ctx-cc 2.3.0 → 3.0.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 +284 -224
- package/agents/ctx-arch-mapper.md +296 -0
- package/agents/ctx-concerns-mapper.md +359 -0
- package/agents/ctx-debugger.md +428 -207
- package/agents/ctx-discusser.md +287 -0
- package/agents/ctx-executor.md +287 -75
- package/agents/ctx-mapper.md +309 -0
- package/agents/ctx-quality-mapper.md +356 -0
- package/agents/ctx-tech-mapper.md +163 -0
- package/commands/ctx.md +94 -19
- package/commands/discuss.md +101 -0
- package/commands/map-codebase.md +169 -0
- package/commands/map.md +88 -0
- package/commands/profile.md +131 -0
- package/package.json +2 -2
- package/templates/config.json +124 -0
package/commands/map.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx:map
|
|
3
|
+
description: Build or rebuild the repository map for intelligent code understanding
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Build a token-optimized map of the codebase that enables all CTX agents to understand project structure, symbols, and dependencies.
|
|
8
|
+
|
|
9
|
+
This is the foundation for intelligent code operations.
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<usage>
|
|
13
|
+
```
|
|
14
|
+
/ctx map # Build/rebuild repository map
|
|
15
|
+
/ctx map --expand # Generate expanded map (8k tokens)
|
|
16
|
+
/ctx map --stats # Show map statistics only
|
|
17
|
+
/ctx map --refresh # Force full rebuild (ignore cache)
|
|
18
|
+
```
|
|
19
|
+
</usage>
|
|
20
|
+
|
|
21
|
+
<workflow>
|
|
22
|
+
|
|
23
|
+
## Step 1: Check Existing Map
|
|
24
|
+
|
|
25
|
+
Read `.ctx/REPO-MAP.json` if exists:
|
|
26
|
+
- If fresh (< 1 hour old) and no git changes: Skip rebuild, show stats
|
|
27
|
+
- If stale or files changed: Incremental update
|
|
28
|
+
- If `--refresh` flag: Full rebuild
|
|
29
|
+
|
|
30
|
+
Check git for changes:
|
|
31
|
+
```bash
|
|
32
|
+
git diff --name-only HEAD~10 2>/dev/null || echo "no-git"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Step 2: Spawn Mapper Agent
|
|
36
|
+
|
|
37
|
+
Spawn `ctx-mapper` agent to build the map:
|
|
38
|
+
- Pass project root
|
|
39
|
+
- Pass token budget (2000 default, 8000 if --expand)
|
|
40
|
+
- Pass list of changed files (for incremental)
|
|
41
|
+
|
|
42
|
+
## Step 3: Validate Output
|
|
43
|
+
|
|
44
|
+
Ensure mapper produced:
|
|
45
|
+
- `.ctx/REPO-MAP.json` - Valid JSON
|
|
46
|
+
- `.ctx/REPO-MAP.md` - Non-empty markdown
|
|
47
|
+
- `.ctx/repo-map-cache.json` - Cache file
|
|
48
|
+
|
|
49
|
+
## Step 4: Report Results
|
|
50
|
+
|
|
51
|
+
</workflow>
|
|
52
|
+
|
|
53
|
+
<output_format>
|
|
54
|
+
```
|
|
55
|
+
[CTX] Repository Map
|
|
56
|
+
|
|
57
|
+
Project: {{name}}
|
|
58
|
+
Stack: {{stack}}
|
|
59
|
+
|
|
60
|
+
Statistics:
|
|
61
|
+
Files: {{file_count}}
|
|
62
|
+
Symbols: {{symbol_count}}
|
|
63
|
+
Lines: {{line_count}}
|
|
64
|
+
Languages: {{language_breakdown}}
|
|
65
|
+
|
|
66
|
+
Entry Points:
|
|
67
|
+
{{entry_points}}
|
|
68
|
+
|
|
69
|
+
Top Referenced:
|
|
70
|
+
1. {{symbol}} ({{refs}} refs)
|
|
71
|
+
2. {{symbol}} ({{refs}} refs)
|
|
72
|
+
3. {{symbol}} ({{refs}} refs)
|
|
73
|
+
|
|
74
|
+
Map Tokens: {{token_count}}/{{budget}}
|
|
75
|
+
Cache: {{cache_status}}
|
|
76
|
+
|
|
77
|
+
Saved to: .ctx/REPO-MAP.md
|
|
78
|
+
```
|
|
79
|
+
</output_format>
|
|
80
|
+
|
|
81
|
+
<integration>
|
|
82
|
+
The repository map is automatically:
|
|
83
|
+
- Loaded by ctx-researcher before research
|
|
84
|
+
- Loaded by ctx-planner before planning
|
|
85
|
+
- Loaded by ctx-executor before execution
|
|
86
|
+
- Used to identify relevant files for any task
|
|
87
|
+
- Updated incrementally when files change
|
|
88
|
+
</integration>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx:profile
|
|
3
|
+
description: Switch between model profiles (quality/balanced/budget) for cost optimization
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Switch between pre-configured model profiles to optimize for quality or cost.
|
|
8
|
+
|
|
9
|
+
Profiles control which models are used for each phase of the CTX workflow.
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<usage>
|
|
13
|
+
```
|
|
14
|
+
/ctx profile # Show current profile
|
|
15
|
+
/ctx profile quality # Use best models (highest cost)
|
|
16
|
+
/ctx profile balanced # Use balanced models (default)
|
|
17
|
+
/ctx profile budget # Use fastest models (lowest cost)
|
|
18
|
+
```
|
|
19
|
+
</usage>
|
|
20
|
+
|
|
21
|
+
<profiles>
|
|
22
|
+
|
|
23
|
+
## Quality Profile
|
|
24
|
+
**Use when**: Critical production code, complex architecture, security-sensitive
|
|
25
|
+
|
|
26
|
+
| Phase | Model | Why |
|
|
27
|
+
|-------|-------|-----|
|
|
28
|
+
| Research | Opus | Deep understanding needed |
|
|
29
|
+
| Discussion | Opus | Nuanced question formulation |
|
|
30
|
+
| Planning | Opus | Best architectural decisions |
|
|
31
|
+
| Execution | Opus | Highest quality code |
|
|
32
|
+
| Debugging | Opus | Complex root cause analysis |
|
|
33
|
+
| Verification | Sonnet | Good enough for checks |
|
|
34
|
+
| Mapping | Sonnet | Reliable parsing |
|
|
35
|
+
| Quick | Sonnet | Still good quality |
|
|
36
|
+
|
|
37
|
+
**Estimated cost**: ~3x balanced profile
|
|
38
|
+
|
|
39
|
+
## Balanced Profile (Default)
|
|
40
|
+
**Use when**: Most development work, good balance of speed and quality
|
|
41
|
+
|
|
42
|
+
| Phase | Model | Why |
|
|
43
|
+
|-------|-------|-----|
|
|
44
|
+
| Research | Opus | Worth investing in understanding |
|
|
45
|
+
| Discussion | Sonnet | Good enough for questions |
|
|
46
|
+
| Planning | Opus | Worth investing in architecture |
|
|
47
|
+
| Execution | Sonnet | Good code quality |
|
|
48
|
+
| Debugging | Sonnet | Reliable debugging |
|
|
49
|
+
| Verification | Haiku | Fast checks sufficient |
|
|
50
|
+
| Mapping | Haiku | Fast parsing |
|
|
51
|
+
| Quick | Haiku | Speed prioritized |
|
|
52
|
+
|
|
53
|
+
**Estimated cost**: Baseline
|
|
54
|
+
|
|
55
|
+
## Budget Profile
|
|
56
|
+
**Use when**: Prototyping, learning, non-critical code, cost-sensitive
|
|
57
|
+
|
|
58
|
+
| Phase | Model | Why |
|
|
59
|
+
|-------|-------|-----|
|
|
60
|
+
| Research | Sonnet | Acceptable understanding |
|
|
61
|
+
| Discussion | Sonnet | Good enough |
|
|
62
|
+
| Planning | Sonnet | Acceptable plans |
|
|
63
|
+
| Execution | Sonnet | Decent code |
|
|
64
|
+
| Debugging | Sonnet | Usually works |
|
|
65
|
+
| Verification | Haiku | Fast is fine |
|
|
66
|
+
| Mapping | Haiku | Fast parsing |
|
|
67
|
+
| Quick | Haiku | Maximum speed |
|
|
68
|
+
|
|
69
|
+
**Estimated cost**: ~0.4x balanced profile (60% savings)
|
|
70
|
+
|
|
71
|
+
</profiles>
|
|
72
|
+
|
|
73
|
+
<workflow>
|
|
74
|
+
|
|
75
|
+
## Step 1: Read Current Config
|
|
76
|
+
|
|
77
|
+
Read `.ctx/config.json`:
|
|
78
|
+
- If doesn't exist: Copy from template, set balanced as default
|
|
79
|
+
- Get current `activeProfile`
|
|
80
|
+
|
|
81
|
+
## Step 2: Handle Command
|
|
82
|
+
|
|
83
|
+
If no argument:
|
|
84
|
+
- Show current profile and routing table
|
|
85
|
+
|
|
86
|
+
If profile name provided:
|
|
87
|
+
- Validate: must be `quality`, `balanced`, or `budget`
|
|
88
|
+
- Update `activeProfile` in config.json
|
|
89
|
+
- Show new routing table
|
|
90
|
+
|
|
91
|
+
## Step 3: Update Config
|
|
92
|
+
|
|
93
|
+
Write updated config to `.ctx/config.json`
|
|
94
|
+
|
|
95
|
+
</workflow>
|
|
96
|
+
|
|
97
|
+
<output_format>
|
|
98
|
+
```
|
|
99
|
+
[CTX] Model Profile: {{profile}}
|
|
100
|
+
|
|
101
|
+
Current Routing:
|
|
102
|
+
Research: {{model}} ({{costTier}})
|
|
103
|
+
Discussion: {{model}} ({{costTier}})
|
|
104
|
+
Planning: {{model}} ({{costTier}})
|
|
105
|
+
Execution: {{model}} ({{costTier}})
|
|
106
|
+
Debugging: {{model}} ({{costTier}})
|
|
107
|
+
Verification: {{model}} ({{costTier}})
|
|
108
|
+
Mapping: {{model}} ({{costTier}})
|
|
109
|
+
Quick: {{model}} ({{costTier}})
|
|
110
|
+
|
|
111
|
+
Estimated Cost: {{multiplier}}x baseline
|
|
112
|
+
|
|
113
|
+
Saved to: .ctx/config.json
|
|
114
|
+
```
|
|
115
|
+
</output_format>
|
|
116
|
+
|
|
117
|
+
<integration>
|
|
118
|
+
All CTX agents check config.json before spawning subagents:
|
|
119
|
+
1. Determine task type (research, planning, etc.)
|
|
120
|
+
2. Look up routing table for model
|
|
121
|
+
3. Use Task tool with `model` parameter
|
|
122
|
+
|
|
123
|
+
Example:
|
|
124
|
+
```
|
|
125
|
+
Task(
|
|
126
|
+
prompt: "Research authentication patterns",
|
|
127
|
+
subagent_type: "ctx-researcher",
|
|
128
|
+
model: "opus" // from config routing
|
|
129
|
+
)
|
|
130
|
+
```
|
|
131
|
+
</integration>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ctx-cc",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "CTX
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "CTX 3.0 (Continuous Task eXecution) - Production-grade workflow orchestration for Claude Code. Repository mapping, discussion phase, model profiles, git-native commits, persistent debug, parallel codebase analysis.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
7
7
|
"claude-code",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ctx.dev/schemas/config.json",
|
|
3
|
+
"version": "3.0",
|
|
4
|
+
|
|
5
|
+
"models": {
|
|
6
|
+
"architect": {
|
|
7
|
+
"id": "claude-opus-4",
|
|
8
|
+
"description": "Best reasoning, use for critical decisions",
|
|
9
|
+
"costTier": "high"
|
|
10
|
+
},
|
|
11
|
+
"default": {
|
|
12
|
+
"id": "claude-sonnet-4",
|
|
13
|
+
"description": "Balanced performance and cost",
|
|
14
|
+
"costTier": "medium"
|
|
15
|
+
},
|
|
16
|
+
"fast": {
|
|
17
|
+
"id": "claude-haiku-4",
|
|
18
|
+
"description": "Quick tasks, lower cost",
|
|
19
|
+
"costTier": "low"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
"routing": {
|
|
24
|
+
"research": "architect",
|
|
25
|
+
"discussion": "default",
|
|
26
|
+
"planning": "architect",
|
|
27
|
+
"execution": "default",
|
|
28
|
+
"debugging": "default",
|
|
29
|
+
"verification": "fast",
|
|
30
|
+
"mapping": "fast",
|
|
31
|
+
"quick": "fast"
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"profiles": {
|
|
35
|
+
"quality": {
|
|
36
|
+
"description": "Best results, higher cost",
|
|
37
|
+
"routing": {
|
|
38
|
+
"research": "architect",
|
|
39
|
+
"discussion": "architect",
|
|
40
|
+
"planning": "architect",
|
|
41
|
+
"execution": "architect",
|
|
42
|
+
"debugging": "architect",
|
|
43
|
+
"verification": "default",
|
|
44
|
+
"mapping": "default",
|
|
45
|
+
"quick": "default"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"balanced": {
|
|
49
|
+
"description": "Good results, moderate cost (default)",
|
|
50
|
+
"routing": {
|
|
51
|
+
"research": "architect",
|
|
52
|
+
"discussion": "default",
|
|
53
|
+
"planning": "architect",
|
|
54
|
+
"execution": "default",
|
|
55
|
+
"debugging": "default",
|
|
56
|
+
"verification": "fast",
|
|
57
|
+
"mapping": "fast",
|
|
58
|
+
"quick": "fast"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"budget": {
|
|
62
|
+
"description": "Acceptable results, lowest cost",
|
|
63
|
+
"routing": {
|
|
64
|
+
"research": "default",
|
|
65
|
+
"discussion": "default",
|
|
66
|
+
"planning": "default",
|
|
67
|
+
"execution": "default",
|
|
68
|
+
"debugging": "default",
|
|
69
|
+
"verification": "fast",
|
|
70
|
+
"mapping": "fast",
|
|
71
|
+
"quick": "fast"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"activeProfile": "balanced",
|
|
77
|
+
|
|
78
|
+
"git": {
|
|
79
|
+
"autoCommit": true,
|
|
80
|
+
"commitPerTask": true,
|
|
81
|
+
"commitMessageFormat": "[CTX] {title}\n\nStory: {storyId} - {storyTitle}\nCriterion: {criterion}\n\nCo-Authored-By: Claude <noreply@anthropic.com>",
|
|
82
|
+
"signOff": false,
|
|
83
|
+
"gpgSign": false
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
"context": {
|
|
87
|
+
"mapTokenBudget": 2000,
|
|
88
|
+
"mapTokenBudgetExpanded": 8000,
|
|
89
|
+
"checkpointThreshold": 0.5,
|
|
90
|
+
"forceCheckpointThreshold": 0.7,
|
|
91
|
+
"handoffThreshold": 0.4
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
"debug": {
|
|
95
|
+
"maxAttempts": 5,
|
|
96
|
+
"persistSessions": true,
|
|
97
|
+
"screenshotOnFailure": true
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
"integrations": {
|
|
101
|
+
"linear": {
|
|
102
|
+
"enabled": false,
|
|
103
|
+
"apiKey": "env:LINEAR_API_KEY",
|
|
104
|
+
"teamId": null,
|
|
105
|
+
"syncStories": true
|
|
106
|
+
},
|
|
107
|
+
"github": {
|
|
108
|
+
"enabled": false,
|
|
109
|
+
"syncIssues": false,
|
|
110
|
+
"createPROnComplete": false
|
|
111
|
+
},
|
|
112
|
+
"slack": {
|
|
113
|
+
"enabled": false,
|
|
114
|
+
"webhookUrl": "env:SLACK_WEBHOOK_URL",
|
|
115
|
+
"notifyOnPhaseComplete": false
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
"ui": {
|
|
120
|
+
"showTokenUsage": true,
|
|
121
|
+
"showModelInfo": true,
|
|
122
|
+
"verboseOutput": false
|
|
123
|
+
}
|
|
124
|
+
}
|