claude-code-workflow 7.2.29 → 7.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
- package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
- package/.claude/agents/action-planning-agent.md +7 -4
- package/.claude/agents/cli-explore-agent.md +77 -63
- package/.claude/agents/cli-lite-planning-agent.md +11 -10
- package/.claude/agents/issue-plan-agent.md +421 -426
- package/.claude/commands/workflow/spec/setup.md +1 -1
- package/.claude/skills/ccw-chain/SKILL.md +119 -0
- package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
- package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
- package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
- package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
- package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
- package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
- package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
- package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
- package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
- package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
- package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
- package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
- package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
- package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
- package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
- package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
- package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
- package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
- package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
- package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
- package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
- package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
- package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
- package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
- package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
- package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
- package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
- package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
- package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
- package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
- package/.claude/skills/chain-loader/SKILL.md +78 -0
- package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
- package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
- package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
- package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
- package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
- package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
- package/.claude/skills/review-cycle/phases/review-module.md +764 -764
- package/.claude/skills/review-cycle/phases/review-session.md +775 -775
- package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
- package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
- package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
- package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
- package/README.md +14 -0
- package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
- package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
- package/ccw/dist/tools/chain-loader.d.ts +10 -0
- package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
- package/ccw/dist/tools/chain-loader.js +642 -0
- package/ccw/dist/tools/chain-loader.js.map +1 -0
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +2 -0
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/json-builder.js +20 -0
- package/ccw/dist/tools/json-builder.js.map +1 -1
- package/ccw/dist/types/chain-types.d.ts +72 -0
- package/ccw/dist/types/chain-types.d.ts.map +1 -0
- package/ccw/dist/types/chain-types.js +5 -0
- package/ccw/dist/types/chain-types.js.map +1 -0
- package/ccw/scripts/prepublish-clean.mjs +0 -1
- package/package.json +1 -3
- package/ccw-litellm/README.md +0 -180
- package/ccw-litellm/pyproject.toml +0 -35
- package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
- package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
- package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
- package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
- package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
- package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
- package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
- package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
- package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
- package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
- package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
# Phase 2: Context Gathering
|
|
2
|
+
|
|
3
|
+
Gather project context and analyze codebase via context-search-agent with parallel exploration.
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
- Gather project context using context-search-agent
|
|
8
|
+
- Identify critical files, architecture patterns, and constraints
|
|
9
|
+
- Detect conflict risk level for Phase 3 decision
|
|
10
|
+
- Update planning-notes.md with findings
|
|
11
|
+
|
|
12
|
+
## Core Philosophy
|
|
13
|
+
|
|
14
|
+
- **Agent Delegation**: Delegate all discovery to `context-search-agent` for autonomous execution
|
|
15
|
+
- **Detection-First**: Check for existing context-package before executing
|
|
16
|
+
- **Plan Mode**: Full comprehensive analysis (vs lightweight brainstorm mode)
|
|
17
|
+
- **Standardized Output**: Generate `.workflow/active/{session}/.process/context-package.json`
|
|
18
|
+
|
|
19
|
+
## Execution
|
|
20
|
+
|
|
21
|
+
### Step 2.1: Context-Package Detection
|
|
22
|
+
|
|
23
|
+
**Execute First** - Check if valid package already exists:
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
const contextPackagePath = `.workflow/active/${sessionId}/.process/context-package.json`;
|
|
27
|
+
|
|
28
|
+
if (file_exists(contextPackagePath)) {
|
|
29
|
+
const existing = Read(contextPackagePath);
|
|
30
|
+
|
|
31
|
+
// Validate package belongs to current session
|
|
32
|
+
if (existing?.metadata?.session_id === sessionId) {
|
|
33
|
+
console.log("Valid context-package found for session:", sessionId);
|
|
34
|
+
console.log("Stats:", existing.statistics);
|
|
35
|
+
console.log("Conflict Risk:", existing.conflict_detection.risk_level);
|
|
36
|
+
// Skip execution, store variables and proceed to Step 2.5
|
|
37
|
+
contextPath = contextPackagePath;
|
|
38
|
+
conflictRisk = existing.conflict_detection.risk_level;
|
|
39
|
+
return; // Early exit - skip Steps 2.2-2.4
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2.2: Complexity Assessment & Parallel Explore
|
|
45
|
+
|
|
46
|
+
**Only execute if Step 2.1 finds no valid package**
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
// 2.2.1 Complexity Assessment
|
|
50
|
+
function analyzeTaskComplexity(taskDescription) {
|
|
51
|
+
const text = taskDescription.toLowerCase();
|
|
52
|
+
if (/architect|refactor|restructure|modular|cross-module/.test(text)) return 'High';
|
|
53
|
+
if (/multiple|several|integrate|migrate|extend/.test(text)) return 'Medium';
|
|
54
|
+
return 'Low';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ANGLE_PRESETS = {
|
|
58
|
+
architecture: ['architecture', 'dependencies', 'modularity', 'integration-points'],
|
|
59
|
+
security: ['security', 'auth-patterns', 'dataflow', 'validation'],
|
|
60
|
+
performance: ['performance', 'bottlenecks', 'caching', 'data-access'],
|
|
61
|
+
bugfix: ['error-handling', 'dataflow', 'state-management', 'edge-cases'],
|
|
62
|
+
feature: ['patterns', 'integration-points', 'testing', 'dependencies'],
|
|
63
|
+
refactor: ['architecture', 'patterns', 'dependencies', 'testing']
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function selectAngles(taskDescription, complexity) {
|
|
67
|
+
const text = taskDescription.toLowerCase();
|
|
68
|
+
let preset = 'feature';
|
|
69
|
+
if (/refactor|architect|restructure/.test(text)) preset = 'architecture';
|
|
70
|
+
else if (/security|auth|permission/.test(text)) preset = 'security';
|
|
71
|
+
else if (/performance|slow|optimi/.test(text)) preset = 'performance';
|
|
72
|
+
else if (/fix|bug|error|issue/.test(text)) preset = 'bugfix';
|
|
73
|
+
|
|
74
|
+
const count = complexity === 'High' ? 4 : (complexity === 'Medium' ? 3 : 1);
|
|
75
|
+
return ANGLE_PRESETS[preset].slice(0, count);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const complexity = analyzeTaskComplexity(task_description);
|
|
79
|
+
const selectedAngles = selectAngles(task_description, complexity);
|
|
80
|
+
const sessionFolder = `.workflow/active/${sessionId}/.process`;
|
|
81
|
+
|
|
82
|
+
// 2.2.2 Launch Parallel Explore Agents
|
|
83
|
+
const explorationTasks = selectedAngles.map((angle, index) =>
|
|
84
|
+
Task(
|
|
85
|
+
subagent_type="cli-explore-agent",
|
|
86
|
+
run_in_background=false,
|
|
87
|
+
description=`Explore: ${angle}`,
|
|
88
|
+
prompt=`
|
|
89
|
+
## Task Objective
|
|
90
|
+
Execute **${angle}** exploration for task planning context. Analyze codebase from this specific angle to discover relevant structure, patterns, and constraints.
|
|
91
|
+
|
|
92
|
+
## Assigned Context
|
|
93
|
+
- **Exploration Angle**: ${angle}
|
|
94
|
+
- **Task Description**: ${task_description}
|
|
95
|
+
- **Session ID**: ${sessionId}
|
|
96
|
+
- **Exploration Index**: ${index + 1} of ${selectedAngles.length}
|
|
97
|
+
- **Output File**: ${sessionFolder}/exploration-${angle}.json
|
|
98
|
+
|
|
99
|
+
## Agent Initialization
|
|
100
|
+
The cli-explore-agent autonomously executes project structure discovery, schema loading, project context loading, and keyword search as part of its Phase 1 initialization. No manual steps needed.
|
|
101
|
+
|
|
102
|
+
## Exploration Strategy (${angle} focus)
|
|
103
|
+
|
|
104
|
+
**Step 1: Structural Scan** (Bash)
|
|
105
|
+
- Identify modules related to ${angle}
|
|
106
|
+
- Locate files relevant to ${angle} aspect
|
|
107
|
+
- Analyze imports/dependencies from ${angle} perspective
|
|
108
|
+
|
|
109
|
+
**Step 2: Semantic Analysis** (Gemini CLI)
|
|
110
|
+
- How does existing code handle ${angle} concerns?
|
|
111
|
+
- What patterns are used for ${angle}?
|
|
112
|
+
- Where would new code integrate from ${angle} viewpoint?
|
|
113
|
+
|
|
114
|
+
**Step 3: Write Output**
|
|
115
|
+
- Consolidate ${angle} findings into JSON
|
|
116
|
+
- Identify ${angle}-specific clarification needs
|
|
117
|
+
|
|
118
|
+
## Expected Output
|
|
119
|
+
|
|
120
|
+
**File**: ${sessionFolder}/exploration-${angle}.json
|
|
121
|
+
|
|
122
|
+
**Required Fields** (all ${angle} focused):
|
|
123
|
+
- Follow explore-json-schema.json exactly (loaded during agent initialization)
|
|
124
|
+
- All fields scoped to ${angle} perspective
|
|
125
|
+
- Ensure rationale is specific to ${angle} topic (not generic)
|
|
126
|
+
- Include file:line locations in integration_points
|
|
127
|
+
|
|
128
|
+
## Success Criteria
|
|
129
|
+
- [ ] At least 3 relevant files identified with ${angle} rationale
|
|
130
|
+
- [ ] Patterns are actionable (code examples, not generic advice)
|
|
131
|
+
- [ ] Integration points include file:line locations
|
|
132
|
+
- [ ] Constraints are project-specific to ${angle}
|
|
133
|
+
- [ ] JSON output follows schema exactly
|
|
134
|
+
- [ ] clarification_needs includes options + recommended
|
|
135
|
+
|
|
136
|
+
## Output
|
|
137
|
+
Write: ${sessionFolder}/exploration-${angle}.json
|
|
138
|
+
Return: 2-3 sentence summary of ${angle} findings
|
|
139
|
+
`
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
// 2.2.3 Generate Manifest after all complete
|
|
144
|
+
const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`).split('\n').filter(f => f.trim());
|
|
145
|
+
const explorationManifest = {
|
|
146
|
+
session_id: sessionId,
|
|
147
|
+
task_description,
|
|
148
|
+
timestamp: new Date().toISOString(),
|
|
149
|
+
complexity,
|
|
150
|
+
exploration_count: selectedAngles.length,
|
|
151
|
+
angles_explored: selectedAngles,
|
|
152
|
+
explorations: explorationFiles.map(file => {
|
|
153
|
+
const data = JSON.parse(Read(file));
|
|
154
|
+
return { angle: data._metadata.exploration_angle, file: file.split('/').pop(), path: file, index: data._metadata.exploration_index };
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
Write(`${sessionFolder}/explorations-manifest.json`, JSON.stringify(explorationManifest, null, 2));
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Step 2.3: Invoke Context-Search Agent
|
|
161
|
+
|
|
162
|
+
**Only execute after Step 2.2 completes**
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
// Load user intent from planning-notes.md (from Phase 1)
|
|
166
|
+
const planningNotesPath = `.workflow/active/${sessionId}/planning-notes.md`;
|
|
167
|
+
let userIntent = { goal: task_description, key_constraints: "None specified" };
|
|
168
|
+
|
|
169
|
+
if (file_exists(planningNotesPath)) {
|
|
170
|
+
const notesContent = Read(planningNotesPath);
|
|
171
|
+
const goalMatch = notesContent.match(/\*\*GOAL\*\*:\s*(.+)/);
|
|
172
|
+
const constraintsMatch = notesContent.match(/\*\*KEY_CONSTRAINTS\*\*:\s*(.+)/);
|
|
173
|
+
if (goalMatch) userIntent.goal = goalMatch[1].trim();
|
|
174
|
+
if (constraintsMatch) userIntent.key_constraints = constraintsMatch[1].trim();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
Task(
|
|
178
|
+
subagent_type="context-search-agent",
|
|
179
|
+
run_in_background=false,
|
|
180
|
+
description="Gather comprehensive context for plan",
|
|
181
|
+
prompt=`
|
|
182
|
+
## Execution Mode
|
|
183
|
+
**PLAN MODE** (Comprehensive) - Full Phase 1-3 execution with priority sorting
|
|
184
|
+
|
|
185
|
+
## Session Information
|
|
186
|
+
- **Session ID**: ${sessionId}
|
|
187
|
+
- **Task Description**: ${task_description}
|
|
188
|
+
- **Output Path**: .workflow/${sessionId}/.process/context-package.json
|
|
189
|
+
|
|
190
|
+
## User Intent (from Phase 1 - Planning Notes)
|
|
191
|
+
**GOAL**: ${userIntent.goal}
|
|
192
|
+
**KEY_CONSTRAINTS**: ${userIntent.key_constraints}
|
|
193
|
+
|
|
194
|
+
This is the PRIMARY context source - all subsequent analysis must align with user intent.
|
|
195
|
+
|
|
196
|
+
## Exploration Input (from Step 2.2)
|
|
197
|
+
- **Manifest**: ${sessionFolder}/explorations-manifest.json
|
|
198
|
+
- **Exploration Count**: ${explorationManifest.exploration_count}
|
|
199
|
+
- **Angles**: ${explorationManifest.angles_explored.join(', ')}
|
|
200
|
+
- **Complexity**: ${complexity}
|
|
201
|
+
|
|
202
|
+
## Mission
|
|
203
|
+
Execute complete context-search-agent workflow (Phase 1-3) for implementation planning.
|
|
204
|
+
|
|
205
|
+
Key emphasis:
|
|
206
|
+
- Run: ccw spec load --category exploration FIRST (per your spec Phase 1.1b)
|
|
207
|
+
- Synthesize exploration results with project context
|
|
208
|
+
- Generate prioritized_context with user_intent alignment
|
|
209
|
+
- Apply specs/*.md constraints during conflict detection
|
|
210
|
+
|
|
211
|
+
Input priority: User Intent > project-tech.json > Exploration results > Code discovery > Web examples
|
|
212
|
+
|
|
213
|
+
## Output Requirements
|
|
214
|
+
|
|
215
|
+
Complete context-package.json must include a **prioritized_context** section:
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"prioritized_context": {
|
|
219
|
+
"user_intent": { "goal": "...", "scope": "...", "key_constraints": ["..."] },
|
|
220
|
+
"priority_tiers": {
|
|
221
|
+
"critical": [{ "path": "...", "relevance": 0.95, "rationale": "..." }],
|
|
222
|
+
"high": [], "medium": [], "low": []
|
|
223
|
+
},
|
|
224
|
+
"dependency_order": ["module1", "module2", "module3"],
|
|
225
|
+
"sorting_rationale": "Based on user goal alignment, exploration critical files, and dependency graph"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
All other required fields (metadata, project_context, project_guidelines, assets, dependencies, brainstorm_artifacts, conflict_detection, exploration_results) follow context-search-agent standard output schema.
|
|
231
|
+
|
|
232
|
+
## Planning Notes Record (REQUIRED)
|
|
233
|
+
After completing context-package.json, append to planning-notes.md:
|
|
234
|
+
|
|
235
|
+
**File**: .workflow/active/${sessionId}/planning-notes.md
|
|
236
|
+
**Location**: Under "## Context Findings (Phase 2)" section
|
|
237
|
+
**Format**:
|
|
238
|
+
### [Context-Search Agent] YYYY-MM-DD
|
|
239
|
+
- **Note**: [Brief summary of key findings]
|
|
240
|
+
|
|
241
|
+
Execute autonomously following agent documentation.
|
|
242
|
+
Report completion with statistics.
|
|
243
|
+
`
|
|
244
|
+
)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Step 2.4: Output Verification
|
|
248
|
+
|
|
249
|
+
After agent completes, verify output:
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
// Verify file was created
|
|
253
|
+
const outputPath = `.workflow/active/${sessionId}/.process/context-package.json`;
|
|
254
|
+
if (!file_exists(outputPath)) {
|
|
255
|
+
throw new Error("Agent failed to generate context-package.json");
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Store variables for subsequent phases
|
|
259
|
+
contextPath = outputPath;
|
|
260
|
+
|
|
261
|
+
// Verify exploration_results included
|
|
262
|
+
const pkg = JSON.parse(Read(outputPath));
|
|
263
|
+
if (pkg.exploration_results?.exploration_count > 0) {
|
|
264
|
+
console.log(`Exploration results aggregated: ${pkg.exploration_results.exploration_count} angles`);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
conflictRisk = pkg.conflict_detection?.risk_level || 'low';
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### TodoWrite Update (Phase 2 in progress - tasks attached)
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
[
|
|
274
|
+
{"content": "Phase 1: Session Discovery", "status": "completed", "activeForm": "Executing session discovery"},
|
|
275
|
+
{"content": "Phase 2: Context Gathering", "status": "in_progress", "activeForm": "Executing context gathering"},
|
|
276
|
+
{"content": " -> Analyze codebase structure", "status": "in_progress", "activeForm": "Analyzing codebase structure"},
|
|
277
|
+
{"content": " -> Identify integration points", "status": "pending", "activeForm": "Identifying integration points"},
|
|
278
|
+
{"content": " -> Generate context package", "status": "pending", "activeForm": "Generating context package"},
|
|
279
|
+
{"content": "Phase 4: Task Generation", "status": "pending", "activeForm": "Executing task generation"}
|
|
280
|
+
]
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### TodoWrite Update (Phase 2 completed - tasks collapsed)
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
[
|
|
287
|
+
{"content": "Phase 1: Session Discovery", "status": "completed", "activeForm": "Executing session discovery"},
|
|
288
|
+
{"content": "Phase 2: Context Gathering", "status": "completed", "activeForm": "Executing context gathering"},
|
|
289
|
+
{"content": "Phase 4: Task Generation", "status": "pending", "activeForm": "Executing task generation"}
|
|
290
|
+
]
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Step 2.5: Update Planning Notes
|
|
294
|
+
|
|
295
|
+
After context gathering completes, update planning-notes.md with findings:
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
// Read context-package to extract key findings
|
|
299
|
+
const contextPackage = JSON.parse(Read(contextPath))
|
|
300
|
+
const conflictRisk = contextPackage.conflict_detection?.risk_level || 'low'
|
|
301
|
+
const criticalFiles = (contextPackage.exploration_results?.aggregated_insights?.critical_files || [])
|
|
302
|
+
.slice(0, 5).map(f => f.path)
|
|
303
|
+
const archPatterns = contextPackage.project_context?.architecture_patterns || []
|
|
304
|
+
const constraints = contextPackage.exploration_results?.aggregated_insights?.constraints || []
|
|
305
|
+
|
|
306
|
+
// Append Phase 2 findings to planning-notes.md
|
|
307
|
+
Edit(planningNotesPath, {
|
|
308
|
+
old: '## Context Findings (Phase 2)\n(To be filled by context-gather)',
|
|
309
|
+
new: `## Context Findings (Phase 2)
|
|
310
|
+
|
|
311
|
+
- **CRITICAL_FILES**: ${criticalFiles.join(', ') || 'None identified'}
|
|
312
|
+
- **ARCHITECTURE**: ${archPatterns.join(', ') || 'Not detected'}
|
|
313
|
+
- **CONFLICT_RISK**: ${conflictRisk}
|
|
314
|
+
- **CONSTRAINTS**: ${constraints.length > 0 ? constraints.join('; ') : 'None'}`
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
// Append Phase 2 constraints to consolidated list
|
|
318
|
+
Edit(planningNotesPath, {
|
|
319
|
+
old: '## Consolidated Constraints (Phase 4 Input)',
|
|
320
|
+
new: `## Consolidated Constraints (Phase 4 Input)
|
|
321
|
+
${constraints.map((c, i) => `${i + 2}. [Context] ${c}`).join('\n')}`
|
|
322
|
+
})
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Auto-Continue**: Return to user showing Phase 2 results, then auto-continue to Phase 3/4 (depending on `conflictRisk`).
|
|
326
|
+
|
|
327
|
+
## Output
|
|
328
|
+
|
|
329
|
+
- **Variable**: `contextPath` (path to context-package.json)
|
|
330
|
+
- **Variable**: `conflictRisk` (none/low/medium/high)
|
|
331
|
+
- **File**: `context-package.json`
|
|
332
|
+
- **TodoWrite**: Mark Phase 2 completed, determine Phase 3 or Phase 4
|
|
333
|
+
|
|
334
|
+
## Next Phase
|
|
335
|
+
|
|
336
|
+
Return to orchestrator. Orchestrator checks `conflictRisk`:
|
|
337
|
+
- If `conflictRisk >= medium` -> [Phase 3: Conflict Resolution](03-conflict-resolution.md)
|
|
338
|
+
- If `conflictRisk < medium` -> [Phase 4: Task Generation](04-task-generation.md)
|