diff --git a/docs/BEARING.md b/docs/BEARING.md index 3d158efe..bfbc5ffb 100644 --- a/docs/BEARING.md +++ b/docs/BEARING.md @@ -3,7 +3,7 @@ # BEARING -Last updated: 2026-06-03. +Last updated: 2026-06-15. This signpost summarizes current direction. It does not create commitments or replace backlog items, design docs, retros, or CLI status. If it disagrees with @@ -12,6 +12,12 @@ code, the code wins and this file should be corrected. The WARP paper-to-Echo noun map is maintained in `docs/design/warp-optic-implementation-map.md`. +The post-PR #545 strands and braids hardening roadmap is maintained in +`docs/design/braids-and-strands-roadmap.md`. + +Its goalpost design packet is maintained under +`docs/design/braids-and-strands-hardening/`. + The feature bar for the eventual `v0.1.0` release is maintained in `docs/design/v0.1.0-release-plan.md`. @@ -47,12 +53,22 @@ but production Echo code must remain generic. ## Current Bearing +The active architecture hardening focus is the post-PR #545 braids and strands +campaign. Track progress through the goalpost and slice checklist in +`docs/design/braids-and-strands-roadmap.md`. Each goalpost has a focused design +document under `docs/design/braids-and-strands-hardening/`; implementation PRs +must check off slices in the roadmap only when the slice actually lands. + +This hardening campaign does not replace the `v0.1.0` external-app release +gate. It protects the newly landed strand, braid, proof, sealed-member, +identity, witness, and plurality surfaces before more callers depend on them. + Echo has a local witnessed intent pipeline into deterministic execution: application ingress can become witnessed submission history, lawful admission evidence, ticketed runtime ingress, scheduler-owned handler dispatch, receipt correlation, and observable intent outcome. -The current priority is to prove that pipeline with `jedit` as a real external +The release priority remains proving that pipeline with `jedit` as a real external consumer. The in-repo external fixture remains valuable, but it is no longer the `v0.1.0` release gate. Echo is not ready to release until jedit can submit an application-owned contract intent, let a trusted Echo host authorize diff --git a/docs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.md b/docs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.md new file mode 100644 index 00000000..2ada7622 --- /dev/null +++ b/docs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.md @@ -0,0 +1,73 @@ + + + +# Goalpost 1: Lawful Construction And Typed Failures + +Status: planned. + +Roadmap: +[`../braids-and-strands-roadmap.md`](../braids-and-strands-roadmap.md) + +## Decision Summary + +Echo will stop presenting law-bearing strand and braid/proof failures as casual +public data shapes. `Strand
` construction moves behind posture-aware doors, +proof validation reports structured `ProofError` variants, and braid transition +failures report typed transition kinds instead of string action names. + +## Invariant + +No law-looking strand value or transition failure is created by accident. +Typestate narrows ordinary construction, but live registry and runtime posture +checks remain the final admission law. + +## Sponsored Human + +A maintainer wants hard API boundaries around strand posture and braid/proof +failures so future refactors cannot create fake `Shared`-looking values or +parse behavior out of display text. + +## Sponsored Agent + +An agent needs typed constructors, fixture builders, and error variants so it +can write regression tests against behavior without inferring invariants from +public fields or error strings. + +## Scope + +This goalpost includes: + +- private or controlled `Strand
` construction; +- read-only accessors where public data remains needed; +- fixture builders for tests; +- structured `ProofError`; +- typed `BraidTransitionKind`; +- negative tests for forged construction and string parsing. + +## Non-Goals + +This goalpost does not include: + +- changing settlement semantics; +- replacing runtime posture checks with typestate; +- adding real cryptographic proof verification; +- adding historical braid membership views. + +## Slices + +| Slice | Work | Witness | +| ------ | -------------------------------------------------- | ------------------------------------------------ | +| GP1-S1 | Make `Strand
` construction posture-aware | compile-fail or API test for public forgery |
+| GP1-S2 | Replace public test construction with fixtures | tests use builders instead of public literals |
+| GP1-S3 | Replace proof validation strings with `ProofError` | tests assert exact error variants |
+| GP1-S4 | Replace action strings with `BraidTransitionKind` | tests assert exact invalid transition kind |
+| GP1-S5 | Add negative capability tests | tests reject forged strands and string contracts |
+
+## Acceptance
+
+- External callers cannot set `_marker` or `retention_posture` directly.
+- `Strand ` carries causal posture as a sealed typestate parameter, while
+ live registry/runtime posture validation remains the final admission law.
+- `Braid::apply` is checked: it rejects invalid lifecycle transitions,
+ duplicate members, mixed member-reference postures, sequence overflow, empty
+ settlement frontiers, and empty collapse witnesses.
+- `ProofEnvelope::validate_shape` admits replay-trace envelope structure and
+ public-input binding only. Cryptographic proof kinds remain reserved until
+ verifier backends exist.
+- `BraidShell::assemble_with_proof` binds proof-envelope identity into shell
+ identity, so proof-bearing and proofless shells do not collide.
+- Sealed braid members require secure query material and no longer leak behind
+ generic member lookup APIs.
+- Settlement member blinding has explicit salt input and deterministic default
+ derivation for reproducible local flows.
+
+## Progress Tracker
+
+Check off a slice only in the PR that implements or lands that slice. Design
+approval alone does not complete implementation slices unless the slice is
+explicitly design-only. The roadmap stays as the live progress register for
+this campaign.
+
+### Goalpost 1: Lawful Construction And Typed Failures
+
+Design:
+[`goalpost-01-lawful-construction-and-typed-failures.md`](braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.md)
+
+- [ ] GP1-S1: Make `Strand ` construction posture-aware and non-forgeable
+ through public API.
+- [ ] GP1-S2: Replace public test construction with fixture builders.
+- [ ] GP1-S3: Replace proof validation strings with structured `ProofError`.
+- [ ] GP1-S4: Replace braid transition action strings with
+ `BraidTransitionKind`.
+- [ ] GP1-S5: Add negative capability tests for forged strands and display
+ string parsing.
+
+### Goalpost 2: Stable Identity And Privacy Posture
+
+Design:
+[`goalpost-02-stable-identity-and-privacy-posture.md`](braids-and-strands-hardening/goalpost-02-stable-identity-and-privacy-posture.md)
+
+- [ ] GP2-S1: Add golden vectors for replay-trace `ProofEnvelope` identity.
+- [ ] GP2-S2: Add proofless and proof-bearing `BraidShell` identity vectors.
+- [ ] GP2-S3: Add revealed and sealed `BraidMemberRef` vectors, including salt
+ effect.
+- [ ] GP2-S4: Mark vector compatibility classes and migration/versioning rules.
+- [ ] GP2-S5: Document deterministic blinding salt risk in API docs and
+ privacy-sensitive examples.
+
+### Goalpost 3: Historical Membership And Replay
+
+Design:
+[`goalpost-03-historical-membership-and-replay.md`](braids-and-strands-hardening/goalpost-03-historical-membership-and-replay.md)
+
+- [ ] GP3-S1: Promote append-only braid membership into an implementation
+ design.
+- [ ] GP3-S2: Add historical membership views by coordinate or event sequence.
+- [ ] GP3-S3: Add membership diff facts for added, ended, revealed, and
+ concealed changes.
+- [ ] GP3-S4: Add replay/audit facts for member verdicts, posture floors,
+ proof binding, retained support, frontier, and witness posture.
+- [ ] GP3-S5: Define the Braid Flight Recorder and Causal X-Ray lower-mode
+ output.
+
+### Goalpost 4: Witness Receipts And Sealed Capabilities
+
+Design:
+[`goalpost-04-witness-receipts-and-sealed-capabilities.md`](braids-and-strands-hardening/goalpost-04-witness-receipts-and-sealed-capabilities.md)
+
+- [ ] GP4-S1: Define `WitnessReceipt`, `WitnessKind`, and `WitnessBackend`.
+- [ ] GP4-S2: Add deterministic witness simulator fixtures for supported,
+ rejected, and unsupported outcomes.
+- [ ] GP4-S3: Bind witness identity only through explicit compatibility rules.
+- [ ] GP4-S4: Design purpose-bound sealed membership presentations.
+- [ ] GP4-S5: Add disclosure budget labels and replay wording for sealed
+ membership.
+
+### Goalpost 5: Named Plurality Laws
+
+Design:
+[`goalpost-05-named-plurality-laws.md`](braids-and-strands-hardening/goalpost-05-named-plurality-laws.md)
+
+- [ ] GP5-S1: Define the core plurality law registry shape.
+- [ ] GP5-S2: Add machine-readable Law Cards.
+- [ ] GP5-S3: Bind law name and version into witnessed readings.
+- [ ] GP5-S4: Route adapter-provided law families without application nouns in
+ Echo core.
+- [ ] GP5-S5: Add obstruction evidence for unsupported or unauthorized law
+ execution.
+
+## North Star
+
+Echo must feel less like a crate full of important structs and more like a
+causal operating system with lawful doors:
+
+| Today | Target |
+| ------------------------------- | ---------------------------------------------- |
+| Constructing a `Strand` | admitted through posture-aware constructors |
+| Creating a `Braid` | emitted as an authority-scoped event |
+| Adding a member | witnessed as `MemberWoven` history |
+| Settling | admitted as a shared settlement act |
+| Attaching proof evidence | carried by verifier-shaped receipts |
+| Reading a shell | replayed through an audit optic |
+| Sealing a member | backed by authority/capability-local blinding |
+| Interpreting retained plurality | governed by named settlement and collapse laws |
+
+Every important causal claim must answer:
+
+1. Who admitted this?
+2. Under what authority?
+3. With what posture?
+4. Bound to what identity?
+5. Replayable by whom, revealing how much?
+
+The vocabulary stays sharp:
+
+| Term | Meaning |
+| ------------------ | -------------------------------------------------------- |
+| Struct | Represents a fact. |
+| Constructor | Admits a fact through a named door. |
+| Witness | Supports a fact with evidence. |
+| Replay | Explains a fact from recorded causes. |
+| Law | Interprets a fact under named authority and posture. |
+| Digest | Preserves the identity of a fact. |
+| Admission | Decides whether a claim enters Echo history. |
+| Settlement | Admits history; it is not merge semantics. |
+| Projection | Materializes one bounded reading from admitted history. |
+| Sealed member | Hides member identity behind authorized proof material. |
+| Revealed member | Exposes member identity directly. |
+| Posture floor | Lowest causal posture the reading can honestly claim. |
+| Retained plurality | Preserved multiple claims not collapsed to one fact. |
+| Collapse law | Named law that interprets or reduces retained plurality. |
+
+Claim lifecycle:
+
+```text
+created -> admitted -> projected -> witnessed -> replayed -> interpreted
+```
+
+## Dependency Graph
+
+This is a dependency chain, not a menu.
+
+| Item | Depends on | Why |
+| -------------------------------- | --------------------------------------- | --------------------------------------------------- |
+| Private `Strand ` construction | PR #545 final model | prevents typestate-looking forgery |
+| Structured errors | current proof and braid APIs | stops tests and callers from parsing strings |
+| Golden vectors | current digest and proof binding | freezes identity semantics |
+| Blinding salt docs and tests | current sealed member API | prevents reproducibility from being sold as privacy |
+| Historical braid membership | checked `BraidEvent` model | turns event log into source of truth |
+| Replay optic | shell identity and historical views | shows lawful reading |
+| External witness receipts | golden vectors and typed proof errors | prevents witness model drift |
+| Sealed membership capability | blinding docs and historical membership | prevents privacy overclaim |
+| Named plurality laws | replay optic and witness boundary | makes interpretation law visible |
+
+## Ownership Labels
+
+Each item owns a primary surface so issue triage stays narrow.
+
+| Item | Surface |
+| ---: | ----------------------- |
+| 1 | API/runtime |
+| 2 | API/testability |
+| 3 | digest compatibility |
+| 4 | privacy/API |
+| 5 | runtime/history |
+| 6 | replay/agent inspection |
+| 7 | witnessing/API |
+| 8 | privacy/capability |
+| 9 | law machinery/design |
+
+## Universal Definition Of Done
+
+Every issue created from this roadmap MUST include:
+
+1. One failing regression witness before the fix, unless the issue is
+ explicitly design-only.
+2. One focused implementation change.
+3. One stable test, vector, fixture, replay fact, or deterministic integration
+ proof.
+4. Documentation when public semantics, privacy posture, digest identity, or
+ replay output changes.
+5. No hidden reliance on parsing display strings.
+6. No public constructor that bypasses law-bearing validation.
+7. No weakening of live runtime posture or registry checks.
+8. No application-domain nouns in Echo core.
+
+Design-only issues MUST name the later runtime, API, golden-vector, replay, or
+deterministic integration witness that closes the claim.
+
+## Issue Output Format
+
+Every execution issue created from this roadmap MUST include:
+
+1. Invariant being protected.
+2. Failing witness.
+3. Implementation surface.
+4. Compatibility class affected.
+5. Acceptance test.
+6. Documentation, vector, or replay impact.
+
+## Non-Goals
+
+This roadmap slice does not include:
+
+- Real ZK backend implementation.
+- Application-domain law nouns in Echo core.
+- Settlement-as-merge semantics.
+- Any promise that deterministic member blinding defaults provide
+ unlinkability.
+- Replacement of runtime admission checks with typestate alone.
+- Current-only braid history.
+- Self-witness branding as independent attestation.
+
+## Threat Model Notes
+
+- Sealed member references hide global strand identity only when blinding
+ material remains non-public and is not reused across unlinkability domains.
+- The deterministic default salt is for reproducibility, not unlinkability.
+ Privacy-preserving flows MUST provide authority-local, capability-local, or
+ session-local blinding material.
+- Authority-local and capability-local salts are the preferred privacy
+ boundary.
+- Replay MUST reveal what was lawfully proven without revealing concealed
+ source chains beyond the requested aperture.
+- `SelfWitness` means integrity-only local witness unless an external receipt
+ says otherwise.
+- Typestate is a guardrail. Runtime admission is the courthouse.
+
+## Compatibility Classes
+
+Golden vectors and replay fixtures MUST mark identity stability explicitly:
+
+| Class | Rule |
+| -------------------------- | ------------------------------------------------------------- |
+| Public stable identity | MUST NOT change without migration note and compatibility plan |
+| E1 scaffolding identity | Changes require an explicit compatibility note |
+| Test-only fixture identity | Carries no compatibility promise beyond the fixture |
+
+Intentional digest, proof, shell, witness, or replay identity changes MUST
+state which compatibility class changed and how callers migrate.
+
+Any public stable identity change MUST include a migration path, a version
+bump, or an explicit declaration that no prior stable identity was published.
+
+## Execution Order
+
+### 1. Seal The Constructor Boundary
+
+Surfaces: API/runtime.
+
+Depends on: PR #545 final model.
+
+Goal: callers MUST NOT fabricate law-looking strand values with public struct
+literals.
+
+Work:
+
+1. Make `Strand ` fields private where possible.
+2. Add accessors for read-only public data.
+3. Add named constructors or builders for `DynamicPosture`, `Scratch`,
+ `AuthorOnly`, and `Shared` paths.
+4. Keep registry/runtime checks authoritative.
+5. Move tests to fixture builders instead of public struct literals.
+6. Ensure the public API cannot construct a value whose type-level posture and
+ runtime retention posture disagree.
+
+Acceptance:
+
+- External callers cannot set `_marker` or `retention_posture` directly.
+- Existing registry and settlement tests still prove stale or forged handles
+ cannot bypass runtime posture validation.
+- Public API docs state that typestate narrows normal construction but does
+ not replace live admission checks.
+- Negative tests prove `Strand ` construction plus fixture builders | typestate-looking forgery remains API-shaped |
+| B | `ProofError` plus `BraidTransitionKind` | callers parse strings |
+| C | Golden vectors | digest drift goes undetected |
+| D | Blinding salt docs and tests | reproducibility gets mistaken for privacy |
+| E | Historical braid membership views | event history degrades into current-only state |
+| F | Replay and audit optic | law-bearing readings remain hard to inspect |
+| G | `WitnessReceipt` boundary plus simulator fixtures | self-witness scaffolding becomes permanent model |
+| H | Sealed membership capability design | sealed membership turns into privacy theater |
+| I | Named plurality law registry design | interpretation policy hides in callers |
+
+PRs A-D are the hardening foundation. PRs E-I MUST NOT introduce runtime or
+public API dependencies that bypass A-D.
+
+## Mandatory Negative Capability Tests
+
+The execution issues MUST include negative witnesses for these claims:
+
+- Cannot construct `Strand ` | public construction weakens typestate | private fields plus fixture builders |
+| 2 | `ProofEnvelope` | validation returns strings | structured `ProofError` |
+| 3 | digest identity | no golden vectors yet | proof and shell vector fixtures |
+| 4 | `Braid::apply` | transition names are strings | typed `BraidTransitionKind` |
+| 5 | settlement blinding | deterministic default invites overtrust | sharper docs and salt-path tests |
+| 6 | braid shell witnessing | self-witness is only E1 scaffolding | named witness receipt design |
+
+## Promoted Design Targets
+
+These ideas are promoted into the roadmap as ordered extensions. They are
+mandatory design targets, but they MUST respect the dependency graph.
+
+| Rank | Idea | Required placement |
+| ---: | ------------------------------------ | ------------------ |
+| 1 | Braid Flight Recorder | replay optic |
+| 2 | Causal X-Ray CLI | replay optic |
+| 3 | Privacy Budget Labels | sealed capability |
+| 4 | Law Cards | plurality laws |
+| 5 | Witness Backend Simulator | witness receipts |
+| 6 | Historical Membership Diff | historical views |
+| 7 | Sealed Membership Presentation Token | sealed capability |
+
+## Sequencing Guardrails
+
+- Do not implement real ZK or vector-opening verification until the verifier
+ boundary and golden vectors are in place.
+- Do not make self-witness mean independent attestation.
+- Do not treat typestate as the only authority; live runtime posture checks
+ remain final.
+- Do not rewrite settlement as merge semantics. Settlement admits history;
+ it does not pretend braided strands became one published truth.
+- Do not let application nouns enter Echo core while adding plurality laws or
+ replay tools.
+- Do not make current braid membership the only queryable shape once event
+ history exists.
+- Do not implement witness backends before typed proof errors, witness receipt
+ identity, and simulator fixtures exist.
+- Do not implement sealed membership capability before blinding docs,
+ salt-effect vectors, and historical membership are in place.
+
+## Issue Seeds
+
+Live backlog is GitHub Issues. These are ready to turn into issues when this
+roadmap is pulled into execution:
+
+1. Private `Strand ` construction and fixture builders.
+2. Structured `ProofError` and typed braid transition kinds.
+3. Golden vectors for proof envelope and braid shell identity.
+4. Blinding salt privacy docs and salt-path tests.
+5. Append-only braid membership historical views and membership diff.
+6. Braid replay, Braid Flight Recorder, and Causal X-Ray optic.
+7. External witness receipt boundary and witness backend simulator.
+8. Purpose-bound sealed membership capability with disclosure budgets.
+9. Named plurality law registry with Law Cards.
+
+Each issue MUST carry one executable witness. Design-only issues MUST state
+which later runtime, API, golden-vector, replay, or deterministic integration
+proof closes the claim.
diff --git a/docs/index.md b/docs/index.md
index 94815f83..84821acf 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -12,6 +12,7 @@ Echo's live documentation centers on the runtime carrier, the retained witnesses
- Application contract hosting: [/architecture/application-contract-hosting](/architecture/application-contract-hosting)
- Local contract host quickstart: [/quickstart-local-contract-host](/quickstart-local-contract-host)
- WARP optic implementation map: [/design/warp-optic-implementation-map](/design/warp-optic-implementation-map)
+- Braids and strands hardening roadmap: [/design/braids-and-strands-roadmap](/design/braids-and-strands-roadmap)
- Echo v0.1.0 release plan: [/design/v0.1.0-release-plan](/design/v0.1.0-release-plan)
- Echo v0.1.0 jedit release gate: [/design/v0.1.0-jedit-release-gate](/design/v0.1.0-jedit-release-gate)
- Trusted runtime control history: [/design/trusted-runtime-control-history](/design/trusted-runtime-control-history)
@@ -30,6 +31,12 @@ Echo's live documentation centers on the runtime carrier, the retained witnesses
## Settlement And Replay
+- Braids and strands hardening roadmap: [/design/braids-and-strands-roadmap](/design/braids-and-strands-roadmap)
+- Goalpost 1, lawful construction and typed failures: [/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures](/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures)
+- Goalpost 2, stable identity and privacy posture: [/design/braids-and-strands-hardening/goalpost-02-stable-identity-and-privacy-posture](/design/braids-and-strands-hardening/goalpost-02-stable-identity-and-privacy-posture)
+- Goalpost 3, historical membership and replay: [/design/braids-and-strands-hardening/goalpost-03-historical-membership-and-replay](/design/braids-and-strands-hardening/goalpost-03-historical-membership-and-replay)
+- Goalpost 4, witness receipts and sealed capabilities: [/design/braids-and-strands-hardening/goalpost-04-witness-receipts-and-sealed-capabilities](/design/braids-and-strands-hardening/goalpost-04-witness-receipts-and-sealed-capabilities)
+- Goalpost 5, named plurality laws: [/design/braids-and-strands-hardening/goalpost-05-named-plurality-laws](/design/braids-and-strands-hardening/goalpost-05-named-plurality-laws)
- DPO concurrency litmus: [/spec/SPEC-0003-dpo-concurrency-litmus-v0](/spec/SPEC-0003-dpo-concurrency-litmus-v0)
- Rewrite scheduler: [/spec/scheduler-warp-core](/spec/scheduler-warp-core)
- Canonical inbox sequencing: [/spec/canonical-inbox-sequencing](/spec/canonical-inbox-sequencing)