claude-cli-advanced-starter-pack 1.0.16 → 1.8.0

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.
Files changed (61) hide show
  1. package/OVERVIEW.md +5 -1
  2. package/README.md +241 -132
  3. package/bin/gtask.js +53 -0
  4. package/package.json +1 -1
  5. package/src/cli/menu.js +27 -0
  6. package/src/commands/explore-mcp/mcp-registry.js +99 -0
  7. package/src/commands/init.js +309 -80
  8. package/src/commands/install-panel-hook.js +108 -0
  9. package/src/commands/install-scripts.js +232 -0
  10. package/src/commands/install-skill.js +220 -0
  11. package/src/commands/panel.js +297 -0
  12. package/src/commands/setup-wizard.js +4 -3
  13. package/src/commands/test-setup.js +4 -5
  14. package/src/data/releases.json +209 -0
  15. package/src/panel/queue.js +188 -0
  16. package/templates/commands/ask-claude.template.md +118 -0
  17. package/templates/commands/ccasp-panel.template.md +72 -0
  18. package/templates/commands/ccasp-setup.template.md +470 -79
  19. package/templates/commands/create-smoke-test.template.md +186 -0
  20. package/templates/commands/project-impl.template.md +9 -113
  21. package/templates/commands/refactor-check.template.md +112 -0
  22. package/templates/commands/refactor-cleanup.template.md +144 -0
  23. package/templates/commands/refactor-prep.template.md +192 -0
  24. package/templates/docs/AI_ARCHITECTURE_CONSTITUTION.template.md +198 -0
  25. package/templates/docs/DETAILED_GOTCHAS.template.md +347 -0
  26. package/templates/docs/PHASE-DEV-CHECKLIST.template.md +241 -0
  27. package/templates/docs/PROGRESS_JSON_TEMPLATE.json +117 -0
  28. package/templates/docs/background-agent.template.md +264 -0
  29. package/templates/hooks/autonomous-decision-logger.template.js +207 -0
  30. package/templates/hooks/branch-merge-checker.template.js +272 -0
  31. package/templates/hooks/context-injector.template.js +261 -0
  32. package/templates/hooks/git-commit-tracker.template.js +267 -0
  33. package/templates/hooks/happy-mode-detector.template.js +214 -0
  34. package/templates/hooks/happy-title-generator.template.js +260 -0
  35. package/templates/hooks/issue-completion-detector.template.js +205 -0
  36. package/templates/hooks/panel-queue-reader.template.js +83 -0
  37. package/templates/hooks/phase-validation-gates.template.js +307 -0
  38. package/templates/hooks/session-id-generator.template.js +236 -0
  39. package/templates/hooks/token-budget-loader.template.js +234 -0
  40. package/templates/hooks/token-usage-monitor.template.js +193 -0
  41. package/templates/hooks/tool-output-cacher.template.js +219 -0
  42. package/templates/patterns/README.md +129 -0
  43. package/templates/patterns/l1-l2-orchestration.md +189 -0
  44. package/templates/patterns/multi-phase-orchestration.md +258 -0
  45. package/templates/patterns/two-tier-query-pipeline.md +192 -0
  46. package/templates/scripts/README.md +109 -0
  47. package/templates/scripts/analyze-delegation-log.js +299 -0
  48. package/templates/scripts/autonomous-decision-logger.js +277 -0
  49. package/templates/scripts/git-history-analyzer.py +269 -0
  50. package/templates/scripts/phase-validation-gates.js +307 -0
  51. package/templates/scripts/poll-deployment-status.js +260 -0
  52. package/templates/scripts/roadmap-scanner.js +263 -0
  53. package/templates/scripts/validate-deployment.js +293 -0
  54. package/templates/skills/agent-creator/skill.json +18 -0
  55. package/templates/skills/agent-creator/skill.md +335 -0
  56. package/templates/skills/hook-creator/skill.json +18 -0
  57. package/templates/skills/hook-creator/skill.md +318 -0
  58. package/templates/skills/panel/skill.json +18 -0
  59. package/templates/skills/panel/skill.md +90 -0
  60. package/templates/skills/rag-agent-creator/skill.json +18 -0
  61. package/templates/skills/rag-agent-creator/skill.md +307 -0
