Skip to content

fix(web): sprints load their plan, state and memory whole after compaction - #609

Merged
NoahHendrickson merged 4 commits into
customfrom
t3/sprint-file-imports
Nov 29, 2026
Merged

NoahHendrickson merged 4 commits into
customfrom
t3/sprint-file-imports

Conversation

@NoahHendrickson

Copy link
Copy Markdown
Owner

After each compaction, the sprint leader's session-start hook showed only the first 2,500 bytes of PLAN.md and STATE.md and just a "read it" pointer for MEMORY.md. So for most of a sprint the leader worked without its own files. It rarely went back to read them (context/compaction-in-parent-threads.md).

What changed

  • Imports: the seeded CLAUDE.md now imports @PLAN.md, @STATE.md and @MEMORY.md in a closing "Your plan, state and memory" section, the way it already imports CREW.md and PROJECTS.md.
  • Session-start hook: drops those three previews. It keeps the memory snapshot the turn hook compares against, and the newest library names.
  • Rules text: the STATE.md and MEMORY.md sections no longer describe the old previews.
  • Rules version: v12, so existing sprints pick this up on their next rules refresh. The fork-sprints guard's session-start case now checks the imports, and that the hook no longer prints the files.
  • Manifest: the .fork/customizations.yaml note is updated.

Why imports work here

Tested by hand on Claude Code 2.1.332 in one long-running stream-json session:

  • A 20 KB @import loads in full.
  • After /compact it is read again from disk. A word changed in the file before compacting showed up afterwards, while the summary still had the old one.
  • An edit in the middle of a session is not picked up until then. Between compactions, the existing turn hook already shows MEMORY.md line changes and owner edits.

A coding agent other than Claude doesn't expand imports. It still gets the AGENTS.md pointer to read the files, as before.

Checks

vp run check:changed, vp test run src/__fork_guards__/ (1028/1028), node .fork/lint-owned.mjs and node .fork/design-lint.mjs --check pass.

Plan: context/sprints-plan-after-pr596.md (step 5) in the sprint's library.

Reviewed with sol-loop: 1 round with GPT-6.1 Sol (gpt-6.1-sol) on high. Sol verdict: approved


🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code
🤖 Review: GPT-6.1 Sol (gpt-6.1-sol, high) via Codex: one sol-loop round, approved with no findings

🤖 Generated with Claude Code

…ction

The session-start hook showed only 2.5 KB previews of PLAN.md and STATE.md and just a pointer
for MEMORY.md, so after most compactions the leader worked without its own files.

CLAUDE.md now imports PLAN.md, STATE.md and MEMORY.md, the same way it already imports CREW.md
and PROJECTS.md. Claude Code rereads imports from disk at session start and after compaction
(tested on 2.1.332 with a 20 KB import), so the leader gets all of each file. The session-start
hook keeps only the library listing and the memory snapshot. Sprint rules go to v12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NoahHendrickson

Copy link
Copy Markdown
Owner Author

Code-quality review of 7b268cdaad0d2c6970c6ba3aeccec2402372ce79: no major structural issues found.

This change goes the right way. It deletes machinery instead of moving it around. The session-start hook loses show_file and the special case for a MEMORY.md too long to show. The loading moves to the mechanism CLAUDE.md already uses for CREW.md and PROJECTS.md, so the hook is left with one job: the library listing plus the memory snapshot the turn hook diffs against. sprintSeedFiles.ts shrinks (491 lines, well under 1k). SPRINT_FILE_PREVIEW_BYTES gets a narrower doc comment and now covers only owner saves, its one remaining use. No new branching, casts or wrappers.

