ctx-cc 1.0.0 → 2.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/commands/init.md CHANGED
@@ -1,132 +1,81 @@
1
1
  ---
2
2
  name: ctx:init
3
- description: Initialize CTX project with tech detection and codebase mapping
3
+ description: Initialize CTX project with STATE.md
4
4
  ---
5
5
 
6
6
  <objective>
7
- Initialize a new CTX project. Detect tech stack, map codebase structure, create PROJECT.md and initial ROADMAP.md.
7
+ Initialize a new CTX 2.0 project. Creates `.ctx/` directory with STATE.md as the single source of truth.
8
8
  </objective>
9
9
 
10
- <process>
11
-
12
- <step name="detect_tech_stack">
13
- Scan the project to detect:
14
- - Package managers: package.json, Cargo.toml, go.mod, requirements.txt, etc.
15
- - Frameworks: React, Next.js, FastAPI, Express, etc.
16
- - Languages: TypeScript, Python, Go, Rust, etc.
17
- - Build tools: Webpack, Vite, esbuild, etc.
18
- </step>
19
-
20
- <step name="create_ctx_directory">
21
- Create `.ctx/` directory structure:
22
-
10
+ <workflow>
11
+ ## Step 1: Check Existing
12
+ If `.ctx/STATE.md` exists:
13
+ - Ask: "CTX project exists. Reinitialize? (will archive current state)"
14
+ - If no: stop
15
+ - If yes: backup to `.ctx/archive/STATE-{timestamp}.md`
16
+
17
+ ## Step 2: Detect Project
18
+ Scan the codebase:
19
+ 1. **Package files**: package.json, Cargo.toml, go.mod, requirements.txt, pyproject.toml
20
+ 2. **Frameworks**: React, Next.js, FastAPI, Express, Django, etc.
21
+ 3. **Entry points**: main files, index files, app files
22
+ 4. **Key directories**: src/, lib/, app/, components/, etc.
23
+
24
+ ## Step 3: Create Structure
23
25
  ```
24
26
  .ctx/
25
- ├── PROJECT.md
26
- ├── ROADMAP.md
27
- ├── config.json
28
- ├── phases/
29
- ├── memory/
30
- ├── working/
31
- ├── episodic/
32
- │ └── semantic/
33
- ├── checkpoints/
34
- └── todos/
27
+ ├── STATE.md # Living digest - ALWAYS read first
28
+ ├── phases/ # Phase-specific data
29
+ │ └── {phase-id}/
30
+ ├── RESEARCH.md
31
+ ├── PLAN.md
32
+ └── VERIFY.md
33
+ ├── checkpoints/ # Auto-checkpoints for resume
34
+ ├── memory/ # Decision memory
35
+ └── archive/ # Archived states
35
36
  ```
36
- </step>
37
37
 
38
- <step name="map_codebase">
39
- If this is an existing codebase (not empty), analyze:
40
- - Entry points (main files, index files)
41
- - Key directories and their purposes
42
- - Architectural patterns used
43
- - Important dependencies
38
+ ## Step 4: Initialize STATE.md
39
+ Create STATE.md from template with:
40
+ - Project name (from package.json or directory name)
41
+ - Detected tech stack
42
+ - Status: "initializing"
43
+ - Context budget: 0%
44
+ - Empty current phase
44
45
 
45
- Use ChunkHound if available:
46
+ ## Step 5: Index with ChunkHound (if available)
46
47
  ```bash
47
- chunkhound index .
48
- ```
49
- </step>
50
-
51
- <step name="create_project_md">
52
- Write `.ctx/PROJECT.md`:
53
-
54
- ```markdown
55
- # Project: {name}
56
-
57
- ## Tech Stack
58
- - Language: {detected}
59
- - Framework: {detected}
60
- - Build: {detected}
61
-
62
- ## Architecture
63
- {brief description from codebase mapping}
64
-
65
- ## Entry Points
66
- - {list of main files}
67
-
68
- ## Key Patterns
69
- - {patterns identified}
70
-
71
- ## Initialized
72
- {timestamp}
73
- ```
74
- </step>
75
-
76
- <step name="create_config">
77
- Write `.ctx/config.json`:
78
-
79
- ```json
80
- {
81
- "version": "1.0.0",
82
- "initialized": "{timestamp}",
83
- "techStack": {
84
- "language": "{detected}",
85
- "framework": "{detected}",
86
- "buildTool": "{detected}"
87
- },
88
- "integrations": {
89
- "arguseek": true,
90
- "chunkhound": true
91
- },
92
- "contextBudget": 50
93
- }
48
+ chunkhound index . --output .ctx/chunks.json
94
49
  ```
