@aperant/framework 0.7.0 → 0.7.4

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 (151) hide show
  1. package/CHANGELOG.md +205 -0
  2. package/agents/apt-planner.md +12 -0
  3. package/agents/apt-pr-review-fixer.md +13 -9
  4. package/bin/apt-tools.mjs +7 -0
  5. package/dist/cli/ci-watch/stop-matrix.d.mts.map +1 -1
  6. package/dist/cli/ci-watch/stop-matrix.mjs +16 -0
  7. package/dist/cli/ci-watch/stop-matrix.mjs.map +1 -1
  8. package/dist/cli/commands/ci-watch.d.mts +11 -0
  9. package/dist/cli/commands/ci-watch.d.mts.map +1 -1
  10. package/dist/cli/commands/ci-watch.mjs +108 -2
  11. package/dist/cli/commands/ci-watch.mjs.map +1 -1
  12. package/dist/cli/commands/features-audit.d.mts +24 -0
  13. package/dist/cli/commands/features-audit.d.mts.map +1 -1
  14. package/dist/cli/commands/features-audit.mjs +159 -5
  15. package/dist/cli/commands/features-audit.mjs.map +1 -1
  16. package/dist/cli/commands/health-check.d.mts +16 -0
  17. package/dist/cli/commands/health-check.d.mts.map +1 -1
  18. package/dist/cli/commands/health-check.mjs +118 -2
  19. package/dist/cli/commands/health-check.mjs.map +1 -1
  20. package/dist/cli/commands/init.d.mts +9 -0
  21. package/dist/cli/commands/init.d.mts.map +1 -1
  22. package/dist/cli/commands/init.mjs +49 -4
  23. package/dist/cli/commands/init.mjs.map +1 -1
  24. package/dist/cli/commands/modes.d.mts.map +1 -1
  25. package/dist/cli/commands/modes.mjs +11 -0
  26. package/dist/cli/commands/modes.mjs.map +1 -1
  27. package/dist/cli/commands/pr-review-audit-fixer.d.mts +13 -0
  28. package/dist/cli/commands/pr-review-audit-fixer.d.mts.map +1 -1
  29. package/dist/cli/commands/pr-review-audit-fixer.mjs +18 -5
  30. package/dist/cli/commands/pr-review-audit-fixer.mjs.map +1 -1
  31. package/dist/cli/commands/task.d.mts.map +1 -1
  32. package/dist/cli/commands/task.mjs +84 -5
  33. package/dist/cli/commands/task.mjs.map +1 -1
  34. package/dist/cli/commands/validate-evidence.d.mts +24 -2
  35. package/dist/cli/commands/validate-evidence.d.mts.map +1 -1
  36. package/dist/cli/commands/validate-evidence.mjs +154 -17
  37. package/dist/cli/commands/validate-evidence.mjs.map +1 -1
  38. package/dist/cli/commands/vitest-doctor.d.mts +2 -0
  39. package/dist/cli/commands/vitest-doctor.d.mts.map +1 -0
  40. package/dist/cli/commands/vitest-doctor.mjs +168 -0
  41. package/dist/cli/commands/vitest-doctor.mjs.map +1 -0
  42. package/dist/cli/config/gitignore-drift.d.mts +23 -1
  43. package/dist/cli/config/gitignore-drift.d.mts.map +1 -1
  44. package/dist/cli/config/gitignore-drift.mjs +81 -3
  45. package/dist/cli/config/gitignore-drift.mjs.map +1 -1
  46. package/dist/cli/config/load.d.mts +56 -2
  47. package/dist/cli/config/load.d.mts.map +1 -1
  48. package/dist/cli/config/load.mjs +192 -2
  49. package/dist/cli/config/load.mjs.map +1 -1
  50. package/dist/cli/consistency/parse-review.mjs +7 -0
  51. package/dist/cli/consistency/parse-review.mjs.map +1 -1
  52. package/dist/cli/dispatch.d.mts.map +1 -1
  53. package/dist/cli/dispatch.mjs +24 -2
  54. package/dist/cli/dispatch.mjs.map +1 -1
  55. package/dist/cli/gate/gates/gitignore-in-sync.d.mts +1 -1
  56. package/dist/cli/gate/gates/gitignore-in-sync.d.mts.map +1 -1
  57. package/dist/cli/gate/gates/gitignore-in-sync.mjs +5 -2
  58. package/dist/cli/gate/gates/gitignore-in-sync.mjs.map +1 -1
  59. package/dist/cli/gate/gates/review-clean.d.mts +5 -1
  60. package/dist/cli/gate/gates/review-clean.d.mts.map +1 -1
  61. package/dist/cli/gate/gates/review-clean.mjs +23 -18
  62. package/dist/cli/gate/gates/review-clean.mjs.map +1 -1
  63. package/dist/cli/gate/gates/verify-approved.d.mts +49 -1
  64. package/dist/cli/gate/gates/verify-approved.d.mts.map +1 -1
  65. package/dist/cli/gate/gates/verify-approved.mjs +93 -14
  66. package/dist/cli/gate/gates/verify-approved.mjs.map +1 -1
  67. package/dist/cli/help.d.mts.map +1 -1
  68. package/dist/cli/help.mjs +7 -2
  69. package/dist/cli/help.mjs.map +1 -1
  70. package/dist/cli/install/runtime-detect.d.mts +13 -0
  71. package/dist/cli/install/runtime-detect.d.mts.map +1 -1
  72. package/dist/cli/install/runtime-detect.mjs +9 -0
  73. package/dist/cli/install/runtime-detect.mjs.map +1 -1
  74. package/dist/cli/task/index-md.d.mts.map +1 -1
  75. package/dist/cli/task/index-md.mjs +14 -2
  76. package/dist/cli/task/index-md.mjs.map +1 -1
  77. package/dist/plugin/.claude-plugin/plugin.json +11 -2
  78. package/dist/plugin/agents/apt-improver.md +99 -0
  79. package/dist/plugin/agents/apt-planner.md +127 -10
  80. package/dist/plugin/agents/apt-pr-review-fixer.md +13 -9
  81. package/dist/plugin/skills/apt/SKILL.md +1 -0
  82. package/dist/plugin/skills/apt-close-task/SKILL.md +63 -1
  83. package/dist/plugin/skills/apt-debug/SKILL.md +39 -6
  84. package/dist/plugin/skills/apt-debug/appendices/diagnose-discipline.md +119 -0
  85. package/dist/plugin/skills/apt-diagram/SKILL.md +378 -0
  86. package/dist/plugin/skills/apt-diagram/appendices/design-discipline.md +97 -0
  87. package/dist/plugin/skills/apt-discuss/SKILL.md +72 -5
  88. package/dist/plugin/skills/apt-discuss/appendices/grill-discipline.md +104 -0
  89. package/dist/plugin/skills/apt-discuss/appendices/zoom-out-helper.md +79 -0
  90. package/dist/plugin/skills/apt-execute/SKILL.md +57 -5
  91. package/dist/plugin/skills/apt-execute/appendices/tdd-mode.md +107 -0
  92. package/dist/plugin/skills/apt-improve/DEEPENING.md +84 -0
  93. package/dist/plugin/skills/apt-improve/INTERFACE-DESIGN.md +97 -0
  94. package/dist/plugin/skills/apt-improve/LANGUAGE.md +104 -0
  95. package/dist/plugin/skills/apt-improve/SKILL.md +141 -0
  96. package/dist/plugin/skills/apt-plan/SKILL.md +171 -4
  97. package/dist/plugin/skills/apt-plan/adapters/conductor.md +98 -0
  98. package/dist/plugin/skills/apt-pr-review/SKILL.md +57 -18
  99. package/dist/plugin/skills/apt-prototype/LOGIC.md +109 -0
  100. package/dist/plugin/skills/apt-prototype/SKILL.md +143 -0
  101. package/dist/plugin/skills/apt-prototype/UI.md +90 -0
  102. package/dist/plugin/skills/apt-quick/SKILL.md +49 -8
  103. package/dist/plugin/skills/apt-release-notes/SKILL.md +193 -0
  104. package/dist/plugin/skills/apt-release-notes/appendices/persona-voice.md +59 -0
  105. package/dist/plugin/skills/apt-review/SKILL.md +2 -0
  106. package/dist/plugin/skills/apt-run/SKILL.md +32 -4
  107. package/dist/plugin/skills/apt-setup/SKILL.md +308 -6
  108. package/dist/plugin/skills/apt-ship/SKILL.md +122 -1
  109. package/dist/plugin/skills/apt-spar/SKILL.md +315 -0
  110. package/dist/plugin/skills/apt-triage/AGENT-BRIEF.md +84 -0
  111. package/dist/plugin/skills/apt-triage/OUT-OF-SCOPE.md +75 -0
  112. package/dist/plugin/skills/apt-triage/SKILL.md +169 -0
  113. package/dist/plugin/skills/apt-update/SKILL.md +77 -10
  114. package/dist/plugin/skills/apt-verify/SKILL.md +3 -0
  115. package/dist/plugin/skills/apt-verify-proof/SKILL.md +10 -5
  116. package/dist/plugin/skills/apt-watch-ci/SKILL.md +166 -0
  117. package/dist/plugin/skills/apt-zoom-out/SKILL.md +130 -0
  118. package/package.json +1 -1
  119. package/prompts/conductor-framework-context.md +63 -0
  120. package/prompts/conductor-system.md +11 -0
  121. package/skills/apt-close-task/SKILL.md +1 -0
  122. package/skills/apt-discuss/SKILL.md +47 -5
  123. package/skills/apt-execute/SKILL.md +9 -0
  124. package/skills/apt-plan/SKILL.md +12 -0
  125. package/skills/apt-pr-review/SKILL.md +19 -3
  126. package/skills/apt-quick/SKILL.md +19 -8
  127. package/skills/apt-researcher.md +1 -0
  128. package/skills/apt-setup/SKILL.md +33 -2
  129. package/skills/apt-verify-proof/SKILL.md +7 -5
  130. package/src/cli/ci-watch/stop-matrix.mjs +17 -0
  131. package/src/cli/commands/ci-watch.mjs +113 -2
  132. package/src/cli/commands/features-audit.mjs +164 -5
  133. package/src/cli/commands/health-check.mjs +115 -2
  134. package/src/cli/commands/init.mjs +52 -4
  135. package/src/cli/commands/modes.mjs +11 -0
  136. package/src/cli/commands/pr-review-audit-fixer.mjs +18 -5
  137. package/src/cli/commands/task.mjs +83 -5
  138. package/src/cli/commands/validate-evidence.mjs +158 -17
  139. package/src/cli/commands/vitest-doctor.mjs +173 -0
  140. package/src/cli/config/gitignore-drift.mjs +74 -3
  141. package/src/cli/config/load.mjs +188 -2
  142. package/src/cli/consistency/parse-review.mjs +6 -0
  143. package/src/cli/dispatch.mjs +23 -2
  144. package/src/cli/gate/gates/gitignore-in-sync.mjs +5 -2
  145. package/src/cli/gate/gates/review-clean.mjs +24 -19
  146. package/src/cli/gate/gates/verify-approved.mjs +97 -14
  147. package/src/cli/help.mjs +7 -2
  148. package/src/cli/install/runtime-detect.mjs +9 -0
  149. package/src/cli/task/index-md.mjs +15 -2
  150. package/templates/config.json +2 -7
  151. package/workflows/verify-proof.md +8 -3
