codexkit 1.0.3 → 1.0.5
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/.codex/.template-manifest.json +19 -18
- package/.codex/.version +1 -1
- package/.codex/agents/scout.toml +42 -1
- package/.codex/config.toml +24 -5
- package/.codex/mcp/README.md +28 -1
- package/.codex/mcp/context7.toml.example +22 -7
- package/.codex/mcp/exa.toml.example +33 -7
- package/.codex/memory/_templates/project.md +8 -0
- package/.codex/memory/_templates/session-context.md +8 -0
- package/.codex/memory/_templates/state.md +10 -0
- package/.codex/memory/_templates/tech-stack.md +9 -0
- package/.codex/memory/_templates/user.md +6 -0
- package/.codex/prompts/resume.md +6 -0
- package/.codex/prompts/search.md +78 -0
- package/.codex/scripts/audit_memory_hygiene.sh +65 -0
- package/.codex/scripts/build_startup_brief.sh +15 -0
- package/.codex/skills/compaction/SKILL.md +76 -125
- package/.codex/skills/context-management/SKILL.md +65 -55
- package/.codex/skills/session-management/SKILL.md +12 -5
- package/.template-manifest.json +19 -18
- package/CHANGELOG.md +26 -0
- package/README.md +2 -1
- package/bin/codexkit +3 -3
- package/bin/codexkit.js +87 -0
- package/install/install-global.sh +93 -52
- package/install/install-project.sh +211 -117
- package/install/validate.sh +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: compaction
|
|
3
3
|
description: >
|
|
4
|
-
Use when context is growing large during long-running tasks and needs
|
|
5
|
-
summarization to continue effectively. Covers compaction triggers, custom
|
|
6
|
-
session handoff, and context preservation strategies.
|
|
7
|
-
|
|
4
|
+
Use when context is growing large during long-running tasks and needs
|
|
5
|
+
summarization to continue effectively. Covers compaction triggers, custom
|
|
6
|
+
summarization patterns, session handoff, and context preservation strategies.
|
|
7
|
+
Uses Codex-native /compact command.
|
|
8
|
+
version: 2.0.0
|
|
8
9
|
tags: [context, workflow]
|
|
9
10
|
dependencies: []
|
|
10
11
|
---
|
|
@@ -19,7 +20,6 @@ dependencies: []
|
|
|
19
20
|
|
|
20
21
|
- Short sessions with low context usage where no compaction is needed.
|
|
21
22
|
|
|
22
|
-
|
|
23
23
|
## Overview
|
|
24
24
|
|
|
25
25
|
**Compaction = Summarization + Preservation + Continuity**
|
|
@@ -32,54 +32,53 @@ Long-running sessions accumulate context (tool outputs, code reads, exploration
|
|
|
32
32
|
|
|
33
33
|
| Context Usage | Status | Action |
|
|
34
34
|
| ------------- | ----------- | --------------------------------------------- |
|
|
35
|
-
| 0-50% |
|
|
36
|
-
| 50-70% |
|
|
37
|
-
| 70-85% |
|
|
38
|
-
| 85-95% |
|
|
39
|
-
| 95%+ |
|
|
35
|
+
| 0-50% | Normal | Work freely |
|
|
36
|
+
| 50-70% | Watch | Start compressing completed explorations |
|
|
37
|
+
| 70-85% | Compact | Actively compress; write summaries to durable files |
|
|
38
|
+
| 85-95% | Critical | Emergency compaction, prepare session handoff |
|
|
39
|
+
| 95%+ | Limit | Session handoff required |
|
|
40
40
|
|
|
41
41
|
### Monitoring
|
|
42
42
|
|
|
43
43
|
Pay attention to these signals:
|
|
44
44
|
|
|
45
|
-
- Completed phases accumulating without being
|
|
45
|
+
- Completed phases accumulating without being summarized
|
|
46
46
|
- Repeated file reads of the same content
|
|
47
47
|
- Large bash outputs from builds/tests
|
|
48
48
|
- Multiple exploration rounds without synthesis
|
|
49
49
|
|
|
50
50
|
## Compaction Strategies
|
|
51
51
|
|
|
52
|
-
### Strategy 1:
|
|
53
|
-
|
|
54
|
-
Compress completed conversation phases into dense summaries. This is the primary DCP instrument in the installed beta.
|
|
52
|
+
### Strategy 1: Codex-Native `/compact` (Preferred)
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
Compress completed conversation phases into dense summaries.
|
|
54
|
+
Use the built-in `/compact` command to summarize conversation history while preserving key context.
|
|
58
55
|
|
|
59
56
|
```
|
|
60
|
-
WHEN: A research phase is complete
|
|
61
|
-
DO:
|
|
62
|
-
topic: "Auth Research Complete",
|
|
63
|
-
content: {
|
|
64
|
-
startString: "unique text at phase start",
|
|
65
|
-
endString: "unique text at phase end",
|
|
66
|
-
summary: "Complete technical summary of findings..."
|
|
67
|
-
}
|
|
68
|
-
})
|
|
57
|
+
WHEN: A research or implementation phase is complete
|
|
58
|
+
DO: /compact focus on [completed phase topic]
|
|
69
59
|
```
|
|
70
60
|
|
|
71
|
-
|
|
61
|
+
The `/compact` command:
|
|
62
|
+
- Summarizes conversation history server-side
|
|
63
|
+
- Preserves key decisions and findings
|
|
64
|
+
- Frees context budget for new work
|
|
65
|
+
- Accepts an optional focus instruction to guide what it preserves
|
|
72
66
|
|
|
73
|
-
|
|
67
|
+
**Key principle**: Only compact CLOSED chapters. Never compact active work.
|
|
74
68
|
|
|
75
|
-
|
|
69
|
+
### Strategy 2: Manual Phase Summarization
|
|
70
|
+
|
|
71
|
+
When `/compact` is too broad, manually write a dense summary to a durable file before the context is lost.
|
|
76
72
|
|
|
77
73
|
```
|
|
78
|
-
WHEN:
|
|
79
|
-
DO:
|
|
74
|
+
WHEN: A research phase is complete and findings are clear
|
|
75
|
+
DO:
|
|
76
|
+
1. Write summary to `.codex/context/worklog.md` or `.codex/memory/research/`
|
|
77
|
+
2. Record key decisions in `.codex/context/decision-log.md`
|
|
78
|
+
3. The summarized content can now be safely forgotten by the session
|
|
80
79
|
```
|
|
81
80
|
|
|
82
|
-
**Key principle**:
|
|
81
|
+
**Key principle**: Persist durable findings to repo files before they leave the context window.
|
|
83
82
|
|
|
84
83
|
### Strategy 3: Session Handoff
|
|
85
84
|
|
|
@@ -88,10 +87,10 @@ When context is too large to compact further, hand off to a new session.
|
|
|
88
87
|
```
|
|
89
88
|
WHEN: Context > 85% and significant work remains
|
|
90
89
|
DO:
|
|
91
|
-
1.
|
|
92
|
-
2.
|
|
93
|
-
3.
|
|
94
|
-
4. Start new session with
|
|
90
|
+
1. Update `.codex/context/session-context.md` with exact stop point
|
|
91
|
+
2. Update `.codex/memory/project/state.md` with durable state
|
|
92
|
+
3. Append milestone to `.codex/context/worklog.md`
|
|
93
|
+
4. Start new session with `/prompts:resume`
|
|
95
94
|
```
|
|
96
95
|
|
|
97
96
|
## Compaction Decision Tree
|
|
@@ -100,8 +99,8 @@ DO:
|
|
|
100
99
|
Is context growing large?
|
|
101
100
|
├── NO → Continue working normally
|
|
102
101
|
└── YES → What type of content is consuming space?
|
|
103
|
-
├── Completed conversation phases →
|
|
104
|
-
├──
|
|
102
|
+
├── Completed conversation phases → /compact
|
|
103
|
+
├── Research findings not yet persisted → Write to memory/research/, then /compact
|
|
105
104
|
└── Everything is still relevant → SESSION HANDOFF
|
|
106
105
|
```
|
|
107
106
|
|
|
@@ -150,9 +149,9 @@ Is context growing large?
|
|
|
150
149
|
|
|
151
150
|
### Verification
|
|
152
151
|
|
|
153
|
-
- TypeScript:
|
|
154
|
-
- Tests:
|
|
155
|
-
- Lint:
|
|
152
|
+
- TypeScript: passing
|
|
153
|
+
- Tests: 12/12 passing
|
|
154
|
+
- Lint: no issues
|
|
156
155
|
|
|
157
156
|
### Remaining
|
|
158
157
|
|
|
@@ -187,131 +186,83 @@ Is context growing large?
|
|
|
187
186
|
|
|
188
187
|
- Added null check in middleware (src/auth/middleware.ts:42)
|
|
189
188
|
- Added token refresh attempt before rejecting (src/auth/refresh.ts)
|
|
190
|
-
- Added test for expired token scenario (src/auth
|
|
189
|
+
- Added test for expired token scenario (src/auth/tests/middleware.test.ts)
|
|
191
190
|
|
|
192
191
|
### Verification
|
|
193
192
|
|
|
194
|
-
- Tests:
|
|
195
|
-
- Manual:
|
|
193
|
+
- Tests: all passing including new test
|
|
194
|
+
- Manual: expired token now triggers refresh
|
|
196
195
|
```
|
|
197
196
|
|
|
198
197
|
## Session Handoff Protocol
|
|
199
198
|
|
|
200
199
|
When you must hand off to a new session:
|
|
201
200
|
|
|
202
|
-
### 1.
|
|
201
|
+
### 1. Persist Durable Findings
|
|
203
202
|
|
|
204
|
-
|
|
205
|
-
memory -
|
|
206
|
-
update({
|
|
207
|
-
file: "handoffs/YYYY-MM-DD-feature-name",
|
|
208
|
-
content: `# Session Handoff: [Feature Name]
|
|
203
|
+
Write key findings and decisions to the appropriate repo files:
|
|
209
204
|
|
|
210
|
-
|
|
211
|
-
|
|
205
|
+
- `.codex/context/session-context.md` — exact stop point and first next action
|
|
206
|
+
- `.codex/memory/project/state.md` — durable current state and blockers
|
|
207
|
+
- `.codex/context/worklog.md` — milestone summary
|
|
208
|
+
- `.codex/context/decision-log.md` — architecture/workflow decisions with rationale
|
|
209
|
+
- `.codex/memory/research/*.md` — deep investigation notes
|
|
212
210
|
|
|
213
|
-
|
|
214
|
-
[What was done, files changed, decisions made]
|
|
211
|
+
### 2. Create Handoff Summary
|
|
215
212
|
|
|
216
|
-
|
|
217
|
-
[Where things stand right now]
|
|
213
|
+
Use `/prompts:handoff` or write directly to `session-context.md`:
|
|
218
214
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
## Key Decisions
|
|
223
|
-
[Important choices made and why]
|
|
224
|
-
|
|
225
|
-
## Files Modified
|
|
226
|
-
[List of all files changed with brief description]
|
|
227
|
-
|
|
228
|
-
## Gotchas
|
|
229
|
-
[Things the next session should know]
|
|
230
|
-
`,
|
|
231
|
-
mode: "replace",
|
|
232
|
-
});
|
|
233
|
-
```
|
|
215
|
+
```markdown
|
|
216
|
+
## Resume: [task-id]
|
|
234
217
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
title: "Auth implementation approach",
|
|
241
|
-
narrative: "Chose JWT with Redis sessions because...",
|
|
242
|
-
facts: "JWT 15min expiry, Redis 24h TTL, bcrypt 12 rounds",
|
|
243
|
-
concepts: "authentication, sessions, tokens",
|
|
244
|
-
confidence: "high",
|
|
245
|
-
});
|
|
218
|
+
- Branch: [branch]
|
|
219
|
+
- Commit: [short hash]
|
|
220
|
+
- Stop point: [exact step in progress]
|
|
221
|
+
- First next action: [single best next action]
|
|
222
|
+
- Blockers: [none or short list]
|
|
246
223
|
```
|
|
247
224
|
|
|
248
225
|
### 3. Resume in New Session
|
|
249
226
|
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
memory - search({ query: "auth implementation" });
|
|
254
|
-
```
|
|
227
|
+
```bash
|
|
228
|
+
# Native Codex resume (thread-based):
|
|
229
|
+
codex resume
|
|
255
230
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
- **compress**: Phase-level conversation compression (primary DCP tool in the installed beta)
|
|
261
|
-
- **/dcp sweep**: Cleanup command for stale/noisy content after a phase is complete
|
|
262
|
-
- **Prunable-tools list**: Auto-injected into messages with token estimates
|
|
263
|
-
- **Nudge system**: Reminders every N tool calls + critical limit warnings
|
|
264
|
-
|
|
265
|
-
**Division of responsibility:**
|
|
266
|
-
|
|
267
|
-
- **DCP plugin**: Context budget rules, tool guidance, prunable-tools list, nudges (always present via system prompt)
|
|
268
|
-
- **Compaction workflow** (`.codex/context/session-context.md` + handoff/resume prompts): Session continuity, beads state, handoff recovery, post-compaction protocol
|
|
231
|
+
# Or file-based resume via Codexkit:
|
|
232
|
+
/prompts:resume [task-id]
|
|
233
|
+
```
|
|
269
234
|
|
|
270
235
|
## Anti-Patterns
|
|
271
236
|
|
|
272
|
-
###
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
// DON'T compress a file you're about to edit
|
|
276
|
-
compress({ ... }) // Loses exact line numbers you need
|
|
277
|
-
edit({ ... }) // Now you can't find the right location
|
|
278
|
-
```
|
|
237
|
+
### Premature Compaction
|
|
279
238
|
|
|
280
|
-
|
|
239
|
+
Don't compact a file you're about to edit — you'll lose exact line numbers. Keep raw content while actively editing. Compact AFTER the edit phase.
|
|
281
240
|
|
|
282
|
-
###
|
|
241
|
+
### Compacting Active Work
|
|
283
242
|
|
|
284
|
-
|
|
285
|
-
// DON'T compress a conversation phase you might return to
|
|
286
|
-
compress({ summary: "Explored auth options" })
|
|
287
|
-
// Later: "Wait, which options did we consider?"
|
|
288
|
-
```
|
|
243
|
+
Don't compact a conversation phase you might return to. Only compact CLOSED chapters where findings are crystallized.
|
|
289
244
|
|
|
290
|
-
|
|
245
|
+
### Ignoring Context Growth
|
|
291
246
|
|
|
292
|
-
|
|
247
|
+
Don't let context grow unchecked until hitting limits. By the time you notice, emergency compaction loses information. Monitor regularly and compact at natural breakpoints.
|
|
293
248
|
|
|
294
|
-
|
|
295
|
-
// DON'T let context grow unchecked until hitting limits
|
|
296
|
-
// By the time you notice, emergency compaction loses information
|
|
297
|
-
```
|
|
249
|
+
### Persisting Only to Session Memory
|
|
298
250
|
|
|
299
|
-
|
|
251
|
+
Don't rely on session history for durable findings. Write important decisions and state to repo-visible files before compacting, so they survive session boundaries.
|
|
300
252
|
|
|
301
253
|
## Checklist
|
|
302
254
|
|
|
303
255
|
Before compacting:
|
|
304
256
|
|
|
305
257
|
- [ ] Identified what type of content is consuming context
|
|
306
|
-
- [ ] Chosen appropriate strategy (
|
|
258
|
+
- [ ] Chosen appropriate strategy (/compact, manual summary, or handoff)
|
|
307
259
|
- [ ] Verified raw content is no longer needed for active work
|
|
308
|
-
- [ ]
|
|
309
|
-
- [ ] Saved important decisions as observations
|
|
260
|
+
- [ ] Persisted key findings to durable repo files
|
|
310
261
|
- [ ] Created handoff document if switching sessions
|
|
311
262
|
|
|
312
263
|
During long sessions:
|
|
313
264
|
|
|
314
|
-
- [ ]
|
|
315
|
-
- [ ]
|
|
265
|
+
- [ ] Running `/compact` at natural phase boundaries
|
|
266
|
+
- [ ] Writing durable findings to context/memory files before they leave the window
|
|
316
267
|
- [ ] Monitoring context usage trends
|
|
317
268
|
- [ ] Planning session handoff if approaching limits
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-management
|
|
3
|
-
description: Unified protocol for context health and session lifecycle management using
|
|
4
|
-
version:
|
|
3
|
+
description: Unified protocol for context health and session lifecycle management using Codex-native /compact, repo-visible memory files, thresholds, handoff, and resume workflows
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
tags: [context, workflow, session]
|
|
6
6
|
dependencies: []
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Context Management
|
|
10
10
|
|
|
11
|
-
>
|
|
11
|
+
> Unified protocol for context health across a session lifecycle using Codex-native primitives.
|
|
12
12
|
|
|
13
13
|
Use this skill to keep context useful from first turn to final handoff.
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ Use this skill to keep context useful from first turn to final handoff.
|
|
|
17
17
|
- Context size is growing and you need to reduce noise without losing critical details
|
|
18
18
|
- You are finishing a work phase and want to compress completed exploration/implementation
|
|
19
19
|
- You are preparing `/handoff` or resuming a prior session
|
|
20
|
-
- You need to recover relevant prior context
|
|
20
|
+
- You need to recover relevant prior context from repo files or session history
|
|
21
21
|
|
|
22
22
|
## When NOT to Use
|
|
23
23
|
|
|
@@ -29,61 +29,69 @@ Use this skill to keep context useful from first turn to final handoff.
|
|
|
29
29
|
Prefer **phase-level compression** over reactive cleanup.
|
|
30
30
|
|
|
31
31
|
```text
|
|
32
|
-
|
|
32
|
+
/compact > persist to files > handoff
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
- **
|
|
37
|
-
- **handoff**: Use when context pressure remains high even after
|
|
35
|
+
- **/compact**: Use the Codex-native command when a phase is complete
|
|
36
|
+
- **persist**: Write durable findings to repo files before they leave the context window
|
|
37
|
+
- **handoff**: Use when context pressure remains high even after compaction
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Codex-Native Compaction
|
|
40
40
|
|
|
41
|
-
### `/
|
|
41
|
+
### `/compact`
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
The built-in Codex CLI command that summarizes conversation history server-side.
|
|
44
|
+
|
|
45
|
+
Use for completed chapters of work (research, implementation wave, review sweep):
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
/compact focus on the authentication refactor
|
|
49
|
+
```
|
|
44
50
|
|
|
45
51
|
- Best for large ranges of now-stable outputs
|
|
46
52
|
- Lowest cognitive overhead on later turns
|
|
53
|
+
- Accepts optional focus instructions to guide what it preserves
|
|
47
54
|
- Usually lowest risk of deleting needed details
|
|
48
55
|
|
|
49
|
-
###
|
|
50
|
-
|
|
51
|
-
Use after a phase is complete to let DCP remove stale/noisy content automatically.
|
|
56
|
+
### `codex resume`
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
Resume a previous Codex session by thread ID:
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
```bash
|
|
61
|
+
codex resume
|
|
62
|
+
```
|
|
58
63
|
|
|
59
|
-
|
|
64
|
+
This restores the session transcript from `~/.codex/sessions/`. Useful for short interruptions where the full session context is still relevant.
|
|
60
65
|
|
|
61
66
|
## Session Lifecycle Protocol
|
|
62
67
|
|
|
63
68
|
### 1) Start Session
|
|
64
69
|
|
|
65
70
|
1. Load task spec and essential policy docs only
|
|
66
|
-
2.
|
|
67
|
-
|
|
68
|
-
- `
|
|
69
|
-
-
|
|
70
|
-
- `
|
|
71
|
+
2. Pull prior work only if needed:
|
|
72
|
+
- Read `.codex/context/session-context.md` for the last stop point
|
|
73
|
+
- Read `.codex/memory/project/state.md` for durable state
|
|
74
|
+
- Search repo memory: `bash .codex/scripts/memory_search.sh "query"`
|
|
75
|
+
- Use `codex resume` if continuing from the same thread
|
|
71
76
|
|
|
72
77
|
### 2) During Active Work
|
|
73
78
|
|
|
74
79
|
- Keep active files readable until edits are done
|
|
75
|
-
- At each natural boundary, evaluate
|
|
76
|
-
-
|
|
80
|
+
- At each natural boundary, evaluate `/compact` candidates
|
|
81
|
+
- Persist durable findings to repo files before compacting
|
|
77
82
|
|
|
78
83
|
### 3) Pre-Handoff / Closeout
|
|
79
84
|
|
|
80
|
-
1.
|
|
81
|
-
2. Persist key decisions/learnings to
|
|
82
|
-
|
|
85
|
+
1. Run `/compact` on completed phase ranges
|
|
86
|
+
2. Persist key decisions/learnings to durable repo files:
|
|
87
|
+
- `.codex/context/decision-log.md` for architecture decisions
|
|
88
|
+
- `.codex/context/worklog.md` for milestone trail
|
|
89
|
+
- `.codex/memory/project/state.md` for durable state
|
|
90
|
+
3. Create concise handoff in `.codex/context/session-context.md`
|
|
83
91
|
|
|
84
92
|
### 4) Resume Session
|
|
85
93
|
|
|
86
|
-
1. Rehydrate only relevant context (don
|
|
94
|
+
1. Rehydrate only relevant context (don't replay everything)
|
|
87
95
|
2. Validate assumptions against current files/git state
|
|
88
96
|
3. Continue with fresh context budget, not accumulated clutter
|
|
89
97
|
|
|
@@ -94,8 +102,8 @@ Use these thresholds as operational triggers:
|
|
|
94
102
|
| Threshold | Interpretation | Required Action |
|
|
95
103
|
| --- | --- | --- |
|
|
96
104
|
| <50k | Healthy start | Keep inputs minimal, avoid unnecessary reads |
|
|
97
|
-
| 50k
|
|
98
|
-
| >100k | High pressure | Aggressively
|
|
105
|
+
| 50k-100k | Moderate growth | `/compact` completed phases, keep active files intact |
|
|
106
|
+
| >100k | High pressure | Aggressively compact by phase; persist findings to repo files |
|
|
99
107
|
| >150k | Near capacity | Perform handoff and resume in a fresh session |
|
|
100
108
|
|
|
101
109
|
Secondary guardrails:
|
|
@@ -106,23 +114,25 @@ Secondary guardrails:
|
|
|
106
114
|
|
|
107
115
|
## Phase Boundary Triggers
|
|
108
116
|
|
|
109
|
-
|
|
117
|
+
Compact at these boundaries:
|
|
110
118
|
|
|
111
|
-
- Research complete
|
|
112
|
-
- Implementation wave complete
|
|
113
|
-
- Review complete
|
|
114
|
-
- Before `/handoff`
|
|
119
|
+
- Research complete -> persist findings to `memory/research/`, then `/compact`
|
|
120
|
+
- Implementation wave complete -> `/compact` completed read/edit/test cycles
|
|
121
|
+
- Review complete -> persist synthesized findings, `/compact` raw outputs
|
|
122
|
+
- Before `/handoff` -> compact everything non-essential since last checkpoint
|
|
115
123
|
|
|
116
|
-
Rule: **Completed phases should not remain
|
|
124
|
+
Rule: **Completed phases should not remain uncompacted for long.**
|
|
117
125
|
|
|
118
126
|
## Context Transfer Sources (Cross-Session)
|
|
119
127
|
|
|
120
128
|
Use in priority order:
|
|
121
129
|
|
|
122
|
-
1.
|
|
123
|
-
2.
|
|
124
|
-
3.
|
|
125
|
-
4.
|
|
130
|
+
1. Repo-visible files: `.codex/context/`, `.codex/memory/project/`, `.codex/memory/research/`
|
|
131
|
+
2. Local retrieval: `bash .codex/scripts/memory_search.sh "query"`
|
|
132
|
+
3. Codex session history: `codex resume` for thread-based recall
|
|
133
|
+
4. Task tracker state: `br show <id>` when applicable
|
|
134
|
+
5. Git evidence: `git diff`, `git log`, test output
|
|
135
|
+
6. Optional MCP memory: only when repo docs are insufficient (requires MCP setup)
|
|
126
136
|
|
|
127
137
|
Carry forward decisions and constraints, not every intermediate log.
|
|
128
138
|
|
|
@@ -130,31 +140,31 @@ Carry forward decisions and constraints, not every intermediate log.
|
|
|
130
140
|
|
|
131
141
|
| Anti-Pattern | Why It Hurts | Correct Pattern |
|
|
132
142
|
| --- | --- | --- |
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
143
|
+
| Compacting active work areas | Removes exact lines needed for safe edits | Keep active file/tool outputs until edit + verification complete |
|
|
144
|
+
| Not compacting completed phases | Bloats context and degrades later turns | `/compact` immediately at phase completion |
|
|
145
|
+
| Session handoff without persisting to repo files | Next session loses rationale and constraints | Write to decision-log, state, worklog before handoff |
|
|
146
|
+
| Relying only on session memory for durable facts | Facts are lost when session ends | Persist to `.codex/context/` or `.codex/memory/` |
|
|
137
147
|
|
|
138
148
|
## Verification
|
|
139
149
|
|
|
140
|
-
Check context health: are completed phases
|
|
150
|
+
Check context health: are completed phases compacted? Are active files still readable?
|
|
141
151
|
|
|
142
152
|
Before claiming cleanup done, confirm:
|
|
143
153
|
|
|
144
154
|
- Active edit targets are still present in readable form
|
|
145
|
-
- Completed phases are
|
|
146
|
-
- No critical decision exists only in transient
|
|
147
|
-
- Handoff includes next actions and blockers
|
|
155
|
+
- Completed phases are compacted or intentionally kept for active work
|
|
156
|
+
- No critical decision exists only in transient session output
|
|
157
|
+
- Handoff includes next actions and blockers in repo-visible files
|
|
148
158
|
|
|
149
159
|
## Quick Playbook
|
|
150
160
|
|
|
151
161
|
```text
|
|
152
|
-
1) Start
|
|
162
|
+
1) Start: read session-context.md + state.md
|
|
153
163
|
2) Identify completed phase ranges
|
|
154
|
-
3)
|
|
155
|
-
4) /
|
|
156
|
-
5)
|
|
157
|
-
6)
|
|
164
|
+
3) Persist durable findings to repo files
|
|
165
|
+
4) /compact completed ranges
|
|
166
|
+
5) At session end: update session-context.md, state.md, worklog.md
|
|
167
|
+
6) Resume: /prompts:resume or codex resume
|
|
158
168
|
```
|
|
159
169
|
|
|
160
170
|
## See Also
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: session-management
|
|
3
|
-
description: "
|
|
3
|
+
description: "Deprecated: merged into context-management. Load $context-management instead."
|
|
4
|
+
deprecated: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Session Management
|
|
7
|
+
# Session Management (Deprecated)
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
This skill has been merged into `$context-management` which now covers both context health and session lifecycle management.
|
|
10
|
+
|
|
11
|
+
**Load `$context-management` instead.**
|
|
12
|
+
|
|
13
|
+
The merged skill covers:
|
|
14
|
+
- Session start, pause, resume lifecycle
|
|
15
|
+
- Context budget thresholds and `/compact` usage
|
|
16
|
+
- Handoff/resume protocol with repo-visible files
|
|
17
|
+
- Cross-session context transfer strategies
|