Repository navigation
fix: keep the continuity digest within harness injection limits - #422
Merged
Merged
Conversation
Claude Code saves hook context over 10,000 characters to a file and injects only a 2,000-character preview; Codex does the same past about 2,500 tokens. The digest had grown past both, so agents started with a preview of one old wrap. The default `loaf journal context`, every SessionStart hook and post-compaction resumption now render one compact digest: one line per entry with its date, id and shortened message, no cursor tokens, no empty layers, and a cursor-free command for any layer showing fewer items than it has. It stays under an 8,000-byte budget; when that is tight, layers give up their oldest items first, one round at a time, and the digest says how many entries it left out. Each target's injection limit, unit, source and checked date is now recorded in config/target-capabilities.json, and a test holds every adapter's payload under it. --json and single --layer output are unchanged. Closes #345
#418's tests looked for the old " branch: <name>" header line; the compact digest names the branch in its first line instead.
2 tasks
Owner
Author
|
Ship: request changes on 5b6b257. The design holds up: one renderer with an 8,000-byte budget sits behind every hook path, and nothing is stored. Three gaps keep it from meeting #345 as written, and the head that will land still needs its checks.
Agent notes
|
Ship review of #422 found three gaps: - Exploration checkpoints page at five with no cursor, so a "more" command without --limit showed the same five again. Every list command now names --limit min(total, 100). - Diagnostics had no size bound, and a hard cut dropped the omission notice. Diagnostics now collapse to one line per code, and a cut keeps the cut marker and the notice when they fit. - No test pinned the priority order. A golden test now shows which layers win at a tight budget, and the docs say the canonical layer order is the priority order, and why. Also: the drift nudge now shares the budget; titles, scopes and labels fold onto one line; legacy deferrals name their spark; the payload test checks that only Amp goes unchecked; and the contract notes why injection_limit stays under version 3.
levifig
force-pushed
the
claude/wizardly-wing-91ee03
branch
from
October 22, 2026 00:34
5b6b257 to
d551bb6
Compare
Owner
Author
|
Ship: approve d551bb6. Every finding from the first review is fixed, and the full local gate passes on this exact head. #345's Verification boxes are all ticked, each with a result recorded for this head, live Claude Code checks included. In this repository the digest is now 6,601 bytes, down from 11.1 KB. Agent notes
|
levifig
marked this pull request as ready for review
October 22, 2026 00:42
levifig
added a commit
that referenced
this pull request
Oct 22, 2026
After #422 the default digest, every SessionStart hook and post-compaction resumption render through renderJournalContextDigest, so the 30-day blocker collapse moves there: aged-out blockers are counted next to the layer's list command instead of listed, and listed blockers carry the resolve-by-id hint. The --layer read lists every blocker in #422's [date] id order. A Runner clock lets a test age real blockers and drive the CLI and Claude Code hook paths end to end.
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.
Summary
The continuity digest grew past what harnesses inject. Claude Code saves hook context over 10,000 characters to a file and gives the agent only a 2,000-character preview, and Codex does the same past about 2,500 tokens. On 21 October this repository's digest was 11.1 KB and spwn/infra's 15.4 KB, so agents started with a preview of one old wrap.
loaf journal context, every SessionStart hook and post-compaction resumption now print one compact digest. Each entry is one line with its date, id and a shortened message;loaf journal show <id>prints it in full.--limitthat lists them. Repeated diagnostics collapse to one line per code.config/target-capabilities.jsonrecords each target's injection limit, its unit, source and the date it was checked. Cursor, OpenCode and Amp document none and are held to the tightest documented limit.--jsonand single---layeroutput are unchanged.Closes #345
Native work
Verification
All checks below ran on the final head, d551bb6: #345 rebased onto main 02f36e9, plus the #418 assertion fix and the Ship review fixes. The first round of evidence on 5b6b257 is superseded.
TestJournalContextDigestRendersCompactLayerscovers every layer kind, an empty layer, an unavailable layer and a diagnostic.TestJournalContextDigestPriorityFollowsCanonicalLayerOrderuses a budget that admits only the first items of the leading layers.TestJournalContextDigestFitsBudgetAndKeepsEachLayersFirstItemsruns at 8,000, 4,000 and 2,000 bytes.--limit 8).TestJournalContextHookPayloadsFitRecordedInjectionLimitslogs 51 oversized entries and renders the Claude Code, Codex, both Cursor records' and OpenCode payloads, including OpenCode's post-compaction resumption. It holds each to the limit inconfig/target-capabilities.jsonand asserts that only Amp, which delivers no automatic context, goes unchecked. With the old renderer the Claude Code payload is 47,923 bytes against 10,000.PATH. The session'shook_additional_contextattachment holds the 6,023-character digest inline, naming this worktree's branch./compactin the same session: theSessionStart:compactattachment again holds the 6,023-character digest inline.--jsonand--layerpaging unchanged. The existing JSON and layer tests pass untouched. The only changed assertions concern the human digest: the emptyproject-synthesislayer is left out (two tests), and fix: scope journal context to the invoking worktree's branch #418's tests now match the new branch header (three assertions).env -u LOAF_DB make verify-localpassed on d551bb6: 60 Go packages, typecheck, vet, CGO-free build, 39 adapter runner tests and generated-content drift.loaf check issue-changelogpasses for Fit the continuity digest to each harness's injection budget #345 against main.TestWorktreeStorageMissingMainPreservesCanonicalIdentityfails on this machine when run alone, because ofworktree.useRelativePathsin the global git config, on main as well. It passed inside the full gate. CI does not hit it.Ship
Approved on d551bb6: verdict.
Migration / risks
config/target-capabilities.jsongains a requiredinjection_limiton every record. The contract stays at version 3, and a code comment says why: the file is repo-local and only this binary reads it, while bumping the version would churn every installed target manifest.--jsonremains the machine surface.Out of scope