@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.
Files changed (244) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +64 -10
  3. package/agents/apt-improver.md +99 -0
  4. package/agents/apt-planner.md +115 -10
  5. package/dist/__test-helpers/run-cmd.d.mts +4 -2
  6. package/dist/__test-helpers/run-cmd.d.mts.map +1 -1
  7. package/dist/__test-helpers/run-cmd.mjs +56 -15
  8. package/dist/__test-helpers/run-cmd.mjs.map +1 -1
  9. package/dist/cli/artifacts/classification.d.mts.map +1 -1
  10. package/dist/cli/artifacts/classification.mjs +10 -0
  11. package/dist/cli/artifacts/classification.mjs.map +1 -1
  12. package/dist/cli/ci-watch/lock.d.mts +53 -0
  13. package/dist/cli/ci-watch/lock.d.mts.map +1 -0
  14. package/dist/cli/ci-watch/lock.mjs +172 -0
  15. package/dist/cli/ci-watch/lock.mjs.map +1 -0
  16. package/dist/cli/ci-watch/state.d.mts +36 -0
  17. package/dist/cli/ci-watch/state.d.mts.map +1 -0
  18. package/dist/cli/ci-watch/state.mjs +103 -0
  19. package/dist/cli/ci-watch/state.mjs.map +1 -0
  20. package/dist/cli/ci-watch/stop-matrix.d.mts +58 -0
  21. package/dist/cli/ci-watch/stop-matrix.d.mts.map +1 -0
  22. package/dist/cli/ci-watch/stop-matrix.mjs +164 -0
  23. package/dist/cli/ci-watch/stop-matrix.mjs.map +1 -0
  24. package/dist/cli/cli-wrappers/ci-watch.d.mts +2 -0
  25. package/dist/cli/cli-wrappers/ci-watch.d.mts.map +1 -0
  26. package/dist/cli/cli-wrappers/ci-watch.mjs +9 -0
  27. package/dist/cli/cli-wrappers/ci-watch.mjs.map +1 -0
  28. package/dist/cli/commands/adr.d.mts +5 -0
  29. package/dist/cli/commands/adr.d.mts.map +1 -0
  30. package/dist/cli/commands/adr.mjs +228 -0
  31. package/dist/cli/commands/adr.mjs.map +1 -0
  32. package/dist/cli/commands/ci-watch.d.mts +7 -0
  33. package/dist/cli/commands/ci-watch.d.mts.map +1 -0
  34. package/dist/cli/commands/ci-watch.mjs +465 -0
  35. package/dist/cli/commands/ci-watch.mjs.map +1 -0
  36. package/dist/cli/commands/context.d.mts +7 -0
  37. package/dist/cli/commands/context.d.mts.map +1 -0
  38. package/dist/cli/commands/context.mjs +224 -0
  39. package/dist/cli/commands/context.mjs.map +1 -0
  40. package/dist/cli/commands/event.d.mts.map +1 -1
  41. package/dist/cli/commands/event.mjs +59 -24
  42. package/dist/cli/commands/event.mjs.map +1 -1
  43. package/dist/cli/commands/host-detect.d.mts +1 -1
  44. package/dist/cli/commands/host-detect.d.mts.map +1 -1
  45. package/dist/cli/commands/host-detect.mjs +30 -3
  46. package/dist/cli/commands/host-detect.mjs.map +1 -1
  47. package/dist/cli/commands/init.d.mts.map +1 -1
  48. package/dist/cli/commands/init.mjs +73 -5
  49. package/dist/cli/commands/init.mjs.map +1 -1
  50. package/dist/cli/commands/modes.d.mts +13 -0
  51. package/dist/cli/commands/modes.d.mts.map +1 -0
  52. package/dist/cli/commands/modes.mjs +220 -0
  53. package/dist/cli/commands/modes.mjs.map +1 -0
  54. package/dist/cli/commands/pr-review-audit-fixer.d.mts +41 -2
  55. package/dist/cli/commands/pr-review-audit-fixer.d.mts.map +1 -1
  56. package/dist/cli/commands/pr-review-audit-fixer.mjs +91 -14
  57. package/dist/cli/commands/pr-review-audit-fixer.mjs.map +1 -1
  58. package/dist/cli/commands/route.d.mts.map +1 -1
  59. package/dist/cli/commands/route.mjs +11 -2
  60. package/dist/cli/commands/route.mjs.map +1 -1
  61. package/dist/cli/commands/task.d.mts.map +1 -1
  62. package/dist/cli/commands/task.mjs +136 -6
  63. package/dist/cli/commands/task.mjs.map +1 -1
  64. package/dist/cli/commands/tokens.d.mts.map +1 -1
  65. package/dist/cli/commands/tokens.mjs +150 -6
  66. package/dist/cli/commands/tokens.mjs.map +1 -1
  67. package/dist/cli/commands/triage.d.mts +8 -0
  68. package/dist/cli/commands/triage.d.mts.map +1 -0
  69. package/dist/cli/commands/triage.mjs +259 -0
  70. package/dist/cli/commands/triage.mjs.map +1 -0
  71. package/dist/cli/config/post-merge-sweep.d.mts +18 -0
  72. package/dist/cli/config/post-merge-sweep.d.mts.map +1 -1
  73. package/dist/cli/config/post-merge-sweep.mjs +48 -3
  74. package/dist/cli/config/post-merge-sweep.mjs.map +1 -1
  75. package/dist/cli/consistency/registry.d.mts +11 -0
  76. package/dist/cli/consistency/registry.d.mts.map +1 -1
  77. package/dist/cli/consistency/registry.mjs +13 -0
  78. package/dist/cli/consistency/registry.mjs.map +1 -1
  79. package/dist/cli/coordination/agent-identity.d.mts +9 -0
  80. package/dist/cli/coordination/agent-identity.d.mts.map +1 -1
  81. package/dist/cli/coordination/agent-identity.mjs +11 -0
  82. package/dist/cli/coordination/agent-identity.mjs.map +1 -1
  83. package/dist/cli/coordination/event-log.d.mts +27 -0
  84. package/dist/cli/coordination/event-log.d.mts.map +1 -1
  85. package/dist/cli/coordination/event-log.mjs +72 -2
  86. package/dist/cli/coordination/event-log.mjs.map +1 -1
  87. package/dist/cli/design/frontmatter-schema.d.mts +3 -3
  88. package/dist/cli/design/frontmatter-schema.d.mts.map +1 -1
  89. package/dist/cli/design/frontmatter-schema.mjs +3 -1
  90. package/dist/cli/design/frontmatter-schema.mjs.map +1 -1
  91. package/dist/cli/dispatch.d.mts.map +1 -1
  92. package/dist/cli/dispatch.mjs +14 -1
  93. package/dist/cli/dispatch.mjs.map +1 -1
  94. package/dist/cli/gate/registry.d.mts +11 -0
  95. package/dist/cli/gate/registry.d.mts.map +1 -1
  96. package/dist/cli/gate/registry.mjs +13 -0
  97. package/dist/cli/gate/registry.mjs.map +1 -1
  98. package/dist/cli/help.d.mts.map +1 -1
  99. package/dist/cli/help.mjs +1 -0
  100. package/dist/cli/help.mjs.map +1 -1
  101. package/dist/cli/host/detect.d.mts +1 -0
  102. package/dist/cli/host/detect.d.mts.map +1 -1
  103. package/dist/cli/host/detect.mjs +5 -0
  104. package/dist/cli/host/detect.mjs.map +1 -1
  105. package/dist/cli/route/envelope.d.mts +68 -4
  106. package/dist/cli/route/envelope.d.mts.map +1 -1
  107. package/dist/cli/route/envelope.mjs +140 -103
  108. package/dist/cli/route/envelope.mjs.map +1 -1
  109. package/dist/cli/route/skill-discover.d.mts +11 -0
  110. package/dist/cli/route/skill-discover.d.mts.map +1 -1
  111. package/dist/cli/route/skill-discover.mjs +46 -1
  112. package/dist/cli/route/skill-discover.mjs.map +1 -1
  113. package/dist/cli/skill-author/contract.d.mts +20 -0
  114. package/dist/cli/skill-author/contract.d.mts.map +1 -1
  115. package/dist/cli/skill-author/contract.mjs +27 -0
  116. package/dist/cli/skill-author/contract.mjs.map +1 -1
  117. package/dist/cli/skill-author/skill-template.d.mts.map +1 -1
  118. package/dist/cli/skill-author/skill-template.mjs +4 -3
  119. package/dist/cli/skill-author/skill-template.mjs.map +1 -1
  120. package/dist/cli/task/worktree-cleanup.d.mts +9 -1
  121. package/dist/cli/task/worktree-cleanup.d.mts.map +1 -1
  122. package/dist/cli/task/worktree-cleanup.mjs +190 -9
  123. package/dist/cli/task/worktree-cleanup.mjs.map +1 -1
  124. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  125. package/dist/plugin/agents/apt-planner.md +1 -1
  126. package/dist/plugin/skills/apt/SKILL.md +111 -5
  127. package/dist/plugin/skills/apt-author-skill/SKILL.md +11 -0
  128. package/dist/plugin/skills/apt-bootstrap/SKILL.md +1 -0
  129. package/dist/plugin/skills/apt-classify/SKILL.md +1 -0
  130. package/dist/plugin/skills/apt-close-task/SKILL.md +1 -0
  131. package/dist/plugin/skills/apt-create-docs/SKILL.md +1 -0
  132. package/dist/plugin/skills/apt-debug/SKILL.md +2 -0
  133. package/dist/plugin/skills/apt-design/SKILL.md +2 -0
  134. package/dist/plugin/skills/apt-discuss/SKILL.md +2 -0
  135. package/dist/plugin/skills/apt-docs/SKILL.md +2 -0
  136. package/dist/plugin/skills/apt-execute/SKILL.md +1 -0
  137. package/dist/plugin/skills/apt-mockup/SKILL.md +2 -0
  138. package/dist/plugin/skills/apt-pause/SKILL.md +1 -0
  139. package/dist/plugin/skills/apt-personas/SKILL.md +1 -0
  140. package/dist/plugin/skills/apt-plan/SKILL.md +2 -0
  141. package/dist/plugin/skills/apt-pr-review/SKILL.md +1 -0
  142. package/dist/plugin/skills/apt-quick/SKILL.md +2 -0
  143. package/dist/plugin/skills/apt-resume/SKILL.md +1 -0
  144. package/dist/plugin/skills/apt-review/SKILL.md +1 -0
  145. package/dist/plugin/skills/apt-roadmap/SKILL.md +1 -0
  146. package/dist/plugin/skills/apt-roundtable/SKILL.md +2 -0
  147. package/dist/plugin/skills/apt-run/SKILL.md +1 -0
  148. package/dist/plugin/skills/apt-scan/SKILL.md +1 -0
  149. package/dist/plugin/skills/apt-setup/SKILL.md +1 -0
  150. package/dist/plugin/skills/apt-ship/SKILL.md +6 -5
  151. package/dist/plugin/skills/apt-stress-test/SKILL.md +1 -0
  152. package/dist/plugin/skills/apt-terminal/SKILL.md +1 -0
  153. package/dist/plugin/skills/apt-update/SKILL.md +5 -0
  154. package/dist/plugin/skills/apt-verify/SKILL.md +1 -0
  155. package/dist/plugin/skills/apt-verify-proof/SKILL.md +1 -0
  156. package/dist/types/config.d.ts +85 -0
  157. package/dist/types/config.d.ts.map +1 -1
  158. package/package.json +125 -122
  159. package/prompts/coder.md +2 -0
  160. package/prompts/planner.md +12 -0
  161. package/prompts/spec_writer.md +9 -0
  162. package/skills/apt/SKILL.md +112 -5
  163. package/skills/apt-author-skill/SKILL.md +11 -0
  164. package/skills/apt-bootstrap/SKILL.md +1 -0
  165. package/skills/apt-classify/SKILL.md +1 -0
  166. package/skills/apt-close-task/SKILL.md +33 -1
  167. package/skills/apt-create-docs/SKILL.md +1 -0
  168. package/skills/apt-debug/SKILL.md +41 -6
  169. package/skills/apt-debug/appendices/diagnose-discipline.md +119 -0
  170. package/skills/apt-design/SKILL.md +2 -0
  171. package/skills/apt-diagram/SKILL.md +342 -0
  172. package/skills/apt-diagram/appendices/design-discipline.md +97 -0
  173. package/skills/apt-discuss/SKILL.md +27 -0
  174. package/skills/apt-discuss/appendices/grill-discipline.md +104 -0
  175. package/skills/apt-discuss/appendices/zoom-out-helper.md +79 -0
  176. package/skills/apt-docs/SKILL.md +2 -0
  177. package/skills/apt-execute/SKILL.md +49 -5
  178. package/skills/apt-execute/appendices/tdd-mode.md +107 -0
  179. package/skills/apt-improve/DEEPENING.md +84 -0
  180. package/skills/apt-improve/INTERFACE-DESIGN.md +97 -0
  181. package/skills/apt-improve/LANGUAGE.md +104 -0
  182. package/skills/apt-improve/SKILL.md +141 -0
  183. package/skills/apt-mockup/SKILL.md +2 -0
  184. package/skills/apt-pause/SKILL.md +1 -0
  185. package/skills/apt-personas/SKILL.md +1 -0
  186. package/skills/apt-plan/SKILL.md +149 -4
  187. package/skills/apt-planner.md +42 -1
  188. package/skills/apt-pr-review/SKILL.md +47 -16
  189. package/skills/apt-prototype/LOGIC.md +109 -0
  190. package/skills/apt-prototype/SKILL.md +143 -0
  191. package/skills/apt-prototype/UI.md +90 -0
  192. package/skills/apt-quick/SKILL.md +32 -0
  193. package/skills/apt-resume/SKILL.md +1 -0
  194. package/skills/apt-review/SKILL.md +3 -0
  195. package/skills/apt-roadmap/SKILL.md +1 -0
  196. package/skills/apt-roundtable/SKILL.md +2 -0
  197. package/skills/apt-run/SKILL.md +33 -4
  198. package/skills/apt-scan/SKILL.md +1 -0
  199. package/skills/apt-setup/SKILL.md +129 -2
  200. package/skills/apt-ship/SKILL.md +52 -4
  201. package/skills/apt-stress-test/SKILL.md +1 -0
  202. package/skills/apt-terminal/SKILL.md +1 -0
  203. package/skills/apt-triage/AGENT-BRIEF.md +84 -0
  204. package/skills/apt-triage/OUT-OF-SCOPE.md +75 -0
  205. package/skills/apt-triage/SKILL.md +169 -0
  206. package/skills/apt-update/SKILL.md +3 -0
  207. package/skills/apt-verify/SKILL.md +4 -0
  208. package/skills/apt-verify-proof/SKILL.md +4 -0
  209. package/skills/apt-watch-ci/SKILL.md +163 -0
  210. package/skills/apt-zoom-out/SKILL.md +130 -0
  211. package/src/cli/artifacts/classification.mjs +10 -0
  212. package/src/cli/ci-watch/lock.mjs +178 -0
  213. package/src/cli/ci-watch/state.mjs +103 -0
  214. package/src/cli/ci-watch/stop-matrix.mjs +181 -0
  215. package/src/cli/cli-wrappers/ci-watch.mjs +9 -0
  216. package/src/cli/commands/adr.mjs +243 -0
  217. package/src/cli/commands/ci-watch.mjs +503 -0
  218. package/src/cli/commands/context.mjs +244 -0
  219. package/src/cli/commands/event.mjs +63 -24
  220. package/src/cli/commands/host-detect.mjs +33 -7
  221. package/src/cli/commands/init.mjs +83 -5
  222. package/src/cli/commands/modes.mjs +215 -0
  223. package/src/cli/commands/pr-review-audit-fixer.mjs +95 -16
  224. package/src/cli/commands/route.mjs +11 -2
  225. package/src/cli/commands/task.mjs +152 -18
  226. package/src/cli/commands/tokens.mjs +157 -6
  227. package/src/cli/commands/triage.mjs +277 -0
  228. package/src/cli/config/post-merge-sweep.mjs +49 -3
  229. package/src/cli/consistency/registry.mjs +14 -0
  230. package/src/cli/coordination/agent-identity.mjs +12 -0
  231. package/src/cli/coordination/event-log.mjs +73 -2
  232. package/src/cli/design/frontmatter-schema.mjs +3 -1
  233. package/src/cli/dispatch.mjs +15 -1
  234. package/src/cli/gate/registry.mjs +14 -0
  235. package/src/cli/help.mjs +1 -0
  236. package/src/cli/host/detect.mjs +5 -0
  237. package/src/cli/route/envelope.mjs +140 -106
  238. package/src/cli/route/skill-discover.mjs +46 -1
  239. package/src/cli/skill-author/contract.mjs +29 -0
  240. package/src/cli/skill-author/skill-template.mjs +4 -3
  241. package/src/cli/task/worktree-cleanup.mjs +191 -9
  242. package/templates/adr-format.md +56 -0
  243. package/templates/config.json +4 -0
  244. package/templates/context-format.md +34 -0
