feat: Add templates for epics, product brief, and requirements documentation

- Introduced a comprehensive template for generating epics and stories in Phase 5, including an index and individual epic files.
- Created a product brief template for Phase 2 to summarize product vision, goals, and target users.
- Developed a requirements PRD template for Phase 3, outlining functional and non-functional requirements, along with traceability matrices.

feat: Implement tech debt roles for assessment, execution, planning, scanning, validation, and analysis

- Added roles for tech debt assessment, executor, planner, scanner, validator, and analyst, each with defined phases and processes for managing technical debt.
- Each role includes structured input requirements, processing strategies, and output formats to ensure consistency and clarity in tech debt management.
This commit is contained in:
catlog22
2026-03-07 13:32:04 +08:00
parent 7ee9b579fa
commit 29a1fea467
255 changed files with 14407 additions and 21120 deletions

View File

@@ -0,0 +1,61 @@
# Analyze Task
Parse user task description for roadmap-dev domain signals. Detect phase count, depth preference, gate configuration, and pipeline mode.
**CONSTRAINT**: Text-level analysis only. NO source code reading, NO codebase exploration.
## Signal Detection
### Phase Count
| Keywords | Inferred Phase Count |
|----------|---------------------|
| "phase 1", "phase 2", ... | Explicit phase count from numbers |
| "milestone", "milestone 1/2/3" | Count milestones |
| "first ... then ... finally" | 3 phases |
| "step 1/2/3" | Count steps |
| No phase keywords | Default: 1 phase |
### Depth Setting
| Keywords | Depth |
|----------|-------|
| "quick", "fast", "simple", "minimal" | quick |
| "thorough", "comprehensive", "complete", "full" | comprehensive |
| default | standard |
### Gate Configuration
| Keywords | Gate |
|----------|------|
| "review each plan", "approve plan", "check before execute" | plan_check: true |
| "review each phase", "approve phase", "check between phases" | phase_check: true |
| "auto", "automated", "no review", "fully automated" | all gates: false |
| default | plan_check: false, phase_check: false |
### Pipeline Mode
| Keywords | Mode |
|----------|------|
| "interactive", "step by step", "with approval" | interactive |
| default | auto |
## Output
Write coordinator state to memory (not a file). Structure:
```json
{
"pipeline_mode": "auto | interactive",
"phase_count": 1,
"depth": "quick | standard | comprehensive",
"gates": {
"plan_check": false,
"phase_check": false
},
"task_description": "<original task text>",
"notes": ["<any detected constraints or special requirements>"]
}
```
This state is passed to `commands/dispatch.md` and written to `config.json` in the session directory.

View File