95
- </step>
96
-
97
- <step name="ask_goal">
98
- Ask the user:
99
-
100
- "Project initialized! What's your goal for this project?"
50
+ This enables semantic code search during planning.
101
51
 
102
- Based on their answer, create initial `.ctx/ROADMAP.md` with Phase 1.
103
- </step>
52
+ ## Step 6: Prompt for Goal
53
+ Ask user: **"What do you want to build/fix/improve?"**
104
54
 
105
- </process>
55
+ Do NOT start planning yet. Just store the goal in STATE.md and set status to "initializing".
56
+ The user will run `/ctx` to begin the research + planning phase.
57
+ </workflow>
106
58
 
107
- <output>
59
+ <output_format>
108
60
  ```
109
- ## CTX Initialized
61
+ [CTX 2.0] Initialized
110
62
 
111
- **Project:** {name}
112
- **Tech Stack:** {language} + {framework}
113
- **Integrations:**
114
- - ArguSeek: {available/not available}
115
- - ChunkHound: {indexed/not available}
63
+ Project: {{name}}
64
+ Stack: {{language}} + {{framework}}
65
+ Directory: .ctx/
116
66
 
117
- **Files Created:**
118
- - .ctx/PROJECT.md
119
- - .ctx/ROADMAP.md
120
- - .ctx/config.json
67
+ Integrations:
68
+ ArguSeek: ready
69
+ ChunkHound: {{indexed | not found}}
121
70
 
122
- **Next:** Run `/ctx:plan <goal>` to start your first phase.
71
+ Next: Run /ctx to start planning
123
72
  ```
124
- </output>
73
+ </output_format>
125
74
 
126
75
  <success_criteria>
127
- - [ ] Tech stack detected correctly
128
76
  - [ ] .ctx/ directory created
129
- - [ ] PROJECT.md written with accurate info
130
- - [ ] ChunkHound index attempted if available
131
- - [ ] User asked for project goal
77
+ - [ ] STATE.md initialized with detected info
78
+ - [ ] ChunkHound index attempted
79
+ - [ ] User prompted for goal
80
+ - [ ] Status set to "initializing"
132
81
  </success_criteria>
package/commands/pause.md CHANGED
@@ -1,104 +1,103 @@
1
1
  ---
2
2
  name: ctx:pause
3
- description: Create checkpoint with handoff notes
3
+ description: Create checkpoint with handoff notes - safe to close session
4
4
  ---
5
5
 
6
6
  <objective>
7
- Create a checkpoint of current state for seamless session resumption. Captures all context needed to continue later.
7
+ Create a checkpoint for seamless session resumption. Captures all context in ~2.5k tokens.
8
8
  </objective>
9
9
 
10
- <process>
10
+ <workflow>
11
+ ## Step 1: Capture State
12
+ Read current STATE.md and capture:
13
+ 1. **Status** - Current workflow state
14
+ 2. **Phase** - Active phase and goal
15
+ 3. **Task** - Current task and progress
16
+ 4. **Debug** - If debugging, capture hypothesis and attempt count
17
+ 5. **Decisions** - Recent decisions made
11
18
 
12
- <step name="capture_state">
13
- Capture current state:
14
-
15
- 1. **Active phase** - Which phase, which task
16
- 2. **Progress** - What's done, what's pending
17
- 3. **Working memory** - Recent facts and decisions
18
- 4. **File state** - Files being worked on
19
- 5. **Context usage** - Current percentage
20
- </step>
21
-
22
- <step name="generate_handoff">
23
- Create handoff notes:
19
+ ## Step 2: Generate Checkpoint
20
+ Create `.ctx/checkpoints/checkpoint-{timestamp}.md`:
24
21
 
