From 64a2911880be24b363afdaeac97fdee0540c51b8 Mon Sep 17 00:00:00 2001 From: Disaster-Terminator <2557058999@qq.com> Date: Sat, 18 Apr 2026 10:41:31 +0800 Subject: [PATCH 1/2] fix(prompts): prefer task_id in continuation guidance --- src/agents/atlas/default-prompt-sections.ts | 8 ++++---- src/agents/atlas/gemini-prompt-sections.ts | 10 +++++----- src/agents/atlas/gpt-prompt-sections.ts | 10 +++++----- src/agents/hephaestus/gpt-5-3-codex.ts | 2 +- src/hooks/atlas/index.test.ts | 2 +- src/hooks/atlas/system-reminder-templates.ts | 2 +- .../compaction-context-prompt.ts | 4 ++-- src/hooks/compaction-context-injector/index.test.ts | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/agents/atlas/default-prompt-sections.ts b/src/agents/atlas/default-prompt-sections.ts index 24ba9f807..ab1ace967 100644 --- a/src/agents/atlas/default-prompt-sections.ts +++ b/src/agents/atlas/default-prompt-sections.ts @@ -139,10 +139,10 @@ Count remaining **top-level task** checkboxes. Ignore nested verification/eviden [ ] Boulder: Read plan file, confirmed current progress \`\`\` -**If verification fails**: Resume the SAME session with the ACTUAL error output: +**If verification fails**: Resume the SAME task with the ACTUAL error output: \`\`\`typescript task( - session_id="ses_xyz789", + task_id="ses_xyz789", load_skills=[...], prompt="Verification failed: {actual error}. Fix." ) @@ -156,7 +156,7 @@ Every \`task()\` output includes a task_id. STORE IT. If task fails: 1. Identify what went wrong -2. **Resume the SAME session** - subagent has full context already: +2. **Resume the SAME task** - subagent has full context already: \`\`\`typescript task( task_id="ses_xyz789", // Task ID from failed task @@ -187,7 +187,7 @@ Final-wave reviewers can finish in parallel before you update the plan file, so 1. Execute all Final Wave tasks in parallel 2. If ANY verdict is REJECT: - - Fix the issues (delegate via \`task()\` with \`session_id\`) + - Fix the issues (delegate via \`task()\` with \`task_id\`) - Re-run the rejecting reviewer - Repeat until ALL verdicts are APPROVE 3. Mark \`pass-final-wave\` todo as \`completed\` diff --git a/src/agents/atlas/gemini-prompt-sections.ts b/src/agents/atlas/gemini-prompt-sections.ts index 2ca4c2bc2..633264a17 100644 --- a/src/agents/atlas/gemini-prompt-sections.ts +++ b/src/agents/atlas/gemini-prompt-sections.ts @@ -154,7 +154,7 @@ Answer THREE questions: ALL three must be YES. "Probably" = NO. "I think so" = NO. - **All 3 YES** → Proceed. -- **Any NO** → Reject: resume session with \`session_id\`, fix the specific issue. +- **Any NO** → Reject: resume with \`task_id\`, fix the specific issue. **After gate passes:** Check boulder state: \`\`\` @@ -185,7 +185,7 @@ Final-wave reviewers can finish in parallel before you update the plan file, so 1. Execute all Final Wave tasks in parallel 2. If ANY verdict is REJECT: - - Fix the issues (delegate via \`task()\` with \`session_id\`) + - Fix the issues (delegate via \`task()\` with \`task_id\`) - Re-run the rejecting reviewer - Repeat until ALL verdicts are APPROVE 3. Mark \`pass-final-wave\` todo as \`completed\` @@ -242,7 +242,7 @@ Subagents CLAIM "done" when: **Phase 3 is NOT optional for user-facing changes.** **Phase 4 gate: ALL three questions must be YES. "Unsure" = NO.** -**On failure: Resume with \`session_id\` and the SPECIFIC failure.** +**On failure: Resume with \`task_id\` and the SPECIFIC failure.** ` export const GEMINI_ATLAS_BOUNDARIES = ` @@ -272,7 +272,7 @@ export const GEMINI_ATLAS_CRITICAL_RULES = ` - Send prompts under 30 lines - Skip scanned-file lsp_diagnostics (use 'filePath=".", extension=".ts"' for TypeScript projects; directory scans are capped at 50 files) - Batch multiple tasks in one delegation -- Start fresh session for failures (use session_id) +- Start fresh session for failures (do NOT do this; use task_id) **ALWAYS**: - Include ALL 6 sections in delegation prompts @@ -280,6 +280,6 @@ export const GEMINI_ATLAS_CRITICAL_RULES = ` - Run scanned-file QA after every delegation - Pass inherited wisdom to every subagent - Parallelize independent tasks -- Store and reuse session_id for retries +- Store and reuse task_id for retries - **USE TOOL CALLS for verification - not internal reasoning** ` diff --git a/src/agents/atlas/gpt-prompt-sections.ts b/src/agents/atlas/gpt-prompt-sections.ts index 1a9f39c26..8d1e4a9d0 100644 --- a/src/agents/atlas/gpt-prompt-sections.ts +++ b/src/agents/atlas/gpt-prompt-sections.ts @@ -158,7 +158,7 @@ Before moving to the next task, answer these THREE questions honestly: 3. **Am I confident this doesn't break existing functionality?** (If no → run broader tests) - **All 3 YES** → Proceed: mark task complete, move to next. -- **Any NO** → Reject: resume session with \`session_id\`, fix the specific issue. +- **Any NO** → Reject: resume with \`task_id\`, fix the specific issue. - **Unsure on any** → Reject: "unsure" = "no". Investigate until you have a definitive answer. **After gate passes:** Check boulder state: @@ -190,7 +190,7 @@ Final-wave reviewers can finish in parallel before you update the plan file, so 1. Execute all Final Wave tasks in parallel 2. If ANY verdict is REJECT: - - Fix the issues (delegate via \`task()\` with \`session_id\`) + - Fix the issues (delegate via \`task()\` with \`task_id\`) - Re-run the rejecting reviewer - Repeat until ALL verdicts are APPROVE 3. Mark \`pass-final-wave\` todo as \`completed\` @@ -248,7 +248,7 @@ Your job is to CATCH THEM. Assume every claim is false until YOU personally veri **Phase 4 gate:** ALL three questions must be YES to proceed. "Unsure" = NO. Investigate until certain. -**On failure at any phase:** Resume with \`session_id\` and the SPECIFIC failure. Do not start fresh. +**On failure at any phase:** Resume with \`task_id\` and the SPECIFIC failure. Do not start fresh. ` export const GPT_ATLAS_BOUNDARIES = ` @@ -276,7 +276,7 @@ export const GPT_ATLAS_CRITICAL_RULES = ` - Send prompts under 30 lines - Skip scanned-file lsp_diagnostics (use 'filePath=".", extension=".ts"' for TypeScript projects; directory scans are capped at 50 files) - Batch multiple tasks in one delegation -- Start fresh session for failures (use session_id) +- Start fresh session for failures (do NOT do this; use task_id) **ALWAYS**: - Include ALL 6 sections in delegation prompts @@ -284,5 +284,5 @@ export const GPT_ATLAS_CRITICAL_RULES = ` - Run scanned-file QA after every delegation - Pass inherited wisdom to every subagent - Parallelize independent tasks -- Store and reuse session_id for retries +- Store and reuse task_id for retries ` diff --git a/src/agents/hephaestus/gpt-5-3-codex.ts b/src/agents/hephaestus/gpt-5-3-codex.ts index 28127bcc8..488f13937 100644 --- a/src/agents/hephaestus/gpt-5-3-codex.ts +++ b/src/agents/hephaestus/gpt-5-3-codex.ts @@ -407,7 +407,7 @@ After delegation, ALWAYS verify: works as expected? follows codebase pattern? MU ### Session Continuity -Every \`task()\` output includes a session_id. **USE IT for follow-ups.** +Every \`task()\` output includes a task_id. **USE IT for follow-ups.** - **Task failed/incomplete** - \`task_id="{id}", prompt="Fix: {error}"\` - **Follow-up on result** - \`task_id="{id}", prompt="Also: {question}"\` diff --git a/src/hooks/atlas/index.test.ts b/src/hooks/atlas/index.test.ts index a2e80cf78..73cfd067a 100644 --- a/src/hooks/atlas/index.test.ts +++ b/src/hooks/atlas/index.test.ts @@ -520,7 +520,7 @@ session_id: ses_standalone_def cleanupMessageStorage(sessionID) }) - test("should include session_id and checkbox instructions in reminder", async () => { + test("should include task_id and checkbox instructions in reminder", async () => { // given - boulder state, Atlas caller const sessionID = "session-resume-test" setupMessageStorage(sessionID, "atlas") diff --git a/src/hooks/atlas/system-reminder-templates.ts b/src/hooks/atlas/system-reminder-templates.ts index ee7db3bb5..23d7bd5de 100644 --- a/src/hooks/atlas/system-reminder-templates.ts +++ b/src/hooks/atlas/system-reminder-templates.ts @@ -98,7 +98,7 @@ Answer honestly: ALL three must be YES. "Probably" = NO. "I think so" = NO. Investigate until CERTAIN. - **All 3 YES** - Proceed: mark task complete, move to next. -- **Any NO** - Reject: resume session with \`session_id\`, fix the specific issue. +- **Any NO** - Reject: resume with \`task_id\`, fix the specific issue. - **Unsure** - Reject: "unsure" = "no". Investigate until you have a definitive answer. **DO NOT proceed to the next task until all 4 phases are complete and the gate passes.**` diff --git a/src/hooks/compaction-context-injector/compaction-context-prompt.ts b/src/hooks/compaction-context-injector/compaction-context-prompt.ts index 11bc25747..9439ca8d4 100644 --- a/src/hooks/compaction-context-injector/compaction-context-prompt.ts +++ b/src/hooks/compaction-context-injector/compaction-context-prompt.ts @@ -49,8 +49,8 @@ This section is CRITICAL for reviewer agents (momus, oracle) to maintain continu ## 8. Delegated Agent Sessions - List ALL background agent tasks spawned during this session -- For each: agent name, category, status, description, and **session_id** -- **RESUME, DON'T RESTART.** Each listed session retains full context. After compaction, use \`session_id\` to continue existing agent sessions instead of spawning new ones. This saves tokens, preserves learned context, and prevents duplicate work. +- For each: agent name, category, status, description, and **task_id** +- **RESUME, DON'T RESTART.** Each listed delegated task retains full context. After compaction, use \`task_id\` to continue existing delegated work instead of spawning new tasks. This saves tokens, preserves learned context, and prevents duplicate work. This context is critical for maintaining continuity after compaction. ` diff --git a/src/hooks/compaction-context-injector/index.test.ts b/src/hooks/compaction-context-injector/index.test.ts index 69cb082a9..2bc39ba4c 100644 --- a/src/hooks/compaction-context-injector/index.test.ts +++ b/src/hooks/compaction-context-injector/index.test.ts @@ -107,7 +107,7 @@ describe("createCompactionContextInjector", () => { //#then expect(prompt).toContain("Delegated Agent Sessions") expect(prompt).toContain("RESUME, DON'T RESTART") - expect(prompt).toContain("session_id") + expect(prompt).toContain("task_id") }) it("injects actual task history when backgroundManager and sessionID provided", async () => { From ff9c3e0e6ea87b81363d2847351e3013dd32957f Mon Sep 17 00:00:00 2001 From: Disaster-Terminator <2557058999@qq.com> Date: Sat, 18 Apr 2026 11:04:03 +0800 Subject: [PATCH 2/2] test(atlas): assert task_id guidance in reminder --- src/hooks/atlas/index.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hooks/atlas/index.test.ts b/src/hooks/atlas/index.test.ts index 73cfd067a..97a4bb3ac 100644 --- a/src/hooks/atlas/index.test.ts +++ b/src/hooks/atlas/index.test.ts @@ -549,10 +549,11 @@ session_id: ses_standalone_def output ) - // then - should include verification instructions + // then - should include verification instructions and task_id guidance expect(output.output).toContain("LYING") - expect(output.output).toContain("PHASE 1") - expect(output.output).toContain("PHASE 2") + expect(output.output).toContain("PHASE 1") + expect(output.output).toContain("PHASE 2") + expect(output.output).toContain("task_id") cleanupMessageStorage(sessionID) })