From a4cb1e7eb23081b05a7aaf24cdbed179ab569b81 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 2 Mar 2026 16:28:10 +0800 Subject: [PATCH] fix(planning-agent): relax task parser regex and inject Prior Analysis into CLI context 1. extractStructuredTasks regex: /### (TASK-\d+|T\d+):/ was too strict, failing when Gemini outputs fewer #'s or omits colon. Relaxed to /#{1,3}\s*(TASK-\d+|T\d+):?\s*/ to tolerate format variations. 2. CLI Command Template CONTEXT field: added explicit instruction to use Prior Analysis from task description as primary planning context when exploration files are absent. --- .claude/agents/cli-lite-planning-agent.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.claude/agents/cli-lite-planning-agent.md b/.claude/agents/cli-lite-planning-agent.md index 51a66cc4..4a4c27f0 100644 --- a/.claude/agents/cli-lite-planning-agent.md +++ b/.claude/agents/cli-lite-planning-agent.md @@ -174,7 +174,7 @@ TASK: • Identify dependencies and execution phases • Generate complexity-appropriate fields (rationale, verification, risks, code_skeleton, data_flow) MODE: analysis -CONTEXT: @**/* | Memory: {context_summary} +CONTEXT: @**/* | Memory: {context_summary}. If task description contains '## Prior Analysis', treat it as primary planning context with pre-analyzed files, findings, and recommendations. EXPECTED: ## Summary [overview] @@ -257,8 +257,8 @@ function extractSection(cliOutput, header) { // Parse structured tasks from CLI output function extractStructuredTasks(cliOutput, complexity) { const tasks = [] - // Split by task headers (supports both TASK-NNN and T\d+ formats) - const taskBlocks = cliOutput.split(/### (TASK-\d+|T\d+):/).slice(1) + // Split by task headers (flexible: 1-3 #, optional colon, supports TASK-NNN and T\d+) + const taskBlocks = cliOutput.split(/#{1,3}\s*(TASK-\d+|T\d+):?\s*/).slice(1) for (let i = 0; i < taskBlocks.length; i += 2) { const rawId = taskBlocks[i].trim()