@luizsantiago/spec-guardrails 3.1.2 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,9 +3,13 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@luizsantiago/spec-guardrails.svg)](https://www.npmjs.com/package/@luizsantiago/spec-guardrails)
4
4
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
5
 
6
- **Guardrails for AI coding agents**agree on the goal in writing, break work into provable steps, run automatic checks before calling anything “done”, and verify with a fresh context that did not write the code.
6
+ **Keep AI coding agents honest specify the work, prove each step, verify independently.**
7
7
 
8
- **Token-efficient by design:** the agent loads **one phase guide per turn** (~9k est. tokens on Specify) instead of dumping the full skill library (~31k). Measured savings: **~72%** on planning, **~86%** on Execute vs a naive full reload ([details below](#token-cost)).
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. |
9
13
 
10
14
  npm: [`@luizsantiago/spec-guardrails`](https://www.npmjs.com/package/@luizsantiago/spec-guardrails) **3.1.x**
11
15
 
@@ -22,17 +26,19 @@ npx @luizsantiago/spec-guardrails install
22
26
  | Requirement | Role |
23
27
  | --- | --- |
24
28
  | **Node.js 18+** | Required — runs the CLI and `install` |
25
- | **Python 3.10+** | Recommendedruns automatic **gates** (`validate-spec`, `validate-tasks`, …). Without Python the agent still follows the same checklists manually |
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 |
26
30
 
27
31
  ### What install does
28
32
 
29
33
  | Lands in your project | Purpose |
30
34
  | --- | --- |
31
- | `.cursor/skills/` + `.claude/skills/` | Hub, phase references, sister skills |
32
- | `.specs/guardrails/scripts/` | Python gate scripts |
33
- | `.specs/STATE.md`, `.specs/features/`, … | Project memory |
35
+ | `.cursor/skills/` + `.claude/skills/` | Hub, phase references, sister skills (first shipped **adapters** — not the only supported agents) |
36
+ | `.specs/guardrails/scripts/` | Python gate scripts (Brakes mode) |
37
+ | `.specs/STATE.md`, `.specs/features/`, … | Project memory (any agent) |
34
38
  | `.cursor/rules/engineering-baseline.mdc` | Always-on Cursor rule |
35
39
 
40
+ **Agent environments:** the **core** (`.specs/`, CLI, hub, Python gates) works with any AI agent that reads repo instructions and runs shell commands. Install ships Cursor + Claude Code adapters today; Codex, GitHub Copilot, and others are documented in [Architecture](docs/guide/Architecture.md).
41
+
36
42
  Re-run `install` anytime to refresh skills; your `.specs/` decisions and `STATE.md` are kept.
37
43
 
38
44
  | Need | Command |
@@ -44,6 +50,59 @@ Re-run `install` anytime to refresh skills; your `.specs/` decisions and `STATE.
44
50
 
45
51
  ---
46
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** | Repo-local 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
+
47
106
  ## Token cost
48
107
 
49
108
  Progressive loading is the main cost win: **one working set per turn**, not the entire playbook.
@@ -62,24 +121,6 @@ More: [Token efficiency](docs/guide/Token-efficiency.md)
62
121
 
63
122
  ---
64
123
 
65
- ## How the pieces fit together
66
-
67
- Four ideas stack — full explanation: **[Concepts](docs/guide/concepts.md)**
68
-
69
- | Idea | What it is | What it does |
70
- | --- | --- | --- |
71
- | **Spec-driven** | Written plan before code | `spec.md` + `tasks.md`; evidence before “done” |
72
- | **Guardrails** | This package | Skills + Python gates that stop incomplete work |
73
- | **Loop** | Execute in waves | `loop-plan` picks the next jobs; sub-agents when files don’t overlap |
74
- | **Graph** | Parallel task map | `task-graph.md` — safe parallelism without file collisions |
75
- | **Memory** | Repo-local state | `.specs/` — specs, decisions, and handoff survive across chats |
76
-
77
- **You** approve specs and tasks. **The agent** runs gates and implements. **Gates** exit non-zero when paperwork or evidence is missing.
78
-
79
- Plain-language tour: [Home](docs/guide/Home.md) · [How it works](docs/guide/How-it-works.md) · [Quick start](docs/guide/Quick-start.md)
80
-
81
- ---
82
-
83
124
  ## Complexity tiers (how work flows)
84
125
 
85
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.
@@ -115,7 +156,7 @@ Full map: **[Skills and hub](docs/guide/skills-and-hub.md)**
115
156
 
116
157
  ## Gates (summary)
117
158
 
118
- Scripts in `.specs/guardrails/scripts/`. **Exit ≠ 0 → stop and fix.**
159
+ Commands implement the guarantees above. Scripts in `.specs/guardrails/scripts/`. **Exit ≠ 0 → stop and fix.**
119
160
 
120
161
  | When | Gate | What it blocks |
121
162
  | --- | --- | --- |
@@ -130,7 +171,7 @@ Scripts in `.specs/guardrails/scripts/`. **Exit ≠ 0 → stop and fix.**
130
171
  | After Verify FAIL | `lessons` | Ungrounded “lessons learned” |
131
172
  | After Verify PASS | `archive-feature` | (CLI) folds feature into domain memory |
132
173
 
133
- Full reference: **[Gates](docs/guide/gates.md)** · [Gates and guarantees](docs/guide/Gates-and-guarantees.md)
174
+ Full reference: **[Gates](docs/guide/gates.md)** · [Guarantees matrix](docs/guide/Guarantees-matrix.md) · [Gates and guarantees](docs/guide/Gates-and-guarantees.md)
134
175
 
135
176
  ---
136
177
 
@@ -138,12 +179,14 @@ Full reference: **[Gates](docs/guide/gates.md)** · [Gates and guarantees](docs/
138
179
 
139
180
  | Doc | For |
140
181
  | --- | --- |
182
+ | [Guarantees matrix](docs/guide/Guarantees-matrix.md) | Product promises → mechanisms |
183
+ | [Architecture](docs/guide/Architecture.md) | Core vs platform adapters |
141
184
  | [Agent commands](docs/guide/agent-commands.md) | Every `/specify`, `/loop`, `/verify`, … — purpose, when, examples |
142
185
  | [Quick start](docs/guide/Quick-start.md) | First ten minutes |
143
186
  | [Concepts](docs/guide/concepts.md) | Spec-driven + guardrails + loop + graph |
144
187
  | [Skills and hub](docs/guide/skills-and-hub.md) | What each skill file does |
145
188
  | [Gates](docs/guide/gates.md) | How each gate works |
146
- | [Platform parity](docs/guide/Platform-parity.md) | Cursor vs Claude Code |
189
+ | [Platform parity](docs/guide/Platform-parity.md) | Shipped adapters (Cursor, Claude Code) — core works with any agent |
147
190
  | [FAQ](docs/guide/FAQ.md) | Common questions |
148
191
  | [Changelog](docs/CHANGELOG.md) | Full version history |
149
192
 
package/lib/gates.js CHANGED
@@ -112,8 +112,8 @@ export async function runGuardrailsScript(command, args, options = {}) {
112
112
 
113
113
  if (!python) {
114
114
  throw new Error(
115
- "Python 3 not found. Install Python 3.10+ to run guardrails scripts, " +
116
- "or perform the equivalent checks manually (degraded mode).",
115
+ "Python 3 not found. Install Python 3.10+ for Brakes mode (automatic gates), " +
116
+ "or perform the equivalent checks manually in Process mode.",
117
117
  );
118
118
  }
119
119
 
package/lib/install.js CHANGED
@@ -129,8 +129,8 @@ export async function install(options = {}) {
129
129
  const pythonAvailable = await hasPython();
130
130
  if (!pythonAvailable) {
131
131
  log(
132
- "⚠️ Python 3 not found. Skills still work in degraded mode " +
133
- "(manual checks). Install Python 3.10+ to enable the gates.",
132
+ "⚠️ Python 3 not found Process mode only (flexible workflow, manual checkpoints). " +
133
+ "Install Python 3.10+ for Brakes mode (full kit with automatic gates).",
134
134
  );
135
135
  }
136
136
 
package/lib/next-steps.js CHANGED
@@ -12,9 +12,10 @@ export function formatInstallNextSteps(options = {}) {
12
12
  "✨ Setup complete.",
13
13
  "",
14
14
  "Next:",
15
- " 1. Open Cursor or Claude Code in this project.",
15
+ " 1. Open your AI coding agent in this project (Cursor and Claude Code adapters install automatically).",
16
16
  " 2. Run **Specify** (`/specify` or “Specify a feature: …”).",
17
17
  "",
18
+ " Other agents: core + CLI work anywhere — see docs/guide/Architecture.md",
18
19
  " Guide: docs/guide/Quick-start.md (repo) · .specs/GETTING_STARTED.md (this project)",
19
20
  ];
20
21
 
@@ -24,7 +25,8 @@ export function formatInstallNextSteps(options = {}) {
24
25
 
25
26
  if (options.pythonAvailable === false) {
26
27
  lines.push(
27
- " Note: install Python 3.10+ for automatic gates, or the agent checks by hand.",
28
+ " Note: install Python 3.10+ for Brakes mode (full kit with automatic gates), " +
29
+ "or stay in Process mode (same phases, manual checkpoints).",
28
30
  );
29
31
  }
30
32
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@luizsantiago/spec-guardrails",
3
- "version": "3.1.2",
4
- "description": "Guardrails for AI coding agents spec-driven phases, automatic gates, progressive skill loading (~70% fewer tokens per turn). Works in Cursor and Claude.",
3
+ "version": "3.1.4",
4
+ "description": "Spec-driven process kit for any repo-local AI agent: Process mode (Node) or full Brakes mode (Node + Python gates). Progressive loading, independent verify, Guarantees matrix.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "spec-guardrails": "./index.js"
@@ -190,10 +190,6 @@ Never skip to step 5 while steps 1–4 are available. Fabrication cascades throu
190
190
 
191
191
  Project rules: `.cursor/rules/engineering-baseline.mdc` (always applied in Cursor).
192
192
 
193
- ## Optional companion: Full Stack Floor Map
194
-
195
- When [`@luizsantiago/fullstack-floor-map`](https://www.npmjs.com/package/@luizsantiago/fullstack-floor-map) is installed, **Execute** may load one **Lane** layer manual and at most one catalog specialist per turn; **`/verify` stays Guardrails-only** (no Lane manuals, no catalog). Floor Map **0.5.0 (planned)** adds **Desk** memory under `.specs/desks/` for specialist continuity and handoff — companion-owned, not Guardrails gates. Pairing contract: [Companion: Full Stack Floor Map](https://github.com/luizssantiago92/spec-guardrails/blob/main/docs/guide/Companion-fullstack-floor-map.md).
196
-
197
193
  ## Commands
198
194
 
199
195
  | Command | Reference | Action |
@@ -27,7 +27,7 @@ Break the work into atomic tasks with real dependencies and binary done criteria
27
27
  ## Procedure
28
28
 
29
29
  1. **Write one task per deliverable.** A task is something you would hand to a single agent and check in one commit.
30
- 2. **Prefer vertical slices.** One thin verifiable path per **feature** (e.g. register), not “all schema then all APIs then all UI” as *phases*. If `.cursor/rules/fullstack-layer.mdc` is present (`@luizsantiago/fullstack-floor-map`), keep each task `Files` list on **one Lane** (path layer; 0.4.x docs may still say “Floor”). Split UI vs API into T1/T2 with `Depends on`. Vertical still means a thin *feature*, not one task mixing `apps/web` + `apps/api`. See [Companion: Full Stack Floor Map](https://github.com/luizssantiago92/spec-guardrails/blob/main/docs/guide/Companion-fullstack-floor-map.md).
30
+ 2. **Prefer vertical slices.** One thin verifiable path per **feature** (e.g. register), not “all schema then all APIs then all UI” as *phases*. Split UI vs API into separate tasks with `Depends on` when they must stay sequential. Vertical still means a thin *feature*, not one task that mixes unrelated areas without a dependency edge.
31
31
  3. **Give every task the full field set.** Authoring and the gate require all six:
32
32
  - `Requirement` — the spec ID it serves (gated)
33
33
  - `Files` — where the change lands (gated; required; `none` / `—` rejected; overlap across independent tasks blocks)
@@ -4,7 +4,7 @@ You installed the **Spec Guardrails**. You do **not** need to memorize CLI comma
4
4
 
5
5
  ## What to do now
6
6
 
7
- 1. Open **Cursor** or **Claude Code** in this project.
7
+ 1. Open your **AI coding agent** in this project (Cursor or Claude Code if you use those adapters).
8
8
  2. Start with **Specify** (an **agent command** — chat, not terminal):
9
9
 
10
10
  ```
@@ -20,7 +20,7 @@ You installed the **Spec Guardrails**. You do **not** need to memorize CLI comma
20
20
 
21
21
  ## Agent commands (chat — not terminal)
22
22
 
23
- Type these in **Cursor or Claude Code**. They load phase procedures from `.cursor/skills/references/`. The agent runs gates for you.
23
+ Type these in **chat** in your agent environment. They load phase procedures from the installed skills tree (e.g. `.cursor/skills/references/`). In **Brakes mode**, the agent runs Python gates for you.
24
24
 
25
25
  | Command | When |
26
26
  | --- | --- |