Repository navigation
feat(memory): evidence-backed claims and relationship-graph substrate (#178 s1) - #239
Merged
Merged
Conversation
Ambisphaeric
force-pushed
the
feat/178-claims-s1
branch
from
July 17, 2026 17:21
d73acb0 to
168a9eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #178 (slice 1 of N — substrate only).
The durable representation for learned relationships the system lacked — a person works on a repo, a repo belongs to an app, an entity relates to an earlier author. This slice lands the SUBSTRATE only: a typed append-only
Claimcontract, a deterministic no-model builder, store + relationship queries, and the honest user-correction path. No surface, no model-enriched semantic claims — named OUT below.What this delivers (per the issue's acceptance criteria)
shared/contracts/src/records/claim.ts): typed, versioned, append-onlyClaim—subject → relation → object, grounded only inevidencerefs (ClaimEvidenceRefover context-packet/moment/distillate) withminItems:1, so a claim with no evidence is unrepresentable at the schema boundary — every claim traces to source observations. Framed proposal-not-truth:source(derived/user),state(provisional/confirmed/corrected/rejected/superseded), deterministicconfidence,ClaimProvenance(builder +evidenceCount= the recorded derivation behind confidence),ClaimCorrection+correctson sovereign user rows, append-onlyrevision/supersedes,firstObserved/lastObserved= honest valid-time from the evidence.ClaimRelation=co-occurs-with · works-on · belongs-to · authored · member-of · relates-to, not an open string: relation is a query axis (and later a UI/semantic axis), so an open string invites un-queryable drift.relates-tois the deliberate generic escape-valve; extending is a reviewed contract change +CLAIM_SCHEMA_VERSIONbump + regen (the MomentKind/SummaryLevel precedent). The enum is COMPLETE now even though slice 1's builder emits onlyco-occurs-with— the sole relation co-occurrence can assert without a model. The semantic kinds are carried by a later judge-enrichment slice (proposals, roadmap: ambient context runtime — canonical ordered execution tracker #189) and by user corrections.apps/engine/src/index/claims.ts): purebuildClaimsderives co-occurrence from entities named together in one ContextPacket's candidates (reusing feat(context): converge separate senses into inspectable ContextPackets #176's converged correlation) or one moment's refs — symmetric endpoints canonically ordered by id, dangling refs never claimed, no evidence ⇒ no claim, confidence a fixed evidence-count map capped <1.0, repeated evidence strengthens only via a NEW revision (never a silent mutation). Content-derived ids ⇒ byte-stable replay (claims-replay.test.ts: same evidence into two fresh stores ⇒ byte-identical). No model this slice.apps/engine/src/index/produce-claims.ts+api/http.ts):materializeClaimsruns AFTER packets materialize, same contained-failure discipline as packets/summaries — never throws, idempotent, batched per session, workspace-isolated.store/workspaces.ts):listClaimsby workspace/session/entity(subject∨object)/relation/source/time, withresolveClaimHeadsresolving derived-supersession AND user-sovereignty before the filters;relatedEntities= the depth-1 walk (entity → claims → counterparts, always returning the backing claim ids — feat(entity): local candidate search and typeahead person confirmation #181's typeahead substrate); threaded throughmoveSession. Routes: GET/claims·/claims/related, POST/claims/build·/claims/correct.recordClaimCorrectionmints an append-onlysource:'user'correction that outranks derived without deleting it (the Episode naming: derive and persist a session title from orientation output #211/fix(distill): episode-title sane defaults — judge-lane fallback + zero-model floor + no workspace-id leakage #232 titling-sovereignty pattern) — a REJECT drops the pair from the live view and survives re-derivation.Out of scope (named — later slices)
Any UI/surface; model-enriched semantic claims (the judge-enrichment pass promoting co-occurrence into works-on/belongs-to/…); #181 entity search/typeahead (this ships the
relatedEntitieswalk it will consume); cross-workspace / app-scoped memory grants (depends on #182 AppRuntime — no deadappIdfield added).Determinism / gates
index/claims-replay.test.ts): same evidence built into two fresh stores ⇒ byte-identical claims; rebuild appends nothing; content-derived ids.origin/main(ab4ece1, contract: 'sessions' block type is used by seeded surfaces but missing from the BlockTypeName union (type widening + no runtime surface validation mask it) #234/fix(contracts): add 'sessions' to BlockTypeName union + restore drift guardrails (#234) #235 folded — conflicts were the append-only CODE_MAP/PHASE4-NOTES tails, resolved keeping both).