@deltafleet/codex-goalkeeper 0.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.
@@ -0,0 +1,77 @@
1
+ # Roadmap
2
+
3
+ ## Product Thesis
4
+
5
+ Long-running Codex goals need a small continuity layer outside the model context.
6
+
7
+ Goalkeeper should stay boring: a short checkpoint, a medium-density context pack, an append-only event log, a turn-start helper, and a doctor check. It should not become a substitute context engine or a promise of perfect post-compact recovery.
8
+
9
+ ## MVP
10
+
11
+ Ship a root-level Codex skill that manages project-local state:
12
+
13
+ ```text
14
+ .goalkeeper/
15
+ active-session
16
+ sessions/
17
+ <goal-session-id>/
18
+ checkpoint.md
19
+ context-pack.md
20
+ events.jsonl
21
+ ```
22
+
23
+ Core behavior:
24
+
25
+ - initialize a Goalkeeper session for a long-running goal
26
+ - read the active checkpoint first after resume or suspected compaction
27
+ - read the context pack when the checkpoint is too thin to recover pre-compaction reasoning
28
+ - append meaningful decisions, failures, verification, and handoff events
29
+ - refresh the checkpoint when recoverable working state changes
30
+ - run a read-only doctor before trusting a workspace for long work
31
+
32
+ ## User-Facing Scope
33
+
34
+ Keep these scripts central:
35
+
36
+ - `goalkeeper-init.mjs`
37
+ - `goalkeeper-turn-start.mjs`
38
+ - `goalkeeper-append-event.mjs`
39
+ - `goalkeeper-update-checkpoint.mjs`
40
+ - `goalkeeper-doctor.mjs`
41
+
42
+ Keep this optional and maintainer-oriented:
43
+
44
+ - `test-goalkeeper-update-checkpoint.mjs`
45
+
46
+ ## Non-Goals
47
+
48
+ - no MCP server in the MVP
49
+ - no Codex plugin packaging in the MVP
50
+ - no SQLite or global database
51
+ - no background daemon
52
+ - no prompt-assembly hook
53
+ - no Codex session rewriting
54
+ - no claim of 100 percent compact recovery
55
+
56
+ ## Good Enough Release Bar
57
+
58
+ - `npx skills add . --list` discovers exactly one skill named `codex-goalkeeper`
59
+ - the skill body is concise enough to load routinely
60
+ - README explains the simple workflow clearly
61
+ - multilingual READMEs keep the same public workflow in Korean, Japanese, and Chinese
62
+ - examples parse as valid JSONL
63
+ - script syntax checks pass
64
+ - checkpoint update helper test passes
65
+ - doctor passes against this repo's live Goalkeeper state
66
+
67
+ ## Later, Only If Needed
68
+
69
+ Possible future additions should be justified by real usage:
70
+
71
+ - a tiny CLI wrapper around the existing scripts
72
+ - event search helper
73
+ - checkpoint compaction helper
74
+ - optional MCP ergonomics
75
+ - cross-workspace indexing
76
+
77
+ These should not change the source of truth: project-local `.goalkeeper/` files.
@@ -0,0 +1,58 @@
1
+ # Goalkeeper Checkpoint
2
+
3
+ ## Active Goal
4
+
5
+ - Objective: Ship a long-running Codex feature without losing direction after repeated compaction.
6
+ - Done criteria: The implementation, tests, documentation, and handoff are complete; no known blocker remains untracked.
7
+ - Current status: Example state for Codex Goalkeeper.
8
+
9
+ ## Throughline
10
+
11
+ - Current direction: Preserve the user's intent, constraints, major decisions, verification state, and next action in a short project-local checkpoint.
12
+ - Why this direction: Codex's active goal describes the destination, but repeated compaction can blur the decision chain that explains how to keep moving.
13
+
14
+ ## Constraints
15
+
16
+ - Non-negotiable: Read this checkpoint before resuming after compaction or handoff.
17
+ - Non-negotiable: Append important evidence to `events.jsonl` before updating this checkpoint.
18
+ - Forbidden approaches: Treating memory as exact proof when the event log or source files are needed.
19
+
20
+ ## Decisions
21
+
22
+ - Runtime state lives under `.goalkeeper/sessions/<goal-session-id>/`.
23
+ - The checkpoint stays concise and current.
24
+ - The event log keeps append-only evidence.
25
+
26
+ ## Attempts And Failures
27
+
28
+ - Avoid writing full transcripts into the checkpoint; it becomes too long to read routinely.
29
+ - Avoid relying only on the active Codex goal; it does not preserve enough decision context.
30
+
31
+ ## Important Files
32
+
33
+ - `SKILL.md`
34
+ - `.goalkeeper/sessions/<goal-session-id>/checkpoint.md`
35
+ - `.goalkeeper/sessions/<goal-session-id>/context-pack.md`
36
+ - `.goalkeeper/sessions/<goal-session-id>/events.jsonl`
37
+
38
+ ## Context Pack
39
+
40
+ - `examples/goalkeeper-session/context-pack.md`
41
+
42
+ ## Verification
43
+
44
+ - Verified: This is a static example, not a live project verification result.
45
+ - Not yet verified: Replace this section with real command/test evidence during actual work.
46
+
47
+ ## Open Risks
48
+
49
+ - Agents may skip reading the checkpoint unless the skill makes the recovery ritual explicit.
50
+ - Checkpoints can become stale if not updated at meaningful transitions.
51
+
52
+ ## Next Action
53
+
54
+ - Read recent events when this checkpoint is insufficient, then continue from the stated next action.
55
+
56
+ ## Last Updated
57
+
58
+ - 2026-05-17
@@ -0,0 +1,39 @@
1
+ # Goalkeeper Context Pack
2
+
3
+ ## Purpose
4
+
5
+ This example context pack keeps reasoning that is too detailed for the checkpoint but useful after compaction.
6
+
7
+ ## Active Goal
8
+
9
+ Ship a long-running Codex feature without losing direction after repeated compaction.
10
+
11
+ ## Durable Constraints
12
+
13
+ - Read the checkpoint before resuming after compaction or handoff.
14
+ - Append important evidence to `events.jsonl` before updating the checkpoint.
15
+
16
+ ## Working Model
17
+
18
+ - `checkpoint.md` is the small turn-start recovery note.
19
+ - `context-pack.md` carries the larger reasoning chain.
20
+ - `events.jsonl` is the append-only evidence trail.
21
+
22
+ ## Decision Chain
23
+
24
+ - Keep state project-local so it travels with the workspace.
25
+ - Keep checkpoint short so agents actually read it.
26
+ - Use the context pack only when the checkpoint is too thin.
27
+
28
+ ## Rejected Alternatives
29
+
30
+ - Full transcript storage in the checkpoint.
31
+ - Treating Codex goal metadata as enough for long-running work.
32
+
33
+ ## Open Threads
34
+
35
+ - In a real project, replace this example with the actual codebase model and unresolved questions.
36
+
37
+ ## Evidence Index
38
+
39
+ - `examples/goalkeeper-session/events.jsonl`
@@ -0,0 +1,5 @@
1
+ {"ts":"2026-05-17T00:00:00Z","type":"goal","text":"Ship a long-running Codex feature without losing direction after repeated compaction.","status":"open"}
2
+ {"ts":"2026-05-17T00:01:00Z","type":"user_constraint","text":"The agent must read checkpoint.md before resuming after compaction."}
3
+ {"ts":"2026-05-17T00:02:00Z","type":"decision","text":"Use .goalkeeper/sessions/<goal-session-id>/ for runtime state.","reason":"Separates multiple long-running goals within one project while keeping state local to the workspace."}
4
+ {"ts":"2026-05-17T00:03:00Z","type":"failure","text":"Do not store full conversation summaries in checkpoint.md.","reason":"Long checkpoints defeat routine recovery because agents stop reading them carefully."}
5
+ {"ts":"2026-05-17T00:04:00Z","type":"next_action","text":"Use the checkpoint to recover direction, then inspect event evidence only when exact details are needed.","status":"open"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@deltafleet/codex-goalkeeper",
3
+ "version": "0.1.0",
4
+ "description": "A small Codex skill for keeping long-running goals oriented across compaction, resumes, and handoffs.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://github.com/deltafleet/codex-goalkeeper#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deltafleet/codex-goalkeeper.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/deltafleet/codex-goalkeeper/issues"
14
+ },
15
+ "keywords": [
16
+ "codex",
17
+ "codex-skill",
18
+ "ai-agents",
19
+ "context",
20
+ "compaction",
21
+ "checkpoint",
22
+ "goal"
23
+ ],
24
+ "bin": {
25
+ "codex-goalkeeper-init": "src/scripts/goalkeeper-init.mjs",
26
+ "codex-goalkeeper-turn-start": "src/scripts/goalkeeper-turn-start.mjs",
27
+ "codex-goalkeeper-append-event": "src/scripts/goalkeeper-append-event.mjs",
28
+ "codex-goalkeeper-update-checkpoint": "src/scripts/goalkeeper-update-checkpoint.mjs",
29
+ "codex-goalkeeper-doctor": "src/scripts/goalkeeper-doctor.mjs"
30
+ },
31
+ "files": [
32
+ "SKILL.md",
33
+ "agents",
34
+ "src",
35
+ "examples",
36
+ "docs",
37
+ "README.md",
38
+ "README.ko.md",
39
+ "README.ja.md",
40
+ "README.zh-CN.md",
41
+ "LICENSE",
42
+ "CHANGELOG.md",
43
+ "CONTRIBUTING.md",
44
+ "SECURITY.md",
45
+ "CODE_OF_CONDUCT.md"
46
+ ],
47
+ "scripts": {
48
+ "check:scripts": "find src/scripts -name '*.mjs' -print0 | xargs -0 -n1 node --check",
49
+ "test": "node src/scripts/test-goalkeeper-update-checkpoint.mjs",
50
+ "validate:skill": "npx skills add . --list",
51
+ "validate:examples": "find examples -name '*.jsonl' -print0 | xargs -0 -n1 jq -c . >/dev/null",
52
+ "validate": "npm run check:scripts && npm test && npm run validate:examples && npm run validate:skill"
53
+ },
54
+ "engines": {
55
+ "node": ">=18"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ }
60
+ }
@@ -0,0 +1,63 @@
1
+ # Event Schema
2
+
3
+ Events are newline-delimited JSON records in the current goal session's `events.jsonl`.
4
+
5
+ Default path:
6
+
7
+ ```text
8
+ <workspace>/.goalkeeper/sessions/<goal-session-id>/events.jsonl
9
+ ```
10
+
11
+ Prefer the append helper when available:
12
+
13
+ ```bash
14
+ node <skill-path>/src/scripts/goalkeeper-append-event.mjs --workspace <workspace> --session <goal-session-id> --type decision --text "<summary>"
15
+ ```
16
+
17
+ When `<workspace>/.goalkeeper/active-session` points to the current session, `--session` may be omitted. The helper validates existing JSONL schema before writing and reports the appended line number.
18
+
19
+ ## Required Fields
20
+
21
+ ```json
22
+ {"ts":"2026-05-17T00:00:00Z","type":"decision","text":"Use skill-only continuity files before adding optional MCP automation."}
23
+ ```
24
+
25
+ - `ts`: ISO timestamp.
26
+ - `type`: event type.
27
+ - `text`: concise event summary.
28
+
29
+ ## Optional Fields
30
+
31
+ - `goal`: active goal identifier or short title.
32
+ - `reason`: why the event matters.
33
+ - `evidence`: short supporting detail.
34
+ - `files`: array of file paths.
35
+ - `commands`: array of commands.
36
+ - `status`: `open`, `done`, `failed`, `blocked`, or `superseded`.
37
+ - `supersedes`: event id or short reference.
38
+
39
+ ## Initial Types
40
+
41
+ - `goal`: objective or done criteria changed.
42
+ - `user_constraint`: user gave a durable constraint or forbidden path.
43
+ - `decision`: direction-setting choice.
44
+ - `attempt`: meaningful path tried.
45
+ - `failure`: path failed or should not be repeated.
46
+ - `edit`: important file or artifact changed.
47
+ - `command`: command result worth preserving.
48
+ - `verification`: verification evidence.
49
+ - `risk`: unresolved risk or blocker.
50
+ - `handoff`: current state prepared for resume.
51
+ - `next_action`: explicit next step.
52
+ - `compact_observed`: a real Codex compaction boundary was observed.
53
+ - `recovery_violation`: the agent continued after compaction or resume before reading the Goalkeeper checkpoint.
54
+
55
+ ## Writing Rules
56
+
57
+ - Keep records one line each.
58
+ - Prefer `goalkeeper-append-event.mjs` over manual edits for routine event writes.
59
+ - Expect `goalkeeper-doctor.mjs` to fail if event type, timestamp, text, status, files, or commands violate this schema.
60
+ - Prefer exact paths and commands when they matter.
61
+ - Do not paste large output. Summarize and link to artifact paths.
62
+ - Use `failure` only when the result should influence future behavior.
63
+ - Use `verification` only when the result changes confidence.
@@ -0,0 +1,62 @@
1
+ # Goalkeeper Guardrail
2
+
3
+ The skill body is not enough to guarantee checkpoint-first behavior after compaction. Codex may resume from a compacted summary without the model noticing the exact session-log marker.
4
+
5
+ For high-stakes long-running work, add the AGENTS guardrail template to the target workspace:
6
+
7
+ ```text
8
+ src/templates/AGENTS.goalkeeper.md
9
+ ```
10
+
11
+ Use it in one of these ways:
12
+
13
+ - Copy the whole template into the target repository's `AGENTS.md`.
14
+ - Merge the checkpoint-first section into an existing `AGENTS.md`.
15
+ - Keep the template as project documentation and explicitly ask Codex to follow it before starting a long goal.
16
+
17
+ The guardrail is still skill-first. It does not require a plugin, MCP server, database, or private Codex runtime hook. It uses a surface Codex already honors: repository instructions.
18
+
19
+ ## Why This Matters
20
+
21
+ Compacted or resumed sessions can restart from a thin summary. The practical fix is to move the checkpoint-first rule into an always-on project instruction for workspaces that opt in.
22
+
23
+ ## Minimum Rule
24
+
25
+ For an active Goalkeeper-managed goal:
26
+
27
+ 1. Read `.goalkeeper/sessions/<goal-session-id>/checkpoint.md` before normal project files.
28
+ 2. Use `context-pack.md` when the checkpoint is too thin to recover the reasoning chain.
29
+ 3. Use `events.jsonl` only when exact evidence is needed.
30
+ 4. Append `recovery_violation` if the agent continued after compaction or resume before reading the checkpoint.
31
+
32
+ If `src/scripts/goalkeeper-turn-start.mjs` is present, it can be used as the first recovery action:
33
+
34
+ ```bash
35
+ node src/scripts/goalkeeper-turn-start.mjs --session <goal-session-id>
36
+ ```
37
+
38
+ If `.goalkeeper/active-session` contains the current session id, this shorter form is valid:
39
+
40
+ ```bash
41
+ node src/scripts/goalkeeper-turn-start.mjs
42
+ ```
43
+
44
+ If the helper is being run from an installed skill package rather than from the target repository, pass the target workspace explicitly:
45
+
46
+ ```bash
47
+ node <skill-path>/src/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id>
48
+ ```
49
+
50
+ Add `--context` when the medium-density context pack is needed:
51
+
52
+ ```bash
53
+ node <skill-path>/src/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id> --context
54
+ ```
55
+
56
+ Before starting a high-stakes long run, use the read-only doctor to verify the target workspace has the required state and guardrail:
57
+
58
+ ```bash
59
+ node <skill-path>/src/scripts/goalkeeper-doctor.mjs --workspace <workspace> --session <goal-session-id> --strict
60
+ ```
61
+
62
+ Parallel calls are still subject to checkpoint-first ordering. It is acceptable to batch `pwd`, `.goalkeeper/sessions` discovery, and `goalkeeper-turn-start.mjs`; it is not acceptable to include normal project files or verification in that same first post-compact parallel call.
@@ -0,0 +1,187 @@
1
+ # Workflow
2
+
3
+ ## Start
4
+
5
+ When a user starts a long-running goal:
6
+
7
+ 1. Confirm the active objective from the user request or Codex goal state.
8
+ 2. Choose a stable goal session id.
9
+ 3. Create `.goalkeeper/sessions/<goal-session-id>/checkpoint.md` if missing.
10
+ 4. Create `.goalkeeper/sessions/<goal-session-id>/context-pack.md` if missing.
11
+ 5. Create `.goalkeeper/sessions/<goal-session-id>/events.jsonl` if missing.
12
+ 6. Write `.goalkeeper/active-session` when this is the current Goalkeeper session for the workspace.
13
+ 7. Append a `goal` event.
14
+ 8. Record any explicit user constraints as `user_constraint` events.
15
+ 9. Write the initial checkpoint and seed context pack.
16
+
17
+ Use the init helper when available:
18
+
19
+ ```bash
20
+ node <skill-path>/src/scripts/goalkeeper-init.mjs --workspace <workspace> --session <goal-session-id> --goal "<active goal>"
21
+ ```
22
+
23
+ Pass repeated `--constraint "<text>"` flags for known durable constraints. The helper refuses to overwrite an existing session unless `--force` is explicitly provided.
24
+ By default, it updates `.goalkeeper/active-session`; pass `--no-activate` when creating a non-current session.
25
+
26
+ ## Continue
27
+
28
+ During normal work:
29
+
30
+ - Append `decision` events for direction-setting choices.
31
+ - Append `attempt` events for meaningful implementation or investigation paths.
32
+ - Append `failure` events when a path should not be repeated without new evidence.
33
+ - Append `command` or `verification` events for commands whose output changes confidence.
34
+ - Append `risk` events for unresolved issues.
35
+ - Keep `checkpoint.md` aligned with the current state.
36
+
37
+ Use the append helper for routine event writes:
38
+
39
+ ```bash
40
+ node <skill-path>/src/scripts/goalkeeper-append-event.mjs --workspace <workspace> --session <goal-session-id> --type verification --text "<summary>"
41
+ ```
42
+
43
+ If `.goalkeeper/active-session` points to the target session, `--session` may be omitted. The helper reports the appended JSONL line number so later checkpoint evidence can cite the event precisely.
44
+
45
+ When the event changes the recoverable working state, refresh the checkpoint in the same working segment:
46
+
47
+ ```bash
48
+ node <skill-path>/src/scripts/goalkeeper-update-checkpoint.mjs \
49
+ --workspace <workspace> \
50
+ --session <goal-session-id> \
51
+ --goal "<active goal>" \
52
+ --done "<done criteria>" \
53
+ --status "<current status>" \
54
+ --throughline "<current direction>" \
55
+ --constraint "<durable constraint>" \
56
+ --decision "<current decision>" \
57
+ --verified "<trusted verification>" \
58
+ --risk "<open risk>" \
59
+ --next "<exact next action>"
60
+ ```
61
+
62
+ If `.goalkeeper/active-session` points to the target session, `--session` may be omitted. The helper rewrites only `checkpoint.md` and refuses to write over the configured size budget, so long-running sessions do not silently turn the checkpoint into a transcript.
63
+
64
+ Use `context-pack.md` for medium-density reasoning that should survive compaction but should not be read on every turn. Update it at major design or implementation boundaries:
65
+
66
+ - decision chain
67
+ - rejected alternatives
68
+ - open threads
69
+ - domain or codebase model
70
+ - evidence index
71
+
72
+ ## Start of Each Turn
73
+
74
+ For an already active Goalkeeper-managed task, begin each new assistant turn with a checkpoint-first recovery read before touching normal project files.
75
+
76
+ Recommended sequence:
77
+
78
+ ```bash
79
+ pwd
80
+ find .goalkeeper/sessions -maxdepth 2 -name checkpoint.md
81
+ sed -n '1,220p' .goalkeeper/sessions/<goal-session-id>/checkpoint.md
82
+ ```
83
+
84
+ If the turn-start helper is available, use it instead of manually reading the checkpoint:
85
+
86
+ ```bash
87
+ node <skill-path>/src/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id>
88
+ ```
89
+
90
+ If `.goalkeeper/active-session` points to the correct session id, omit `--session`:
91
+
92
+ ```bash
93
+ node <skill-path>/src/scripts/goalkeeper-turn-start.mjs --workspace <workspace>
94
+ ```
95
+
96
+ If checkpoint recovery is too thin, include the context pack:
97
+
98
+ ```bash
99
+ node <skill-path>/src/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --context
100
+ ```
101
+
102
+ ## Resume After Compaction
103
+
104
+ When the conversation appears compacted or the agent is resuming after a long gap:
105
+
106
+ 1. Read `checkpoint.md`.
107
+ 2. Read `context-pack.md` if the checkpoint does not explain why the current direction exists.
108
+ 3. Read recent `events.jsonl` entries if exact prior evidence is needed.
109
+ 4. Search `events.jsonl` for a topic if exact prior evidence is needed.
110
+ 5. Do not proceed from memory alone when the checkpoint says a risk or constraint is open.
111
+
112
+ ### Recovery Guardrail
113
+
114
+ After resume or suspected compaction, the first project-state action should be reading the active Goalkeeper checkpoint.
115
+
116
+ Allowed before the checkpoint read:
117
+
118
+ - determine `pwd`
119
+ - list `.goalkeeper/sessions/`
120
+ - inspect filenames only when needed to choose the active session id
121
+ - run `goalkeeper-turn-start.mjs --session <goal-session-id>` or `goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id>`
122
+
123
+ Not allowed before the checkpoint read:
124
+
125
+ - sending a user-visible progress, status, or direction message based on memory
126
+ - reading `README.md`, `docs/`, `src/`, examples, tests, or other project files
127
+ - editing files
128
+ - running verification commands that depend on recovered state
129
+ - relying on the compacted summary as the source of current direction
130
+
131
+ If an agent violates this order, append a `recovery_violation` event, read the checkpoint immediately, and continue only after reconciling the current action with the checkpoint.
132
+
133
+ Before relying on a workspace for a long run, run the read-only doctor:
134
+
135
+ ```bash
136
+ node <skill-path>/src/scripts/goalkeeper-doctor.mjs --workspace <workspace> --session <goal-session-id> --strict
137
+ ```
138
+
139
+ ## Goal Session Directory
140
+
141
+ The goal session directory is project-local, not global:
142
+
143
+ ```text
144
+ <workspace>/.goalkeeper/sessions/<goal-session-id>/
145
+ ```
146
+
147
+ Use one directory per long-running Codex goal session. A compacted conversation, resumed thread, or handoff should keep using the same directory when the underlying goal is the same.
148
+
149
+ Suggested id format:
150
+
151
+ ```text
152
+ YYYY-MM-DD-short-goal-slug
153
+ ```
154
+
155
+ Example:
156
+
157
+ ```text
158
+ .goalkeeper/sessions/2026-05-17-codex-goalkeeper-roadmap/
159
+ ```
160
+
161
+ ## Handoff
162
+
163
+ Before ending a long working segment:
164
+
165
+ 1. Append a `handoff` event.
166
+ 2. Update `checkpoint.md` with the current state and exact next action.
167
+ 3. Include unresolved risks and verification gaps.
168
+
169
+ ## Checkpoint Update Guidance
170
+
171
+ Update the checkpoint after a meaningful state transition, not after every minor tool call.
172
+
173
+ Good checkpoint updates:
174
+
175
+ - A user changes scope.
176
+ - A design route is chosen.
177
+ - A blocker is discovered.
178
+ - A test result proves or disproves the current direction.
179
+ - Implementation reaches a stable boundary.
180
+ - The next action changes.
181
+
182
+ Bad checkpoint updates:
183
+
184
+ - Repeating the same status after every file read.
185
+ - Copying long command output into the checkpoint.
186
+ - Adding uncertain claims without evidence.
187
+ - Refreshing the checkpoint without first appending the event that explains why the state changed.