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/README.md +124 -75
- package/agents/ctx-debugger.md +257 -0
- package/agents/ctx-executor.md +96 -71
- package/agents/ctx-planner.md +70 -62
- package/agents/ctx-researcher.md +26 -19
- package/agents/ctx-verifier.md +86 -68
- package/bin/ctx.js +3 -2
- package/commands/ctx.md +116 -0
- package/commands/help.md +109 -92
- package/commands/init.md +55 -106
- package/commands/pause.md +68 -69
- package/commands/phase.md +149 -0
- package/commands/plan.md +77 -123
- package/commands/quick.md +68 -0
- package/commands/status.md +59 -76
- package/commands/verify.md +91 -121
- package/package.json +2 -2
- package/src/install.js +3 -3
- package/templates/STATE.md +47 -0
- package/commands/do.md +0 -130
- package/commands/forget.md +0 -58
- package/commands/phase-add.md +0 -53
- package/commands/phase-list.md +0 -46
- package/commands/phase-next.md +0 -67
- package/commands/recall.md +0 -72
- package/commands/remember.md +0 -68
- package/commands/resume.md +0 -108
- package/commands/ship.md +0 -119
- package/commands/update.md +0 -117
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('
|
|
33
|
-
console.log('
|
|
31
|
+
console.log(` ${bold('CTX 2.1')} ${dim(`v${VERSION}`)}`);
|
|
32
|
+
console.log(' Continuous Task eXecution for Claude Code.');
|
|
33
|
+
console.log(' 8 commands. Smart routing. Debug loop.\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>
|
package/commands/forget.md
DELETED
|
@@ -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>
|
package/commands/phase-add.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx:phase-add
|
|
3
|
-
description: Add a new phase to the roadmap
|
|
4
|
-
args: "<name>"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<objective>
|
|
8
|
-
Add a new phase to the project roadmap.
|
|
9
|
-
</objective>
|
|
10
|
-
|
|
11
|
-
<process>
|
|
12
|
-
|
|
13
|
-
<step name="validate">
|
|
14
|
-
Check `.ctx/ROADMAP.md` exists. If not:
|
|
15
|
-
```
|
|
16
|
-
CTX not initialized. Run `/ctx:init` first.
|
|
17
|
-
```
|
|
18
|
-
</step>
|
|
19
|
-
|
|
20
|
-
<step name="get_details">
|
|
21
|
-
Ask user for phase details:
|
|
22
|
-
|
|
23
|
-
1. **Goal**: What should this phase achieve?
|
|
24
|
-
2. **Priority**: Where in the roadmap? (next, end, after phase X)
|
|
25
|
-
</step>
|
|
26
|
-
|
|
27
|
-
<step name="create_phase">
|
|
28
|
-
1. Generate phase ID from name (slugified)
|
|
29
|
-
2. Create phase directory: `.ctx/phases/{phase-id}/`
|
|
30
|
-
3. Add to ROADMAP.md in specified position
|
|
31
|
-
4. Set status to "pending"
|
|
32
|
-
</step>
|
|
33
|
-
|
|
34
|
-
<step name="output">
|
|
35
|
-
```
|
|
36
|
-
## Phase Added
|
|
37
|
-
|
|
38
|
-
**Name:** {name}
|
|
39
|
-
**ID:** {phase-id}
|
|
40
|
-
**Position:** #{position} in roadmap
|
|
41
|
-
**Status:** pending
|
|
42
|
-
|
|
43
|
-
**Next:** Run `/ctx:plan {name}` to create the plan.
|
|
44
|
-
```
|
|
45
|
-
</step>
|
|
46
|
-
|
|
47
|
-
</process>
|
|
48
|
-
|
|
49
|
-
<success_criteria>
|
|
50
|
-
- [ ] Phase added to ROADMAP.md
|
|
51
|
-
- [ ] Phase directory created
|
|
52
|
-
- [ ] Position correct in roadmap
|
|
53
|
-
</success_criteria>
|
package/commands/phase-list.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx:phase-list
|
|
3
|
-
description: Show all phases with status
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<objective>
|
|
7
|
-
Display all phases in the roadmap with their current status.
|
|
8
|
-
</objective>
|
|
9
|
-
|
|
10
|
-
<process>
|
|
11
|
-
|
|
12
|
-
<step name="load_roadmap">
|
|
13
|
-
Read `.ctx/ROADMAP.md` and parse phases.
|
|
14
|
-
|
|
15
|
-
If not found:
|
|
16
|
-
```
|
|
17
|
-
CTX not initialized. Run `/ctx:init` first.
|
|
18
|
-
```
|
|
19
|
-
</step>
|
|
20
|
-
|
|
21
|
-
<step name="display_phases">
|
|
22
|
-
```
|
|
23
|
-
## Project Phases
|
|
24
|
-
|
|
25
|
-
| # | Phase | Status | Progress | Verified |
|
|
26
|
-
|---|-------|--------|----------|----------|
|
|
27
|
-
| 1 | {name} | complete | 100% | ✓ |
|
|
28
|
-
| 2 | {name} | in_progress | 60% | - |
|
|
29
|
-
| 3 | {name} | pending | 0% | - |
|
|
30
|
-
|
|
31
|
-
**Current:** Phase 2 - {name}
|
|
32
|
-
**Remaining:** {count} phases
|
|
33
|
-
|
|
34
|
-
**Next action:**
|
|
35
|
-
- If current incomplete: `/ctx:do`
|
|
36
|
-
- If current done: `/ctx:verify` then `/ctx:phase next`
|
|
37
|
-
```
|
|
38
|
-
</step>
|
|
39
|
-
|
|
40
|
-
</process>
|
|
41
|
-
|
|
42
|
-
<success_criteria>
|
|
43
|
-
- [ ] All phases listed with accurate status
|
|
44
|
-
- [ ] Current phase highlighted
|
|
45
|
-
- [ ] Next action suggested
|
|
46
|
-
</success_criteria>
|
package/commands/phase-next.md
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx:phase-next
|
|
3
|
-
description: Move to the next phase in the roadmap
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<objective>
|
|
7
|
-
Complete current phase and move to the next one.
|
|
8
|
-
</objective>
|
|
9
|
-
|
|
10
|
-
<process>
|
|
11
|
-
|
|
12
|
-
<step name="check_current">
|
|
13
|
-
Load current phase from `.ctx/ROADMAP.md`.
|
|
14
|
-
|
|
15
|
-
If current phase not verified:
|
|
16
|
-
```
|
|
17
|
-
⚠ Current phase not verified.
|
|
18
|
-
Run `/ctx:verify` first to ensure phase is complete.
|
|
19
|
-
```
|
|
20
|
-
</step>
|
|
21
|
-
|
|
22
|
-
<step name="complete_current">
|
|
23
|
-
1. Mark current phase as "complete" in ROADMAP.md
|
|
24
|
-
2. Update completion timestamp
|
|
25
|
-
3. Archive phase state to memory
|
|
26
|
-
</step>
|
|
27
|
-
|
|
28
|
-
<step name="activate_next">
|
|
29
|
-
1. Find next "pending" phase
|
|
30
|
-
2. Mark it as "in_progress"
|
|
31
|
-
3. Load phase details
|
|
32
|
-
|
|
33
|
-
If no next phase:
|
|
34
|
-
```
|
|
35
|
-
## All Phases Complete!
|
|
36
|
-
|
|
37
|
-
No more phases in the roadmap.
|
|
38
|
-
|
|
39
|
-
**Options:**
|
|
40
|
-
- `/ctx:ship` - Run final audit
|
|
41
|
-
- `/ctx:phase add <name>` - Add more phases
|
|
42
|
-
```
|
|
43
|
-
</step>
|
|
44
|
-
|
|
45
|
-
<step name="output">
|
|
46
|
-
```
|
|
47
|
-
## Phase Transition
|
|
48
|
-
|
|
49
|
-
**Completed:** {previous phase}
|
|
50
|
-
**Now Active:** {next phase}
|
|
51
|
-
|
|
52
|
-
**Phase Goal:** {goal}
|
|
53
|
-
**Tasks:** {count from PLAN.md or "Not planned yet"}
|
|
54
|
-
|
|
55
|
-
**Next:**
|
|
56
|
-
- If not planned: `/ctx:plan {goal}`
|
|
57
|
-
- If planned: `/ctx:do`
|
|
58
|
-
```
|
|
59
|
-
</step>
|
|
60
|
-
|
|
61
|
-
</process>
|
|
62
|
-
|
|
63
|
-
<success_criteria>
|
|
64
|
-
- [ ] Previous phase marked complete
|
|
65
|
-
- [ ] Next phase activated
|
|
66
|
-
- [ ] Clear guidance on next steps
|
|
67
|
-
</success_criteria>
|
package/commands/recall.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx:recall
|
|
3
|
-
description: Query memory for relevant facts
|
|
4
|
-
args: "<query>"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<objective>
|
|
8
|
-
Search CTX memory for facts matching the query. Returns relevant information from all memory tiers.
|
|
9
|
-
</objective>
|
|
10
|
-
|
|
11
|
-
<process>
|
|
12
|
-
|
|
13
|
-
<step name="search_memory">
|
|
14
|
-
Search across all memory tiers:
|
|
15
|
-
|
|
16
|
-
1. **Working memory** - Current session facts
|
|
17
|
-
2. **Episodic memory** - Cross-session facts
|
|
18
|
-
3. **Semantic memory** - Permanent knowledge
|
|
19
|
-
|
|
20
|
-
Match by:
|
|
21
|
-
- Keyword matching
|
|
22
|
-
- Category filtering
|
|
23
|
-
- Relevance scoring
|
|
24
|
-
</step>
|
|
25
|
-
|
|
26
|
-
<step name="rank_results">
|
|
27
|
-
Rank results by:
|
|
28
|
-
1. Recency (newer facts first)
|
|
29
|
-
2. Relevance to query
|
|
30
|
-
3. Importance (manual > auto-extracted)
|
|
31
|
-
</step>
|
|
32
|
-
|
|
33
|
-
<step name="display">
|
|
34
|
-
```
|
|
35
|
-
## Memory Recall: "{query}"
|
|
36
|
-
|
|
37
|
-
### Results ({count} found)
|
|
38
|
-
|
|
39
|
-
**From Episodic Memory:**
|
|
40
|
-
1. [{id}] {fact} ({timestamp})
|
|
41
|
-
2. [{id}] {fact} ({timestamp})
|
|
42
|
-
|
|
43
|
-
**From Semantic Memory:**
|
|
44
|
-
3. [{id}] {fact} (permanent)
|
|
45
|
-
|
|
46
|
-
**From Working Memory:**
|
|
47
|
-
4. [{id}] {fact} (current session)
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
To forget a fact: `/ctx:forget {id}`
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
If no results:
|
|
54
|
-
```
|
|
55
|
-
## Memory Recall: "{query}"
|
|
56
|
-
|
|
57
|
-
No matching facts found.
|
|
58
|
-
|
|
59
|
-
**Tips:**
|
|
60
|
-
- Try broader keywords
|
|
61
|
-
- Check `/ctx:status` for memory stats
|
|
62
|
-
- Use `/ctx:remember` to add facts
|
|
63
|
-
```
|
|
64
|
-
</step>
|
|
65
|
-
|
|
66
|
-
</process>
|
|
67
|
-
|
|
68
|
-
<success_criteria>
|
|
69
|
-
- [ ] All memory tiers searched
|
|
70
|
-
- [ ] Results ranked by relevance
|
|
71
|
-
- [ ] IDs provided for management
|
|
72
|
-
</success_criteria>
|
package/commands/remember.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx:remember
|
|
3
|
-
description: Force-remember an important fact
|
|
4
|
-
args: "<fact>"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<objective>
|
|
8
|
-
Manually add a fact to CTX memory. Use for important information that should persist across sessions.
|
|
9
|
-
</objective>
|
|
10
|
-
|
|
11
|
-
<process>
|
|
12
|
-
|
|
13
|
-
<step name="validate">
|
|
14
|
-
Check `.ctx/memory/` exists. Create if not.
|
|
15
|
-
</step>
|
|
16
|
-
|
|
17
|
-
<step name="categorize">
|
|
18
|
-
Determine fact category:
|
|
19
|
-
- **decision**: Architectural or design decisions
|
|
20
|
-
- **pattern**: Code patterns to follow
|
|
21
|
-
- **constraint**: Limitations or requirements
|
|
22
|
-
- **context**: Project-specific context
|
|
23
|
-
- **preference**: User preferences
|
|
24
|
-
</step>
|
|
25
|
-
|
|
26
|
-
<step name="store">
|
|
27
|
-
Add to appropriate memory tier:
|
|
28
|
-
|
|
29
|
-
1. **Working memory** (current session): `.ctx/memory/working/`
|
|
30
|
-
2. **Episodic memory** (cross-session): `.ctx/memory/episodic/`
|
|
31
|
-
3. **Semantic memory** (permanent): `.ctx/memory/semantic/`
|
|
32
|
-
|
|
33
|
-
For manual `/ctx:remember`, store in **episodic** by default.
|
|
34
|
-
|
|
35
|
-
Format:
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"id": "{uuid}",
|
|
39
|
-
"content": "{fact}",
|
|
40
|
-
"category": "{category}",
|
|
41
|
-
"timestamp": "{iso-8601}",
|
|
42
|
-
"source": "manual"
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
</step>
|
|
46
|
-
|
|
47
|
-
<step name="confirm">
|
|
48
|
-
```
|
|
49
|
-
## Fact Remembered
|
|
50
|
-
|
|
51
|
-
**ID:** {short-id}
|
|
52
|
-
**Category:** {category}
|
|
53
|
-
**Content:** {fact}
|
|
54
|
-
**Stored in:** Episodic memory
|
|
55
|
-
|
|
56
|
-
This fact will be available in future sessions.
|
|
57
|
-
To query: `/ctx:recall {keywords}`
|
|
58
|
-
To remove: `/ctx:forget {id}`
|
|
59
|
-
```
|
|
60
|
-
</step>
|
|
61
|
-
|
|
62
|
-
</process>
|
|
63
|
-
|
|
64
|
-
<success_criteria>
|
|
65
|
-
- [ ] Fact stored in memory
|
|
66
|
-
- [ ] ID assigned for retrieval
|
|
67
|
-
- [ ] Category determined
|
|
68
|
-
</success_criteria>
|
package/commands/resume.md
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ctx:resume
|
|
3
|
-
description: Resume from last checkpoint
|
|
4
|
-
args: "[checkpoint-id]"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<objective>
|
|
8
|
-
Resume work from a checkpoint. Restores context efficiently (~2-3k tokens instead of full reload).
|
|
9
|
-
</objective>
|
|
10
|
-
|
|
11
|
-
<process>
|
|
12
|
-
|
|
13
|
-
<step name="find_checkpoint">
|
|
14
|
-
If checkpoint-id provided:
|
|
15
|
-
Load `.ctx/checkpoints/{checkpoint-id}/`
|
|
16
|
-
|
|
17
|
-
If no checkpoint-id:
|
|
18
|
-
Load most recent checkpoint from `.ctx/checkpoints/`
|
|
19
|
-
|
|
20
|
-
If no checkpoints exist:
|
|
21
|
-
```
|
|
22
|
-
No checkpoints found.
|
|
23
|
-
|
|
24
|
-
**Options:**
|
|
25
|
-
- Start fresh with `/ctx:init`
|
|
26
|
-
- Check `.ctx/` exists
|
|
27
|
-
```
|
|
28
|
-
</step>
|
|
29
|
-
|
|
30
|
-
<step name="load_state">
|
|
31
|
-
Load checkpoint state:
|
|
32
|
-
|
|
33
|
-
1. **HANDOFF.md** - Read for context
|
|
34
|
-
2. **state.json** - Parse current state
|
|
35
|
-
3. **working-memory.json** - Load recent facts
|
|
36
|
-
4. **file-index.json** - Know relevant files
|
|
37
|
-
</step>
|
|
38
|
-
|
|
39
|
-
<step name="restore_context">
|
|
40
|
-
Build minimal context:
|
|
41
|
-
|
|
42
|
-
1. Load semantic memory (permanent facts)
|
|
43
|
-
2. Load recent episodic memory (relevant to phase)
|
|
44
|
-
3. Load working memory from checkpoint
|
|
45
|
-
4. Identify files to read (from file-index)
|
|
46
|
-
|
|
47
|
-
Target: ~2-3k tokens for full context restoration.
|
|
48
|
-
</step>
|
|
49
|
-
|
|
50
|
-
<step name="verify_sync">
|
|
51
|
-
Check for changes since checkpoint:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
git status
|
|
55
|
-
git log --oneline {checkpoint-commit}..HEAD
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
If changes found:
|
|
59
|
-
```
|
|
60
|
-
⚠ Changes detected since checkpoint:
|
|
61
|
-
- {files changed}
|
|
62
|
-
|
|
63
|
-
These will be incorporated into current state.
|
|
64
|
-
```
|
|
65
|
-
</step>
|
|
66
|
-
|
|
67
|
-
<step name="output">
|
|
68
|
-
```
|
|
69
|
-
## Session Resumed
|
|
70
|
-
|
|
71
|
-
**Checkpoint:** {id}
|
|
72
|
-
**Created:** {timestamp}
|
|
73
|
-
**Phase:** {phase name}
|
|
74
|
-
**Progress:** {percentage}%
|
|
75
|
-
|
|
76
|
-
**Context Restored:** ~{token count} tokens
|
|
77
|
-
|
|
78
|
-
**Where We Left Off:**
|
|
79
|
-
{handoff summary}
|
|
80
|
-
|
|
81
|
-
**Next Task:**
|
|
82
|
-
{next task from plan}
|
|
83
|
-
|
|
84
|
-
**Ready to continue.** Run `/ctx:do` to proceed.
|
|
85
|
-
```
|
|
86
|
-
</step>
|
|
87
|
-
|
|
88
|
-
</process>
|
|
89
|
-
|
|
90
|
-
<context_budget>
|
|
91
|
-
| Component | Tokens |
|
|
92
|
-
|-----------|--------|
|
|
93
|
-
| Semantic facts | ~1,000 |
|
|
94
|
-
| Recent decisions | ~500 |
|
|
95
|
-
| Patterns | ~300 |
|
|
96
|
-
| Task state | ~200 |
|
|
97
|
-
| File identifiers | ~500 |
|
|
98
|
-
| **Total** | **~2,500** |
|
|
99
|
-
|
|
100
|
-
vs. Naive reload: 50,000+ tokens
|
|
101
|
-
</context_budget>
|
|
102
|
-
|
|
103
|
-
<success_criteria>
|
|
104
|
-
- [ ] Checkpoint loaded correctly
|
|
105
|
-
- [ ] Context restored efficiently
|
|
106
|
-
- [ ] Sync with git verified
|
|
107
|
-
- [ ] Clear next steps provided
|
|
108
|
-
</success_criteria>
|