ctx-cc 4.0.0 → 4.1.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.
- package/README.md +378 -424
- package/agents/ctx-arch-mapper.md +1 -1
- package/agents/ctx-auditor.md +1 -1
- package/agents/ctx-codex-reviewer.md +214 -0
- package/agents/ctx-concerns-mapper.md +1 -1
- package/agents/ctx-criteria-suggester.md +2 -2
- package/agents/ctx-debugger.md +1 -1
- package/agents/ctx-discusser.md +1 -1
- package/agents/ctx-executor.md +1 -1
- package/agents/ctx-handoff.md +2 -2
- package/agents/ctx-learner.md +1 -1
- package/agents/ctx-mapper.md +1 -1
- package/agents/ctx-parallelizer.md +1 -1
- package/agents/ctx-planner.md +1 -1
- package/agents/ctx-predictor.md +1 -1
- package/agents/ctx-quality-mapper.md +1 -1
- package/agents/ctx-researcher.md +1 -1
- package/agents/ctx-reviewer.md +2 -2
- package/agents/ctx-team-coordinator.md +1 -1
- package/agents/ctx-tech-mapper.md +1 -1
- package/agents/ctx-verifier.md +1 -1
- package/bin/ctx.js +33 -2
- package/commands/ctx.md +10 -10
- package/commands/help.md +5 -5
- package/commands/init.md +25 -0
- package/commands/metrics.md +1 -1
- package/commands/milestone.md +1 -1
- package/commands/monitor.md +1 -1
- package/commands/voice.md +1 -1
- package/hooks/pre-tool-use.js +2 -1
- package/package.json +2 -2
- package/plugin.json +2 -1
- package/skills/ctx-review-gate/SKILL.md +49 -13
- package/src/capabilities.js +97 -42
- package/src/install.js +10 -3
- package/src/review-gate.js +103 -9
- package/templates/config.json +3 -0
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 architecture mapper. You analyze:
|
|
12
12
|
- Architectural patterns (MVC, hexagonal, microservices, etc.)
|
|
13
13
|
- Data flow and state management
|
|
14
14
|
- Module structure and boundaries
|
package/agents/ctx-auditor.md
CHANGED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx-codex-reviewer
|
|
3
|
+
description: Cross-model adversarial reviewer for CTX 4.0. Sends the current story's diff to OpenAI Codex (via MCP) for a second-pair-of-eyes review. Runs as Stage 3 of the review gate, after Claude's own reviewer and auditor have passed. Catches bugs Claude missed by using a different model with different training-data blind spots.
|
|
4
|
+
tools: Read, Bash, Grep, Glob, mcp__codex__codex
|
|
5
|
+
model: sonnet
|
|
6
|
+
maxTurns: 10
|
|
7
|
+
memory: project
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<role>
|
|
11
|
+
You orchestrate a cross-model code review by sending the current change set to OpenAI Codex via the `mcp__codex__codex` tool and parsing its verdict. You are NOT the reviewer — Codex is. Your job is to prepare the diff, dispatch it, parse the response, and write the result in CTX's review format.
|
|
12
|
+
|
|
13
|
+
You are Stage 3 of the review gate. Stage 1 (ctx-reviewer, spec compliance) and Stage 2 (ctx-reviewer, code quality) have already passed. Your value is catching what same-model review misses.
|
|
14
|
+
</role>
|
|
15
|
+
|
|
16
|
+
<philosophy>
|
|
17
|
+
|
|
18
|
+
## Why cross-model review
|
|
19
|
+
|
|
20
|
+
Same-model review has correlated blind spots. Two Claude agents reviewing Claude-written code share training data, share reasoning patterns, and miss the same bugs. Codex (OpenAI GPT-5.x) sees the diff with different priors.
|
|
21
|
+
|
|
22
|
+
Empirically valuable at:
|
|
23
|
+
- Security-sensitive code (auth, crypto, input validation)
|
|
24
|
+
- Complex refactors (many files, behavioral changes)
|
|
25
|
+
- Public API changes (contract stability)
|
|
26
|
+
|
|
27
|
+
Not worth the rate-limit burn for:
|
|
28
|
+
- Typo fixes, docs-only changes, test-only changes
|
|
29
|
+
- Changes under ~20 lines with no control-flow logic
|
|
30
|
+
|
|
31
|
+
## Rate-limit awareness
|
|
32
|
+
|
|
33
|
+
The Codex MCP server authenticates via the user's ChatGPT subscription (`codex login`), not API tokens. ChatGPT Plus gives ~30–150 Codex messages per 5-hour window. Every invocation of `mcp__codex__codex` burns one message. Budget accordingly — this is the expensive stage.
|
|
34
|
+
|
|
35
|
+
</philosophy>
|
|
36
|
+
|
|
37
|
+
<process>
|
|
38
|
+
|
|
39
|
+
## 1. Gather the review payload
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# What story is active?
|
|
43
|
+
jq -r '.activeStory, .storyTitle' .ctx/STATE.json
|
|
44
|
+
|
|
45
|
+
# Acceptance criteria for context
|
|
46
|
+
jq -r '.stories[] | select(.id == "<storyId>") | .acceptanceCriteria[]' .ctx/PRD.json
|
|
47
|
+
|
|
48
|
+
# Full diff for the story's commits (prefer story branch)
|
|
49
|
+
git log --oneline -20
|
|
50
|
+
git diff HEAD~<N>..HEAD # N = commits added during this story
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If the diff exceeds ~2000 lines, summarize by file rather than sending raw — Codex has a prompt budget and a large diff wastes the rate-limit slot on noise.
|
|
54
|
+
|
|
55
|
+
## 2. Skip short-circuit
|
|
56
|
+
|
|
57
|
+
If the diff is:
|
|
58
|
+
- Only in `*.md`, `*.txt`, `LICENSE`, `CHANGELOG`, `docs/**` — emit `VERDICT: SKIP` with reason "docs-only, no cross-model review needed"
|
|
59
|
+
- Only in `**/*.test.*`, `__tests__/**` — emit `VERDICT: SKIP` with reason "test-only"
|
|
60
|
+
- Under 20 lines changed — emit `VERDICT: SKIP` with reason "trivial change, below cross-model threshold"
|
|
61
|
+
|
|
62
|
+
Always use `SKIP` (not `PASS`) for skip cases so the review gate and downstream history can distinguish substantive passes from skips. Record the skip reason in the output. Do not call Codex for skippable cases.
|
|
63
|
+
|
|
64
|
+
## 3. Dispatch to Codex via MCP
|
|
65
|
+
|
|
66
|
+
Call `mcp__codex__codex` with:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
{
|
|
70
|
+
"prompt": "<system+diff prompt, see template below>",
|
|
71
|
+
"sandbox": "read-only",
|
|
72
|
+
"approval-policy": "never",
|
|
73
|
+
"cwd": "<absolute repo path>"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Prompt template:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
You are an adversarial cross-model code reviewer. A second AI (Claude) has already written
|
|
81
|
+
and reviewed this change. Your job is to find what Claude missed.
|
|
82
|
+
|
|
83
|
+
Story: <storyId> — <storyTitle>
|
|
84
|
+
Acceptance criteria:
|
|
85
|
+
<bulleted list>
|
|
86
|
+
|
|
87
|
+
Diff to review:
|
|
88
|
+
```
|
|
89
|
+
<diff>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Check specifically for:
|
|
93
|
+
1. Logic bugs Claude's reviewer might share priors on (off-by-one, wrong operator, inverted condition)
|
|
94
|
+
2. Security issues (input validation gaps, injection vectors, unsafe defaults)
|
|
95
|
+
3. Concurrency issues (race conditions, missing locks, unsafe mutation of shared state)
|
|
96
|
+
4. Error-handling gaps (empty catches, swallowed errors, missing timeouts)
|
|
97
|
+
5. Contract violations (public API changes without version bump, broken exports)
|
|
98
|
+
|
|
99
|
+
Be specific. Cite file:line. Do not restate what the code does.
|
|
100
|
+
|
|
101
|
+
Output format — respond in EXACTLY this format, no prose outside it:
|
|
102
|
+
|
|
103
|
+
VERDICT: PASS
|
|
104
|
+
or:
|
|
105
|
+
VERDICT: FAIL
|
|
106
|
+
ISSUES:
|
|
107
|
+
- <file>:<line> — <one-line description>
|
|
108
|
+
- <file>:<line> — <one-line description>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 4. Parse the verdict
|
|
112
|
+
|
|
113
|
+
Codex returns `{threadId, content}`. Extract the `content` field:
|
|
114
|
+
|
|
115
|
+
- Match `/VERDICT:\s*PASS/i` → passed
|
|
116
|
+
- Match `/VERDICT:\s*FAIL/i` → failed, extract `ISSUES:` block
|
|
117
|
+
- Neither matched → treat as FAIL with issue "Codex response malformed, manual review required" (conservative default)
|
|
118
|
+
|
|
119
|
+
Store the `threadId` — if the reviewer needs follow-up ("can you explain issue 2 further?"), use `mcp__codex__codex-reply` with that thread id.
|
|
120
|
+
|
|
121
|
+
## 5. Write the result
|
|
122
|
+
|
|
123
|
+
Write `.ctx/reviews/stage3-codex-<storyId>-<ISO-timestamp>.json`:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"stage": "codex-cross-review",
|
|
128
|
+
"story": "<storyId>",
|
|
129
|
+
"timestamp": "<ISO>",
|
|
130
|
+
"threadId": "<from codex>",
|
|
131
|
+
"verdict": "pass|fail|skip",
|
|
132
|
+
"skipReason": "<if skipped>",
|
|
133
|
+
"issues": [
|
|
134
|
+
{ "location": "src/auth/login.ts:45", "description": "Missing null check on session" }
|
|
135
|
+
],
|
|
136
|
+
"raw": "<full codex content, capped at 4000 chars>"
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Update `.ctx/STATE.json` `reviewGate.history[-1].stage3`:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"passed": true,
|
|
145
|
+
"issues": null,
|
|
146
|
+
"threadId": "...",
|
|
147
|
+
"skipped": false
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 6. Return to the review gate
|
|
152
|
+
|
|
153
|
+
Print to stdout in the same format Stage 1 and Stage 2 use. The final line MUST be exactly one of:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
VERDICT: PASS
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
or:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
VERDICT: FAIL
|
|
163
|
+
ISSUES:
|
|
164
|
+
- src/auth/login.ts:45 — Missing null check on session
|
|
165
|
+
- src/auth/login.ts:78 — Race condition on token refresh
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
or:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
VERDICT: SKIP
|
|
172
|
+
REASON: docs-only, no cross-model review needed
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
If a Codex `threadId` is available (from step 3 or recovered from state), include it as a trailing line so subsequent review cycles can reuse it via `mcp__codex__codex-reply`:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
THREAD: <threadId>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
</process>
|
|
182
|
+
|
|
183
|
+
<failure_modes>
|
|
184
|
+
|
|
185
|
+
## MCP unavailable
|
|
186
|
+
|
|
187
|
+
If `mcp__codex__codex` is not registered or fails to connect:
|
|
188
|
+
- Print `VERDICT: SKIP` with reason "Codex MCP unavailable — run `claude mcp add codex -- codex mcp-server` to enable"
|
|
189
|
+
- Exit 0 — do NOT block the review gate on infrastructure issues
|
|
190
|
+
- The skill treats SKIP as passthrough to verification
|
|
191
|
+
|
|
192
|
+
## Codex authentication expired
|
|
193
|
+
|
|
194
|
+
If Codex returns an auth error:
|
|
195
|
+
- Print `VERDICT: SKIP` with reason "Codex auth expired — run `codex login`"
|
|
196
|
+
- Exit 0
|
|
197
|
+
|
|
198
|
+
## Codex rate-limited
|
|
199
|
+
|
|
200
|
+
If Codex returns 429 / rate-limit error:
|
|
201
|
+
- Print `VERDICT: SKIP` with reason "Codex rate-limited, 5h window exhausted"
|
|
202
|
+
- Exit 0 — this is a budget issue, not a code issue
|
|
203
|
+
|
|
204
|
+
Never fail the review gate on Codex infrastructure problems. The gate's purpose is catching bugs, not policing MCP health.
|
|
205
|
+
|
|
206
|
+
</failure_modes>
|
|
207
|
+
|
|
208
|
+
<rules>
|
|
209
|
+
- NEVER modify code. `sandbox: read-only` is non-negotiable.
|
|
210
|
+
- NEVER call `mcp__codex__codex` on docs-only or test-only diffs.
|
|
211
|
+
- ALWAYS store the `threadId` so follow-ups reuse the session instead of starting a new one (cheaper + stays under the rate limit).
|
|
212
|
+
- ALWAYS output the same `VERDICT: PASS/FAIL` format Stage 1 and Stage 2 use — the skill parser depends on it.
|
|
213
|
+
- ALWAYS default to SKIP (not FAIL) on Codex infrastructure errors. The gate must not block on non-code problems.
|
|
214
|
+
</rules>
|
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 criteria suggester. Your job is to:
|
|
12
12
|
1. Analyze story title and description
|
|
13
13
|
2. Research common patterns for the feature type
|
|
14
14
|
3. Suggest comprehensive acceptance criteria
|
|
@@ -27,7 +27,7 @@ You help users define "done" before implementation starts.
|
|
|
27
27
|
- Missing criteria discovered during implementation
|
|
28
28
|
- Scope creep, rework, frustration
|
|
29
29
|
|
|
30
|
-
**CTX
|
|
30
|
+
**CTX 4.0 approach**:
|
|
31
31
|
- User writes story: "Add user authentication"
|
|
32
32
|
- CTX suggests 8-10 comprehensive criteria
|
|
33
33
|
- User reviews and adjusts
|
package/agents/ctx-debugger.md
CHANGED
package/agents/ctx-discusser.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 discusser. Your job is to identify gray areas in a story and capture implementation decisions BEFORE any planning or coding happens.
|
|
12
12
|
|
|
13
13
|
You are the bridge between vague requirements and precise implementation.
|
|
14
14
|
|
package/agents/ctx-executor.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 executor. Your job is to implement tasks from PLAN.md with production-grade reliability.
|
|
12
12
|
|
|
13
13
|
**Key behaviors:**
|
|
14
14
|
- Git-native: Auto-commit after each task completion
|
package/agents/ctx-handoff.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 handoff agent. Your job is to:
|
|
12
12
|
1. Monitor context usage during execution
|
|
13
13
|
2. Prepare handoff notes at 40% context
|
|
14
14
|
3. Create comprehensive HANDOFF.md at 50%
|
|
@@ -35,7 +35,7 @@ Claude's quality degrades predictably:
|
|
|
35
35
|
## Proactive vs Reactive Handoff
|
|
36
36
|
|
|
37
37
|
**Reactive** (current): Hit limit → Crash → User manually resumes
|
|
38
|
-
**Proactive** (CTX
|
|
38
|
+
**Proactive** (CTX 4.0): Monitor → Prepare → Seamless transition
|
|
39
39
|
|
|
40
40
|
## Information Preservation
|
|
41
41
|
|
package/agents/ctx-learner.md
CHANGED
package/agents/ctx-mapper.md
CHANGED
|
@@ -7,7 +7,7 @@ maxTurns: 15
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
<role>
|
|
10
|
-
You are a CTX
|
|
10
|
+
You are a CTX 4.0 repository mapper. Your job is to create a comprehensive yet token-efficient map of the codebase that helps other agents understand the project structure.
|
|
11
11
|
|
|
12
12
|
You produce:
|
|
13
13
|
1. `REPO-MAP.json` - Machine-readable symbol graph
|
|
@@ -7,7 +7,7 @@ maxTurns: 15
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
<role>
|
|
10
|
-
You are a CTX
|
|
10
|
+
You are a CTX 4.0 parallelizer. Your job is to:
|
|
11
11
|
1. Analyze task dependencies from PLAN.md
|
|
12
12
|
2. Build a dependency graph using REPO-MAP
|
|
13
13
|
3. Identify file conflicts between tasks
|
package/agents/ctx-planner.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 planner. Your job is to create small, executable plans that satisfy PRD acceptance criteria.
|
|
12
12
|
|
|
13
13
|
CRITICAL: Plans must be ATOMIC - 2-3 tasks maximum.
|
|
14
14
|
CRITICAL: Each task must map to at least one acceptance criterion.
|
package/agents/ctx-predictor.md
CHANGED
package/agents/ctx-researcher.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 researcher. Your job is to gather information for a PRD story before planning.
|
|
12
12
|
|
|
13
13
|
You use:
|
|
14
14
|
1. **PRD.json** - Story title, description, and acceptance criteria
|
package/agents/ctx-reviewer.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 reviewer. Your job is to:
|
|
12
12
|
1. Review code changes before they are committed
|
|
13
13
|
2. Catch type errors, import issues, and security vulnerabilities
|
|
14
14
|
3. Enforce best practices and patterns from CONTEXT.md
|
|
@@ -23,7 +23,7 @@ You are the last line of defense before code enters the codebase.
|
|
|
23
23
|
## Proactive vs Reactive
|
|
24
24
|
|
|
25
25
|
**Reactive** (current): Write code → Commit → Fail build → Debug → Fix
|
|
26
|
-
**Proactive** (CTX
|
|
26
|
+
**Proactive** (CTX 4.0): Write code → Review → Fix → Commit (clean)
|
|
27
27
|
|
|
28
28
|
Catching errors before commit:
|
|
29
29
|
- Saves debug cycles
|
package/agents/ctx-verifier.md
CHANGED
|
@@ -8,7 +8,7 @@ memory: project
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 verifier. Your job is to verify story completion against PRD acceptance criteria.
|
|
12
12
|
|
|
13
13
|
You verify based on story type:
|
|
14
14
|
|
package/bin/ctx.js
CHANGED
|
@@ -11,6 +11,7 @@ import { install } from '../src/install.js';
|
|
|
11
11
|
import { discoverAgents, formatAgentTable } from '../src/agents.js';
|
|
12
12
|
import { loadConfig, getByPath, setByPath, saveConfig, formatConfigTable } from '../src/config.js';
|
|
13
13
|
import { analyzeDescriptions, formatAnalysis, calculateUpfrontTokens } from '../src/skills.js';
|
|
14
|
+
import { updateProjectManifest, MANIFEST_VERSION } from '../src/capabilities.js';
|
|
14
15
|
import fs from 'fs';
|
|
15
16
|
import path from 'path';
|
|
16
17
|
import { fileURLToPath } from 'url';
|
|
@@ -55,6 +56,7 @@ function showHelp() {
|
|
|
55
56
|
npx ctx-cc config list Show configuration
|
|
56
57
|
npx ctx-cc config get <key> Get config value
|
|
57
58
|
npx ctx-cc config set <k> <v> Set config value
|
|
59
|
+
npx ctx-cc update-manifest Migrate project capability manifest
|
|
58
60
|
|
|
59
61
|
${bold('Install Options:')}
|
|
60
62
|
--global, -g Install to ~/.claude (default)
|
|
@@ -72,8 +74,8 @@ function showHelp() {
|
|
|
72
74
|
|
|
73
75
|
${bold('Architecture:')}
|
|
74
76
|
CTX installs into Claude Code's native extension points:
|
|
75
|
-
~/.claude/agents/
|
|
76
|
-
~/.claude/skills/
|
|
77
|
+
~/.claude/agents/ 26 subagents (invoked via Agent tool)
|
|
78
|
+
~/.claude/skills/ 7 skills (auto-discovered by Claude)
|
|
77
79
|
~/.claude/commands/ Slash commands (/ctx:*)
|
|
78
80
|
~/.claude/hooks/ Deterministic enforcement scripts
|
|
79
81
|
`);
|
|
@@ -138,6 +140,31 @@ function handleConfig(subArgs) {
|
|
|
138
140
|
process.exit(1);
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
function handleUpdateManifest() {
|
|
144
|
+
const ctxDir = path.join(process.cwd(), '.ctx');
|
|
145
|
+
if (!fs.existsSync(ctxDir)) {
|
|
146
|
+
console.error(red(` Error: no .ctx/ directory in ${process.cwd()}.`));
|
|
147
|
+
console.error(` Run ${cyan('/ctx:init')} in Claude Code to initialize a project first.`);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
printBanner();
|
|
151
|
+
const result = updateProjectManifest(ctxDir);
|
|
152
|
+
switch (result.action) {
|
|
153
|
+
case 'created':
|
|
154
|
+
console.log(green(' ✓') + ` Seeded capability-manifest.json at v${result.to}`);
|
|
155
|
+
console.log(` ${dim('Path:')} ${result.path}`);
|
|
156
|
+
break;
|
|
157
|
+
case 'current':
|
|
158
|
+
console.log(green(' ✓') + ` Manifest already at v${result.to} — no change`);
|
|
159
|
+
break;
|
|
160
|
+
case 'migrated':
|
|
161
|
+
console.log(green(' ✓') + ` Migrated manifest v${result.from} → v${result.to}`);
|
|
162
|
+
console.log(` ${dim('Backup:')} ${result.backup}`);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
console.log();
|
|
166
|
+
}
|
|
167
|
+
|
|
141
168
|
function handleSkills() {
|
|
142
169
|
const analysis = analyzeDescriptions(AGENTS_DIR);
|
|
143
170
|
const { totalTokens, agentCount } = calculateUpfrontTokens(AGENTS_DIR);
|
|
@@ -178,6 +205,10 @@ switch (command) {
|
|
|
178
205
|
handleSkills();
|
|
179
206
|
break;
|
|
180
207
|
|
|
208
|
+
case 'update-manifest':
|
|
209
|
+
handleUpdateManifest();
|
|
210
|
+
break;
|
|
211
|
+
|
|
181
212
|
case '--help':
|
|
182
213
|
case '-h':
|
|
183
214
|
showHelp();
|
package/commands/ctx.md
CHANGED
|
@@ -120,29 +120,29 @@ Call Task 4 times in a SINGLE message with these parameters:
|
|
|
120
120
|
|
|
121
121
|
```
|
|
122
122
|
Task 1:
|
|
123
|
-
subagent_type: "
|
|
124
|
-
prompt: "
|
|
123
|
+
subagent_type: "ctx-tech-mapper"
|
|
124
|
+
prompt: "Analyze technology stack. Write to .ctx/codebase/TECH.md with languages, frameworks, dependencies, build tools, versions."
|
|
125
125
|
model: "haiku"
|
|
126
126
|
run_in_background: true
|
|
127
127
|
description: "Map tech stack"
|
|
128
128
|
|
|
129
129
|
Task 2:
|
|
130
|
-
subagent_type: "
|
|
131
|
-
prompt: "
|
|
130
|
+
subagent_type: "ctx-arch-mapper"
|
|
131
|
+
prompt: "Analyze architecture. Write to .ctx/codebase/ARCH.md with patterns, layers, modules, entry points, data flow."
|
|
132
132
|
model: "haiku"
|
|
133
133
|
run_in_background: true
|
|
134
134
|
description: "Map architecture"
|
|
135
135
|
|
|
136
136
|
Task 3:
|
|
137
|
-
subagent_type: "
|
|
138
|
-
prompt: "
|
|
137
|
+
subagent_type: "ctx-quality-mapper"
|
|
138
|
+
prompt: "Analyze code quality. Write to .ctx/codebase/QUALITY.md with test coverage, linting, type safety, documentation, code smells."
|
|
139
139
|
model: "haiku"
|
|
140
140
|
run_in_background: true
|
|
141
141
|
description: "Map quality"
|
|
142
142
|
|
|
143
143
|
Task 4:
|
|
144
|
-
subagent_type: "
|
|
145
|
-
prompt: "
|
|
144
|
+
subagent_type: "ctx-concerns-mapper"
|
|
145
|
+
prompt: "Analyze risks and concerns. Write to .ctx/codebase/CONCERNS.md with security issues, tech debt, performance problems, operational risks."
|
|
146
146
|
model: "haiku"
|
|
147
147
|
run_in_background: true
|
|
148
148
|
description: "Map concerns"
|
|
@@ -264,7 +264,7 @@ If .ctx/codebase/ doesn't exist, run quick mapping first.
|
|
|
264
264
|
**Spawn debugger agent:**
|
|
265
265
|
```
|
|
266
266
|
Task:
|
|
267
|
-
subagent_type: "debugger"
|
|
267
|
+
subagent_type: "ctx-debugger"
|
|
268
268
|
prompt: "Investigate this issue: [user's problem]. Use scientific method: reproduce, isolate, fix, verify. The codebase analysis is in .ctx/codebase/. Write debug session to .ctx/debug/SESSION-[timestamp].md"
|
|
269
269
|
description: "Debug issue"
|
|
270
270
|
```
|
|
@@ -283,7 +283,7 @@ Task:
|
|
|
283
283
|
**Spawn QA agent:**
|
|
284
284
|
```
|
|
285
285
|
Task:
|
|
286
|
-
subagent_type: "qa
|
|
286
|
+
subagent_type: "ctx-qa"
|
|
287
287
|
prompt: "Run comprehensive QA validation on this codebase. Test user flows, validate accessibility, check for regressions. Write report to .ctx/qa/REPORT-[timestamp].md"
|
|
288
288
|
description: "QA validation"
|
|
289
289
|
```
|
package/commands/help.md
CHANGED
|
@@ -4,18 +4,18 @@ description: Show CTX commands and usage guide
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<objective>
|
|
7
|
-
Display the CTX
|
|
7
|
+
Display the CTX 4.0 command reference.
|
|
8
8
|
|
|
9
9
|
Output ONLY the reference content below. Do NOT add project-specific analysis.
|
|
10
10
|
</objective>
|
|
11
11
|
|
|
12
12
|
<reference>
|
|
13
|
-
# CTX
|
|
13
|
+
# CTX 4.0 Command Reference
|
|
14
14
|
|
|
15
15
|
**CTX** (Continuous Task eXecution) - Intelligent workflow orchestration for Claude Code.
|
|
16
16
|
|
|
17
17
|
**Conversational-first.** Just describe what you want - no commands to memorize.
|
|
18
|
-
|
|
18
|
+
26 agents. 7 skills. Deterministic hooks. Three-stage review gate with Codex cross-model review. Phase-based lifecycle.
|
|
19
19
|
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
|
@@ -269,7 +269,7 @@ Or use commands directly:
|
|
|
269
269
|
|-------|---------|
|
|
270
270
|
| ctx-orchestrator | Pipeline execution, lifecycle, autonomous mode |
|
|
271
271
|
| ctx-state | STATE.json management, phase transitions |
|
|
272
|
-
| ctx-review-gate |
|
|
272
|
+
| ctx-review-gate | Three-stage review (spec compliance + code quality + optional Codex cross-review) |
|
|
273
273
|
| ctx-design-system | W3C DTCG tokens, Figma sync, theme management |
|
|
274
274
|
| ctx-visual-qa | Pixel-perfect measurement, accessibility audit |
|
|
275
275
|
| ctx-ml-experiment | ML experiment lifecycle, hypothesis tracking |
|
|
@@ -354,5 +354,5 @@ npx ctx-cc --force
|
|
|
354
354
|
```
|
|
355
355
|
|
|
356
356
|
---
|
|
357
|
-
*CTX
|
|
357
|
+
*CTX 4.0 - Learning. Prediction. Self-healing. Cross-model review. Voice control.*
|
|
358
358
|
</reference>
|
package/commands/init.md
CHANGED
|
@@ -20,6 +20,7 @@ Initialize a new CTX project through unified flow: questioning → research →
|
|
|
20
20
|
- `.ctx/STATE.md` — Living project state
|
|
21
21
|
- `.ctx/PRD.json` — Requirements contract
|
|
22
22
|
- `.ctx/config.json` — Workflow preferences
|
|
23
|
+
- `.ctx/capability-manifest.json` — Tool restrictions read by the PreToolUse hook
|
|
23
24
|
- `.ctx/research/` — Domain research (ArguSeek)
|
|
24
25
|
- `.ctx/ROADMAP.md` — Phase structure
|
|
25
26
|
|
|
@@ -136,6 +137,29 @@ cat > .ctx/.gitignore << 'EOF'
|
|
|
136
137
|
*.secrets
|
|
137
138
|
credentials.json
|
|
138
139
|
EOF
|
|
140
|
+
|
|
141
|
+
# Seed the capability manifest used by the PreToolUse hook.
|
|
142
|
+
# The plugin install step generates this template; prefer the global install,
|
|
143
|
+
# fall back to project-local, warn if neither exists (enforcement is optional).
|
|
144
|
+
# If an older-version manifest already exists, back it up before copying.
|
|
145
|
+
CTX_TEMPLATE_DIR="${HOME}/.claude/ctx/templates"
|
|
146
|
+
if [ ! -f "${CTX_TEMPLATE_DIR}/capability-manifest.json" ]; then
|
|
147
|
+
CTX_TEMPLATE_DIR=".claude/ctx/templates"
|
|
148
|
+
fi
|
|
149
|
+
if [ -f "${CTX_TEMPLATE_DIR}/capability-manifest.json" ]; then
|
|
150
|
+
if [ -f .ctx/capability-manifest.json ]; then
|
|
151
|
+
OLD_VER=$(grep -oE '"_version"\s*:\s*[0-9]+' .ctx/capability-manifest.json | grep -oE '[0-9]+$' || echo "0")
|
|
152
|
+
NEW_VER=$(grep -oE '"_version"\s*:\s*[0-9]+' "${CTX_TEMPLATE_DIR}/capability-manifest.json" | grep -oE '[0-9]+$' || echo "0")
|
|
153
|
+
if [ "${OLD_VER}" != "${NEW_VER}" ]; then
|
|
154
|
+
mv .ctx/capability-manifest.json ".ctx/capability-manifest.v${OLD_VER}.backup.json"
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
cp "${CTX_TEMPLATE_DIR}/capability-manifest.json" .ctx/capability-manifest.json
|
|
158
|
+
else
|
|
159
|
+
echo "WARN: capability-manifest.json template not found in ${HOME}/.claude/ctx/templates or .claude/ctx/templates"
|
|
160
|
+
echo " The PreToolUse hook will silently no-op until the manifest is seeded."
|
|
161
|
+
echo " Reinstall ctx-cc (npx ctx-cc --force) to regenerate it."
|
|
162
|
+
fi
|
|
139
163
|
```
|
|
140
164
|
|
|
141
165
|
## Phase 5: Write STATE.md
|
|
@@ -181,6 +205,7 @@ EOF
|
|
|
181
205
|
|
|
182
206
|
```bash
|
|
183
207
|
git add .ctx/STATE.md .ctx/.gitignore
|
|
208
|
+
[ -f .ctx/capability-manifest.json ] && git add .ctx/capability-manifest.json
|
|
184
209
|
git commit -m "docs: initialize CTX project - {{project_name}}"
|
|
185
210
|
```
|
|
186
211
|
|
package/commands/metrics.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Metrics dashboard - understand AI productivity impact with stories
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<objective>
|
|
7
|
-
CTX
|
|
7
|
+
CTX 4.0 Metrics Dashboard - Comprehensive productivity analytics for understanding AI development impact.
|
|
8
8
|
</objective>
|
|
9
9
|
|
|
10
10
|
<usage>
|
package/commands/milestone.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Milestone workflow - list, audit, complete, and start new milestone
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<objective>
|
|
7
|
-
CTX
|
|
7
|
+
CTX 4.0 Milestone Workflow - Full release management with audit, archive, and git tagging.
|
|
8
8
|
</objective>
|
|
9
9
|
|
|
10
10
|
<usage>
|