pi-anchorloop 0.0.0-stage → 2.0.0
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/LICENSE +21 -0
- package/README.md +63 -2
- package/README.zh-TW.md +64 -0
- package/hooks/validate_tool_use.py +88 -0
- package/hooks/validators/__init__.py +1 -0
- package/hooks/validators/constants.py +47 -0
- package/hooks/validators/durable_validator.py +89 -0
- package/hooks/validators/rule_validator.py +42 -0
- package/hooks/validators/skill_validator.py +144 -0
- package/hooks/validators/utils.py +71 -0
- package/package.json +44 -4
- package/pi/anchor-gate.ts +84 -0
- package/pi/decision-tool.ts +88 -0
- package/pi/second-thought.ts +242 -0
- package/pi/support/validators.ts +403 -0
- package/pi/ttsr.ts +516 -0
- package/pi/validate-tool-use.ts +27 -0
- package/skills/agent-terse/SKILL.md +46 -0
- package/skills/anchorloop/PRINCIPLES.md +34 -0
- package/skills/anchorloop/SKILL.md +76 -0
- package/skills/anchorloop/playbooks/autonomous-run.md +12 -0
- package/skills/anchorloop/playbooks/pause.md +10 -0
- package/skills/anchorloop/playbooks/pickup.md +11 -0
- package/skills/answering/SKILL.md +19 -0
- package/skills/answering/playbooks/compare.md +9 -0
- package/skills/answering/playbooks/explain.md +9 -0
- package/skills/coding/MINI-SDD.md +61 -0
- package/skills/coding/SKILL.md +27 -0
- package/skills/coding/playbooks/bug-fix.md +11 -0
- package/skills/coding/playbooks/feature.md +15 -0
- package/skills/coding/playbooks/perf.md +10 -0
- package/skills/coding/playbooks/prototype.md +14 -0
- package/skills/coding/playbooks/refactoring.md +12 -0
- package/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +48 -0
- package/skills/grilling/SKILL.md +30 -0
- package/skills/human-feedback/SKILL.md +83 -0
- package/skills/inspecting/SKILL.md +49 -0
- package/skills/inspecting/playbooks/diff-review.md +57 -0
- package/skills/inspecting/playbooks/qa-release.md +9 -0
- package/skills/investigating/SKILL.md +22 -0
- package/skills/investigating/playbooks/diagnose.md +9 -0
- package/skills/investigating/playbooks/research.md +9 -0
- package/skills/solid-loop/SKILL.md +50 -0
- package/skills/solid-loop/playbooks/apply-friction.md +15 -0
- package/skills/solid-loop/playbooks/author-skill.md +11 -0
- package/skills/solid-loop/playbooks/bootstrap.md +10 -0
- package/skills/solid-loop/references/template-skill.md +26 -0
- package/skills/writing/SKILL.md +16 -0
- package/skills/writing/playbooks/comments.md +10 -0
- package/skills/writing/playbooks/draft.md +10 -0
- package/skills/writing/playbooks/tighten.md +9 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: anchorloop
|
|
3
|
+
description: Use when a task runs while the user is away, is paused, or picks up a prior run's work (我要睡了, 跑到完成, 先暫停, 接手昨天的), and as the shared loop every entry skill runs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Anchor Loop
|
|
7
|
+
|
|
8
|
+
Every entry skill (`answering`, `investigating`, `inspecting`, `coding`, `writing`, `solid-loop`) runs this loop and supplies the steps through one of its playbooks. The target project's instructions and an exact project skill govern where they speak.
|
|
9
|
+
|
|
10
|
+
## Align
|
|
11
|
+
|
|
12
|
+
Open with one working interpretation in your own words:
|
|
13
|
+
|
|
14
|
+
Alignment: <the requested task and intended outcome>
|
|
15
|
+
|
|
16
|
+
Pick the entry's playbook from its index; with none fitting, run the loop bare. For work longer than one increment, copy the playbook's steps verbatim into `todo`, keeping each step you will not run as `skip: <reason>`, so the plan shows what was left out and why.
|
|
17
|
+
|
|
18
|
+
## Anchor
|
|
19
|
+
|
|
20
|
+
Before the first change, state:
|
|
21
|
+
|
|
22
|
+
Reality anchor: <the exact check that observes the result, and its checkpoint>
|
|
23
|
+
|
|
24
|
+
The anchorloop extension holds `write` and `edit` outside `scratch/` and `docs/specs/` until this line appears after the user's latest message.
|
|
25
|
+
|
|
26
|
+
Size the anchor to the change's actual reach and pick one method: an executable check, a user operation, human judgment, or a focused review. An anchor assigned by a coordinator governs. Pick a review anchor when the change touches a shared contract, authorization or permission data, a migration, or security, or when the Jev second thought rates its review `full`; other changes rest on their check and the author's own read of the diff. A review anchor names the realistic use it judges against and blocks on P0 and P1 findings only, recording lower ones as follow-ups; after fixes it re-checks only those findings and the lines the fixes changed, and when two consecutive rounds still raise new blocking findings the run stops and hands the trend to the user, because a fresh exploratory review each round finds new edge cases instead of converging. The checkpoint is normally once, after the last increment.
|
|
27
|
+
|
|
28
|
+
## Act
|
|
29
|
+
|
|
30
|
+
Work in the smallest useful increments through the project's native practices, deleting before adding (**Subtract before you add**).
|
|
31
|
+
|
|
32
|
+
Give follow-up work (a fix round, a retry, the next item) to a fresh subagent carrying the original brief, every later directive, and the prior report and branch, because a resumed chain silently drops directives; resume an existing subagent only for state it alone holds, such as uncommitted changes or a running process. Write briefs, follow-ups, and messages to agents by [agent-terse](../agent-terse/SKILL.md); read each subagent's output and write its summary yourself.
|
|
33
|
+
|
|
34
|
+
Report problems outside the contract as follow-ups rather than fixing them in this change, because each extra fix reopens review on code the round never meant to touch.
|
|
35
|
+
|
|
36
|
+
[PRINCIPLES.md](PRINCIPLES.md) holds the named principles the playbooks cite. The reply names a principle only when it changed a decision, together with that decision.
|
|
37
|
+
|
|
38
|
+
### Friction Notes
|
|
39
|
+
|
|
40
|
+
Each time an attempt fails and a later attempt reveals why, append a note before continuing:
|
|
41
|
+
|
|
42
|
+
- Tried: <the attempt that failed>
|
|
43
|
+
Found: <what the failure revealed>
|
|
44
|
+
Led by: <the skill or instruction line that prompted the attempt, or `none`>
|
|
45
|
+
|
|
46
|
+
Keep them in `scratch/friction.md` unless the entry names another home.
|
|
47
|
+
|
|
48
|
+
### Decision Trail
|
|
49
|
+
|
|
50
|
+
A run the user reviews after stepping away records one row per fork, completed unit, pivot, or blocker in `scratch/decisions-<task-slug>.tsv` with the `anchorloop_decision` tool. Evidence is a pointer (commit, `file:line`, artifact path), never prose, and a wrong call gets a superseding row instead of an edit. A run that picks up an existing trail reads its last rows, then records a `start` row with its run id. Before handing back, check every row against what the run actually did and build the report from the trail.
|
|
51
|
+
|
|
52
|
+
## Verify
|
|
53
|
+
|
|
54
|
+
Exercise the anchor and report what it observed. A requirement the anchor did not exercise is `unknown`; a green unrelated check is not evidence for it. Report local tests, builds, interactive runs, commit, push, CI, and deployment as separate claims; one never stands in for another. A criterion that needs human judgment is a human checkpoint: propose a `human-feedback` pass when it is still `unknown`, and record its verdict apart from executable or review evidence.
|
|
55
|
+
|
|
56
|
+
A review anchor stays open until an independent reviewer returns its verdict. When none can run or its result is lost, report `blocked: independent review` and keep merge and release closed, because the author's own review, green tests, and CI each miss what an independent reader catches.
|
|
57
|
+
|
|
58
|
+
Write the reply the playbook's `Reply:` line names, with the anchor's evidence. After a run that changed something, the extension may add a Jev second thought on that reply; it is advisory: recheck the evidence it questions, then finish or continue on your own judgment. When a calling workflow supplies an artifact, write the results into it instead of a separate report or plan.
|
|
59
|
+
|
|
60
|
+
### Reflexive Pass
|
|
61
|
+
|
|
62
|
+
Run only when friction notes exist, and say nothing about it otherwise. Classify each note: **misdirection** when the `Led by` line states or implies something `Found` contradicts; **gap** when no instruction in use states the `Found` fact. A gap the change itself resolved, or a tool slip no instruction owns, is recorded as resolved. Invoke `solid-loop` with the rest.
|
|
63
|
+
|
|
64
|
+
**Complete when:** every requirement has evidence from its anchor or is reported `unknown`, and every friction note is applied through `solid-loop` or recorded as resolved.
|
|
65
|
+
|
|
66
|
+
## Playbooks
|
|
67
|
+
|
|
68
|
+
- [autonomous-run](playbooks/autonomous-run.md): the user steps away and the run drives to a predicate without them.
|
|
69
|
+
- [pause](playbooks/pause.md): an explicit pause, going offline, a restart, or imminent compaction.
|
|
70
|
+
- [pickup](playbooks/pickup.md): resuming or taking over a prior run's work.
|
|
71
|
+
|
|
72
|
+
Lifecycle playbooks wrap the entry playbook that does the work.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
Playbooks, principles, and the decision trail are adapted from [pstack](https://github.com/backnotprop/pstack) by Lauren Tan (MIT License), revision `e44668c`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Autonomous run
|
|
2
|
+
|
|
3
|
+
**You own the exit condition.**
|
|
4
|
+
|
|
5
|
+
1. Align: state the exit condition as a predicate a command or artifact can pass or fail; a duration is not one.
|
|
6
|
+
2. Anchor: the predicate is the anchor. Set the wake mechanism: `MonitorCreate` with `onDone` or `onSignal` for an event (CI, a merge, a job), a `LoopCreate` heartbeat otherwise, plus one safety deadline.
|
|
7
|
+
3. Act: each iteration makes the smallest change the evidence justifies, checks it against the predicate, commits when it advanced, and discards it when it did not.
|
|
8
|
+
4. Act: record one decision-trail row per iteration.
|
|
9
|
+
5. Act: fix reversible mid-run discoveries yourself in their own commits, then return to the predicate. Bring only irreversible actions, user-owned decisions, or a real dead end to the user, and leave them in the trail when the user is asleep.
|
|
10
|
+
6. Verify: stop when the predicate holds. On a plateau, change approach; never relax the predicate to declare victory. A genuine dead end ends the run with a written reason.
|
|
11
|
+
|
|
12
|
+
**Reply:** the exit condition, iterations run, what landed, what was discarded, and the final predicate state.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Pause
|
|
2
|
+
|
|
3
|
+
**You own a clean stop a cold-start agent can resume from.** Runs only on an explicit pause, going offline, a restart, or imminent compaction; "keep going" is not a pause.
|
|
4
|
+
|
|
5
|
+
1. Stop at a safe boundary: finish or back out of the current step, start nothing new, and stop the subagents and monitors you started.
|
|
6
|
+
2. Take no irreversible action to pause: no new push, PR, or deploy.
|
|
7
|
+
3. Commit uncommitted work as one `wip:` commit on the current branch; when the tree is broken, say so in one line of the commit body.
|
|
8
|
+
4. Write `scratch/resume-<task-slug>.md`: intent, what is done and verified, current state, the next action, key files, and gotchas. Point to the decision trail instead of copying it.
|
|
9
|
+
|
|
10
|
+
**Reply:** where the run stopped, the `wip:` commit and whether the tree is clean, what lives only in the resume note, and the first action on resume.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Pickup
|
|
2
|
+
|
|
3
|
+
**You own the resume point.**
|
|
4
|
+
|
|
5
|
+
1. Locate the prior trail: the resume note, the decision trail, the branch, and this workspace's pi sessions only (the cwd's folder under the session directory: `~/.pi/agent/sessions/--Users-me-proj--/` for `/Users/me/proj` unless `--session-dir`, `PI_CODING_AGENT_SESSION_DIR`, or `sessionDir` moves it). Parse a long session in a subagent and keep the reduced timeline.
|
|
6
|
+
2. Reconstruct state: branch and worktree, commits landed against the base, open todos, decisions made, and processes still running.
|
|
7
|
+
3. Treat the trail as authoritative: name the resume point and redo nothing it shows finished.
|
|
8
|
+
4. Route the remaining work to its entry playbook, which owns the rest of the run.
|
|
9
|
+
5. Before reporting done, verify the inherited claims against the original goal on the real artifact; a prior self-report is not the proof.
|
|
10
|
+
|
|
11
|
+
**Reply:** where the prior run stopped, what was inherited and what was redone, the resume point, and the outcome.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: answering
|
|
3
|
+
description: Use when explaining a concept or how something works, comparing technical alternatives, summarizing results or a change for the user, or when the user says they do not follow (看不懂, show me, 講清楚一點).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Answering
|
|
7
|
+
|
|
8
|
+
Run the loop in [../anchorloop/SKILL.md](../anchorloop/SKILL.md). The anchor is that every material claim carries its source and its evidence grade as `investigating` defines them; gather missing evidence through `investigating` first.
|
|
9
|
+
|
|
10
|
+
Keep prose brief and state uncertainty where it lives. Show the shape beside the sentence it supports, with the smallest view that makes the point: a call tree or file tree for structure, pseudocode for logic, `A → B: message` lines for interaction, a table for options against criteria.
|
|
11
|
+
|
|
12
|
+
## Playbooks
|
|
13
|
+
|
|
14
|
+
- [explain](playbooks/explain.md): how something works, what changed, or what a result means.
|
|
15
|
+
- [compare](playbooks/compare.md): choosing between alternatives.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
The views are adapted from HumanLayer's [show-me](https://github.com/humanlayer/skills/tree/main/plugins/show-me) (MIT, © 2026 HumanLayer).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Compare
|
|
2
|
+
|
|
3
|
+
**You own the recommendation.** A recommendation is a judgment, not an agreement.
|
|
4
|
+
|
|
5
|
+
1. Fix the criteria that decide the choice before scoring any option.
|
|
6
|
+
2. **Observe, don't ask** for any criterion a check can settle.
|
|
7
|
+
3. Score each option against the criteria with evidence; say plainly when the premise or every option is wrong.
|
|
8
|
+
|
|
9
|
+
**Reply:** the recommendation and its deciding reason, then the options-by-criteria table and what would change the pick.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Explain
|
|
2
|
+
|
|
3
|
+
**You own the user's understanding.**
|
|
4
|
+
|
|
5
|
+
1. Name the one mechanism or outcome the user needs and lead with it.
|
|
6
|
+
2. For a change or result, start from what the user or the next maintainer will notice, then the cause; describe the change instead of showing a diff.
|
|
7
|
+
3. Cut every section that does not move the user toward that point.
|
|
8
|
+
|
|
9
|
+
**Reply:** the point in a line or two, then the supporting views with sources.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Durable phases and artifacts
|
|
2
|
+
|
|
3
|
+
Read this when work is classified as durable. The threshold itself lives in [SKILL.md](SKILL.md); this file holds the Durable phases and what each artifact contains.
|
|
4
|
+
|
|
5
|
+
Artifacts live in `docs/specs/YYYY-MM-DD-<slug>/`. Create each file when its phase is reached, not up front. Link to project instructions, ADRs, code, research, tickets, and visuals rather than copying them.
|
|
6
|
+
|
|
7
|
+
## Decision → `decision.md`
|
|
8
|
+
|
|
9
|
+
Resolve facts from their source; use `investigating` or `inspecting` when search is wide. Invoke `grilling` with `decision.md` only when it has an `open` row. Check that core rules are ready before implementation.
|
|
10
|
+
|
|
11
|
+
The file holds outcome and actors; in and out of scope; concrete scenarios; confirmed decisions; open consequential decisions. Explore every consequential branch in:
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
| Question | Answer | Basis | Status |
|
|
15
|
+
|---|---|---|---|
|
|
16
|
+
| ... | ... | request, evidence, or decision link | grounded, confirmed, or open |
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Status is `grounded`, `confirmed`, or `open`. `grounded` comes from the request, source facts, or existing decisions; `confirmed` comes from the user; `open` is a consequential user-owned decision.
|
|
20
|
+
|
|
21
|
+
**Complete when:** no open row blocks observable behavior.
|
|
22
|
+
|
|
23
|
+
## Spec → `spec.md`
|
|
24
|
+
|
|
25
|
+
State the observable contract, edge cases, compatibility constraints, non-goals, and the applied project standards. Persist it in `spec.md` under `Status: proposed` before presenting it, then await explicit user confirmation. `proposed` keeps production source untouched while artifacts and read-only work stay open. Only the user's approving reply sets `Status: approved`, `Approved at`, and `Approved from`.
|
|
26
|
+
|
|
27
|
+
The file opens with the approval header, then observable behavior and edge cases; compatibility constraints and non-goals; applied standards with their impact; evidence and precedent links; the selected reality anchor and checkpoint.
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
Status: proposed | approved
|
|
31
|
+
Approved at: <date the user approved, empty while proposed>
|
|
32
|
+
Approved from: <the user reply that approved it, empty while proposed>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Design → `design.md`
|
|
36
|
+
|
|
37
|
+
Choose the smallest approach that fits the approved spec and architecture. Follow the matching playbook's design steps ([feature](playbooks/feature.md) for interfaces and seams, [prototype](playbooks/prototype.md) when a named question is cheaper to settle by experiment) and the project's exact skill.
|
|
38
|
+
|
|
39
|
+
The file holds the chosen approach; interfaces and data flow affected; existing precedent; decisions, trade-offs, and risks; the method selected inside the reality anchor. A straightforward design may be short, but it still names precedent and seam. Friction notes recorded during Act go under `## Friction Notes`.
|
|
40
|
+
|
|
41
|
+
**Complete when:** implementation invents no product behavior or architecture.
|
|
42
|
+
|
|
43
|
+
## Verify → `verification.md`
|
|
44
|
+
|
|
45
|
+
Review the diff against project standards, the approved spec, and the confirmed domain model; dispatch a verification agent when the anchor needs an independent observer. Give every requirement in `spec.md` its own row:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
| Requirement | Evidence | Result |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| Observable behavior from spec | Real interface executed and the specific output observed | pass / fail / unknown |
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **pass**: The reality anchor ran against the actual implementation and directly observed the expected behavior.
|
|
54
|
+
- **fail**: The anchor executed and observed a deviation from the spec or an error.
|
|
55
|
+
- **unknown**: No anchor exercised the requirement in this run.
|
|
56
|
+
|
|
57
|
+
Then human appropriateness verdicts; deviations from the approved spec or design; unresolved verification gaps and their impact. When friction notes exist, include a Reflexive section listing each with its classification (`misdirection` or `gap`) and its action.
|
|
58
|
+
|
|
59
|
+
## Updates
|
|
60
|
+
|
|
61
|
+
Update the owning phase file when new information changes it. A new consequential decision returns to `decision.md`; a change to user intent or observable behavior returns to Spec and user confirmation.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coding
|
|
3
|
+
description: Use when changing source code or its tests, such as fixing a bug, adding or changing behavior, refactoring, improving performance, or prototyping a design question.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Coding
|
|
7
|
+
|
|
8
|
+
Run the loop in [../anchorloop/SKILL.md](../anchorloop/SKILL.md) with one of the playbooks below. Return to Align when user intent or observable behavior changes.
|
|
9
|
+
|
|
10
|
+
## Classify
|
|
11
|
+
|
|
12
|
+
Before the first production edit, declare the change **Inline** or **Durable**:
|
|
13
|
+
|
|
14
|
+
- **Inline:** requirements and approach are clear, impact is bounded, and implementation and verification fit this run; a lasting behavior or public contract can still be Inline when the change is simple. Follow Alignment with `Inline — Contract: <one sentence of the observable behavior after the change>`; the user's source-change request approves it, and approval already given is not asked again.
|
|
15
|
+
- **Durable:** the work needs a persistent design record because of material ambiguity, consequential trade-offs, cross-component coordination, migration risk, continuity across sessions, or a user-requested spec. Read [MINI-SDD.md](MINI-SDD.md) and create or resume its folder, which keeps no `tasks.md`; Spec waits for the user's approval before any production edit.
|
|
16
|
+
|
|
17
|
+
## Anchor
|
|
18
|
+
|
|
19
|
+
Point the anchor at what the change touches: a one-line edit anchors on the tests that assert that file; a shared code path anchors on its callers' tests. For Inline work, a green anchor plus a read of your own diff completes Verify; report the contract with its observed output in one line. Durable work verifies into `verification.md` as MINI-SDD describes.
|
|
20
|
+
|
|
21
|
+
## Playbooks
|
|
22
|
+
|
|
23
|
+
- [bug-fix](playbooks/bug-fix.md): broken, failing, slow-for-a-reason, or intermittent behavior.
|
|
24
|
+
- [feature](playbooks/feature.md): new or changed behavior, or an interface that crosses a module.
|
|
25
|
+
- [refactoring](playbooks/refactoring.md): structure changes, behavior does not.
|
|
26
|
+
- [perf](playbooks/perf.md): a measured slowness to improve against a baseline.
|
|
27
|
+
- [prototype](playbooks/prototype.md): disposable code that settles a design or behavior question.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Bug fix
|
|
2
|
+
|
|
3
|
+
**You own the root cause.** Every shipped line traces to runtime evidence.
|
|
4
|
+
|
|
5
|
+
1. Anchor: build one tight, agent-runnable loop that asserts the user's exact symptom (failing test, request script, CLI fixture, browser check, replay, bisection, or differential comparison) and watch it go red. For flaky behavior, raise and measure the reproduction rate. Minimize it until every element is load-bearing. When no red-capable loop can be built, report what is missing and ask for that evidence instead of theorizing from code.
|
|
6
|
+
2. Act: when the red loop does not already point at the cause, write three to five falsifiable hypotheses with predicted observations and test them one variable at a time, preferring a debugger, then logs tagged `[DEBUG-xxxx]`.
|
|
7
|
+
3. Act: when two fixes resting on one premise fail the same loop, apply **Attack the premise** before a third: a contradicted premise sends you back to the hypotheses; a confirmed one means the fixes treated a consequence, so ask the next why.
|
|
8
|
+
4. Act: an architectural cause returns to Classify as Durable. Otherwise turn the minimized repro into a regression test at the public seam, committed failing before the fix when that is cheap (**Sequence verifiable units**), and make the smallest change that turns it green. A change the evidence did not motivate is reverted.
|
|
9
|
+
5. Verify: run the regression test and the affected suite on the surface the user saw, then remove every `[DEBUG-xxxx]` probe and throwaway artifact.
|
|
10
|
+
|
|
11
|
+
**Reply:** what was broken, the root cause, the fix, and the failing-then-passing output.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Feature
|
|
2
|
+
|
|
3
|
+
**You own the design.**
|
|
4
|
+
|
|
5
|
+
1. Align: learn how the affected subsystem works now, and name the data shape and its organizing structure (**Model the domain**, **Foundational thinking**) before any logic.
|
|
6
|
+
2. Act: when the change crosses a module, settle its interface first. Place the seam at an existing boundary; add one only for real variation, because one adapter is hypothetical and two demonstrate variation. Hide invariants and ordering behind the interface, and make it the test surface. A module whose removal makes complexity vanish rather than move to callers is a pass-through; delete it. With no precedent and a costly-to-reverse choice, compare two interface shapes on depth, locality, compatibility, and testability, or settle it with the `prototype` playbook; a user-owned trade-off goes to the user.
|
|
7
|
+
3. Act: for more than one unit, write the throughput checkpoint as four `todo` items, each `n/a: <reason>` when it does not apply: blocking first steps; independent workstreams; shared mutable state, split before serializing; the smallest safe decomposition.
|
|
8
|
+
4. Act: build in units that each end in a check (**Sequence verifiable units**).
|
|
9
|
+
5. Verify: on the surface the user will use; an inconclusive or wrong-surface result is not a pass.
|
|
10
|
+
|
|
11
|
+
**Reply:** what was built, the shape chosen and why, the checkpoint, and open decisions; a table when alternatives were compared.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Interface checks adapted from [mattpocock/skills](https://github.com/mattpocock/skills) `codebase-design` (MIT License, Copyright (c) 2026 Matt Pocock).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Perf
|
|
2
|
+
|
|
3
|
+
**You own the number.**
|
|
4
|
+
|
|
5
|
+
1. Anchor: measure a baseline on the real workload, repeated, with its range.
|
|
6
|
+
2. Act: **Explain the number**: find what limits it and rule out a warm cache, a skipped path, or a debug build before trusting it. Profile before changing code.
|
|
7
|
+
3. Act: one change at a time against the baseline; keep a change only when its gain sits outside the noise, and revert the rest.
|
|
8
|
+
4. Verify: rerun the baseline workload under the same conditions.
|
|
9
|
+
|
|
10
|
+
**Reply:** faster, slower, no measurable difference, or inconclusive, with run counts, ranges, what limits the number, and the profile that pointed at the change.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Prototype
|
|
2
|
+
|
|
3
|
+
**You own the decision, not the code.** The prototype is a throwaway instrument; the real build follows `feature`.
|
|
4
|
+
|
|
5
|
+
1. Align: write the one question the prototype answers, the observation that settles it, and who owns the verdict. Choose a prototype only when running an experiment is cheaper or clearer than deciding from existing evidence.
|
|
6
|
+
2. Act: build the smallest experiment in the project's native runtime, near its subject and visibly marked as a prototype, with ephemeral state unless persistence is the question. Implement only what observing the answer needs, and expose the state it depends on. Alternatives sit behind one switch, each labeled.
|
|
7
|
+
3. Verify: observe the thing being decided (output, timing, a screenshot of each variant). When the remaining verdict is suitability, the human anchor's reviewer judges it.
|
|
8
|
+
4. Record the question, environment, evidence, verdict, and decision in `design.md`, or in the reply when there is none. Delete the prototype afterward unless the user or project keeps it; it is committed only when the delivery workflow authorizes it.
|
|
9
|
+
|
|
10
|
+
**Reply:** the variants, the evidence, the trade-offs, a recommendation, and the scratch path, stated as throwaway.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Adapted from [mattpocock/skills](https://github.com/mattpocock/skills) `prototype` (MIT License, Copyright (c) 2026 Matt Pocock).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Refactoring
|
|
2
|
+
|
|
3
|
+
**You own the behavior contract. The structure changes; the behavior does not.**
|
|
4
|
+
|
|
5
|
+
1. Anchor: pin current behavior with a characterization test, snapshot, or equivalence run before anything moves; a type check and lint are not a pin.
|
|
6
|
+
2. Align: name the target shape as if built today, and the branches or invalid states it deletes. A reshape that only adds indirection is not one.
|
|
7
|
+
3. Act: **Subtract before you add**.
|
|
8
|
+
4. Act: move in small steps with the pin green. **Migrate callers, then delete**. Check each rename against strings, prose, and back-references.
|
|
9
|
+
5. Act: a bug or missing feature found on the way becomes a follow-up; the structural change ships against the pinned contract first.
|
|
10
|
+
6. Verify: prove equivalence on the real artifact, then confirm reader load dropped (**Minimize reader load**); when it did not, revert.
|
|
11
|
+
|
|
12
|
+
**Reply:** the structure that changed, the pin, the equivalence evidence, the reader-load change, and what was reverted.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ADR Format
|
|
2
|
+
|
|
3
|
+
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
|
4
|
+
|
|
5
|
+
Create the `docs/adr/` directory lazily — only when the first ADR is needed.
|
|
6
|
+
|
|
7
|
+
## Template
|
|
8
|
+
|
|
9
|
+
```md
|
|
10
|
+
# {Short title of the decision}
|
|
11
|
+
|
|
12
|
+
{1-3 sentences: what's the context, what did we decide, and why.}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why* — not in filling out sections.
|
|
16
|
+
|
|
17
|
+
## Optional sections
|
|
18
|
+
|
|
19
|
+
Only include these when they add genuine value. Most ADRs won't need them.
|
|
20
|
+
|
|
21
|
+
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited
|
|
22
|
+
- **Considered Options** — only when the rejected alternatives are worth remembering
|
|
23
|
+
- **Consequences** — only when non-obvious downstream effects need to be called out
|
|
24
|
+
|
|
25
|
+
## Numbering
|
|
26
|
+
|
|
27
|
+
Scan `docs/adr/` for the highest existing number and increment by one.
|
|
28
|
+
|
|
29
|
+
## When to offer an ADR
|
|
30
|
+
|
|
31
|
+
All three of these must be true:
|
|
32
|
+
|
|
33
|
+
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
|
34
|
+
2. **Surprising without context** — a future reader will look at the code and wonder "why on earth did they do it this way?"
|
|
35
|
+
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
|
36
|
+
|
|
37
|
+
If a decision is easy to reverse, skip it — you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
|
38
|
+
|
|
39
|
+
### What qualifies
|
|
40
|
+
|
|
41
|
+
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
|
42
|
+
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
|
43
|
+
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library — just the ones that would take a quarter to swap out.
|
|
44
|
+
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
|
45
|
+
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
|
46
|
+
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
|
47
|
+
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it — otherwise someone will suggest GraphQL again in six months.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# CONTEXT.md Format
|
|
2
|
+
|
|
3
|
+
## Structure
|
|
4
|
+
|
|
5
|
+
```md
|
|
6
|
+
# {Context Name}
|
|
7
|
+
|
|
8
|
+
{One or two sentence description of what this context is and why it exists.}
|
|
9
|
+
|
|
10
|
+
## Language
|
|
11
|
+
|
|
12
|
+
**Order**:
|
|
13
|
+
{A one or two sentence description of the term}
|
|
14
|
+
_Avoid_: Purchase, transaction
|
|
15
|
+
|
|
16
|
+
**Invoice**:
|
|
17
|
+
A request for payment sent to a customer after delivery.
|
|
18
|
+
_Avoid_: Bill, payment request
|
|
19
|
+
|
|
20
|
+
**Customer**:
|
|
21
|
+
A person or organization that places orders.
|
|
22
|
+
_Avoid_: Client, buyer, account
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
|
|
28
|
+
- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
|
|
29
|
+
- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
|
|
30
|
+
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
|
31
|
+
|
|
32
|
+
## Single vs multi-context repos
|
|
33
|
+
|
|
34
|
+
**Single context (most repos):** One `CONTEXT.md` at the repo root.
|
|
35
|
+
|
|
36
|
+
**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
# Context Map
|
|
40
|
+
|
|
41
|
+
## Contexts
|
|
42
|
+
|
|
43
|
+
- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders
|
|
44
|
+
- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments
|
|
45
|
+
- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping
|
|
46
|
+
|
|
47
|
+
## Relationships
|
|
48
|
+
|
|
49
|
+
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
|
50
|
+
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
|
51
|
+
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The skill infers which structure applies:
|
|
55
|
+
|
|
56
|
+
- If `CONTEXT-MAP.md` exists, read it to find contexts
|
|
57
|
+
- If only a root `CONTEXT.md` exists, single context
|
|
58
|
+
- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
|
|
59
|
+
|
|
60
|
+
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-modeling
|
|
3
|
+
description: Use when project terminology or domain boundaries need refinement.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Domain Modeling
|
|
7
|
+
|
|
8
|
+
Actively reconcile the user's language, the project's glossary, and code. Return
|
|
9
|
+
confirmed terms and decisions to the caller's artifact, or in the reply when
|
|
10
|
+
there is none.
|
|
11
|
+
|
|
12
|
+
## Discipline
|
|
13
|
+
|
|
14
|
+
1. Read the applicable `CONTEXT.md`; follow `CONTEXT-MAP.md` when the repository
|
|
15
|
+
has multiple domain contexts.
|
|
16
|
+
2. Surface conflicts between the user's term, glossary definition, and code.
|
|
17
|
+
Sharpen vague or overloaded terms into one canonical meaning.
|
|
18
|
+
3. Stress-test relationships and boundaries with concrete edge-case scenarios.
|
|
19
|
+
4. Check asserted behavior against code. Let the user decide when current code
|
|
20
|
+
and intended domain truth disagree.
|
|
21
|
+
5. Record a confirmed term immediately in `CONTEXT.md`, using
|
|
22
|
+
[CONTEXT-FORMAT.md](CONTEXT-FORMAT.md). Keep the glossary
|
|
23
|
+
free of implementation detail.
|
|
24
|
+
6. Offer an ADR only when it meets the criteria in
|
|
25
|
+
[ADR-FORMAT.md](ADR-FORMAT.md).
|
|
26
|
+
|
|
27
|
+
## Carry the model into code
|
|
28
|
+
|
|
29
|
+
- Use the confirmed ubiquitous language in identifiers, tests, errors, and
|
|
30
|
+
public contracts within its bounded context.
|
|
31
|
+
- Keep domain invariants in the domain model. UI, transport, persistence, and
|
|
32
|
+
orchestration layers call the model instead of reimplementing its rules.
|
|
33
|
+
- Translate external schemas, persistence records, and another context's
|
|
34
|
+
vocabulary at explicit adapter seams; do not let them become the internal
|
|
35
|
+
domain model by accident.
|
|
36
|
+
- Use tactical DDD patterns only when they clarify real domain rules. Reserve
|
|
37
|
+
entities, aggregates, value objects, and repositories for genuine domain concepts.
|
|
38
|
+
- Return to Align when implementation reveals a domain
|
|
39
|
+
contradiction. Do not encode an unconfirmed model silently.
|
|
40
|
+
|
|
41
|
+
Create the glossary or ADR directory only when there is confirmed knowledge to
|
|
42
|
+
record. Domain modeling is complete when language, boundaries, invariants,
|
|
43
|
+
adapters, code, and tests express the same confirmed model.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
Adapted from [mattpocock/skills](https://github.com/mattpocock/skills)
|
|
48
|
+
`domain-modeling` (MIT License, Copyright (c) 2026 Matt Pocock).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grilling
|
|
3
|
+
description: Use when resolving user-owned decisions or ambiguous architectural tradeoffs, when a decision artifact has open rows, or when the user asks to be grilled on an idea.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Interview the user relentlessly until you reach a shared understanding. Map the subject as a **design tree**: every decision branches into the decisions that depend on it.
|
|
7
|
+
|
|
8
|
+
When a caller hands over a decision artifact, first write every consequential question into it with the answer already supported by the request or source facts, its basis, and its status; when no row is `open`, return it without interviewing.
|
|
9
|
+
|
|
10
|
+
Work in **rounds**. The **frontier** is every open decision whose prerequisites are settled. Ask the whole frontier in one round, numbering each question and giving your recommended answer. Then wait for the user's answers before continuing.
|
|
11
|
+
|
|
12
|
+
Format each question like this:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
❓ **Q1 — <title>**: <question and options>
|
|
16
|
+
|
|
17
|
+
➡️ <recommended answer and why>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Each answer reshapes the tree. Recompute the frontier before the next round. A question that still depends on another open decision belongs to a later round.
|
|
21
|
+
|
|
22
|
+
Finding facts is the agent's job. Use the environment and available tools; delegate independent fact-finding only when it materially saves time. Settle observable questions by **Observe, don't ask** ([principles](../anchorloop/PRINCIPLES.md)), with a check or the `coding` prototype playbook. The decisions are the user's: put each remaining product or preference question to them and wait.
|
|
23
|
+
|
|
24
|
+
When terminology or a durable architectural decision emerges, invoke `domain-modeling` at that point.
|
|
25
|
+
|
|
26
|
+
The session is complete when the frontier is empty and every branch has been visited. Record each answer as `confirmed` in the caller's artifact, if any, and return the confirmed decisions to the caller.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
Ported and adapted from [mattpocock/skills](https://github.com/mattpocock/skills) `grilling` and `grill-with-docs` (MIT License, Copyright (c) 2026 Matt Pocock).
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: human-feedback
|
|
3
|
+
description: Use when evaluating human feedback or conducting interactive UI verification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Human Feedback
|
|
7
|
+
|
|
8
|
+
Turn a person's reaction to working output into an evidence-backed root cause and
|
|
9
|
+
a correction made at that root. This skill owns diagnosis, not implementation.
|
|
10
|
+
|
|
11
|
+
## 1. Enter
|
|
12
|
+
|
|
13
|
+
Two entries:
|
|
14
|
+
|
|
15
|
+
- **Detected:** a person reacts to working code, design, or documentation.
|
|
16
|
+
Invoke on the reaction itself, before answering it.
|
|
17
|
+
- **Invited:** verification covers UI or a human-use scenario and the user
|
|
18
|
+
accepted a feedback pass. Name the real interface and the flows to operate,
|
|
19
|
+
then collect what the person observed.
|
|
20
|
+
|
|
21
|
+
Route a crash or reproducible failure to the `coding` bug-fix playbook and a
|
|
22
|
+
request for new behavior to its feature playbook. A reaction with no
|
|
23
|
+
identifiable target may be venting; ask whether the user wants it investigated.
|
|
24
|
+
|
|
25
|
+
**Complete when:** there is a working code, design, or documentation target the
|
|
26
|
+
person wants improved.
|
|
27
|
+
|
|
28
|
+
## 2. Diagnose
|
|
29
|
+
|
|
30
|
+
Attend to the problem the person has, ahead of the fix they propose. Identify
|
|
31
|
+
separately:
|
|
32
|
+
|
|
33
|
+
- the person's observed experience and the need left unmet
|
|
34
|
+
- the friction that turns that experience into negative feedback
|
|
35
|
+
- the behavior, design, or documentation decision that creates the friction
|
|
36
|
+
- the documented standard, best practice, or project precedent it violates
|
|
37
|
+
|
|
38
|
+
Use `investigating` for substantial cross-source research. If the causal decision
|
|
39
|
+
and violated standard are unsupported by evidence, classify the reaction as a
|
|
40
|
+
preference rather than invent a defect.
|
|
41
|
+
|
|
42
|
+
Treat justification added to a response or document as a workaround signal: it
|
|
43
|
+
manages the perception of the friction while leaving its source intact. Continue
|
|
44
|
+
diagnosis until the correction addresses that source and the document can state
|
|
45
|
+
the expected behavior directly.
|
|
46
|
+
|
|
47
|
+
**Complete when:** the chain `feedback → experience → friction → root cause →
|
|
48
|
+
positive correction` is evidence-backed.
|
|
49
|
+
|
|
50
|
+
## 3. Correct at the source
|
|
51
|
+
|
|
52
|
+
Propose the smallest correction that removes the friction where it originates.
|
|
53
|
+
Phrase its target as observable expected behavior for the person and any document
|
|
54
|
+
reader. When wording creates the friction, rewrite it to state that behavior
|
|
55
|
+
directly; when behavior or design creates it, correct the source and align the
|
|
56
|
+
document with the result.
|
|
57
|
+
|
|
58
|
+
The correction carries the source's own shape:
|
|
59
|
+
|
|
60
|
+
- It lands on the causal decision, so the same friction cannot return through a
|
|
61
|
+
sibling path.
|
|
62
|
+
- It matches the pattern, terminology, and layer that already govern that source.
|
|
63
|
+
- A defensive guard belongs where the input is genuinely untrusted or the failure
|
|
64
|
+
is genuinely reachable; a root proven correct carries none.
|
|
65
|
+
- A fallback or special case belongs where its branch is a real case of the
|
|
66
|
+
domain; a branch that exists to mask the root belongs in the root instead.
|
|
67
|
+
|
|
68
|
+
Use `grilling` when viable alternatives carry a real user-owned trade-off, and
|
|
69
|
+
wait for the user there. When the cause and the correction carry no such
|
|
70
|
+
trade-off, state both and continue; treat later disagreement as new diagnostic
|
|
71
|
+
input.
|
|
72
|
+
|
|
73
|
+
## 4. Hand off
|
|
74
|
+
|
|
75
|
+
Return the confirmed chain as decision input to `coding` for a source fix, or
|
|
76
|
+
to `writing` for a document fix.
|
|
77
|
+
|
|
78
|
+
**Complete when:** no change was requested, or the owning entry has received a
|
|
79
|
+
confirmed correction target.
|
|
80
|
+
|
|
81
|
+
## 5. Reflexive System Placement
|
|
82
|
+
|
|
83
|
+
When feedback conveys a preference or convention rather than an isolated code bug, hand the preference to `reflecting-to-root` and any procedure change to `solid-loop`.
|