ctx-cc 3.4.3 → 3.4.4

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 (2) hide show
  1. package/commands/ctx.md +233 -62
  2. package/package.json +1 -1
package/commands/ctx.md CHANGED
@@ -12,67 +12,238 @@ allowed-tools:
12
12
  - AskUserQuestion
13
13
  - mcp__arguseek__research_iteratively
14
14
  - mcp__arguseek__fetch_url
15
+ - mcp__playwright__browser_navigate
16
+ - mcp__playwright__browser_snapshot
17
+ - mcp__playwright__browser_type
18
+ - mcp__playwright__browser_click
15
19
  ---
16
20
 
17
- <objective>
18
- CTX Smart Router - Conversational-first workflow orchestration.
19
-
20
- **Users don't need to know commands.** They describe what they want, CTX routes automatically.
21
-
22
- ```
23
- User: "I want to build a todo app" -> Routes to init
24
- User: "Fix the login bug" -> Routes to debug
25
- User: "Study the codebase" -> Routes to map-codebase
26
- User: "What should I do next?" -> Shows status + routes
27
- ```
28
- </objective>
29
-
30
- <execution_context>
31
- @~/.claude/ctx/workflows/ctx-router.md
32
- </execution_context>
33
-
34
- <process>
35
- 1. Check if .ctx/ exists (bash: test -d .ctx)
36
- 2. Detect intent from user message
37
- 3. Route based on intent + ctx state:
38
- - No .ctx/ + "build/create" -> /ctx:init
39
- - No .ctx/ + "study/analyze" -> spawn 4 mapper agents in parallel
40
- - No .ctx/ + "debug/fix" -> map codebase first, then debug
41
- - Has .ctx/ + any intent -> load state, route accordingly
42
- 4. Spawn appropriate agents with Task()
43
- 5. Update STATE.md
44
- 6. Show "Next Up" with clear next action
45
- </process>
46
-
47
- <intent_patterns>
48
- | Pattern | Intent | Route |
49
- |---------|--------|-------|
50
- | "build", "create", "make", "start new" | new-project | /ctx:init |
51
- | "fix", "bug", "broken", "error", "crash" | debug | Debug flow |
52
- | "test", "QA", "check", "accessible" | qa | QA flow |
53
- | "study", "analyze", "understand", "explore" | analyze | Map codebase |
54
- | "improve", "optimize", "refactor" | improve | Analyze + suggest |
55
- | "status", "progress", "what's next" | status | Show status |
56
- | "help", "how", "commands" | help | Show help |
57
- | "continue", "next", "go" | continue | Read STATE.md |
58
- </intent_patterns>
59
-
60
- <model_routing>
61
- Based on config.json profile, use these models for Task() calls:
62
-
63
- | Agent | quality | balanced | budget |
64
- |-------|---------|----------|--------|
65
- | Mappers | sonnet | haiku | haiku |
66
- | Debugger | opus | sonnet | sonnet |
67
- | QA | sonnet | sonnet | haiku |
68
- | Executor | opus | sonnet | sonnet |
69
- </model_routing>
70
-
71
- <success_criteria>
72
- - [ ] Intent detected from user message
73
- - [ ] Correct flow routed
74
- - [ ] ArguSeek called for research (when applicable)
75
- - [ ] Task() agents spawned with full context
76
- - [ ] STATE.md updated after each action
77
- - [ ] Clear "Next Up" shown
78
- </success_criteria>
21
+ # CTX Smart Router
22
+
23
+ You MUST follow these instructions exactly. This is not documentation - these are commands to execute.
24
+
25
+ ## Step 1: Check CTX Structure
26
+
27
+ Execute this bash command RIGHT NOW:
28
+
29
+ ```bash
30
+ test -d .ctx && echo "CTX_EXISTS" || echo "CTX_MISSING"
31
+ ```
32
+
33
+ Store the result.
34
+
35
+ ## Step 2: Detect Intent
36
+
37
+ Parse the user's message. Match against these patterns (check in order):
38
+
39
+ | If message contains... | Intent is... |
40
+ |------------------------|--------------|
41
+ | "study", "analyze", "understand", "explore", "deeply" | ANALYZE |
42
+ | "build", "create", "make", "start", "new" | NEW_PROJECT |
43
+ | "fix", "bug", "broken", "error", "crash" | DEBUG |
44
+ | "test", "QA", "check", "accessible" | QA |
45
+ | "status", "progress", "what's next" | STATUS |
46
+
47
+ ## Step 3: Execute Based on Intent
48
+
49
+ ### If Intent = ANALYZE
50
+
51
+ **3a. Show banner:**
52
+
53
+ ```
54
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55
+ CTX DEEP STUDY
56
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
+ ```
58
+
59
+ **3b. Ask scope using AskUserQuestion tool:**
60
+
61
+ You MUST call the AskUserQuestion tool with these exact parameters:
62
+
63
+ ```json
64
+ {
65
+ "questions": [
66
+ {
67
+ "question": "What type of analysis do you need?",
68
+ "header": "Scope",
69
+ "options": [
70
+ { "label": "Code only", "description": "Analyze codebase structure, patterns, and quality" },
71
+ { "label": "Code + Running app", "description": "Also browse the running application in browser" },
72
+ { "label": "Full system", "description": "Code + App + API testing + Database inspection" }
73
+ ],
74
+ "multiSelect": false
75
+ }
76
+ ]
77
+ }
78
+ ```
79
+
80
+ **3c. If user selected "Code + Running app" or "Full system", ask for credentials:**
81
+
82
+ ```json
83
+ {
84
+ "questions": [
85
+ {
86
+ "question": "Do you have login credentials for the app?",
87
+ "header": "Access",
88
+ "options": [
89
+ { "label": "Yes, I'll provide them", "description": "I have username/password" },
90
+ { "label": "No auth needed", "description": "The app doesn't require login" }
91
+ ],
92
+ "multiSelect": false
93
+ }
94
+ ]
95
+ }
96
+ ```
97
+
98
+ If they'll provide credentials, ask:
99
+ ```
100
+ Please provide login credentials:
101
+ • Username/Email:
102
+ • Password:
103
+ ```
104
+
105
+ **3d. Create directory:**
106
+
107
+ ```bash
108
+ mkdir -p .ctx/codebase
109
+ ```
110
+
111
+ **3e. Show spawning indicator:**
112
+
113
+ ```
114
+ ◆ Spawning 4 mappers in parallel...
115
+ → ctx-tech-mapper
116
+ → ctx-arch-mapper
117
+ → ctx-quality-mapper
118
+ → ctx-concerns-mapper
119
+ ```
120
+
121
+ **3f. SPAWN 4 AGENTS NOW using Task tool:**
122
+
123
+ You MUST call the Task tool 4 times with these EXACT parameters. Call all 4 in a SINGLE message:
124
+
125
+ Task 1:
126
+ - prompt: "Analyze this codebase for technology stack. Write comprehensive analysis to: .ctx/codebase/TECH.md. Include languages, frameworks, dependencies, versions, build tools. Return confirmation with line count when complete."
127
+ - subagent_type: "ctx-tech-mapper"
128
+ - model: "haiku"
129
+ - run_in_background: true
130
+ - description: "Map tech stack"
131
+
132
+ Task 2:
133
+ - prompt: "Analyze this codebase architecture. Write comprehensive analysis to: .ctx/codebase/ARCH.md. Include architectural pattern, layer structure, module boundaries, entry points, data flow. Return confirmation with line count when complete."
134
+ - subagent_type: "ctx-arch-mapper"
135
+ - model: "haiku"
136
+ - run_in_background: true
137
+ - description: "Map architecture"
138
+
139
+ Task 3:
140
+ - prompt: "Analyze this codebase for quality patterns. Write comprehensive analysis to: .ctx/codebase/QUALITY.md. Include test coverage, linting, type safety, documentation, code smells. Return confirmation with line count when complete."
141
+ - subagent_type: "ctx-quality-mapper"
142
+ - model: "haiku"
143
+ - run_in_background: true
144
+ - description: "Map quality"
145
+
146
+ Task 4:
147
+ - prompt: "Analyze this codebase for concerns and risks. Write comprehensive analysis to: .ctx/codebase/CONCERNS.md. Include security issues, technical debt, performance problems, operational risks. Return confirmation with line count when complete."
148
+ - subagent_type: "ctx-concerns-mapper"
149
+ - model: "haiku"
150
+ - run_in_background: true
151
+ - description: "Map concerns"
152
+
153
+ **3g. Wait for all agents using TaskOutput:**
154
+
155
+ After spawning, use TaskOutput tool to wait for each agent to complete. Show progress:
156
+
157
+ ```
158
+ ✓ ctx-tech-mapper complete: TECH.md
159
+ ✓ ctx-arch-mapper complete: ARCH.md
160
+ ✓ ctx-quality-mapper complete: QUALITY.md
161
+ ✓ ctx-concerns-mapper complete: CONCERNS.md
162
+ ```
163
+
164
+ **3h. Verify files exist:**
165
+
166
+ ```bash
167
+ ls -la .ctx/codebase/
168
+ wc -l .ctx/codebase/*.md
169
+ ```
170
+
171
+ **3i. Create summary:**
172
+
173
+ Read all 4 files and create .ctx/codebase/SUMMARY.md with key findings.
174
+
175
+ **3j. If browser testing requested, use Playwright:**
176
+
177
+ Detect app URL:
178
+ ```bash
179
+ grep -r "localhost\|PORT" .env* package.json 2>/dev/null | head -3
180
+ ```
181
+
182
+ Then use mcp__playwright__browser_navigate to open the app, login with provided credentials, and explore.
183
+
184
+ **3k. Show completion:**
185
+
186
+ ```
187
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
188
+ CTX ► MAPPING COMPLETE ✓
189
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
190
+
191
+ ┌─────────────────────────────────────────────────────┐
192
+ │ CODEBASE SUMMARY │
193
+ ├─────────────────────────────────────────────────────┤
194
+ │ Tech: [from TECH.md] │
195
+ │ Architecture: [from ARCH.md] │
196
+ │ Quality: [from QUALITY.md] │
197
+ │ Concerns: [count] identified │
198
+ └─────────────────────────────────────────────────────┘
199
+
200
+ Files: .ctx/codebase/
201
+
202
+ ───────────────────────────────────────────────────────
203
+
204
+ ## ▶ Next Up
205
+
206
+ **Initialize project** — set up CTX workflow
207
+
208
+ `/ctx:init`
209
+
210
+ ───────────────────────────────────────────────────────
211
+ ```
212
+
213
+ ### If Intent = NEW_PROJECT
214
+
215
+ Execute /ctx:init inline.
216
+
217
+ ### If Intent = DEBUG
218
+
219
+ Show banner, map codebase first (same as ANALYZE), then spawn ctx-debugger agent.
220
+
221
+ ### If Intent = STATUS
222
+
223
+ Read .ctx/STATE.md and show status with progress bars.
224
+
225
+ ### If Intent = unknown
226
+
227
+ Show help:
228
+ ```
229
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
230
+ CTX ► WELCOME
231
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
232
+
233
+ What would you like to do?
234
+
235
+ • "Study this codebase" → Deep analysis
236
+ • "Build something new" → Project setup
237
+ • "Fix a bug" → Debug mode
238
+ • "Test the app" → QA testing
239
+
240
+ Just describe what you want!
241
+ ```
242
+
243
+ ## CRITICAL RULES
244
+
245
+ 1. You MUST use the Task tool to spawn agents - do not just describe what should happen
246
+ 2. You MUST use AskUserQuestion for interactive prompts - do not just print questions
247
+ 3. You MUST execute bash commands - do not just show them
248
+ 4. You MUST wait for agents with TaskOutput before proceeding
249
+ 5. You MUST show the CLI banners and boxes exactly as specified
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "3.4.3",
3
+ "version": "3.4.4",
4
4
  "description": "CTX 3.3 (Continuous Task eXecution) - AI that learns your preferences. Learning system, predictive planning, self-healing deployments (Sentry/LogRocket), voice control for hands-free development.",
5
5
  "keywords": [
6
6
  "claude",