@@ -0,0 +1,84 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/triage/AGENT-BRIEF.md
4
+ Licensed under MIT. Modifications: aligned with Aperant's 5-state
5
+ machine (needs-triage / needs-info / ready-for-agent / ready-for-human /
6
+ wontfix) and the backend-pluggable mirror model (local-only / github-issues / app-inbox).
7
+ -->
8
+
9
+ # Triage Agent Brief — what to do with each state
10
+
11
+ ## needs-triage (inbound)
12
+
13
+ A task lands here by default — no state assigned yet. Read the task
14
+ description, the linked artifacts, and CONTEXT.md (if relevant).
15
+
16
+ Decide:
17
+
18
+ - Is the task **concrete enough** to act on?
19
+ - **Yes, agent can act:** → `ready-for-agent`. Note required acceptance
20
+ criteria and files.
21
+ - **Yes, but needs human judgment:** → `ready-for-human`. Note WHY
22
+ (design taste / product call / security review).
23
+ - **No, missing info:** → `needs-info`. Note what's missing.
24
+ - **No, not going to act:** → `wontfix`. Note reason.
25
+
26
+ Category: assign `bug` or `enhancement`. Don't conflate them — bug
27
+ triage and enhancement triage have different priorities downstream.
28
+
29
+ ## needs-info (blocked on the reporter)
30
+
31
+ Don't keep grilling. Write one clarifying question, surface it to the
32
+ reporter (via the backend adapter or by tagging the user in the
33
+ local-only case), and stop. Re-enter triage when the answer arrives.
34
+
35
+ If the info is never supplied:
36
+
37
+ - After 30 days with no response → `wontfix` with reason "no response
38
+ to clarification request"
39
+ - Earlier than 30 days, only on a clear signal that the reporter
40
+ abandoned the task
41
+
42
+ ## ready-for-agent
43
+
44
+ The task is concrete: files identified, acceptance criteria stated,
45
+ no human-judgment-required gates ahead. An agent can take it.
46
+
47
+ This is NOT a green-light to start `/apt:plan` automatically — the
48
+ triage agent's job ends here. The user (or a downstream skill) picks
49
+ ready-for-agent tasks off the queue and runs them.
50
+
51
+ ## ready-for-human
52
+
53
+ The task requires human judgment that no agent should auto-resolve.
54
+ Common reasons:
55
+
56
+ - Design taste (apt:design / apt:mockup needed, then human chooses
57
+ between variants)
58
+ - Product decision (does this belong in the product at all?)
59
+ - Security review (a credential / auth / data-handling change that
60
+ needs human eyes)
61
+ - Legal / compliance call
62
+
63
+ Tag the human reviewer in the backend's mention surface (GitHub
64
+ Issues assignee, app-inbox owner field, or local-only `task.owner`).
65
+
66
+ ## wontfix (closed without implementation)
67
+
68
+ Record the reason verbatim. Patterns:
69
+
70
+ - "Out of scope — belongs to {parallel track / v2 / separate area}"
71
+ - "Already addressed by {commit-sha / task-id / decision in
72
+ context-notes}"
73
+ - "No actionable behavior change — task description was a question
74
+ better answered by {apt:zoom-out / docs / discussion}"
75
+ - "Reporter abandoned — no response to clarification request after 30 days"
76
+
77
+ `wontfix` is terminal. Re-opening requires a fresh `needs-triage`
78
+ record.
79
+
80
+ ## When in doubt
81
+
82
+ Default to `ready-for-human` over `wontfix`. False-positive `wontfix`
83
+ loses real work; false-positive `ready-for-human` just adds one review
84
+ turn. The cost asymmetry favors the more conservative call.
@@ -0,0 +1,75 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/triage/OUT-OF-SCOPE.md
4
+ Licensed under MIT. Modifications: aligned with Aperant's pipeline
5
+ (other skills exist for the out-of-scope concerns — explicit pointers).
6
+ -->
7
+
8
+ # Triage Out-of-Scope
9
+
10
+ What this skill is NOT. Knowing the boundary prevents triage from
11
+ metastasizing into a catch-all decision-making surface.
12
+
13
+ ## Out-of-scope concerns and where they belong
14
+
15
+ ### Locking decisions
16
+ Triage moves a task between states; it does NOT lock design or
17
+ implementation decisions. Decisions live in
18
+ `.aperant/context/notes/{task-id}.md` (via `/apt:discuss`) or in
19
+ `docs/adr/NNNN-slug.md` (via `apt-tools adr write` if the Nygard
20
+ 3-gate filter passes).
21
+
22
+ ### Feature design
23
+ Triage does NOT design features. If a `needs-triage` task contains a
24
+ vision or vague intent ("we should have analytics"), the right move is
25
+ `ready-for-human` with a pointer to `/apt:discuss --brainstorm` — not
26
+ to invent the feature shape inside the triage agent's context.
27
+
28
+ ### Multi-task prioritization
29
+ Triage assigns a state to one task at a time. It does NOT decide which
30
+ ready-for-agent task should be worked on first. That's the roadmap
31
+ surface (`apt-tools roadmap`) or the active-task surface (`apt-tools
32
+ active`).
33
+
34
+ ### Implementation planning
35
+ Triage does NOT emit an `implementation_plan.json`. That's `/apt:plan`'s
36
+ job, invoked AFTER a task is in `ready-for-agent` state.
37
+
38
+ ### Verification / review
39
+ Triage does NOT verify implementation quality. That's `/apt:verify` and
40
+ `/apt:review` AFTER the agent ships.
41
+
42
+ ### Stakeholder communication
43
+ Triage's `needs-info` state surfaces a clarifying question to the
44
+ reporter via the configured backend's mention surface — it does NOT
45
+ own the conversation thread itself. Long back-and-forths belong in the
46
+ backend (GitHub Issues comments, app-inbox replies), not in the triage
47
+ record's `extra` field.
48
+
49
+ ### Coordination layer
50
+ Triage does NOT atomically claim a task for a specific agent worker,
51
+ heartbeat, or coordinate cross-machine. That's the coordination layer
52
+ (team-task roundtable verdicts R1-R16). Triage and coordination share
53
+ data (the task ID, the lifecycle phase) but their surfaces are disjoint.
54
+
55
+ ### Security incident response
56
+ Triage does NOT escalate security incidents through their own
57
+ pipeline. If a `needs-triage` task has a security-sensitive flag (set
58
+ in `extra.security_sensitive` once v2 ships), it routes immediately to
59
+ `ready-for-human` and stops — the human owns the incident response.
60
+
61
+ ## What triage IS
62
+
63
+ A 5-state machine + bug/enhancement category + extensible metadata
64
+ record. That's it. Every concern above either belongs to a sibling
65
+ skill or stays in the backend that hosts the conversation.
66
+
67
+ ## The metadata extension contract
68
+
69
+ Triage's v1 schema includes `extra: Record<string, unknown>` for v2 OSS
70
+ contributor primitives. The v1 schema MUST be forward-compatible: v1
71
+ readers MUST ignore unrecognized fields under `extra`, and v2 readers
72
+ MUST gracefully handle missing fields under `extra` (treat as
73
+ undefined; don't crash). This is the non-breaking schema extension
74
+ mechanism — it's what lets us ship v1 today and add v2 fields later
75
+ without a migration.
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: apt:triage
3
+ description: "Move a task through the 5-state triage machine (needs-triage → needs-info → ready-for-agent | ready-for-human → wontfix). Mirrors to local triage.json by default; backends pluggable."
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: plan
6
+ intent: investigate
7
+ when_to_use: "An inbound task / bug report / feature request needs triage — is it ready for an agent, ready for a human, blocked on more info, or won't-fix? Always available; only the BACKEND it mirrors to is configurable."
8
+ user_invocable: true
9
+ internal: false
10
+ spawns_agent: false
11
+ agent_name: null
12
+ task_context: require-existing
13
+ default_track: STANDARD
14
+ default_execution_mode: step
15
+ execution_modes:
16
+ - auto
17
+ - step
18
+ allowed-tools: "Read, Write, Bash, Grep, Glob"
19
+ argument-hint: "apt:triage [task-id]"
20
+ gates: []
21
+ config_keys:
22
+ - task_tracking.backend
23
+ - task_tracking.publish_to_tracker
24
+ - task_tracking.tracker_url
25
+ - task_tracking.tracker_label_vocabulary
26
+ ---
27
+
28
+ # Triage — 5-State Task Machine
29
+
30
+ This skill moves a task through a 5-state machine. The state machine
31
+ runs identically regardless of backend (local-only / github-issues /
32
+ app-inbox); only the mirror destination changes.
33
+
34
+ **Pocock adoption attribution.** State machine + AGENT-BRIEF.md +
35
+ OUT-OF-SCOPE.md sub-files ported from Matt Pocock's MIT-licensed
36
+ `triage` skill. Aperant-specific extensions:
37
+
38
+ - Backend abstraction (configured at `apt:setup` Batch 8 — task_tracking.backend)
39
+ - Local-only default (zero GitHub auth on first run — ID-01: Framework
40
+ full-featured locally; backends are pluggable)
41
+ - Extensible metadata field `extra: Record<string, unknown>` for v2 OSS
42
+ contributor primitives (trust tier, repro status, security flag,
43
+ response templates) — non-breaking schema extension when v2 adds them
44
+ - Fast Path Guarantee: QUICK-routed tasks NEVER enter triage (ID-05)
45
+
46
+ ## When to Use
47
+
48
+ - An inbound task / bug / feature request needs status assignment
49
+ - Periodic review of `needs-triage` tasks
50
+ - Re-triage when new info arrives on a `needs-info` task
51
+
52
+ ## When NOT to Use
53
+
54
+ - QUICK-routed tasks (Fast Path Guarantee — they go straight to
55
+ `/apt:quick` with no triage)
56
+ - Tasks already in a terminal state (`wontfix` or `ready-for-agent`
57
+ with an active agent run)
58
+
59
+ ## 5-state machine
60
+
61
+ ```
62
+ ┌──→ ready-for-agent (terminal)
63
+
64
+ needs-triage ──⇄── needs-info ──┼──→ ready-for-human (terminal)
65
+ │ │
66
+ │ └──→ wontfix (terminal)
67
+
68
+ ├──→ ready-for-agent (direct)
69
+ ├──→ ready-for-human (direct)
70
+ └──→ wontfix (direct)
71
+ ```
72
+
73
+ All 8 valid transitions: see prose list below and
74
+ `apt-triage-state-machine.test.ts` for the exhaustive matrix.
75
+
76
+ States:
77
+
78
+ - **needs-triage** — inbound default. No state assigned yet.
79
+ - **needs-info** — triage agent identified missing info; blocked on
80
+ the reporter.
81
+ - **ready-for-agent** — task is concrete enough for `/apt:plan` +
82
+ `/apt:execute`. Has acceptance criteria, files identified.
83
+ - **ready-for-human** — task requires human judgment (design taste,
84
+ product decision, security review). NOT for an agent to ship.
85
+ - **wontfix** — closed without implementation. Reason recorded.
86
+
87
+ Valid transitions (8):
88
+
89
+ 1. `needs-triage` → `needs-info` (need more info)
90
+ 2. `needs-triage` → `ready-for-agent`
91
+ 3. `needs-triage` → `ready-for-human`
92
+ 4. `needs-triage` → `wontfix`
93
+ 5. `needs-info` → `ready-for-agent` (info supplied)
94
+ 6. `needs-info` → `ready-for-human`
95
+ 7. `needs-info` → `wontfix`
96
+ 8. `needs-info` → `needs-triage` (re-triage — reset)
97
+
98
+ All other transitions are invalid and rejected.
99
+
100
+ Categories (orthogonal to state): `bug` | `enhancement`.
101
+
102
+ ## v1 schema (with extensible metadata for v2)
103
+
104
+ ```jsonc
105
+ {
106
+ "task_id": "string",
107
+ "state": "needs-triage | needs-info | ready-for-agent | ready-for-human | wontfix",
108
+ "category": "bug | enhancement",
109
+ "transitions": [
110
+ { "from": "needs-triage", "to": "needs-info", "at": "ISO-8601", "by": "user|agent", "reason": "string" }
111
+ ],
112
+ "extra": { /* v2 OSS contributor primitives go here — non-breaking schema extension */ }
113
+ }
114
+ ```
115
+
116
+ The `extra` field is the v2-extension slot. v2 will add:
117
+
118
+ - `contributor_trust_tier` (number)
119
+ - `repro_status` (string: not-reproduced | reproduced | needs-info)
120
+ - `security_sensitive` (boolean)
121
+ - `response_template_id` (string)
122
+
123
+ v1 ignores these fields if present; v2 reads them. No schema migration
124
+ needed.
125
+
126
+ ## Backend configuration
127
+
128
+ `.aperant/config.json.task_tracking.backend` selects the mirror:
129
+
130
+ | Backend | v1 behavior |
131
+ |---|---|
132
+ | `local-only` (default) | State mirrors to `.aperant/tasks/{task-id}/triage.json` only. Zero network dependency. |
133
+ | `github-issues` | Returns `{status: 'not-implemented', backend: 'github-issues', v2_issue: '#TBD'}`. Implementation deferred to v2. |
134
+ | `app-inbox` | Same as github-issues — stub returning not-implemented. |
135
+
136
+ Skill body reads `task_tracking.backend` at the start of every
137
+ invocation. If the backend's adapter is not implemented, the skill
138
+ fails fast with the `not-implemented` envelope — it does NOT silently
139
+ fall back to `local-only`.
140
+
141
+ ## Fast Path Guarantee — QUICK never enters triage (AC9, ID-05)
142
+
143
+ When the router classifies a task as QUICK, the task NEVER enters this
144
+ state machine. `/apt:quick` skips triage by design — it's the one-shot
145
+ path for trivial fixes, and triage ceremony would violate the Fast
146
+ Path Guarantee. apt-triage-quick-exempt.test.ts asserts this constraint
147
+ holds.
148
+
149
+ ## Sub-files (MIT-attributed)
150
+
151
+ - `AGENT-BRIEF.md` — what an agent does with each state
152
+ - `OUT-OF-SCOPE.md` — what triage explicitly is NOT (decision-locking,
153
+ feature design, multi-task prioritization)
154
+
155
+ ## Skill body process
156
+
157
+ 1. Parse `task-id` from `$ARGUMENTS`.
158
+ 2. Read `.aperant/config.json.task_tracking.backend`.
159
+ 3. Read the current `triage.json` state (default `needs-triage`).
160
+ 4. Apply the requested transition via the `apt-tools triage` CLI
161
+ (sub-command on the dispatch map).
162
+ 5. Mirror to the backend if configured (local-only = write
163
+ `.aperant/tasks/{id}/triage.json`).
164
+ 6. Output the new state envelope.
165
+
166
+ State transitions surface the autonomy-aware degradation table
167
+ (`apt-discuss/appendices/grill-discipline.md`) when the transition
168
+ needs the user's judgment (e.g., moving to `wontfix` without
169
+ escalation).
@@ -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
@@ -69,6 +70,8 @@ Build the flags list from the runtime ids (e.g. `--claude --codex`) and run:
69
70
  node .aperant/deps/node_modules/@aperant/framework/bin/apt-tools.mjs init . <flags>
70
71
  ```
71
72
 
73
+ **Do NOT add `--yes`, `--solo`, `--team`, or any other Class A flag.** This command is meant to refresh runtime files only — adding `--yes` triggers a config schema migration that can silently flip `share.visibility` to `solo` and re-write `.gitignore`, which is exactly the 0.6.0/0.6.1 dogfood bug. If `init` returns a `requires_input` envelope (schema drift), surface it to the user verbatim and stop; let them decide team vs solo with the explicit flag. From 0.6.4 onward `--yes` infers visibility from existing git tracking, but the skill must still not add it — keep this command scoped to runtime refresh.
74
+
72
75
  Parse the init JSON. Capture for each runtime:
73
76
  - `install_root` (shortened to the basename, e.g. `.claude`)
74
77
  - `file_count`
@@ -9,6 +9,7 @@ user_invocable: true
9
9
  internal: false
10
10
  spawns_agent: true
11
11
  agent_name: "apt-verifier"
12
+ task_context: require-existing
12
13
  default_execution_mode: auto
13
14
  execution_modes:
14
15
  - auto
@@ -18,6 +19,9 @@ argument-hint: "apt:verify [--fast | --cross-verify]"
18
19
  gates:
19
20
  - consistency-check
20
21
  - all-subtasks-complete
22
+ config_keys:
23
+ - verification.evidence_capture
24
+ - verification.max_iterations
21
25
  ---
22
26
  <objective>
23
27
  Verify that the implementation matches the spec, all tests pass, code quality checks succeed, and sign off on the build.
@@ -9,6 +9,7 @@ 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
@@ -16,6 +17,9 @@ execution_modes:
16
17
  allowed-tools: "Bash, Read, Write, Edit, Grep, Glob, Task"
17
18
  argument-hint: "apt:verify-proof [--multi-model | --video]"
18
19
  gates: []
20
+ config_keys:
21
+ - verification.open_report
22
+ - verification.report_formats
19
23
  ---
20
24
 
21
25
  # Proof Verification
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: apt:watch-ci
3
+ description: "Post-ship CI watcher — polls PR checks, auto-fixes red, pushes, reschedules"
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: ship
6
+ intent: x-watch-ci
7
+ when_to_use: "A PR has been shipped and CI is running. Use to watch its checks on a recurring tick, auto-fix red checks from first red, push fixes, and reschedule until green / merged / closed / 5 attempts / 4h wall."
8
+ user_invocable: true
9
+ internal: false
10
+ spawns_agent: false
11
+ agent_name: null
12
+ task_context: require-existing
13
+ default_execution_mode: auto
14
+ execution_modes:
15
+ - auto
16
+ - step
17
+ allowed-tools: "Bash, Read, Write, Edit, Grep, Glob"
18
+ argument-hint: "apt:watch-ci [--pr N | --tick --pr N | --stop --pr N | --resume --pr N]"
19
+ gates: []
20
+ config_keys:
21
+ - ci_watch.after_ship
22
+ - ci_watch.auto_merge_on_green
23
+ ---
24
+
25
+ # /apt:watch-ci — Post-ship CI Watcher
26
+
27
+ You are a **post-ship CI watcher**. After a PR has been opened by `/apt:ship`, you watch its checks on a recurring tick, auto-fix red checks from the first red, push the fix, and reschedule yourself until the PR is green / merged / closed, or you hit the 5-attempt / 4h wall budget.
28
+
29
+ This skill is **one-tick-per-invocation** (D-01). It MUST NOT enter a polling loop. The recurring beat is delivered externally — by Claude Code's `CronCreate` on cron-capable hosts, by Pi's `pi-schedule-prompt` on Pi, or by the user re-invoking `/apt:watch-ci --tick --pr N` on non-cron hosts. Each invocation does at most one of: poll + classify + maybe-fix + push + reschedule, then exits.
30
+
31
+ The locked decisions backing every section are in `.aperant/context/notes/framework-post-ship-ci-watcher.md` (D-01..D-08).
32
+
33
+ ---
34
+
35
+ ## Your environment
36
+
37
+ - **Working directory:** the task's worktree (or the project root if this is a non-worktree task).
38
+ - **State files:** `.aperant/ci-watches/{pr}.json` (per-PR state, D-04); `.aperant/ci-watches/{pr}.lock` (per-PR atomic lock, D-05). Both ephemeral — they are NOT committed.
39
+ - **Events:** every tick appends a `ci-watch.tick` event to `.aperant/events/{today}.jsonl`; `start` appends `ci-watch.armed`; the fix-and-push path appends `ci-watch.fix-pushed`; terminal actions append `ci-watch.stopped` with a `reason`.
40
+ - **CLI surface:** `apt-tools ci-watch start|stop|status|tick --pr N`. The skill body shells out to those subcommands — DO NOT re-implement the classifier in your prompt; the cmd already does it.
41
+
42
+ ---
43
+
44
+ ## §1. Resolve mode
45
+
46
+ Parse the flags:
47
+ - No flag → "start a watch for the active task's PR" (resolve PR number from `.aperant/state.json` active task's `pr_url` field).
48
+ - `--tick --pr N` → run one tick for PR N. This is the cron payload's invocation form.
49
+ - `--stop --pr N` → tear down the watch.
50
+ - `--resume --pr N` → clear the `paused: true` flag and return to normal tick.
51
+
52
+ If no PR can be resolved (no active task, no `pr_url`), print an error and exit — there is nothing to watch.
53
+
54
+ ---
55
+
56
+ ## §2. Lock acquire
57
+
58
+ For everything except `status`, the imperative work happens inside `apt-tools ci-watch tick`, which acquires the per-PR lock itself. If `tick` returns exit code 2 with `{status:"busy", reason:"lock-held"}`, another invocation is already running for this PR. Print:
59
+
60
+ ```
61
+ Watcher already running for PR {N} (held by sessionId={x}, pid={y}); exiting.
62
+ ```
63
+
64
+ …and exit. Do NOT block, retry, or kill the holder.
65
+
66
+ ---
67
+
68
+ ## §3. One-tick semantics (the heart of D-01)
69
+
70
+ For the `--tick` mode, execute exactly the following sequence — once — inside this single skill invocation:
71
+
72
+ 1. **Poll.** Call `gh pr checks <N> --json name,bucket,state,conclusion,detailsUrl` and `gh pr view <N> --json state,reviewDecision`. On any `gh` failure, write the captured stderr to a temp file and let the cmd's `tick` route to `infra-backoff` (it surfaces the same action when the gh payload is unavailable).
73
+ 2. **Classify + state update.** Call `apt-tools ci-watch tick {worktree} --pr {N}`. The cmd internally:
74
+ - acquires the per-PR lock (BUSY → exit 2 → step §2);
75
+ - reads the per-PR state file;
76
+ - runs the stop-matrix classifier (`packages/framework/src/cli/ci-watch/stop-matrix.mjs`);
77
+ - applies the action's state mutation (attempts++, last_status fingerprint, paused, etc.);
78
+ - releases the lock;
79
+ - returns `{status, action, attempts_used, next_tick_at, reason}`.
80
+ 3. **Branch on `action`** — see §4 (terminal), §5 (fix), §6 (non-counting), §7 (pause/resume).
81
+ 4. **Reschedule (next tick).** On Claude Code: refresh the `CronCreate` entry's next-fire timestamp (CronCreate is idempotent on the same payload). On Pi: do the equivalent via `pi-schedule-prompt`. On other hosts: print `Next tick: run /apt:watch-ci --tick --pr {N} when you return.` Do NOT register a cron on a non-cron host — the framework would be lying.
82
+ 5. **Emit event.** `apt-tools event append . --type ci-watch.tick --data '{...}'` with the cmd's envelope as the data payload. Non-fatal if it fails.
83
+
84
+ ---
85
+
86
+ ## §4. Terminal branches (green / merged / closed / *-cap / identical-log)
87
+
88
+ When `action ∈ {green, merged, closed, attempts-cap, wall-cap, identical-log}`:
89
+
90
+ - **green** — print "CI green for PR {N}." If `ci_watch.auto_merge_on_green` is `true` in `.aperant/config.json`, run `gh pr merge {N} --auto --squash` then suggest `/apt:close-task`. Else print the exact D-08 text:
91
+
92
+ ```
93
+ ✅ CI green — merge in browser or run /apt:close-task post-merge
94
+ ```
95
+
96
+ - **merged** / **closed** — print a one-line summary. No PR comment needed.
97
+
98
+ - **attempts-cap** / **wall-cap** / **identical-log** — these are bail conditions. Leave a PR comment via `gh pr comment {N} --body "<summary>"` describing why the watcher stopped (attempt count, deadline, fingerprint). The user comes back to find a structured note in the PR.
99
+
100
+ In all terminal cases:
101
+ - Stop the host scheduler (`CronDelete` on Claude Code, `pi schedule remove` on Pi, no-op elsewhere).
102
+ - The cmd already deleted the state file when it returned `status: 'stopped'`. Do NOT re-delete it.
103
+ - Emit `ci-watch.stopped` event with the matching `reason`.
104
+
105
+ ---
106
+
107
+ ## §5. Fix-and-push (D-02 — the auto-fix path)
108
+
109
+ When `action === 'fix'` (or `diverged-rebased`/`diverged-bailed`):
110
+
111
+ 1. **Fetch the failed-check log.** From the gh payload, find the failed check's `detailsUrl` and call `gh run view {runId} --log` to capture the log into a temp file.
112
+ 2. **Shell out to the host CLI** to fix it. The watcher does NOT inline a custom fix prompt; it hands the worktree + failed-log to the same CLI binary that's running this skill (detected by `apt-tools host-detect`). Pseudocode:
113
+
114
+ ```bash
115
+ <host-cli-bin> --print "Fix this CI failure for PR {N}. The failed-run log is at {log_path}. Use the worktree at {worktree}. Land + push a commit with the fix." \
116
+ --cwd {worktree}
117
+ ```
118
+
119
+ The fix-CLI is responsible for the actual edits + verification + commit + push. This is a clean shell-out boundary — the watcher trusts the fix-CLI to land a commit (or to bail with a non-zero exit code, which the watcher treats as "no progress made this tick").
120
+ 3. **Did the fix change anything?** Run `git -C {worktree} status --porcelain`. If empty, the fixer made no changes → the next tick's classifier will see the same failure log and emit `identical-log`. Do NOT push.
121
+ 4. **Push.** `git -C {worktree} push origin {branch}`. On push failure, the next tick will route through `infra-backoff`.
122
+ 5. **Emit event.** `apt-tools event append . --type ci-watch.fix-pushed --data '{pr, attempts, commit_sha}'`.
123
+ 6. **Reschedule** per §3 step 4.
124
+
125
+ For `diverged-rebased`: the cmd already returned the verb; the orchestrator runs `git -C {worktree} fetch && git rebase origin/{base}` BEFORE the fix step. On conflict the action becomes `diverged-bailed` and the watcher exits with a PR comment summarizing the conflict.
126
+
127
+ ---
128
+
129
+ ## §6. Non-counting branches (flake-skip / infra-backoff)
130
+
131
+ When `action === 'flake-skip'` or `'infra-backoff'`:
132
+
133
+ - **flake-skip:** Skip the fix path entirely. Reschedule at the normal interval. No PR comment.
134
+ - **infra-backoff:** Same skip — but the next tick interval is doubled by the cmd (it wrote `next_tick_interval_ms *= 2` to state). The cron host re-invocation reads it. After one retry, if the same infra signal persists, post a PR comment marking the failure as `infra-incident`; do NOT keep doubling forever.
135
+
136
+ ---
137
+
138
+ ## §7. --stop / --resume flags
139
+
140
+ - `--stop --pr N` — releases scheduler handle (`CronDelete` on CC, `pi schedule remove` on Pi, no-op elsewhere), deletes state file, emits `ci-watch.stopped` event with `reason:"user-stop"`. Idempotent — calling `--stop` on a PR with no active watch is fine.
141
+ - `--resume --pr N` — only valid when state has `paused: true` (set by `reviewer-pause`). Clears the flag, returns to normal tick. Error envelope if no paused state for the PR.
142
+
143
+ When the classifier returns `reviewer-pause`, the state's `paused: true` is set by the cmd, but the scheduler is NOT removed — the cron payload keeps firing, and each tick the cmd checks `paused` and exits early with action `reviewer-pause`. Cheaper than re-registering on `--resume`.
144
+
145
+ ---
146
+
147
+ ## §8. Single-execution-mode contract
148
+
149
+ Reiterating because this is the most easily-broken invariant:
150
+
151
+ - One tick = one invocation. **Do not** wrap the §3 sequence in a `while`/`until` loop.
152
+ - **Do not** sleep + re-invoke yourself inside a single session.
153
+ - The recurring beat is delivered by host cron OR by the user re-invoking the skill manually. The watcher's value comes from the host scheduler — it does not impersonate one.
154
+
155
+ If you find yourself wanting to add "and then wait 5 minutes and run again," STOP. The skill is finished after one tick. Exit.
156
+
157
+ ---
158
+
159
+ ## Notes for the orchestrator
160
+
161
+ - All gh CLI calls run with the host's existing auth. The watcher introduces no new secret material (per task `dimensions_covered.token-encryption.crossed: false`).
162
+ - `auto_merge_on_green` is snapshotted from `.aperant/config.json` at `start` time (state file's `auto_merge_on_green` field). Changing the config mid-watch does NOT retroactively affect armed watches — re-run `start` to pick up the new value.
163
+ - The fix-CLI shell-out is the cleanest abstraction we have for portability. It's NOT a sub-agent. On Claude Code that means another `claude` invocation; on Codex/Gemini/OpenCode/Pi, the equivalent binary. Detection lives in `apt-tools host-detect`'s `cli` field.
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: apt:zoom-out
3
+ description: "Orient yourself in an unfamiliar area of the codebase — load CONTEXT.md, map modules + callers, output a one-page orientation"
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: plan
6
+ intent: investigate
7
+ when_to_use: "The user is dropped into a part of the codebase they don't know and wants a one-page architectural orientation before planning or editing. Natural-language triggers: 'give me a broader picture of X', 'I'm lost in this area', 'explain how this fits'."
8
+ user_invocable: true
9
+ internal: false
10
+ spawns_agent: false
11
+ agent_name: null
12
+ task_context: none
13
+ default_track: STANDARD
14
+ default_execution_mode: auto
15
+ execution_modes:
16
+ - auto
17
+ - step
18
+ allowed-tools: "Bash, Read, Grep, Glob"
19
+ argument-hint: "apt:zoom-out [area-name]"
20
+ gates: []
21
+ ---
22
+
23
+ # Zoom-Out — One-page Architectural Orientation
24
+
25
+ Tiny skill. High signal. The user named an area; you produce a one-page
26
+ orientation so they (or a future agent) can plan or edit without
27
+ re-learning the codebase from scratch.
28
+
29
+ **Pocock adoption note.** This skill descends from Matt Pocock's `zoom-out`
30
+ discipline. Aperant's router is dynamic and LLM-driven, so unlike Pocock's
31
+ upstream this skill is **router-invocable** (no `disable-model-invocation:
32
+ true` flag). The work-intent — "give me a broader picture of X" — is
33
+ genuine and the router resolves natural-language triggers without forcing
34
+ the user to remember the verb name.
35
+
36
+ ## When to Use
37
+
38
+ - Dropped into a new module / package / area of the monorepo
39
+ - About to plan a feature that crosses an unfamiliar boundary
40
+ - The codebase has CONTEXT.md (Pocock glossary) and you want to load it
41
+ alongside the structural map
42
+
43
+ ## When Not to Use
44
+
45
+ - The area is one you know well — `/apt:plan` already does targeted
46
+ investigation
47
+ - You need to lock decisions (use `/apt:discuss` with the
48
+ `appendices/grill-discipline.md` posture loader instead)
49
+ - The user wants to refactor proactively — that's `/apt:improve`
50
+
51
+ ## Process
52
+
53
+ ### 1. Parse the area name
54
+
55
+ Extract the area from `$ARGUMENTS`. The area is a noun phrase, not a
56
+ file path: e.g., `"chat session lifecycle"`, `"sparring engine"`,
57
+ `"feature registry"`. If the argument is a file path, narrow the
58
+ orientation to the file's enclosing module.
59
+
60
+ ### 2. Load CONTEXT.md (if present)
61
+
62
+ If `CONTEXT.md` exists at the project root, read it and pre-load any
63
+ term-blocks whose `Term` matches keywords in the area name (or whose
64
+ `Aliases to avoid` field hints at the area). Carry these terms forward
65
+ into the orientation report so the reader sees the vocabulary the
66
+ codebase actually uses.
67
+
68
+ If `CONTEXT.md` does not exist, skip silently — orientation still works,
69
+ just without the glossary anchor.
70
+
71
+ ### 3. Map modules and callers
72
+
73
+ Run Glob + Grep to identify:
74
+
75
+ - **Entry points** — files in the area that other modules import (high
76
+ fan-in: many `import`-ers).
77
+ - **State owners** — files that declare the area's persistent
78
+ state (Zustand stores, Convex queries, libSQL tables).
79
+ - **External boundaries** — files that touch external systems (HTTP,
80
+ IPC, native modules, child processes).
81
+ - **Known fragile areas** — search for `// TODO`, `// FIXME`, `// HACK`
82
+ comments + any recent commits touching the area (last 30 days).
83
+
84
+ ### 4. Emit the one-page orientation
85
+
86
+ Output to stdout (no file written — this is a read-only orientation):
87
+
88
+ ```markdown
89
+ # Orientation: {area name}
90
+
91
+ ## Purpose
92
+ {One paragraph: what does this area exist to do?}
93
+
94
+ ## Entry points
95
+ - `{path}` — {one-line role}
96
+ - `{path}` — {one-line role}
97
+
98
+ ## State owners
99
+ - `{path}` — {one-line: what state, what scope}
100
+
101
+ ## External boundaries
102
+ - `{path}` — {one-line: which external system, what direction}
103
+
104
+ ## Known fragile areas
105
+ - `{path}:{line}` — `// TODO` / `// FIXME` summary + age
106
+ - {recent-commit-shortlog one-liner if relevant}
107
+
108
+ ## Glossary (from CONTEXT.md)
109
+ - **{Term}** — definition + aliases-to-avoid
110
+ - {…}
111
+
112
+ ## Pointers for the next agent
113
+ - {one-line: where to start reading}
114
+ - {one-line: which test file to read first}
115
+ - {one-line: which CONTEXT.md term resolves the most ambiguity}
116
+ ```
117
+
118
+ The orientation MUST fit on one screen. If it doesn't, you've gone too
119
+ deep — re-scope the area name and try again.
120
+
121
+ ## Output contract
122
+
123
+ - **Read-only.** This skill never writes files. It is a context-loader,
124
+ not a planner.
125
+ - **Stops at orientation.** Do NOT pivot into `/apt:plan` automatically.
126
+ The user invokes `/apt:plan` (or `/apt:improve`) as a follow-up if the
127
+ orientation surfaces a planning opportunity.
128
+ - **No grill posture.** This skill does NOT load
129
+ `apt-discuss/appendices/grill-discipline.md` — orientation is
130
+ descriptive, not normative. Locking decisions is `apt:discuss`'s job.