fix: Pass session context to agents for proper TODO_LIST and summary management

- Update workflow:execute.md to inject session context paths into agent prompts
- Modify code-developer.md to require and use session context for TODO_LIST updates
- Update task:execute.md to include session_context structure in JSON template
- Enhance action-planning-agent.md to use provided session paths for plan generation
- Fix code-review-test-agent.md to reference session context for review summaries

Resolves issue where agents couldn't locate workflow directory for TODO_LIST.md updates
and summary creation. Agents now receive explicit paths instead of assuming defaults.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-09-12 16:52:30 +08:00
parent 9082951519
commit 69ec163a39
5 changed files with 55 additions and 15 deletions

View File

@@ -65,6 +65,7 @@ END FUNCTION
- **Validation**: Checks for the task's JSON file in `.task/` and resolves its dependencies.
- **Context Preparation**: Loads task and workflow context, preparing it for the selected agent.
- **Session Context Injection**: Provides workflow directory paths to agents for TODO_LIST.md and summary management.
- **TodoWrite Coordination**: Generates execution Todos and checkpoints, syncing with `TODO_LIST.md`.
### 🏁 **Post-Execution Protocol**
@@ -199,7 +200,13 @@ This is the simplified data structure loaded to provide context for task executi
},
"workflow": {
"session": "WFS-user-auth",
"phase": "IMPLEMENT"
"phase": "IMPLEMENT",
"session_context": {
"workflow_directory": ".workflow/WFS-user-auth/",
"todo_list_location": ".workflow/WFS-user-auth/TODO_LIST.md",
"summaries_directory": ".workflow/WFS-user-auth/.summaries/",
"task_json_location": ".workflow/WFS-user-auth/.task/"
}
},
"execution": {
"agent": "code-developer",

View File

@@ -146,6 +146,12 @@ Task(subagent_type="code-developer",
prompt="[GEMINI_CLI_REQUIRED] Implement authentication logic based on schema
Task Context: impl-1.2 - Implement auth logic
Session Context:
- Workflow Directory: .workflow/WFS-user-auth/
- TODO_LIST Location: .workflow/WFS-user-auth/TODO_LIST.md
- Summaries Directory: .workflow/WFS-user-auth/.summaries/
- Task JSON Location: .workflow/WFS-user-auth/.task/impl-1.2.json
Implementation Details:
- Target File: src/auth/models/User.ts
- Function: UserSchema (lines 10-50)
@@ -156,6 +162,7 @@ Task(subagent_type="code-developer",
- Risks: Schema changes require database migration, Existing user data compatibility
- Performance: Index JWT fields for faster lookups
IMPORTANT: Update TODO_LIST.md and create summary in provided directories upon completion.
Use implementation details above for precise, targeted development.",
description="Execute impl-1.2 with full workflow context and implementation details")
```
@@ -218,7 +225,14 @@ Task(subagent_type="code-developer",
- Requirements: JWT authentication, OAuth2 support
- Scope: src/auth/*, tests/auth/*
- Dependencies: impl-1.1 (completed)
- Workflow: WFS-user-auth authentication system",
- Workflow: WFS-user-auth authentication system
Session Context:
- Workflow Directory: .workflow/WFS-user-auth/
- TODO_LIST Location: .workflow/WFS-user-auth/TODO_LIST.md
- Summaries Directory: .workflow/WFS-user-auth/.summaries/
CRITICAL: Update TODO_LIST.md and create completion summary using provided paths.",
description="Agent executes with full discovered context")
```