Remove context.md and scope prompt.txt to checkpoint-only prompts#572
Remove context.md and scope prompt.txt to checkpoint-only prompts#572gtrrz-victor wants to merge 5 commits intomainfrom
Conversation
PR SummaryMedium Risk Overview Changes Written by Cursor Bugbot for commit bd9d181. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR removes the dead-code context.md generation/storage/reading across the entire codebase and scopes prompt.txt to contain only the prompts from the current checkpoint portion of a session transcript (rather than all session prompts). It is a cleanup PR that nets -542 lines.
Changes:
- Remove
context.mdentirely: DeletesgenerateContextFromPrompts(),createContextFile(),GetSessionContext(),getCheckpointsForSession(), theContextfields fromWriteCommittedOptions/UpdateCommittedOptions/SessionContent/SessionFilePaths, related git-blob creation/reading incommitted.go, and theContextFileNameconstant. - Scope
prompt.txtto checkpoint-only prompts: IntroducesextractCheckpointPrompts()that slices the full transcript to the checkpoint portion (viatranscript.SliceFromLinefor JSONL agents orSliceFromMessagefor Gemini/OpenCode) before extracting user prompts; updatesextractSessionData()andextractSessionDataFromLiveTranscript()to use it. - Update tests and docs: Removes tests for deleted functions, updates integration tests to assert checkpoint-scoped (not full-session) prompt content, and updates architecture docs and CLAUDE.md to reflect the new structure.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/entire/cli/strategy/manual_commit_condensation.go |
Adds extractCheckpointPrompts(); removes generateContextFromPrompts() and getCheckpointsForSession(); updates prompt extraction calls |
cmd/entire/cli/strategy/manual_commit_hooks.go |
Removes context generation and redaction in finalizeAllTurnCheckpoints |
cmd/entire/cli/strategy/manual_commit_logs.go |
Removes dead GetSessionContext() function and its imports |
cmd/entire/cli/strategy/manual_commit_types.go |
Removes Context field from ExtractedSessionData |
cmd/entire/cli/strategy/common.go |
Removes context.md fallback in getSessionDescriptionFromTree and the # markdown prefix stripping |
cmd/entire/cli/checkpoint/checkpoint.go |
Removes Context fields from WriteCommittedOptions, UpdateCommittedOptions, SessionContent, SessionFilePaths |
cmd/entire/cli/checkpoint/committed.go |
Removes context blob creation/reading in writeSessionToSubdirectory, UpdateCommitted, ReadSessionContent |
cmd/entire/cli/paths/paths.go |
Removes ContextFileName constant |
cmd/entire/cli/lifecycle.go |
Removes createContextFile() function and its call |
cmd/entire/cli/checkpoint/checkpoint_test.go |
Removes Context-related test assertions |
cmd/entire/cli/checkpoint/committed_update_test.go |
Removes Context-related test assertions |
cmd/entire/cli/strategy/manual_commit_condensation_test.go |
Removes generateContextFromPrompts tests; updates Gemini multi-checkpoint test |
cmd/entire/cli/strategy/manual_commit_test.go |
Updates assertions to verify checkpoint-scoped prompts instead of full-session prompts |
cmd/entire/cli/integration_test/manual_commit_workflow_test.go |
Updates integration tests to assert checkpoint-scoped prompt content |
cmd/entire/cli/lifecycle_test.go |
Removes createContextFile tests |
cmd/entire/cli/benchutil/parse_tree_bench_test.go |
Updates comment and capacity for 4-file structure |
CLAUDE.md |
Updates architecture doc to remove context.md references |
docs/architecture/sessions-and-checkpoints.md |
Updates checkpoint structure diagrams |
docs/architecture/claude-hooks-integration.md |
Updates hook behavior description |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
67bd76a to
8f7c3be
Compare
context.md was dead code — written during checkpointing but never consumed by any reader. prompt.txt stored all session prompts, but every consumer only used the first or last one. This simplifies both by removing context.md entirely and scoping prompt.txt to only the current checkpoint's prompts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 1104437d743e
… transcript Stop extracting prompts from transcript at TurnEnd — prompts now flow exclusively through event.Prompt at TurnStart and are appended to the filesystem prompt.txt. This prevents TurnEnd from overwriting accumulated prompts. Commit messages use state.LastPrompt instead. Add filesystem fallback to finalizeAllTurnCheckpoints for cases where the shadow branch prompt.txt is not yet available. Clear filesystem prompt.txt after condensation only when all files are committed (preserve for carry-forward). Update integration tests to pass prompts through the hook input via new SimulateUserPromptSubmitWithPrompt helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 210a036ddee6
ExtractPrompts was removed from the TurnEnd handler in lifecycle.go but the interface method, all 3 agent implementations, and several helper functions in cli/transcript.go were left behind. Remove them along with their tests and now-unused type aliases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: a8c2ee703e68
These had zero production callers — only tests exercised them. The generic AgentSession.GetLastUserPrompt() in agent/session.go already covers all agents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: d42a011e0627
8f7c3be to
5aaa28a
Compare
Closes #571
Summary
context.mdentirely — it was dead code (written during checkpointing but never consumed by any reader). Removes generation, writing, reading, and all test/doc references across 19 files.prompt.txtto checkpoint-only prompts — previously stored all session prompts joined by---, but every consumer only used the first or last. Now stores only prompts from the current checkpoint portion of the transcript.What changed
context.md removal:
generateContextFromPrompts()function and all callersContextfields fromWriteCommittedOptions,UpdateCommittedOptions,SessionContent,SessionFilePathscommitted.gocreateContextFile()fromlifecycle.goGetSessionContext()andgetCheckpointsForSession()(dead code)getSessionDescriptionFromTree()ContextFileNameconstant frompaths.goprompt.txt scoping:
extractCheckpointPrompts()that scopes transcript by agent type (JSONL/Gemini/OpenCode) before extracting promptsextractSessionData()andextractSessionDataFromLiveTranscript()to use itlifecycle.gowas already checkpoint-scoped — no change neededBackward compatibility:
context.mdfiles onentire/checkpoints/v1are simply ignored (no reader)prompt.txtwith all-session prompts still works withExtractFirstPrompt()/extractLastPrompt()Test plan
go build ./...compiles cleanlymise run fmt— no formatting changesmise run test:ci— all unit + integration tests passentire explainon a repo with existing checkpoints (backward compat)context.mdon committed branchentire rewindto verify session labels display correctly🤖 Generated with Claude Code