25
22
  ```markdown
26
23
  # Checkpoint: {timestamp}
27
24
 
28
- ## Context
29
- **Phase:** {phase name}
30
- **Task:** {current task or "between tasks"}
31
- **Progress:** {percentage}%
25
+ ## Resume Context
26
+ **Status:** {status from STATE.md}
27
+ **Phase:** {phase_id} - {phase_goal}
28
+ **Task:** {current_task}
29
+ **Progress:** {completed}/{total} tasks
32
30
 
33
- ## What Was Done
34
- - {completed item 1}
35
- - {completed item 2}
31
+ ## Session Summary
32
+ ### Completed
33
+ - {completed_1}
34
+ - {completed_2}
36
35
 
37
- ## What's Next
38
- - {next task}
39
- - {considerations}
36
+ ### In Progress
37
+ - {current_task}: {status}
40
38
 
41
- ## Key Decisions Made
42
- - {decision 1}
43
- - {decision 2}
39
+ ### Next Steps
40
+ 1. {next_step_1}
41
+ 2. {next_step_2}
44
42
 
45
- ## Open Questions
46
- - {question if any}
43
+ ## Key Decisions
44
+ - {decision_1}
45
+ - {decision_2}
47
46
 
48
- ## Files in Progress
49
- - {file 1}: {state}
50
- - {file 2}: {state}
51
- ```
52
- </step>
47
+ ## Debug State (if active)
48
+ - Issue: {debug_issue}
49
+ - Hypothesis: {current_hypothesis}
50
+ - Attempt: {attempt}/5
51
+ - Last Error: {error_summary}
53
52
 
54
- <step name="save_checkpoint">
55
- Save to `.ctx/checkpoints/{checkpoint-id}/`:
53
+ ## Files Modified
54
+ - {file_1}: {change_summary}
55
+ - {file_2}: {change_summary}
56
56
 
57
+ ## Context Budget
58
+ - Used: {percent}%
59
+ - Quality: {level}
60
+
61
+ ---
62
+ *Resume with /ctx - state will be restored automatically*
57
63
  ```
58
- .ctx/checkpoints/{id}/
59
- ├── HANDOFF.md # Human-readable summary
60
- ├── state.json # Machine-readable state
61
- ├── working-memory.json # Current session memory
62
- └── file-index.json # Relevant files
63
- ```
64
- </step>
65
64
 
66
- <step name="commit_checkpoint">
67
- Create git commit for checkpoint:
65
+ ## Step 3: Update STATE.md
66
+ Set status to "paused" and record checkpoint ID.
68
67
 
68
+ ## Step 4: Git Commit (optional)
69
+ If uncommitted changes exist:
69
70
  ```bash
70
71
  git add .ctx/
71
- git commit -m "ctx: checkpoint {id} - {phase name}"
72
+ git commit -m "ctx: checkpoint - {phase_goal}"
72
73
  ```
73
- </step>
74
74
 
75
- <step name="output">
75
+ ## Step 5: Output
76
76
  ```
77
- ## Checkpoint Created
78
-
79
- **ID:** {checkpoint-id}
80
- **Phase:** {phase name}
81
- **Progress:** {percentage}%
82
- **Context:** {context percentage}%
77
+ [CTX] Checkpoint created
83
78
 
84
- **Handoff Summary:**
85
- {brief summary}
79
+ Status: paused
80
+ Phase: {phase_id} - {phase_goal}
81
+ Progress: {completed}/{total} tasks
82
+ Context: {percent}%
86
83
 
87
- **Resume Command:**
88
- ```
89
- /ctx:resume
90
- ```
84
+ Checkpoint ID: {checkpoint_id}
85
+ Resume: Run /ctx (auto-restores state)
91
86
 
92
- Safe to close this session. State preserved.
87
+ Safe to close this session.
93
88
  ```
94
- </step>
89
+ </workflow>
95
90
 
96
- </process>
91
+ <resume_cost>
92
+ Target: ~2.5k tokens to restore full context
93
+ - STATE.md: ~100 lines
94
+ - Checkpoint: ~50 lines
95
+ - Phase data: ~100 lines
96
+ </resume_cost>
97
97
 
98
98
  <success_criteria>
