continuous-improvement 3.9.2 → 3.12.3
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/.claude-plugin/marketplace.json +3 -3
- package/CHANGELOG.md +95 -0
- package/LICENSE +21 -21
- package/QUICKSTART.md +13 -8
- package/README.md +94 -162
- package/SKILL.md +1 -1
- package/bin/analyze.sh +161 -161
- package/bin/backfill.mjs +19 -19
- package/bin/check-docs-substrings.mjs +73 -0
- package/bin/check-scripts-citation-drift.mjs +210 -0
- package/bin/check-skill-count.mjs +110 -0
- package/bin/check-test-imports-only.mjs +126 -0
- package/bin/check-tool-count.mjs +129 -0
- package/bin/companion-preference-status.mjs +231 -0
- package/bin/gateguard-clear.mjs +53 -0
- package/bin/generate-plugin-manifests.mjs +8 -1
- package/bin/harvest-friction.mjs +1 -1
- package/bin/hook-stats.mjs +21 -21
- package/bin/install.mjs +185 -28
- package/bin/mcp-server.mjs +216 -3
- package/bin/refresh-third-party.mjs +315 -313
- package/commands/audit.md +34 -0
- package/commands/companion-preference.md +58 -0
- package/commands/continuous-improvement.md +115 -115
- package/commands/dashboard.md +56 -56
- package/commands/discipline.md +14 -0
- package/commands/distill.md +39 -0
- package/commands/goal-check.md +53 -0
- package/commands/grill-me.md +40 -0
- package/commands/grill-with-docs.md +38 -0
- package/commands/handoff.md +42 -0
- package/commands/harvest.md +1 -1
- package/commands/proceed-with-the-recommendation.md +20 -0
- package/commands/recall.md +49 -0
- package/commands/reconcile.md +47 -0
- package/commands/seven-laws.md +16 -16
- package/commands/superpowers.md +3 -3
- package/commands/verify-install.md +55 -0
- package/commands/workspace-surface-audit.md +77 -77
- package/hooks/companion-preference.mjs +190 -0
- package/hooks/gateguard.mjs +72 -25
- package/hooks/goal-drift-stop.mjs +183 -0
- package/hooks/observe.sh +15 -1
- package/hooks/recall-briefing.mjs +167 -0
- package/hooks/route-prompt.mjs +180 -0
- package/hooks/route-table.json +35 -0
- package/hooks/session.sh +106 -106
- package/hooks/three-section-close.mjs +134 -132
- package/instinct-packs/go.json +58 -58
- package/instinct-packs/meta.json +16 -16
- package/instinct-packs/python.json +58 -58
- package/instinct-packs/react.json +58 -58
- package/lib/gateguard-state.mjs +54 -2
- package/lib/goal-drift-gate.mjs +50 -0
- package/lib/goal-state.mjs +285 -0
- package/lib/plugin-metadata.mjs +134 -15
- package/lib/recall-briefing.mjs +57 -0
- package/lib/recall-index.mjs +175 -0
- package/lib/skill-distill.mjs +222 -0
- package/llms.txt +2 -2
- package/package.json +12 -7
- package/plugins/beginner.json +9 -4
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
- package/plugins/continuous-improvement/LICENSE +21 -21
- package/plugins/continuous-improvement/agents/README.md +3 -3
- package/plugins/continuous-improvement/bin/backfill.mjs +19 -19
- package/plugins/continuous-improvement/bin/gateguard-clear.mjs +53 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +216 -3
- package/plugins/continuous-improvement/commands/audit.md +34 -0
- package/plugins/continuous-improvement/commands/companion-preference.md +58 -0
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -115
- package/plugins/continuous-improvement/commands/dashboard.md +56 -56
- package/plugins/continuous-improvement/commands/discipline.md +14 -0
- package/plugins/continuous-improvement/commands/distill.md +39 -0
- package/plugins/continuous-improvement/commands/goal-check.md +53 -0
- package/plugins/continuous-improvement/commands/grill-me.md +40 -0
- package/plugins/continuous-improvement/commands/grill-with-docs.md +38 -0
- package/plugins/continuous-improvement/commands/handoff.md +42 -0
- package/plugins/continuous-improvement/commands/harvest.md +1 -1
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +20 -0
- package/plugins/continuous-improvement/commands/recall.md +49 -0
- package/plugins/continuous-improvement/commands/reconcile.md +47 -0
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -16
- package/plugins/continuous-improvement/commands/superpowers.md +3 -3
- package/plugins/continuous-improvement/commands/verify-install.md +55 -0
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -77
- package/plugins/continuous-improvement/hooks/companion-preference.mjs +190 -0
- package/plugins/continuous-improvement/hooks/gateguard.mjs +72 -25
- package/plugins/continuous-improvement/hooks/goal-drift-stop.mjs +183 -0
- package/plugins/continuous-improvement/hooks/hooks.json +23 -2
- package/plugins/continuous-improvement/hooks/observe.sh +15 -1
- package/plugins/continuous-improvement/hooks/recall-briefing.mjs +167 -0
- package/plugins/continuous-improvement/hooks/route-prompt.mjs +180 -0
- package/plugins/continuous-improvement/hooks/route-table.json +35 -0
- package/plugins/continuous-improvement/hooks/session.sh +106 -106
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +134 -132
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -58
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -16
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -58
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -58
- package/plugins/continuous-improvement/lib/gateguard-state.mjs +137 -0
- package/plugins/continuous-improvement/lib/goal-drift-gate.mjs +50 -0
- package/plugins/continuous-improvement/lib/goal-state.mjs +285 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +134 -15
- package/plugins/continuous-improvement/lib/recall-briefing.mjs +57 -0
- package/plugins/continuous-improvement/lib/recall-index.mjs +175 -0
- package/plugins/continuous-improvement/lib/skill-distill.mjs +222 -0
- package/plugins/continuous-improvement/skills/README.md +8 -0
- package/plugins/continuous-improvement/skills/audit/SKILL.md +73 -0
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +13 -17
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +36 -17
- package/plugins/continuous-improvement/skills/goal-monitor/SKILL.md +81 -0
- package/plugins/continuous-improvement/skills/grill-me/SKILL.md +66 -0
- package/plugins/continuous-improvement/skills/grill-with-docs/SKILL.md +252 -0
- package/plugins/continuous-improvement/skills/handoff/SKILL.md +59 -0
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +82 -6
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/recall/SKILL.md +50 -0
- package/plugins/continuous-improvement/skills/reconcile/SKILL.md +80 -0
- package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/skill-distillation/SKILL.md +57 -0
- package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +77 -3
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -411
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +28 -20
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +3 -2
- package/plugins/expert.json +28 -3
- package/skills/README.md +3 -0
- package/skills/audit.md +73 -0
- package/skills/deploy-receipt.md +13 -17
- package/skills/gateguard.md +36 -17
- package/skills/goal-monitor.md +81 -0
- package/skills/grill-me.md +66 -0
- package/skills/grill-with-docs.md +252 -0
- package/skills/handoff.md +59 -0
- package/skills/para-memory-files.md +1 -1
- package/skills/proceed-with-the-recommendation.md +82 -6
- package/skills/ralph.md +1 -0
- package/skills/recall.md +50 -0
- package/skills/reconcile.md +80 -0
- package/skills/recovery-classification.md +1 -0
- package/skills/safety-guard.md +1 -0
- package/skills/skill-distillation.md +57 -0
- package/skills/state-reconciliation.md +1 -0
- package/skills/strategic-compact.md +1 -0
- package/skills/superpowers.md +77 -3
- package/skills/tdd-workflow.md +411 -411
- package/skills/token-budget-advisor.md +1 -1
- package/skills/verification-loop.md +28 -20
- package/skills/wild-risa-balance.md +1 -0
- package/skills/workspace-surface-audit.md +1 -1
- package/skills/worktree-safety.md +3 -2
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grill-with-docs
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 1 (Research Before Executing) and Law 7 (Learn From Every Session) of the 7 Laws of AI Agent Discipline. Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates CONTEXT.md + ADRs inline as decisions crystallise. Ported from mattpocock/skills under MIT.
|
|
5
|
+
origin: https://github.com/mattpocock/skills
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /grill-with-docs — Grill the plan AND update the docs as decisions land
|
|
9
|
+
|
|
10
|
+
Ported in behavior from [mattpocock/skills `engineering/grill-with-docs`](https://github.com/mattpocock/skills/blob/main/skills/engineering/grill-with-docs/SKILL.md) (MIT, © 2026 Matt Pocock). Cold-storage snapshot of the three upstream files (`SKILL.md`, `CONTEXT-FORMAT.md`, `ADR-FORMAT.md`) at [`third-party/mattpocock-skills/skills/engineering/grill-with-docs/`](../third-party/mattpocock-skills/skills/engineering/grill-with-docs/); SHA pin in [`third-party/MANIFEST.md`](../third-party/MANIFEST.md).
|
|
11
|
+
|
|
12
|
+
The two format specs (CONTEXT.md format, ADR format) are inlined as appendices in this file so the bundled skill is self-contained — see [Appendix A: CONTEXT.md format](#appendix-a-contextmd-format) and [Appendix B: ADR format](#appendix-b-adr-format).
|
|
13
|
+
|
|
14
|
+
## What this skill does
|
|
15
|
+
|
|
16
|
+
<what-to-do>
|
|
17
|
+
|
|
18
|
+
Interview the user relentlessly about every aspect of this plan until shared understanding is reached. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide a recommended answer.
|
|
19
|
+
|
|
20
|
+
Ask questions one at a time, waiting for feedback on each before continuing.
|
|
21
|
+
|
|
22
|
+
If a question can be answered by exploring the codebase, explore the codebase instead.
|
|
23
|
+
|
|
24
|
+
</what-to-do>
|
|
25
|
+
|
|
26
|
+
## Domain awareness
|
|
27
|
+
|
|
28
|
+
During codebase exploration, also look for existing documentation:
|
|
29
|
+
|
|
30
|
+
### File structure
|
|
31
|
+
|
|
32
|
+
Most repos have a single context:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
/
|
|
36
|
+
├── CONTEXT.md
|
|
37
|
+
├── docs/
|
|
38
|
+
│ └── adr/
|
|
39
|
+
│ ├── 0001-event-sourced-orders.md
|
|
40
|
+
│ └── 0002-postgres-for-write-model.md
|
|
41
|
+
└── src/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
/
|
|
48
|
+
├── CONTEXT-MAP.md
|
|
49
|
+
├── docs/
|
|
50
|
+
│ └── adr/ ← system-wide decisions
|
|
51
|
+
├── src/
|
|
52
|
+
│ ├── ordering/
|
|
53
|
+
│ │ ├── CONTEXT.md
|
|
54
|
+
│ │ └── docs/adr/ ← context-specific decisions
|
|
55
|
+
│ └── billing/
|
|
56
|
+
│ ├── CONTEXT.md
|
|
57
|
+
│ └── docs/adr/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
|
|
61
|
+
|
|
62
|
+
## During the session
|
|
63
|
+
|
|
64
|
+
### Challenge against the glossary
|
|
65
|
+
|
|
66
|
+
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
|
|
67
|
+
|
|
68
|
+
### Sharpen fuzzy language
|
|
69
|
+
|
|
70
|
+
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account' — do you mean the Customer or the User? Those are different things."
|
|
71
|
+
|
|
72
|
+
### Discuss concrete scenarios
|
|
73
|
+
|
|
74
|
+
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
|
|
75
|
+
|
|
76
|
+
### Cross-reference with code
|
|
77
|
+
|
|
78
|
+
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible — which is right?"
|
|
79
|
+
|
|
80
|
+
### Update CONTEXT.md inline
|
|
81
|
+
|
|
82
|
+
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up — capture them as they happen. Use the format in [Appendix A](#appendix-a-contextmd-format).
|
|
83
|
+
|
|
84
|
+
Don't couple `CONTEXT.md` to implementation details. Only include terms that are meaningful to domain experts.
|
|
85
|
+
|
|
86
|
+
### Offer ADRs sparingly
|
|
87
|
+
|
|
88
|
+
Only offer to create an ADR when all three are true:
|
|
89
|
+
|
|
90
|
+
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
|
91
|
+
2. **Surprising without context** — a future reader will wonder "why did they do it this way?"
|
|
92
|
+
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
|
93
|
+
|
|
94
|
+
If any of the three is missing, skip the ADR. Use the format in [Appendix B](#appendix-b-adr-format).
|
|
95
|
+
|
|
96
|
+
## How it fits the 7 Laws
|
|
97
|
+
|
|
98
|
+
| Law | Role of this skill |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Law 1 (Research Before Executing) | Pre-execution interrogation + codebase exploration close the alignment gap before any tool call. |
|
|
101
|
+
| Law 2 (Plan Is Sacred) | The interview produces a plan grounded in domain language, not invented defaults. |
|
|
102
|
+
| Law 7 (Learn From Every Session) | CONTEXT.md updates persist resolved jargon across sessions; ADRs persist decisions across years. |
|
|
103
|
+
|
|
104
|
+
## How it differs from `grill-me`
|
|
105
|
+
|
|
106
|
+
| Skill | Focus |
|
|
107
|
+
|---|---|
|
|
108
|
+
| [`grill-me`](./grill-me.md) | Conversation-only grilling. No artifact. Use when there is no project to update or the project has no docs convention yet. |
|
|
109
|
+
| `grill-with-docs` | Grilling that **updates `CONTEXT.md` and `docs/adr/` inline as decisions land**. Use once the project has, or is willing to start, a shared-language doc. |
|
|
110
|
+
|
|
111
|
+
If a repo has no CONTEXT.md and the conversation is exploratory, start with `grill-me`. Once the user commits to a direction, switch to `grill-with-docs` to capture terminology and decisions as they crystallise.
|
|
112
|
+
|
|
113
|
+
## Companion / alternative skills
|
|
114
|
+
|
|
115
|
+
- [`grill-me`](./grill-me.md) — same interview discipline, no doc artifact.
|
|
116
|
+
- [`handoff`](./handoff.md) — end-of-session compaction; pairs with grill-with-docs (grill to align, handoff to compact).
|
|
117
|
+
- [`workspace-surface-audit`](./workspace-surface-audit.md) — inventory of available tooling; complementary to the domain-language interview.
|
|
118
|
+
- [`gateguard`](./gateguard.md) — tool-boundary gate that fires after alignment is reached.
|
|
119
|
+
|
|
120
|
+
## Attribution
|
|
121
|
+
|
|
122
|
+
This skill is a port of [mattpocock/skills `engineering/grill-with-docs`](https://github.com/mattpocock/skills/blob/main/skills/engineering/grill-with-docs/SKILL.md) (with bundled `CONTEXT-FORMAT.md` and `ADR-FORMAT.md` inlined as appendices). MIT-licensed upstream, MIT-licensed here. See [`third-party/mattpocock-skills/LICENSE`](../third-party/mattpocock-skills/LICENSE) for the verbatim license and [`third-party/mattpocock-skills/OUR_NOTES.md`](../third-party/mattpocock-skills/OUR_NOTES.md) for the vendoring rationale and drift radar.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Appendix A: CONTEXT.md format
|
|
127
|
+
|
|
128
|
+
### Structure
|
|
129
|
+
|
|
130
|
+
```md
|
|
131
|
+
# {Context Name}
|
|
132
|
+
|
|
133
|
+
{One or two sentence description of what this context is and why it exists.}
|
|
134
|
+
|
|
135
|
+
## Language
|
|
136
|
+
|
|
137
|
+
**Order**:
|
|
138
|
+
{A concise description of the term}
|
|
139
|
+
_Avoid_: Purchase, transaction
|
|
140
|
+
|
|
141
|
+
**Invoice**:
|
|
142
|
+
A request for payment sent to a customer after delivery.
|
|
143
|
+
_Avoid_: Bill, payment request
|
|
144
|
+
|
|
145
|
+
**Customer**:
|
|
146
|
+
A person or organization that places orders.
|
|
147
|
+
_Avoid_: Client, buyer, account
|
|
148
|
+
|
|
149
|
+
## Relationships
|
|
150
|
+
|
|
151
|
+
- An **Order** produces one or more **Invoices**
|
|
152
|
+
- An **Invoice** belongs to exactly one **Customer**
|
|
153
|
+
|
|
154
|
+
## Example dialogue
|
|
155
|
+
|
|
156
|
+
> **Dev:** "When a **Customer** places an **Order**, do we create the **Invoice** immediately?"
|
|
157
|
+
> **Domain expert:** "No — an **Invoice** is only generated once a **Fulfillment** is confirmed."
|
|
158
|
+
|
|
159
|
+
## Flagged ambiguities
|
|
160
|
+
|
|
161
|
+
- "account" was used to mean both **Customer** and **User** — resolved: these are distinct concepts.
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Rules
|
|
165
|
+
|
|
166
|
+
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others as aliases to avoid.
|
|
167
|
+
- **Flag conflicts explicitly.** If a term is used ambiguously, call it out in "Flagged ambiguities" with a clear resolution.
|
|
168
|
+
- **Keep definitions tight.** One sentence max. Define what it IS, not what it does.
|
|
169
|
+
- **Show relationships.** Use bold term names and express cardinality where obvious.
|
|
170
|
+
- **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.
|
|
171
|
+
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
|
172
|
+
- **Write an example dialogue.** A conversation between a dev and a domain expert that demonstrates how the terms interact naturally and clarifies boundaries between related concepts.
|
|
173
|
+
|
|
174
|
+
### Single vs multi-context repos
|
|
175
|
+
|
|
176
|
+
**Single context (most repos):** One `CONTEXT.md` at the repo root.
|
|
177
|
+
|
|
178
|
+
**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
|
179
|
+
|
|
180
|
+
```md
|
|
181
|
+
# Context Map
|
|
182
|
+
|
|
183
|
+
## Contexts
|
|
184
|
+
|
|
185
|
+
- Ordering — receives and tracks customer orders
|
|
186
|
+
- Billing — generates invoices and processes payments
|
|
187
|
+
- Fulfillment — manages warehouse picking and shipping
|
|
188
|
+
|
|
189
|
+
## Relationships
|
|
190
|
+
|
|
191
|
+
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
|
192
|
+
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
|
193
|
+
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The skill infers which structure applies:
|
|
197
|
+
|
|
198
|
+
- If `CONTEXT-MAP.md` exists, read it to find contexts
|
|
199
|
+
- If only a root `CONTEXT.md` exists, single context
|
|
200
|
+
- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
|
|
201
|
+
|
|
202
|
+
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Appendix B: ADR format
|
|
207
|
+
|
|
208
|
+
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
|
209
|
+
|
|
210
|
+
Create the `docs/adr/` directory lazily — only when the first ADR is needed.
|
|
211
|
+
|
|
212
|
+
### Template
|
|
213
|
+
|
|
214
|
+
```md
|
|
215
|
+
# {Short title of the decision}
|
|
216
|
+
|
|
217
|
+
{1-3 sentences: what's the context, what did we decide, and why.}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
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.
|
|
221
|
+
|
|
222
|
+
### Optional sections
|
|
223
|
+
|
|
224
|
+
Only include these when they add genuine value. Most ADRs won't need them.
|
|
225
|
+
|
|
226
|
+
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited
|
|
227
|
+
- **Considered Options** — only when the rejected alternatives are worth remembering
|
|
228
|
+
- **Consequences** — only when non-obvious downstream effects need to be called out
|
|
229
|
+
|
|
230
|
+
### Numbering
|
|
231
|
+
|
|
232
|
+
Scan `docs/adr/` for the highest existing number and increment by one.
|
|
233
|
+
|
|
234
|
+
### When to offer an ADR
|
|
235
|
+
|
|
236
|
+
All three of these must be true:
|
|
237
|
+
|
|
238
|
+
1. **Hard to reverse** — the cost of changing your mind later is meaningful
|
|
239
|
+
2. **Surprising without context** — a future reader will look at the code and wonder "why on earth did they do it this way?"
|
|
240
|
+
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
|
|
241
|
+
|
|
242
|
+
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."
|
|
243
|
+
|
|
244
|
+
#### What qualifies
|
|
245
|
+
|
|
246
|
+
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
|
247
|
+
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
|
248
|
+
- **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.
|
|
249
|
+
- **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.
|
|
250
|
+
- **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.
|
|
251
|
+
- **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."
|
|
252
|
+
- **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,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: handoff
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 5 (Reflect After Every Session) of the 7 Laws of AI Agent Discipline. Compact the current conversation into a handoff document for another agent to pick up. Ported from mattpocock/skills under MIT.
|
|
5
|
+
argument-hint: "What will the next session be used for?"
|
|
6
|
+
origin: https://github.com/mattpocock/skills
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /handoff — Hand the session off to a fresh agent
|
|
10
|
+
|
|
11
|
+
Ported verbatim in behavior from [mattpocock/skills `in-progress/handoff`](https://github.com/mattpocock/skills/blob/main/skills/in-progress/handoff/SKILL.md) (MIT, © 2026 Matt Pocock). Cold-storage snapshot at [`third-party/mattpocock-skills/skills/in-progress/handoff/SKILL.md`](../third-party/mattpocock-skills/skills/in-progress/handoff/SKILL.md); SHA pin in [`third-party/MANIFEST.md`](../third-party/MANIFEST.md).
|
|
12
|
+
|
|
13
|
+
## What this skill does
|
|
14
|
+
|
|
15
|
+
Write a handoff document summarising the current conversation so a fresh agent can continue the work. Save it to a path produced by `mktemp -t handoff-XXXXXX.md` (read the file before you write to it).
|
|
16
|
+
|
|
17
|
+
Suggest the skills to be used, if any, by the next session.
|
|
18
|
+
|
|
19
|
+
Do not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
|
|
20
|
+
|
|
21
|
+
If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
|
|
22
|
+
|
|
23
|
+
## When to fire it
|
|
24
|
+
|
|
25
|
+
- End of a working session that did not finish the task — you want the next agent to pick up cold without re-reading the whole transcript.
|
|
26
|
+
- Context budget approaching the ceiling and `/compact` would lose load-bearing state — write a handoff doc first, then compact.
|
|
27
|
+
- Switching from one repo or branch to another mid-session — capture what was decided in the active context before the swap.
|
|
28
|
+
- Before invoking a long-running autonomous loop (`/ralph`, `/loop`) that will run while you are away.
|
|
29
|
+
|
|
30
|
+
## What goes in the doc
|
|
31
|
+
|
|
32
|
+
The handoff is a brief, not a transcript. A useful one fits on one screen and answers, in order:
|
|
33
|
+
|
|
34
|
+
1. **Goal** — the one-sentence outcome the user is steering toward.
|
|
35
|
+
2. **Current state** — what is actually true on disk / in the system right now (branch, last commit, open files, last verified step).
|
|
36
|
+
3. **Decisions made this session** — only what is not already in commits, PRDs, ADRs, or the plan doc.
|
|
37
|
+
4. **Open questions** — blocking choices the next agent needs the user to answer before continuing.
|
|
38
|
+
5. **Next concrete step** — the single action the next agent should take first.
|
|
39
|
+
6. **Skills to load** — names of the skills the next session should activate (e.g. `verification-loop`, `superpowers:writing-plans`, `gateguard`).
|
|
40
|
+
|
|
41
|
+
Anything that is already captured elsewhere gets a path or URL pointer, not a duplicate.
|
|
42
|
+
|
|
43
|
+
## How it fits the 7 Laws
|
|
44
|
+
|
|
45
|
+
| Law | Role of this skill |
|
|
46
|
+
|---|---|
|
|
47
|
+
| Law 5 (Reflect After Every Session) | The handoff is the reflection artifact — what changed, what was decided, what remains. |
|
|
48
|
+
| Law 7 (Learn From Every Session) | Naming the skills the next session should activate is a learned-pattern signal. |
|
|
49
|
+
| Law 2 (Plan Is Sacred) | The "next concrete step" preserves the existing plan across the session boundary instead of restarting from blank. |
|
|
50
|
+
|
|
51
|
+
## Companion / alternative skills
|
|
52
|
+
|
|
53
|
+
- [`strategic-compact`](./strategic-compact.md) — compact the current session at a phase boundary instead of writing a handoff doc. Use when the session continues with the same agent.
|
|
54
|
+
- [`para-memory-files`](./para-memory-files.md) — durable cross-session memory under `~/.claude/memory/`. Use for classified facts (user, project, feedback, reference), not per-session handoff briefs.
|
|
55
|
+
- `superpowers:writing-plans` — produce the plan doc the handoff can reference instead of duplicating.
|
|
56
|
+
|
|
57
|
+
## Attribution
|
|
58
|
+
|
|
59
|
+
This skill is a port of [mattpocock/skills `in-progress/handoff`](https://github.com/mattpocock/skills/blob/main/skills/in-progress/handoff/SKILL.md). MIT-licensed upstream, MIT-licensed here. See [`third-party/mattpocock-skills/LICENSE`](../third-party/mattpocock-skills/LICENSE) for the verbatim license and [`third-party/mattpocock-skills/OUR_NOTES.md`](../third-party/mattpocock-skills/OUR_NOTES.md) for the vendoring rationale and drift radar.
|
|
@@ -63,7 +63,7 @@ $AGENT_HOME/life/
|
|
|
63
63
|
- Significant project or company in the user's life.
|
|
64
64
|
- Otherwise, note it in daily notes.
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Atomic facts in `items.yaml` use the fields `id`, `created`, `content`, and optional `status` (`active` or `superseded`) with `superseded_by` pointing to the replacing fact. Memory decay is manual: rewrite `summary.md` weekly from active facts and move inactive entity folders to `archives/`.
|
|
67
67
|
|
|
68
68
|
### Layer 2: Daily Notes (`$AGENT_HOME/memory/YYYY-MM-DD.md`)
|
|
69
69
|
|
|
@@ -57,21 +57,95 @@ Do NOT use when:
|
|
|
57
57
|
- User scoped the work ("just the first one", "only the safe ones") — honor the scope
|
|
58
58
|
- Recommendations conflict with project agent-instruction files (CLAUDE.md / AGENTS.md / GEMINI.md / equivalent)
|
|
59
59
|
|
|
60
|
+
## Fast-Path: `--once` Mode
|
|
61
|
+
|
|
62
|
+
For single-item, low-risk confirmations, the seven-phase flow below is overkill — P-MAG + plan-restate + reflect + three-section close add more ceremony than the work itself. `--once` is an opt-in fast path that runs **Phase 1 (Pre-Flight) + Phase 3 (Execute) + Phase 4 (Verify) only**. Phase 0 (P-MAG), Phase 2 (Plan), Phase 5 (Iterate-on-failure restart), Phase 6 (Reflect), and Phase 7 (three-section close) are skipped.
|
|
63
|
+
|
|
64
|
+
### When `--once` applies
|
|
65
|
+
|
|
66
|
+
Invoke `--once` only when ALL of the following hold:
|
|
67
|
+
|
|
68
|
+
- The prior turn's recommendation list contained **exactly one** item.
|
|
69
|
+
- The item is tagged **`safe`** in Phase 1 (not `caution`, not `needs-approval`).
|
|
70
|
+
- The item is fully verifiable with a single smallest check (one typecheck, one curl, one read-back, one command output snippet).
|
|
71
|
+
- The user explicitly added `--once` to the trigger or invoked `/proceed-with-the-recommendation --once`.
|
|
72
|
+
|
|
73
|
+
### Trigger phrases for `--once`
|
|
74
|
+
|
|
75
|
+
- `/proceed-with-the-recommendation --once`
|
|
76
|
+
- `/proceed --once`
|
|
77
|
+
- "proceed once with that"
|
|
78
|
+
- "just do that one"
|
|
79
|
+
- Any standard trigger phrase plus the literal `--once` suffix anywhere in the user message
|
|
80
|
+
|
|
81
|
+
### What runs under `--once`
|
|
82
|
+
|
|
83
|
+
| Phase | Status under `--once` |
|
|
84
|
+
|---|---|
|
|
85
|
+
| Phase 0 — P-MAG | **Skipped.** Reason: single-item runs do not accumulate enough state to need a past-mistake gate; running it twice on the same surface within minutes is wasted ceremony. |
|
|
86
|
+
| Phase 1 — Pre-Flight | **Runs.** Restate the one item, tag it `safe`, route it. |
|
|
87
|
+
| Phase 2 — Plan | **Skipped.** Reason: a one-line item does not need a `docs/plans/` artifact. |
|
|
88
|
+
| Phase 3 — Execute | **Runs.** Route to the preferred skill or inline fallback. |
|
|
89
|
+
| Phase 4 — Verify | **Runs.** Smallest check, with the output snippet quoted verbatim. |
|
|
90
|
+
| Phase 5 — Iterate | **Halts on failure.** If Phase 4 fails, do NOT silently restart — report the failure and stop. The operator decides whether to re-invoke the full flow. |
|
|
91
|
+
| Phase 6 — Reflect | **Skipped.** No Reflection block, no `observations.jsonl` append, no `Will NOT repeat:` carry-forward. |
|
|
92
|
+
| Phase 7 — Three-section close | **Skipped.** The reply ends with a single line: `Done: <item>. Verified: <check + output>.` No tiered tables, no WILD/RISA, no `Want me to: A or B?` closer. |
|
|
93
|
+
|
|
94
|
+
### Hard preconditions (refuse `--once` if any fail)
|
|
95
|
+
|
|
96
|
+
`--once` MUST refuse and fall back to the full flow if:
|
|
97
|
+
|
|
98
|
+
- The recommendation list has more than one item. The seven-phase flow exists because multi-item runs accumulate state across items; the fast path cannot guarantee that.
|
|
99
|
+
- The item is tagged `caution` or `needs-approval`. P-MAG is the gate that catches "we already broke this last week"; skipping it on caution-tagged work is exactly the failure pattern the gate was built for.
|
|
100
|
+
- The item touches `>3` files, `>150` LOC, or any of `.github/`, `bin/`, `lib/`, `src/`, `third-party/`. Those surfaces have explicit invariants (`verify:all`, the third-party vendor contract, the `.mts` build pipeline) that the seven-phase flow protects.
|
|
101
|
+
- The item is destructive (deploy, force-push, DB drop, secret rotation, file delete that is not a generated artifact). These always route through the full flow regardless of size.
|
|
102
|
+
|
|
103
|
+
If a precondition fails, emit one line: `--once refused: <reason>. Falling back to full proceed flow.` and continue with Phase 0.
|
|
104
|
+
|
|
105
|
+
### What you give up
|
|
106
|
+
|
|
107
|
+
`--once` trades reflection + learning + close-discipline for speed. Concrete losses per skipped phase:
|
|
108
|
+
|
|
109
|
+
- **No P-MAG read** — past mistakes from prior sessions are not surfaced. Acceptable on single-file safe edits; risky on anything touching code paths the operator has corrected before.
|
|
110
|
+
- **No Reflect block** — the run does not append to `observations.jsonl`. Mulahazah will not learn from this iteration.
|
|
111
|
+
- **No three-section close** — the next turn cannot use `wild-risa-balance` tier inference from a `## Recommendation (expert|beginner)` heading because no such heading shipped.
|
|
112
|
+
|
|
113
|
+
`--once` is the right call when the work is genuinely smaller than the ceremony. For anything larger, the seven-phase flow is the discipline.
|
|
114
|
+
|
|
115
|
+
### Example
|
|
116
|
+
|
|
117
|
+
Prior turn (last item from a five-item recommendation block):
|
|
118
|
+
|
|
119
|
+
> 5. Run `npm run verify:docs-substrings` and confirm green before committing.
|
|
120
|
+
|
|
121
|
+
Operator: `/proceed --once`
|
|
122
|
+
|
|
123
|
+
Under `--once`, the entire response is two lines:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
Routed to: inline (Bash). Item: "Run npm run verify:docs-substrings and confirm green." Tag: safe.
|
|
127
|
+
Done: ran `npm run verify:docs-substrings`. Verified: `OK docs-substrings: all 150 substring assertion(s) match their target files.`
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
No Phase 0 quote, no `Will NOT repeat:`, no Reflection, no tiered tables, no `Want me to:` closer.
|
|
131
|
+
|
|
60
132
|
## Phase 0: Acknowledge (Past Mistake Acknowledgment Gate / P-MAG)
|
|
61
133
|
|
|
62
134
|
Before research begins, the skill must read its own track record. The instinct system records corrections; this gate forces the read at the moment they actually matter — before a new recommendation list is touched. **Three rules, in order. None is optional.**
|
|
63
135
|
|
|
64
136
|
### Rule 1 — Acknowledge before context (right context from the beginning)
|
|
65
137
|
|
|
66
|
-
Scan three surfaces and
|
|
138
|
+
Run [`scripts/scan-past-mistakes.mjs`](../scripts/scan-past-mistakes.mjs) at the project root. Scan three surfaces in one pass and surface every entry with a citation:
|
|
139
|
+
|
|
140
|
+
- `~/.claude/instincts/<project-hash>/observations.jsonl` — last N (default 10) entries with `type: failure` or `correction` (legacy `event` field also matched for pre-2026-05-06 rows)
|
|
141
|
+
- `~/.claude/projects/<project-hash>/memory/feedback_*.md` — every file whose frontmatter declares `type: feedback`; the canonical home of the operator's named corrections (e.g. `feedback_past_mistake_gate.md`, `feedback_no_git_add_all_on_windows.md`)
|
|
142
|
+
- `<project-root>/CLAUDE.md` "## Past Mistakes" table rows (if present)
|
|
67
143
|
|
|
68
|
-
-
|
|
69
|
-
- `~/.claude/projects/<project-hash>/memory/feedback_*.md` — auto-memory `feedback`-typed entries (named-pattern corrections the operator declared in prior sessions); `~/.claude/projects/<project-hash>/memory/MEMORY.md` is the index of these files
|
|
70
|
-
- The active project's `CLAUDE.md` "Past Mistakes" section (if present)
|
|
144
|
+
Pass `--json` for machine consumption, or override paths via `--observations <path>`, `--memory-dir <dir>`, `--claude-md <path>` (the auto-detection derives all three from the project root via the standard `<hash>` convention). If the script outputs `No prior mistakes recorded — proceed.`, all three surfaces were empty and Rule 1 is satisfied.
|
|
71
145
|
|
|
72
|
-
|
|
146
|
+
For each scanned entry, emit one line: `Past mistake observed: <quote>. Source: <file:line>. Active in current scope: yes|no.` The script provides the quote + source citation; the active-in-scope judgment is yours — read each surface against the recommendation list and decide.
|
|
73
147
|
|
|
74
|
-
|
|
148
|
+
Skipping this scan because the surface paths are project-host-specific is the historically most common silent failure of this gate; the script removes that excuse. If the script must run, a skip surfaces as no output emitted at all — making the bypass detectable rather than invisible.
|
|
75
149
|
|
|
76
150
|
### Rule 2 — Clearance gate (don't proceed until the mistake is gone)
|
|
77
151
|
|
|
@@ -128,6 +202,8 @@ For each item in the ORIGINAL order:
|
|
|
128
202
|
|
|
129
203
|
### Routing Table (with Inline Fallbacks)
|
|
130
204
|
|
|
205
|
+
Run [`scripts/route-recommendation.mjs "<item>"`](../scripts/route-recommendation.mjs) to match a single recommendation item to its preferred chain + inline fallback. Default mode prints the matched row; `--json` for programmatic consumption; `--list` enumerates every row. The programmatic source of truth is [`scripts/route-recommendation.routes.json`](../scripts/route-recommendation.routes.json) — the table below is the human-readable documentation that mirrors it. If they drift, the routes.json file wins.
|
|
206
|
+
|
|
131
207
|
Rows whose **Preferred skill** is not bundled with the `continuous-improvement` plugin carry a `(Reference behavior — does not require <skill>.)` marker on the fallback cell. The marker makes the soft-dependency contract visible at point of use: the inline fallback is fully self-contained and runs without that skill installed. Rows whose preferred skill ships with the plugin (`ralph`, `tdd-workflow`, `continuous-improvement`) carry no marker — the dedicated skill is always available.
|
|
132
208
|
|
|
133
209
|
| Recommendation type | Preferred skill | Inline fallback |
|
package/skills/ralph.md
CHANGED
|
@@ -3,6 +3,7 @@ name: ralph
|
|
|
3
3
|
tier: companion
|
|
4
4
|
description: "Enforces Law 6 (Iterate Means One Thing) of the 7 Laws of AI Agent Discipline at PRD scale. Ralph is an autonomous AI agent loop that runs repeatedly until all PRD items are complete. Converts PRDs to executable JSON, implements stories iteratively with quality checks, and tracks progress."
|
|
5
5
|
origin: https://github.com/snarktank/ralph
|
|
6
|
+
disable-model-invocation: true
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Ralph — Autonomous Agent Loop
|
package/skills/recall.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: recall
|
|
3
|
+
tier: "1"
|
|
4
|
+
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Makes past sessions first-class research material by searching the observation log with BM25 ranking, so 'have I hit this before?' is answerable before re-deriving a fix or repeating a mistake.
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Recall — Episodic Search Over Past Sessions
|
|
10
|
+
|
|
11
|
+
Law 1 says research before executing. The cheapest research is your own history: the exact error you are staring at may have been solved three sessions ago. `observations.jsonl` already records every tool call, but an append-only log is not searchable. Recall turns that log into a ranked, queryable memory.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
|
|
15
|
+
- Before tackling a problem that feels familiar ("haven't I seen this error before?").
|
|
16
|
+
- Before a risky or destructive operation — check whether a past attempt failed.
|
|
17
|
+
- Before reading large files from scratch — a past session may already summarize the relevant facts.
|
|
18
|
+
- When onboarding into an unfamiliar area of the codebase that you have touched before.
|
|
19
|
+
|
|
20
|
+
## Core Concept
|
|
21
|
+
|
|
22
|
+
Recall builds an in-memory BM25 index over the observation rows and answers a query with the most relevant past activity, newest-first on ties:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
ci_recall query="permission denied push"
|
|
26
|
+
ci_recall query="jq command not found" k=3
|
|
27
|
+
ci_recall query="auth login" since=7d
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Each result is a past tool call with a redacted snippet, a relevance score, and a timestamp.
|
|
31
|
+
|
|
32
|
+
## Privacy
|
|
33
|
+
|
|
34
|
+
Snippets are passed through a secret redactor before they are surfaced. AWS access keys, JWT-shaped triplets, bearer tokens, `KEY`/`SECRET`/`TOKEN`/`PASSWORD` assignments, and long hex strings are masked. The observation log already caps output at 200 characters; redaction is the second layer.
|
|
35
|
+
|
|
36
|
+
## Limitations
|
|
37
|
+
|
|
38
|
+
- **Lexical, not semantic.** A query for "login" will not surface activity that only ever said "authentication". Search with the vocabulary that actually appeared in the tool calls, or try several phrasings.
|
|
39
|
+
- **Scoped to the captured history.** Recall only knows what the hooks recorded. Thin-schema rows (no input/output, emitted when the Node observer is not wired) contribute little signal.
|
|
40
|
+
- **In-memory rebuild per query.** Dependency-free and fast at current volumes; a `node:sqlite` FTS5 index is a planned follow-up if the log grows past ~100k rows.
|
|
41
|
+
|
|
42
|
+
## How to Invoke
|
|
43
|
+
|
|
44
|
+
Exposed as the `ci_recall` MCP tool (expert mode) and the `/recall` slash command. `query` is required; `k` (default 5) and `since` (ISO timestamp or `7d`/`24h`/`30m`) are optional.
|
|
45
|
+
|
|
46
|
+
## Pairs With
|
|
47
|
+
|
|
48
|
+
- **`gateguard`** (Law 1) — before clearing a high-risk action, recall whether a past attempt at the same thing failed.
|
|
49
|
+
- **`continuous-improvement`** (core SKILL.md, Law 7 — Learn From Every Session) — recall is the retrieval side of the same observation log the instinct engine learns from.
|
|
50
|
+
- **`workspace-surface-audit`** — recall confirms whether the environment facts the audit records have bitten this project before.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reconcile
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations, and verifies a push actually landed instead of assuming it did.
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Reconcile — Ground-Truth Git State Before You Touch It
|
|
10
|
+
|
|
11
|
+
Law 1 says research before executing. The most expensive skipped research is the state of your own repo: a branch that shifted under you, a push that silently did not land, a stash from a session you forgot. This skill establishes git ground truth first, acts only on a known state, and stops at every operation that is hard to reverse.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
|
|
15
|
+
- Before any branch/merge/rebase/push when more than one session, loop, or agent may be writing to the tree.
|
|
16
|
+
- When the working tree looks different from what you expect (unexpected branch, surprise modifications, a half-finished merge).
|
|
17
|
+
- Before cleaning up: consolidating branches, dropping stashes, removing worktrees.
|
|
18
|
+
- After a push, to confirm it actually landed on the remote.
|
|
19
|
+
|
|
20
|
+
## Establish Ground Truth First
|
|
21
|
+
|
|
22
|
+
Read before you write. Capture the full state in one pass:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
git branch --show-current
|
|
26
|
+
git status --porcelain=v1
|
|
27
|
+
git rev-list --left-right --count @{u}...HEAD # behind / ahead of upstream
|
|
28
|
+
git stash list
|
|
29
|
+
git worktree list
|
|
30
|
+
ls .git/MERGE_HEAD .git/rebase-merge .git/rebase-apply 2>/dev/null # in-progress operation?
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
On Windows with `autocrlf=true`, `git status` reports phantom line-ending-only modifications. Trust `git diff --stat` (and `git diff --ignore-all-space`) for real content drift, not `git status`. Never stage with `git add -A` / `git add .` on such a tree — stage by explicit filename.
|
|
34
|
+
|
|
35
|
+
## Detect a Concurrent Writer
|
|
36
|
+
|
|
37
|
+
When another session/loop may be active, do not assume the tree is yours:
|
|
38
|
+
|
|
39
|
+
- An in-progress `MERGE_HEAD` / `rebase-merge` you did not start means another actor is mid-operation. Do not "help" by editing conflicted files — wait, or hand off.
|
|
40
|
+
- Re-read the current branch immediately before any mutation; if it shifted since your snapshot, re-survey from the top.
|
|
41
|
+
- If `.git/index` keeps changing while you are idle, a writer is active. Pause and surface it rather than racing.
|
|
42
|
+
- If `gateguard` is installed, its Parallel-Actor Gate already captured this baseline on the session's first mutation (via `scripts/git-state-snapshot.sh`) and divergence-checks every later mutation — `reconcile` complements that gate, it does not replace it. Without gateguard, run the snapshot above yourself.
|
|
43
|
+
|
|
44
|
+
## Classify, Then Act
|
|
45
|
+
|
|
46
|
+
Map the upstream relationship before choosing an action:
|
|
47
|
+
|
|
48
|
+
- **even** (0 ahead / 0 behind) → safe to branch.
|
|
49
|
+
- **ahead only** → push (after the protected-op gate below) or open a PR.
|
|
50
|
+
- **behind only** → `git pull --ff-only`.
|
|
51
|
+
- **diverged** (both) → rebase or merge deliberately; never blind `--force`.
|
|
52
|
+
|
|
53
|
+
Branch from a base only after confirming `local <base>` equals `origin/<base>` — a squash-merge will otherwise silently bundle ahead-of-origin commits.
|
|
54
|
+
|
|
55
|
+
## Halt on Protected or Destructive Operations
|
|
56
|
+
|
|
57
|
+
STOP and get explicit authorization before:
|
|
58
|
+
|
|
59
|
+
- Pushing to a protected branch (e.g. `main`) — this repo's flow is feature branch + PR, never direct push.
|
|
60
|
+
- `git push --force` / `--force-with-lease`, `git reset --hard`, `git clean -fd`, `worktree remove` on a dirty worktree, or dropping a stash with uncommitted value.
|
|
61
|
+
|
|
62
|
+
If a rebase has diverged and force-push is gated, do not force-recover — supersede via a new branch + new PR.
|
|
63
|
+
|
|
64
|
+
## Verify the Push Actually Landed
|
|
65
|
+
|
|
66
|
+
A push that printed no error is still a claim. Confirm:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
git rev-parse HEAD
|
|
70
|
+
git ls-remote origin refs/heads/<branch> # remote tip must equal local HEAD
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If the remote ref is absent or behind, the push did not land — investigate before reporting success.
|
|
74
|
+
|
|
75
|
+
## Pairs With
|
|
76
|
+
|
|
77
|
+
- **`recall`** (Law 1) — before a risky git op, recall whether the same operation failed on this repo before.
|
|
78
|
+
- **`gateguard`** (Law 1) — the runtime gate (`hooks/gateguard.mjs`); `reconcile` is the procedure you run once a destructive git action is in play.
|
|
79
|
+
- **`safety-guard`** — destructive-operation guardrails for production and autonomous runs.
|
|
80
|
+
- **`audit`** (Law 4) — when an audit ends in a fix, `reconcile` is the safe path from branch to landed PR.
|
|
@@ -3,6 +3,7 @@ name: recovery-classification
|
|
|
3
3
|
tier: "2"
|
|
4
4
|
description: "Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. After any failure in the verification ladder or auto-loop, classify the failure class before retrying — provider, tool-schema, deterministic-policy, git, worktree, runtime — so retry-vs-pause-vs-self-heal-vs-stop is an intentional decision, not a generic 'try again'."
|
|
5
5
|
origin: continuous-improvement
|
|
6
|
+
user-invocable: false
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Recovery Classification Skill
|
package/skills/safety-guard.md
CHANGED
|
@@ -3,6 +3,7 @@ name: safety-guard
|
|
|
3
3
|
tier: "2"
|
|
4
4
|
description: Enforces Law 3 (One Thing at a Time) of the 7 Laws of AI Agent Discipline by scoping edits to a directory and blocking destructive shell commands. Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
|
|
5
5
|
origin: continuous-improvement
|
|
6
|
+
disable-model-invocation: true
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Safety Guard — Prevent Destructive Operations
|