ctx-cc 1.0.0 → 2.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/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,68 @@
1
+ ---
2
+ name: ctx:quick
3
+ description: Quick task bypass - execute without full workflow
4
+ ---
5
+
6
+ <objective>
7
+ Execute a quick task without the full CTX workflow.
8
+ Use for small fixes, one-off tasks, or urgent work that doesn't need planning.
9
+ </objective>
10
+
11
+ <usage>
12
+ ```
13
+ /ctx:quick "fix the login button styling"
14
+ /ctx:quick "add console.log for debugging"
15
+ /ctx:quick "update the README"
16
+ ```
17
+ </usage>
18
+
19
+ <workflow>
20
+ ## Step 1: Validate Task Size
21
+ Quick tasks should be:
22
+ - Single file or 2-3 files max
23
+ - No architectural decisions
24
+ - < 30 minutes of work
25
+ - Clear, specific outcome
26
+
27
+ If task seems large, suggest: "This looks like a bigger task. Consider `/ctx init` + `/ctx` for proper planning."
28
+
29
+ ## Step 2: Execute Directly
30
+ 1. Understand the task
31
+ 2. Find relevant files
32
+ 3. Make changes
33
+ 4. Verify (build + tests if applicable)
34
+
35
+ ## Step 3: Verify Success
36
+ Run appropriate verification:
37
+ - Build: `npm run build` / `go build` / etc.
38
+ - Tests: Run affected tests
39
+ - Lint: Check for errors
40
+
41
+ If verification fails:
42
+ - Auto-fix if simple (typo, import)
43
+ - Otherwise report issue
44
+
45
+ ## Step 4: Update STATE.md (if exists)
46
+ If `.ctx/STATE.md` exists, log the quick task:
47
+ ```
48
+ ## Quick Tasks Log
49
+ - [timestamp] {{task_description}} - {{status}}
50
+ ```
51
+
52
+ ## Step 5: Output
53
+ Report what was done:
54
+ ```
55
+ [CTX Quick] {{task_description}}
56
+ [CTX Quick] Changed: {{files}}
57
+ [CTX Quick] Verified: {{build/tests status}}
58
+ [CTX Quick] Done.
59
+ ```
60
+ </workflow>
61
+
62
+ <guardrails>
63
+ - Max 3 files changed
64
+ - No database schema changes
65
+ - No API contract changes
66
+ - No new dependencies without asking
67
+ - No refactoring (use full workflow for that)
68
+ </guardrails>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "1.0.0",
4
- "description": "CTX - Smart Context Management for Claude Code. The GSD Killer.",
3
+ "version": "2.0.0",
4
+ "description": "CTX 2.0 (Continuous Task eXecution) - Smart workflow orchestration for Claude Code. 4 commands, debug loop, 100% verified.",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
package/src/install.js CHANGED
@@ -28,9 +28,9 @@ function printBanner() {
28
28
  ╚██████╗ ██║ ██╔╝ ██╗
29
29
  ╚═════╝ ╚═╝ ╚═╝ ╚═╝
30
30
  `));
31
- console.log(` ${bold('CTX')} ${dim(`v${VERSION}`)}`);
32
- console.log(' Smart Context Management for Claude Code.');
33
- console.log(' The GSD Killer. 12 commands, infinite power.\n');
31
+ console.log(` ${bold('CTX 2.0')} ${dim(`v${VERSION}`)}`);
32
+ console.log(' Continuous Task eXecution for Claude Code.');
33
+ console.log(' 4 commands. Debug loop. 100% verified.\n');
34
34
  }
35
35
 
36
36
  function copyDir(src, dest) {
@@ -0,0 +1,47 @@
1
+ # STATE.md - Living Digest
2
+
3
+ > This file is the single source of truth. Updated after every action.
4
+ > ~100 lines max. Always accurate. Always current.
5
+
6
+ ## Project
7
+ - **Name**: {{project_name}}
8
+ - **Stack**: {{tech_stack}}
9
+ - **Status**: {{status}} <!-- initializing | planning | executing | debugging | verifying | paused -->
10
+
11
+ ## Current Phase
12
+ - **ID**: {{phase_id}}
13
+ - **Goal**: {{phase_goal}}
14
+ - **Progress**: {{completed_tasks}}/{{total_tasks}} tasks
15
+
16
+ ## Active Task
17
+ - **Task**: {{current_task}}
18
+ - **Status**: {{task_status}} <!-- pending | in_progress | blocked | debugging | done -->
19
+ - **Attempts**: {{attempt_count}}/5
20
+
21
+ ## Debug Session (if active)
22
+ - **Issue**: {{debug_issue}}
23
+ - **Hypothesis**: {{current_hypothesis}}
24
+ - **Attempt**: {{debug_attempt}}/5
25
+ - **Last Error**: {{last_error}}
26
+ - **Browser Verified**: {{browser_verified}} <!-- false | true -->
27
+
28
+ ## Context Budget
29
+ - **Used**: {{context_percent}}%
30
+ - **Quality**: {{quality_level}} <!-- peak | good | degrading | poor -->
31
+ - **Action**: {{recommended_action}} <!-- continue | checkpoint-soon | checkpoint-now -->
32
+
33
+ ## Recent Decisions
34
+ <!-- Last 5 decisions, newest first -->
35
+ 1. {{decision_1}}
36
+ 2. {{decision_2}}
37
+ 3. {{decision_3}}
38
+
39
+ ## Blockers
40
+ <!-- Current blockers requiring user input -->
41
+ - {{blocker_1}}
42
+
43
+ ## Next Action
44
+ > {{next_action_description}}
45
+
46
+ ---
47
+ *Last updated: {{timestamp}}*
package/commands/do.md DELETED
@@ -1,130 +0,0 @@
1
- ---
2
- name: ctx:do
3
- description: Execute current phase or run a quick task
4
- args: "[task]"
5
- ---
6
-
7
- <objective>
8
- Execute the current phase's plan, OR run a quick task if an argument is provided.
9
- </objective>
10
-
11
- <process>
12
-
13
- <step name="check_mode">
14
- If argument provided (e.g., `/ctx:do "fix the login bug"`):
15
- → Quick Task Mode
16
-
17
- If no argument:
18
- → Phase Execution Mode
19
- </step>
20
-
21
- <!-- QUICK TASK MODE -->
22
- <step name="quick_task" condition="argument provided">
23
- Quick task mode - bypass full workflow:
24
-
25
- 1. Read the task description
26
- 2. Load relevant context from memory
27
- 3. Execute the task directly
28
- 4. Create atomic git commit
29
- 5. Update memory with what was done
30
-
31
- ```
32
- ## Quick Task
33
-
34
- **Task:** {task description}
35
- **Status:** In Progress
36
-
37
- Executing without full planning workflow...
38
- ```
39
-
40
- Skip to `complete_task` step.
41
- </step>
42
-
43
- <!-- PHASE EXECUTION MODE -->
44
- <step name="load_phase">
45
- Load current phase from `.ctx/ROADMAP.md`:
46
-
47
- 1. Find phase with status "in_progress" or first "pending"
48
- 2. Load `.ctx/phases/{phase-id}/PLAN.md`
49
- 3. Load `.ctx/phases/{phase-id}/PROGRESS.md`
50
-
51
- If no phase found:
52
- ```
53
- No phase to execute. Run `/ctx:plan <goal>` first.
54
- ```
55
- </step>
56
-
57
- <step name="load_context">
58
- JIT context loading:
59
-
60
- 1. Load relevant facts from memory
61
- 2. Load file index for files mentioned in plan
62
- 3. Retrieve only needed files (not entire codebase)
63
-
64
- Target: Minimal context for current task.
65
- </step>
66
-
67
- <step name="execute_tasks">
68
- For each task in PLAN.md:
69
-
70
- 1. **Start task**
71
- - Update PROGRESS.md: task status → "in_progress"
72
- - Load task-specific files
73
-
74
- 2. **Execute**
75
- - Implement the task
76
- - Follow deviation rules:
77
- - Bug in existing code → Auto-fix, document
78
- - Missing validation → Auto-add, document
79
- - Blocking issue → Auto-fix, document
80
- - Architectural decision → STOP, ask user
81
-
82
- 3. **Commit**
83
- - Atomic git commit for the task
84
- - Message: "ctx: {task title}"
85
-
86
- 4. **Update progress**
87
- - Mark task complete in PROGRESS.md
88
- - Extract facts to memory
89
- - Check context budget
90
-
91
- 5. **Context check**
92
- - If context > 50%: trigger auto-checkpoint
93
- - Signal user if split recommended
94
- </step>
95
-
96
- <step name="complete_task">
97
- After task/phase completion:
98
-
99
- ```
100
- ## Task Complete
101
-
102
- **Task:** {description}
103
- **Files changed:** {list}
104
- **Commit:** {hash}
105
-
106
- **Context:** {percentage}%
107
- {If > 50%: "Consider `/ctx:pause` to checkpoint."}
108
-
109
- **Next:** {next task or "Run `/ctx:verify` to validate"}
110
- ```
111
- </step>
112
-
113
- </process>
114
-
115
- <deviation_rules>
116
- | Rule | Trigger | Action |
117
- |------|---------|--------|
118
- | 1 | Bug in existing code | Auto-fix, document in commit |
119
- | 2 | Missing validation | Auto-add, document |
120
- | 3 | Blocking issue | Auto-fix, document |
121
- | 4 | Architectural decision | **STOP** - ask user |
122
- </deviation_rules>
123
-
124
- <success_criteria>
125
- - [ ] Task executed successfully
126
- - [ ] Atomic git commit created
127
- - [ ] PROGRESS.md updated
128
- - [ ] Memory updated with facts
129
- - [ ] Context budget monitored
130
- </success_criteria>
@@ -1,58 +0,0 @@
1
- ---
2
- name: ctx:forget
3
- description: Remove a fact from memory
4
- args: "<id>"
5
- ---
6
-
7
- <objective>
8
- Remove a specific fact from CTX memory by its ID.
9
- </objective>
10
-
11
- <process>
12
-
13
- <step name="find_fact">
14
- Search all memory tiers for the fact ID.
15
-
16
- If not found:
17
- ```
18
- Fact "{id}" not found in memory.
19
- Use `/ctx:recall {query}` to find fact IDs.
20
- ```
21
- </step>
22
-
23
- <step name="confirm">
24
- Show the fact before removal:
25
-
26
- ```
27
- ## Forget Fact
28
-
29
- **ID:** {id}
30
- **Content:** {fact}
31
- **Category:** {category}
32
- **Stored:** {timestamp}
33
-
34
- Are you sure you want to remove this fact?
35
- This cannot be undone.
36
- ```
37
- </step>
38
-
39
- <step name="remove">
40
- Delete the fact from its memory tier.
41
-
42
- ```
43
- ## Fact Forgotten
44
-
45
- **ID:** {id}
46
- **Content:** {fact}
47
-
48
- Removed from {tier} memory.
49
- ```
50
- </step>
51
-
52
- </process>
53
-
54
- <success_criteria>
55
- - [ ] Fact located by ID
56
- - [ ] Confirmation shown
57
- - [ ] Fact removed from correct tier
58
- </success_criteria>