codebyplan 1.13.63 → 1.13.65
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/dist/cli.js +923 -443
- package/package.json +1 -1
- package/templates/github-workflows/ci.yml +5 -0
- package/templates/hooks/cbp-session-id-stamp.sh +67 -0
- package/templates/hooks/cbp-skill-context-guard.sh +33 -13
- package/templates/hooks/cbp-test-hooks.sh +271 -0
- package/templates/rules/architecture-map.md +6 -0
- package/templates/rules/cbp-operating-gotchas.md +23 -9
- package/templates/rules/e2e-mandatory.md +5 -0
- package/templates/rules/handoff-file-convention.md +65 -0
- package/templates/rules/model-invocation-convention.md +1 -1
- package/templates/rules/scope-vocabulary.md +5 -0
- package/templates/rules/task-routing-recommendation.md +1 -1
- package/templates/settings.project.base.json +26 -8
- package/templates/skills/cbp-build-cc-agent/SKILL.md +3 -0
- package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +31 -0
- package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +6 -0
- package/templates/skills/cbp-build-cc-agent/templates/agent.md +1 -0
- package/templates/skills/cbp-build-cc-settings/reference/cbp-permission-policy.md +12 -5
- package/templates/skills/cbp-build-cc-skill/SKILL.md +1 -0
- package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +14 -0
- package/templates/skills/cbp-build-cc-skill/templates/skill.md +1 -0
- package/templates/skills/cbp-checkpoint-complete/SKILL.md +32 -0
- package/templates/skills/cbp-clear-continue/SKILL.md +23 -1
- package/templates/skills/cbp-clear-prep/SKILL.md +23 -2
- package/templates/skills/cbp-finalize/SKILL.md +40 -4
- package/templates/skills/cbp-finalize/reference/checkpoint-done-branching.md +1 -1
- package/templates/skills/cbp-finalize/reference/next-step-heuristic.md +1 -1
- package/templates/skills/cbp-session-end/SKILL.md +23 -25
- package/templates/skills/cbp-session-start/SKILL.md +24 -2
- package/templates/skills/cbp-standalone-task-complete/SKILL.md +32 -0
|
@@ -147,22 +147,16 @@
|
|
|
147
147
|
"mcp__codebyplan__get_checkpoints",
|
|
148
148
|
"mcp__codebyplan__get_current_task",
|
|
149
149
|
"mcp__codebyplan__get_eslint_presets",
|
|
150
|
-
"mcp__codebyplan__get_eslint_repo_config",
|
|
151
150
|
"mcp__codebyplan__get_file_changes",
|
|
152
|
-
"mcp__codebyplan__get_library_doc_job",
|
|
153
151
|
"mcp__codebyplan__get_repos",
|
|
154
152
|
"mcp__codebyplan__get_rounds",
|
|
155
153
|
"mcp__codebyplan__get_server_config",
|
|
156
154
|
"mcp__codebyplan__get_session_log",
|
|
157
155
|
"mcp__codebyplan__get_session_logs",
|
|
158
156
|
"mcp__codebyplan__get_session_state",
|
|
159
|
-
"mcp__codebyplan__get_task_template",
|
|
160
|
-
"mcp__codebyplan__get_task_templates",
|
|
161
157
|
"mcp__codebyplan__get_tasks",
|
|
162
158
|
"mcp__codebyplan__get_todos",
|
|
163
|
-
"mcp__codebyplan__list_tech_stack_sync_sessions",
|
|
164
159
|
"mcp__codebyplan__get_chunk",
|
|
165
|
-
"mcp__codebyplan__get_library_toc",
|
|
166
160
|
"mcp__codebyplan__list_migrations",
|
|
167
161
|
"mcp__codebyplan__lookup_symbol",
|
|
168
162
|
"mcp__codebyplan__resolve_library_id",
|
|
@@ -184,7 +178,15 @@
|
|
|
184
178
|
"mcp__codebyplan__flag_stale_chunk",
|
|
185
179
|
"mcp__codebyplan__update_eslint_repo_config",
|
|
186
180
|
"mcp__codebyplan__update_server_config",
|
|
187
|
-
"
|
|
181
|
+
"mcp__codebyplan__get_standalone_tasks",
|
|
182
|
+
"mcp__codebyplan__get_current_standalone_task",
|
|
183
|
+
"mcp__codebyplan__get_standalone_rounds",
|
|
184
|
+
"mcp__codebyplan__create_standalone_task",
|
|
185
|
+
"mcp__codebyplan__update_standalone_task",
|
|
186
|
+
"mcp__codebyplan__complete_standalone_task",
|
|
187
|
+
"mcp__codebyplan__add_standalone_round",
|
|
188
|
+
"mcp__codebyplan__update_standalone_round",
|
|
189
|
+
"mcp__codebyplan__complete_standalone_round",
|
|
188
190
|
"Bash(codebyplan check:*)",
|
|
189
191
|
"Bash(npx codebyplan check:*)",
|
|
190
192
|
"Bash(codebyplan session:*)",
|
|
@@ -250,13 +252,29 @@
|
|
|
250
252
|
"Bash(codebyplan cd:*)",
|
|
251
253
|
"Bash(npx codebyplan cd:*)",
|
|
252
254
|
"Bash(codebyplan cleanup-plan-folders:*)",
|
|
253
|
-
"Bash(npx codebyplan cleanup-plan-folders:*)"
|
|
255
|
+
"Bash(npx codebyplan cleanup-plan-folders:*)",
|
|
256
|
+
"Bash(codebyplan handoff:*)",
|
|
257
|
+
"Bash(npx codebyplan handoff:*)"
|
|
254
258
|
]
|
|
255
259
|
},
|
|
256
260
|
"attribution": {
|
|
257
261
|
"commit": "",
|
|
258
262
|
"pr": ""
|
|
259
263
|
},
|
|
264
|
+
"hooks": {
|
|
265
|
+
"SessionStart": [
|
|
266
|
+
{
|
|
267
|
+
"hooks": [
|
|
268
|
+
{
|
|
269
|
+
"_owner": "codebyplan-claude",
|
|
270
|
+
"_hook_id": "cbp-session-id-stamp.sh",
|
|
271
|
+
"type": "command",
|
|
272
|
+
"command": "bash ./.claude/hooks/cbp-session-id-stamp.sh"
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
},
|
|
260
278
|
"showClearContextOnPlanAccept": false,
|
|
261
279
|
"syntaxHighlightingDisabled": false
|
|
262
280
|
}
|
|
@@ -77,6 +77,7 @@ Check each against the task and include only when they add value:
|
|
|
77
77
|
| Background execution | `background: true` | Agent should always run concurrently |
|
|
78
78
|
| Bounded turns | `maxTurns: N` | Cap runaway loops |
|
|
79
79
|
| Subagent spawning | `tools: Agent(worker, researcher)` | Only if run as main thread via `--agent` |
|
|
80
|
+
| Memory store | `memory: user \| project \| local` | Which memory store the agent reads/writes |
|
|
80
81
|
|
|
81
82
|
Cross-references for complex cases:
|
|
82
83
|
|
|
@@ -136,5 +137,7 @@ Report:
|
|
|
136
137
|
- Subagents cannot spawn other subagents — the `Agent` tool only applies when the agent runs as the main thread
|
|
137
138
|
- `bypassPermissions` and `acceptEdits` inherited from the parent cannot be weakened by the child
|
|
138
139
|
- Preloaded skills inject _full content_ at startup — don't preload `disable-model-invocation: true` skills
|
|
140
|
+
- `Task(` was renamed to `Agent(` in v2.1.63 — use `Agent(...)` in `tools:` allowlists; `Task()` is a stale alias that still works but should not appear in new agents
|
|
141
|
+
- Plugin agents (`.claude/agents/`) ignore `hooks`, `mcpServers`, and `permissionMode` — these fields parse without error but have no runtime effect for plugin agents
|
|
139
142
|
- Restart the session or use `/agents` to load a newly written agent file
|
|
140
143
|
- Flat form `.claude/agents/{name}.md` is the default and matches all 12 existing CBP agents; folder form `{name}/AGENT.md` is optional and only for agents that bundle supporting files alongside them
|
|
@@ -18,6 +18,7 @@ Source: official Claude Code sub-agents spec. Only `name` and `description` are
|
|
|
18
18
|
| `effort` | string | `low` \| `medium` \| `high` \| `xhigh` \| `max`. **Plugin agents authored in CBP MUST set this explicitly** (no commented-out placeholder); see [/cbp-build-cc-mode](../../build-cc-mode/SKILL.md) for the matrix |
|
|
19
19
|
| `isolation` | string | `worktree` — gives the agent a temporary git worktree |
|
|
20
20
|
| `color` | string | `red` \| `blue` \| `green` \| `yellow` \| `purple` \| `orange` \| `pink` \| `cyan` |
|
|
21
|
+
| `memory` | string | Which memory store the agent reads/writes: `user` \| `project` \| `local` |
|
|
21
22
|
| `initialPrompt` | string | Auto-submitted first user turn when the agent is the main session agent |
|
|
22
23
|
|
|
23
24
|
## Tool-allowlist special forms
|
|
@@ -34,3 +35,33 @@ Source: official Claude Code sub-agents spec. Only `name` and `description` are
|
|
|
34
35
|
2. Per-invocation `model` parameter passed by Claude
|
|
35
36
|
3. The `model` field in this file
|
|
36
37
|
4. Main conversation's model
|
|
38
|
+
|
|
39
|
+
## Task( → Agent( rename (v2.1.63)
|
|
40
|
+
|
|
41
|
+
The `Agent` tool replaces the older `Task` tool. `Task()` still works as a stale alias but new agents should use `Agent(...)` in their `tools:` allowlists. Example: `tools: Agent(worker, researcher)` — not `Task(worker, researcher)`. The runtime accepts both forms; prefer `Agent`.
|
|
42
|
+
|
|
43
|
+
## Plugin agent limitations
|
|
44
|
+
|
|
45
|
+
Plugin agents (those defined in `.claude/agents/`) ignore the following fields — they are parsed without error but have **no runtime effect**:
|
|
46
|
+
|
|
47
|
+
- `hooks` — lifecycle hooks are silently no-opped for plugin agents
|
|
48
|
+
- `mcpServers` — scoped MCP server definitions are ignored
|
|
49
|
+
- `permissionMode` — the parent session's permission mode applies unchanged; the child cannot set its own
|
|
50
|
+
|
|
51
|
+
This is distinct from agents run as the main thread via `claude --agent`, where these fields take full effect.
|
|
52
|
+
|
|
53
|
+
## Skills-preload constraint
|
|
54
|
+
|
|
55
|
+
Skills listed in `skills:` are preloaded — their full content is injected into the agent's context at startup. Do NOT preload skills that carry `disable-model-invocation: true`. A preloaded skill with that flag is loaded at startup but can never be invoked at runtime, so its content wastes context and its intent cannot be fulfilled.
|
|
56
|
+
|
|
57
|
+
## CBP-only fields (not read by Claude Code)
|
|
58
|
+
|
|
59
|
+
`scope:` is **CBP framework metadata** — it is NOT part of the official Claude Code sub-agents spec and is not read by the Claude Code runtime. It declares the agent's distribution class:
|
|
60
|
+
|
|
61
|
+
| Value | Meaning |
|
|
62
|
+
|-------|---------|
|
|
63
|
+
| `org-shared` | Ships identically to every consuming repo via the `codebyplan` package |
|
|
64
|
+
| `project-shared` | Shared across repos in a single project family |
|
|
65
|
+
| `repo-only:<name>` | Bound to one repo; `<name>` is the repo slug |
|
|
66
|
+
|
|
67
|
+
Required only on user-created agents (no template twin). Package-managed agents are `org-shared` by default — no marker needed. See [rules/scope-vocabulary.md](../../../../rules/scope-vocabulary.md).
|
|
@@ -16,3 +16,9 @@ Source: official Claude Code sub-agents and permission-modes specs.
|
|
|
16
16
|
- If parent is `bypassPermissions` or `acceptEdits`, child cannot weaken it
|
|
17
17
|
- If parent is `auto`, child inherits `auto` and its `permissionMode` is ignored
|
|
18
18
|
- Otherwise the child's `permissionMode` takes effect as declared
|
|
19
|
+
|
|
20
|
+
## Plugin agents
|
|
21
|
+
|
|
22
|
+
Plugin agents (those defined in `.claude/agents/` and loaded by the runtime, not run via `claude --agent`) **ignore `permissionMode` entirely**. The field is valid YAML and parses without error, but has no runtime effect — the parent session's permission mode applies unchanged.
|
|
23
|
+
|
|
24
|
+
Likewise, `hooks` and `mcpServers` are ignored for plugin agents regardless of the parent session's permission mode. These fields only take effect when the agent runs as the main thread via `claude --agent`.
|
|
@@ -6,6 +6,7 @@ tools: Read, Grep, Glob, Bash
|
|
|
6
6
|
# disallowedTools: Write, Edit # alternative to tools — inherits then removes
|
|
7
7
|
# review with /cbp-build-cc-mode if defaults don't fit this agent's purpose
|
|
8
8
|
model: sonnet
|
|
9
|
+
# memory: user # user | project | local — which memory store this agent reads/writes
|
|
9
10
|
# permissionMode: default # default | acceptEdits | auto | dontAsk | bypassPermissions | plan
|
|
10
11
|
# maxTurns: 20
|
|
11
12
|
effort: xhigh
|
|
@@ -24,8 +24,8 @@ Precedence is `deny > ask > allow`; arrays union across scopes (managed/user/pro
|
|
|
24
24
|
|
|
25
25
|
- **Non-lifecycle, non-shipment `/cbp-*` skills** — authoring (`cbp-build-cc-*`), frontend (`cbp-frontend-*`), git (`cbp-git-*`, `cbp-merge-main`, `cbp-refresh-infra`), round work (`cbp-round-plan`, `cbp-verify` — `cbp-verify` is the autonomous verify stage that runs deterministic gates, proves execution, spawns the fresh-context reviewer, and routes to `cbp-round-complete` or `cbp-round-plan`, so it runs without a prompt), setup/configure (`cbp-setup-*`, `cbp-ship-configure`, `cbp-supabase-*`), task prep (`cbp-task-create`/`-start`, `cbp-standalone-task-check`/`-testing`), planning (`cbp-checkpoint-plan`/`-update`), plus `cbp-session-start` and `cbp-todo`. Invoking a skill is the intended mode of operation; the gated side effects happen inside via the Bash/MCP tools the skill calls, which carry their own tiering. The lifecycle/state-transition and plan-approval skills are the exception — they live in `ask` (next section).
|
|
26
26
|
- **All `mcp__codebyplan__*` reads** (`get_*`, `list_*`, `search_*`, `health_check`, `lookup_symbol`, `resolve_library_id`, `get_chunk`).
|
|
27
|
-
- **Routine workflow-write MCP tools** the pipeline calls many times per task: create/update/complete checkpoint, task, and round; session log + session-state writes; `create_worktree`, `add_library`, `flag_stale_chunk`, `update_server_config`, `update_eslint_repo_config
|
|
28
|
-
- **Read/safe CLI commands** (both `codebyplan X` and `npx codebyplan X`): `whoami`, `statusline`, `ports`, `tech-stack`, `eslint`, `round`, `help`, `--version`.
|
|
27
|
+
- **Routine workflow-write MCP tools** the pipeline calls many times per task: create/update/complete checkpoint, task, and round; session log + session-state writes; `create_worktree`, `add_library`, `flag_stale_chunk`, `update_server_config`, `update_eslint_repo_config`. Gating these with `ask` would make the autonomous workflow unusable.
|
|
28
|
+
- **Read/safe CLI commands** (both `codebyplan X` and `npx codebyplan X`): `whoami`, `resolve-worktree`, `statusline`, `ports`, `tech-stack`, `eslint`, `round`, `help`, `--version`.
|
|
29
29
|
|
|
30
30
|
### `ask` — the deliberate confirm-gate
|
|
31
31
|
|
|
@@ -66,11 +66,18 @@ This means:
|
|
|
66
66
|
- A skill in `ask` that is auto-triggered shows a permission prompt — that prompt is the gate;
|
|
67
67
|
say so in the routing prose.
|
|
68
68
|
|
|
69
|
-
### The
|
|
69
|
+
### The model-aware context guard
|
|
70
70
|
|
|
71
71
|
The `cbp-skill-context-guard.sh` PreToolUse hook denies heavy close-out skills when the
|
|
72
|
-
context window exceeds
|
|
73
|
-
|
|
72
|
+
context window exceeds the model-aware threshold:
|
|
73
|
+
|
|
74
|
+
- **Standard models**: `CBP_CONTEXT_WARN_TOKENS` (default 200 000 tokens)
|
|
75
|
+
- **1M-context models** (model id contains `[1m]`): `CBP_CONTEXT_WARN_TOKENS_1M` (default 800 000 tokens)
|
|
76
|
+
|
|
77
|
+
When no model id is found in the transcript the hook fails conservative to the standard 200K
|
|
78
|
+
tier. Each env var overrides only its own tier — the other tier is unaffected.
|
|
79
|
+
|
|
80
|
+
The heavy allowlist is: `cbp-round-build`, `cbp-verify`, `cbp-standalone-task-testing`,
|
|
74
81
|
`cbp-checkpoint-check`, `cbp-checkpoint-end`.
|
|
75
82
|
|
|
76
83
|
When the guard fires, it directs the model to run `/cbp-clear-prep` instead. The flow is:
|
|
@@ -97,6 +97,7 @@ Key fields by use case:
|
|
|
97
97
|
| Manual-only workflow | `disable-model-invocation: true` |
|
|
98
98
|
| Hide from `/` menu | `user-invocable: false` |
|
|
99
99
|
| Pre-approve tools | `allowed-tools: Bash(git add *) Bash(git commit *)` |
|
|
100
|
+
| Block specific tools | `disallowed-tools: Write, Edit` (denylist applied before `allowed-tools`; blocks those tools for the duration of the skill) |
|
|
100
101
|
| Accept arguments | `argument-hint: [file] [mode]`, optionally `arguments: [file mode]` for named `$file`/`$mode` |
|
|
101
102
|
| Set model + effort | `model: inherit` (the standard value — explicitly signals session-model inheritance) and `effort: xhigh` (default for plugin skills; lower tiers `high`/`medium`/`low` per [/cbp-build-cc-mode](../build-cc-mode/SKILL.md)). A non-`inherit` model pin forces a model the user didn't choose and can carry the session's 1M `[1m]` tier onto the skill (→ "usage credits required for 1M context"), so pin only as a deliberate, documented exception |
|
|
102
103
|
| Path-scoped auto-load | `paths: ["src/api/**/*.ts"]` |
|
|
@@ -12,6 +12,7 @@ Source: official Claude Code skills spec. All fields are optional; `description`
|
|
|
12
12
|
| `disable-model-invocation` | `true` → only user can invoke (via `/name`). Upstream skills that auto-trigger this skill MUST emit a `Next: /name` directive instead — model invocation is blocked by the runtime; see SKILL.md Step 4 "Convention: User-only / permission-gated finalizer" |
|
|
13
13
|
| `user-invocable` | `false` → hidden from `/` menu, Claude-only |
|
|
14
14
|
| `allowed-tools` | Pre-approve tools while the skill is active |
|
|
15
|
+
| `disallowed-tools` | Denylist tools blocked while the skill is active — complement to `allowed-tools`. Applied before `allowed-tools`; e.g. `disallowed-tools: Write, Edit` prevents those tools even if the session allows them |
|
|
15
16
|
| `model` | Model for this skill's turn. **CBP skills set `model: inherit`** (the standard value — explicitly signals session-model inheritance). A non-`inherit` pin (e.g. `sonnet`) forces that model and can carry the session's 1M `[1m]` context tier onto the skill, triggering "usage credits required for 1M context"; use only as a deliberate, documented exception — see [/cbp-build-cc-mode](../../build-cc-mode/SKILL.md) |
|
|
16
17
|
| `effort` | Override effort level (`low`/`medium`/`high`/`xhigh`/`max`). **Plugin skills authored in CBP MUST set this explicitly** (no commented-out placeholder); defaults to `xhigh`. See [/cbp-build-cc-mode](../../build-cc-mode/SKILL.md) for the matrix |
|
|
17
18
|
| `context` | `fork` → run in a subagent |
|
|
@@ -39,3 +40,16 @@ Total skill-description budget in context: 1% of the context window (fallback 8,
|
|
|
39
40
|
| `user-invocable: false` | No | Yes | Description in context; body loads on auto-invoke |
|
|
40
41
|
|
|
41
42
|
> **Upstream-directive rule**: a skill with `disable-model-invocation: true` cannot be invoked by another skill. Any upstream skill that auto-triggers it MUST emit a `Next: /skill-name` close-out directive and stop. See "Convention: User-only / permission-gated finalizer" in SKILL.md Step 4 for the full pattern and canonical example.
|
|
43
|
+
|
|
44
|
+
## `context: fork` + `agent:` interplay
|
|
45
|
+
|
|
46
|
+
`agent:` is **ignored by the runtime unless `context: fork` is also set**. When both are present, the skill body runs in the named agent's context (isolated subagent). Built-in agent types: `Explore`, `Plan`, `general-purpose`, or any custom agent name. Note that `Explore`/`Plan` subagents skip the project `CLAUDE.md` — they have no inherited session context. Use `general-purpose` (or a custom agent) when the forked skill needs CLAUDE.md to be in scope.
|
|
47
|
+
|
|
48
|
+
## CBP-only fields (not read by Claude Code)
|
|
49
|
+
|
|
50
|
+
Two fields in CBP `.claude/` structural files are **CBP framework metadata** — they are NOT part of the official Claude Code skills spec and are not read by the Claude Code runtime:
|
|
51
|
+
|
|
52
|
+
| Field | Purpose |
|
|
53
|
+
|-------|---------|
|
|
54
|
+
| `scope:` | Distribution class — `org-shared` \| `project-shared` \| `repo-only:<repo-name>`. Required only on user-created skills (no template twin). Package-managed skills are `org-shared` by default and need no marker. See [rules/scope-vocabulary.md](../../../../rules/scope-vocabulary.md) |
|
|
55
|
+
| `triggers:` | CBP pipeline routing documentation only — describes when the skill auto-fires in the CBP pipeline. Has no runtime effect; Claude Code does not read it |
|
|
@@ -8,6 +8,7 @@ description: What this skill does and when to use it. Front-load the key use cas
|
|
|
8
8
|
# disable-model-invocation: false # true = only user can invoke via /name
|
|
9
9
|
# user-invocable: true # false = only Claude can invoke (hidden from / menu)
|
|
10
10
|
# allowed-tools: Read, Grep, Glob, Bash(git status *)
|
|
11
|
+
# disallowed-tools: Write, Edit # tools blocked while the skill is active (complement to allowed-tools)
|
|
11
12
|
# model: # OMIT to inherit the session model (recommended). A pinned model can carry the session's 1M [1m] tier and require usage credits — pin only as a documented exception (see /cbp-build-cc-mode)
|
|
12
13
|
# review effort with /cbp-build-cc-mode if the default doesn't fit this skill's purpose
|
|
13
14
|
effort: xhigh
|
|
@@ -72,6 +72,38 @@ Complete remaining tasks first, then run `/cbp-checkpoint-complete`.
|
|
|
72
72
|
```
|
|
73
73
|
Stop here.
|
|
74
74
|
|
|
75
|
+
### Step 2.6: Verify Checkpoint Handoff Is Resolved
|
|
76
|
+
|
|
77
|
+
Run `codebyplan handoff status --json` and parse the output.
|
|
78
|
+
|
|
79
|
+
Check if `nonEmpty[]` contains an entry where `level === 'checkpoint'` AND `identifier === '{NNN}'`
|
|
80
|
+
(the 3-digit zero-padded checkpoint number — e.g. `231`).
|
|
81
|
+
|
|
82
|
+
If a matching entry is found, BLOCK with:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
## Cannot Complete Checkpoint — Handoff Unresolved
|
|
86
|
+
|
|
87
|
+
CHK-[NNN] has unresolved handoff content at `.codebyplan/handoff/checkpoint/[NNN].md`.
|
|
88
|
+
|
|
89
|
+
The handoff file contains scope that has not been resolved. You must clear it before
|
|
90
|
+
completing this checkpoint. Three options — pick exactly one:
|
|
91
|
+
|
|
92
|
+
1. **Absorb** — address the pending scope now, then clear:
|
|
93
|
+
`codebyplan handoff clear --level checkpoint --number [NNN]`
|
|
94
|
+
2. **Defer** — create a follow-up checkpoint or standalone task to cover the scope,
|
|
95
|
+
then clear: `codebyplan handoff clear --level checkpoint --number [NNN]`
|
|
96
|
+
3. **Escalate** — move the content to the repo handoff:
|
|
97
|
+
`codebyplan handoff append --level repo --content "<content>"`
|
|
98
|
+
then clear: `codebyplan handoff clear --level checkpoint --number [NNN]`
|
|
99
|
+
|
|
100
|
+
Never silently delete handoff content — it represents tracked scope.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
(STOP)
|
|
104
|
+
|
|
105
|
+
If no matching entry: continue to Step 3.
|
|
106
|
+
|
|
75
107
|
### Step 3: Aggregate QA
|
|
76
108
|
|
|
77
109
|
Collect QA results from all tasks and rounds. Build checkpoint-level QA summary:
|
|
@@ -48,6 +48,28 @@ Resuming from handoff:
|
|
|
48
48
|
Next action: /<next-action>
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
### Step 2.5 — Surface committed handoffs
|
|
52
|
+
|
|
53
|
+
Surface any committed handoff files before proceeding. Non-blocking.
|
|
54
|
+
|
|
55
|
+
1. Run `codebyplan handoff status --json` → parse `nonEmpty[]`.
|
|
56
|
+
2. If `nonEmpty` is empty → skip silently.
|
|
57
|
+
3. For each entry in `nonEmpty`, read the content:
|
|
58
|
+
- `repo` → `codebyplan handoff read --level repo`
|
|
59
|
+
- `checkpoint` → `codebyplan handoff read --level checkpoint --number <identifier>`
|
|
60
|
+
- `task` → split identifier `"<NNN>-<T>"` → `codebyplan handoff read --level task --number <NNN> --task <T>`
|
|
61
|
+
- `standalone` → `codebyplan handoff read --level standalone --number <identifier>`
|
|
62
|
+
4. Display:
|
|
63
|
+
```
|
|
64
|
+
Handoff notes from previous session(s):
|
|
65
|
+
|
|
66
|
+
[<level>: <identifier>]
|
|
67
|
+
<content>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
```
|
|
71
|
+
5. Non-blocking — proceed to Step 3 regardless.
|
|
72
|
+
|
|
51
73
|
### Step 3 — Delete the handoff BEFORE re-invoking
|
|
52
74
|
|
|
53
75
|
Delete `.codebyplan/clear/handoff.md` once its contents have been read and displayed:
|
|
@@ -80,7 +102,7 @@ the guard will deny again. Follow the same cycle: `/cbp-clear-prep` → `/clear`
|
|
|
80
102
|
## Integration
|
|
81
103
|
|
|
82
104
|
- **Invoked by**: user after `/clear` following `/cbp-clear-prep`
|
|
83
|
-
- **Reads**: `.codebyplan/clear/handoff.md`
|
|
105
|
+
- **Reads**: `.codebyplan/clear/handoff.md` (Step 1); `codebyplan handoff status --json` + `codebyplan handoff read` (Step 2.5 — committed handoff surfacing)
|
|
84
106
|
- **Deletes**: `.codebyplan/clear/handoff.md` (Step 3, before resuming)
|
|
85
107
|
- **Then invokes**: the skill from `next_action` via Skill tool
|
|
86
108
|
- **Companion**: `.claude/skills/cbp-clear-prep/SKILL.md` writes the handoff
|
|
@@ -86,6 +86,27 @@ next_action: /<skill-name> <args if any>
|
|
|
86
86
|
After /clear, run: /cbp-clear-continue
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
+
### Step 4.5 — Flush carryover to committed handoff
|
|
90
|
+
|
|
91
|
+
If `checkpoint_number` from Step 2 is `unknown` → skip silently (no reliable key).
|
|
92
|
+
|
|
93
|
+
Otherwise:
|
|
94
|
+
|
|
95
|
+
1. Compose a brief carryover note:
|
|
96
|
+
```markdown
|
|
97
|
+
## Context-clear carryover — CHK-<N>
|
|
98
|
+
|
|
99
|
+
Captured: <ISO now>
|
|
100
|
+
Blocked skill: <blocked_skill>
|
|
101
|
+
Next action: `<next_action>`
|
|
102
|
+
|
|
103
|
+
<in-flight notes from Step 3>
|
|
104
|
+
```
|
|
105
|
+
2. Run `codebyplan handoff write --level checkpoint --number <N> --content "<content>"`.
|
|
106
|
+
3. Output: `Carryover handoff written to .codebyplan/handoff/checkpoint/<NNN>.md`.
|
|
107
|
+
|
|
108
|
+
Non-blocking — Step 5 continues regardless.
|
|
109
|
+
|
|
89
110
|
### Step 5 — Instruct the user
|
|
90
111
|
|
|
91
112
|
Output exactly this summary (fill in the real values):
|
|
@@ -116,7 +137,7 @@ The user must run both commands manually.
|
|
|
116
137
|
## Integration
|
|
117
138
|
|
|
118
139
|
- **Invoked when**: `cbp-skill-context-guard` PreToolUse hook emits `permissionDecision: deny`
|
|
119
|
-
- **Writes**: `.codebyplan/clear/handoff.md`
|
|
140
|
+
- **Writes**: `.codebyplan/clear/handoff.md` (Step 4 — transient, gitignored); `codebyplan handoff write --level checkpoint --number <N>` (Step 4.5 — committed carryover flush; skipped when checkpoint_number unknown)
|
|
120
141
|
- **Next**: user runs `/clear`, then `/cbp-clear-continue`
|
|
121
142
|
- **Companion**: `.claude/skills/cbp-clear-continue/SKILL.md` reads `.codebyplan/clear/handoff.md`
|
|
122
|
-
- **Guard hook**: `.claude/hooks/cbp-skill-context-guard.sh` — fires when context
|
|
143
|
+
- **Guard hook**: `.claude/hooks/cbp-skill-context-guard.sh` — fires when context exceeds the model-aware threshold: `CBP_CONTEXT_WARN_TOKENS` (default 200000) for standard models; `CBP_CONTEXT_WARN_TOKENS_1M` (default 800000) for `[1m]`-context models. No model id found → standard tier (fail-conservative).
|
|
@@ -85,6 +85,42 @@ Stop here.
|
|
|
85
85
|
|
|
86
86
|
`task.context.verify_verdict` must exist and have `verdict: 'READY'` (written by `/cbp-verify` Phase 6 when it runs at task scope — whole-repo `codebyplan check --scope task`, holistic `cbp-verify-reviewer`, and the single batched human walkthrough all passed). If absent or not `READY`, surface "Run `/cbp-verify` first" and stop.
|
|
87
87
|
|
|
88
|
+
### Step 2.6: Verify Task Handoff Is Resolved
|
|
89
|
+
|
|
90
|
+
Run `codebyplan handoff status --json` and parse the output.
|
|
91
|
+
|
|
92
|
+
Check if `nonEmpty[]` contains an entry where `level === 'task'` AND `identifier === '{NNN}-{T}'`
|
|
93
|
+
(the 3-digit zero-padded checkpoint number, hyphen, task number — e.g. `231-3`).
|
|
94
|
+
|
|
95
|
+
> Gate scope is intentional: only **task**-level handoffs block here. Checkpoint-level handoffs
|
|
96
|
+
> (written by `/cbp-session-end` as resume-pointers) are deliberately scoped to
|
|
97
|
+
> `/cbp-checkpoint-complete`, NOT task finalize — do not "fix" this to gate on checkpoint level.
|
|
98
|
+
|
|
99
|
+
If a matching entry is found, BLOCK with:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
## Cannot Complete Task — Handoff Unresolved
|
|
103
|
+
|
|
104
|
+
TASK-[N] has unresolved handoff content at `.codebyplan/handoff/task/[NNN]-[T].md`.
|
|
105
|
+
|
|
106
|
+
The handoff file contains scope that has not been resolved. You must clear it before
|
|
107
|
+
completing this task. Three options — pick exactly one:
|
|
108
|
+
|
|
109
|
+
1. **Absorb** — address the pending scope in current work, then clear:
|
|
110
|
+
`codebyplan handoff clear --level task --number [NNN] --task [T]`
|
|
111
|
+
2. **Defer** — create a follow-up task or standalone task to cover the scope,
|
|
112
|
+
then clear: `codebyplan handoff clear --level task --number [NNN] --task [T]`
|
|
113
|
+
3. **Escalate** — move the content to the repo handoff:
|
|
114
|
+
`codebyplan handoff append --level repo --content "<content>"`
|
|
115
|
+
then clear: `codebyplan handoff clear --level task --number [NNN] --task [T]`
|
|
116
|
+
|
|
117
|
+
Never silently delete handoff content — it represents tracked scope.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
(STOP)
|
|
121
|
+
|
|
122
|
+
If no matching entry: continue to Step 3.
|
|
123
|
+
|
|
88
124
|
### Step 3: Verify QA and File Approval
|
|
89
125
|
|
|
90
126
|
Load `task.qa` and `task.files_changed`:
|
|
@@ -133,7 +169,7 @@ Skip the push only when nothing was committed in Step 5 AND `/cbp-merge-main` re
|
|
|
133
169
|
|
|
134
170
|
### Step 7: Complete Task
|
|
135
171
|
|
|
136
|
-
MCP `complete_task(task_id)
|
|
172
|
+
MCP `complete_task(task_id)` — kept on MCP because the CLI `codebyplan task complete` sends an empty POST body and cannot forward `caller_worktree_id`, which the server uses to enforce the mutate-lock. `caller_worktree_id` is auto-injected by the `cbp-mcp-caller-worktree-inject.sh` PreToolUse hook (CHK-198 TASK-2); the server falls back to the repo `main` worktree only when it is absent, then enforces the mutate-lock. The server auto-clears `assigned_user_id` + `assigned_worktree_id` on the task; if this was the last sibling task, it also clears the parent checkpoint's assignment. (Per CHK-104 hard-lock.)
|
|
137
173
|
|
|
138
174
|
### Step 8: Run Cleanup + Migration (inline)
|
|
139
175
|
|
|
@@ -153,7 +189,7 @@ Show the completion summary:
|
|
|
153
189
|
**Warnings**: [any QA / file-approval warnings from Step 3, or "none"]
|
|
154
190
|
```
|
|
155
191
|
|
|
156
|
-
Then route. Same-context transitions (next task in this checkpoint) auto-trigger `cbp-task-start` via the Skill tool. Checkpoint-done (last task) also auto-triggers `cbp-checkpoint-check` via the Skill tool (`ask`-tier — the permission prompt is the human gate; the
|
|
192
|
+
Then route. Same-context transitions (next task in this checkpoint) auto-trigger `cbp-task-start` via the Skill tool. Checkpoint-done (last task) also auto-triggers `cbp-checkpoint-check` via the Skill tool (`ask`-tier — the permission prompt is the human gate; the model-aware context guard handles oversized contexts via the cbp-clear-prep flow — 200K standard, 800K on `[1m]` sessions). Only the no-task-anywhere session-end fallback surfaces as a single directive (`Next: Run /clear, then /cbp-session-end`) for the user to invoke.
|
|
157
193
|
|
|
158
194
|
#### 9a — Determine routing context
|
|
159
195
|
|
|
@@ -182,7 +218,7 @@ If no next task is found (no pending work anywhere in the repo), emit directive
|
|
|
182
218
|
The checkpoint has no remaining tasks. Invoke `cbp-checkpoint-check` via the Skill tool.
|
|
183
219
|
`cbp-checkpoint-check` is `ask`-tier — the harness permission prompt IS the human gate; the
|
|
184
220
|
user confirms (or declines) before checkpoint verification and ship begins. If the context
|
|
185
|
-
window is above the
|
|
221
|
+
window is above the model-aware threshold (200K standard, 800K for `[1m]` sessions) the `cbp-skill-context-guard.sh` hook will block it and
|
|
186
222
|
direct you to run `/cbp-clear-prep` first; otherwise checkpoint-check starts on confirmation.
|
|
187
223
|
|
|
188
224
|
## Integration
|
|
@@ -190,7 +226,7 @@ direct you to run `/cbp-clear-prep` first; otherwise checkpoint-check starts on
|
|
|
190
226
|
- **Triggered by**: `/cbp-verify` (auto, scope=task, when it writes `verify_verdict.verdict === 'READY'`)
|
|
191
227
|
- **Chain**: `/cbp-verify` (scope=task READY) → `/cbp-finalize`
|
|
192
228
|
- **Reads**: `.codebyplan/state/checkpoints/*.json`, `checkpoints/<id>/tasks/*.json`, `checkpoints/<id>/tasks/<id>/rounds/*.json`, `todos.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task`/`get_rounds`/`get_tasks` break-glass) — including each round's `verify_manifest` and `task.context.verify_verdict`
|
|
193
|
-
- **Writes**: `codebyplan task update` for `files_changed` (CLI write-through; MCP `update_task` break-glass); MCP `complete_task` for task completion
|
|
229
|
+
- **Writes**: `codebyplan task update` for `files_changed` (CLI write-through; MCP `update_task` break-glass); MCP `complete_task` for task completion (kept MCP — CLI cannot forward `caller_worktree_id`)
|
|
194
230
|
- **Uses skills (inline, no sub-agent)**: `cleanup` (if deletions), `migration` (if exports renamed)
|
|
195
231
|
- **Triggers**: Same-context transitions auto-trigger via the Skill tool (next task in checkpoint → `cbp-task-start {N}`, `allow`-tier, fires silently). Checkpoint-done → auto-triggers `cbp-checkpoint-check` via Skill tool (`ask`-tier, permission prompt IS the human gate). No-task-anywhere fallback → directive `Next: Run /clear, then /cbp-session-end.`
|
|
196
232
|
- **Checkpoint-bound only** — for standalone tasks use `/cbp-standalone-task-complete`
|
|
@@ -17,7 +17,7 @@ The skill detects "checkpoint done" at Step 9 by:
|
|
|
17
17
|
When all siblings are done, the skill invokes `cbp-checkpoint-check` via the Skill tool:
|
|
18
18
|
|
|
19
19
|
- `cbp-checkpoint-check` is `ask`-tier — the harness permission prompt IS the human gate. The user confirms (or declines) before checkpoint verification and the shipment chain begin.
|
|
20
|
-
- No `/clear` is emitted unconditionally. If the `cbp-skill-context-guard.sh` hook detects the context window is above the
|
|
20
|
+
- No `/clear` is emitted unconditionally. If the `cbp-skill-context-guard.sh` hook detects the context window is above the model-aware threshold (200K for standard models; 800K for `[1m]`-context models; env vars `CBP_CONTEXT_WARN_TOKENS` / `CBP_CONTEXT_WARN_TOKENS_1M`) it blocks the skill and directs you to run `/cbp-clear-prep` first (which writes a handoff; the user then runs `/clear`, then `/cbp-clear-continue` resumes); otherwise checkpoint-check starts immediately on confirmation.
|
|
21
21
|
|
|
22
22
|
There is no AskUserQuestion menu. Expanding the checkpoint with more tasks (`/cbp-checkpoint-update`) or wrapping up the session (`/cbp-session-end`) are no longer surfaced as inline alternatives — the deterministic next step on checkpoint-done is `cbp-checkpoint-check`. (The user can still invoke those other skills manually at any time; they are simply not part of the auto-flow.)
|
|
23
23
|
|
|
@@ -19,7 +19,7 @@ No AskUserQuestion, no `/clear`. The skill fires immediately.
|
|
|
19
19
|
|
|
20
20
|
Two sub-cases:
|
|
21
21
|
|
|
22
|
-
**Checkpoint done** (last task in the checkpoint complete): auto-trigger `cbp-checkpoint-check` via the Skill tool. `cbp-checkpoint-check` is `ask`-tier — the permission prompt is the human gate; the
|
|
22
|
+
**Checkpoint done** (last task in the checkpoint complete): auto-trigger `cbp-checkpoint-check` via the Skill tool. `cbp-checkpoint-check` is `ask`-tier — the permission prompt is the human gate; the model-aware context guard handles oversized contexts (via `cbp-clear-prep`) only when context is near the limit — 200K standard, 800K on `[1m]` sessions (env vars `CBP_CONTEXT_WARN_TOKENS` / `CBP_CONTEXT_WARN_TOKENS_1M`). No unconditional `/clear`. (See `checkpoint-done-branching.md`.)
|
|
23
23
|
|
|
24
24
|
**Session end** (no pending tasks anywhere): emit a single directive line at the end of skill output and stop:
|
|
25
25
|
|
|
@@ -22,46 +22,44 @@ Always write a session log for this session — **even if empty**. `/cbp-session
|
|
|
22
22
|
2. Pull facts from local state files rather than narrating from memory:
|
|
23
23
|
- Rounds added/completed, tasks advanced/completed during this session (read from `.codebyplan/state/checkpoints/` subtree)
|
|
24
24
|
- Decisions, blockers, or discoveries recorded in checkpoint/task context
|
|
25
|
-
3. Run `codebyplan session update-log --id <log-id> --ended-at <now> --
|
|
25
|
+
3. Run `codebyplan session update-log --id <log-id> --ended-at <now> --git-branch <current-branch>` (CLI write-through: updates `.codebyplan/state/session/current.json` + REST). Break-glass fallback: MCP `update_session_log` when the CLI is unavailable. Fields:
|
|
26
26
|
- `ended_at`: now (maps to the `closed_at` column per TASK-2 alias)
|
|
27
|
-
- `summary`: concise — may be empty if nothing happened
|
|
28
|
-
- `pending`: open items the next session should see first
|
|
29
27
|
- `git_branch`: the current git branch (informational; `git rev-parse --abbrev-ref HEAD`)
|
|
30
|
-
-
|
|
28
|
+
- Carryover notes now go to committed `.codebyplan/handoff/` files (Step 1.3) — not the session log.
|
|
31
29
|
|
|
32
30
|
### Step 1.3: Optional Handoff File (mid-work only)
|
|
33
31
|
|
|
34
32
|
When an active in-progress task or round exists, offer to write a handoff file so the next session can auto-resume. Skip entirely when not mid-work.
|
|
35
33
|
|
|
36
|
-
1. Read `.codebyplan/state/todos.json` (local-first) and check `rows[0]` (queue head, ordered by `sort_order`). If missing/stale, run `npx codebyplan sync` once and re-read. Break-glass fallback: MCP `get_todos({ repo_id })` when the state dir is absent and sync fails.
|
|
34
|
+
1. Read `.codebyplan/state/todos.json` (local-first) and check `rows[0]` (queue head, ordered by `sort_order`). If missing/stale, run `npx codebyplan sync` once and re-read. Break-glass fallback: MCP `get_todos({ repo_id })` when the state dir is absent and sync fails.
|
|
37
35
|
|
|
38
36
|
2. **If `rows[0]` exists and its `command` is non-empty** (active work in flight):
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
37
|
+
- Resolve the level and number (level is `checkpoint`/`standalone`, NOT `task` — a session-end
|
|
38
|
+
handoff is a checkpoint-scope resume-pointer; `task`-level handoffs are reserved for explicit
|
|
39
|
+
user-deferred scope and gate only `/cbp-finalize`):
|
|
40
|
+
- Checkpoint work: read `.codebyplan/state/checkpoints/<rows[0].checkpoint_id>.json` → `number` (break-glass: MCP `get_checkpoints`). Level: `checkpoint`, number: `<NNN>` (3-digit zero-pad).
|
|
41
|
+
- Standalone work: read the standalone task `number` from local standalone state (break-glass: MCP `get_standalone_tasks`). Level: `standalone`, number: `<N>`.
|
|
42
|
+
- Offer to write:
|
|
43
43
|
```
|
|
44
|
-
Write handoff
|
|
45
|
-
|
|
44
|
+
Write handoff for next session?
|
|
45
|
+
.codebyplan/handoff/<level>/<identifier>.md
|
|
46
46
|
|
|
47
47
|
Reply: yes | no
|
|
48
48
|
```
|
|
49
|
-
- On `yes`: write
|
|
49
|
+
- On `yes`: run `codebyplan handoff write --level <level> --number <N> --content "<content>"` where content is:
|
|
50
50
|
```markdown
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
round_id: <rows[0].round_id or null>
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
<rows[0].instructions — human-readable trigger reason>
|
|
51
|
+
## Session handoff — CHK-<N>
|
|
52
|
+
|
|
53
|
+
Captured: <ISO now>
|
|
54
|
+
Next action: `<rows[0].command>`
|
|
55
|
+
|
|
56
|
+
<rows[0].instructions>
|
|
61
57
|
```
|
|
62
|
-
|
|
58
|
+
(Standalone variant: `## Session handoff — TASK-<N>` heading.)
|
|
59
|
+
- On `no`: skip — do not create an empty file.
|
|
60
|
+
- The committed file is picked up by the Step 1.5 infra-commit offer automatically (it lives under the managed `.gitignore` negation `!.codebyplan/handoff/`).
|
|
63
61
|
|
|
64
|
-
3. **If the queue is empty or `rows[0].command` is empty/idle**: skip
|
|
62
|
+
3. **If the queue is empty or `rows[0].command` is empty/idle**: skip.
|
|
65
63
|
|
|
66
64
|
### Step 1.5: Commit Non-Task Files
|
|
67
65
|
|
|
@@ -146,7 +144,7 @@ You can close this window.
|
|
|
146
144
|
|
|
147
145
|
- **Triggered by**: user invocation (prompted by `/cbp-todo` when no work remains)
|
|
148
146
|
- **Reads**: `.codebyplan/repo.json`; local-first reads (with `npx codebyplan sync` + MCP break-glass): `.codebyplan/state/session/current.json` (Step 1 resolve log), `.codebyplan/state/todos.json` (Step 1.3 mid-work detection + Step 1.5 active-task lookup), `.codebyplan/state/checkpoints/<id>/tasks/<id>/rounds/` (Step 1.5 task-file resolution); `codebyplan session freshness-gate` (Step 1.7 package-freshness gate, without --halt-on-update); `codebyplan session infra-files --json --task-files <csv>` (Step 1.5 infra-file set math)
|
|
149
|
-
- **Writes**: `codebyplan session update-log --id <id> --git-branch <branch
|
|
147
|
+
- **Writes**: `codebyplan session update-log --id <id> --ended-at <now> --git-branch <branch>` (Step 1 finalize — CLI write-through to `.codebyplan/state/session/current.json`; break-glass: MCP `update_session_log`; summary/pending/handoff fields never passed), `codebyplan session create-log` (Step 1 fallback when no log exists; break-glass: MCP `create_session_log`), `codebyplan handoff write --level <checkpoint|standalone> --number <N>` (Step 1.3, mid-work only, committed under `.codebyplan/handoff/`), `codebyplan session update-state --action deactivate` (Step 3 — CLI write-through to `.codebyplan/state/session/state.json`; break-glass: MCP `update_session_state`)
|
|
150
148
|
- **Spawns**: none
|
|
151
149
|
- **Triggers**: none at the skill-contract level. Step 1.5 may invoke `/cbp-git-commit` inline on user approval; Step 1.7 may invoke `/cbp-git-commit` on the `result === 'updated'` path (committing changed `.claude/` and `.codebyplan/` paths).
|
|
152
150
|
- **Paired with**: `/cbp-session-start`
|
|
@@ -78,7 +78,29 @@ The envelope shape:
|
|
|
78
78
|
**Parse and branch**:
|
|
79
79
|
|
|
80
80
|
- `status === 'update_halt'` → print `rendered_block` (the update-halt message) and **STOP**. No further writes, no `/cbp-todo` trigger.
|
|
81
|
-
- Otherwise → print `rendered_block` (the Step 6 output block), then proceed to Step 5.7 and Step 7.
|
|
81
|
+
- Otherwise → print `rendered_block` (the Step 6 output block), then proceed to Step 5.5, Step 5.7, and Step 7.
|
|
82
|
+
|
|
83
|
+
### Step 5.5: Surface Committed Handoff Notes
|
|
84
|
+
|
|
85
|
+
After printing the orchestrator output, surface any committed handoff files from previous sessions. Non-blocking.
|
|
86
|
+
|
|
87
|
+
1. Run `codebyplan handoff status --json` → parse `nonEmpty[]`.
|
|
88
|
+
2. If `nonEmpty` is empty → skip silently.
|
|
89
|
+
3. For each entry in `nonEmpty`, read the content:
|
|
90
|
+
- `repo` → `codebyplan handoff read --level repo`
|
|
91
|
+
- `checkpoint` → `codebyplan handoff read --level checkpoint --number <identifier>`
|
|
92
|
+
- `task` → split identifier `"<NNN>-<T>"` → `codebyplan handoff read --level task --number <NNN> --task <T>`
|
|
93
|
+
- `standalone` → `codebyplan handoff read --level standalone --number <identifier>`
|
|
94
|
+
4. Display:
|
|
95
|
+
```
|
|
96
|
+
Handoff notes from previous session(s):
|
|
97
|
+
|
|
98
|
+
[<level>: <identifier>]
|
|
99
|
+
<content>
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
```
|
|
103
|
+
5. Non-blocking — proceed to Step 5.7 regardless.
|
|
82
104
|
|
|
83
105
|
### Step 5.7: Commit Non-Task Files (Claude-side)
|
|
84
106
|
|
|
@@ -109,7 +131,7 @@ Route from `envelope.next_action`:
|
|
|
109
131
|
## Integration
|
|
110
132
|
|
|
111
133
|
- **Triggered by**: user invocation, `/clear` recovery
|
|
112
|
-
- **Reads**: MCP `health_check` (Step 0 hard gate — stays MCP unconditionally); `codebyplan session start --json` (Steps 1–5.8 — the orchestrator runs `codebyplan whoami --json` for caller identity and reads `.codebyplan/repo.json`, `.codebyplan/git.json`, `.codebyplan/state/session/current.json`, `.codebyplan/state/todos.json`, `.codebyplan/state/checkpoints/` entity files, `scripts/infra-drift.mjs`, `.codebyplan/architecture.json`, `.codebyplan/lsp.json`)
|
|
134
|
+
- **Reads**: MCP `health_check` (Step 0 hard gate — stays MCP unconditionally); `codebyplan session start --json` (Steps 1–5.8 — the orchestrator runs `codebyplan whoami --json` for caller identity and reads `.codebyplan/repo.json`, `.codebyplan/git.json`, `.codebyplan/state/session/current.json`, `.codebyplan/state/todos.json`, `.codebyplan/state/checkpoints/` entity files, `scripts/infra-drift.mjs`, `.codebyplan/architecture.json`, `.codebyplan/lsp.json`); `codebyplan handoff status --json` + `codebyplan handoff read --level <l> ...` (Step 5.5 — committed handoff surfacing)
|
|
113
135
|
- **Writes**: orchestrator calls `codebyplan session update-state --action activate` (Step 7) and `codebyplan session create-log` (Step 8 — user-level; no worktree_id in the body) — both SKIPPED on Step 0 hard-fail and on `status: update_halt`
|
|
114
136
|
- **Spawns**: none
|
|
115
137
|
- **Triggers**: `/cbp-git-commit` (conditional, on user approval at Step 5.7), `envelope.handoff.command` (on `next_action: resume_handoff`), `/cbp-todo` (on `next_action: trigger_todo` or `commit_then_todo`); STOPS with no trigger on `next_action: stop` or `mcp_update_halt`
|
|
@@ -80,6 +80,38 @@ Stop here.
|
|
|
80
80
|
|
|
81
81
|
`task.context.task_testing_output` must exist with `all_passed: true`. If not, surface "Run `/cbp-standalone-task-testing` first" and stop.
|
|
82
82
|
|
|
83
|
+
### Step 2.7: Verify Standalone Task Handoff Is Resolved
|
|
84
|
+
|
|
85
|
+
Run `codebyplan handoff status --json` and parse the output.
|
|
86
|
+
|
|
87
|
+
Check if `nonEmpty[]` contains an entry where `level === 'standalone'` AND `identifier === '{N}'`
|
|
88
|
+
(the bare standalone task number — e.g. `45`).
|
|
89
|
+
|
|
90
|
+
If a matching entry is found, BLOCK with:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
## Cannot Complete Standalone Task — Handoff Unresolved
|
|
94
|
+
|
|
95
|
+
Standalone TASK-[N] has unresolved handoff content at `.codebyplan/handoff/standalone/[N].md`.
|
|
96
|
+
|
|
97
|
+
The handoff file contains scope that has not been resolved. You must clear it before
|
|
98
|
+
completing this task. Three options — pick exactly one:
|
|
99
|
+
|
|
100
|
+
1. **Absorb** — address the pending scope in current work, then clear:
|
|
101
|
+
`codebyplan handoff clear --level standalone --number [N]`
|
|
102
|
+
2. **Defer** — create a new standalone task to cover the scope,
|
|
103
|
+
then clear: `codebyplan handoff clear --level standalone --number [N]`
|
|
104
|
+
3. **Escalate** — move the content to the repo handoff:
|
|
105
|
+
`codebyplan handoff append --level repo --content "<content>"`
|
|
106
|
+
then clear: `codebyplan handoff clear --level standalone --number [N]`
|
|
107
|
+
|
|
108
|
+
Never silently delete handoff content — it represents tracked scope.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
(STOP)
|
|
112
|
+
|
|
113
|
+
If no matching entry: continue to Step 3.
|
|
114
|
+
|
|
83
115
|
### Step 3: Verify QA and File Approval
|
|
84
116
|
|
|
85
117
|
Load `task.qa` and `task.files_changed`:
|