@luizsantiago/spec-guardrails 3.1.8 → 3.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +256 -253
  3. package/index.js +394 -394
  4. package/lib/adapters.js +17 -17
  5. package/lib/agent-contract.js +74 -74
  6. package/lib/agents-md.js +21 -21
  7. package/lib/archive.js +222 -218
  8. package/lib/assets.js +145 -145
  9. package/lib/brownfield.js +435 -446
  10. package/lib/classify-change.js +127 -127
  11. package/lib/claude-md.js +20 -20
  12. package/lib/codex-agents.js +19 -19
  13. package/lib/config.js +293 -293
  14. package/lib/constants.js +244 -244
  15. package/lib/copilot-instructions.js +23 -23
  16. package/lib/cursorrules.js +92 -92
  17. package/lib/delta-merge.js +248 -248
  18. package/lib/doctor.js +432 -431
  19. package/lib/download.js +133 -133
  20. package/lib/feature-status.js +160 -160
  21. package/lib/feature.js +272 -272
  22. package/lib/fs-utils.js +114 -114
  23. package/lib/gates.js +218 -205
  24. package/lib/install.js +146 -146
  25. package/lib/marked-inject.js +78 -78
  26. package/lib/memory.js +34 -34
  27. package/lib/next-steps.js +55 -55
  28. package/lib/presets.js +176 -176
  29. package/lib/project-rules.js +212 -212
  30. package/lib/slug-utils.js +40 -0
  31. package/lib/specs-utils.js +161 -123
  32. package/lib/token-cost.js +124 -124
  33. package/package.json +46 -46
  34. package/rules/engineering-baseline.mdc +56 -56
  35. package/scripts/_common.py +397 -356
  36. package/scripts/analyze_artifacts.py +187 -187
  37. package/scripts/check_commit.py +140 -140
  38. package/scripts/lessons.py +447 -447
  39. package/scripts/loop_plan.py +217 -217
  40. package/scripts/validate_quick.py +159 -159
  41. package/scripts/validate_spec.py +345 -345
  42. package/scripts/validate_state.py +385 -385
  43. package/scripts/validate_tasks.py +379 -379
  44. package/scripts/validate_traceability.py +167 -167
  45. package/skills/agent-architecture.md +220 -220
  46. package/skills/appsec.md +83 -83
  47. package/skills/code-simplify.md +49 -49
  48. package/skills/engineering-standards.md +98 -98
  49. package/skills/git-handoff.md +213 -213
  50. package/skills/qa-strategy.md +83 -83
  51. package/skills/references/analyze.md +56 -56
  52. package/skills/references/archive.md +60 -60
  53. package/skills/references/constitution.md +66 -66
  54. package/skills/references/context-limits.md +73 -73
  55. package/skills/references/converge.md +47 -47
  56. package/skills/references/design.md +88 -88
  57. package/skills/references/discuss.md +68 -68
  58. package/skills/references/explore.md +61 -61
  59. package/skills/references/implement.md +175 -175
  60. package/skills/references/lessons.md +71 -71
  61. package/skills/references/memory.md +98 -98
  62. package/skills/references/project-init.md +62 -62
  63. package/skills/references/quick-mode.md +88 -88
  64. package/skills/references/specify.md +144 -144
  65. package/skills/references/sub-agents.md +117 -117
  66. package/skills/references/tasks.md +178 -178
  67. package/skills/references/validate.md +210 -210
  68. package/skills/security-review.md +120 -120
  69. package/skills/ship-ready.md +50 -50
  70. package/skills/task-graph-engineering.md +180 -180
  71. package/templates/GETTING_STARTED.md +64 -63
  72. package/templates/config.yaml.example +28 -28
  73. package/templates/presets/default.yaml +16 -16
  74. package/templates/presets/node-ts.yaml +22 -22
  75. package/templates/presets/python.yaml +22 -22
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Luiz Santiago
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luiz Santiago
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,253 +1,256 @@
1
- # Spec Guardrails
2
-
3
- [![npm version](https://img.shields.io/npm/v/@luizsantiago/spec-guardrails.svg)](https://www.npmjs.com/package/@luizsantiago/spec-guardrails)
4
- [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
-
6
- **Keep AI coding agents honest — specify the work, prove each step, verify independently.**
7
-
8
- | | |
9
- | --- | --- |
10
- | **Problem** | Agents ship “looks good” with thin specs, missing evidence, and the same context that wrote the code declaring victory. |
11
- | **Solution** | One kit, two deliberate modes: **Process** (Node only) for a flexible spec-driven workflow; **Brakes** (Node + Python) for the **full product** — structural gates that exit non-zero when paperwork or evidence is missing. You approve specs/tasks in both. |
12
- | **Result** | Traceable `.specs/` memory, fewer fake finishes, cheaper turns (~70% less skill text on planning). Choose Process for light ceremony; add Python when you want the [Guarantees matrix](#guarantees-matrix) enforced automatically. |
13
-
14
- npm: [`@luizsantiago/spec-guardrails`](https://www.npmjs.com/package/@luizsantiago/spec-guardrails) **3.1.x**
15
-
16
- ---
17
-
18
- ## Install
19
-
20
- ```bash
21
- npx @luizsantiago/spec-guardrails install
22
- ```
23
-
24
- ### What you need
25
-
26
- | Requirement | Role |
27
- | --- | --- |
28
- | **Node.js 18+** | Required — runs the CLI and `install` |
29
- | **Python 3.10+** | Activates **Brakes mode** — the **full** kit with Python structural gates (`validate-spec`, `validate-tasks`, …). Gates stay Python by design. Without Python you stay in **Process mode**: same phases and checklists, no exit-code enforcement. Run [`doctor`](#install) to see which mode you are in |
30
-
31
- ### What install does
32
-
33
- | Lands in your project | Purpose |
34
- | --- | --- |
35
- | `.cursor/skills/` + `.claude/skills/` + `.github/skills/` + `.codex/skills/` | Hub, phase references, sister skills (**shipped adapters** — same content, product-specific paths) |
36
- | `.specs/guardrails/scripts/` | Python gate scripts (Brakes mode) |
37
- | `.specs/STATE.md`, `.specs/features/`, … | Project memory (any agent) |
38
- | `.cursor/rules/engineering-baseline.mdc` | Always-on Cursor rule |
39
-
40
- **Agent environments:** the **core** (`.specs/`, CLI, hub, Python gates) works with any AI agent. **Install** ships adapters for **Cursor, Claude Code, GitHub Copilot, and OpenAI Codex** (plus root `AGENTS.md`). See [Architecture](docs/guide/Architecture.md).
41
-
42
- Re-run `install` anytime to refresh skills; your `.specs/` decisions and `STATE.md` are kept.
43
-
44
- | Need | Command |
45
- | --- | --- |
46
- | First time / upgrade | `install` |
47
- | Existing codebase | `project-init` (optional) |
48
- | Something looks wrong | `doctor` |
49
- | Full CLI list | `--help` |
50
-
51
- ---
52
-
53
- ## How it works in one screen
54
-
55
- Four ideas stack — full explanation: **[Concepts](docs/guide/concepts.md)**
56
-
57
- | Idea | What it is | What it does |
58
- | --- | --- | --- |
59
- | **Spec-driven** | Written plan before code | `spec.md` + `tasks.md`; evidence before “done” |
60
- | **Brakes / Gates** | Structural stop-gates | Python scripts exit non-zero when paperwork or evidence is missing |
61
- | **Loop** | Execute in waves | `loop-plan` picks the next jobs; sub-agents when files don’t overlap |
62
- | **Graph** | Parallel task map | `task-graph.md` — safe parallelism without file collisions |
63
- | **Memory** | Persistent project state | `.specs/` — specs, decisions, and handoff survive across chats |
64
-
65
- **You** approve specs and tasks. **The agent** runs gates and implements. **Gates** exit non-zero when paperwork or evidence is missing.
66
-
67
- Plain-language tour: [Home](docs/guide/Home.md) · [How it works](docs/guide/How-it-works.md) · [Quick start](docs/guide/Quick-start.md)
68
-
69
- ---
70
-
71
- ## Operating modes
72
-
73
- Two modes, one package — pick how much rigor you want:
74
-
75
- | Mode | Runtime | What you get | Best for |
76
- | --- | --- | --- | --- |
77
- | **Process** | Node.js 18+ | Spec-driven workflow, `.specs/` memory, progressive loading, independent `/verify` | Flexible ceremony, exploration, teams that enforce by review |
78
- | **Brakes** | Node + **Python 3.10+** | Everything in Process **plus** Python gates from the [Guarantees matrix](#guarantees-matrix) — exit ≠ 0 → stop and fix | The **full Spec Guardrails** — traceability, evidence, and structural guarantees enforced automatically |
79
-
80
- **Gates stay Python.** That is the product: Brakes mode is the complete version with automated enforcement. Process mode is the same loop without exit-code brakes — intentional, not incomplete.
81
-
82
- Install Python when you want gates to fire; run `doctor` to confirm Brakes are available.
83
-
84
- ---
85
-
86
- ## Guarantees matrix
87
-
88
- **Guarantees are the product.** Commands are implementation.
89
-
90
- | Guarantee | Mechanism | Mode | Enforcement |
91
- | --- | --- | --- | --- |
92
- | Intent exists before code | `validate-spec` | Brakes | Hard gate |
93
- | Tasks derive from requirements | `analyze-artifacts` | Brakes | Hard gate |
94
- | Requirements stay traceable | `validate-traceability` | Brakes | Hard gate |
95
- | Dependencies respected in Execute | `loop-plan` | Brakes | Hard gate |
96
- | Parallel work is file-safe | `task-graph.md` + `validate-tasks` | Process + Brakes | Artifact + gate |
97
- | Completion cites evidence | `validate-state` | Brakes | Hard gate |
98
- | Commits follow policy | `check-commit` | Brakes | Hard gate |
99
- | Verification is independent | `/verify` + `validate.md` | Process | Phase skill |
100
- | Knowledge survives chats | `.specs/` + `archive-feature` | Process | Install + CLI |
101
-
102
- Full matrix, limits, and phase diagram → **[Guarantees matrix](docs/guide/Guarantees-matrix.md)** · [Architecture](docs/guide/Architecture.md) (Core + adapters)
103
-
104
- ---
105
-
106
- ## Token cost
107
-
108
- Progressive loading is the main cost win: **one working set per turn**, not the entire playbook.
109
-
110
- | Profile | Est. tokens | When |
111
- | ---: | ---: | --- |
112
- | Naive full dump (don’t) | ~31k | Loading every skill + reference every message |
113
- | Specify turn | ~9k | `/specify` — hub + `specify.md` + standards |
114
- | Tasks turn | ~10k | `/tasks` — hub + `tasks.md` + task-graph skill |
115
- | Execute `/loop` (one wave) | ~4k | One implement wave (inline or parallel) |
116
- | Verify turn | ~6k | Independent reviewer stack |
117
-
118
- Savings vs full dump: **~72%** (Specify), **~86%** (Execute). Numbers from `lib/token-cost.js`; CI guardrails in `test/test_token_cost.test.js`. Order-of-magnitude only — not a billing API.
119
-
120
- More: [Token efficiency](docs/guide/Token-efficiency.md)
121
-
122
- ---
123
-
124
- ## Complexity tiers (how work flows)
125
-
126
- The hub **Complexity Router** picks how much ceremony a feature needs — Quick, Simple, Medium, Complex, or Parallel. It is **not** a separate product feature; it is how the agent decides which phases to run.
127
-
128
- | Tier | Typical scope | Path |
129
- | --- | --- | --- |
130
- | **Quick** | ≤3 files, no new deps | `/quick` → verify → commit |
131
- | **Simple** | Small localized change | `/specify` → `/loop` → `/verify` |
132
- | **Medium** | New feature, <10 tasks | `/specify` → `/tasks` → `/loop` → `/verify` → `/archive` |
133
- | **Complex** | APIs, architecture, infra | + `/discuss`, `/plan`, optional security/QA on verify |
134
- | **Parallel** | Splittable work | Above + `/task-graph` when 3+ tasks |
135
-
136
- Rules and examples: [Concepts → Complexity tiers](docs/guide/concepts.md#complexity-tiers--how-the-agent-chooses-depth)
137
-
138
- ---
139
-
140
- ## Hub and skills (summary)
141
-
142
- Install copies a **hub** (`agent-architecture.md`), **phase references** (`references/*.md`), and **sister skills** (security, task-graph, …). The agent loads **one phase file at a time**.
143
-
144
- | Load order | Layer | Role | Examples |
145
- | ---: | --- | --- | --- |
146
- | 1 | **Hub** | Contract, complexity router, gate schedule | `agent-architecture.md` |
147
- | 2 | **Reference** | One phase procedure per turn | `specify.md`, `implement.md`, `validate.md` |
148
- | 3 | **Sister** (optional) | Cross-cutting depth, on demand | `engineering-standards.md`, `task-graph-engineering.md` |
149
- | 4 | **Gate** | Automatic check at the boundary | `validate-spec`, `loop-plan`, `check-commit` |
150
-
151
- Conditional sisters (`appsec.md`, `qa-strategy.md`, …) load **one at a time** on Verify when risk warrants it.
152
-
153
- Full map: **[Skills and hub](docs/guide/skills-and-hub.md)**
154
-
155
- ---
156
-
157
- ## Gates (summary)
158
-
159
- Commands implement the guarantees above. Scripts in `.specs/guardrails/scripts/`. **Exit ≠ 0 → stop and fix.**
160
-
161
- | When | Gate | What it blocks |
162
- | --- | --- | --- |
163
- | Before approving spec | `validate-spec` | Incomplete or untestable spec |
164
- | Before approving tasks | `analyze-artifacts` | Spec ↔ tasks drift |
165
- | Before approving tasks | `validate-tasks` | Bad tasks; missing graph when 3+ tasks |
166
- | After tasks / with validation | `validate-traceability` | REQ missing from tasks or coverage lines |
167
- | End of `/quick` | `validate-quick` | Incomplete Quick TASK/SUMMARY; >3 files; sensitive paths |
168
- | Each `/loop` wave | `loop-plan` | Blocked dependencies; shows parallel groups |
169
- | Each commit | `check-commit` | Non-Conventional commit message |
170
- | Before “done” | `validate-state` | Fake PASS without test evidence |
171
- | After Verify FAIL | `lessons` | Ungrounded “lessons learned” |
172
- | After Verify PASS | `archive-feature` | (CLI) folds feature into domain memory |
173
-
174
- Full reference: **[Gates](docs/guide/gates.md)** · [Guarantees matrix](docs/guide/Guarantees-matrix.md) · [Gates and guarantees](docs/guide/Gates-and-guarantees.md)
175
-
176
- ---
177
-
178
- ## Documentation
179
-
180
- | Doc | For |
181
- | --- | --- |
182
- | [Guarantees matrix](docs/guide/Guarantees-matrix.md) | Product promises → mechanisms |
183
- | [Architecture](docs/guide/Architecture.md) | Core vs platform adapters |
184
- | [Agent commands](docs/guide/agent-commands.md) | Every `/specify`, `/loop`, `/verify`, … — purpose, when, examples |
185
- | [Quick start](docs/guide/Quick-start.md) | First ten minutes |
186
- | [Concepts](docs/guide/concepts.md) | Spec-driven + guardrails + loop + graph |
187
- | [Skills and hub](docs/guide/skills-and-hub.md) | What each skill file does |
188
- | [Gates](docs/guide/gates.md) | How each gate works |
189
- | [Platform parity](docs/guide/Platform-parity.md) | Shipped adapters (Cursor, Claude, Copilot, Codex) — core works with any agent |
190
- | [FAQ](docs/guide/FAQ.md) | Common questions |
191
- | [Changelog](docs/CHANGELOG.md) | Full version history |
192
-
193
- Start after install: [Quick start](docs/guide/Quick-start.md) · [Agent commands](docs/guide/agent-commands.md)
194
-
195
- ---
196
-
197
- ## Upgrading
198
-
199
- ```bash
200
- npx @luizsantiago/spec-guardrails install
201
- ```
202
-
203
- | Version | What you gain |
204
- | --- | --- |
205
- | **3.1.x** | Copilot/Codex/AGENTS.md adapters; doctor Process + Brakes scores; unified execution contracts; `validate-traceability` / `validate-quick`; `classify-change` / `feature-status` |
206
- | **3.0.x** | Final name Spec Guardrails; `.specs/guardrails/`; no dual-path ([Migration](docs/guide/Migration.md)) |
207
- | **2.2.x** | Seatbelt-era paths & markers; `doctor` Execute hints; docs split from README |
208
- | **2.1.x** | `loop-plan` + parallel `/loop` waves |
209
- | **2.0.x** | Package rename → `@luizsantiago/spec-seatbelt` (superseded by 3.0) |
210
- | **1.1.x** | `project-init` for brownfield repos |
211
- | **0.9.x** | `archive-feature` + domain memory merge |
212
-
213
- Full history: [CHANGELOG](docs/CHANGELOG.md) · [Releases](https://github.com/luizssantiago92/spec-guardrails/releases) · [Stability policy](docs/guide/Stability-policy.md)
214
-
215
- Lineage: `agentic-harness` → `spec-seatbelt` → **`spec-guardrails` (final)**. Run `install` once after switching. See [Migration](docs/guide/Migration.md).
216
-
217
- ---
218
-
219
- ## Contributing
220
-
221
- See [CONTRIBUTING.md](CONTRIBUTING.md) — tests, gate freeze policy, local `npm run guardrails -- install`.
222
-
223
- ---
224
-
225
- ## Credits
226
-
227
- Spec Guardrails adapts open ideas; we did not invent spec-driven phases, loop design, or task-graph rules.
228
-
229
- ### Core lineage
230
-
231
- | Source | License | How we use it |
232
- | --- | --- | --- |
233
- | [tlc-spec-driven](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) | CC-BY-4.0 | Phase model, `.specs/` memory, gate lineage |
234
- | [addyosmani/agent-skills](https://github.com/addyosmani/agent-skills) | MIT | Discuss patterns, definition-of-done |
235
- | [graph-engineering](https://github.com/codejunkie99/graph-engineering) | MIT | Task-graph topology, stop rules, parallel merge |
236
-
237
- ### Loop & ecosystem
238
-
239
- | Source | License | How we use it |
240
- | --- | --- | --- |
241
- | [loop-engineering](https://github.com/cobusgreyling/loop-engineering) | MIT | Operational loop patterns; `doctor` score metaphor |
242
- | [Addy Osmani — Loop engineering](https://addyosmani.com/blog/loop-engineering/) | — | Essay lineage |
243
- | [awesome-harness-engineering](https://github.com/ai-boost/awesome-harness-engineering) | CC0 | Ecosystem taxonomy |
244
-
245
- ### Adjacent (not vendored)
246
-
247
- [DeepCode](https://github.com/HKUDS/DeepCode) · [RepoGraph](https://github.com/ozyyshr/RepoGraph)
248
-
249
- Extended attribution: [docs/guide/credits.md](docs/guide/credits.md)
250
-
251
- ## License
252
-
253
- MIT
1
+ # Spec Guardrails
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@luizsantiago/spec-guardrails.svg)](https://www.npmjs.com/package/@luizsantiago/spec-guardrails)
4
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ **Keep AI coding agents honest — specify the work, prove each step, verify independently.**
7
+
8
+ | | |
9
+ | --- | --- |
10
+ | **Problem** | Agents ship “looks good” with thin specs, missing evidence, and the same context that wrote the code declaring victory. |
11
+ | **Solution** | One kit, two deliberate modes: **Process** (Node only) for a flexible spec-driven workflow; **Brakes** (Node + Python) for the **full product** — structural gates that exit non-zero when paperwork or evidence is missing. You approve specs/tasks in both. |
12
+ | **Result** | Traceable `.specs/` memory, fewer fake finishes, cheaper turns (~70% less skill text on planning). Choose Process for light ceremony; add Python when you want the [Guarantees matrix](#guarantees-matrix) enforced automatically. |
13
+
14
+ npm: [`@luizsantiago/spec-guardrails`](https://www.npmjs.com/package/@luizsantiago/spec-guardrails) **3.1.x**
15
+
16
+ ---
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npx @luizsantiago/spec-guardrails install
22
+ ```
23
+
24
+ ### What you need
25
+
26
+ | Requirement | Role |
27
+ | --- | --- |
28
+ | **Node.js 18+** | Required — runs the CLI and `install` |
29
+ | **Python 3.10+** | Activates **Brakes mode** — the **full** kit with Python structural gates (`validate-spec`, `validate-tasks`, …). Gates stay Python by design. Without Python you stay in **Process mode**: same phases and checklists, no exit-code enforcement. Run [`doctor`](#install) to see which mode you are in |
30
+
31
+ ### What install does
32
+
33
+ | Lands in your project | Purpose |
34
+ | --- | --- |
35
+ | `.cursor/skills/` + `.claude/skills/` + `.github/skills/` + `.codex/skills/` | Hub, phase references, sister skills (**shipped adapters** — same content, product-specific paths) |
36
+ | `.specs/guardrails/scripts/` | Python gate scripts (Brakes mode) |
37
+ | `.specs/STATE.md`, `.specs/features/`, … | Project memory (any agent) |
38
+ | `.cursor/rules/engineering-baseline.mdc` | Always-on Cursor rule |
39
+
40
+ **Agent environments:** the **core** (`.specs/`, CLI, hub, Python gates) works with any AI agent. **Install** ships adapters for **Cursor, Claude Code, GitHub Copilot, and OpenAI Codex** (plus root `AGENTS.md`). See [Architecture](docs/guide/Architecture.md).
41
+
42
+ Re-run `install` anytime to refresh skills; your `.specs/` decisions and `STATE.md` are kept.
43
+
44
+ | Need | Command |
45
+ | --- | --- |
46
+ | First time / upgrade | `install` |
47
+ | Existing codebase | `project-init` (optional) |
48
+ | Something looks wrong | `doctor` |
49
+ | Full CLI list | `--help` |
50
+
51
+ ---
52
+
53
+ ## How it works in one screen
54
+
55
+ Four ideas stack — full explanation: **[Concepts](docs/guide/concepts.md)**
56
+
57
+ | Idea | What it is | What it does |
58
+ | --- | --- | --- |
59
+ | **Spec-driven** | Written plan before code | `spec.md` + `tasks.md`; evidence before “done” |
60
+ | **Brakes / Gates** | Structural stop-gates | Python scripts exit non-zero when paperwork or evidence is missing |
61
+ | **Loop** | Execute in waves | `loop-plan` picks the next jobs; sub-agents when files don’t overlap |
62
+ | **Graph** | Parallel task map | `task-graph.md` — safe parallelism without file collisions |
63
+ | **Memory** | Persistent project state | `.specs/` — specs, decisions, and handoff survive across chats |
64
+
65
+ **You** approve specs and tasks. **The agent** runs gates and implements. **Gates** exit non-zero when paperwork or evidence is missing.
66
+
67
+ Plain-language tour: [Home](docs/guide/Home.md) · [How it works](docs/guide/How-it-works.md) · [Quick start](docs/guide/Quick-start.md)
68
+
69
+ ---
70
+
71
+ ## Operating modes
72
+
73
+ Two modes, one package — pick how much rigor you want:
74
+
75
+ | Mode | Runtime | What you get | Best for |
76
+ | --- | --- | --- | --- |
77
+ | **Process** | Node.js 18+ | Spec-driven workflow, `.specs/` memory, progressive loading, independent `/verify` | Flexible ceremony, exploration, teams that enforce by review |
78
+ | **Brakes** | Node + **Python 3.10+** | Everything in Process **plus** Python gates from the [Guarantees matrix](#guarantees-matrix) — exit ≠ 0 → stop and fix | The **full Spec Guardrails** — traceability, evidence, and structural guarantees enforced automatically |
79
+
80
+ **Gates stay Python.** That is the product: Brakes mode is the complete version with automated enforcement. Process mode is the same loop without exit-code brakes — intentional, not incomplete.
81
+
82
+ Install Python when you want gates to fire; run `doctor` to confirm Brakes are available.
83
+
84
+ ---
85
+
86
+ ## Guarantees matrix
87
+
88
+ **Guarantees are the product.** Commands are implementation.
89
+
90
+ | Guarantee | Mechanism | Mode | Enforcement |
91
+ | --- | --- | --- | --- |
92
+ | Intent exists before code | `validate-spec` | Brakes | Hard gate |
93
+ | Tasks derive from requirements | `analyze-artifacts` | Brakes | Hard gate |
94
+ | Task shape and graph when needed | `validate-tasks` | Brakes | Hard gate |
95
+ | Requirements stay traceable | `validate-traceability` | Brakes | Hard gate |
96
+ | Quick evidence is complete | `validate-quick` | Brakes | Hard gate |
97
+ | Dependencies respected in Execute | `loop-plan` | Brakes | Hard gate |
98
+ | Parallel work is file-safe | `task-graph.md` + `validate-tasks` | Process + Brakes | Artifact + gate |
99
+ | Completion cites evidence | `validate-state` | Brakes | Hard gate |
100
+ | Commits follow policy | `check-commit` | Brakes | Hard gate |
101
+ | Lessons grounded after FAIL | `lessons` | Brakes | Hard gate |
102
+ | Verification is independent | `/verify` + `validate.md` | Process | Phase skill |
103
+ | Knowledge survives chats | `.specs/` + `archive-feature` | Process | Install + CLI |
104
+
105
+ Full matrix, limits, and phase diagram → **[Guarantees matrix](docs/guide/Guarantees-matrix.md)** · [Architecture](docs/guide/Architecture.md) (Core + adapters)
106
+
107
+ ---
108
+
109
+ ## Token cost
110
+
111
+ Progressive loading is the main cost win: **one working set per turn**, not the entire playbook.
112
+
113
+ | Profile | Est. tokens | When |
114
+ | ---: | ---: | --- |
115
+ | Naive full dump (don’t) | ~31k | Loading every skill + reference every message |
116
+ | Specify turn | ~9k | `/specify` — hub + `specify.md` + standards |
117
+ | Tasks turn | ~10k | `/tasks` — hub + `tasks.md` + task-graph skill |
118
+ | Execute `/loop` (one wave) | ~4k | One implement wave (inline or parallel) |
119
+ | Verify turn | ~6k | Independent reviewer stack |
120
+
121
+ Savings vs full dump: **~72%** (Specify), **~86%** (Execute). Numbers from `lib/token-cost.js`; CI guardrails in `test/test_token_cost.test.js`. Order-of-magnitude only — not a billing API.
122
+
123
+ More: [Token efficiency](docs/guide/Token-efficiency.md)
124
+
125
+ ---
126
+
127
+ ## Complexity tiers (how work flows)
128
+
129
+ The hub **Complexity Router** picks how much ceremony a feature needs — Quick, Simple, Medium, Complex, or Parallel. It is **not** a separate product feature; it is how the agent decides which phases to run.
130
+
131
+ | Tier | Typical scope | Path |
132
+ | --- | --- | --- |
133
+ | **Quick** | ≤3 files, no new deps | `/quick` → verify → commit |
134
+ | **Simple** | Small localized change | `/specify` → `/loop` → `/verify` |
135
+ | **Medium** | New feature, <10 tasks | `/specify` → `/tasks` → `/loop` → `/verify` → `/archive` |
136
+ | **Complex** | APIs, architecture, infra | + `/discuss`, `/plan`, optional security/QA on verify |
137
+ | **Parallel** | Splittable work | Above + `/task-graph` when 3+ tasks |
138
+
139
+ Rules and examples: [Concepts → Complexity tiers](docs/guide/concepts.md#complexity-tiers--how-the-agent-chooses-depth)
140
+
141
+ ---
142
+
143
+ ## Hub and skills (summary)
144
+
145
+ Install copies a **hub** (`agent-architecture.md`), **phase references** (`references/*.md`), and **sister skills** (security, task-graph, …). The agent loads **one phase file at a time**.
146
+
147
+ | Load order | Layer | Role | Examples |
148
+ | ---: | --- | --- | --- |
149
+ | 1 | **Hub** | Contract, complexity router, gate schedule | `agent-architecture.md` |
150
+ | 2 | **Reference** | One phase procedure per turn | `specify.md`, `implement.md`, `validate.md` |
151
+ | 3 | **Sister** (optional) | Cross-cutting depth, on demand | `engineering-standards.md`, `task-graph-engineering.md` |
152
+ | 4 | **Gate** | Automatic check at the boundary | `validate-spec`, `loop-plan`, `check-commit` |
153
+
154
+ Conditional sisters (`appsec.md`, `qa-strategy.md`, …) load **one at a time** on Verify when risk warrants it.
155
+
156
+ Full map: **[Skills and hub](docs/guide/skills-and-hub.md)**
157
+
158
+ ---
159
+
160
+ ## Gates (summary)
161
+
162
+ Commands implement the guarantees above. Scripts in `.specs/guardrails/scripts/`. **Exit ≠ 0 → stop and fix.**
163
+
164
+ | When | Gate | What it blocks |
165
+ | --- | --- | --- |
166
+ | Before approving spec | `validate-spec` | Incomplete or untestable spec |
167
+ | Before approving tasks | `analyze-artifacts` | Spec ↔ tasks drift |
168
+ | Before approving tasks | `validate-tasks` | Bad tasks; missing graph when 3+ tasks |
169
+ | After tasks / with validation | `validate-traceability` | REQ missing from tasks or coverage lines |
170
+ | End of `/quick` | `validate-quick` | Incomplete Quick TASK/SUMMARY; >3 files; sensitive paths |
171
+ | Each `/loop` wave | `loop-plan` | Blocked dependencies; shows parallel groups |
172
+ | Each commit | `check-commit` | Non-Conventional commit message |
173
+ | Before “done” | `validate-state` | Fake PASS without test evidence |
174
+ | After Verify FAIL | `lessons` | Ungrounded “lessons learned” |
175
+ | After Verify PASS | `archive-feature` | (CLI) folds feature into domain memory |
176
+
177
+ Full reference: **[Gates](docs/guide/gates.md)** · [Guarantees matrix](docs/guide/Guarantees-matrix.md) · [Gates and guarantees](docs/guide/Gates-and-guarantees.md)
178
+
179
+ ---
180
+
181
+ ## Documentation
182
+
183
+ | Doc | For |
184
+ | --- | --- |
185
+ | [Guarantees matrix](docs/guide/Guarantees-matrix.md) | Product promises → mechanisms |
186
+ | [Architecture](docs/guide/Architecture.md) | Core vs platform adapters |
187
+ | [Agent commands](docs/guide/agent-commands.md) | Every `/specify`, `/loop`, `/verify`, … — purpose, when, examples |
188
+ | [Quick start](docs/guide/Quick-start.md) | First ten minutes |
189
+ | [Concepts](docs/guide/concepts.md) | Spec-driven + guardrails + loop + graph |
190
+ | [Skills and hub](docs/guide/skills-and-hub.md) | What each skill file does |
191
+ | [Gates](docs/guide/gates.md) | How each gate works |
192
+ | [Platform parity](docs/guide/Platform-parity.md) | Shipped adapters (Cursor, Claude, Copilot, Codex) — core works with any agent |
193
+ | [FAQ](docs/guide/FAQ.md) | Common questions |
194
+ | [Changelog](docs/CHANGELOG.md) | Full version history |
195
+
196
+ Start after install: [Quick start](docs/guide/Quick-start.md) · [Agent commands](docs/guide/agent-commands.md)
197
+
198
+ ---
199
+
200
+ ## Upgrading
201
+
202
+ ```bash
203
+ npx @luizsantiago/spec-guardrails install
204
+ ```
205
+
206
+ | Version | What you gain |
207
+ | --- | --- |
208
+ | **3.1.x** | Copilot/Codex/AGENTS.md adapters; doctor Process + Brakes scores; unified execution contracts; `validate-traceability` / `validate-quick`; `classify-change` / `feature-status` |
209
+ | **3.0.x** | Final name Spec Guardrails; `.specs/guardrails/`; no dual-path ([Migration](docs/guide/Migration.md)) |
210
+ | **2.2.x** | Seatbelt-era paths & markers; `doctor` Execute hints; docs split from README |
211
+ | **2.1.x** | `loop-plan` + parallel `/loop` waves |
212
+ | **2.0.x** | Package rename → `@luizsantiago/spec-seatbelt` (superseded by 3.0) |
213
+ | **1.1.x** | `project-init` for brownfield repos |
214
+ | **0.9.x** | `archive-feature` + domain memory merge |
215
+
216
+ Full history: [CHANGELOG](docs/CHANGELOG.md) · [Releases](https://github.com/luizssantiago92/spec-guardrails/releases) · [Stability policy](docs/guide/Stability-policy.md)
217
+
218
+ Lineage: `agentic-harness` → `spec-seatbelt` → **`spec-guardrails` (final)**. Run `install` once after switching. See [Migration](docs/guide/Migration.md).
219
+
220
+ ---
221
+
222
+ ## Contributing
223
+
224
+ See [CONTRIBUTING.md](CONTRIBUTING.md) — tests, gate freeze policy, local `npm run guardrails -- install`.
225
+
226
+ ---
227
+
228
+ ## Credits
229
+
230
+ Spec Guardrails adapts open ideas; we did not invent spec-driven phases, loop design, or task-graph rules.
231
+
232
+ ### Core lineage
233
+
234
+ | Source | License | How we use it |
235
+ | --- | --- | --- |
236
+ | [tlc-spec-driven](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) | CC-BY-4.0 | Phase model, `.specs/` memory, gate lineage |
237
+ | [addyosmani/agent-skills](https://github.com/addyosmani/agent-skills) | MIT | Discuss patterns, definition-of-done |
238
+ | [graph-engineering](https://github.com/codejunkie99/graph-engineering) | MIT | Task-graph topology, stop rules, parallel merge |
239
+
240
+ ### Loop & ecosystem
241
+
242
+ | Source | License | How we use it |
243
+ | --- | --- | --- |
244
+ | [loop-engineering](https://github.com/cobusgreyling/loop-engineering) | MIT | Operational loop patterns; `doctor` score metaphor |
245
+ | [Addy Osmani — Loop engineering](https://addyosmani.com/blog/loop-engineering/) | — | Essay lineage |
246
+ | [awesome-harness-engineering](https://github.com/ai-boost/awesome-harness-engineering) | CC0 | Ecosystem taxonomy |
247
+
248
+ ### Adjacent (not vendored)
249
+
250
+ [DeepCode](https://github.com/HKUDS/DeepCode) · [RepoGraph](https://github.com/ozyyshr/RepoGraph)
251
+
252
+ Extended attribution: [docs/guide/credits.md](docs/guide/credits.md)
253
+
254
+ ## License
255
+
256
+ MIT