@@ -0,0 +1,104 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/grill-with-docs
4
+ Licensed under MIT. Modifications: ported as an apt:discuss posture loader,
5
+ extended with the validated 100-token reframe sentence and the
6
+ autonomy-aware degradation table from the Pocock adoption brainstorm
7
+ (Architectural principles to lock §2).
8
+ -->
9
+
10
+ # Grill Discipline — apt:discuss posture loader
11
+
12
+ This appendix loads into `apt:discuss`'s reasoning context whenever the
13
+ skill is invoked in decision-lock posture (or as a sub-step inside
14
+ `apt:improve` / `apt:triage`'s grill loop). It carries two load-bearing
15
+ artifacts:
16
+
17
+ 1. The 100-token **reframe sentence** validated by the V2 grill-comparison
18
+ experiment (43/44 vs 38/44 blind-judge score against Pocock's verbatim
19
+ `grill-with-docs`).
20
+ 2. The **autonomy-aware degradation table** that prevents full-auto runs
21
+ from grinding to a halt grilling every gray area.
22
+
23
+ ## The reframe sentence (validated, 43/44 vs 38/44)
24
+
25
+ > **Your job is not to emit a plan; your job is to resolve the design
26
+ > tree until planning is mechanical.**
27
+
28
+ This sentence is the *first thing* you load into your reasoning context
29
+ when entering decision-lock posture. It does two things at once:
30
+
31
+ - It refuses the "I'll just emit a plan and let the executor figure
32
+ out the gaps" anti-pattern. Plans with unresolved gray areas push the
33
+ cost into execution where rollbacks are 10× more expensive.
34
+ - It frames the goal as *resolving a design tree*, not *answering a
35
+ questionnaire*. The interview-style "ask the user 47 clarifying
36
+ questions" is the failure mode this reframe blocks.
37
+
38
+ The empirical V1 + V2 evidence is in
39
+ `.aperant/experiments/grill-comparison-20260513/SUMMARY-FOR-AGENT-REVIEW.md`.
40
+
41
+ ## Autonomy-aware degradation table (load-bearing)
42
+
43
+ The grill discipline runs at every autonomy level — the *interaction
44
+ shape* degrades, not the discipline itself. This is the canonical
45
+ source for this rule; new skills (apt:improve, apt:triage) reference
46
+ THIS table rather than re-stating the policy.
47
+
48
+ | Autonomy | Mode | Behavior |
49
+ |---|---|---|
50
+ | **1 (Supervised)** | Grill everything | Ask the user for every load-bearing decision. The user reviews each Q&A turn before the next one fires. |
51
+ | **2 (Balanced / Semi)** | Batch-recommend | Auto-recommend per decision; collect all recommendations into a single batch the user reviews at the end. This is the existing `--review-auto` pattern. |
52
+ | **3 (Full auto / YOLO)** | Auto-lock with escalation triggers | Auto-recommend and lock decisions silently. Escalate to the user only when one of THREE triggers fires (below). |
53
+
54
+ ## The three escalation triggers (Autonomy 3 only)
55
+
56
+ At Autonomy 3, the agent locks recommendations silently — **EXCEPT** when:
57
+
58
+ 1. **Conflict with a prior locked decision.** The new recommendation
59
+ contradicts a decision already written to
60
+ `.aperant/context/notes/{task-id}.md` (or any other notes file under
61
+ `.aperant/context/notes/`). Re-litigating a locked decision needs
62
+ human sign-off.
63
+ 2. **Critical-path file touched.** The decision's downstream effect
64
+ modifies a file matching a glob in
65
+ `.aperant/config.json.risk_map.critical_paths` (e.g., auth, billing,
66
+ migration paths). Critical-path changes always escalate at every
67
+ autonomy level — this trigger is the autonomy-3 surface for the same
68
+ policy.
69
+ 3. **No defensible default exists.** Neither AGENTS.md nor an existing
70
+ codebase pattern provides a defensible answer. "Just pick one" is
71
+ not a defensible default; the agent must say "I see two viable
72
+ paths and no precedent — which do you want?"
73
+
74
+ These three triggers cover the cases where a silent auto-lock would
75
+ cause real harm. Everything else gets locked, logged, and surfaced in
76
+ the final report only — not as a blocking prompt.
77
+
78
+ ## Practical consequence for new skills
79
+
80
+ When `apt:improve`'s deepening loop, `apt:triage`'s priority resolution,
81
+ or any other agent reaches a gray area:
82
+
83
+ - It loads THIS appendix into reasoning context.
84
+ - It reads the current autonomy from `.aperant/config.json` (or the
85
+ per-task autonomy from `apt-tools task get`).
86
+ - It enters the matching row of the degradation table.
87
+ - At Autonomy 3, it walks the three triggers before deciding to lock or
88
+ escalate.
89
+
90
+ The "ask first vs lock first" decision is NOT a per-skill policy.
91
+ Reasoning lives here; every grill-loop-bearing skill references it.
92
+
93
+ ## When NOT to load this appendix
94
+
95
+ This appendix is for **decision-lock** posture (convergent discussion
96
+ where the user has a concrete task with implicit gray areas). The
97
+ **brainstorm** posture (divergent — user has a rough vision, exploring
98
+ options) does NOT load this appendix; brainstorm has its own posture
99
+ encoded in apt:discuss's `<objective>` block.
100
+
101
+ `apt:zoom-out` (a sibling skill, also Pocock-adopted) does NOT load
102
+ this appendix. Zoom-out is descriptive ("show me the broader picture"),
103
+ not normative ("lock this decision"). Loading grill-discipline there
104
+ would mis-fire the reframe sentence on a read-only operation.
@@ -0,0 +1,79 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/zoom-out
4
+ Licensed under MIT. Modifications: ported as a loaded-helper for apt:discuss
5
+ brainstorm mode so the discipline activates without spawning the full
6
+ apt:zoom-out skill (the latter is a router-invocable verb on its own).
7
+ -->
8
+
9
+ # Zoom-Out Helper — apt:discuss brainstorm mode loaded helper
10
+
11
+ This appendix loads into `apt:discuss` brainstorm mode when the user's
12
+ turn contains a zoom-out trigger phrase. The full
13
+ `/apt:zoom-out` skill (router-invocable) is the right answer when the
14
+ user invokes it explicitly; this helper is the right answer when the
15
+ zoom-out request surfaces *inside* a brainstorm discussion.
16
+
17
+ ## When to load this appendix
18
+
19
+ Inside an active `apt:discuss --brainstorm` session, if the user's turn
20
+ contains any of these phrases (or their natural-language variants):
21
+
22
+ - "give me a broader picture"
23
+ - "I'm lost in this area"
24
+ - "explain how this fits"
25
+ - "what's the surrounding architecture"
26
+ - "zoom out from {topic}"
27
+
28
+ …load this appendix into reasoning context and follow the helper
29
+ process below. The brainstorm posture stays active — you don't pivot
30
+ out of `apt:discuss`; you augment its reasoning with the orientation
31
+ discipline.
32
+
33
+ ## Process (helper mode, not full skill)
34
+
35
+ 1. **Identify the area.** Pull the noun phrase from the user's message
36
+ (e.g., "the sparring engine"). If ambiguous, ask a single targeted
37
+ clarifying question — do NOT enter a 20-question interview.
38
+
39
+ 2. **Load CONTEXT.md term-blocks if matching.** Same as the full
40
+ `apt:zoom-out` skill: if the area name matches a term or alias in
41
+ `CONTEXT.md`, pre-load that term-block's definition + flagged
42
+ ambiguities into the orientation.
43
+
44
+ 3. **Emit a compressed orientation INLINE in the discussion.** Format:
45
+
46
+ > **Purpose:** {one sentence}
47
+ > **Entry points:** `{file1}`, `{file2}`
48
+ > **State owners:** `{file3}` ({what state})
49
+ > **External boundaries:** `{file4}` ({what external})
50
+ > **Watch out for:** {one-line fragile area}
51
+
52
+ Three to six lines. The full one-page `apt:zoom-out` report is
53
+ overkill when the user is mid-discussion — they want enough context
54
+ to keep brainstorming, not a separate artifact.
55
+
56
+ 4. **Resume brainstorm posture.** After the orientation block, ask:
57
+ "Want me to keep zooming, lock a decision, or stay in brainstorm?"
58
+ so the user explicitly drives whether to deepen.
59
+
60
+ ## When NOT to load this appendix
61
+
62
+ - In decision-lock posture (the user wants to *resolve* a decision, not
63
+ *orient* themselves) — load `grill-discipline.md` instead.
64
+ - When the user explicitly types `/apt:zoom-out` — they invoked the
65
+ full skill; let that skill run unmodified.
66
+ - In `apt:plan` — the planner's Phase-0 codebase investigation already
67
+ covers orientation. Loading this helper there would duplicate work.
68
+
69
+ ## Relationship to the full apt:zoom-out skill
70
+
71
+ | | `apt:discuss + zoom-out-helper` | `/apt:zoom-out` (full skill) |
72
+ |---|---|---|
73
+ | Invocation | Detected mid-brainstorm | User-explicit verb |
74
+ | Output | 3-6 line inline orientation | One-page report |
75
+ | Side effects | None | None (read-only) |
76
+ | Posture after | Brainstorm continues | Skill exits — no continuation |
77
+
78
+ Same underlying discipline; different surface shapes for different
79
+ work contexts.
@@ -15,11 +15,14 @@ execution_modes:
15
15
  - auto
16
16
  - step
17
17
  allowed-tools: "Read, Write, Edit, Bash, Grep, Glob"
18
- argument-hint: "apt:execute [--continue]"
18
+ argument-hint: "apt:execute [--continue] [--subtask <id>] [--parallel] [--wave <N>] [--tdd] [--no-tdd]"
19
19
  gates:
20
20
  - constitution-read
21
21
  - constitution-coverage
22
22
  - plan-exists
23
+ config_keys:
24
+ - coding.tdd_default
25
+ - tdd.iron_law
23
26
  ---
24
27
  <objective>
25
28
  Read an implementation plan, iterate through subtasks, implement each one with atomic commits, and track progress. Supports both sequential (default) and wave-parallel execution modes.
@@ -79,6 +82,8 @@ When `/apt:execute` spawns ANY subagent (executor, wave workers, post-subtask re
79
82
  | `--subtask <id>` | Jump to a specific subtask (skip dependency check — user override) |
80
83
  | `--parallel` | Force wave-parallel mode even if `parallelization.enabled` is false in config |
81
84
  | `--wave <N>` | Execute only wave N (implies wave mode). Useful for pacing or quota management |
85
+ | `--tdd` | Activate the vertical-tracer-bullet TDD discipline for this run (gates `<tdd_iron_law>`). Inverse of `--no-tdd`. Hard-exempt on QUICK tasks per Fast Path Guarantee (ID-05). |
86
+ | `--no-tdd` | Deactivate TDD even if `coding.tdd_default: true` is set in config. |
82
87
  </arguments>
83
88
 
84
89
  <process>
@@ -134,6 +139,44 @@ Before loading context, determine execution mode:
134
139
 
135
140
  4. **If Sequential Mode:** proceed to Section 1 below (existing behavior, unchanged).
136
141
 
142
+ ### 0a.1. TDD Discipline Detection (Pocock adoption AC3)
143
+
144
+ Compute whether the vertical-tracer-bullet TDD discipline is active for
145
+ this run. The `<tdd_iron_law>` block in Section 3c is gated on this
146
+ boolean. Three inputs combine; QUICK is hard-exempt regardless.
147
+
148
+ 1. **Read config:** `coding.tdd_default` from `.aperant/config.json`
149
+ (default `false` when absent).
150
+ 2. **Read flags:** `--tdd` (force-enable) and `--no-tdd` (force-disable)
151
+ on the command line.
152
+ 3. **Read task track** from `apt-tools task get . --id {task-id}` →
153
+ `task.track`. (If unset, fall back to `complexity` field on
154
+ `implementation_plan.json`: `simple` → QUICK, otherwise STANDARD.)
155
+
156
+ Compute `tdd_active` as:
157
+
158
+ ```
159
+ if track === "QUICK":
160
+ tdd_active = false # Fast Path Guarantee — ID-05, hard-exempt
161
+ elif --no-tdd flag:
162
+ tdd_active = false # explicit user override
163
+ elif --tdd flag:
164
+ tdd_active = true # explicit user opt-in
165
+ else:
166
+ tdd_active = coding.tdd_default || legacy config.tdd.iron_law === true
167
+ ```
168
+
169
+ Carry `tdd_active` forward to Section 3c. When `tdd_active === false`,
170
+ the iron-law block is skipped entirely and execute behaves identically
171
+ to the pre-Pocock single-commit flow. When `tdd_active === true`, the
172
+ red-green-refactor sequence is mandatory and audited by gate G9.
173
+
174
+ **The QUICK exemption is a constraint, not a toggle.** A user who passes
175
+ `--tdd` on a QUICK-routed task gets `tdd_active = false` and a one-line
176
+ note in the run report: "TDD requested but skipped — QUICK Fast Path
177
+ Guarantee (ID-05)". The Pocock appendix
178
+ `appendices/tdd-mode.md` carries the rationale.
179
+
137
180
  ## 1. Load Context
138
181
 
139
182
  1. Read `AGENTS.md` if it exists — extract coding conventions, test requirements, style rules
@@ -236,11 +279,11 @@ Follow `subtask.description` to implement the changes. Rules:
236
279
  - Add/update tests if the subtask modifies testable behavior
237
280
  - Reference `prompts/coder.md` for coding methodology and environment awareness
238
281
 
239
- <tdd_iron_law enabled_when="config.tdd.iron_law === true">
282
+ <tdd_iron_law enabled_when="tdd_active === true">
240
283
 
241
- **TDD Iron Law — conditional flow.** This block activates ONLY when `.aperant/config.json` has `tdd.iron_law: true` (read in Section 0a). When the flag is absent or `false`, skip this block entirely and use the single-commit flow above behavior is unchanged.
284
+ **TDD Iron Law — conditional flow.** This block activates ONLY when `tdd_active === true` (computed in Section 0a.1 from `coding.tdd_default` config, the `--tdd` / `--no-tdd` flags, and the task track). When `tdd_active === false` — including all QUICK-routed tasks regardless of flag or config (Fast Path Guarantee, ID-05) — skip this block entirely and use the single-commit flow above. The legacy `config.tdd.iron_law` config key continues to work and is rolled into `tdd_active` as a backward-compat alias.
242
285
 
243
- When `tdd.iron_law` is on, 3c/3d/3e collapses into a strict red-green-refactor sequence with **two commits per subtask**:
286
+ When the iron law is on, 3c/3d/3e collapses into a strict red-green-refactor sequence with **two commits per subtask**:
244
287
 
245
288
  1. **Write the failing test first.** Identify or create the test file in `subtask.files` (look for `*.test.*` / `*.spec.*`). Add the test that describes the behavior you are about to implement. Do NOT touch implementation files yet.
246
289
  2. **Commit the red test.**
@@ -256,7 +299,7 @@ When `tdd.iron_law` is on, 3c/3d/3e collapses into a strict red-green-refactor s
256
299
  ```
257
300
  The audit gate `tdd-iron-law` (G9) fires during `/apt:verify` and asserts this commit order per subtask — a `feat(...)` commit that precedes the matching `test(...)` commit on the same file set is a blocking failure.
258
301
 
259
- **Rationalizations to reject** (do NOT take any of these shortcuts when `tdd.iron_law` is on):
302
+ **Rationalizations to reject** (do NOT take any of these shortcuts when `tdd_active` is on):
260
303
 
261
304
  | Rationalization | Counter-rule |
262
305
  |---|---|
@@ -340,11 +383,20 @@ executor commits introduce a new feature surface without registering it.
340
383
 
341
384
  ```bash
342
385
  node packages/framework/bin/apt-tools.mjs features-audit . \
386
+ --task-id "$TASK_ID" \
343
387
  --diff-files "$(git diff --name-only HEAD^ HEAD | tr '\n' ',')" \
344
388
  --apply-stubs
345
389
  ```
346
390
 
347
391
  Notes:
392
+ - `--task-id $TASK_ID` (BUG-025b) is mandatory when the executor runs
393
+ from the main-repo cwd instead of inside the worktree (the
394
+ orchestrator's common path). features-audit resolves the worktree's
395
+ `.aperant/features/` from the active task record and writes there,
396
+ preventing generated `*.json` from leaking into main. When invoked
397
+ from the worktree cwd directly, `--task-id` is a no-op (layer 1
398
+ detection short-circuits). Pass `--no-worktree-redirect` only when
399
+ you intentionally want to write to the invoking cwd.
348
400
  - `--apply-stubs` only runs when the matched surface's policy is
349
401
  `auto-update` (the default for `.aperant/features/*.json`). Users who
350
402
  opted out via `/apt:setup` Batch 7 get a no-op — the command still
@@ -0,0 +1,107 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/tdd
4
+ Licensed under MIT. Modifications: ported as an apt:execute appendix
5
+ gated by `tdd_active` (config.coding.tdd_default || --tdd flag) and
6
+ made QUICK-exempt per Aperant's Fast Path Guarantee (ID-05).
7
+ -->
8
+
9
+ # TDD Mode — Vertical Tracer-Bullet Discipline (apt:execute appendix)
10
+
11
+ This appendix loads into `apt:execute`'s context when `tdd_active === true`
12
+ (see SKILL.md §0a.1). It carries the vertical-tracer-bullet discipline
13
+ Pocock's `tdd` skill captured. The audit gate G9 (`tdd-iron-law`) enforces
14
+ the commit order; this prose explains the **why**.
15
+
16
+ ## Why vertical tracer bullets, not horizontal layers
17
+
18
+ A "vertical slice" of TDD means: for each subtask, write one failing
19
+ test that describes the **smallest end-to-end behavior change the user
20
+ will care about**, then implement only enough to make it green.
21
+ Horizontal TDD ("write all the data-layer tests first, then all the
22
+ service tests, then all the UI tests") accumulates dead inventory and
23
+ hides whether the slice actually delivers user value.
24
+
25
+ Concretely:
26
+
27
+ - A vertical-slice subtask titled "Solo dogfooder gets a PRD-shaped
28
+ spec on STANDARD" should commit one `test(plan): STANDARD emits PRD
29
+ shape` red test first — exercising the user-visible behavior — then
30
+ one `feat(plan): branch spec.md on track` green commit. Two commits.
31
+ Done.
32
+ - A horizontal-slice subtask titled "edit apt-plan SKILL.md" gets you a
33
+ test that pins prose, not a test that pins user value. The G9 audit
34
+ will pass technically but the discipline failed.
35
+
36
+ The vertical-slice subtask schema (`user_value` field, mandatory on
37
+ STANDARD/DEEP per AC2) is **upstream** of this discipline — TDD bites
38
+ hardest when the subtask was already framed as user value, not file
39
+ scope.
40
+
41
+ ## The five rules of vertical tracer bullets
42
+
43
+ These five rules are the load-bearing discipline; ignoring any one of
44
+ them collapses TDD back into ceremony.
45
+
46
+ 1. **Write the failing test from the spec, not from the implementation
47
+ you're about to write.** If you write the test after you mentally
48
+ draft the implementation, the test only pins what you wrote —
49
+ not what the spec required. Read the relevant `acceptance_criteria`
50
+ id-ref, then write a test that fails because that AC isn't met yet.
51
+
52
+ 2. **Verify the test fails for the *right reason*.** A `ReferenceError`
53
+ because the function doesn't exist yet is not the same as the
54
+ assertion failing on a value mismatch. The G9 audit treats any
55
+ non-zero exit as RED, but the discipline demands you check the
56
+ failure mode is "behavior wrong", not "code shape wrong".
57
+
58
+ 3. **Implement the minimum to turn the test green.** No speculative
59
+ abstractions. No "while I'm here, I'll refactor X." The vertical
60
+ slice is one test + one minimum impl. Refactor lives in a follow-up
61
+ subtask with its own test.
62
+
63
+ 4. **Commit the test before the implementation.** This is the iron-law
64
+ commit order audit gate G9 enforces. A `feat(...)` commit that
65
+ precedes the matching `test(...)` commit on the same file set is a
66
+ blocking failure at `/apt:verify`.
67
+
68
+ 5. **Don't grow the test surface to cover edge cases the spec didn't
69
+ list.** Edge cases are subtasks of their own (with their own AC
70
+ id-refs). The vertical-slice rule applies recursively: each edge
71
+ case is a new tracer bullet through the whole stack, not a wider
72
+ suite of tests for the same slice.
73
+
74
+ ## Fast Path Guarantee — QUICK is hard-exempt
75
+
76
+ `tdd_active` is forced `false` when the task's track is `"QUICK"`,
77
+ regardless of flag or config. The rationale: QUICK is the one-shot
78
+ fast path for trivial fixes (typo, copy change, single-line config
79
+ update). Forcing TDD ceremony on those tasks violates the Fast Path
80
+ Guarantee (ID-05) — the user opted into speed, not discipline. If a
81
+ QUICK-routed task genuinely needs TDD, the right move is to re-route
82
+ it as STANDARD via `/apt:plan` (which the router will do for any task
83
+ with >1 file or >30 words of description).
84
+
85
+ The skill body emits a one-line note in the run report when `--tdd`
86
+ was passed on a QUICK task: "TDD requested but skipped — QUICK Fast
87
+ Path Guarantee (ID-05)". This is intentional surface — the user sees
88
+ that their flag was overridden by the constraint.
89
+
90
+ ## Backward-compat alias
91
+
92
+ The legacy `config.tdd.iron_law` key continues to enable TDD for
93
+ projects that adopted Aperant before the Pocock content-format
94
+ upgrade. The new computation rolls it into `tdd_active`:
95
+
96
+ ```
97
+ tdd_active = (
98
+ (--tdd flag) ||
99
+ (coding.tdd_default === true) ||
100
+ (config.tdd.iron_law === true)
101
+ )
102
+ && (track !== "QUICK")
103
+ && !(--no-tdd flag)
104
+ ```
105
+
106
+ The two config keys (`coding.tdd_default` and `tdd.iron_law`) coexist
107
+ without conflict; either set to `true` enables TDD by default.
@@ -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/improve-codebase-architecture/DEEPENING.md
4
+ Licensed under MIT. Modifications: scoped to Aperant's apt:improve
5
+ Phase-1 explore step and aligned with the deletion-test priority
6
+ rubric in Phase 2.
7
+ -->
8
+
9
+ # DEEPENING — Domain-modeling depth lens
10
+
11
+ This lens asks: **does this area model the domain at the right depth?**
12
+ Are the abstractions earning their keep, or are they shallow wrappers
13
+ hiding nothing?
14
+
15
+ The discipline is to **find abstractions that have failed to deepen** —
16
+ classes, modules, or types that started as a single-use convenience and
17
+ never grew into something that captures domain meaning.
18
+
19
+ ## What "deep" means
20
+
21
+ A deep abstraction:
22
+
23
+ - Has a name that maps to a domain concept the user / business cares
24
+ about
25
+ - Encapsulates more behavior than its interface suggests (you can call
26
+ one method and trust it to handle multiple internal concerns)
27
+ - Reads naturally in client code without the reader needing to know
28
+ the abstraction's internals
29
+
30
+ A shallow abstraction:
31
+
32
+ - Has a name that mirrors implementation detail rather than domain
33
+ concept (e.g., `DataManager`, `Helper`, `Utils`)
34
+ - Encapsulates almost no behavior — the interface is wider than the
35
+ internals (mostly pass-through)
36
+ - Reads as noise in client code; the reader has to look inside the
37
+ abstraction to know what it does
38
+
39
+ ## Red flags this lens surfaces
40
+
41
+ - **Anemic types** — types that are bags of fields with no methods, OR
42
+ classes with methods that just return fields.
43
+ - **Pass-through wrappers** — `class FooService { constructor(api) { this.api = api } create(x) { return this.api.create(x) } }` adds nothing.
44
+ - **Single-call-site abstractions** — extracted "for reuse" but only
45
+ called from one place. Inline them.
46
+ - **God objects** — abstractions that grew too deep AND too wide,
47
+ collecting unrelated responsibilities. Different problem, same lens.
48
+
49
+ ## Apply in Phase 1
50
+
51
+ When the explore step scans the named area:
52
+
53
+ 1. For each module / class / type, ask: "what domain concept does this
54
+ model?"
55
+ 2. If the answer is "none — it's an implementation detail dressed up as
56
+ a concept", flag it as a candidate.
57
+ 3. Note in the inventory: `{File}:{Symbol} — shallow ({reason})`. The
58
+ deletion test in Phase 2 will rank these.
59
+
60
+ ## What this lens does NOT cover
61
+
62
+ - Boundary shape between modules → see `INTERFACE-DESIGN.md`
63
+ - Naming consistency within / across modules → see `LANGUAGE.md`
64
+
65
+ DEEPENING is about whether each abstraction is the right size. The
66
+ sibling lenses are about whether the gaps between them are well-shaped
67
+ and whether the language is consistent.
68
+
69
+ ## Deletion test (Phase 2 prep)
70
+
71
+ For each candidate this lens flags, the Phase-2 deletion test asks:
72
+
73
+ > If I deleted `{Symbol}` and inlined its body at every call site, what
74
+ > domain meaning would be lost?
75
+
76
+ If the answer is "nothing — it was just a name on a syntactic shape",
77
+ the deletion test passes and the candidate is high-priority for refactor
78
+ (remove the abstraction; the area gets shallower in surface area but
79
+ deeper in meaning per remaining concept).
80
+
81
+ If the answer is "we'd lose the {domain concept} as a first-class
82
+ thing in the code", the deletion test fails — the abstraction was
83
+ earning its keep, just maybe at the wrong depth. Re-scope to a sibling
84
+ lens.
@@ -0,0 +1,97 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/improve-codebase-architecture/INTERFACE-DESIGN.md
4
+ Licensed under MIT. Modifications: scoped to Aperant's apt:improve
5
+ Phase-1 explore step and aligned with apt:review Pass 4's boundary
6
+ audit semantics (this lens is proactive; Pass 4 is reactive).
7
+ -->
8
+
9
+ # INTERFACE-DESIGN — Boundary-shape lens
10
+
11
+ This lens asks: **are the boundaries between modules well-shaped?** Are
12
+ there feature-envy patterns? Hidden coupling? Async leakage? Boundary
13
+ violations the reactive `apt:review` Pass 4 audit would catch if a diff
14
+ crossed them, but which currently exist statically and nobody is
15
+ auditing?
16
+
17
+ ## Red flags this lens surfaces
18
+
19
+ ### Feature envy
20
+ A method in module A spends most of its time reading fields from
21
+ module B's types. The behavior wants to live in B but the import
22
+ direction made it land in A. Symptom: lots of `b.x`, `b.y`, `b.z`
23
+ accesses in A's methods.
24
+
25
+ ### Hidden coupling
26
+ Module A imports module B by accident — not because B's exported
27
+ surface is being used, but because B re-exports something A actually
28
+ wanted from a third place. Symptom: `import { foo } from './b'` where
29
+ `foo` is defined in C and B is just a passthrough.
30
+
31
+ ### Async leakage
32
+ A function in A returns a Promise, but the work it kicks off settles
33
+ asynchronously somewhere else (timer, event handler, background job).
34
+ The caller can `await` the Promise and think they're done, but the
35
+ real work is still in flight. Symptom: tests pass synchronously but
36
+ real-world behavior is racy.
37
+
38
+ ### Wide-then-narrow interfaces
39
+ Module A exports 30 functions, but only 3 are called externally. The
40
+ other 27 are accidental surface. Symptom: `index.ts` exports `*`.
41
+
42
+ ### Pass-through importers
43
+ Module A exports `foo` which it imports from B and re-exports
44
+ unchanged. Adds a hop with no value. Symptom: A's body contains
45
+ `export { foo } from './b'` and nothing else for that symbol.
46
+
47
+ ### Dependency direction violations
48
+ Per Aperant's import-direction convention (`packages/` never imports
49
+ from `cloud/`), this lens flags any backward import. The static lint
50
+ catches some of these; this lens catches the rest (e.g., implicit type
51
+ re-exports that leak `cloud/` types into `packages/`).
52
+
53
+ ## Apply in Phase 1
54
+
55
+ When the explore step scans the named area:
56
+
57
+ 1. For each module boundary (file-level or directory-level), identify
58
+ the explicit imports + exports.
59
+ 2. Look for the 6 red flags above.
60
+ 3. Note in the inventory: `{Module A} ↔ {Module B} — {red-flag name}
61
+ ({one-line evidence})`.
62
+
63
+ ## Distinguishing this from DEEPENING and LANGUAGE
64
+
65
+ | Lens | Question |
66
+ |---|---|
67
+ | **DEEPENING** | Does each abstraction earn its keep at its current depth? |
68
+ | **INTERFACE-DESIGN** | Are the gaps between abstractions well-shaped? |
69
+ | **LANGUAGE** | Does the codebase use the same word for the same thing? |
70
+
71
+ A red flag in one lens often surfaces in another, but the lens is the
72
+ diagnostic angle. A god-object problem is DEEPENING (the abstraction
73
+ is too deep AND too wide); a feature-envy problem is INTERFACE-DESIGN
74
+ (the boundary is in the wrong place).
75
+
76
+ ## Deletion test (Phase 2 prep)
77
+
78
+ For each candidate this lens flags, the Phase-2 deletion test asks:
79
+
80
+ > If I moved this code across the boundary it currently sits behind
81
+ > (or removed the boundary entirely), what would break?
82
+
83
+ If the answer is "nothing important — the boundary was an accident",
84
+ the deletion test passes and the candidate is high-priority for
85
+ refactor (move the code; the boundary disappears).
86
+
87
+ If the answer is "we'd lose the ability to test / mock / version this
88
+ slice independently", the deletion test fails — the boundary was
89
+ earning its keep, even if the shape is awkward. Re-scope to "reshape"
90
+ rather than "remove".
91
+
92
+ ## What this lens does NOT cover
93
+
94
+ - Whether the abstractions on either side of the boundary are deep
95
+ enough → see `DEEPENING.md`
96
+ - Whether the boundary's types and method names use the codebase's
97
+ domain language → see `LANGUAGE.md`