Two small, optional points. Neither blocks:

  • The same fact is stated three times in the rules text. The STATE.md and MEMORY.md sections each say "imported at the end of this file, so you have all of it…", and the closing section says it again. The PLAN.md section says nothing about it. Pick one place to say it: either only the closing section, or put each @ import under its own section the way PROJECTS.md and CREW.md do. Then the sections would no longer need to point at each other. Putting the files at the end of CLAUDE.md is a fair prompt-layout choice, so this is only about saying it once.
  • "STATE.md" is still a bare string literal (17 uses in this file). PLAN.md and MEMORY.md use SPRINT_PLAN_FILE and SPRINT_MEMORY_FILE. This PR adds two more bare uses: the new import line and the guard's loop over [SPRINT_PLAN_FILE, "STATE.md", SPRINT_MEMORY_FILE]. A SPRINT_STATE_FILE next to the other two would make that loop consistent. This is an existing inconsistency, so it could go in a separate change.

Not approving: this automation only reviews. CI was still pending when I reviewed.


🤖 Review: Claude Opus 5.5 (claude-opus-5-5) via Claude Code

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M labels Nov 29, 2026

@NoahHendrickson NoahHendrickson left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review of 7b268cdaad0d2c6970c6ba3aeccec2402372ce79.

The change is small and it holds together. The seeded CLAUDE.md imports the three files the same way it already imports CREW.md and PROJECTS.md. The session-start hook still takes the memory snapshot the turn hook diffs against. The rules version moves to v12, so existing sprints refresh, and the guard pins the new text and checks that the hook no longer prints the files. The rules text and the manifest note match what the code now does. I found no correctness bug. Three things are worth a look, all inline:

  1. Plausible: @ inside agent-written files now imports. Claude Code expands imports recursively, up to 5 hops. A memory or state line written as @context/report.md (bare, not in backticks) would now pull that library file in whole on every new context, past the 8 KB memory budget. The rules ask for a longer note to go in the library "with a line here pointing to it", so a pointer like that is a likely thing for an agent to write.
  2. Consideration: MEMORY.md now reaches the leader as CLAUDE.md text. Before, it came in as hook output. Now every thread's lines arrive inside the block Claude Code labels as instructions that override default behavior. Threads read untrusted text (PR bot comments, web pages), and any of them can write to MEMORY.md. "Files win" already gives the file weight, so this may be fine, but it should be a deliberate choice.
  3. Nit: the snapshot and the import read are no longer one step. Before, the hook printed MEMORY.md and copied it in the same script run. Now Claude Code reads the import and the hook copies the file separately. If a thread writes to MEMORY.md between the two, the change lands in the snapshot but not in context, and the turn hook never reports it. The window is short.

Out of scope here: apps/web/src/custom/bots/botSeedFiles.ts:4 still says its hooks "re-show STATE.md". That is the bots path, which this PR doesn't touch.

Not run: I read the diff and the surrounding hook scripts and fixtures. I didn't run tests or a live session.


🤖 Review: Claude Opus 5.5 (claude-opus-5-5) via Claude Code

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 2851046.

This comment will update automatically after the next completed run.

Review follow-ups. Imports in an imported file load too, so MEMORY.md and STATE.md lines
write paths without a leading @. MEMORY.md now reaches the leader inside CLAUDE.md, so the
rules call it notes, with CREW.md and the owner's messages as the instructions. "Imported
at the end of this file" is said once, in the closing section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NoahHendrickson

Copy link
Copy Markdown
Owner Author

Code-quality notes, handled in 2851046:

  • Said three times: fixed. "Imported at the end of this file" now appears only in the closing section; the STATE.md and MEMORY.md sections no longer repeat it.
  • Bare "STATE.md" literal: declined here. It's an existing inconsistency (17 uses), and a SPRINT_STATE_FILE constant belongs in its own change.
  • botSeedFiles.ts:4 comment: out of scope. That's the Petal path, which this PR doesn't touch, and Petals are being removed (feat(fork): remove Petals from web #606).

Still blocked: Lint fails on 15 stale design-lint B6 stamps. They fail on custom itself since #602 merged (867ba17), not because of this PR.

@NoahHendrickson
NoahHendrickson merged commit 3935fa8 into custom Nov 29, 2026
32 checks passed
@NoahHendrickson
NoahHendrickson deleted the t3/sprint-file-imports branch November 29, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants