@aperant/framework 0.6.4 → 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 +38 -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/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/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/route.mjs +1 -1
- 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 +108 -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/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 +9 -0
- package/dist/cli/route/skill-discover.d.mts.map +1 -1
- package/dist/cli/route/skill-discover.mjs +11 -0
- package/dist/cli/route/skill-discover.mjs.map +1 -1
- package/dist/cli/skill-author/contract.d.mts +1 -0
- package/dist/cli/skill-author/contract.d.mts.map +1 -1
- package/dist/cli/skill-author/contract.mjs +7 -0
- package/dist/cli/skill-author/contract.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 -125
- package/prompts/coder.md +2 -0
- package/prompts/planner.md +12 -0
- package/prompts/spec_writer.md +9 -0
- package/skills/apt/SKILL.md +1 -0
- package/skills/apt-close-task/SKILL.md +32 -1
- package/skills/apt-debug/SKILL.md +39 -6
- package/skills/apt-debug/appendices/diagnose-discipline.md +119 -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 +25 -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-execute/SKILL.md +48 -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-plan/SKILL.md +147 -4
- package/skills/apt-planner.md +42 -1
- package/skills/apt-pr-review/SKILL.md +46 -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 +30 -0
- package/skills/apt-review/SKILL.md +2 -0
- package/skills/apt-run/SKILL.md +32 -4
- package/skills/apt-setup/SKILL.md +128 -2
- package/skills/apt-ship/SKILL.md +47 -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-verify/SKILL.md +3 -0
- package/skills/apt-verify-proof/SKILL.md +3 -0
- package/skills/apt-watch-ci/SKILL.md +163 -0
- package/skills/apt-zoom-out/SKILL.md +130 -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/modes.mjs +215 -0
- package/src/cli/commands/route.mjs +1 -1
- package/src/cli/commands/task.mjs +125 -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/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 +12 -0
- package/src/cli/skill-author/contract.mjs +7 -0
- 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
|
@@ -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="
|
|
282
|
+
<tdd_iron_law enabled_when="tdd_active === true">
|
|
240
283
|
|
|
241
|
-
**TDD Iron Law — conditional flow.** This block activates ONLY when
|
|
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
|
|
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 `
|
|
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
|
|---|---|
|
|
@@ -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`
|
|
@@ -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/improve-codebase-architecture/LANGUAGE.md
|
|
4
|
+
Licensed under MIT. Modifications: scoped to Aperant's apt:improve
|
|
5
|
+
Phase-1 explore step and aligned with CONTEXT.md's aliases-to-avoid
|
|
6
|
+
field — this lens reads that field to catch term conflations.
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# LANGUAGE — Naming-consistency lens
|
|
10
|
+
|
|
11
|
+
This lens asks: **does the codebase use the same word for the same
|
|
12
|
+
thing?** Do field names match domain language? Is CONTEXT.md's
|
|
13
|
+
"aliases to avoid" list violated anywhere?
|
|
14
|
+
|
|
15
|
+
Naming inconsistency is invisible until you trip over it. A reader who
|
|
16
|
+
hits `userId` in one file and `user_id` in another, or `account` in
|
|
17
|
+
the UI and `customer` in the backend, has to mentally translate
|
|
18
|
+
between vocabularies — and that translation cost accumulates across
|
|
19
|
+
every code review and every onboarding.
|
|
20
|
+
|
|
21
|
+
## Red flags this lens surfaces
|
|
22
|
+
|
|
23
|
+
### Same concept, two names
|
|
24
|
+
The codebase has `user`, `account`, and `customer` referring to the
|
|
25
|
+
same entity in different layers. Pick one and rename. CONTEXT.md's
|
|
26
|
+
"aliases to avoid" field is the canonical place to record which name
|
|
27
|
+
won.
|
|
28
|
+
|
|
29
|
+
### Same name, two concepts
|
|
30
|
+
The codebase has two distinct `Session` types — one for an auth
|
|
31
|
+
session and one for a chat session. Disambiguate with a domain prefix
|
|
32
|
+
(`AuthSession`, `ChatSession`) so a reader doesn't have to import the
|
|
33
|
+
right one based on file location.
|
|
34
|
+
|
|
35
|
+
### Field-name drift across layers
|
|
36
|
+
The backend stores `created_at`, the API returns `createdAt`, the UI
|
|
37
|
+
displays `Date created`. The serialization layer becomes a translation
|
|
38
|
+
graveyard. Standardize across all three layers.
|
|
39
|
+
|
|
40
|
+
### Implementation-detail names
|
|
41
|
+
Field or symbol names that describe *how* something is stored or
|
|
42
|
+
computed rather than *what* it represents. `is_processed_boolean` vs
|
|
43
|
+
`is_processed`. `temp_holder_arr` vs `pending_items`.
|
|
44
|
+
|
|
45
|
+
### CONTEXT.md violations
|
|
46
|
+
If `CONTEXT.md` declares "Plan thread" with aliases-to-avoid: "Plan
|
|
47
|
+
session, plan chat", any code in the area that calls it a "plan
|
|
48
|
+
session" or "plan chat" is a violation. Grep CONTEXT.md aliases as
|
|
49
|
+
part of this lens.
|
|
50
|
+
|
|
51
|
+
## Apply in Phase 1
|
|
52
|
+
|
|
53
|
+
When the explore step scans the named area:
|
|
54
|
+
|
|
55
|
+
1. Read `CONTEXT.md` (if present) — every term-block's `Aliases to
|
|
56
|
+
avoid` field becomes a grep target.
|
|
57
|
+
2. Grep the area for each alias. Each hit is a candidate.
|
|
58
|
+
3. Look for the 4 other red flags above by inspection.
|
|
59
|
+
4. Note in the inventory: `{File}:{Line} — uses {wrong-term} for
|
|
60
|
+
{canonical-term} ({CONTEXT.md reference if applicable})`.
|
|
61
|
+
|
|
62
|
+
## Apply in Phase 3 (deepening loop)
|
|
63
|
+
|
|
64
|
+
When the user picks a LANGUAGE candidate, the deepening loop should
|
|
65
|
+
write the canonical decision into CONTEXT.md via `apt-tools context
|
|
66
|
+
write`:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
apt-tools context write . \
|
|
70
|
+
--term "{canonical}" \
|
|
71
|
+
--definition "{one-line}" \
|
|
72
|
+
--aliases-to-avoid "{loser1}, {loser2}"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This is the cycle: LANGUAGE lens surfaces conflations → user picks the
|
|
76
|
+
canonical term → CONTEXT.md upserts the term-block → future LANGUAGE
|
|
77
|
+
passes use CONTEXT.md as the grep source.
|
|
78
|
+
|
|
79
|
+
## Distinguishing this from DEEPENING and INTERFACE-DESIGN
|
|
80
|
+
|
|
81
|
+
A symbol can have a perfectly good name and still be the wrong depth
|
|
82
|
+
(DEEPENING) or sit behind the wrong boundary (INTERFACE-DESIGN).
|
|
83
|
+
LANGUAGE is orthogonal — it asks "regardless of where this lives or
|
|
84
|
+
how big it is, does its name match the codebase's vocabulary?"
|
|
85
|
+
|
|
86
|
+
## Deletion test (Phase 2 prep)
|
|
87
|
+
|
|
88
|
+
The deletion test for LANGUAGE candidates is unusual: deleting the
|
|
89
|
+
*wrong* name doesn't help unless you replace it with the right one. So
|
|
90
|
+
the Phase-2 priority rubric for LANGUAGE candidates is:
|
|
91
|
+
|
|
92
|
+
> Number of call sites that read with friction × cost of rename
|
|
93
|
+
> divided by ergonomic gain.
|
|
94
|
+
|
|
95
|
+
High-call-site, cheap-rename, real-confusion candidates are
|
|
96
|
+
high-priority. One-off conflations that aren't blocking anyone are
|
|
97
|
+
low-priority — record them in CONTEXT.md and move on.
|
|
98
|
+
|
|
99
|
+
## What this lens does NOT cover
|
|
100
|
+
|
|
101
|
+
- Abstraction depth → `DEEPENING.md`
|
|
102
|
+
- Boundary shape → `INTERFACE-DESIGN.md`
|
|
103
|
+
|
|
104
|
+
LANGUAGE is read-only of the symbol's *name*, not its *shape*.
|