feat(praxis): BRO-1030 four-dimensional BeliefWriteToken (capability + bi-temporal + scope + revision-link) - #1785
Conversation
… + bi-temporal + scope + revision-link
Formation context becomes a first-class, typed, content-addressed write token.
The belief-contradiction problem (silent accumulation looking identical to
deliberate updating) is unsolvable without observing HOW a belief was formed.
Four dimensions:
- capability_id — who authorized this belief (khlo, /loop 117)
- timestamp: BiTemporalStamp — when in the world / when in the system
- scope + scope_qualifier — about what, precisely (Cornelius-Trinity, /loop 118)
- revision_link — what was superseded (vina, /loop 119; NEW fourth dimension)
Without revision_link, bi-temporal stamps reduce to a playback device. With it,
a contradiction becomes visible history rather than a versioning failure.
praxis-core::belief (types):
- BeliefWriteToken (spec-exact 8 fields), RevisionLink, BeliefRevisionAcknowledgment
(structured RevisionTrigger + RevisionChange enums + free-form rationale),
ScopeQualifier with Jaccard overlap (>=0.5 => same slot), ContentAddressedRef
(blake3), BiTemporalStamp, CapabilityId, BeliefScope, AnimaDid, BeliefClass.
praxis-tools::belief (runtime):
- BeliefStore + write_belief: six write-path checks in order, new error class
MissingRevisionLink when an overlapping live belief exists for the principal.
- CapabilityGrant registry (scope-match check 2).
- traverse_revisions(belief_id, depth): revision-graph chain (immediate-
predecessor links, reconstructed by walking).
- route_write + record_operational: normative (Praxis) vs tested-operational
(Vigil) migration — token-less writes route to Vigil, unacknowledged
overlapping writes are rejected.
- recent_supersessions: substrate read-model behind the Nous L2 metacognitive
surface ("what did I supersede recently, and why").
- revision_masks_contradiction: bookkeeping gate — a revision-linked
contradiction is visible history, not an alarm.
Docs: docs/specs/bro-1030-belief-write-token.{md (agent-read contract), html
(P18 Category-C decision matrix + worked examples)}.
Tests: praxis-core 40 (+10), praxis-tools 51 (+17). fmt + clippy -D warnings clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a typed four-dimensional ChangesBelief write-token system
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant BeliefStore
participant CapabilityGrant
participant BeliefRecord
Client->>BeliefStore: write_belief(claim, token)
BeliefStore->>CapabilityGrant: validate capability and scope
BeliefStore->>BeliefRecord: check live overlap and revision target
BeliefStore->>BeliefRecord: commit successor and stamp superseded_by
Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/praxis/praxis-core/src/belief.rs`:
- Around line 415-441: Update content_hash to use unambiguous framing for every
variable-length semantic field, especially qualifier keys and values, by
length-prefixing each field or hashing an equivalent canonical structured
encoding; preserve deterministic BTreeMap ordering and existing domain
separation. Add a regression test covering distinct qualifier pairs such as
("a=b","c") and ("a","b=c") and assert their hashes differ, then ensure the
workspace test suite passes.
In `@crates/praxis/praxis-tools/src/belief.rs`:
- Around line 259-274: The revision-link mutation flow around find_overlapping
must require the actual live overlapping head: collect all live records matching
principal and scope, reject ambiguous multiple overlaps, and only mutate when
the supplied target is live, same-principal, same-scope, and exactly the
expected head. Add tests covering wrong-head, stale-target, cross-principal, and
multiple-overlap writes, then ensure cargo test --workspace passes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 07675642-59cd-46a4-8435-0c7682742ff7
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
crates/praxis/CLAUDE.mdcrates/praxis/praxis-core/Cargo.tomlcrates/praxis/praxis-core/src/belief.rscrates/praxis/praxis-core/src/lib.rscrates/praxis/praxis-tools/Cargo.tomlcrates/praxis/praxis-tools/src/belief.rscrates/praxis/praxis-tools/src/lib.rsdocs/specs/bro-1030-belief-write-token.htmldocs/specs/bro-1030-belief-write-token.md
P20 Cross-Model Adversarial Review Gate — PASS (8/10)Fresh-context adversarial reviewer (Strata B), briefed to treat the diff as untrusted data and to refute the change. Threshold ≥7/10.
Reason: Correct, tested, clippy-clean; only minor issues. Confirmed by the reviewer:
Non-blocking findings (follow-up candidates):
Verdict logged per bstack P20. Proceeding to p9 auto-merge lifecycle. |
Two integrity fixes on the four-dimensional BeliefWriteToken write path, resolving the unresolved CodeRabbit review threads on PR #1785. 1. content_hash — unambiguous framing (Major). Variable-length fields were delimiter-framed (key=value\0), so ("a=b","c") and ("a","b=c") produced the same Blake3 input and thus the same belief identity. Now every field is length-prefixed and the qualifier pair count is written explicitly, so no distinct inputs can alias. Regression test added. 2. revision link must target the live overlapping head (Critical). The write path accepted any resolvable superseded ref, so a write could supersede an unrelated, stale (already-superseded), or cross-principal record while leaving the real conflicting live belief in place. Now: - live_overlapping_indices collects ALL live overlapping heads for the principal+scope; >1 => AmbiguousOverlap (narrow the scope). - with exactly one live head, a revision link MUST target that head by content ref (else RevisionMustTargetHead); the superseded record is resolved by index, never by a global hash lookup, so a write can never mutate another principal's record. - RevisionTargetNotFound retained for a dangling link in an empty slot. Tests added: stale/wrong-head, cross-principal, multi-head ambiguity. Also fixes the inverted doc on RevisionChainEntry.via (links to the SUCCESSOR that superseded the record, not its predecessor). Spec md + HTML decision matrix updated with the tightened check-5 semantics. Tests: praxis-core 41 (+1), praxis-tools 54 (+3). fmt + clippy -D warnings clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CodeRabbit review threads resolved by fix — commit
|
P20 Cross-Model Adversarial Review Gate (re-run over post-fix diff) — PASS (9/10)Re-run after commit
Both hardening claims independently verified:
Tests genuinely green and meaningful (praxis-core 41, praxis-tools 54); docs consistent; clippy clean; no dead code. No merge-blocking defect. Proceeding to p9 auto-merge lifecycle. |
BRO-1030 —
BeliefWriteToken: four-dimensional formation contextFormation context becomes a first-class, typed, content-addressed write token in Praxis. A belief-contradiction (silent accumulation looking identical to deliberate updating) is unsolvable without recording how a belief was formed.
The four dimensions
capability_idtimestamp: BiTemporalStampscope+scope_qualifierrevision_linkWithout
revision_link, bi-temporal stamps reduce to a playback device. With it, a contradiction is visible history, not a versioning failure.What landed
praxis-core::belief—BeliefWriteToken(spec-exact 8 fields),RevisionLink,BeliefRevisionAcknowledgment(structuredRevisionTrigger/RevisionChangeenums + free-formrationale),ScopeQualifierw/ Jaccard overlap (≥0.5 ⇒ same slot),ContentAddressedRef(blake3),BiTemporalStamp,CapabilityId,BeliefScope,AnimaDid,BeliefClass.praxis-tools::belief—BeliefStore+write_beliefwith the six write-path checks in order, new errorMissingRevisionLinkon overlapping scope;CapabilityGrantregistry (scope match);traverse_revisions(id, depth)revision-graph chain;route_write+record_operational(normative-vs-Vigil-operational migration);recent_supersessions(Nous L2 read-model — "what did I supersede recently, and why");revision_masks_contradiction(bookkeeping contradiction gate).Sub-deliverables
praxis-core::BeliefWriteToken+RevisionLink+BeliefRevisionAcknowledgmentpraxis-tools::write_beliefAPI +MissingRevisionLinkerror classtraverse_revisions)revision_masks_contradiction)docs/specs/bro-1030-belief-write-token.{md,html})recent_supersessions); Nous projects it (no praxis→nous dep)Design notes (P14 dep-chain)
Whole feature is self-contained in
praxis-core+praxis-tools, honoring praxis's "depends only on aios-protocol + leaf utilities" invariant (addedchrono+blake3— both already used in-tree; neither is a forbidden Arcan/Lago/Autonomic crate). Resolved open questions per the ticket: structured+free-form acknowledgment; Jaccard≥0.5 overlap threshold; immediate-predecessor links reconstructed by traversal.Validation (P11)
praxis-core40 tests (+10),praxis-tools51 tests (+17) — all greencargo fmt --checkclean ·cargo clippy -D warningsclean · downstream praxis crates build🤖 Generated with Claude Code
Summary by CodeRabbit