@@ -15,9 +15,9 @@ Handle all coordinator monitoring events for the roadmap-dev pipeline using the
| Prefix | Role | Role Spec | inner_loop |
|--------|------|-----------|------------|
| PLAN | planner | `.claude/skills/team-roadmap-dev/role-specs/planner.md` | true (cli_tools: gemini --mode analysis) |
| EXEC | executor | `.claude/skills/team-roadmap-dev/role-specs/executor.md` | true (cli_tools: gemini --mode write) |
| VERIFY | verifier | `.claude/skills/team-roadmap-dev/role-specs/verifier.md` | true |
| PLAN | planner | `.claude/skills/team-roadmap-dev/roles/planner/role.md` | true (cli_tools: gemini --mode analysis) |
| EXEC | executor | `.claude/skills/team-roadmap-dev/roles/executor/role.md` | true (cli_tools: gemini --mode write) |
| VERIFY | verifier | `.claude/skills/team-roadmap-dev/roles/verifier/role.md` | true |
### Pipeline Structure
@@ -247,7 +247,7 @@ Agent({
run_in_background: true,
prompt: `## Role Assignment
role: <role>
role_spec: .claude/skills/team-roadmap-dev/role-specs/<role>.md
role_spec: .claude/skills/team-roadmap-dev/roles/<role>/role.md
session: <session-folder>
session_id: <session-id>
team_name: roadmap-dev

View File

@@ -98,6 +98,7 @@ For callback/check/resume/complete: load `commands/monitor.md` and execute match
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `analyze` | [commands/analyze.md](commands/analyze.md) | Phase 1 | Detect depth/phase-count/gate signals from task description |
| `roadmap-discuss` | [commands/roadmap-discuss.md](commands/roadmap-discuss.md) | Phase 2 | Discuss roadmap with user, generate session artifacts |
| `dispatch` | [commands/dispatch.md](commands/dispatch.md) | Phase 3 | Create task chain per phase |
| `monitor` | [commands/monitor.md](commands/monitor.md) | Phase 4 | Stop-Wait phase execution loop |

View File

@@ -0,0 +1,72 @@
---
role: executor
prefix: EXEC
inner_loop: true
cli_tools:
- gemini --mode write
message_types:
success: exec_complete
progress: exec_progress
error: error
---
# Executor
Wave-based code implementation per phase. Reads IMPL-*.json task files, computes execution waves from the dependency graph, delegates each task to CLI tool for code generation. Produces summary-{IMPL-ID}.md per task.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task JSONs | <session>/phase-{N}/.task/IMPL-*.json | Yes |
| Prior summaries | <session>/phase-{1..N-1}/summary-*.md | No |
| Wisdom | <session>/wisdom/ | No |
1. Glob `<session>/phase-{N}/.task/IMPL-*.json`, error if none found
2. Parse each task JSON: extract id, description, depends_on, files, convergence, implementation
3. Compute execution waves from dependency graph:
- Wave 1: tasks with no dependencies
- Wave N: tasks whose all deps are in waves 1..N-1
- Force-assign if circular (break at lowest-numbered task)
4. Load prior phase summaries for cross-task context
## Phase 3: Wave-Based Implementation
Execute waves sequentially, tasks within each wave can be parallel.
**Strategy selection**:
| Task Count | Strategy |
|------------|----------|
| <= 2 | Direct: inline Edit/Write |
| 3-5 | Single CLI tool call for all |
| > 5 | Batch: one CLI tool call per module group |
**Per task**:
1. Build prompt from task JSON: description, files, implementation steps, convergence criteria
2. Include prior summaries and wisdom as context
3. Delegate to CLI tool (`run_in_background: false`):
```
Bash({
command: `ccw cli -p "PURPOSE: Implement task ${taskId}: ${description}
TASK: ${implementationSteps}
MODE: write
CONTEXT: @${files.join(' @')} | Memory: ${priorSummaries}
EXPECTED: Working code changes matching convergence criteria
CONSTRAINTS: ${convergenceCriteria}" --tool gemini --mode write`,
run_in_background: false
})
```
4. Write `<session>/phase-{N}/summary-{IMPL-ID}.md` with: task ID, affected files, changes made, status
**Between waves**: report wave progress via team_msg (type: exec_progress)
## Phase 4: Self-Validation
| Check | Method | Pass Criteria |
|-------|--------|---------------|
| Affected files exist | `test -f <path>` for each file in summary | All present |
| TypeScript syntax | `npx tsc --noEmit` (if tsconfig.json exists) | No errors |
| Lint | `npm run lint` (best-effort) | No critical errors |
Log errors via team_msg but do NOT fix — verifier handles gap detection.

View File

@@ -0,0 +1,78 @@
---
role: planner
prefix: PLAN
inner_loop: true
cli_tools:
- gemini --mode analysis
message_types:
success: plan_ready
progress: plan_progress
error: error
---
# Planner
Research and plan creation per roadmap phase. Gathers codebase context via CLI exploration, then generates wave-based execution plans with convergence criteria via CLI planning tool.
## Phase 2: Context Loading + Research
| Input | Source | Required |
|-------|--------|----------|
| roadmap.md | <session>/roadmap.md | Yes |
| config.json | <session>/config.json | Yes |
| Prior summaries | <session>/phase-{1..N-1}/summary-*.md | No |
| Wisdom | <session>/wisdom/ | No |
1. Read roadmap.md, extract phase goal, requirements (REQ-IDs), success criteria
2. Read config.json for depth setting (quick/standard/comprehensive)
3. Load prior phase summaries for dependency context
4. Detect gap closure mode (task description contains "Gap closure")
5. Launch CLI exploration with phase requirements as exploration query:
```
Bash({
command: `ccw cli -p "PURPOSE: Explore codebase for phase requirements
TASK: • Identify files needing modification • Map patterns and dependencies • Assess test infrastructure • Identify risks
MODE: analysis
CONTEXT: @**/* | Memory: Phase goal: ${phaseGoal}
EXPECTED: Structured exploration results with file lists, patterns, risks
CONSTRAINTS: Read-only analysis" --tool gemini --mode analysis`,
run_in_background: false
})
```
- Target: files needing modification, patterns, dependencies, test infrastructure, risks
6. If depth=comprehensive: run Gemini CLI analysis (`--mode analysis --rule analysis-analyze-code-patterns`)
7. Write `<session>/phase-{N}/context.md` combining roadmap requirements + exploration results
## Phase 3: Plan Creation
1. Load context.md from Phase 2
2. Create output directory: `<session>/phase-{N}/.task/`
3. Delegate to CLI planning tool with:
```
Bash({
command: `ccw cli -p "PURPOSE: Generate wave-based execution plan for phase ${phaseNum}
TASK: • Break down requirements into tasks • Define convergence criteria • Build dependency graph • Assign waves
MODE: write
CONTEXT: @${contextMd} | Memory: ${priorSummaries}
EXPECTED: IMPL_PLAN.md + IMPL-*.json files + TODO_LIST.md
CONSTRAINTS: <= 10 tasks | Valid DAG | Measurable convergence criteria" --tool gemini --mode write`,
run_in_background: false
})
```
4. CLI tool produces: `IMPL_PLAN.md`, `.task/IMPL-*.json`, `TODO_LIST.md`
5. If gap closure: only create tasks for gaps, starting from next available ID
## Phase 4: Self-Validation
| Check | Pass Criteria | Action on Failure |
|-------|---------------|-------------------|
| Task JSON files exist | >= 1 IMPL-*.json found | Error to coordinator |
| Required fields | id, title, description, files, implementation, convergence | Log warning |
| Convergence criteria | Each task has >= 1 criterion | Log warning |
| No self-dependency | task.id not in task.depends_on | Log error, remove cycle |
| All deps valid | Every depends_on ID exists | Log warning |
| IMPL_PLAN.md exists | File present | Generate minimal version from task JSONs |
After validation, compute wave structure from dependency graph for reporting:
- Wave count = topological layers of DAG
- Report: task count, wave count, file list

View File

@@ -0,0 +1,74 @@
---
role: verifier
prefix: VERIFY
inner_loop: true
cli_tools:
- gemini --mode analysis
message_types:
success: verify_passed
failure: gaps_found
error: error
---
# Verifier
Goal-backward verification per phase. Reads convergence criteria from IMPL-*.json task files and checks against actual codebase state. Read-only — never modifies code. Produces verification.md with pass/fail and structured gap lists.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task JSONs | <session>/phase-{N}/.task/IMPL-*.json | Yes |
| Summaries | <session>/phase-{N}/summary-*.md | Yes |
| Wisdom | <session>/wisdom/ | No |
1. Glob IMPL-*.json files, extract convergence criteria from each task
2. Glob summary-*.md files, parse frontmatter (task, affects, provides)
3. If no task JSONs or summaries found → error to coordinator
## Phase 3: Goal-Backward Verification
For each task's convergence criteria, execute appropriate check:
| Criteria Type | Method |
|---------------|--------|
| File existence | `test -f <path>` |
| Command execution | Run command, check exit code |
| Pattern match | Grep for pattern in specified files |
| Semantic check | Optional: Gemini CLI (`--mode analysis --rule analysis-review-code-quality`) |
**Per task scoring**:
| Result | Condition |
|--------|-----------|
| pass | All criteria met |
| partial | Some criteria met |
| fail | No criteria met or critical check failed |
Collect all gaps from partial/failed tasks with structured format:
- task ID, criteria type, expected value, actual value
## Phase 4: Compile Results
1. Aggregate per-task results: count passed, partial, failed
2. Determine overall status:
- `passed` if gaps.length === 0
- `gaps_found` otherwise
3. Write `<session>/phase-{N}/verification.md`:
```yaml
---
phase: <N>
status: passed | gaps_found
tasks_checked: <count>
tasks_passed: <count>
gaps:
- task: "<task-id>"
type: "<criteria-type>"
item: "<description>"
expected: "<expected>"
actual: "<actual>"
---
```
4. Update .msg/meta.json with verification summary