aiwcli 0.12.3 → 0.12.7
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/bin/dev.cmd +3 -3
- package/bin/dev.js +16 -16
- package/bin/run.cmd +3 -3
- package/bin/run.js +21 -21
- package/dist/commands/branch.js +7 -2
- package/dist/lib/bmad-installer.js +37 -37
- package/dist/lib/terminal.d.ts +2 -0
- package/dist/lib/terminal.js +57 -7
- package/dist/templates/CLAUDE.md +205 -205
- package/dist/templates/_shared/.claude/commands/handoff-resume.md +12 -64
- package/dist/templates/_shared/.claude/commands/handoff.md +12 -198
- package/dist/templates/_shared/.claude/settings.json +65 -65
- package/dist/templates/_shared/.codex/workflows/handoff.md +226 -226
- package/dist/templates/_shared/.windsurf/workflows/handoff.md +226 -226
- package/dist/templates/_shared/handoff-system/CLAUDE.md +421 -0
- package/dist/templates/_shared/{lib-ts/handoff → handoff-system/lib}/document-generator.ts +215 -216
- package/dist/templates/_shared/{lib-ts/handoff → handoff-system/lib}/handoff-reader.ts +157 -158
- package/dist/templates/_shared/{scripts → handoff-system/scripts}/resume_handoff.ts +373 -373
- package/dist/templates/_shared/{scripts → handoff-system/scripts}/save_handoff.ts +469 -358
- package/dist/templates/_shared/handoff-system/workflows/handoff-resume.md +66 -0
- package/dist/templates/_shared/{workflows → handoff-system/workflows}/handoff.md +254 -254
- package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +2 -2
- package/dist/templates/_shared/hooks-ts/archive_plan.ts +159 -159
- package/dist/templates/_shared/hooks-ts/context_monitor.ts +147 -147
- package/dist/templates/_shared/hooks-ts/file-suggestion.ts +128 -128
- package/dist/templates/_shared/hooks-ts/pre_compact.ts +49 -49
- package/dist/templates/_shared/hooks-ts/session_end.ts +196 -183
- package/dist/templates/_shared/hooks-ts/session_start.ts +163 -151
- package/dist/templates/_shared/hooks-ts/task_create_capture.ts +48 -48
- package/dist/templates/_shared/hooks-ts/task_update_capture.ts +74 -74
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +93 -93
- package/dist/templates/_shared/lib-ts/CLAUDE.md +367 -367
- package/dist/templates/_shared/lib-ts/base/atomic-write.ts +138 -138
- package/dist/templates/_shared/lib-ts/base/constants.ts +303 -303
- package/dist/templates/_shared/lib-ts/base/git-state.ts +58 -58
- package/dist/templates/_shared/lib-ts/base/hook-utils.ts +582 -582
- package/dist/templates/_shared/lib-ts/base/inference.ts +301 -301
- package/dist/templates/_shared/lib-ts/base/logger.ts +247 -247
- package/dist/templates/_shared/lib-ts/base/state-io.ts +202 -130
- package/dist/templates/_shared/lib-ts/base/stop-words.ts +184 -184
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +56 -0
- package/dist/templates/_shared/lib-ts/base/utils.ts +184 -184
- package/dist/templates/_shared/lib-ts/context/context-formatter.ts +566 -560
- package/dist/templates/_shared/lib-ts/context/context-selector.ts +524 -515
- package/dist/templates/_shared/lib-ts/context/context-store.ts +712 -668
- package/dist/templates/_shared/lib-ts/context/plan-manager.ts +312 -312
- package/dist/templates/_shared/lib-ts/context/task-tracker.ts +185 -185
- package/dist/templates/_shared/lib-ts/package.json +20 -20
- package/dist/templates/_shared/lib-ts/templates/formatters.ts +102 -102
- package/dist/templates/_shared/lib-ts/templates/plan-context.ts +58 -58
- package/dist/templates/_shared/lib-ts/tsconfig.json +13 -13
- package/dist/templates/_shared/lib-ts/types.ts +186 -180
- package/dist/templates/_shared/scripts/resolve_context.ts +33 -33
- package/dist/templates/_shared/scripts/status_line.ts +690 -690
- package/dist/templates/cc-native/.claude/commands/{rlm → cc-native/rlm}/ask.md +136 -136
- package/dist/templates/cc-native/.claude/commands/{rlm → cc-native/rlm}/index.md +21 -21
- package/dist/templates/cc-native/.claude/commands/{rlm → cc-native/rlm}/overview.md +56 -56
- package/dist/templates/cc-native/.claude/commands/cc-native/specdev.md +10 -10
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/fix.md +8 -8
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/implement.md +8 -8
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/research.md +8 -8
- package/dist/templates/cc-native/CC-NATIVE-README.md +189 -189
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +304 -304
- package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +143 -143
- package/dist/templates/cc-native/_cc-native/agents/PLAN-ORCHESTRATOR.md +213 -213
- package/dist/templates/cc-native/_cc-native/agents/plan-questions/PLAN-QUESTIONER.md +70 -70
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +96 -96
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +247 -247
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +76 -76
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +54 -54
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +51 -51
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +53 -53
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +61 -61
- package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -163
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +156 -156
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/format.ts +597 -597
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/index.ts +26 -26
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/tracker.ts +107 -107
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts/write.ts +119 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +319 -319
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +144 -144
- package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +57 -57
- package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +83 -83
- package/dist/templates/cc-native/_cc-native/lib-ts/corroboration.ts +119 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +79 -79
- package/dist/templates/cc-native/_cc-native/lib-ts/graduation.ts +132 -132
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +116 -116
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +168 -168
- package/dist/templates/cc-native/_cc-native/lib-ts/orchestrator.ts +70 -70
- package/dist/templates/cc-native/_cc-native/lib-ts/output-builder.ts +130 -130
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +80 -80
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +41 -41
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-questions.ts +101 -101
- package/dist/templates/cc-native/_cc-native/lib-ts/review-pipeline.ts +511 -511
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/agent.ts +71 -71
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/base/base-agent.ts +217 -217
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/index.ts +12 -12
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/claude-agent.ts +66 -65
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/codex-agent.ts +184 -184
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/gemini-agent.ts +39 -39
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/orchestrator-claude-agent.ts +196 -195
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/schemas.ts +201 -201
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/types.ts +21 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/CLAUDE.md +480 -480
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +287 -287
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +148 -148
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +54 -54
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +58 -58
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +208 -208
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +460 -460
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +446 -447
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +280 -280
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +274 -274
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +201 -201
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +278 -278
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +184 -184
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +275 -275
- package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +18 -18
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +329 -329
- package/dist/templates/cc-native/_cc-native/lib-ts/verdict.ts +72 -72
- package/dist/templates/cc-native/_cc-native/workflows/specdev.md +9 -9
- package/oclif.manifest.json +1 -1
- package/package.json +108 -108
- package/dist/templates/cc-native/_cc-native/lib-ts/nul +0 -3
|
@@ -1,304 +1,304 @@
|
|
|
1
|
-
# CC-Native Template Schema
|
|
2
|
-
|
|
3
|
-
## Philosophy
|
|
4
|
-
|
|
5
|
-
CC-Native uses Claude Code's native tools with minimal workflow overhead. Plan review runs automatically via external CLIs (Codex/Gemini) and parallel Claude Code agents when exiting plan mode.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Directory Structure
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
packages/cli/src/templates/cc-native/
|
|
13
|
-
├── _cc-native/ # METHOD-SPECIFIC: CC-Native template code
|
|
14
|
-
│ ├── workflows/*.md # Workflow definitions
|
|
15
|
-
│ ├── hooks/ # Hook scripts (TypeScript, run via bun)
|
|
16
|
-
│ │ ├── cc-native-plan-review.ts # Unified plan review (CLI + agents)
|
|
17
|
-
│ │ ├── add_plan_context.ts # Clarifying questions offer
|
|
18
|
-
│ │ └── plan_questions_early.ts # Phase A clarification prompt
|
|
19
|
-
│ ├── lib-ts/ # CC-Native specific TypeScript libraries
|
|
20
|
-
│ │ ├── cc-native-state.ts # State management
|
|
21
|
-
│ │ ├── config.ts # Configuration loading
|
|
22
|
-
│ │ └── reviewers/ # Plan review implementations
|
|
23
|
-
│ │ └── codex.ts # Codex CLI reviewer
|
|
24
|
-
│ └── cc-native.config.json # Plan review configuration
|
|
25
|
-
├── .claude/commands/cc-native/ # Claude Code slash commands
|
|
26
|
-
├── .claude/agents/cc-native/ # Agent definitions for plan review
|
|
27
|
-
├── .claude/settings.json # Hook wiring
|
|
28
|
-
├── .windsurf/workflows/cc-native/ # Windsurf workflows
|
|
29
|
-
├── .gitignore # Ignores _output/
|
|
30
|
-
├── CC-NATIVE-README.md # User documentation
|
|
31
|
-
└── TEMPLATE-SCHEMA.md # This file
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Native Tools Used
|
|
37
|
-
|
|
38
|
-
| Tool | Purpose |
|
|
39
|
-
|------|---------|
|
|
40
|
-
| `AskUserQuestion` | Clarify requirements before exploration |
|
|
41
|
-
| `Task` (Explore) | Gather codebase context via subagents |
|
|
42
|
-
| `Task` (general-purpose) | Execute complex subtasks |
|
|
43
|
-
| `EnterPlanMode` | Native planning with user approval |
|
|
44
|
-
| `Write` | Persist findings to scratch file (optional) |
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Workflows
|
|
49
|
-
|
|
50
|
-
| Workflow | Purpose |
|
|
51
|
-
|----------|---------|
|
|
52
|
-
| fix | Clarify → Explore → Plan → Execute |
|
|
53
|
-
| research | Clarify → Explore → Write findings |
|
|
54
|
-
| implement | Clarify → Explore → Plan → Execute (for new features) |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Output Structure
|
|
59
|
-
|
|
60
|
-
All outputs in `_output/`:
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
_output/
|
|
64
|
-
├── index.json # Global context cache
|
|
65
|
-
├── contexts/ # Context folders (method-agnostic)
|
|
66
|
-
│ └── {context-id}/
|
|
67
|
-
│ ├── state.json # Context state (source of truth)
|
|
68
|
-
│ └── plans/ # Archived plans for this context
|
|
69
|
-
│ └── YYYY-MM-DD-{slug}.md
|
|
70
|
-
├── cc-native/ # CC-Native specific outputs
|
|
71
|
-
│ ├── findings.md # Research findings (optional)
|
|
72
|
-
│ ├── reviews/ # Combined review artifacts (CLI + agents)
|
|
73
|
-
│ │ └── YYYY-MM-DD/
|
|
74
|
-
│ │ ├── HHMMSS-session-{id}-plan.md # Copy of plan
|
|
75
|
-
│ │ ├── HHMMSS-session-{id}-review.json # Combined JSON
|
|
76
|
-
│ │ └── HHMMSS-session-{id}-review.md # Combined Markdown
|
|
77
|
-
│ └── scratch/ # Working notes
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Configuration (`_cc-native/cc-native.config.json`)
|
|
83
|
-
|
|
84
|
-
CC-Native settings are stored in `_cc-native/cc-native.config.json`:
|
|
85
|
-
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"planReview": {
|
|
89
|
-
"enabled": true,
|
|
90
|
-
"reviewers": {
|
|
91
|
-
"codex": { "enabled": true, "model": "", "timeout": 120 },
|
|
92
|
-
"gemini": { "enabled": false, "model": "", "timeout": 120 }
|
|
93
|
-
},
|
|
94
|
-
"blockOnFail": false
|
|
95
|
-
},
|
|
96
|
-
"agentReview": {
|
|
97
|
-
"enabled": true,
|
|
98
|
-
"timeout": 120,
|
|
99
|
-
"blockOnFail": true,
|
|
100
|
-
"orchestrator": {
|
|
101
|
-
"enabled": true,
|
|
102
|
-
"model": "haiku",
|
|
103
|
-
"timeout": 30
|
|
104
|
-
},
|
|
105
|
-
"agentSelection": {
|
|
106
|
-
"simple": { "min": 0, "max": 0 },
|
|
107
|
-
"medium": { "min": 1, "max": 2 },
|
|
108
|
-
"high": { "min": 2, "max": 4 },
|
|
109
|
-
"fallbackCount": 2
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Plan Review Settings (External CLIs)
|
|
116
|
-
|
|
117
|
-
| Setting | Purpose | Default |
|
|
118
|
-
|---------|---------|---------|
|
|
119
|
-
| `planReview.enabled` | Master switch for external CLI review | `true` |
|
|
120
|
-
| `planReview.reviewers.codex.enabled` | Use Codex CLI for review | `true` |
|
|
121
|
-
| `planReview.reviewers.gemini.enabled` | Use Gemini CLI for review | `false` |
|
|
122
|
-
| `planReview.reviewers.*.model` | Model override | `""` (use default) |
|
|
123
|
-
| `planReview.reviewers.*.timeout` | Seconds before timeout | `120` |
|
|
124
|
-
| `planReview.blockOnFail` | Block Claude if review fails | `false` |
|
|
125
|
-
|
|
126
|
-
### Agent Review Settings (Claude Code Agents)
|
|
127
|
-
|
|
128
|
-
| Setting | Purpose | Default |
|
|
129
|
-
|---------|---------|---------|
|
|
130
|
-
| `agentReview.enabled` | Master switch for agent review | `true` |
|
|
131
|
-
| `agentReview.timeout` | Seconds per agent before timeout | `120` |
|
|
132
|
-
| `agentReview.blockOnFail` | Block Claude if any agent fails | `true` |
|
|
133
|
-
| `agentReview.orchestrator.enabled` | Use orchestrator for complexity analysis | `true` |
|
|
134
|
-
| `agentReview.orchestrator.model` | Model for orchestrator | `haiku` |
|
|
135
|
-
| `agentReview.agentSelection.simple` | Agent count for simple plans | `0-0` |
|
|
136
|
-
| `agentReview.agentSelection.medium` | Agent count for medium plans | `1-2` |
|
|
137
|
-
| `agentReview.agentSelection.high` | Agent count for complex plans | `2-4` |
|
|
138
|
-
|
|
139
|
-
### Environment Variables
|
|
140
|
-
|
|
141
|
-
| Variable | Purpose | Default |
|
|
142
|
-
|----------|---------|---------|
|
|
143
|
-
| `CC_NATIVE_ROBUST_WRITES` | Enable atomic writes and retry logic | `true` |
|
|
144
|
-
| `CC_NATIVE_NOTIFICATIONS` | Enable voice/visual notifications | `false` |
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Context Management (Phase 1 - State Based)
|
|
149
|
-
|
|
150
|
-
CC-Native uses **shared infrastructure** for cross-session context persistence:
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
_output/
|
|
154
|
-
├── index.json # CACHE: Aggregates all contexts
|
|
155
|
-
└── contexts/ # All contexts (method-agnostic)
|
|
156
|
-
├── feature-auth/
|
|
157
|
-
│ ├── state.json # SOURCE OF TRUTH: Context state
|
|
158
|
-
│ └── plans/ # Archived plans for this context
|
|
159
|
-
│ └── 2026-01-25-auth.md
|
|
160
|
-
└── another-context/
|
|
161
|
-
└── state.json
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Data Hierarchy
|
|
165
|
-
|
|
166
|
-
| Level | File | Role | Recovery |
|
|
167
|
-
|-------|------|------|----------|
|
|
168
|
-
| 1 (Truth) | `state.json` | Context state (source of truth) | Cannot be rebuilt |
|
|
169
|
-
| 2 (Cache) | `index.json` | Global context index | Rebuild from state files |
|
|
170
|
-
|
|
171
|
-
### Context Schema
|
|
172
|
-
|
|
173
|
-
```json
|
|
174
|
-
{
|
|
175
|
-
"id": "feature-auth",
|
|
176
|
-
"status": "active",
|
|
177
|
-
"summary": "JWT authentication system",
|
|
178
|
-
"method": "cc-native",
|
|
179
|
-
"created_at": "2026-01-20T10:00:00Z",
|
|
180
|
-
"last_active": "2026-01-25T09:00:00Z",
|
|
181
|
-
"in_flight": {
|
|
182
|
-
"mode": "implementing",
|
|
183
|
-
"artifact_path": "_output/contexts/feature-auth/plans/2026-01-25-auth.md",
|
|
184
|
-
"artifact_hash": "a1b2c3d4",
|
|
185
|
-
"started_at": "2026-01-25T09:00:00Z"
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### In-Flight Mode Values
|
|
191
|
-
|
|
192
|
-
| Mode | Meaning | SessionStart Behavior |
|
|
193
|
-
|------|---------|----------------------|
|
|
194
|
-
| `none` | Normal context | Show in context picker |
|
|
195
|
-
| `planning` | In plan mode | Continue planning |
|
|
196
|
-
| `pending_implementation` | Plan approved | Auto-continue implementation |
|
|
197
|
-
| `implementing` | Implementation active | Continue implementation |
|
|
198
|
-
|
|
199
|
-
### Robust Writes
|
|
200
|
-
|
|
201
|
-
When `CC_NATIVE_ROBUST_WRITES=true` (default):
|
|
202
|
-
|
|
203
|
-
1. **Atomic writes** - Uses temp file + rename (POSIX) or MoveFileExW (Windows)
|
|
204
|
-
2. **Retry logic** - 2 attempts with 500ms, 1s backoff (max 1.5s retry window)
|
|
205
|
-
3. **Crash safety** - If process dies mid-write, original file remains intact
|
|
206
|
-
|
|
207
|
-
**Why atomic writes?**
|
|
208
|
-
- Prevents corruption if hook killed mid-write
|
|
209
|
-
- Guarantees readers see complete file or nothing
|
|
210
|
-
- Cross-platform (Windows + POSIX)
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## Hooks (`_cc-native/hooks/`)
|
|
215
|
-
|
|
216
|
-
Hook scripts live in `_cc-native/hooks/`. IDE-specific wiring in `.claude/settings.json`:
|
|
217
|
-
|
|
218
|
-
```json
|
|
219
|
-
{
|
|
220
|
-
"hooks": {
|
|
221
|
-
"PreToolUse": [{
|
|
222
|
-
"matcher": "ExitPlanMode",
|
|
223
|
-
"hooks": [
|
|
224
|
-
{ "type": "command", "command": "bun run .aiwcli/_cc-native/hooks/cc-native-plan-review.ts", "timeout": 600000 }
|
|
225
|
-
]
|
|
226
|
-
}]
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**Hook order matters:** Archive runs on PermissionRequest:ExitPlanMode before reviews. If a review blocks, the archived plan is available for reference. Only plans that pass all reviews proceed to implementation.
|
|
232
|
-
|
|
233
|
-
| Hook | Trigger | Purpose |
|
|
234
|
-
|------|---------|---------|
|
|
235
|
-
| `cc-native-plan-review.ts` | ExitPlanMode | Unified review: CLI + orchestrator + agents |
|
|
236
|
-
| `add_plan_context.ts` | PostToolUse:AskUserQuestion, PreToolUse:Task | Mark questions asked; nudge Plan subagent |
|
|
237
|
-
| `plan_questions_early.ts` | UserPromptSubmit | Injects Phase A clarification in plan mode |
|
|
238
|
-
|
|
239
|
-
### Claude Feedback Mechanism
|
|
240
|
-
|
|
241
|
-
The unified review hook returns structured JSON to Claude Code:
|
|
242
|
-
|
|
243
|
-
```json
|
|
244
|
-
{
|
|
245
|
-
"hookSpecificOutput": {
|
|
246
|
-
"additionalContext": "Review results and recommendations...",
|
|
247
|
-
"permissionDecision": "deny",
|
|
248
|
-
"permissionDecisionReason": "Reason for blocking..."
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
When a plan fails review and `blockOnFail` is enabled, Claude is blocked from proceeding until the plan is revised.
|
|
254
|
-
|
|
255
|
-
### Unified Review Pipeline
|
|
256
|
-
|
|
257
|
-
The `cc-native-plan-review.ts` hook runs 4 phases:
|
|
258
|
-
|
|
259
|
-
1. **Phase 1: CLI Reviewers** - Sends plan to Codex/Gemini for external review
|
|
260
|
-
2. **Phase 2: Orchestrator** - Analyzes plan complexity and selects appropriate agents
|
|
261
|
-
3. **Phase 3: Agent Reviews** - Spawns selected Claude Code agents in parallel
|
|
262
|
-
4. **Phase 4: Combined Output** - Generates single JSON + Markdown output file
|
|
263
|
-
|
|
264
|
-
#### Orchestrator Details
|
|
265
|
-
|
|
266
|
-
The orchestrator uses a fast model (Haiku) to:
|
|
267
|
-
- Classify plan complexity (simple/medium/high)
|
|
268
|
-
- Categorize the plan (code/infrastructure/documentation/life/business/design/research)
|
|
269
|
-
- Select appropriate agents based on complexity and category
|
|
270
|
-
|
|
271
|
-
Simple plans skip agent review entirely. Medium/high complexity plans get 1-4 agents based on configuration.
|
|
272
|
-
|
|
273
|
-
#### Agent Execution
|
|
274
|
-
|
|
275
|
-
Each selected agent:
|
|
276
|
-
1. Runs as a headless Claude Code instance with `--agent` flag
|
|
277
|
-
2. Executes in parallel via Promise.all()
|
|
278
|
-
3. Uses `--permission-mode bypassPermissions` and `--max-turns 3`
|
|
279
|
-
4. Returns structured JSON verdict (pass/warn/fail)
|
|
280
|
-
|
|
281
|
-
---
|
|
282
|
-
|
|
283
|
-
## Key Principles
|
|
284
|
-
|
|
285
|
-
1. **Native tools first** - AskUserQuestion, Task, EnterPlanMode, Write
|
|
286
|
-
2. **Minimal implicit behavior** - Only plan review runs automatically
|
|
287
|
-
3. **Context efficiency** - Explore subagents discard context, findings persist
|
|
288
|
-
4. **User control** - Clarification before action, plan approval before execution
|
|
289
|
-
5. **Composable** - Each workflow is independent, no interdependencies
|
|
290
|
-
6. **Multi-layer validation** - Plans reviewed by external CLIs + orchestrator + agents
|
|
291
|
-
7. **Selective archival** - Only plans passing all reviews get archived
|
|
292
|
-
8. **Single output** - One JSON + one Markdown file per review (no duplication)
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
## Version History
|
|
297
|
-
|
|
298
|
-
| Version | Changes |
|
|
299
|
-
|---------|---------|
|
|
300
|
-
| 1.4.0 | **Phase 1 Shared Infrastructure**: Event-sourced context management in `_shared/`, contexts in `_output/contexts/`, atomic writes. **BREAKING**: Renamed config.json → cc-native.config.json |
|
|
301
|
-
| 1.3.0 | Consolidated CLI + agent review into single unified hook with combined output |
|
|
302
|
-
| 1.2.0 | Added multi-agent plan review via Claude Code agents, reordered hooks (archive last) |
|
|
303
|
-
| 1.1.0 | Added plan review via Codex/Gemini with Claude feedback, config.json |
|
|
304
|
-
| 1.0.0 | Initial release with fix, research, implement workflows |
|
|
1
|
+
# CC-Native Template Schema
|
|
2
|
+
|
|
3
|
+
## Philosophy
|
|
4
|
+
|
|
5
|
+
CC-Native uses Claude Code's native tools with minimal workflow overhead. Plan review runs automatically via external CLIs (Codex/Gemini) and parallel Claude Code agents when exiting plan mode.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Directory Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
packages/cli/src/templates/cc-native/
|
|
13
|
+
├── _cc-native/ # METHOD-SPECIFIC: CC-Native template code
|
|
14
|
+
│ ├── workflows/*.md # Workflow definitions
|
|
15
|
+
│ ├── hooks/ # Hook scripts (TypeScript, run via bun)
|
|
16
|
+
│ │ ├── cc-native-plan-review.ts # Unified plan review (CLI + agents)
|
|
17
|
+
│ │ ├── add_plan_context.ts # Clarifying questions offer
|
|
18
|
+
│ │ └── plan_questions_early.ts # Phase A clarification prompt
|
|
19
|
+
│ ├── lib-ts/ # CC-Native specific TypeScript libraries
|
|
20
|
+
│ │ ├── cc-native-state.ts # State management
|
|
21
|
+
│ │ ├── config.ts # Configuration loading
|
|
22
|
+
│ │ └── reviewers/ # Plan review implementations
|
|
23
|
+
│ │ └── codex.ts # Codex CLI reviewer
|
|
24
|
+
│ └── cc-native.config.json # Plan review configuration
|
|
25
|
+
├── .claude/commands/cc-native/ # Claude Code slash commands
|
|
26
|
+
├── .claude/agents/cc-native/ # Agent definitions for plan review
|
|
27
|
+
├── .claude/settings.json # Hook wiring
|
|
28
|
+
├── .windsurf/workflows/cc-native/ # Windsurf workflows
|
|
29
|
+
├── .gitignore # Ignores _output/
|
|
30
|
+
├── CC-NATIVE-README.md # User documentation
|
|
31
|
+
└── TEMPLATE-SCHEMA.md # This file
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Native Tools Used
|
|
37
|
+
|
|
38
|
+
| Tool | Purpose |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| `AskUserQuestion` | Clarify requirements before exploration |
|
|
41
|
+
| `Task` (Explore) | Gather codebase context via subagents |
|
|
42
|
+
| `Task` (general-purpose) | Execute complex subtasks |
|
|
43
|
+
| `EnterPlanMode` | Native planning with user approval |
|
|
44
|
+
| `Write` | Persist findings to scratch file (optional) |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Workflows
|
|
49
|
+
|
|
50
|
+
| Workflow | Purpose |
|
|
51
|
+
|----------|---------|
|
|
52
|
+
| fix | Clarify → Explore → Plan → Execute |
|
|
53
|
+
| research | Clarify → Explore → Write findings |
|
|
54
|
+
| implement | Clarify → Explore → Plan → Execute (for new features) |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Output Structure
|
|
59
|
+
|
|
60
|
+
All outputs in `_output/`:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
_output/
|
|
64
|
+
├── index.json # Global context cache
|
|
65
|
+
├── contexts/ # Context folders (method-agnostic)
|
|
66
|
+
│ └── {context-id}/
|
|
67
|
+
│ ├── state.json # Context state (source of truth)
|
|
68
|
+
│ └── plans/ # Archived plans for this context
|
|
69
|
+
│ └── YYYY-MM-DD-{slug}.md
|
|
70
|
+
├── cc-native/ # CC-Native specific outputs
|
|
71
|
+
│ ├── findings.md # Research findings (optional)
|
|
72
|
+
│ ├── reviews/ # Combined review artifacts (CLI + agents)
|
|
73
|
+
│ │ └── YYYY-MM-DD/
|
|
74
|
+
│ │ ├── HHMMSS-session-{id}-plan.md # Copy of plan
|
|
75
|
+
│ │ ├── HHMMSS-session-{id}-review.json # Combined JSON
|
|
76
|
+
│ │ └── HHMMSS-session-{id}-review.md # Combined Markdown
|
|
77
|
+
│ └── scratch/ # Working notes
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Configuration (`_cc-native/cc-native.config.json`)
|
|
83
|
+
|
|
84
|
+
CC-Native settings are stored in `_cc-native/cc-native.config.json`:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"planReview": {
|
|
89
|
+
"enabled": true,
|
|
90
|
+
"reviewers": {
|
|
91
|
+
"codex": { "enabled": true, "model": "", "timeout": 120 },
|
|
92
|
+
"gemini": { "enabled": false, "model": "", "timeout": 120 }
|
|
93
|
+
},
|
|
94
|
+
"blockOnFail": false
|
|
95
|
+
},
|
|
96
|
+
"agentReview": {
|
|
97
|
+
"enabled": true,
|
|
98
|
+
"timeout": 120,
|
|
99
|
+
"blockOnFail": true,
|
|
100
|
+
"orchestrator": {
|
|
101
|
+
"enabled": true,
|
|
102
|
+
"model": "haiku",
|
|
103
|
+
"timeout": 30
|
|
104
|
+
},
|
|
105
|
+
"agentSelection": {
|
|
106
|
+
"simple": { "min": 0, "max": 0 },
|
|
107
|
+
"medium": { "min": 1, "max": 2 },
|
|
108
|
+
"high": { "min": 2, "max": 4 },
|
|
109
|
+
"fallbackCount": 2
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Plan Review Settings (External CLIs)
|
|
116
|
+
|
|
117
|
+
| Setting | Purpose | Default |
|
|
118
|
+
|---------|---------|---------|
|
|
119
|
+
| `planReview.enabled` | Master switch for external CLI review | `true` |
|
|
120
|
+
| `planReview.reviewers.codex.enabled` | Use Codex CLI for review | `true` |
|
|
121
|
+
| `planReview.reviewers.gemini.enabled` | Use Gemini CLI for review | `false` |
|
|
122
|
+
| `planReview.reviewers.*.model` | Model override | `""` (use default) |
|
|
123
|
+
| `planReview.reviewers.*.timeout` | Seconds before timeout | `120` |
|
|
124
|
+
| `planReview.blockOnFail` | Block Claude if review fails | `false` |
|
|
125
|
+
|
|
126
|
+
### Agent Review Settings (Claude Code Agents)
|
|
127
|
+
|
|
128
|
+
| Setting | Purpose | Default |
|
|
129
|
+
|---------|---------|---------|
|
|
130
|
+
| `agentReview.enabled` | Master switch for agent review | `true` |
|
|
131
|
+
| `agentReview.timeout` | Seconds per agent before timeout | `120` |
|
|
132
|
+
| `agentReview.blockOnFail` | Block Claude if any agent fails | `true` |
|
|
133
|
+
| `agentReview.orchestrator.enabled` | Use orchestrator for complexity analysis | `true` |
|
|
134
|
+
| `agentReview.orchestrator.model` | Model for orchestrator | `haiku` |
|
|
135
|
+
| `agentReview.agentSelection.simple` | Agent count for simple plans | `0-0` |
|
|
136
|
+
| `agentReview.agentSelection.medium` | Agent count for medium plans | `1-2` |
|
|
137
|
+
| `agentReview.agentSelection.high` | Agent count for complex plans | `2-4` |
|
|
138
|
+
|
|
139
|
+
### Environment Variables
|
|
140
|
+
|
|
141
|
+
| Variable | Purpose | Default |
|
|
142
|
+
|----------|---------|---------|
|
|
143
|
+
| `CC_NATIVE_ROBUST_WRITES` | Enable atomic writes and retry logic | `true` |
|
|
144
|
+
| `CC_NATIVE_NOTIFICATIONS` | Enable voice/visual notifications | `false` |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Context Management (Phase 1 - State Based)
|
|
149
|
+
|
|
150
|
+
CC-Native uses **shared infrastructure** for cross-session context persistence:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
_output/
|
|
154
|
+
├── index.json # CACHE: Aggregates all contexts
|
|
155
|
+
└── contexts/ # All contexts (method-agnostic)
|
|
156
|
+
├── feature-auth/
|
|
157
|
+
│ ├── state.json # SOURCE OF TRUTH: Context state
|
|
158
|
+
│ └── plans/ # Archived plans for this context
|
|
159
|
+
│ └── 2026-01-25-auth.md
|
|
160
|
+
└── another-context/
|
|
161
|
+
└── state.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Data Hierarchy
|
|
165
|
+
|
|
166
|
+
| Level | File | Role | Recovery |
|
|
167
|
+
|-------|------|------|----------|
|
|
168
|
+
| 1 (Truth) | `state.json` | Context state (source of truth) | Cannot be rebuilt |
|
|
169
|
+
| 2 (Cache) | `index.json` | Global context index | Rebuild from state files |
|
|
170
|
+
|
|
171
|
+
### Context Schema
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"id": "feature-auth",
|
|
176
|
+
"status": "active",
|
|
177
|
+
"summary": "JWT authentication system",
|
|
178
|
+
"method": "cc-native",
|
|
179
|
+
"created_at": "2026-01-20T10:00:00Z",
|
|
180
|
+
"last_active": "2026-01-25T09:00:00Z",
|
|
181
|
+
"in_flight": {
|
|
182
|
+
"mode": "implementing",
|
|
183
|
+
"artifact_path": "_output/contexts/feature-auth/plans/2026-01-25-auth.md",
|
|
184
|
+
"artifact_hash": "a1b2c3d4",
|
|
185
|
+
"started_at": "2026-01-25T09:00:00Z"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### In-Flight Mode Values
|
|
191
|
+
|
|
192
|
+
| Mode | Meaning | SessionStart Behavior |
|
|
193
|
+
|------|---------|----------------------|
|
|
194
|
+
| `none` | Normal context | Show in context picker |
|
|
195
|
+
| `planning` | In plan mode | Continue planning |
|
|
196
|
+
| `pending_implementation` | Plan approved | Auto-continue implementation |
|
|
197
|
+
| `implementing` | Implementation active | Continue implementation |
|
|
198
|
+
|
|
199
|
+
### Robust Writes
|
|
200
|
+
|
|
201
|
+
When `CC_NATIVE_ROBUST_WRITES=true` (default):
|
|
202
|
+
|
|
203
|
+
1. **Atomic writes** - Uses temp file + rename (POSIX) or MoveFileExW (Windows)
|
|
204
|
+
2. **Retry logic** - 2 attempts with 500ms, 1s backoff (max 1.5s retry window)
|
|
205
|
+
3. **Crash safety** - If process dies mid-write, original file remains intact
|
|
206
|
+
|
|
207
|
+
**Why atomic writes?**
|
|
208
|
+
- Prevents corruption if hook killed mid-write
|
|
209
|
+
- Guarantees readers see complete file or nothing
|
|
210
|
+
- Cross-platform (Windows + POSIX)
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Hooks (`_cc-native/hooks/`)
|
|
215
|
+
|
|
216
|
+
Hook scripts live in `_cc-native/hooks/`. IDE-specific wiring in `.claude/settings.json`:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"hooks": {
|
|
221
|
+
"PreToolUse": [{
|
|
222
|
+
"matcher": "ExitPlanMode",
|
|
223
|
+
"hooks": [
|
|
224
|
+
{ "type": "command", "command": "bun run .aiwcli/_cc-native/hooks/cc-native-plan-review.ts", "timeout": 600000 }
|
|
225
|
+
]
|
|
226
|
+
}]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Hook order matters:** Archive runs on PermissionRequest:ExitPlanMode before reviews. If a review blocks, the archived plan is available for reference. Only plans that pass all reviews proceed to implementation.
|
|
232
|
+
|
|
233
|
+
| Hook | Trigger | Purpose |
|
|
234
|
+
|------|---------|---------|
|
|
235
|
+
| `cc-native-plan-review.ts` | ExitPlanMode | Unified review: CLI + orchestrator + agents |
|
|
236
|
+
| `add_plan_context.ts` | PostToolUse:AskUserQuestion, PreToolUse:Task | Mark questions asked; nudge Plan subagent |
|
|
237
|
+
| `plan_questions_early.ts` | UserPromptSubmit | Injects Phase A clarification in plan mode |
|
|
238
|
+
|
|
239
|
+
### Claude Feedback Mechanism
|
|
240
|
+
|
|
241
|
+
The unified review hook returns structured JSON to Claude Code:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"hookSpecificOutput": {
|
|
246
|
+
"additionalContext": "Review results and recommendations...",
|
|
247
|
+
"permissionDecision": "deny",
|
|
248
|
+
"permissionDecisionReason": "Reason for blocking..."
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
When a plan fails review and `blockOnFail` is enabled, Claude is blocked from proceeding until the plan is revised.
|
|
254
|
+
|
|
255
|
+
### Unified Review Pipeline
|
|
256
|
+
|
|
257
|
+
The `cc-native-plan-review.ts` hook runs 4 phases:
|
|
258
|
+
|
|
259
|
+
1. **Phase 1: CLI Reviewers** - Sends plan to Codex/Gemini for external review
|
|
260
|
+
2. **Phase 2: Orchestrator** - Analyzes plan complexity and selects appropriate agents
|
|
261
|
+
3. **Phase 3: Agent Reviews** - Spawns selected Claude Code agents in parallel
|
|
262
|
+
4. **Phase 4: Combined Output** - Generates single JSON + Markdown output file
|
|
263
|
+
|
|
264
|
+
#### Orchestrator Details
|
|
265
|
+
|
|
266
|
+
The orchestrator uses a fast model (Haiku) to:
|
|
267
|
+
- Classify plan complexity (simple/medium/high)
|
|
268
|
+
- Categorize the plan (code/infrastructure/documentation/life/business/design/research)
|
|
269
|
+
- Select appropriate agents based on complexity and category
|
|
270
|
+
|
|
271
|
+
Simple plans skip agent review entirely. Medium/high complexity plans get 1-4 agents based on configuration.
|
|
272
|
+
|
|
273
|
+
#### Agent Execution
|
|
274
|
+
|
|
275
|
+
Each selected agent:
|
|
276
|
+
1. Runs as a headless Claude Code instance with `--agent` flag
|
|
277
|
+
2. Executes in parallel via Promise.all()
|
|
278
|
+
3. Uses `--permission-mode bypassPermissions` and `--max-turns 3`
|
|
279
|
+
4. Returns structured JSON verdict (pass/warn/fail)
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Key Principles
|
|
284
|
+
|
|
285
|
+
1. **Native tools first** - AskUserQuestion, Task, EnterPlanMode, Write
|
|
286
|
+
2. **Minimal implicit behavior** - Only plan review runs automatically
|
|
287
|
+
3. **Context efficiency** - Explore subagents discard context, findings persist
|
|
288
|
+
4. **User control** - Clarification before action, plan approval before execution
|
|
289
|
+
5. **Composable** - Each workflow is independent, no interdependencies
|
|
290
|
+
6. **Multi-layer validation** - Plans reviewed by external CLIs + orchestrator + agents
|
|
291
|
+
7. **Selective archival** - Only plans passing all reviews get archived
|
|
292
|
+
8. **Single output** - One JSON + one Markdown file per review (no duplication)
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Version History
|
|
297
|
+
|
|
298
|
+
| Version | Changes |
|
|
299
|
+
|---------|---------|
|
|
300
|
+
| 1.4.0 | **Phase 1 Shared Infrastructure**: Event-sourced context management in `_shared/`, contexts in `_output/contexts/`, atomic writes. **BREAKING**: Renamed config.json → cc-native.config.json |
|
|
301
|
+
| 1.3.0 | Consolidated CLI + agent review into single unified hook with combined output |
|
|
302
|
+
| 1.2.0 | Added multi-agent plan review via Claude Code agents, reordered hooks (archive last) |
|
|
303
|
+
| 1.1.0 | Added plan review via Codex/Gemini with Claude feedback, config.json |
|
|
304
|
+
| 1.0.0 | Initial release with fix, research, implement workflows |
|