-
Notifications
You must be signed in to change notification settings - Fork 15
feat: trusted recall and memory write surface (v1.35.0) #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
91a5e72
chore(brainstorm): recall-trust-and-write-surface
solaitken 292490e
fix(tests): derive temporal-replace log day from result instead of wa…
solaitken acb6fe1
feat(doctor): add opt-in fail-fast readiness probes
solaitken e67a2c8
feat(brain): clip-protected session_id and agent_id on pack identity
solaitken 5ac62e0
feat(brain): typed age-labeled session-start timeline
solaitken b9ec650
feat(search): retrieval trust gate and per-pack receipts (kernel 1)
solaitken 4aa2b89
feat(search): relation-only supersede fade (kernel 1 second consumer)
solaitken 22c63b0
feat(mcp): brain_update_note and brain_append_note over atomic write …
solaitken b39ca11
feat(mcp): general atomic batch write tool over kernel 2
solaitken 1ee8d50
feat(brain): include_raw plus extracted discriminator on session recall
solaitken f89a961
feat(hooks): bounded fail-closed audited recall inject on UserPromptS…
solaitken ad22efc
feat(brain): knowledge-gap loop - recurrence, promotion, agenda, auto…
solaitken f0c1988
fix: self-review polish
solaitken 5426a41
fix(hooks): neutralize and fence recall-inject brief as untrusted con…
solaitken a2fafbf
docs: document the trusted recall and memory write surface wave, bump…
solaitken 23f361b
fix: address CodeRabbit review feedback
solaitken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
40 changes: 40 additions & 0 deletions
40
docs/brainstorm/recall-trust-and-write-surface/cli-output/claude.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ### Variant 1: Kernel-first (four seams extracted up front) | ||
|
|
||
| - **Approach**: Land four pure-refactor commits first, before any feature: (1) a retrieval rank-adjustment pipeline (ordered list of deterministic scorers/sinks between ranker and pack builder), (2) an atomic multi-operation write core generalized from `runPinnedContextBatch`, (3) a unified injection surface abstracting SessionStart and UserPromptSubmit context assembly, (4) a pack-shape module owning budget clipping and protected fields. The ten tasks then plug into these seams as thin consumers, sequenced freely since dependencies are already satisfied. | ||
| - **Trade-offs**: | ||
| - Pro: each concern gets exactly one home from day one; no file is rewritten twice inside the PR. | ||
| - Pro: the byte-identical-opt-out gate is easiest to prove - each refactor commit can be verified behavior-neutral in isolation before features stack on it. | ||
| - Pro: parallelizable - once the four kernels exist, the ten tasks have almost no cross-dependencies. | ||
| - Con: seams 3 and 4 are designed before their consumers exist; the injection abstraction especially risks being wrong (SessionStart digest, prompt-time recall, and gap agenda have different lifecycles, budgets, and fail-open/fail-closed rules). | ||
| - Con: four refactor commits inflate the PR and delay the first visible feature; a review objection to one kernel blocks everything behind it. | ||
| - Con: highest chance of speculative generality, which conflicts with the "no stubs, no do-nothing fallbacks" convention. | ||
| - **Complexity**: large | ||
| - **Risk**: medium | ||
|
|
||
| ### Variant 2: Feature-first with second-consumer extraction | ||
|
|
||
| - **Approach**: Sequence the ten tasks by theme and extract a shared kernel only at the moment a second consumer arrives. Concretely: supersede fade lands inline in `ranker.ts`/`result-filters.ts`; when the trust gate arrives next it extracts the rank-adjustment layer and migrates the fade into it. Likewise `brain_update_note`/`brain_append_note` land on `writeFrontmatterAtomic` first, and the batch tool later generalizes `runPinnedContextBatch` and rebases the note tools onto the shared core. | ||
| - **Trade-offs**: | ||
| - Pro: every seam is shaped by two real consumers, so the abstractions are guaranteed to fit; zero speculative design. | ||
| - Pro: each commit ships user-visible value; review can proceed task by task without first approving abstract infrastructure. | ||
| - Con: files are rewritten mid-PR (ranker touched by commit N, restructured by commit N+2), which muddies "one atomic commit per task" and doubles test churn on the hottest files. | ||
| - Con: extraction happens under feature pressure inside the same PR, the classic condition for an asymmetric seam biased toward whichever consumer landed second. | ||
| - Con: sequencing becomes strictly serial along each extraction chain, lengthening the critical path of a ten-task wave. | ||
| - **Complexity**: medium | ||
| - **Risk**: medium | ||
|
|
||
| ### Variant 3: Two-kernel pragmatic (extract only the seams with two proven consumers; keep injection and budget as conventions) | ||
|
|
||
| - **Approach**: Extract exactly two kernels, each of which has two concrete consumers inside this wave: (1) a retrieval-stage rank-adjustment sink between `ranker.ts` and the pack builder, with the trust gate contributing zero-rank verdicts plus receipts and the supersede fade contributing a multiplier - both covering the pure-lexical path; (2) an atomic batch write core generalized from `runPinnedContextBatch` (validate-and-project in memory, commit-or-rollback), on which `brain_update_note`/`brain_append_note` are single-op batches and t_7718ab22 is the multi-op surface that also fixes the operation vocabulary. Seams 3 and 4 are deliberately NOT abstracted: the recall hook, timeline, and gap agenda each stay at their own existing hook/brief anchor sharing only a rendering helper, and clip-protected identity is a small protected-field contract in `token-impact.ts` that `include_raw` simply respects. Sequence: rider test fix; then D (t_cc234ff5, independent); then kernel 1 + t_5f61130a + t_c4a9cef8; then kernel 2 + t_3ff3fe77 + t_7718ab22; then t_5be0654d + t_ac1d36ea; then A-theme t_4adb0b8b, t_2ce46130, t_67d38036 last (the gap loop depends on recall telemetry paths the hook exercises). | ||
| - **Trade-offs**: | ||
| - Pro: both extracted kernels are justified by two in-wave consumers, so no speculative abstraction, and both are deterministic pure functions - a natural fit for the no-LLM kernel and the language-agnostic trust-gate constraint. | ||
| - Pro: respects the real asymmetry in theme A - SessionStart is fail-open, the prompt-time recall hook is fail-closed with audit; a shared injection surface would have to encode both policies and would blur exactly the guarantee t_2ce46130 must keep crisp. | ||
| - Pro: shortest critical path - three independent tracks (rank track, write track, injection track) can proceed in parallel after the two small kernel commits. | ||
| - Con: if a future wave adds a third injection consumer, the A-theme code pays a later extraction cost. | ||
| - Con: the protected-fields "convention" in `token-impact.ts` relies on the regression test (tiny-budget clip retains identity) rather than a structural home; a future clipper could bypass it. | ||
| - **Complexity**: medium | ||
| - **Risk**: low | ||
|
|
||
| ### Recommended: Variant 3 | ||
|
|
||
| **Rationale**: The two kernels it extracts are the only candidate seams with two concrete consumers shipping in this very wave, so they cannot be speculatively wrong, while Variant 1 forces an injection abstraction across surfaces with contradictory failure policies (fail-open session hooks vs the fail-closed audited recall hook) and Variant 2 rewrites the ranker and write path twice inside a ten-commit PR, breaking the one-atomic-commit-per-task convention. Variant 3 also yields three parallel tracks with the rider fix and doctor probes landing first, which de-flakes CI before the heavier commits and keeps every commit byte-identical when its flag is omitted. |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.