From 576378ffcb82f2882cfdf9d8cd945b10dd572146 Mon Sep 17 00:00:00 2001 From: Adam Creeger Date: Sun, 22 Mar 2026 20:23:01 -0400 Subject: [PATCH 1/5] feat(recap): add 'fix' entry type for tracking code review resolutions Add a new recap entry type 'fix' so agents can log when code review findings are addressed. Updated across type definitions, Zod schemas, all prompt templates, agent docs, and tests. Closes #960 Co-Authored-By: Claude Opus 4.6 --- src/mcp/CLAUDE.md | 2 +- src/mcp/recap-server.test.ts | 16 ++++++++++++++++ src/mcp/recap-server.ts | 6 +++--- src/mcp/recap-types.ts | 4 ++-- src/utils/mcp.ts | 2 +- templates/agents/iloom-code-reviewer.md | 2 +- templates/agents/iloom-issue-implementer.md | 2 ++ templates/prompts/issue-prompt.txt | 4 ++-- templates/prompts/pr-prompt.txt | 4 ++-- templates/prompts/regular-prompt.txt | 4 ++-- templates/prompts/session-summary-prompt.txt | 3 ++- templates/prompts/swarm-orchestrator-prompt.txt | 2 +- 12 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/mcp/CLAUDE.md b/src/mcp/CLAUDE.md index 19170215..40320c2b 100644 --- a/src/mcp/CLAUDE.md +++ b/src/mcp/CLAUDE.md @@ -18,7 +18,7 @@ Exposes issue/PR operations to agents. Provider-agnostic — routes to GitHub, L ### recap-server.ts -Manages the recap system — structured knowledge capture (decisions, insights, risks, artifacts) displayed in the VS Code sidebar. +Manages the recap system — structured knowledge capture (decisions, insights, risks, fixes, artifacts) displayed in the VS Code sidebar. **Tools:** `set_goal`, `set_complexity`, `add_entry`, `add_artifact`, `get_recap`, `set_loom_state`, `get_loom_state` diff --git a/src/mcp/recap-server.test.ts b/src/mcp/recap-server.test.ts index 9a2a1be8..46a54f57 100644 --- a/src/mcp/recap-server.test.ts +++ b/src/mcp/recap-server.test.ts @@ -91,6 +91,22 @@ describe('recap-server add_entry deduplication', () => { content: 'Found existing helper function', }) }) + + it('should create a new fix entry and return skipped: false', async () => { + const result = await addEntryWithDeduplication( + readRecapMock, + writeRecapMock, + 'fix', + 'Fixed null check in auth handler per review feedback' + ) + expect(result.skipped).toBe(false) + expect(result.id).toBe('test-uuid-123') + expect(mockRecapFile.entries).toHaveLength(1) + expect(mockRecapFile.entries?.[0]).toMatchObject({ + type: 'fix', + content: 'Fixed null check in auth handler per review feedback', + }) + }) }) describe('when adding an entry with duplicate type and content', () => { diff --git a/src/mcp/recap-server.ts b/src/mcp/recap-server.ts index 729d2f4f..04f439e4 100644 --- a/src/mcp/recap-server.ts +++ b/src/mcp/recap-server.ts @@ -1,7 +1,7 @@ /** * Loom Recap MCP Server * - * Captures session context (goal, decisions, insights, risks, assumptions) + * Captures session context (goal, decisions, insights, risks, fixes, assumptions) * for the VS Code Loom Context Panel. * * Environment variables: @@ -234,7 +234,7 @@ server.registerTool( 'Append an entry to the recap. If an entry with the same type and content already exists, it will be skipped.', inputSchema: { type: z - .enum(['decision', 'insight', 'risk', 'assumption', 'other']) + .enum(['decision', 'insight', 'risk', 'assumption', 'fix', 'other']) .describe('Entry type'), content: z.string().describe('Entry content'), worktreePath: z.string().optional().describe('Optional worktree path to scope recap to a specific loom'), @@ -360,7 +360,7 @@ server.registerTool( z.object({ id: z.string(), timestamp: z.string(), - type: z.enum(['decision', 'insight', 'risk', 'assumption', 'other']), + type: z.enum(['decision', 'insight', 'risk', 'assumption', 'fix', 'other']), content: z.string(), }) ), diff --git a/src/mcp/recap-types.ts b/src/mcp/recap-types.ts index 8954c640..c4da0c0e 100644 --- a/src/mcp/recap-types.ts +++ b/src/mcp/recap-types.ts @@ -3,11 +3,11 @@ * * The Recap MCP captures session context that scrolls away during Claude sessions: * - Goal: The original problem statement - * - Entries: Decisions, insights, risks, assumptions discovered during the session + * - Entries: Decisions, insights, risks, assumptions, fixes discovered during the session */ /** Entry types for recap entries */ -export type RecapEntryType = 'decision' | 'insight' | 'risk' | 'assumption' | 'other' +export type RecapEntryType = 'decision' | 'insight' | 'risk' | 'assumption' | 'fix' | 'other' /** Artifact types for tracking created items */ export type RecapArtifactType = 'comment' | 'issue' | 'pr' diff --git a/src/utils/mcp.ts b/src/utils/mcp.ts index 3521a8c5..d4486624 100644 --- a/src/utils/mcp.ts +++ b/src/utils/mcp.ts @@ -199,7 +199,7 @@ export async function writeRecapFile(filePath: string, recap: Record Date: Sun, 22 Mar 2026 22:53:56 -0400 Subject: [PATCH 2/5] fix(recap): remove fix-entry guidance from code reviewer agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code reviewer doesn't implement fixes — only the implementer does. Move fix entry guidance to where it belongs (already in implementer). Co-Authored-By: Claude Opus 4.6 --- templates/agents/iloom-code-reviewer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/agents/iloom-code-reviewer.md b/templates/agents/iloom-code-reviewer.md index dbcb2427..099cd93f 100644 --- a/templates/agents/iloom-code-reviewer.md +++ b/templates/agents/iloom-code-reviewer.md @@ -17,7 +17,7 @@ You are an expert code reviewer. Your task is to analyze code changes and provid - **Concise output**: Return structured review results suitable for the orchestrator to process. - **Autonomous handling**: If critical issues are found, report them but do NOT wait for user confirmation. - **IMPORTANT recap routing**: You are running inline in a swarm worker's context. You MUST pass `worktreePath` on ALL recap calls (`set_loom_state`, `add_entry`, `get_recap`). The worktree path is provided by the caller — look for it in your invocation prompt (e.g., "Your worktree path is ..."). Without `worktreePath`, recap entries go to the epic's recap file instead of the child's. -- **Recap from findings**: After completing the review, log key findings as recap entries using `recap.add_entry`. For each critical finding (95-100 confidence), add a `risk` entry. For significant patterns or architectural concerns found across multiple files, add an `insight` entry. For architectural choices or trade-offs surfaced during review, add a `decision` entry. When a review finding is addressed in a subsequent implementation pass, the implementer should log a `fix` entry describing what was resolved. Always include `worktreePath` on these calls. +- **Recap from findings**: After completing the review, log key findings as recap entries using `recap.add_entry`. For each critical finding (95-100 confidence), add a `risk` entry. For significant patterns or architectural concerns found across multiple files, add an `insight` entry. For architectural choices or trade-offs surfaced during review, add a `decision` entry. Always include `worktreePath` on these calls. {{/if}} ## Do NOT Review Temporal Information From 542a3bbb462546719903e839d45af5d5f1828714 Mon Sep 17 00:00:00 2001 From: Adam Creeger Date: Sun, 22 Mar 2026 22:58:12 -0400 Subject: [PATCH 3/5] fix(recap): move fix entry ownership from implementer to orchestrator The orchestrator decides what review findings get fixed and sometimes handles simple fixes directly. Add fix type description to orchestrator prompt recap lists and explicitly tell implementer not to log fix entries. Co-Authored-By: Claude Opus 4.6 --- templates/agents/iloom-issue-implementer.md | 2 +- templates/prompts/issue-prompt.txt | 1 + templates/prompts/pr-prompt.txt | 1 + templates/prompts/regular-prompt.txt | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/agents/iloom-issue-implementer.md b/templates/agents/iloom-issue-implementer.md index 23e2e231..c7e50ff7 100644 --- a/templates/agents/iloom-issue-implementer.md +++ b/templates/agents/iloom-issue-implementer.md @@ -43,7 +43,7 @@ After creating or updating any issue comment, use the Recap MCP tools: This enables the recap panel to show quick-reference links to artifacts created during the session. -- When addressing issues identified during code review, use `recap.add_entry` with type `fix` to log what was resolved (e.g., "Fixed null check in auth handler per review feedback"). +**Do NOT log `fix` recap entries** — the orchestrator tracks which review findings were addressed. Only use `recap.add_artifact` for comments you create. {{#if SWARM_MODE}} **IMPORTANT**: You are running inline in a swarm worker's context. You MUST pass `worktreePath` on ALL recap calls (`add_artifact`, `add_entry`, `set_loom_state`, `get_recap`). The worktree path is provided by the caller — look for it in your invocation prompt (e.g., "Your worktree path is ..."). Without `worktreePath`, recap entries go to the epic's recap file instead of the child's. diff --git a/templates/prompts/issue-prompt.txt b/templates/prompts/issue-prompt.txt index a3633dac..086a9bfe 100644 --- a/templates/prompts/issue-prompt.txt +++ b/templates/prompts/issue-prompt.txt @@ -64,6 +64,7 @@ The recap panel is visible to the user in VS Code. They don't care about your in 2. **Insights** - Things discovered that someone picking this up later would need to know: "The auth module depends on Z" 3. **Risks** - Things that could go wrong: "This assumes X, will break if Y" 4. **Assumptions** - Bets you're making: "Assuming backwards compat not needed" +5. **Fixes** - Code review findings you addressed: "Fixed null check in auth handler per review feedback" Use these Recap MCP tools: - `recap.set_complexity` - Call when complexity is confirmed at ROUTING DECISION POINT (trivial/simple/complex) diff --git a/templates/prompts/pr-prompt.txt b/templates/prompts/pr-prompt.txt index e834209c..306f400b 100644 --- a/templates/prompts/pr-prompt.txt +++ b/templates/prompts/pr-prompt.txt @@ -37,6 +37,7 @@ The recap panel is visible to the user in VS Code. They don't care about your in 2. **Insights** - Things discovered that someone picking this up later would need to know: "The auth module depends on Z" 3. **Risks** - Things that could go wrong: "This assumes X, will break if Y" 4. **Assumptions** - Bets you're making: "Assuming backwards compat not needed" +5. **Fixes** - Code review findings you addressed: "Fixed null check in auth handler per review feedback" Use these Recap MCP tools: - `recap.set_goal` - Call once after understanding why the user is working on this PR (e.g., "Review PR for security concerns", "Fix failing tests") diff --git a/templates/prompts/regular-prompt.txt b/templates/prompts/regular-prompt.txt index 6f782155..dfd458b6 100644 --- a/templates/prompts/regular-prompt.txt +++ b/templates/prompts/regular-prompt.txt @@ -37,6 +37,7 @@ The recap panel is visible to the user in VS Code. They don't care about your in 2. **Insights** - Things discovered that someone picking this up later would need to know: "The auth module depends on Z" 3. **Risks** - Things that could go wrong: "This assumes X, will break if Y" 4. **Assumptions** - Bets you're making: "Assuming backwards compat not needed" +5. **Fixes** - Code review findings you addressed: "Fixed null check in auth handler per review feedback" Use these Recap MCP tools: - `recap.set_goal` - Call once at session start with the user's problem statement From 53955897ec781f665b1670bd2c159c30075f7650 Mon Sep 17 00:00:00 2001 From: Adam Creeger Date: Sun, 22 Mar 2026 23:03:30 -0400 Subject: [PATCH 4/5] fix(recap): add fix entry logging guidance to review sections Add instructions to log fix recap entries at all four places where review findings get addressed: one-shot mode, interactive mode, swarm child, and post-swarm review. Also explicitly tell implementer not to log fix entries since the orchestrator owns that. Co-Authored-By: Claude Opus 4.6 --- templates/prompts/issue-prompt.txt | 4 +++- templates/prompts/swarm-orchestrator-prompt.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/prompts/issue-prompt.txt b/templates/prompts/issue-prompt.txt index 086a9bfe..72543b16 100644 --- a/templates/prompts/issue-prompt.txt +++ b/templates/prompts/issue-prompt.txt @@ -406,7 +406,7 @@ Always prepend: `"Your working directory is . cd there before doi 7a. Run artifact review on implementation output via /iloom-swarm-artifact-reviewer skill {{/if}}{{/if}} 8. Set state to `code_review` (pass `worktreePath: ""`), run code review via /iloom-swarm-code-reviewer skill -9. If critical/high issues found, auto-fix and optionally re-review +9. If critical/high issues found, auto-fix and log a `fix` recap entry for each finding addressed 10. Stage and commit all changes: `git add -A && git commit -m "feat(issue-): [descriptive summary of changes]"` — the commit message must summarize what was implemented (not just "fixes #NNN") 11. Set state to `done` (pass `worktreePath: ""`), report structured result to orchestrator {{else}} @@ -1256,9 +1256,11 @@ This section is about reviewing code changes for quality, security, and complian 3. If critical, high, or medium priority issues found: {{#if ONE_SHOT_MODE}} - Automatically implement the recommended fixes for critical, high, and medium priority issues without asking + - After fixing each issue, log a `fix` recap entry describing what was resolved (e.g., `recap.add_entry({ type: "fix", content: "Fixed missing null check in auth handler" })`) {{else}} - Ask the user: "Issues found. Do you want to proceed anyway, or address these first?" - Wait for user response before continuing + - After fixing each issue, log a `fix` recap entry describing what was resolved (e.g., `recap.add_entry({ type: "fix", content: "Fixed missing null check in auth handler" })`) {{/if}} {{/if}} diff --git a/templates/prompts/swarm-orchestrator-prompt.txt b/templates/prompts/swarm-orchestrator-prompt.txt index ed2f3194..9a00e918 100644 --- a/templates/prompts/swarm-orchestrator-prompt.txt +++ b/templates/prompts/swarm-orchestrator-prompt.txt @@ -542,7 +542,7 @@ IMPORTANT: Only fix the specific issues identified in the review findings. Do NO ```` **Handle the subagent result:** -- If the fix agent succeeds: log "Post-swarm review: N findings addressed, fix committed." +- If the fix agent succeeds: log a `fix` recap entry for each finding addressed (e.g., `recap.add_entry({ type: "fix", content: "Fixed missing null check in auth handler" })`). Then log "Post-swarm review: N findings addressed, fix committed." - If the fix agent fails: log the failure and continue. Auto-fix failure is non-blocking. **Single pass only.** Do NOT re-review after fixing. This prevents infinite review-fix loops. From 6a90c2fcf3380aad554ebe0a9210614f2dc894f2 Mon Sep 17 00:00:00 2001 From: Adam Creeger Date: Sun, 22 Mar 2026 23:18:38 -0400 Subject: [PATCH 5/5] WIP: Auto-commit for issue #960 Fixes #960 --- templates/agents/iloom-issue-implementer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/agents/iloom-issue-implementer.md b/templates/agents/iloom-issue-implementer.md index c7e50ff7..239cfd08 100644 --- a/templates/agents/iloom-issue-implementer.md +++ b/templates/agents/iloom-issue-implementer.md @@ -43,7 +43,7 @@ After creating or updating any issue comment, use the Recap MCP tools: This enables the recap panel to show quick-reference links to artifacts created during the session. -**Do NOT log `fix` recap entries** — the orchestrator tracks which review findings were addressed. Only use `recap.add_artifact` for comments you create. +**Do NOT log `fix` recap entries** — the orchestrator tracks which review findings were addressed. {{#if SWARM_MODE}} **IMPORTANT**: You are running inline in a swarm worker's context. You MUST pass `worktreePath` on ALL recap calls (`add_artifact`, `add_entry`, `set_loom_state`, `get_recap`). The worktree path is provided by the caller — look for it in your invocation prompt (e.g., "Your worktree path is ..."). Without `worktreePath`, recap entries go to the epic's recap file instead of the child's.