99
- - [ ] State fully captured
100
- - [ ] Handoff notes generated
101
- - [ ] Checkpoint saved to .ctx/checkpoints/
102
- - [ ] Git commit created
103
- - [ ] Resume instructions provided
99
+ - [ ] STATE.md captured
100
+ - [ ] Checkpoint file created
101
+ - [ ] Status set to "paused"
102
+ - [ ] Resume instructions clear
104
103
  </success_criteria>
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: ctx:phase
3
+ description: Phase management - list, add, next, skip
4
+ args: subcommand (list|add|next|skip)
5
+ ---
6
+
7
+ <objective>
8
+ Manage project phases explicitly. CRUD operations for the phase roadmap.
9
+ </objective>
10
+
11
+ <usage>
12
+ ```
13
+ /ctx phase list # Show all phases with status
14
+ /ctx phase add "goal" # Add new phase to roadmap
15
+ /ctx phase next # Mark current complete, move to next
16
+ /ctx phase skip # Skip current phase (mark skipped)
17
+ ```
18
+ </usage>
19
+
20
+ <subcommands>
21
+
22
+ ## /ctx phase list
23
+
24
+ Show all phases with their status.
25
+
26
+ **Output:**
27
+ ```
28
+ [CTX Phases]
29
+
30
+ # Status Goal
31
+ ─────────────────────────────────────────
32
+ 1 ✓ complete Set up project structure
33
+ 2 ● current Add user authentication
34
+ 3 ○ pending Implement dashboard
35
+ 4 ○ pending Add API endpoints
36
+
37
+ Current: Phase 2 - Add user authentication
38
+ Progress: 1/3 tasks complete
39
+ ```
40
+
41
+ **Status indicators:**
42
+ - `✓` complete - Phase verified and done
43
+ - `●` current - Currently active phase
44
+ - `○` pending - Not yet started
45
+ - `⊘` skipped - Explicitly skipped
46
+
47
+ ---
48
+
49
+ ## /ctx phase add "goal"
50
+
51
+ Add a new phase to the end of the roadmap.
52
+
53
+ **Process:**
54
+ 1. Generate phase ID (increment)
55
+ 2. Create `.ctx/phases/{id}/` directory
56
+ 3. Update STATE.md with new phase in roadmap
57
+ 4. Do NOT start planning yet (user runs `/ctx plan` when ready)
58
+
59
+ **Output:**
60
+ ```
61
+ [CTX Phase] Added phase {id}
62
+
63
+ Goal: {goal}
64
+ Status: pending
65
+
66
+ Roadmap now has {n} phases.
67
+ Run /ctx plan "{goal}" when ready to plan this phase.
68
+ ```
69
+
70
+ ---
71
+
72
+ ## /ctx phase next
73
+
74
+ Mark current phase complete and move to the next.
75
+
76
+ **Process:**
77
+ 1. Verify current phase is complete (all tasks done)
78
+ 2. If not complete, warn user
79
+ 3. Mark current phase as "complete"
80
+ 4. Set next pending phase as "current"
81
+ 5. Update STATE.md
82
+
83
+ **Output (success):**
84
+ ```
85
+ [CTX Phase] Completed phase {id}: {goal}
86
+
87
+ Moving to phase {next_id}: {next_goal}
88
+ Run /ctx to start planning.
89
+ ```
90
+
91
+ **Output (not ready):**
92
+ ```
93
+ [CTX Phase] Cannot complete phase {id}
94
+
95
+ Remaining tasks:
96
+ - {task_1}
97
+ - {task_2}
98
+
99
+ Run /ctx to continue, or /ctx phase skip to skip.
100
+ ```
101
+
102
+ ---
103
+
104
+ ## /ctx phase skip
105
+
106
+ Skip the current phase without completing it.
107
+
108
+ **Process:**
109
+ 1. Mark current phase as "skipped"
110
+ 2. Log reason (optional prompt)
111
+ 3. Move to next phase
112
+ 4. Update STATE.md
113
+
114
+ **Output:**
115
+ ```
116
+ [CTX Phase] Skipped phase {id}: {goal}
117
+
118
+ Moving to phase {next_id}: {next_goal}
119
+ Run /ctx to start planning.
120
+ ```
121
+
122
+ </subcommands>
123
+
124
+ <state_management>
125
+ Phases are tracked in STATE.md:
126
+
127
+ ```markdown
128
+ ## Phases
129
+ | ID | Status | Goal |
130
+ |----|--------|------|
131
+ | 1 | complete | Set up project structure |
132
+ | 2 | current | Add user authentication |
133
+ | 3 | pending | Implement dashboard |
134
+ ```
135
+
136
+ And in individual directories:
137
+ ```
138
+ .ctx/phases/
139
+ ├── 1/
140
+ │ ├── RESEARCH.md
141
+ │ ├── PLAN.md
142
+ │ └── VERIFY.md
143
+ ├── 2/
144
+ │ ├── RESEARCH.md
145
+ │ └── PLAN.md
146
+ └── 3/
147
+ (empty until planned)
148
+ ```
149
+ </state_management>