refactor(task): align continuation ids with task_id

This commit is contained in:
YeonGyu-Kim
2026-04-16 23:13:44 +09:00
parent 56be458ede
commit d89e257d8a
29 changed files with 180 additions and 96 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ Your completion will NOT be recorded until you complete ALL of the following:
If anything fails while closing this out, resume the same session immediately:
\`\`\`typescript
task(session_id="${sessionId}", load_skills=[], prompt="fix: checkbox not recorded correctly")
task(task_id="${sessionId}", load_skills=[], prompt="fix: checkbox not recorded correctly")
\`\`\`
**Your completion is NOT tracked until the checkbox is marked in the plan file.**
@@ -47,7 +47,7 @@ ${VERIFICATION_REMINDER}
**If ANY verification fails, use this immediately:**
\`\`\`
task(session_id="${sessionId}", load_skills=[], prompt="fix: [describe the specific failure]")
task(task_id="${sessionId}", load_skills=[], prompt="fix: [describe the specific failure]")
\`\`\`
${buildReuseHint(sessionId)}`
@@ -115,15 +115,15 @@ task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="<gat
### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)
**Plan agent returns a session_id. USE IT for follow-up interactions.**
**Plan agent returns a task_id. USE IT for follow-up interactions.**
| Scenario | Action |
|----------|--------|
| Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="<your answer>")\` |
| Need to refine the plan | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Please adjust: <feedback>")\` |
| Plan needs more detail | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Add more detail to Task N")\` |
| Plan agent asks clarifying questions | \`task(task_id="{returned_task_id}", load_skills=[], run_in_background=false, prompt="<your answer>")\` |
| Need to refine the plan | \`task(task_id="{returned_task_id}", load_skills=[], run_in_background=false, prompt="Please adjust: <feedback>")\` |
| Plan needs more detail | \`task(task_id="{returned_task_id}", load_skills=[], run_in_background=false, prompt="Add more detail to Task N")\` |
**WHY SESSION_ID IS CRITICAL:**
**WHY TASK_ID IS CRITICAL:**
- Plan agent retains FULL conversation context
- No repeated exploration or context gathering
- Saves 70%+ tokens on follow-ups
@@ -134,7 +134,7 @@ task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="<gat
task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="Here's more info...")
// CORRECT: Resume preserves everything
task(session_id="ses_abc123", load_skills=[], run_in_background=false, prompt="Here's my answer to your question: ...")
task(task_id="ses_abc123", load_skills=[], run_in_background=false, prompt="Here's my answer to your question: ...")
\`\`\`
**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**
@@ -161,13 +161,13 @@ task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="<gat
### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)
**Plan agent returns a session_id. USE IT for follow-up interactions.**
**Plan agent returns a task_id. USE IT for follow-up interactions.**
| Scenario | Action |
|----------|--------|
| Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="<your answer>")\` |
| Need to refine the plan | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Please adjust: <feedback>")\` |
| Plan needs more detail | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Add more detail to Task N")\` |
| Plan agent asks clarifying questions | \`task(task_id="{returned_task_id}", load_skills=[], run_in_background=false, prompt="<your answer>")\` |
| Need to refine the plan | \`task(task_id="{returned_task_id}", load_skills=[], run_in_background=false, prompt="Please adjust: <feedback>")\` |
| Plan needs more detail | \`task(task_id="{returned_task_id}", load_skills=[], run_in_background=false, prompt="Add more detail to Task N")\` |
**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**
+4 -3
View File
@@ -12,12 +12,13 @@ export function createTaskResumeInfoHook() {
if (outputText.startsWith("Error:") || outputText.startsWith("Failed")) return
if (outputText.includes("\nto continue:")) return
const sessionId = extractTaskLink(output.metadata, outputText).sessionId
if (!sessionId) return
const link = extractTaskLink(output.metadata, outputText)
const taskId = link.taskId ?? link.sessionId
if (!taskId) return
output.output =
outputText.trimEnd() +
`\n\nto continue: task(session_id="${sessionId}", load_skills=[], run_in_background=false, prompt="...")`
`\n\nto continue: task(task_id="${taskId}", load_skills=[], run_in_background=false, prompt="...")`
}
return {
+3 -1
View File
@@ -60,6 +60,7 @@ describe("createTaskResumeInfoHook", () => {
await afterHook(input, output)
expect(output.output).toContain("to continue:")
expect(output.output).toContain('task(task_id="ses_abc123"')
expect(output.output).toContain("ses_abc123")
})
@@ -74,6 +75,7 @@ describe("createTaskResumeInfoHook", () => {
await afterHook(input, output)
expect(output.output).toContain("run_in_background=false")
expect(output.output).toContain('task_id="ses_abc123"')
})
})
})
@@ -120,7 +122,7 @@ describe("createTaskResumeInfoHook", () => {
const output = {
title: "task",
output:
'Done.\nSession ID: ses_abc123\nto continue: task(session_id="ses_abc123", load_skills=[], prompt="...")',
'Done.\nSession ID: ses_abc123\nto continue: task(task_id="ses_abc123", load_skills=[], run_in_background=false, prompt="...")',
metadata: {},
}