@aperant/framework 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +64 -10
- package/agents/apt-improver.md +99 -0
- package/agents/apt-planner.md +115 -10
- package/dist/__test-helpers/run-cmd.d.mts +4 -2
- package/dist/__test-helpers/run-cmd.d.mts.map +1 -1
- package/dist/__test-helpers/run-cmd.mjs +56 -15
- package/dist/__test-helpers/run-cmd.mjs.map +1 -1
- package/dist/cli/artifacts/classification.d.mts.map +1 -1
- package/dist/cli/artifacts/classification.mjs +10 -0
- package/dist/cli/artifacts/classification.mjs.map +1 -1
- package/dist/cli/ci-watch/lock.d.mts +53 -0
- package/dist/cli/ci-watch/lock.d.mts.map +1 -0
- package/dist/cli/ci-watch/lock.mjs +172 -0
- package/dist/cli/ci-watch/lock.mjs.map +1 -0
- package/dist/cli/ci-watch/state.d.mts +36 -0
- package/dist/cli/ci-watch/state.d.mts.map +1 -0
- package/dist/cli/ci-watch/state.mjs +103 -0
- package/dist/cli/ci-watch/state.mjs.map +1 -0
- package/dist/cli/ci-watch/stop-matrix.d.mts +58 -0
- package/dist/cli/ci-watch/stop-matrix.d.mts.map +1 -0
- package/dist/cli/ci-watch/stop-matrix.mjs +164 -0
- package/dist/cli/ci-watch/stop-matrix.mjs.map +1 -0
- package/dist/cli/cli-wrappers/ci-watch.d.mts +2 -0
- package/dist/cli/cli-wrappers/ci-watch.d.mts.map +1 -0
- package/dist/cli/cli-wrappers/ci-watch.mjs +9 -0
- package/dist/cli/cli-wrappers/ci-watch.mjs.map +1 -0
- package/dist/cli/commands/adr.d.mts +5 -0
- package/dist/cli/commands/adr.d.mts.map +1 -0
- package/dist/cli/commands/adr.mjs +228 -0
- package/dist/cli/commands/adr.mjs.map +1 -0
- package/dist/cli/commands/ci-watch.d.mts +7 -0
- package/dist/cli/commands/ci-watch.d.mts.map +1 -0
- package/dist/cli/commands/ci-watch.mjs +465 -0
- package/dist/cli/commands/ci-watch.mjs.map +1 -0
- package/dist/cli/commands/context.d.mts +7 -0
- package/dist/cli/commands/context.d.mts.map +1 -0
- package/dist/cli/commands/context.mjs +224 -0
- package/dist/cli/commands/context.mjs.map +1 -0
- package/dist/cli/commands/event.d.mts.map +1 -1
- package/dist/cli/commands/event.mjs +59 -24
- package/dist/cli/commands/event.mjs.map +1 -1
- package/dist/cli/commands/host-detect.d.mts +1 -1
- package/dist/cli/commands/host-detect.d.mts.map +1 -1
- package/dist/cli/commands/host-detect.mjs +30 -3
- package/dist/cli/commands/host-detect.mjs.map +1 -1
- package/dist/cli/commands/init.d.mts.map +1 -1
- package/dist/cli/commands/init.mjs +73 -5
- package/dist/cli/commands/init.mjs.map +1 -1
- package/dist/cli/commands/modes.d.mts +13 -0
- package/dist/cli/commands/modes.d.mts.map +1 -0
- package/dist/cli/commands/modes.mjs +220 -0
- package/dist/cli/commands/modes.mjs.map +1 -0
- package/dist/cli/commands/pr-review-audit-fixer.d.mts +41 -2
- package/dist/cli/commands/pr-review-audit-fixer.d.mts.map +1 -1
- package/dist/cli/commands/pr-review-audit-fixer.mjs +91 -14
- package/dist/cli/commands/pr-review-audit-fixer.mjs.map +1 -1
- package/dist/cli/commands/route.d.mts.map +1 -1
- package/dist/cli/commands/route.mjs +11 -2
- package/dist/cli/commands/route.mjs.map +1 -1
- package/dist/cli/commands/task.d.mts.map +1 -1
- package/dist/cli/commands/task.mjs +136 -6
- package/dist/cli/commands/task.mjs.map +1 -1
- package/dist/cli/commands/tokens.d.mts.map +1 -1
- package/dist/cli/commands/tokens.mjs +150 -6
- package/dist/cli/commands/tokens.mjs.map +1 -1
- package/dist/cli/commands/triage.d.mts +8 -0
- package/dist/cli/commands/triage.d.mts.map +1 -0
- package/dist/cli/commands/triage.mjs +259 -0
- package/dist/cli/commands/triage.mjs.map +1 -0
- package/dist/cli/config/post-merge-sweep.d.mts +18 -0
- package/dist/cli/config/post-merge-sweep.d.mts.map +1 -1
- package/dist/cli/config/post-merge-sweep.mjs +48 -3
- package/dist/cli/config/post-merge-sweep.mjs.map +1 -1
- package/dist/cli/consistency/registry.d.mts +11 -0
- package/dist/cli/consistency/registry.d.mts.map +1 -1
- package/dist/cli/consistency/registry.mjs +13 -0
- package/dist/cli/consistency/registry.mjs.map +1 -1
- package/dist/cli/coordination/agent-identity.d.mts +9 -0
- package/dist/cli/coordination/agent-identity.d.mts.map +1 -1
- package/dist/cli/coordination/agent-identity.mjs +11 -0
- package/dist/cli/coordination/agent-identity.mjs.map +1 -1
- package/dist/cli/coordination/event-log.d.mts +27 -0
- package/dist/cli/coordination/event-log.d.mts.map +1 -1
- package/dist/cli/coordination/event-log.mjs +72 -2
- package/dist/cli/coordination/event-log.mjs.map +1 -1
- package/dist/cli/design/frontmatter-schema.d.mts +3 -3
- package/dist/cli/design/frontmatter-schema.d.mts.map +1 -1
- package/dist/cli/design/frontmatter-schema.mjs +3 -1
- package/dist/cli/design/frontmatter-schema.mjs.map +1 -1
- package/dist/cli/dispatch.d.mts.map +1 -1
- package/dist/cli/dispatch.mjs +14 -1
- package/dist/cli/dispatch.mjs.map +1 -1
- package/dist/cli/gate/registry.d.mts +11 -0
- package/dist/cli/gate/registry.d.mts.map +1 -1
- package/dist/cli/gate/registry.mjs +13 -0
- package/dist/cli/gate/registry.mjs.map +1 -1
- package/dist/cli/help.d.mts.map +1 -1
- package/dist/cli/help.mjs +1 -0
- package/dist/cli/help.mjs.map +1 -1
- package/dist/cli/host/detect.d.mts +1 -0
- package/dist/cli/host/detect.d.mts.map +1 -1
- package/dist/cli/host/detect.mjs +5 -0
- package/dist/cli/host/detect.mjs.map +1 -1
- package/dist/cli/route/envelope.d.mts +68 -4
- package/dist/cli/route/envelope.d.mts.map +1 -1
- package/dist/cli/route/envelope.mjs +140 -103
- package/dist/cli/route/envelope.mjs.map +1 -1
- package/dist/cli/route/skill-discover.d.mts +11 -0
- package/dist/cli/route/skill-discover.d.mts.map +1 -1
- package/dist/cli/route/skill-discover.mjs +46 -1
- package/dist/cli/route/skill-discover.mjs.map +1 -1
- package/dist/cli/skill-author/contract.d.mts +20 -0
- package/dist/cli/skill-author/contract.d.mts.map +1 -1
- package/dist/cli/skill-author/contract.mjs +27 -0
- package/dist/cli/skill-author/contract.mjs.map +1 -1
- package/dist/cli/skill-author/skill-template.d.mts.map +1 -1
- package/dist/cli/skill-author/skill-template.mjs +4 -3
- package/dist/cli/skill-author/skill-template.mjs.map +1 -1
- package/dist/cli/task/worktree-cleanup.d.mts +9 -1
- package/dist/cli/task/worktree-cleanup.d.mts.map +1 -1
- package/dist/cli/task/worktree-cleanup.mjs +190 -9
- package/dist/cli/task/worktree-cleanup.mjs.map +1 -1
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/agents/apt-planner.md +1 -1
- package/dist/plugin/skills/apt/SKILL.md +111 -5
- package/dist/plugin/skills/apt-author-skill/SKILL.md +11 -0
- package/dist/plugin/skills/apt-bootstrap/SKILL.md +1 -0
- package/dist/plugin/skills/apt-classify/SKILL.md +1 -0
- package/dist/plugin/skills/apt-close-task/SKILL.md +1 -0
- package/dist/plugin/skills/apt-create-docs/SKILL.md +1 -0
- package/dist/plugin/skills/apt-debug/SKILL.md +2 -0
- package/dist/plugin/skills/apt-design/SKILL.md +2 -0
- package/dist/plugin/skills/apt-discuss/SKILL.md +2 -0
- package/dist/plugin/skills/apt-docs/SKILL.md +2 -0
- package/dist/plugin/skills/apt-execute/SKILL.md +1 -0
- package/dist/plugin/skills/apt-mockup/SKILL.md +2 -0
- package/dist/plugin/skills/apt-pause/SKILL.md +1 -0
- package/dist/plugin/skills/apt-personas/SKILL.md +1 -0
- package/dist/plugin/skills/apt-plan/SKILL.md +2 -0
- package/dist/plugin/skills/apt-pr-review/SKILL.md +1 -0
- package/dist/plugin/skills/apt-quick/SKILL.md +2 -0
- package/dist/plugin/skills/apt-resume/SKILL.md +1 -0
- package/dist/plugin/skills/apt-review/SKILL.md +1 -0
- package/dist/plugin/skills/apt-roadmap/SKILL.md +1 -0
- package/dist/plugin/skills/apt-roundtable/SKILL.md +2 -0
- package/dist/plugin/skills/apt-run/SKILL.md +1 -0
- package/dist/plugin/skills/apt-scan/SKILL.md +1 -0
- package/dist/plugin/skills/apt-setup/SKILL.md +1 -0
- package/dist/plugin/skills/apt-ship/SKILL.md +6 -5
- package/dist/plugin/skills/apt-stress-test/SKILL.md +1 -0
- package/dist/plugin/skills/apt-terminal/SKILL.md +1 -0
- package/dist/plugin/skills/apt-update/SKILL.md +5 -0
- package/dist/plugin/skills/apt-verify/SKILL.md +1 -0
- package/dist/plugin/skills/apt-verify-proof/SKILL.md +1 -0
- package/dist/types/config.d.ts +85 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +125 -122
- package/prompts/coder.md +2 -0
- package/prompts/planner.md +12 -0
- package/prompts/spec_writer.md +9 -0
- package/skills/apt/SKILL.md +112 -5
- package/skills/apt-author-skill/SKILL.md +11 -0
- package/skills/apt-bootstrap/SKILL.md +1 -0
- package/skills/apt-classify/SKILL.md +1 -0
- package/skills/apt-close-task/SKILL.md +33 -1
- package/skills/apt-create-docs/SKILL.md +1 -0
- package/skills/apt-debug/SKILL.md +41 -6
- package/skills/apt-debug/appendices/diagnose-discipline.md +119 -0
- package/skills/apt-design/SKILL.md +2 -0
- package/skills/apt-diagram/SKILL.md +342 -0
- package/skills/apt-diagram/appendices/design-discipline.md +97 -0
- package/skills/apt-discuss/SKILL.md +27 -0
- package/skills/apt-discuss/appendices/grill-discipline.md +104 -0
- package/skills/apt-discuss/appendices/zoom-out-helper.md +79 -0
- package/skills/apt-docs/SKILL.md +2 -0
- package/skills/apt-execute/SKILL.md +49 -5
- package/skills/apt-execute/appendices/tdd-mode.md +107 -0
- package/skills/apt-improve/DEEPENING.md +84 -0
- package/skills/apt-improve/INTERFACE-DESIGN.md +97 -0
- package/skills/apt-improve/LANGUAGE.md +104 -0
- package/skills/apt-improve/SKILL.md +141 -0
- package/skills/apt-mockup/SKILL.md +2 -0
- package/skills/apt-pause/SKILL.md +1 -0
- package/skills/apt-personas/SKILL.md +1 -0
- package/skills/apt-plan/SKILL.md +149 -4
- package/skills/apt-planner.md +42 -1
- package/skills/apt-pr-review/SKILL.md +47 -16
- package/skills/apt-prototype/LOGIC.md +109 -0
- package/skills/apt-prototype/SKILL.md +143 -0
- package/skills/apt-prototype/UI.md +90 -0
- package/skills/apt-quick/SKILL.md +32 -0
- package/skills/apt-resume/SKILL.md +1 -0
- package/skills/apt-review/SKILL.md +3 -0
- package/skills/apt-roadmap/SKILL.md +1 -0
- package/skills/apt-roundtable/SKILL.md +2 -0
- package/skills/apt-run/SKILL.md +33 -4
- package/skills/apt-scan/SKILL.md +1 -0
- package/skills/apt-setup/SKILL.md +129 -2
- package/skills/apt-ship/SKILL.md +52 -4
- package/skills/apt-stress-test/SKILL.md +1 -0
- package/skills/apt-terminal/SKILL.md +1 -0
- package/skills/apt-triage/AGENT-BRIEF.md +84 -0
- package/skills/apt-triage/OUT-OF-SCOPE.md +75 -0
- package/skills/apt-triage/SKILL.md +169 -0
- package/skills/apt-update/SKILL.md +3 -0
- package/skills/apt-verify/SKILL.md +4 -0
- package/skills/apt-verify-proof/SKILL.md +4 -0
- package/skills/apt-watch-ci/SKILL.md +163 -0
- package/skills/apt-zoom-out/SKILL.md +130 -0
- package/src/cli/artifacts/classification.mjs +10 -0
- package/src/cli/ci-watch/lock.mjs +178 -0
- package/src/cli/ci-watch/state.mjs +103 -0
- package/src/cli/ci-watch/stop-matrix.mjs +181 -0
- package/src/cli/cli-wrappers/ci-watch.mjs +9 -0
- package/src/cli/commands/adr.mjs +243 -0
- package/src/cli/commands/ci-watch.mjs +503 -0
- package/src/cli/commands/context.mjs +244 -0
- package/src/cli/commands/event.mjs +63 -24
- package/src/cli/commands/host-detect.mjs +33 -7
- package/src/cli/commands/init.mjs +83 -5
- package/src/cli/commands/modes.mjs +215 -0
- package/src/cli/commands/pr-review-audit-fixer.mjs +95 -16
- package/src/cli/commands/route.mjs +11 -2
- package/src/cli/commands/task.mjs +152 -18
- package/src/cli/commands/tokens.mjs +157 -6
- package/src/cli/commands/triage.mjs +277 -0
- package/src/cli/config/post-merge-sweep.mjs +49 -3
- package/src/cli/consistency/registry.mjs +14 -0
- package/src/cli/coordination/agent-identity.mjs +12 -0
- package/src/cli/coordination/event-log.mjs +73 -2
- package/src/cli/design/frontmatter-schema.mjs +3 -1
- package/src/cli/dispatch.mjs +15 -1
- package/src/cli/gate/registry.mjs +14 -0
- package/src/cli/help.mjs +1 -0
- package/src/cli/host/detect.mjs +5 -0
- package/src/cli/route/envelope.mjs +140 -106
- package/src/cli/route/skill-discover.mjs +46 -1
- package/src/cli/skill-author/contract.mjs +29 -0
- package/src/cli/skill-author/skill-template.mjs +4 -3
- package/src/cli/task/worktree-cleanup.mjs +191 -9
- package/templates/adr-format.md +56 -0
- package/templates/config.json +4 -0
- package/templates/context-format.md +34 -0
package/skills/apt/SKILL.md
CHANGED
|
@@ -9,6 +9,7 @@ user_invocable: true
|
|
|
9
9
|
internal: false
|
|
10
10
|
spawns_agent: false
|
|
11
11
|
agent_name: null
|
|
12
|
+
task_context: none
|
|
12
13
|
default_execution_mode: auto
|
|
13
14
|
execution_modes:
|
|
14
15
|
- auto
|
|
@@ -129,6 +130,7 @@ Show available commands table:
|
|
|
129
130
|
| `apt:resume` | Restore context after session break |
|
|
130
131
|
| `apt:pause` | Human-initiated handoff — save state when YOU need to stop |
|
|
131
132
|
| `apt:ship` | Create PR with traceability |
|
|
133
|
+
| `apt:close-task` | Post-merge closer — confirm PR merged, flip phase, drain narration ledger |
|
|
132
134
|
| `apt:setup` | Change framework preferences |
|
|
133
135
|
|
|
134
136
|
Show current state summary and autonomy flags (`--supervised`, `--guided`, `--autonomous`, `--yolo`).
|
|
@@ -139,13 +141,118 @@ Show current state summary and autonomy flags (`--supervised`, `--guided`, `--au
|
|
|
139
141
|
|
|
140
142
|
The user invoked a specific skill by name (e.g., `/apt plan`, `/apt resume`,
|
|
141
143
|
`/apt:ship`). The router matched the first word against the installed skill
|
|
142
|
-
set and filled in `skill`, `skill_args`, `spawn_agent`,
|
|
144
|
+
set and filled in `skill`, `skill_args`, `spawn_agent`, `agent`, AND
|
|
145
|
+
`task_context` + (optional) `default_track`.
|
|
143
146
|
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
Dispatch on `task_context` — never just on `spawn_agent`. The four-branch
|
|
148
|
+
policy below is hardcoded contract; do NOT improvise. See
|
|
149
|
+
`docs/frameworks/spec-gaps.md#g25` for the defect that motivated this.
|
|
146
150
|
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
### Missing `task_context` — fail-closed
|
|
152
|
+
|
|
153
|
+
When the envelope's `task_context` is null (the `?? null` fallback in
|
|
154
|
+
`route.mjs:skillIndex.taskContextOf`), print verbatim and STOP. Do NOT
|
|
155
|
+
invoke the skill:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
[APT] ERROR — skill "apt:{skill}" has no task_context declared in SKILL.md frontmatter.
|
|
159
|
+
Cannot dispatch safely until the policy is set. Run /apt:author-skill validate
|
|
160
|
+
packages/framework/skills/apt-{skill}/SKILL.md to see required keys.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Note:** In practice, a skill missing `task_context` is dropped by
|
|
164
|
+
`discoverSkills` during the Zod schema validation step and will never reach
|
|
165
|
+
the skill-passthrough branch — it will be absent from `knownSlugs`. The
|
|
166
|
+
user sees the skill disappear silently from routing; run
|
|
167
|
+
`apt-tools route .` to surface dropped skills logged to
|
|
168
|
+
`.aperant/logs/route-dropped.jsonl`. The `task_context: null` path is
|
|
169
|
+
reachable if the field is marked optional in a future schema version —
|
|
170
|
+
this error fires in that case.
|
|
171
|
+
|
|
172
|
+
### `task_context = none`
|
|
173
|
+
|
|
174
|
+
No task semantics. Invoke the skill directly with `skill_args` (or spawn
|
|
175
|
+
`agent` when `spawn_agent` is true). No `task create`, no worktree banner.
|
|
176
|
+
|
|
177
|
+
### `task_context = self-managed`
|
|
178
|
+
|
|
179
|
+
The skill manages its own task / worktree lifecycle (e.g. `apt:run` calls
|
|
180
|
+
`task create` in its own Step 2; `apt:pr-review` sets up a PR-scoped
|
|
181
|
+
worktree). Dispatch identically to `none` — the skill's own SKILL.md is
|
|
182
|
+
responsible for any task record + worktree banner.
|
|
183
|
+
|
|
184
|
+
### `task_context = create-new`
|
|
185
|
+
|
|
186
|
+
Resolve the track, then create a fresh task record before invoking the skill.
|
|
187
|
+
|
|
188
|
+
**Track resolution chain (first match wins):**
|
|
189
|
+
|
|
190
|
+
1. Explicit user flag in `skill_args` — `--quick` → `QUICK`, `--deep` → `DEEP`,
|
|
191
|
+
`--debug` → `DEBUG`.
|
|
192
|
+
2. `envelope.default_track` if present (the skill's declared default).
|
|
193
|
+
3. Per-slug hardcoded fallback:
|
|
194
|
+
- `quick` → `QUICK`
|
|
195
|
+
- `debug` → `DEBUG`
|
|
196
|
+
- `plan` → `STANDARD`
|
|
197
|
+
- everything else with `task_context: create-new` → `STANDARD`
|
|
198
|
+
|
|
199
|
+
Then run:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
node packages/framework/bin/apt-tools.mjs task create . --description "{slug}" --track {track} --autonomy {autonomy} [--scope {scope}]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Security note:** Do NOT interpolate `{skill_args}` directly into `--description "..."`. `skill_args` is verbatim user input and can contain double-quote characters that break out of the argument boundary and inject extra flags (e.g. `--autonomy`, `--scope`). The task slug is sufficient as the description; `skill_args` is passed to the skill separately after the task record is created.
|
|
206
|
+
|
|
207
|
+
(Use `--scope framework` only when the user is on a framework-scoped task —
|
|
208
|
+
otherwise omit and let the default `project` scope apply.)
|
|
209
|
+
|
|
210
|
+
Parse `task_id`, `task_dir`, and (if present) `worktree.worktree_path` /
|
|
211
|
+
`worktree.branch` / `worktree.base_branch` from the result. Print the
|
|
212
|
+
worktree banner when `worktree` is returned:
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
[APT] Working in isolated worktree: {worktree_path}
|
|
216
|
+
[APT] Task branch: {branch} (from {base_branch})
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Then invoke `apt:{skill}` with `skill_args` + the new task context
|
|
220
|
+
(`task_id`, `task_dir`, `worktree_path`). When `spawn_agent` is true, spawn
|
|
221
|
+
`agent` with the same context.
|
|
222
|
+
|
|
223
|
+
### `task_context = require-existing`
|
|
224
|
+
|
|
225
|
+
Resolve which active task this invocation refers to, then dispatch. Read
|
|
226
|
+
`state.active_tasks` from `.aperant/state.json`.
|
|
227
|
+
|
|
228
|
+
**Active-task resolution chain (first match wins):**
|
|
229
|
+
|
|
230
|
+
1. `--task-id <id>` flag present in `skill_args` → use it. If `<id>` is not
|
|
231
|
+
in `state.active_tasks`, error and stop.
|
|
232
|
+
2. `state.active_tasks` has exactly one entry AND that entry's
|
|
233
|
+
`lifecycle_phase` is non-terminal (`planning`, `executing`, `verifying`,
|
|
234
|
+
`reviewing`) → use it. If the single entry is in a terminal phase
|
|
235
|
+
(`shipped-pending-merge` or `rejected`), fall through to step 4.
|
|
236
|
+
3. `state.active_tasks` has more than one entry with exactly one in a
|
|
237
|
+
non-terminal lifecycle phase (`planning`, `executing`, `verifying`,
|
|
238
|
+
`reviewing`) → use it.
|
|
239
|
+
(Terminal phases in `active_tasks` are `shipped-pending-merge` and
|
|
240
|
+
`rejected`. Note: `completed` tasks are removed from `active_tasks`
|
|
241
|
+
entirely at close and can never appear here.)
|
|
242
|
+
4. Otherwise, print the numbered menu and STOP. Auto-mode (autonomy 2/3)
|
|
243
|
+
does NOT bypass this prompt — multi-task ambiguity is the user's call,
|
|
244
|
+
never the framework's guess:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
[APT] Multiple active tasks — pick one with `--task-id <id>`:
|
|
248
|
+
1. {task-id-1} {description} ({lifecycle_phase})
|
|
249
|
+
2. {task-id-2} {description} ({lifecycle_phase})
|
|
250
|
+
...
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Once resolved, print the worktree banner if the task has a `worktree_path`,
|
|
254
|
+
then invoke `apt:{skill}` with `skill_args` + the resolved `task_id`. When
|
|
255
|
+
`spawn_agent` is true, spawn `agent` with the same context.
|
|
149
256
|
|
|
150
257
|
---
|
|
151
258
|
|
|
@@ -9,6 +9,7 @@ user_invocable: true
|
|
|
9
9
|
internal: false
|
|
10
10
|
spawns_agent: false
|
|
11
11
|
agent_name: null
|
|
12
|
+
task_context: create-new
|
|
12
13
|
default_execution_mode: step
|
|
13
14
|
execution_modes:
|
|
14
15
|
- auto
|
|
@@ -129,6 +130,16 @@ the author sees the full checklist of gaps to fill. Group by section:
|
|
|
129
130
|
The generated structural test only checks tags and numbered steps — the
|
|
130
131
|
TODOs are the semantic gaps the author must close.
|
|
131
132
|
|
|
133
|
+
**Required frontmatter field — `task_context`.** The scaffold ships with
|
|
134
|
+
`task_context: create-new` as the safest default (the new skill will get a
|
|
135
|
+
fresh task record + worktree via `apt-tools task create` when invoked as
|
|
136
|
+
`/apt <slug>`). Verify this is correct for your skill before merging — the
|
|
137
|
+
allowed values are `create-new | require-existing | self-managed | none`.
|
|
138
|
+
See `packages/framework/docs/skill-passthrough.md` for the four-policy
|
|
139
|
+
contract and the orchestrator dispatch behavior. Missing or wrong values
|
|
140
|
+
are caught by the structural test in
|
|
141
|
+
`packages/framework/src/__tests__/skill-frontmatter-task-context.test.ts`.
|
|
142
|
+
|
|
132
143
|
## 4. Show the Structural Test
|
|
133
144
|
|
|
134
145
|
Read the generated structural test file and echo its contents so the
|
|
@@ -9,12 +9,13 @@ user_invocable: true
|
|
|
9
9
|
internal: false
|
|
10
10
|
spawns_agent: false
|
|
11
11
|
agent_name: null
|
|
12
|
+
task_context: require-existing
|
|
12
13
|
default_execution_mode: auto
|
|
13
14
|
execution_modes:
|
|
14
15
|
- auto
|
|
15
16
|
- step
|
|
16
17
|
allowed-tools: "Bash, Read, Grep, Glob, Write"
|
|
17
|
-
argument-hint: "apt:close-task [--all | --task <id>]"
|
|
18
|
+
argument-hint: "apt:close-task [--all | --task <id>] [--narrate-only]"
|
|
18
19
|
gates: []
|
|
19
20
|
---
|
|
20
21
|
<objective>
|
|
@@ -69,6 +70,7 @@ Internally, close-merged does:
|
|
|
69
70
|
a. `apt-tools task close . --id {task-id} --verdict approved` (respects `task_isolation.auto_close_phase`).
|
|
70
71
|
b. Strips `config.pr_review.authorship_overrides['pr-{N}']` if present.
|
|
71
72
|
c. Emits `task.closed.merged` event.
|
|
73
|
+
d. Appends a `pending_narration[]` ledger row to `.aperant/state.json` so `--narrate-only` (see §4) can pick it up. Additive only; never blocks the close.
|
|
72
74
|
3. When `state !== 'MERGED'`, the task stays in `shipped-pending-merge` with a skip reason the user can inspect.
|
|
73
75
|
|
|
74
76
|
## 2.5 Narrate completed phases (moved from /apt:ship in C56 B5)
|
|
@@ -84,6 +86,8 @@ For each entry in the close-merged envelope's `closed[]` whose record has a non-
|
|
|
84
86
|
|
|
85
87
|
Do NOT wait on the narrator. Its status lands in `.aperant/digests/.last-run.json`. Skip narrator spawn entirely when `closed[]` is empty or no closed item has a phase_id.
|
|
86
88
|
|
|
89
|
+
After step 2.5 spawns narrators for the just-closed candidates, the skill ALSO drains `state.pending_narration[]` (entries the passive sweep parked there) — see §4.
|
|
90
|
+
|
|
87
91
|
## 3. Summary
|
|
88
92
|
|
|
89
93
|
close-merged emits an envelope with:
|
|
@@ -94,6 +98,34 @@ close-merged emits an envelope with:
|
|
|
94
98
|
|
|
95
99
|
Report the summary verbatim. If anything landed in `skipped[]` with a recoverable reason (`offline`, `rate_limited`), suggest the user re-run once the network clears.
|
|
96
100
|
|
|
101
|
+
## 4. Narrate-only mode
|
|
102
|
+
|
|
103
|
+
When invoked with `--narrate-only`, skip §1 (no `gh pr view` polling) and §2 (no destructive close path). The deterministic close already ran via the passive post-merge sweep — your job is to drain the `state.pending_narration[]` ledger the sweep parked.
|
|
104
|
+
|
|
105
|
+
Flags:
|
|
106
|
+
- `--narrate-only --all` (default when `--narrate-only` is bare) — drain every ledger entry.
|
|
107
|
+
- `--narrate-only --task <id>` — drain only the entry for `<id>`.
|
|
108
|
+
|
|
109
|
+
Per ledger entry `{ task_id, scope, phase_id, closed_at, pr_number }`:
|
|
110
|
+
|
|
111
|
+
1. Run `apt-tools features-audit . --apply-stubs --task <task_id>` so the feature registry catches whatever the closed task introduced. If the subprocess exits non-zero, skip the entry with `reason: 'features-audit-failed'` — never block narration on registry update.
|
|
112
|
+
2. When `phase_id` is non-null, spawn `apt-team-docs-narrator` (background, fire-and-forget) using the same shape as §2.5: `subagent_type: apt-team-docs-narrator`, `run_in_background: true`, `description: Narrate shipped phase {phase_id}`, `prompt: Run in phase-ship mode with --phase {phase_id} --scope {scope}.`. When `phase_id` is null, skip the spawn with `reason: 'no-phase-id'` (quick tasks have no phase to narrate).
|
|
113
|
+
3. On successful spawn (or successful no-phase skip), drain the row via `apt-tools task narration-drain . --task <task_id>` which acquires `withFileLock(state.json)` and removes the matching `pending_narration[]` entry. On spawn failure, leave the row in place with `reason: 'narrator-spawn-failed'` so the user can re-invoke.
|
|
114
|
+
|
|
115
|
+
Emit a summary envelope:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"status": "ok",
|
|
120
|
+
"command": "close-task-narrate-only",
|
|
121
|
+
"narrated": [{ "task_id": "<id>", "phase_id": "<p|null>", "scope": "<s>" }],
|
|
122
|
+
"skipped": [{ "task_id": "<id>", "reason": "no-phase-id|features-audit-failed|narrator-spawn-failed" }],
|
|
123
|
+
"remaining": <ledger.length>
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The regular `apt:close-task` flow ALSO falls through to this drain step at the tail of §2.5 — so users who run the skill manually after the sweep get narration without remembering the flag. The `--narrate-only` flag exists for the explicit "drain only, don't poll gh" case.
|
|
128
|
+
|
|
97
129
|
</process>
|
|
98
130
|
|
|
99
131
|
<notes>
|
|
@@ -9,6 +9,8 @@ user_invocable: true
|
|
|
9
9
|
internal: false
|
|
10
10
|
spawns_agent: false
|
|
11
11
|
agent_name: null
|
|
12
|
+
task_context: create-new
|
|
13
|
+
default_track: DEBUG
|
|
12
14
|
default_execution_mode: auto
|
|
13
15
|
execution_modes:
|
|
14
16
|
- auto
|
|
@@ -19,6 +21,19 @@ gates: []
|
|
|
19
21
|
---
|
|
20
22
|
<objective>
|
|
21
23
|
Debug an issue using the scientific method: observe symptoms, form hypotheses, test them systematically, and reach a conclusion. State persists across context resets via `.aperant/debug/{session-id}/DEBUG.md`.
|
|
24
|
+
|
|
25
|
+
**Diagnose-discipline posture loader (Pocock adoption AC10).** You MUST
|
|
26
|
+
load `appendices/diagnose-discipline.md` into reasoning context at
|
|
27
|
+
session start. It carries the 6-phase loop (Reproduce → Minimise →
|
|
28
|
+
Hypothesise → Instrument → Fix → Regression-test) and the **Phase-1
|
|
29
|
+
prerequisite** constraint: do NOT advance from Observe (Section 2) to
|
|
30
|
+
Hypothesize (Section 3) until DEBUG.md records `repro_loop_verified:
|
|
31
|
+
true`. The appendix carries the rationale, the anti-pattern list
|
|
32
|
+
(sprint-to-hypothesis, stack-trace cargo cult, test-the-fix-not-the-bug,
|
|
33
|
+
logging-without-minimising), and the distinction between Phase 1
|
|
34
|
+
"reproduce" and Phase 2 "minimise". Open question #1 was verified —
|
|
35
|
+
apt:debug's existing Section 2 conflates symptom-gathering with
|
|
36
|
+
reproduction, so loading this appendix is non-trivial.
|
|
22
37
|
</objective>
|
|
23
38
|
|
|
24
39
|
<your_environment>
|
|
@@ -57,18 +72,38 @@ mkdir -p .aperant/debug/{session-id}
|
|
|
57
72
|
mkdir -p .aperant/debug/{session-id}/checkpoints
|
|
58
73
|
```
|
|
59
74
|
|
|
60
|
-
## 2. Observe — Gather Symptoms
|
|
75
|
+
## 2. Observe — Gather Symptoms + Phase 1 (Reproduce — prerequisite)
|
|
76
|
+
|
|
77
|
+
Collect all available evidence about the bug, then establish a
|
|
78
|
+
**reliable repro loop as a hard prerequisite** before advancing to
|
|
79
|
+
Section 3 (Hypothesize). The Phase-1-reproduce constraint comes from
|
|
80
|
+
`appendices/diagnose-discipline.md` and is load-bearing — you do NOT
|
|
81
|
+
emit any hypothesis until DEBUG.md records `repro_loop_verified: true`.
|
|
61
82
|
|
|
62
|
-
|
|
83
|
+
Sub-steps (the existing 4 + 1 prerequisite check):
|
|
63
84
|
|
|
64
85
|
1. **User description:** Extract from `$ARGUMENTS` what the issue is
|
|
65
86
|
2. **Error output:** If the user provided error messages, record them verbatim
|
|
66
|
-
3. **
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
87
|
+
3. **Phase 1 — Reproduce (prerequisite, per appendices/diagnose-discipline.md):**
|
|
88
|
+
Establish a reliable repro loop. The loop MUST be:
|
|
89
|
+
- Deterministic (same input → same failure)
|
|
90
|
+
- Cheap (under 10 seconds preferred; certainly under 60)
|
|
91
|
+
- Minimal (no irrelevant setup; just enough to fail)
|
|
92
|
+
Record the repro command + verification in DEBUG.md as
|
|
93
|
+
`repro_command: "..."` and `repro_loop_verified: true`. If you
|
|
94
|
+
cannot reproduce reliably, do NOT proceed to Section 3 — instead,
|
|
95
|
+
loop here: gather more environment context, add logging to the
|
|
96
|
+
target environment, ask the user for repro details. Hypothesis-driven
|
|
97
|
+
debugging without a reliable repro is just hope, dressed up as
|
|
98
|
+
method.
|
|
70
99
|
4. **Context:** Note environment details (branch, recent commits, dependencies)
|
|
71
100
|
|
|
101
|
+
After Phase 1 succeeds, run **Phase 2 — Minimise** (also from the
|
|
102
|
+
appendix): strip the repro to the smallest case that still fails.
|
|
103
|
+
Record the minimised repro in DEBUG.md as `minimised_repro: "..."`.
|
|
104
|
+
Phase 2 prevents Sections 3-5 from anchoring on the first plausible
|
|
105
|
+
cause inside a 200-line repro.
|
|
106
|
+
|
|
72
107
|
```bash
|
|
73
108
|
git log --oneline -10
|
|
74
109
|
git diff --stat
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Adapted from Matt Pocock's MIT-licensed skill suite:
|
|
3
|
+
https://github.com/mattpocock/skills/blob/main/skills/engineering/diagnose
|
|
4
|
+
Licensed under MIT. Modifications: ported as an apt:debug posture loader
|
|
5
|
+
so the 6-phase loop attaches to the existing 5-phase apt:debug body
|
|
6
|
+
without forking apt:debug's control flow. Aligned with apt:debug's
|
|
7
|
+
DEBUG.md state file and checkpoint conventions.
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# Diagnose Discipline — apt:debug posture loader (6-phase loop)
|
|
11
|
+
|
|
12
|
+
This appendix loads into `apt:debug`'s reasoning context as a posture
|
|
13
|
+
upgrade. The existing apt:debug body has 5 phases (Observe → Hypothesize
|
|
14
|
+
→ Checkpoint → Test → Conclude) but its Section 2 "Observe" conflates
|
|
15
|
+
symptom-gathering with reproduction. Open question #1 was verified — the
|
|
16
|
+
gap is real, the appendix is non-trivial.
|
|
17
|
+
|
|
18
|
+
This appendix carries the 6-phase Pocock discipline. The skill body
|
|
19
|
+
loads it and uses Phase 1 (Reproduce) as a **hard prerequisite** before
|
|
20
|
+
advancing from Observe to Hypothesize.
|
|
21
|
+
|
|
22
|
+
## The 6-phase loop
|
|
23
|
+
|
|
24
|
+
1. **Reproduce.** Establish a reliable repro loop. Until you can
|
|
25
|
+
trigger the bug at will, no hypothesis is testable — you'd be
|
|
26
|
+
guessing about a moving target. The loop MUST be:
|
|
27
|
+
- Deterministic (same input → same failure)
|
|
28
|
+
- Cheap (under 10 seconds preferred; certainly under 60)
|
|
29
|
+
- Minimal (no irrelevant setup; just enough to fail)
|
|
30
|
+
|
|
31
|
+
2. **Minimise.** Once you can repro, strip the repro to the smallest
|
|
32
|
+
case. Remove every component that isn't load-bearing for the
|
|
33
|
+
failure. A 200-line repro is a hypothesis space; a 10-line repro is
|
|
34
|
+
a near-confirmed cause.
|
|
35
|
+
|
|
36
|
+
3. **Hypothesise.** ONLY after minimise: write 3-5 ranked falsifiable
|
|
37
|
+
hypotheses. Each hypothesis must:
|
|
38
|
+
- Predict an observable consequence
|
|
39
|
+
- Be testable by changing ONE variable
|
|
40
|
+
- Be ordered by prior probability + cost-to-test
|
|
41
|
+
|
|
42
|
+
4. **Instrument.** Add the minimum logging / breakpoint / probe to test
|
|
43
|
+
the highest-ranked hypothesis. Change ONE variable. Re-run the
|
|
44
|
+
minimal repro. Observe.
|
|
45
|
+
|
|
46
|
+
5. **Fix.** When a hypothesis confirms, write the fix. Run the minimal
|
|
47
|
+
repro again — it must now PASS (no more failure). Run the full test
|
|
48
|
+
suite — no new regressions.
|
|
49
|
+
|
|
50
|
+
6. **Regression-test.** Write a test that pins the fix. The test must
|
|
51
|
+
fail on the pre-fix code and pass on the fixed code. This is what
|
|
52
|
+
stops the bug from coming back six months later when someone
|
|
53
|
+
refactors.
|
|
54
|
+
|
|
55
|
+
## The Phase-1 prerequisite (load-bearing)
|
|
56
|
+
|
|
57
|
+
apt:debug's body enforces this constraint: **you do NOT advance from
|
|
58
|
+
Observe to Hypothesize until Phase 1 produces a reliable repro loop**.
|
|
59
|
+
|
|
60
|
+
If you cannot reproduce reliably:
|
|
61
|
+
|
|
62
|
+
- Spend the budget on getting the repro working before guessing causes
|
|
63
|
+
- Add logging in the production / target environment to gather more
|
|
64
|
+
evidence of the failure trigger
|
|
65
|
+
- Ask the user for more context (when does it happen? on what input?
|
|
66
|
+
intermittent or consistent?)
|
|
67
|
+
|
|
68
|
+
It is better to spend 80% of your debug budget on the repro and 20% on
|
|
69
|
+
the fix than to spend 100% guessing at causes. Hypothesis-driven
|
|
70
|
+
debugging without a reliable repro is just hope, dressed up as method.
|
|
71
|
+
|
|
72
|
+
## Distinguishing Phase 1 from apt:debug's existing "Observe"
|
|
73
|
+
|
|
74
|
+
apt:debug's existing Section 2 collects symptom evidence (error
|
|
75
|
+
messages, user reports, environment). That's still valuable — it's the
|
|
76
|
+
*input* to Phase 1. But "I read the error and inferred the cause"
|
|
77
|
+
DOES NOT count as a repro. The repro is a callable artifact: a
|
|
78
|
+
command-line invocation, a test, a script — something the agent can
|
|
79
|
+
run on demand to trigger the failure.
|
|
80
|
+
|
|
81
|
+
## Distinguishing Phase 2 (Minimise) from Phase 3 (Hypothesise)
|
|
82
|
+
|
|
83
|
+
These are different mental modes. Minimise asks "what's the smallest
|
|
84
|
+
thing that still fails?" — a reductive activity. Hypothesise asks
|
|
85
|
+
"WHY does it fail?" — an explanatory activity. Pocock's discipline
|
|
86
|
+
separates them because skipping Phase 2 and going straight from "I can
|
|
87
|
+
repro" to "here's why" tends to anchor on the first plausible cause
|
|
88
|
+
and miss alternatives.
|
|
89
|
+
|
|
90
|
+
## Practical consequence for the apt:debug body
|
|
91
|
+
|
|
92
|
+
When this appendix is loaded, apt:debug's Section 2 (Observe) renames
|
|
93
|
+
its "Reproduce" sub-step to **Phase 1 (Reproduce — prerequisite)** and
|
|
94
|
+
adds a gate: the skill MUST NOT emit any hypothesis (Section 3) until
|
|
95
|
+
DEBUG.md records a `repro_loop_verified: true` field.
|
|
96
|
+
|
|
97
|
+
The appendix's Phase 2 (Minimise) becomes a new sub-section between
|
|
98
|
+
apt:debug's Section 2 (Observe) and Section 3 (Hypothesize). DEBUG.md
|
|
99
|
+
gains a `minimised_repro` field.
|
|
100
|
+
|
|
101
|
+
apt:debug's Sections 3-5 (Hypothesize / Checkpoint / Test / Conclude)
|
|
102
|
+
align with Phases 3-6 of this appendix; no structural change there.
|
|
103
|
+
|
|
104
|
+
## Anti-patterns this discipline prevents
|
|
105
|
+
|
|
106
|
+
- **Sprint-to-hypothesis.** Agent reads the error, picks the first
|
|
107
|
+
plausible cause, writes a fix, and ships. The bug comes back two
|
|
108
|
+
days later under different inputs.
|
|
109
|
+
- **Stack-trace cargo cult.** Agent assumes the line at the top of the
|
|
110
|
+
stack trace IS the bug. Often it's an effect, not a cause.
|
|
111
|
+
- **Test the fix, not the bug.** Agent writes a test that proves the
|
|
112
|
+
fix works but doesn't exercise the original buggy condition. The
|
|
113
|
+
regression test is a no-op against the future regression.
|
|
114
|
+
- **Logging without minimising.** Agent adds 50 log lines in a 200-line
|
|
115
|
+
repro, then drowns in noise. Minimise first; THEN instrument the
|
|
116
|
+
minimal repro.
|
|
117
|
+
|
|
118
|
+
Loading this appendix and following its Phase 1 prerequisite cuts most
|
|
119
|
+
of these failure modes by structural constraint.
|