@deltafleet/goalkeeper 0.2.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,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 agent 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 host-agent 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 agent 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,65 @@
1
+ {
2
+ "name": "@deltafleet/goalkeeper",
3
+ "version": "0.2.0",
4
+ "description": "A small Agent Skill for keeping long-running goals oriented across compaction, resumes, and handoffs.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://github.com/deltafleet/goalkeeper#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deltafleet/goalkeeper.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/deltafleet/goalkeeper/issues"
14
+ },
15
+ "keywords": [
16
+ "agent-skills",
17
+ "claude-code",
18
+ "claude-skill",
19
+ "codex",
20
+ "ai-agents",
21
+ "context",
22
+ "compaction",
23
+ "checkpoint",
24
+ "goal"
25
+ ],
26
+ "bin": {
27
+ "goalkeeper-init": "src/goalkeeper/scripts/goalkeeper-init.mjs",
28
+ "goalkeeper-turn-start": "src/goalkeeper/scripts/goalkeeper-turn-start.mjs",
29
+ "goalkeeper-append-event": "src/goalkeeper/scripts/goalkeeper-append-event.mjs",
30
+ "goalkeeper-update-checkpoint": "src/goalkeeper/scripts/goalkeeper-update-checkpoint.mjs",
31
+ "goalkeeper-doctor": "src/goalkeeper/scripts/goalkeeper-doctor.mjs",
32
+ "codex-goalkeeper-init": "src/goalkeeper/scripts/goalkeeper-init.mjs",
33
+ "codex-goalkeeper-turn-start": "src/goalkeeper/scripts/goalkeeper-turn-start.mjs",
34
+ "codex-goalkeeper-append-event": "src/goalkeeper/scripts/goalkeeper-append-event.mjs",
35
+ "codex-goalkeeper-update-checkpoint": "src/goalkeeper/scripts/goalkeeper-update-checkpoint.mjs",
36
+ "codex-goalkeeper-doctor": "src/goalkeeper/scripts/goalkeeper-doctor.mjs"
37
+ },
38
+ "files": [
39
+ "src/goalkeeper",
40
+ "examples",
41
+ "docs",
42
+ "README.md",
43
+ "README.ko.md",
44
+ "README.ja.md",
45
+ "README.zh-CN.md",
46
+ "LICENSE",
47
+ "CHANGELOG.md",
48
+ "CONTRIBUTING.md",
49
+ "SECURITY.md",
50
+ "CODE_OF_CONDUCT.md"
51
+ ],
52
+ "scripts": {
53
+ "check:scripts": "find src/goalkeeper/scripts tests -name '*.mjs' -print0 | xargs -0 -n1 node --check",
54
+ "test": "node tests/test-goalkeeper-update-checkpoint.mjs",
55
+ "validate:skill": "npx skills add . --list",
56
+ "validate:examples": "find examples -name '*.jsonl' -print0 | xargs -0 -n1 jq -c . >/dev/null",
57
+ "validate": "npm run check:scripts && npm test && npm run validate:examples && npm run validate:skill"
58
+ },
59
+ "engines": {
60
+ "node": ">=18"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ }
65
+ }
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: goalkeeper
3
+ description: Use automatically for Claude Code /goal, Codex /goal, long-running agent goals, multi-turn implementations, session resumes, handoffs, compacted conversations, or any task where an AI coding agent must preserve constraints, decisions, verification state, failed attempts, pre-compaction reasoning, and next actions. Maintains a project-local checkpoint, context pack, and append-only event log.
4
+ ---
5
+
6
+ # Goalkeeper
7
+
8
+ Use this skill when an AI coding agent task is expected to run long enough that compaction, handoff, or drift could cause the agent to lose direction.
9
+
10
+ Goalkeeper does not replace the host agent's goal system. It records the working continuity around the goal.
11
+
12
+ Goalkeeper is a best-effort continuity habit, not a guarantee that every compacted turn will recover perfectly.
13
+
14
+ When a user starts or continues a `/goal` in Claude Code, Codex, or another skill-compatible agent, strongly prefer initializing or resuming Goalkeeper unless the task is clearly short-lived.
15
+
16
+ ## First Action Rule
17
+
18
+ When a Goalkeeper-managed goal is already active, the first project-state action in a new assistant turn should be reading the active checkpoint, unless you have already read it in the same turn.
19
+
20
+ This is stricter than waiting until you notice compaction. A compacted turn may not reliably expose the compaction marker to the model, so checkpoint-first is the practical recovery rule for long-running goals.
21
+
22
+ Allowed before the checkpoint read:
23
+
24
+ - `pwd`
25
+ - listing `.goalkeeper/sessions/`
26
+ - minimal filename inspection to choose the active Goalkeeper session id
27
+
28
+ Do not send a user-visible progress or direction message before the checkpoint read.
29
+ Do not read project docs, source files, examples, tests, or make edits before the checkpoint read.
30
+ Do not combine the checkpoint read with other post-recovery work in the same shell command or parallel tool batch.
31
+
32
+ ## Required Files
33
+
34
+ Use a project-local `.goalkeeper/` directory. Each long-running goal session gets its own subdirectory:
35
+
36
+ ```text
37
+ .goalkeeper/
38
+ active-session # optional: current goal session id
39
+ sessions/
40
+ <goal-session-id>/
41
+ checkpoint.md
42
+ context-pack.md
43
+ events.jsonl
44
+ ```
45
+
46
+ Use a stable, readable `<goal-session-id>` such as `2026-05-17-goalkeeper-roadmap` or `ads-ops-release-hardening`.
47
+
48
+ If any core file is missing during long goal work, create it from the templates in `templates/`.
49
+ Use `.goalkeeper/active-session` when a workspace has one active Goalkeeper session and the agent should not have to reconstruct the session id after compaction.
50
+
51
+ The directory is created inside the active project workspace, not in a global agent directory. Example:
52
+
53
+ ```text
54
+ /path/to/project/.goalkeeper/sessions/2026-05-17-release-hardening/checkpoint.md
55
+ ```
56
+
57
+ Bundled scripts live in the skill package. When the script is not located inside the target workspace, pass the target workspace explicitly.
58
+
59
+ In Claude Code, `${CLAUDE_SKILL_DIR}` can resolve the installed skill directory. In other agents, use the concrete installed skill path:
60
+
61
+ ```bash
62
+ node <skill-path>/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id>
63
+ ```
64
+
65
+ If `<workspace>/.goalkeeper/active-session` points to the session id, `--session` may be omitted:
66
+
67
+ ```bash
68
+ node <skill-path>/scripts/goalkeeper-turn-start.mjs --workspace <workspace>
69
+ ```
70
+
71
+ To create a new session deterministically, run:
72
+
73
+ ```bash
74
+ node <skill-path>/scripts/goalkeeper-init.mjs --workspace <workspace> --session <goal-session-id> --goal "<active goal>"
75
+ ```
76
+
77
+ ## Recovery Rule
78
+
79
+ Before continuing after a resume, suspected compaction, long interruption, or handoff:
80
+
81
+ 1. Resolve the current goal session directory under `.goalkeeper/sessions/`.
82
+ 2. Read its `checkpoint.md`.
83
+ 3. If the checkpoint is stale, too thin, or missing the reasoning chain, read `context-pack.md`.
84
+ 4. If exact evidence is needed, inspect recent entries in `events.jsonl`.
85
+ 5. Restate the active direction internally before taking action.
86
+ 6. Continue only when the next action matches the recovered goal, constraints, and open risks.
87
+
88
+ After compaction, do not rely on the compacted conversation summary alone. Read the Goalkeeper checkpoint before continuing.
89
+
90
+ ## Recovery Guardrail
91
+
92
+ After a visible compact boundary, the first project-state action must be a Goalkeeper recovery read:
93
+
94
+ ```text
95
+ <workspace>/.goalkeeper/sessions/<goal-session-id>/checkpoint.md
96
+ ```
97
+
98
+ If you notice that you already continued without the checkpoint, stop, read the checkpoint, append a `recovery_violation` event, then continue from the recovered state.
99
+
100
+ ## Update Rule
101
+
102
+ Update Goalkeeper state when any of these change:
103
+
104
+ - active goal or done criteria
105
+ - user constraints or forbidden approaches
106
+ - major design decision
107
+ - failed attempt that should not be repeated
108
+ - important file or artifact path
109
+ - command result or verification status
110
+ - open risk, blocker, or next action
111
+ - handoff boundary
112
+
113
+ Append the event first, then update the session's `checkpoint.md` when the event changes the current working state.
114
+ Use `scripts/goalkeeper-update-checkpoint.mjs` when you want a bounded canonical checkpoint instead of manual Markdown edits.
115
+
116
+ ## Keep It Short
117
+
118
+ The checkpoint is a recovery artifact, not a transcript.
119
+
120
+ Keep it under about 8 KB when possible. If it grows beyond 16 KB, compact stale details into `events.jsonl` evidence references before relying on it for routine recovery.
121
+
122
+ Prefer:
123
+
124
+ - exact goal
125
+ - current throughline
126
+ - non-negotiable constraints
127
+ - decisions that explain direction
128
+ - verified facts
129
+ - open risks
130
+ - next action
131
+
132
+ Avoid:
133
+
134
+ - narrative summaries of every turn
135
+ - long command output
136
+ - speculative history
137
+ - stale alternatives that no longer matter
138
+
139
+ ## Context Pack
140
+
141
+ Use `context-pack.md` for medium-density pre-compaction context that is too detailed for the checkpoint:
142
+
143
+ - decision chain and reasoning
144
+ - rejected alternatives
145
+ - open threads
146
+ - domain model or implementation model
147
+ - evidence index for where exact facts live
148
+
149
+ Read it when checkpoint recovery is not enough. Keep raw transcripts and long command output out of it.
150
+
151
+ ## Reference Map
152
+
153
+ - Read `references/workflow.md` for lifecycle rules and examples.
154
+ - Read `references/event-schema.md` before adding or validating event records.
155
+ - Read `references/guardrail.md` when you need stronger always-on behavior in a target repository.
156
+ - Run `scripts/goalkeeper-init.mjs` when a long-running goal needs a new `.goalkeeper/sessions/<goal-session-id>/` directory.
157
+ - Run `scripts/goalkeeper-turn-start.mjs --context` when checkpoint recovery needs the larger context pack too.
158
+ - Run `scripts/goalkeeper-append-event.mjs` instead of hand-writing JSONL when recording decisions, verification, failures, risks, or handoffs; it can use `.goalkeeper/active-session` when `--session` is omitted.
159
+ - Run `scripts/goalkeeper-update-checkpoint.mjs` after appending a meaningful event when checkpoint state should be refreshed in a short canonical shape.
160
+ - Run `scripts/goalkeeper-doctor.mjs` after creating or changing Goalkeeper state to verify the target workspace is ready.
161
+
162
+ ## Safety Boundary
163
+
164
+ - Do not depend on private Codex, Claude Code, or other host-agent runtime internals.
165
+ - Do not claim this reduces compaction frequency.
166
+ - Do not treat the checkpoint as proof when exact evidence is needed; inspect `events.jsonl` or source files.
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: "Goalkeeper"
3
+ short_description: "Keep long goals oriented"
4
+ default_prompt: "Use $goalkeeper for this long-running goal so checkpoint, context pack, and event log preserve direction across compaction."
5
+ brand_color: "#2563EB"
@@ -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>/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 agent 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,64 @@
1
+ # Goalkeeper Guardrail
2
+
3
+ The skill body is not enough to guarantee checkpoint-first behavior after compaction. A host agent may resume from a compacted summary without the model noticing the exact session-log marker.
4
+
5
+ For high-stakes long-running work, add a guardrail template to the target workspace:
6
+
7
+ ```text
8
+ templates/AGENTS.goalkeeper.md
9
+ templates/CLAUDE.goalkeeper.md
10
+ ```
11
+
12
+ Use it in one of these ways:
13
+
14
+ - Copy `templates/AGENTS.goalkeeper.md` into the target repository's `AGENTS.md` for Codex-style agents.
15
+ - Copy `templates/CLAUDE.goalkeeper.md` into the target repository's `CLAUDE.md` for Claude Code.
16
+ - Merge the checkpoint-first section into an existing `AGENTS.md` or `CLAUDE.md`.
17
+ - Keep the template as project documentation and explicitly ask the agent to follow it before starting a long goal.
18
+
19
+ The guardrail is still skill-first. It does not require a plugin, MCP server, database, or private runtime hook. It uses surfaces coding agents already honor: repository instructions.
20
+
21
+ ## Why This Matters
22
+
23
+ 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.
24
+
25
+ ## Minimum Rule
26
+
27
+ For an active Goalkeeper-managed goal:
28
+
29
+ 1. Read `.goalkeeper/sessions/<goal-session-id>/checkpoint.md` before normal project files.
30
+ 2. Use `context-pack.md` when the checkpoint is too thin to recover the reasoning chain.
31
+ 3. Use `events.jsonl` only when exact evidence is needed.
32
+ 4. Append `recovery_violation` if the agent continued after compaction or resume before reading the checkpoint.
33
+
34
+ If `scripts/goalkeeper-turn-start.mjs` is present, it can be used as the first recovery action:
35
+
36
+ ```bash
37
+ node scripts/goalkeeper-turn-start.mjs --session <goal-session-id>
38
+ ```
39
+
40
+ If `.goalkeeper/active-session` contains the current session id, this shorter form is valid:
41
+
42
+ ```bash
43
+ node scripts/goalkeeper-turn-start.mjs
44
+ ```
45
+
46
+ If the helper is being run from an installed skill package rather than from the target repository, pass the target workspace explicitly:
47
+
48
+ ```bash
49
+ node <skill-path>/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id>
50
+ ```
51
+
52
+ Add `--context` when the medium-density context pack is needed:
53
+
54
+ ```bash
55
+ node <skill-path>/scripts/goalkeeper-turn-start.mjs --workspace <workspace> --session <goal-session-id> --context
56
+ ```
57
+
58
+ Before starting a high-stakes long run, use the read-only doctor to verify the target workspace has the required state and guardrail:
59
+
60
+ ```bash
61
+ node <skill-path>/scripts/goalkeeper-doctor.mjs --workspace <workspace> --session <goal-session-id> --strict
62
+ ```
63
+
64
+ 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 host agent 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>/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>/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>/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>/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>/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>/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>/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 agent 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-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.