@@ -0,0 +1,129 @@
1
+ # Agent Patterns Library
2
+
3
+ Reusable patterns for Claude Code agent orchestration.
4
+
5
+ ## Quick Reference
6
+
7
+ | Pattern | Use Case | Complexity |
8
+ |---------|----------|------------|
9
+ | [Two-Tier Query Pipeline](two-tier-query-pipeline.md) | Intent classification + execution | Medium |
10
+ | [L1→L2 Orchestration](l1-l2-orchestration.md) | Master-worker parallel tasks | Medium |
11
+ | [Multi-Phase Orchestration](multi-phase-orchestration.md) | Sequential phases with parallel tasks | High |
12
+
13
+ ## Choosing a Pattern
14
+
15
+ ### Simple Task Routing
16
+ **Use: Two-Tier Query Pipeline**
17
+ - User requests vary in type
18
+ - Different handlers for different intents
19
+ - Need confidence-based routing
20
+
21
+ ### Parallel Subtask Execution
22
+ **Use: L1→L2 Orchestration**
23
+ - Task decomposes into independent parts
24
+ - Parallel execution improves speed
25
+ - Need result aggregation
26
+
27
+ ### Complex Multi-Step Projects
28
+ **Use: Multi-Phase Orchestration**
29
+ - Work has natural phase boundaries
30
+ - Validation needed between phases
31
+ - Phases may have parallel subtasks
32
+
33
+ ## Pattern Combinations
34
+
35
+ ### Query → Orchestration
36
+
37
+ ```
38
+ User Request
39
+
40
+ ┌─────────────────┐
41
+ │ Query Pipeline │ Classify intent
42
+ └─────────────────┘
43
+
44
+ ┌─────────────────┐
45
+ │ L1→L2 Pattern │ Execute with specialists
46
+ └─────────────────┘
47
+ ```
48
+
49
+ ### Phase → Orchestration
50
+
51
+ ```
52
+ ┌─────────────────────────────┐
53
+ │ Phase 1: Discovery │
54
+ │ ┌───────────────────────┐ │
55
+ │ │ L1→L2 Orchestration │ │ Parallel exploration
56
+ │ └───────────────────────┘ │
57
+ └─────────────────────────────┘
58
+
59
+ ┌─────────────────────────────┐
60
+ │ Phase 2: Implementation │
61
+ │ ┌───────────────────────┐ │
62
+ │ │ L1→L2 Orchestration │ │ Parallel coding
63
+ │ └───────────────────────┘ │
64
+ └─────────────────────────────┘
65
+ ```
66
+
67
+ ## Implementation Tips
68
+
69
+ ### 1. Start Simple
70
+ Begin with the simplest pattern that solves your problem. Add complexity only when needed.
71
+
72
+ ### 2. Use Appropriate Models
73
+ - L1 Orchestrators: Sonnet (needs reasoning)
74
+ - L2 Search/Explore: Haiku (fast, cheap)
75
+ - L2 Analysis/Generate: Sonnet (quality needed)
76
+
77
+ ### 3. Handle Failures Gracefully
78
+ Always have fallback behavior when agents fail.
79
+
80
+ ### 4. Log Extensively
81
+ Track agent launches, completions, and aggregations for debugging.
82
+
83
+ ### 5. Use Background Agents
84
+ For long-running tasks, use `run_in_background: true` to avoid blocking.
85
+
86
+ ## Creating New Patterns
87
+
88
+ When documenting a new pattern:
89
+
90
+ 1. **Overview**: What problem does it solve?
91
+ 2. **When to Use**: Clear use cases
92
+ 3. **Architecture**: Visual diagram
93
+ 4. **Implementation**: Code examples
94
+ 5. **Examples**: Real-world usage
95
+ 6. **Related Patterns**: Connections to other patterns
96
+
97
+ ## Pattern Template
98
+
99
+ ```markdown
100
+ # Pattern Name
101
+
102
+ Brief description.
103
+
104
+ ## Overview
105
+
106
+ What this pattern does.
107
+
108
+ ## When to Use
109
+
110
+ - Use case 1
111
+ - Use case 2
112
+
113
+ ## Architecture
114
+
115
+ [Diagram]
116
+
117
+ ## Implementation
118
+
119
+ [Code]
120
+
121
+ ## Example
122
+
123
+ [Complete example]
124
+
125
+ ## Related Patterns
126
+
127
+ - Pattern A
128
+ - Pattern B
129
+ ```
@@ -0,0 +1,189 @@
1
+ # L1→L2 Orchestration Pattern
2
+
3
+ Hierarchical agent coordination with parallel L2 spawning.
4
+
5
+ ## Overview
6
+
7
+ A master-worker pattern where:
8
+ - **L1 (Orchestrator)**: Decomposes task, coordinates workers, aggregates results
9
+ - **L2 (Specialists)**: Execute specific subtasks in parallel
10
+
11
+ ## When to Use
12
+
13
+ - Complex tasks that can be broken into independent subtasks
14
+ - Parallel execution would improve speed
15
+ - Subtasks require different specializations
16
+
17
+ ## Architecture
18
+
19
+ ```
20
+ ┌─────────────────────┐
21
+ │ L1 Orchestrator │
22
+ │ - Decompose task │
23
+ │ - Dispatch L2s │
24
+ │ - Aggregate │
25
+ └─────────────────────┘
26
+
27
+ ┌────────────────────┼────────────────────┐
28
+ ↓ ↓ ↓
29
+ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
30
+ │ L2 Specialist │ │ L2 Specialist │ │ L2 Specialist │
31
+ │ (Search) │ │ (Analyze) │ │ (Document) │
32
+ └───────────────┘ └───────────────┘ └───────────────┘
33
+ ```
34
+
35
+ ## Implementation
36
+
37
+ ### L1 Orchestrator
38
+
39
+ ```typescript
40
+ async function orchestrate(task: string) {
41
+ // Step 1: Decompose task into subtasks
42
+ const subtasks = await decomposeTask(task);
43
+
44
+ // Step 2: Identify dependencies
45
+ const { independent, dependent } = categorizeSubtasks(subtasks);
46
+
47
+ // Step 3: Launch independent L2 agents in parallel
48
+ const parallelResults = await launchParallelL2s(independent);
49
+
50
+ // Step 4: Launch dependent L2 agents sequentially
51
+ const sequentialResults = await launchSequentialL2s(dependent, parallelResults);
52
+
53
+ // Step 5: Aggregate results
54
+ return aggregateResults([...parallelResults, ...sequentialResults]);
55
+ }
56
+ ```
57
+
58
+ ### L2 Launcher
59
+
60
+ ```typescript
61
+ async function launchParallelL2s(subtasks: Subtask[]) {
62
+ // Launch all in single message for true parallelism
63
+ const agents = subtasks.map(subtask => ({
64
+ description: subtask.title,
65
+ prompt: subtask.prompt,
66
+ subagent_type: subtask.type,
67
+ run_in_background: true
68
+ }));
69
+
70
+ // All agents start simultaneously
71
+ const handles = await Promise.all(agents.map(a => Task(a)));
72
+
73
+ // Wait for all to complete
74
+ return Promise.all(handles.map(h => waitForAgent(h)));
75
+ }
76
+ ```
77
+
78
+ ### Task Decomposition
79
+
80
+ ```typescript
81
+ function decomposeTask(task: string): Subtask[] {
82
+ // Example: "Analyze and document the authentication system"
83
+
84
+ return [
85
+ {
86
+ id: 'search',
87
+ title: 'Find auth files',
88
+ prompt: 'Search for all authentication-related files',
89
+ type: 'Explore',
90
+ dependencies: []
91
+ },
92
+ {
93
+ id: 'analyze',
94
+ title: 'Analyze auth flow',
95
+ prompt: 'Analyze the authentication flow and security',
96
+ type: 'Plan',
97
+ dependencies: ['search']
98
+ },
99
+ {
100
+ id: 'document',
101
+ title: 'Generate docs',
102
+ prompt: 'Document the authentication system',
103
+ type: 'general-purpose',
104
+ dependencies: ['analyze']
105
+ }
106
+ ];
107
+ }
108
+ ```
109
+
110
+ ### Result Aggregation
111
+
112
+ ```typescript
113
+ function aggregateResults(results: AgentResult[]): FinalResult {
114
+ return {
115
+ summary: results.map(r => r.summary).join('\n\n'),
116
+ files: results.flatMap(r => r.files || []),
117
+ insights: results.flatMap(r => r.insights || []),
118
+ recommendations: prioritizeRecommendations(results)
119
+ };
120
+ }
121
+ ```
122
+
123
+ ## Complete Example
124
+
125
+ ```typescript
126
+ // Task: "Analyze the codebase for performance issues"
127
+
128
+ // L1 Orchestrator breaks into:
129
+ const subtasks = [
130
+ // Independent (run in parallel)
131
+ { id: 'bundle', type: 'Explore', prompt: 'Find bundle size issues' },
132
+ { id: 'queries', type: 'Explore', prompt: 'Find slow database queries' },
133
+ { id: 'renders', type: 'Explore', prompt: 'Find excessive re-renders' },
134
+
135
+ // Dependent (run after above complete)
136
+ { id: 'report', type: 'general-purpose', prompt: 'Generate performance report',
137
+ dependencies: ['bundle', 'queries', 'renders'] }
138
+ ];
139
+
140
+ // Execution:
141
+ // 1. L1 launches 3 Explore agents in parallel
142
+ // 2. All 3 complete with findings
143
+ // 3. L1 launches report agent with aggregated findings
144
+ // 4. L1 returns final report
145
+ ```
146
+
147
+ ## Model Selection by Level
148
+
149
+ | Level | Model | Reasoning |
150
+ |-------|-------|-----------|
151
+ | L1 | Sonnet | Needs to coordinate, decompose, aggregate |
152
+ | L2 Search | Haiku | Simple file discovery |
153
+ | L2 Analysis | Sonnet | Complex reasoning required |
154
+ | L2 Generate | Sonnet | Quality output needed |
155
+
156
+ ## Error Handling
157
+
158
+ ```typescript
159
+ async function orchestrateWithRecovery(task) {
160
+ const subtasks = await decomposeTask(task);
161
+ const results = [];
162
+
163
+ for (const subtask of subtasks) {
164
+ try {
165
+ const result = await executeSubtask(subtask);
166
+ results.push({ subtask, result, success: true });
167
+ } catch (error) {
168
+ // Log failure but continue with other subtasks
169
+ results.push({ subtask, error, success: false });
170
+ }
171
+ }
172
+
173
+ // Report partial success if some failed
174
+ const successful = results.filter(r => r.success);
175
+ const failed = results.filter(r => !r.success);
176
+
177
+ return {
178
+ results: aggregateResults(successful.map(r => r.result)),
179
+ failures: failed.map(f => ({ task: f.subtask.id, error: f.error })),
180
+ partial: failed.length > 0
181
+ };
182
+ }
183
+ ```
184
+
185
+ ## Related Patterns
186
+
187
+ - Two-Tier Query Pipeline
188
+ - Multi-Phase Orchestration
189
+ - Dependency Ordering
@@ -0,0 +1,258 @@
1
+ # Multi-Phase Orchestration Pattern
2
+
3
+ Sequential phase execution with parallel agents within phases.
4
+
5
+ ## Overview
6
+
7
+ Organizes work into distinct phases where:
8
+ - Phases execute sequentially (each depends on previous)
9
+ - Tasks within a phase can run in parallel
10
+ - Validation gates between phases ensure quality
11
+
12
+ ## When to Use
13
+
14
+ - Large projects with natural phase boundaries
15
+ - Work that must be done in a specific order
16
+ - Need for validation between major steps
17
+
18
+ ## Architecture
19
+
20
+ ```
21
+ ┌─────────────────────────────────────────────────────────────┐
22
+ │ L1 Controller │
23
+ └─────────────────────────────────────────────────────────────┘
24
+
25
+ ┌─────────────────────────────────────────────────────────────┐
26
+ │ Phase 1: Discovery │
27
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
28
+ │ │ Agent A │ │ Agent B │ │ Agent C │ (parallel) │
29
+ │ └──────────┘ └──────────┘ └──────────┘ │
30
+ │ ↓ Validation Gate │
31
+ └─────────────────────────────────────────────────────────────┘
32
+
33
+ ┌─────────────────────────────────────────────────────────────┐
34
+ │ Phase 2: Implementation │
35
+ │ ┌──────────┐ ┌──────────┐ │
36
+ │ │ Agent D │ │ Agent E │ (parallel) │
37
+ │ └──────────┘ └──────────┘ │
38
+ │ ↓ Validation Gate │
39
+ └─────────────────────────────────────────────────────────────┘
40
+
41
+ ┌─────────────────────────────────────────────────────────────┐
42
+ │ Phase 3: Testing │
43
+ │ ┌──────────┐ │
44
+ │ │ Agent F │ (sequential - needs all results) │
45
+ │ └──────────┘ │
46
+ └─────────────────────────────────────────────────────────────┘
47
+ ```
48
+
49
+ ## Implementation
50
+
51
+ ### Phase Controller
52
+
53
+ ```typescript
54
+ interface Phase {
55
+ id: string;
56
+ name: string;
57
+ tasks: Task[];
58
+ validation: ValidationGate;
59
+ parallel: boolean;
60
+ }
61
+
62
+ async function executePhases(phases: Phase[]): Promise<PhaseResults> {
63
+ const results: PhaseResult[] = [];
64
+ let context = {}; // Accumulates data across phases
65
+
66
+ for (const phase of phases) {
67
+ console.log(`Starting Phase ${phase.id}: ${phase.name}`);
68
+
69
+ // Execute phase tasks
70
+ const phaseResult = phase.parallel
71
+ ? await executeParallel(phase.tasks, context)
72
+ : await executeSequential(phase.tasks, context);
73
+
74
+ // Run validation gate
75
+ const validation = await phase.validation.check(phaseResult);
76
+
77
+ if (!validation.passed) {
78
+ return {
79
+ completed: results,
80
+ failed: phase,
81
+ reason: validation.reason,
82
+ context
83
+ };
84
+ }
85
+
86
+ // Update context with phase results
87
+ context = { ...context, [phase.id]: phaseResult };
88
+ results.push({ phase, result: phaseResult, validation });
89
+ }
90
+
91
+ return { completed: results, context };
92
+ }
93
+ ```
94
+
95
+ ### Parallel Task Execution
96
+
97
+ ```typescript
98
+ async function executeParallel(tasks: Task[], context: Context) {
99
+ // Prepare prompts with context
100
+ const preparedTasks = tasks.map(task => ({
101
+ ...task,
102
+ prompt: injectContext(task.prompt, context)
103
+ }));
104
+
105
+ // Launch all in parallel
106
+ const agents = preparedTasks.map(task => Task({
107
+ description: task.title,
108
+ prompt: task.prompt,
109
+ subagent_type: task.type,
110
+ run_in_background: true
111
+ }));
112
+
113
+ const handles = await Promise.all(agents);
114
+
115
+ // Wait for all to complete
116
+ return Promise.all(handles.map(waitForCompletion));
117
+ }
118
+ ```
119
+
120
+ ### Validation Gates
121
+
122
+ ```typescript
123
+ const validationGates = {
124
+ discovery: {
125
+ async check(results) {
126
+ // Verify all files were found
127
+ const allFilesFound = results.every(r => r.files?.length > 0);
128
+
129
+ // Verify no critical errors
130
+ const noErrors = results.every(r => !r.error);
131
+
132
+ return {
133
+ passed: allFilesFound && noErrors,
134
+ reason: !allFilesFound ? 'Missing required files' :
135
+ !noErrors ? 'Errors during discovery' : null
136
+ };
137
+ }
138
+ },
139
+
140
+ implementation: {
141
+ async check(results) {
142
+ // Run tests on new code
143
+ const testResult = await runTests();
144
+
145
+ // Check for type errors
146
+ const typeCheck = await runTypeCheck();
147
+
148
+ return {
149
+ passed: testResult.passing && typeCheck.clean,
150
+ reason: !testResult.passing ? `${testResult.failed} tests failed` :
151
+ !typeCheck.clean ? `${typeCheck.errors} type errors` : null
152
+ };
153
+ }
154
+ }
155
+ };
156
+ ```
157
+
158
+ ## Complete Example
159
+
160
+ ```typescript
161
+ // Project: Implement new feature with testing
162
+
163
+ const phases: Phase[] = [
164
+ {
165
+ id: 'discovery',
166
+ name: 'Codebase Discovery',
167
+ parallel: true,
168
+ tasks: [
169
+ { title: 'Find related components', type: 'Explore', ... },
170
+ { title: 'Find API endpoints', type: 'Explore', ... },
171
+ { title: 'Find existing tests', type: 'Explore', ... }
172
+ ],
173
+ validation: validationGates.discovery
174
+ },
175
+ {
176
+ id: 'planning',
177
+ name: 'Implementation Planning',
178
+ parallel: false, // Sequential - needs discovery results
179
+ tasks: [
180
+ { title: 'Design component structure', type: 'Plan', ... },
181
+ { title: 'Design API changes', type: 'Plan', ... }
182
+ ],
183
+ validation: validationGates.planning
184
+ },
185
+ {
186
+ id: 'implementation',
187
+ name: 'Code Implementation',
188
+ parallel: true, // Independent components
189
+ tasks: [
190
+ { title: 'Implement component', type: 'general-purpose', ... },
191
+ { title: 'Implement API', type: 'general-purpose', ... }
192
+ ],
193
+ validation: validationGates.implementation
194
+ },
195
+ {
196
+ id: 'testing',
197
+ name: 'Testing & Validation',
198
+ parallel: false,
199
+ tasks: [
200
+ { title: 'Write unit tests', type: 'general-purpose', ... },
201
+ { title: 'Run E2E tests', type: 'Bash', ... }
202
+ ],
203
+ validation: validationGates.testing
204
+ }
205
+ ];
206
+
207
+ // Execute
208
+ const result = await executePhases(phases);
209
+ ```
210
+
211
+ ## State Management
212
+
213
+ ### PROGRESS.json Integration
214
+
215
+ ```json
216
+ {
217
+ "current_phase": 2,
218
+ "phases": [
219
+ {
220
+ "id": "discovery",
221
+ "status": "complete",
222
+ "tasks": [...],
223
+ "validation": { "passed": true }
224
+ },
225
+ {
226
+ "id": "implementation",
227
+ "status": "in_progress",
228
+ "tasks": [...],
229
+ "validation": null
230
+ }
231
+ ]
232
+ }
233
+ ```
234
+
235
+ ### Checkpoint Recovery
236
+
237
+ ```typescript
238
+ async function resumeFromCheckpoint(progressPath: string) {
239
+ const progress = JSON.parse(await readFile(progressPath));
240
+
241
+ // Find incomplete phase
242
+ const incompleteIndex = progress.phases.findIndex(
243
+ p => p.status !== 'complete'
244
+ );
245
+
246
+ // Resume from that phase
247
+ return executePhases(
248
+ progress.phases.slice(incompleteIndex),
249
+ progress.context
250
+ );
251
+ }
252
+ ```
253
+
254
+ ## Related Patterns
255
+
256
+ - L1→L2 Orchestration
257
+ - Phase Validation Gates
258
+ - Two-Tier Query Pipeline