feat: add templates for architecture documents, epics, product briefs, and requirements PRD

- Introduced architecture document template for Phase 4, including structure and individual ADR records.
- Added epics & stories template for Phase 5, detailing epic breakdown and dependencies.
- Created product brief template for Phase 2, summarizing product vision, problem statement, and target users.
- Developed requirements PRD template for Phase 3, outlining functional and non-functional requirements with traceability.
- Implemented spec command for project spec management with subcommands for loading, listing, rebuilding, and initializing specs.
This commit is contained in:
catlog22
2026-02-26 13:59:47 +08:00
parent 2b5c334bc4
commit 4ad05f8217
65 changed files with 17841 additions and 7 deletions

View File

@@ -714,13 +714,55 @@ executionContext = {
}
```
**Step 5.2: Handoff**
**Step 5.2: Serialize & Agent Handoff**
> **Why agent handoff**: Phase 1 history consumes significant context. Direct `Read("phases/02-lite-execute.md")` in the same context risks compact compressing Phase 2 instructions mid-execution. Spawning a fresh agent gives Phase 2 a clean context window.
```javascript
// Direct phase handoff: Read and execute Phase 2 (lite-execute) with in-memory context
// No Skill routing needed - executionContext is already set in Step 5.1
Read("phases/02-lite-execute.md")
// Execute Phase 2 with executionContext (Mode 1: In-Memory Plan)
// Pre-populate _loadedTasks so serialized context is self-contained
executionContext.planObject._loadedTasks = (executionContext.planObject.task_ids || []).map(id =>
JSON.parse(Read(`${sessionFolder}/.task/${id}.json`))
)
// Save executionContext to file for agent handoff
Write(`${sessionFolder}/execution-context.json`, JSON.stringify(executionContext, null, 2))
// Resolve absolute path to Phase 2 instructions
const phaseFile = Bash(`cd "${Bash('pwd').trim()}/.claude/skills/workflow-lite-plan/phases" && pwd`).trim()
+ '/02-lite-execute.md'
// Agent handoff: fresh context prevents compact from losing Phase 2 instructions
Task(
subagent_type="universal-executor",
run_in_background=false,
description=`Execute: ${taskSlug}`,
prompt=`
Execute implementation plan following lite-execute protocol.
## Phase Instructions (MUST read first)
Read and follow: ${phaseFile}
## Execution Context (Mode 1: In-Memory Plan)
Read and parse as JSON: ${sessionFolder}/execution-context.json
This is the executionContext variable referenced throughout Phase 2.
The planObject._loadedTasks array is pre-populated — getTasks(planObject) works directly.
## Key References
- Session ID: ${sessionId}
- Session folder: ${sessionFolder}
- Plan: ${sessionFolder}/plan.json
- Task files: ${sessionFolder}/.task/TASK-*.json
- Original task: ${task_description}
## Execution Steps
1. Read phase instructions file (full protocol)
2. Read execution-context.json → parse as executionContext
3. Follow Phase 2 Mode 1 (In-Memory Plan) — executionContext exists, skip user selection
4. Execute all tasks (Step 1-4 in Phase 2)
5. Run code review if codeReviewTool ≠ "Skip" (Step 5)
6. Run auto-sync (Step 6)
`
)
```
## Session Folder Structure