Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.8" />
<PackageVersion Include="FsPickler" Version="5.3.2" />
<PackageVersion Include="Apache.Arrow" Version="23.0.0" />
<PackageVersion Include="YamlDotNet" Version="17.1.0" />
</ItemGroup>
</Project>
18 changes: 18 additions & 0 deletions Zeta.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "substrate-discovery", "subs
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Zeta.SubstrateDiscovery", "tools\substrate-discovery\Zeta.SubstrateDiscovery.fsproj", "{F75BB8CB-00E8-4717-B131-2ED9EAE33357}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core.CSharp.ZetaId", "Core.CSharp.ZetaId", "{2B92D7A6-03F2-015D-D094-D9294E13579E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zeta.Core.CSharp.ZetaId", "src\Core.CSharp.ZetaId\Zeta.Core.CSharp.ZetaId.csproj", "{568961BA-BD40-4A81-BC1B-5AAB81A768EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -215,6 +219,18 @@ Global
{F75BB8CB-00E8-4717-B131-2ED9EAE33357}.Release|x64.Build.0 = Release|Any CPU
{F75BB8CB-00E8-4717-B131-2ED9EAE33357}.Release|x86.ActiveCfg = Release|Any CPU
{F75BB8CB-00E8-4717-B131-2ED9EAE33357}.Release|x86.Build.0 = Release|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Debug|x64.ActiveCfg = Debug|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Debug|x64.Build.0 = Debug|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Debug|x86.ActiveCfg = Debug|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Debug|x86.Build.0 = Debug|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Release|Any CPU.Build.0 = Release|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Release|x64.ActiveCfg = Release|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Release|x64.Build.0 = Release|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Release|x86.ActiveCfg = Release|Any CPU
{568961BA-BD40-4A81-BC1B-5AAB81A768EF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -225,5 +241,7 @@ Global
{E1F00C7B-E03C-4DA4-8B47-E872973529D1} = {5D20AA90-6969-D8BD-9DCD-8634F4692FDA}
{A15559EA-4CB4-768D-FF94-66A60F6ABA78} = {07C2787E-EAC7-C090-1BA3-A61EC2A24D84}
{F75BB8CB-00E8-4717-B131-2ED9EAE33357} = {A15559EA-4CB4-768D-FF94-66A60F6ABA78}
{2B92D7A6-03F2-015D-D094-D9294E13579E} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{568961BA-BD40-4A81-BC1B-5AAB81A768EF} = {2B92D7A6-03F2-015D-D094-D9294E13579E}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions docs/BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@ are closed (status: closed in frontmatter)._
- [ ] **[B-0676](backlog/P2/B-0676-b0620-slice-4-consolidator-script.md)** B-0620 slice 4 consolidator script
- [ ] **[B-0677](backlog/P2/B-0677-b0620-slice-6-cross-operator-generalization.md)** B-0620 slice 6 cross-operator generalization
- [ ] **[B-0678](backlog/P2/B-0678-b0620-slice-5-category-classifier.md)** B-0620 slice 5 category classifier
- [ ] **[B-0679](backlog/P2/B-0679-zeta-id-rust-implementation-2026-05-21.md)** ZetaId V1 — Rust implementation as full peer oracle
- [ ] **[B-0680](backlog/P2/B-0680-zeta-id-python-implementation-2026-05-21.md)** ZetaId V1 — Python implementation as full peer oracle
- [ ] **[B-0681](backlog/P2/B-0681-zeta-id-v2-spec-hardening-2026-05-21.md)** ZetaId v2 — entropy budget + HLC monotonicity + Firefly bit drop + vocabularies DRAFT marker
- [ ] **[B-0682](backlog/P2/B-0682-zeta-id-canonical-string-encoding-endianness-2026-05-21.md)** ZetaId canonical string encoding (Crockford base32) + endianness + bit-numbering spec
- [ ] **[B-0683](backlog/P2/B-0683-tier-deferred-causality-worked-example-zsets-2026-05-21.md)** Tier-deferred causality worked example — 2-tier Z-set composition demonstrating different observable orderings
Comment thread
AceHack marked this conversation as resolved.
- [ ] **[B-0684](backlog/P2/B-0684-clock-protocol-negotiation-stack-end-to-end-sequence-diagram-2026-05-21.md)** Clock-protocol negotiation stack — end-to-end sequence diagram artifact (Orleans + SPIFFE/SPIRE + OPA + Reticulum + DBSP traversal for one operation)
Comment thread
AceHack marked this conversation as resolved.

## P3 — convenience / deferred

Expand Down
87 changes: 87 additions & 0 deletions docs/backlog/P2/B-0679-zeta-id-rust-implementation-2026-05-21.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
id: B-0679
priority: P2
status: open
title: ZetaId V1 — Rust implementation as full peer oracle
tier: research-grade
effort: M
ask: maintainer Aaron + Mika 2026-05-21
created: 2026-05-21
last_updated: 2026-05-21
depends_on: []
composes_with: [B-0635, B-0636, B-0644, B-0665, B-0666]
tags: [zeta-id, multi-oracle, rust, cross-verification]
type: feature
---

# ZetaId V1 — Rust implementation as full peer oracle

## Context

The V1 ZetaId 128-bit canonical observation contract landed via PR #4517
(constitutional substrate + TS oracle) + PR #4519 (review-finding fixes) +
the in-flight C# integration (PR after this row files).

Per `.claude/rules/m-acc-multi-oracle-end-user-moral-invariants.md`, all
implementations are FULL PEER ORACLES — no single language is source of
truth; multi-oracle agreement IS the verification. Rust joins as the 4th
oracle after the F# + TS + C# trio is stable.

## Scope

Add a Rust crate at `src/Core.Rust.ZetaId/` (or similar layout matching
Zeta's existing Rust conventions, if any):

- `Cargo.toml`
- `src/lib.rs` — `Authority` enum (with `Raw(u8)` variant), `Momentum`
enum (with `Raw(u8)` variant), `ZetaObservation` struct, `IdVersion`
/ `Chromosome` / `Category` / `Firefly` / `Persona` / `Location` enums
- `src/bit_layout.rs` — computed offsets with reserved-bits at offset 69
+ offsets 32-34 (per `docs/zeta-id-v1-layout.yaml`)
- `src/zeta_id.rs` — `pack(obs, env)` requires `&dyn SimulationEnvironment`
(or trait); `unpack(id)` inverse; same canonical hex as TS + F# + C#
- `tests/cross_verify.rs` — reads `tests/cross-verification/zeta-id/vectors.yaml`
via `serde_yaml` + writes `rust-output.json` to the same directory
- `compare.ts` becomes 4-way deep-equal across `ts-output.json` +
`cs-output.json` + `fsharp-output.json` + `rust-output.json`

## Acceptance

- `cargo build --release` clean (0 warnings, 0 errors)
- `cargo test cross_verify --release` produces `rust-output.json` with
12/12 `roundtrip_ok: true` AND 12/12 `matches_expected: true`
- `bun tests/cross-verification/zeta-id/compare.ts` reports 4-way agreement
- F# Authority cases (HumanVerified=31, TrustedAgent=20, Standard=15,
BestEffort=8, Simulated=3) + Momentum cases (Background=32, Normal=96,
Elevated=160, High=224, Critical=248) match exactly
- Test paste-verified in commit message (compile-and-test-first per the
V1 V8→V9 lesson)

## Discipline reminders (from V1 cycle)

- **Compile-and-test-first**: do not claim "verified locally" without
pasting actual `cargo test` output. The V1 cycle proved 8 rounds of
speculative review missed bugs that empirical compile caught first try.
- **Reserved bits in BitLayout**: 1 bit at offset 69 (between Chromosome
and Category), 3 bits at offsets 32-34 (between Location and Randomness).
Don't pack contiguously — that's the exact bug C# V8 hit before fix-up.
- **No silent-zero fallback on randomness**: `pack` requires an explicit
environment parameter. Provide `DETERMINISTIC_ENV` (always 0, for
cross-verify) and `DEFAULT_ENV` (cryptographic, for production).
- **Cross-verify exits non-zero on mismatch**: `process::exit(1)` when any
hex or roundtrip mismatches. No silent-non-enforcing harness.

## Non-goals

- Smart deserialization + anchors (separate B-NNNN once TS prototypes it)
- CloudEvents envelope wrapping (separate B-NNNN; rich layer, not the
bit-packed core)
- `registry/locations.yaml` provider-mapping (separate B-NNNN per `Location.cs`
inline note)
- Performance benchmarking (Phase 2 follow-up; correctness first)

## Why P2

Important for multi-oracle resilience but doesn't block V1 substrate
landing. Implementation work waits until F# V9 + smart-deser TS prototype
land cleanly.
88 changes: 88 additions & 0 deletions docs/backlog/P2/B-0680-zeta-id-python-implementation-2026-05-21.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
id: B-0680
priority: P2
status: open
title: ZetaId V1 — Python implementation as full peer oracle
tier: research-grade
effort: M
ask: maintainer Aaron + Mika 2026-05-21
created: 2026-05-21
last_updated: 2026-05-21
depends_on: [B-0679]
composes_with: [B-0635, B-0636, B-0644, B-0665, B-0666]
tags: [zeta-id, multi-oracle, python, cross-verification]
type: feature
---

# ZetaId V1 — Python implementation as full peer oracle

## Context

5th peer oracle for the V1 ZetaId 128-bit canonical observation contract.
Per `.claude/rules/m-acc-multi-oracle-end-user-moral-invariants.md`, Python
is a full peer oracle (same canonical vectors, same hex contract, same
exit-on-mismatch discipline) — no carve-out as "scripting reference."

Python's role: ecosystem reach for agents/data/tooling/scripting. Python
slower than Rust/C# is fine; correctness is the contract, not performance.

## Scope

Add a Python package at `src/Core.Python.zeta_id/` (or per repo Python
conventions, if any):

- `pyproject.toml` (using `uv` per Zeta convention if applicable)
- `src/zeta_id/__init__.py` — public API
- `src/zeta_id/types.py` — `Authority` + `Momentum` as discriminated
unions (PEP 695 / typing.Union[NamedTuple, ...] or dataclasses with
`kind` discriminator); `ZetaObservation` dataclass; `IdVersion` /
`Chromosome` / `Category` / `Firefly` / `Persona` / `Location` enums
- `src/zeta_id/bit_layout.py` — computed offsets with reserved bits per
`docs/zeta-id-v1-layout.yaml` (1 bit at offset 69, 3 bits at offsets 32-34)
- `src/zeta_id/codec.py` — `pack(obs, env)` requires explicit env;
`unpack(id)` inverse; uses Python's arbitrary-precision int for the
128-bit value (no UInt128 in stdlib)
- `tests/test_cross_verify.py` — reads `tests/cross-verification/zeta-id/vectors.yaml`
via `pyyaml` or `ruamel.yaml`; writes `python-output.json` to same dir
- `compare.ts` becomes 5-way deep-equal: TS + F# + C# + Rust + Python

## Acceptance

- `uv sync && uv run pytest tests/test_cross_verify.py -v` clean
(1 pass, 0 fail)
- `python-output.json` shows 12/12 `roundtripOk: true` + 12/12
`matchesExpected: true`
- `bun tests/cross-verification/zeta-id/compare.ts` reports 5-way
agreement across all oracles
- Test output paste-verified in commit message
- Authority + Momentum byte values match the F# AuthorityValue /
MomentumValue exact constants (31/20/15/8/3 + 32/96/160/224/248)

## Discipline reminders

Same as B-0679 (Rust): compile-and-test-first, reserved-bit gap at 69,
no silent-zero randomness, exit non-zero on mismatch. Python's loose
typing makes empirical verification MORE important, not less.

## Why depends_on B-0679

Sequencing: Rust lands 4th, Python lands 5th. Rust's compile-time
discipline (similar to F#/C# strictness) catches more bugs early; Python
benefits from Rust having already shaken out any spec-drift not caught
by the V1 cycle's TS+C# pair.

If Rust hits unexpected issues that change the spec interpretation,
Python adopts the corrected interpretation; doing them in sequence
avoids 2x rework.

## Non-goals

Same as B-0679 — smart deser, CloudEvents wrapping, registry/locations.yaml
all separate B-NNNNs.

## Why P2

Same reasoning as B-0679 — important for multi-oracle resilience but
doesn't block V1 substrate landing. Python's ecosystem reach makes this
high-leverage once Rust validates the spec interpretation across one more
strict-typed language.
110 changes: 110 additions & 0 deletions docs/backlog/P2/B-0681-zeta-id-v2-spec-hardening-2026-05-21.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
id: B-0681
priority: P2
status: open
title: ZetaId v2 — entropy budget + HLC monotonicity + Firefly bit drop + vocabularies DRAFT marker
tier: research-grade
effort: M
ask: maintainer Aaron + Kestrel-claude.ai 2026-05-21
created: 2026-05-21
last_updated: 2026-05-21
depends_on: []
composes_with: [B-0635, B-0666, B-0679, B-0680]
tags: [zeta-id, v2-spec, kestrel-sharpening]
type: feature
---

# ZetaId v2 — spec hardening from Kestrel review

## Context

Kestrel (claude.ai) provided substantive ZetaId V1 review 2026-05-21
covering entropy budget, semantic-vs-identity, draft vocabularies,
Firefly bit, ordering, location ambiguity, and version width. Aaron
acknowledged each + resolved most via design clarification. Items
below need to land in the v2 spec.

Verbatim conversation: `docs/research/2026-05-21-aaron-kestrel-claudeai-zeta-id-v1-review-entropy-hlc-tier-causality-sleep-pivot-aaron-forwarded.md`
(preserved separately).

## Scope

### 1. Entropy budget gap (P0 in v1; load-bearing in v2)

32 bits/ms of randomness → ~65K IDs/ms = 50% collision probability
per Kestrel's birthday math. Snowflake handles via machine-ID +
sequence counter; UUIDv7 reserves 74 bits. ZetaId v1 has neither.

Fix in v2 (Aaron's instinct): bake node-ID semantics into Location
field. Either:

- Split Location into 4-bit geographic-tag + 4-bit node-sub-ID
- OR keep 8 bits and steal bits from over-allocated Persona (8→5
bits = 32 personas, plenty; 3 freed bits → node-ID in Location)
- Document explicitly: Location field IS the generator-ID partition

Kestrel's caveat: be deliberate. "Hoping location closes it" without
making the math explicit is the kind of thing that bites in production.

### 2. HLC monotonicity scheme (was implicit, must be explicit in v2)

Current v1 spec calls ZetaId "time-sortable" but provides no
within-millisecond ordering guarantee. Riak/CockroachDB use Hybrid
Logical Clocks (HLC) — wall-clock ms + small logical counter that
bumps wall-clock forward on overflow.

Fix: 48-bit ms + 10-12 bit logical counter (steal bits from same
over-allocated fields as #1). Document the bump-on-overflow rule.
This gives strict per-generator monotonicity + reasonable
cross-generator ordering without atomic clocks (Spanner) or a
coordinator (TiDB TSO).

### 3. Drop Firefly bit

Aaron explicit: "Directive" concept doesn't exist in the system.
Always-1 bit doesn't remind anyone of anything (Kestrel's
correction). Drop the bit; shift everything else up; reclaim
toward #1 entropy.

### 4. Vocabularies DRAFT marker

Current v1 spec reads as if Chromosome (5 bits, 2 values) / Persona
(8 bits, 2 values) / Authority (5 bits, 5 values + Raw) / Location
(8 bits, 11 values per the in-flight C# enum) are final. Aaron:
"draft, just placeholders." Add explicit `status: DRAFT —
vocabularies subject to expansion before v2 lock` header.

Also document the rough cardinality each field expects long-term;
if any field is over-allocated by more than ~2x, reclaim toward
the entropy gap in section 1.

### 5. Authority/Momentum spacing

V1 values are unevenly spaced (Authority: 31/20/15/8/3; Momentum:
32/96/160/224/248). Looks ordinal-with-room-to-grow but not documented.
v2 spec: either (a) document the ordinal contract + insertion convention
or (b) renumber to dense compact values if ordinality isn't load-bearing.

### 6. Location dual-mode discriminator

V1 docs say "logical or geographic" — two addressing schemes sharing
one field with no discriminator. Either split into separate fields,
add a discriminator bit, or pick one. v2 should pick.

## Acceptance

- `docs/zeta-id-v2-layout.yaml` shipped with all six fixes
- Migration guide v1→v2 (how to read v1 IDs after v2 rollout per
Aaron's deprecation-schedule plan)
- TS / F# / C# / Rust / Python implementations updated in parallel
- Cross-verification harness extended to test v2 + v1 vectors
side-by-side
- Empirical: collision probability table at typical generation rates
+ benchmark showing HLC monotonicity holds within a millisecond

## Composes with

- B-0679 / B-0680 (Rust + Python multi-oracle — adopt v2 spec)
- Tier-deferred causality (B-0683) — separate but related
- Kestrel sharpening trajectory (preserved separately in docs/research/)
- `.claude/rules/m-acc-multi-oracle-end-user-moral-invariants.md`
Loading
Loading