agent-guardrails 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +795 -335
- package/adapters/README.md +12 -6
- package/adapters/claude-code/README.md +61 -22
- package/adapters/codex/README.md +44 -25
- package/adapters/cursor/README.md +53 -22
- package/adapters/openclaw/OPENCLAW.md +2 -2
- package/adapters/openclaw/README.md +49 -27
- package/adapters/openhands/README.md +48 -23
- package/lib/automation/plan-defaults.js +85 -0
- package/lib/benchmark/runner.js +290 -272
- package/lib/check/detectors/oss.js +465 -374
- package/lib/cli.js +17 -1
- package/lib/commands/check.js +657 -506
- package/lib/commands/init.js +28 -17
- package/lib/commands/mcp.js +6 -0
- package/lib/commands/plan.js +146 -33
- package/lib/commands/setup.js +275 -0
- package/lib/i18n.js +666 -362
- package/lib/mcp/server.js +455 -0
- package/lib/runtime/agent-loop.js +245 -0
- package/lib/runtime/service.js +947 -0
- package/lib/setup/agents.js +116 -0
- package/lib/utils.js +5 -0
- package/package.json +57 -55
- package/templates/adapters/claude-code/CLAUDE.md +9 -4
- package/templates/adapters/cursor/agent-guardrails.mdc +7 -2
- package/templates/adapters/openclaw/OPENCLAW.md +9 -4
- package/templates/adapters/openhands/agent-guardrails.md +7 -2
- package/templates/base/AGENTS.md +8 -3
- package/templates/locales/zh-CN/adapters/claude-code/CLAUDE.md +1 -1
- package/templates/locales/zh-CN/adapters/cursor/agent-guardrails.mdc +1 -1
- package/templates/locales/zh-CN/adapters/openclaw/OPENCLAW.md +2 -2
- package/templates/locales/zh-CN/adapters/openhands/agent-guardrails.md +1 -1
- package/templates/locales/zh-CN/base/AGENTS.md +1 -1
- package/templates/presets/monorepo/config.json +20 -0
- package/templates/presets/nextjs/config.json +17 -0
- package/templates/presets/node-service/config.json +17 -0
- package/templates/presets/python-fastapi/config.json +17 -0
package/README.md
CHANGED
|
@@ -1,335 +1,795 @@
|
|
|
1
|
-
# Agent Guardrails
|
|
2
|
-
|
|
3
|
-
Ship AI-written code with production guardrails.
|
|
4
|
-
|
|
5
|
-
`agent-guardrails` is a
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
1. `
|
|
19
|
-
2. `
|
|
20
|
-
3.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- semantic
|
|
162
|
-
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
261
|
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
- the
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
##
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
1
|
+
# Agent Guardrails
|
|
2
|
+
|
|
3
|
+
Ship AI-written code with production guardrails.
|
|
4
|
+
|
|
5
|
+
`agent-guardrails` is a production-safety runtime for AI coding workflows. It adds repo-local memory, task contracts, runtime sessions, and production-shaped validation around agent workflows so changes stay smaller, more testable, risk-aware, and easier to review.
|
|
6
|
+
|
|
7
|
+
It is not trying to be another standalone coding agent or another PR review bot.
|
|
8
|
+
It is trying to be the repo-aware runtime that existing agent chats call before code is trusted and merged.
|
|
9
|
+
|
|
10
|
+
For real repos, not one-off prototypes.
|
|
11
|
+
|
|
12
|
+
## Start Here / 先看这里
|
|
13
|
+
|
|
14
|
+
**English**
|
|
15
|
+
|
|
16
|
+
If you are new, start with `setup`.
|
|
17
|
+
|
|
18
|
+
1. install `agent-guardrails`
|
|
19
|
+
2. run `agent-guardrails setup --agent claude-code` in your repo
|
|
20
|
+
3. connect your existing coding agent
|
|
21
|
+
4. describe the task in plain language
|
|
22
|
+
5. get a reviewer summary with scope, validation, and remaining risk
|
|
23
|
+
|
|
24
|
+
What you should expect:
|
|
25
|
+
|
|
26
|
+
- smaller changes
|
|
27
|
+
- clearer validation
|
|
28
|
+
- less scope drift
|
|
29
|
+
- a reviewer-friendly finish output
|
|
30
|
+
|
|
31
|
+
**中文**
|
|
32
|
+
|
|
33
|
+
如果你是第一次用,先从 `setup` 开始。
|
|
34
|
+
|
|
35
|
+
1. 安装 `agent-guardrails`
|
|
36
|
+
2. 在仓库里运行 `agent-guardrails setup --agent claude-code`
|
|
37
|
+
3. 把它接进你现有的 coding agent
|
|
38
|
+
4. 直接用自然语言说任务
|
|
39
|
+
5. 最后拿到 reviewer summary,看这次改了什么、有没有越界、还剩什么风险
|
|
40
|
+
|
|
41
|
+
你应该得到的是:
|
|
42
|
+
|
|
43
|
+
- 更小的改动范围
|
|
44
|
+
- 更清楚的验证结果
|
|
45
|
+
- 更少的越界和漂移
|
|
46
|
+
- 更容易 review 的收尾输出
|
|
47
|
+
|
|
48
|
+
Use website or code-generation tools to get something started.
|
|
49
|
+
Use `agent-guardrails` when the code lives in a real repo and needs to be trusted, reviewed, and maintained.
|
|
50
|
+
|
|
51
|
+
先用生成工具快速起一个 prototype、页面或 demo。
|
|
52
|
+
当代码进入真实仓库、需要 review、merge 和长期维护时,再用 `agent-guardrails`。
|
|
53
|
+
|
|
54
|
+
The CLI still matters, but it is the infrastructure and fallback layer, not the long-term main user entry.
|
|
55
|
+
|
|
56
|
+
If you want to see it working before using your own repo, run the demo first:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm run demo
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Who This Is For / 适合谁
|
|
63
|
+
|
|
64
|
+
- developers already using Claude Code, Cursor, Codex, OpenHands, or OpenClaw inside real repos
|
|
65
|
+
- teams and solo builders who have already been burned by scope drift, skipped validation, or AI-shaped maintenance debt
|
|
66
|
+
- users who want smaller AI changes, clearer validation, and reviewer-facing output before merge
|
|
67
|
+
|
|
68
|
+
- 已经在真实仓库里使用 Claude Code、Cursor、Codex、OpenHands 或 OpenClaw 的开发者
|
|
69
|
+
- 已经被越界改动、漏测试或维护漂移坑过的个人开发者和小团队
|
|
70
|
+
- 希望在 merge 前看到更小改动、更清楚验证结果和 reviewer 输出的人
|
|
71
|
+
|
|
72
|
+
## Who This Is Not For / 不适合谁
|
|
73
|
+
|
|
74
|
+
- people who only want a one-shot landing page, mockup, or prototype
|
|
75
|
+
- users who do not care about repo rules, review trust, or long-term maintenance
|
|
76
|
+
- teams looking for a generic static-analysis replacement
|
|
77
|
+
|
|
78
|
+
- 只想快速做一个 landing page、mockup 或 demo 的人
|
|
79
|
+
- 不在意仓库规则、review 信任和后续维护的人
|
|
80
|
+
- 想找一个通用静态分析替代品的团队
|
|
81
|
+
|
|
82
|
+
## Why This Is Different / 为什么它不是另一种生成工具
|
|
83
|
+
|
|
84
|
+
`agent-guardrails` is not trying to win on the first wow moment.
|
|
85
|
+
It is trying to make AI-written changes easier to trust after the first prompt.
|
|
86
|
+
|
|
87
|
+
- smaller AI changes
|
|
88
|
+
- clearer validation
|
|
89
|
+
- lower review anxiety
|
|
90
|
+
- lower maintenance drift
|
|
91
|
+
|
|
92
|
+
它不是靠“第一次生成多爽”取胜。
|
|
93
|
+
它要解决的是第一轮生成之后,代码还能不能继续信、继续 review、继续维护。
|
|
94
|
+
|
|
95
|
+
- 更小的 AI 改动
|
|
96
|
+
- 更清楚的验证结果
|
|
97
|
+
- 更低的 review 焦虑
|
|
98
|
+
- 更低的长期维护漂移
|
|
99
|
+
|
|
100
|
+
## Quick Start / 最短路径
|
|
101
|
+
|
|
102
|
+
Install once:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install -g agent-guardrails
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
In your repo, run:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
agent-guardrails setup --agent claude-code
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If your agent supports a clearly safe repo-local config path, use:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
agent-guardrails setup --agent claude-code --write-repo-config
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Then open your existing agent and start chatting.
|
|
121
|
+
|
|
122
|
+
如果你只知道一个大概方向,也可以直接这样说:
|
|
123
|
+
|
|
124
|
+
- `先帮我看看这个仓库最小能改哪里,尽量别扩大范围,最后告诉我还有什么风险。`
|
|
125
|
+
- `帮我修这个问题,先读仓库规则,小范围改动,跑完测试后给我 reviewer summary。`
|
|
126
|
+
- `I only have a rough idea. Please read the repo rules, find the smallest safe change, and finish with a reviewer summary.`
|
|
127
|
+
|
|
128
|
+
Proof in one page:
|
|
129
|
+
|
|
130
|
+
- [What this catches that normal AI coding workflows miss](./docs/PROOF.md)
|
|
131
|
+
- [Python/FastAPI baseline proof demo](./examples/python-fastapi-demo/README.md)
|
|
132
|
+
|
|
133
|
+
## Current Language Support / 当前语言支持
|
|
134
|
+
|
|
135
|
+
**English**
|
|
136
|
+
|
|
137
|
+
- **Deepest support today:** JavaScript / TypeScript
|
|
138
|
+
- **Baseline runtime support today:** Next.js, Python/FastAPI, monorepos
|
|
139
|
+
- **Actively expanding:** deeper Python semantic support and broader framework-aware analysis
|
|
140
|
+
|
|
141
|
+
This means the runtime, setup-first flow, contracts, evidence, and reviewer summary already work outside plain JS/TS repos, but the strongest semantic depth today is still in the TS/JS path.
|
|
142
|
+
|
|
143
|
+
**中文**
|
|
144
|
+
|
|
145
|
+
- **当前最深支持:** JavaScript / TypeScript
|
|
146
|
+
- **当前基础运行时支持:** Next.js、Python/FastAPI、monorepo
|
|
147
|
+
- **正在继续补强:** Python 更深的语义能力,以及更广的框架级分析
|
|
148
|
+
|
|
149
|
+
这意味着现在的 setup、contract、evidence、reviewer summary 已经不只适用于 JS/TS,但真正最强的语义深度仍然在 TS/JS 这条线上。
|
|
150
|
+
|
|
151
|
+
## Current Language Support / 当前语言支持
|
|
152
|
+
|
|
153
|
+
**Today / 当前**
|
|
154
|
+
|
|
155
|
+
- **Deepest support:** JavaScript / TypeScript
|
|
156
|
+
- **Baseline runtime support:** Next.js, Python/FastAPI, monorepos
|
|
157
|
+
- **Still expanding:** deeper Python semantic support and broader framework-aware analysis
|
|
158
|
+
|
|
159
|
+
**What that means / 这代表什么**
|
|
160
|
+
|
|
161
|
+
- JavaScript / TypeScript currently has the strongest semantic proof points through the public `plugin-ts` path and the shipped demos
|
|
162
|
+
- Python works today through the same setup, contract, evidence, and review loop, but it does not yet have semantic-depth parity with TypeScript / JavaScript
|
|
163
|
+
- Monorepo support is a repo shape, not a separate language claim
|
|
164
|
+
|
|
165
|
+
- JavaScript / TypeScript 目前有最强的语义 proof 和 demo 支撑
|
|
166
|
+
- Python 现在已经能走 setup、contract、evidence、review 这一整条 baseline 流程,但还没有达到 TS/JS 的语义深度
|
|
167
|
+
- monorepo 是仓库形态支持,不是一门单独语言
|
|
168
|
+
|
|
169
|
+
Language expansion is now an active product priority, with Python as the next language to deepen.
|
|
170
|
+
|
|
171
|
+
语言支持扩展现在已经是正式产品优先项,下一门重点加深的语言是 Python。
|
|
172
|
+
|
|
173
|
+
If you want the first Python/FastAPI proof path, use the sandbox in [examples/python-fastapi-demo](./examples/python-fastapi-demo). It proves the baseline runtime, deploy-readiness, and post-deploy maintenance surface in a Python repo without claiming semantic-depth parity with TS/JS.
|
|
174
|
+
|
|
175
|
+
如果你想看第一条 Python/FastAPI proof 路径,可以直接跑 [examples/python-fastapi-demo](./examples/python-fastapi-demo)。这条路径证明的是 Python 仓库里的 baseline runtime、deploy-readiness 和 post-deploy maintenance,而不是宣称它已经达到 TS/JS 的语义深度。
|
|
176
|
+
|
|
177
|
+
## What This Catches / 这能多抓住什么
|
|
178
|
+
|
|
179
|
+
- bounded-scope failure versus bounded-scope pass
|
|
180
|
+
- semantic drift catches beyond the basic OSS baseline
|
|
181
|
+
- reviewer summaries that explain changed files, validation, and remaining risk
|
|
182
|
+
|
|
183
|
+
- bounded-scope 的失败与修复对比
|
|
184
|
+
- 超过基础 OSS baseline 的语义漂移捕捉
|
|
185
|
+
- 能告诉你改了什么、做了哪些验证、还剩什么风险的 reviewer summary
|
|
186
|
+
|
|
187
|
+
See the full proof in [docs/PROOF.md](./docs/PROOF.md).
|
|
188
|
+
|
|
189
|
+
## Why this exists
|
|
190
|
+
|
|
191
|
+
Coding agents usually fail in predictable ways:
|
|
192
|
+
|
|
193
|
+
- they invent abstractions that do not match the repo
|
|
194
|
+
- they change too many files at once
|
|
195
|
+
- they skip tests when behavior changes
|
|
196
|
+
- they ignore project-specific rules unless those rules are explicit and easy to load
|
|
197
|
+
|
|
198
|
+
`agent-guardrails` gives repos a runtime-backed workflow:
|
|
199
|
+
|
|
200
|
+
1. `init` seeds repo-local instructions and templates
|
|
201
|
+
2. `plan` writes a bounded task contract
|
|
202
|
+
3. `check` validates scope, consistency, correctness, and review or risk signals
|
|
203
|
+
|
|
204
|
+
The product is most valuable when you want three things at once:
|
|
205
|
+
|
|
206
|
+
- smaller AI-generated changes
|
|
207
|
+
- clearer merge and review signals
|
|
208
|
+
- lower maintenance cost over time
|
|
209
|
+
|
|
210
|
+
The moat is not prompt wording or a chat wrapper.
|
|
211
|
+
The moat is the combination of repo-local contracts, runtime judgment, semantic checks, review structure, workflow integration, and maintenance continuity that compounds with continued use in the same repo.
|
|
212
|
+
|
|
213
|
+
## Setup-First Quick Start
|
|
214
|
+
|
|
215
|
+
If you want the intended product entry, install the package and let `setup` prepare the repo plus the agent config you need:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npm install -g agent-guardrails
|
|
219
|
+
npx agent-guardrails setup --agent claude-code
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
If you want the shortest install path, use:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
npm install -g agent-guardrails
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
If your shell does not pick up the global binary right away, skip PATH troubleshooting and run:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npx agent-guardrails ...
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The runtime is tested in CI on Windows, Linux, and macOS, and the README examples stay shell-neutral unless a platform-specific workaround is required.
|
|
235
|
+
|
|
236
|
+
`setup` now does the first-run work that heavy vibe-coding users usually do not want to do by hand:
|
|
237
|
+
|
|
238
|
+
- auto-initializes the repo if `.agent-guardrails/config.json` is missing
|
|
239
|
+
- defaults to the `node-service` preset unless you override it with `--preset`
|
|
240
|
+
- writes safe repo-local helper files such as `CLAUDE.md`, `.cursor/rules/agent-guardrails.mdc`, `.agents/skills/agent-guardrails.md`, or `OPENCLAW.md` when the chosen agent needs them
|
|
241
|
+
- prints the agent config snippet and tells you exactly where to put it
|
|
242
|
+
- gives you one first chat message and one canonical MCP loop
|
|
243
|
+
|
|
244
|
+
Example:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
npx agent-guardrails setup --agent claude-code
|
|
248
|
+
npx agent-guardrails setup --agent cursor --preset nextjs
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
If the agent uses a clearly safe repo-local MCP config file, you can remove even the paste step:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
npx agent-guardrails setup --agent claude-code --write-repo-config
|
|
255
|
+
npx agent-guardrails setup --agent cursor --write-repo-config
|
|
256
|
+
npx agent-guardrails setup --agent openhands --write-repo-config
|
|
257
|
+
npx agent-guardrails setup --agent openclaw --write-repo-config
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Today that safe repo-local write path is intended for:
|
|
261
|
+
|
|
262
|
+
- `claude-code` via `.mcp.json`
|
|
263
|
+
- `cursor` via `.cursor/mcp.json`
|
|
264
|
+
- `openhands` via `.openhands/mcp.json`
|
|
265
|
+
- `openclaw` via `.openclaw/mcp.json`
|
|
266
|
+
|
|
267
|
+
If you want the current most opinionated happy path, use Claude Code first.
|
|
268
|
+
For broader pilot coverage, validate the same setup-first path across:
|
|
269
|
+
|
|
270
|
+
- `claude-code` as the primary path
|
|
271
|
+
- `cursor` and `codex` as secondary paths
|
|
272
|
+
- `openhands` and `openclaw` as supplementary paths
|
|
273
|
+
|
|
274
|
+
Once you connect the generated config to your agent, the happy path should feel like normal chat:
|
|
275
|
+
|
|
276
|
+
- You: `Add refund status transitions to the order service.`
|
|
277
|
+
- Agent: bootstraps the task contract through `start_agent_native_loop`
|
|
278
|
+
- Agent: makes the change, runs required commands, updates evidence
|
|
279
|
+
- Agent: finishes through `finish_agent_native_loop` and returns a reviewer-friendly summary with scope, risk, and future maintenance guidance
|
|
280
|
+
|
|
281
|
+
If you do not know how to phrase the task yet, you can still start in plain Chinese or plain English:
|
|
282
|
+
|
|
283
|
+
- `先帮我看看这个仓库最小能改哪里,尽量别扩大范围,最后告诉我还有什么风险。`
|
|
284
|
+
- `帮我修这个问题,先读仓库规则,小范围改动,跑完测试后给我 reviewer summary。`
|
|
285
|
+
- `I only have a rough idea. Please read the repo rules, find the smallest safe change, and finish with a reviewer summary.`
|
|
286
|
+
|
|
287
|
+
The first recommended MCP flow is:
|
|
288
|
+
|
|
289
|
+
1. `read_repo_guardrails`
|
|
290
|
+
2. `start_agent_native_loop`
|
|
291
|
+
3. work inside the declared scope
|
|
292
|
+
4. `finish_agent_native_loop`
|
|
293
|
+
|
|
294
|
+
`suggest_task_contract` and `run_guardrail_check` still exist as lower-level MCP tools, but they are not the preferred first-run chat flow.
|
|
295
|
+
|
|
296
|
+
## CLI Fallback Quick Start
|
|
297
|
+
|
|
298
|
+
If you want the shortest manual path, copy this:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npx agent-guardrails setup --agent codex
|
|
302
|
+
npx agent-guardrails plan --task "Add refund status transitions to the order service"
|
|
303
|
+
npm test
|
|
304
|
+
npx agent-guardrails check --commands-run "npm test" --review
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
By default, `setup` handles repo initialization and MCP guidance for you, and `plan` still fills in the preset's common allowed paths, required commands, and evidence path. Add extra flags only when you need a tighter contract.
|
|
308
|
+
|
|
309
|
+
You do not need to hand-write the contract for a normal task. Start with plain task text, let `plan` bootstrap the session, then let `check` tell you the finish-time command and next steps.
|
|
310
|
+
|
|
311
|
+
The CLI currently supports `en` and `zh-CN`. You can switch with `--lang zh-CN` or `AGENT_GUARDRAILS_LOCALE=zh-CN`.
|
|
312
|
+
|
|
313
|
+
What each step means:
|
|
314
|
+
|
|
315
|
+
- `init` writes the guardrail files into your repo.
|
|
316
|
+
- `plan` creates a task contract for the specific change you want to make.
|
|
317
|
+
- `check` compares the real change against that contract and your repo rules.
|
|
318
|
+
|
|
319
|
+
If you are unsure which preset to choose:
|
|
320
|
+
|
|
321
|
+
- `node-service` for backend APIs and services
|
|
322
|
+
- `nextjs` for Next.js apps
|
|
323
|
+
- `python-fastapi` for Python APIs
|
|
324
|
+
- `monorepo` for multi-package repos
|
|
325
|
+
|
|
326
|
+
If you are not sure about file paths, prefer the MCP flow first. The runtime can infer a sensible starting contract before you tighten anything manually.
|
|
327
|
+
|
|
328
|
+
## External Pilot Paths
|
|
329
|
+
|
|
330
|
+
Use the same setup-first loop for all five current agent entries:
|
|
331
|
+
|
|
332
|
+
- `claude-code`
|
|
333
|
+
- `cursor`
|
|
334
|
+
- `codex`
|
|
335
|
+
- `openhands`
|
|
336
|
+
- `openclaw`
|
|
337
|
+
|
|
338
|
+
Current pilot priority is:
|
|
339
|
+
|
|
340
|
+
1. `claude-code`
|
|
341
|
+
2. `cursor`
|
|
342
|
+
3. `codex`
|
|
343
|
+
4. `openhands`
|
|
344
|
+
5. `openclaw`
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
中文说明:
|
|
348
|
+
|
|
349
|
+
如果你要开始第一条真实 pilot,建议先用 `claude-code`。
|
|
350
|
+
这条路径最容易把 setup、MCP 粘贴、第一次聊天和 reviewer summary 这一整条链路跑通。
|
|
351
|
+
|
|
352
|
+
每条 pilot 只看这几个问题:
|
|
353
|
+
|
|
354
|
+
- 是否能从安装直接走到第一次聊天
|
|
355
|
+
- setup 输出是否清楚
|
|
356
|
+
- MCP 配置是否仍然是最大摩擦
|
|
357
|
+
- reviewer summary 是否值得信任
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
For each pilot:
|
|
361
|
+
|
|
362
|
+
1. run `npx agent-guardrails setup --agent <name>`
|
|
363
|
+
2. paste the generated snippet into that agent's MCP config
|
|
364
|
+
3. send the generated first chat message
|
|
365
|
+
4. confirm the agent uses:
|
|
366
|
+
- `read_repo_guardrails`
|
|
367
|
+
- `start_agent_native_loop`
|
|
368
|
+
- `finish_agent_native_loop`
|
|
369
|
+
|
|
370
|
+
Use the matching pilot record in [docs/pilots/](./docs/pilots/README.md) for each individual run:
|
|
371
|
+
|
|
372
|
+
- [Claude Code pilot](./docs/pilots/claude-code.md)
|
|
373
|
+
- [Cursor pilot](./docs/pilots/cursor.md)
|
|
374
|
+
- [Codex pilot](./docs/pilots/codex.md)
|
|
375
|
+
- [OpenHands pilot](./docs/pilots/openhands.md)
|
|
376
|
+
- [OpenClaw pilot](./docs/pilots/openclaw.md)
|
|
377
|
+
|
|
378
|
+
If you need reusable blank templates instead of the ready-made files above, keep using [docs/PILOT_TEMPLATE.md](./docs/PILOT_TEMPLATE.md) and [docs/PILOT_SUMMARY_TEMPLATE.md](./docs/PILOT_SUMMARY_TEMPLATE.md).
|
|
379
|
+
|
|
380
|
+
After all five pilot runs are complete, roll the results up into [docs/pilots/SUMMARY.md](./docs/pilots/SUMMARY.md) so the next decision is based on one cross-entry view instead of scattered notes.
|
|
381
|
+
|
|
382
|
+
## What This Proves
|
|
383
|
+
|
|
384
|
+
The flagship examples are:
|
|
385
|
+
|
|
386
|
+
- the bounded-scope demo in [examples/bounded-scope-demo](./examples/bounded-scope-demo)
|
|
387
|
+
- the first semantic pattern-drift demo in [examples/pattern-drift-demo](./examples/pattern-drift-demo)
|
|
388
|
+
- the interface-drift demo in [examples/interface-drift-demo](./examples/interface-drift-demo)
|
|
389
|
+
- the boundary-violation demo in [examples/boundary-violation-demo](./examples/boundary-violation-demo)
|
|
390
|
+
- the source-test-relevance demo in [examples/source-test-relevance-demo](./examples/source-test-relevance-demo)
|
|
391
|
+
- the unified proof page in [docs/PROOF.md](./docs/PROOF.md)
|
|
392
|
+
- the pilot write-up in [docs/REAL_REPO_PILOT.md](./docs/REAL_REPO_PILOT.md)
|
|
393
|
+
|
|
394
|
+
Together they show:
|
|
395
|
+
|
|
396
|
+
- a narrow task contract can block out-of-scope changes before merge
|
|
397
|
+
- required commands and evidence notes are part of the merge gate, not optional ceremony
|
|
398
|
+
- the OSS baseline can stay green while a semantic pack adds a higher-signal consistency warning
|
|
399
|
+
- the semantic layer can also block implementation-only work when it silently changes the public surface
|
|
400
|
+
- the semantic layer can block a controller that crosses a declared module boundary even when the task contract still looks narrow
|
|
401
|
+
- the semantic layer can tell the difference between "a test changed" and "the right test changed"
|
|
402
|
+
- the same public CLI can surface deeper enforcement without splitting into a second product
|
|
403
|
+
- the same OSS runtime can produce deploy-readiness and post-deploy maintenance output in a Python/FastAPI repo before any Python semantic pack ships
|
|
404
|
+
|
|
405
|
+
Run it with:
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
node ./examples/bounded-scope-demo/scripts/run-demo.mjs all
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Then run the Python/FastAPI baseline proof demo:
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
npm run demo:python-fastapi
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Then run the OSS benchmark suite:
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
npm run benchmark
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
And run the first semantic proof demo:
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
npm run demo:pattern-drift
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Then run the interface drift proof demo:
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
npm run demo:interface-drift
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Then run the boundary and source-to-test proof demos:
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
npm run demo:boundary-violation
|
|
439
|
+
npm run demo:source-test-relevance
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Manual CLI Workflow
|
|
443
|
+
|
|
444
|
+
Use this docs-first loop in day-to-day work. Copy it, then replace only the task text and file paths:
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
agent-guardrails plan --task "Add audit logging to the release approval endpoint" --required-commands "npm test,npm run lint"
|
|
448
|
+
npm test
|
|
449
|
+
npm run lint
|
|
450
|
+
agent-guardrails check --commands-run "npm test,npm run lint" --review
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Add `--intended-files`, `--allowed-change-types`, or narrower `--allow-paths` only when you want a tighter task contract than the preset default.
|
|
454
|
+
|
|
455
|
+
The intended low-friction flow is:
|
|
456
|
+
|
|
457
|
+
1. describe the task in plain language with `plan`
|
|
458
|
+
2. make the smallest change that fits the generated contract
|
|
459
|
+
3. run the commands you actually used
|
|
460
|
+
4. finish with the `check` command the runtime recommends
|
|
461
|
+
|
|
462
|
+
If your repo does not have `origin/main`, use the branch that matches your default branch.
|
|
463
|
+
|
|
464
|
+
Keep a short evidence note at `.agent-guardrails/evidence/current-task.md` with:
|
|
465
|
+
|
|
466
|
+
- task name
|
|
467
|
+
- commands run
|
|
468
|
+
- notable results
|
|
469
|
+
- residual risk or `none`
|
|
470
|
+
|
|
471
|
+
Example:
|
|
472
|
+
|
|
473
|
+
```md
|
|
474
|
+
# Task Evidence
|
|
475
|
+
|
|
476
|
+
- Task: Add audit logging to the release approval endpoint
|
|
477
|
+
- Commands run: npm test, npm run lint
|
|
478
|
+
- Notable results: Tests and lint passed after updating the approval endpoint and audit assertions.
|
|
479
|
+
- Residual risk: none
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
## CI and Automation Workflow
|
|
483
|
+
|
|
484
|
+
For CI, hooks, or orchestrated agent runs, prefer machine-readable output:
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
agent-guardrails check --base-ref origin/main --json
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
If the workflow wants parity with locally reported commands, set:
|
|
491
|
+
|
|
492
|
+
```text
|
|
493
|
+
AGENT_GUARDRAILS_COMMANDS_RUN=npm test,npm run lint
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
The generated user-repo workflow template lives in [templates/base/workflows/agent-guardrails.yml](./templates/base/workflows/agent-guardrails.yml).
|
|
497
|
+
The maintainer CI for this package lives in [guardrails.yml](./.github/workflows/guardrails.yml).
|
|
498
|
+
|
|
499
|
+
For agent integrations, the recommended entry is the OSS MCP server:
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
agent-guardrails mcp
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
The MCP layer exposes the same runtime-backed judgment through these tools:
|
|
506
|
+
|
|
507
|
+
- `read_repo_guardrails`
|
|
508
|
+
- `suggest_task_contract`
|
|
509
|
+
- `start_agent_native_loop`
|
|
510
|
+
- `finish_agent_native_loop`
|
|
511
|
+
- `run_guardrail_check`
|
|
512
|
+
- `summarize_review_risks`
|
|
513
|
+
|
|
514
|
+
The loop tools are the recommended OSS agent-native slice:
|
|
515
|
+
|
|
516
|
+
- `start_agent_native_loop` bootstraps a runtime-backed contract, writes it to the repo, and seeds the evidence note
|
|
517
|
+
- `finish_agent_native_loop` updates evidence, runs `check`, and returns a reviewer-friendly summary from the same judgment path
|
|
518
|
+
|
|
519
|
+
That reviewer-facing result now also carries continuity guidance from the same OSS runtime:
|
|
520
|
+
|
|
521
|
+
- reuse targets to extend first
|
|
522
|
+
- new surface files that broaden the maintenance surface
|
|
523
|
+
- continuity breaks that look like parallel abstractions or structure drift
|
|
524
|
+
- future maintenance risks and continuity-specific next actions
|
|
525
|
+
|
|
526
|
+
## Production Baseline
|
|
527
|
+
|
|
528
|
+
The current product direction is a generic, repo-local production baseline for AI-written code:
|
|
529
|
+
|
|
530
|
+
- the runtime shapes the task before implementation with bounded paths, intended files, change-type intent, and risk metadata
|
|
531
|
+
- `check` enforces small-scope, test-aware, evidence-backed, reviewable changes
|
|
532
|
+
- `check --review` turns the same findings into a concise reviewer-oriented report
|
|
533
|
+
- MCP and agent-native loop consumers reuse the same judgment path instead of re-implementing prompts
|
|
534
|
+
- the next production layer is deploy-readiness judgment plus post-deploy maintenance surface, not a separate deployment product
|
|
535
|
+
|
|
536
|
+
This is intentionally generic-first. It relies on file-shape heuristics, repo policy, task contracts, and command/evidence enforcement rather than framework-specific AST logic.
|
|
537
|
+
|
|
538
|
+
## Open Source vs Pro
|
|
539
|
+
|
|
540
|
+
### Today
|
|
541
|
+
|
|
542
|
+
The open-source core is already the product:
|
|
543
|
+
|
|
544
|
+
- repo-local production baseline
|
|
545
|
+
- smaller, more reviewable AI changes
|
|
546
|
+
- stronger validation and risk visibility before merge
|
|
547
|
+
- public benchmarks and cross-platform CI proof
|
|
548
|
+
- active semantic examples for pattern drift, interface drift, boundary violation, and source-to-test relevance
|
|
549
|
+
- a baseline repo-local workflow that can already act as a real merge gate
|
|
550
|
+
|
|
551
|
+
### Next
|
|
552
|
+
|
|
553
|
+
The next technical step is conversation-first onboarding and stronger runtime-backed enforcement through the same MCP and CLI surface:
|
|
554
|
+
|
|
555
|
+
- detector pipeline foundation
|
|
556
|
+
- benchmarked semantic examples
|
|
557
|
+
- a first TypeScript or JavaScript semantic pack under `plugins/plugin-ts/`
|
|
558
|
+
- first active semantic proofs for pattern drift, interface drift, boundary violation, and source-to-test relevance
|
|
559
|
+
- semantic analyzers for TypeScript or JavaScript first, Python second
|
|
560
|
+
- MCP-first onboarding and chat-oriented adoption
|
|
561
|
+
- broader real-repo pilots beyond the documented pilot
|
|
562
|
+
|
|
563
|
+
### Paid
|
|
564
|
+
|
|
565
|
+
Paid tiers should extend the baseline rather than replace it:
|
|
566
|
+
|
|
567
|
+
- `Pro Local`: semantic packs, auto task generation, richer local review, maintenance-aware workflows, and lower-touch deployment orchestration
|
|
568
|
+
- `Pro Cloud`: hosted review, shared policies, trend dashboards, deployment governance, and centralized orchestration
|
|
569
|
+
|
|
570
|
+
Baseline merge-gate features stay open source.
|
|
571
|
+
|
|
572
|
+
That means the OSS core should keep owning the production-readiness gate:
|
|
573
|
+
|
|
574
|
+
- trust verdicts
|
|
575
|
+
- recovery / secrets-safe / cost-aware guidance
|
|
576
|
+
- deploy-readiness judgment
|
|
577
|
+
- release and deploy checklist visibility
|
|
578
|
+
- post-deploy maintenance summaries
|
|
579
|
+
|
|
580
|
+
Deployment orchestration itself remains a later automation layer on top of the same runtime, not a second product that bypasses it.
|
|
581
|
+
|
|
582
|
+
The first semantic pack lives publicly in this repo today as an early semantic milestone. It is positioned as the future `Pro Local` direction, not as a separate closed-source runtime.
|
|
583
|
+
|
|
584
|
+
## Supported Agents
|
|
585
|
+
|
|
586
|
+
| Tool | Seeded file | Local workflow support | Automation guidance support |
|
|
587
|
+
| :-- | :-- | :-- | :-- |
|
|
588
|
+
| Codex | `AGENTS.md` | Yes | Yes |
|
|
589
|
+
| Claude Code | `CLAUDE.md` | Yes | Yes |
|
|
590
|
+
| Cursor | `.cursor/rules/agent-guardrails.mdc` | Yes | Yes |
|
|
591
|
+
| OpenHands | `.agents/skills/agent-guardrails.md` | Yes | Yes |
|
|
592
|
+
| OpenClaw | `OPENCLAW.md` | Yes | Yes |
|
|
593
|
+
|
|
594
|
+
## CLI Commands
|
|
595
|
+
|
|
596
|
+
### `init`
|
|
597
|
+
|
|
598
|
+
Seeds a repo with:
|
|
599
|
+
|
|
600
|
+
- `AGENTS.md`
|
|
601
|
+
- `docs/PROJECT_STATE.md`
|
|
602
|
+
- `docs/PR_CHECKLIST.md`
|
|
603
|
+
- `.agent-guardrails/config.json`
|
|
604
|
+
- `.agent-guardrails/tasks/TASK_TEMPLATE.md`
|
|
605
|
+
- `.github/workflows/agent-guardrails.yml`
|
|
606
|
+
|
|
607
|
+
Example:
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
agent-guardrails init . --preset nextjs --adapter openclaw
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
If you are not sure what to type, start with `setup --agent <name>`, then use the manual flow only when you want to debug or inspect the runtime directly.
|
|
614
|
+
|
|
615
|
+
### `setup`
|
|
616
|
+
|
|
617
|
+
Auto-initializes the repo when needed, generates the MCP config snippet for a supported agent, and tells you exactly how to start chatting.
|
|
618
|
+
|
|
619
|
+
Example:
|
|
620
|
+
|
|
621
|
+
```bash
|
|
622
|
+
agent-guardrails setup --agent cursor
|
|
623
|
+
agent-guardrails setup --agent claude-code --preset nextjs
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
The happy path is:
|
|
627
|
+
|
|
628
|
+
1. run `setup`
|
|
629
|
+
2. paste the snippet into your agent
|
|
630
|
+
3. ask for the task in chat
|
|
631
|
+
4. let the runtime use `read_repo_guardrails`, `start_agent_native_loop`, and `finish_agent_native_loop`
|
|
632
|
+
|
|
633
|
+
### `plan`
|
|
634
|
+
|
|
635
|
+
Prints a bounded implementation brief and writes a task contract by default.
|
|
636
|
+
|
|
637
|
+
Example:
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
agent-guardrails plan --task "Add audit logging to the release approval endpoint" --allow-paths "src/,tests/" --intended-files "src/release/approve.js,tests/release/approve.test.js" --allowed-change-types "implementation-only" --risk-level medium --required-commands "npm test,npm run lint" --evidence ".agent-guardrails/evidence/current-task.md"
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### `check`
|
|
644
|
+
|
|
645
|
+
Runs baseline guardrail checks against the current repo and git working tree.
|
|
646
|
+
|
|
647
|
+
Example:
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
agent-guardrails check --base-ref origin/main --commands-run "npm test,npm run lint" --review
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
For JSON output:
|
|
654
|
+
|
|
655
|
+
```bash
|
|
656
|
+
agent-guardrails check --base-ref origin/main --json
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
Minimal contract example:
|
|
660
|
+
|
|
661
|
+
```json
|
|
662
|
+
{
|
|
663
|
+
"schemaVersion": 3,
|
|
664
|
+
"task": "Add audit logging to the release approval endpoint",
|
|
665
|
+
"preset": "node-service",
|
|
666
|
+
"allowedPaths": ["src/", "tests/"],
|
|
667
|
+
"intendedFiles": ["src/release/approve.js", "tests/release/approve.test.js"],
|
|
668
|
+
"allowedChangeTypes": ["implementation-only"],
|
|
669
|
+
"riskLevel": "medium",
|
|
670
|
+
"requiredCommands": ["npm test", "npm run lint"],
|
|
671
|
+
"evidencePaths": [".agent-guardrails/evidence/current-task.md"]
|
|
672
|
+
}
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
## Presets
|
|
676
|
+
|
|
677
|
+
- `node-service`
|
|
678
|
+
- `nextjs`
|
|
679
|
+
- `python-fastapi`
|
|
680
|
+
- `monorepo`
|
|
681
|
+
|
|
682
|
+
Each preset adjusts file heuristics and recommended read-before-write paths while keeping the same mental model.
|
|
683
|
+
|
|
684
|
+
## Adapters
|
|
685
|
+
|
|
686
|
+
The core workflow is generic, but `agent-guardrails` ships first-pass adapters for:
|
|
687
|
+
|
|
688
|
+
- [Codex](./adapters/codex/README.md)
|
|
689
|
+
- [Claude Code](./adapters/claude-code/README.md)
|
|
690
|
+
- [Cursor](./adapters/cursor/README.md)
|
|
691
|
+
- [OpenHands](./adapters/openhands/README.md)
|
|
692
|
+
- [OpenClaw](./adapters/openclaw/README.md)
|
|
693
|
+
|
|
694
|
+
For Codex, the default `AGENTS.md` workflow is already the main integration surface, so `--adapter codex` is a docs-level adapter rather than an extra seeded file.
|
|
695
|
+
|
|
696
|
+
## FAQ
|
|
697
|
+
|
|
698
|
+
### Do I need all adapters?
|
|
699
|
+
|
|
700
|
+
No. Use only the adapter that matches your coding tool. The core workflow still works without tool-specific seed files.
|
|
701
|
+
|
|
702
|
+
### Do I need evidence files?
|
|
703
|
+
|
|
704
|
+
Only when the task contract declares them. In the default docs-first workflow, the evidence note is intentionally lightweight and meant to record what actually happened.
|
|
705
|
+
|
|
706
|
+
### When should I use `--json`?
|
|
707
|
+
|
|
708
|
+
Use `--json` for CI, hooks, or automation that needs machine-readable results. For normal local work, the human-readable output is the intended default.
|
|
709
|
+
|
|
710
|
+
### Does this work on Windows, Linux, and macOS?
|
|
711
|
+
|
|
712
|
+
Yes. The published CLI is exercised in CI on all three platforms, and the primary install and workflow commands are platform-neutral:
|
|
713
|
+
|
|
714
|
+
- `npm install -g agent-guardrails`
|
|
715
|
+
- `npx agent-guardrails init . --preset node-service`
|
|
716
|
+
- `npx agent-guardrails plan --task "..."`
|
|
717
|
+
- `npx agent-guardrails check --review`
|
|
718
|
+
|
|
719
|
+
Platform-specific commands only appear in docs when a shell-specific workaround is required.
|
|
720
|
+
|
|
721
|
+
### Why not just use another AI to recreate this?
|
|
722
|
+
|
|
723
|
+
You can copy prompts and a chat wrapper.
|
|
724
|
+
The harder part is copying a repo-aware runtime that keeps state across task bootstrap, validation, review, semantic drift checks, continuity guidance, and workflow integration.
|
|
725
|
+
|
|
726
|
+
The value of `agent-guardrails` is not "one clever prompt."
|
|
727
|
+
It is the merge-gate system that existing agent chats call while the runtime keeps getting more aligned to the repo over time.
|
|
728
|
+
|
|
729
|
+
### What if the global `agent-guardrails` command is not found?
|
|
730
|
+
|
|
731
|
+
Use `npx agent-guardrails ...` first. That works across shells and avoids PATH differences between Windows, macOS, and Linux.
|
|
732
|
+
|
|
733
|
+
## Current Limits
|
|
734
|
+
|
|
735
|
+
This project is useful today as a repo-local guardrail layer, but it still has important limits:
|
|
736
|
+
|
|
737
|
+
- the heuristics are still intentionally lightweight and may need tuning for larger repos
|
|
738
|
+
- the semantic detectors are still string- and path-driven, not full AST or type-graph analyzers
|
|
739
|
+
- module boundaries still depend on explicit repo policy instead of automatic architecture inference
|
|
740
|
+
- source-to-test relevance is heuristic and should be treated as reviewer guidance plus contract enforcement, not coverage proof
|
|
741
|
+
- CI users still need to choose their canonical base ref, such as `origin/main`
|
|
742
|
+
- the current pilot is documented in [docs/REAL_REPO_PILOT.md](./docs/REAL_REPO_PILOT.md), and broader external pilots are still pending
|
|
743
|
+
|
|
744
|
+
## Roadmap
|
|
745
|
+
|
|
746
|
+
See [docs/ROADMAP.md](./docs/ROADMAP.md).
|
|
747
|
+
|
|
748
|
+
## Strategy
|
|
749
|
+
|
|
750
|
+
See [docs/PRODUCT_STRATEGY.md](./docs/PRODUCT_STRATEGY.md) for the current semantic-analysis direction, rollout plan, and open-source versus paid product split.
|
|
751
|
+
|
|
752
|
+
## More Docs
|
|
753
|
+
|
|
754
|
+
- [Proof](./docs/PROOF.md)
|
|
755
|
+
- [Automation Spec](./docs/AUTOMATION_SPEC.md)
|
|
756
|
+
- [Market Research](./docs/MARKET_RESEARCH.md)
|
|
757
|
+
- [Strategy](./docs/PRODUCT_STRATEGY.md)
|
|
758
|
+
- [Commercialization](./docs/COMMERCIALIZATION.md)
|
|
759
|
+
|
|
760
|
+
## Architecture
|
|
761
|
+
|
|
762
|
+
See [docs/SEMANTIC_ARCHITECTURE.md](./docs/SEMANTIC_ARCHITECTURE.md).
|
|
763
|
+
|
|
764
|
+
## Benchmarks
|
|
765
|
+
|
|
766
|
+
See [docs/BENCHMARKS.md](./docs/BENCHMARKS.md).
|
|
767
|
+
|
|
768
|
+
## Pilot
|
|
769
|
+
|
|
770
|
+
See [docs/REAL_REPO_PILOT.md](./docs/REAL_REPO_PILOT.md).
|
|
771
|
+
|
|
772
|
+
## Commercialization
|
|
773
|
+
|
|
774
|
+
See [docs/COMMERCIALIZATION.md](./docs/COMMERCIALIZATION.md).
|
|
775
|
+
|
|
776
|
+
## Chinese Docs
|
|
777
|
+
|
|
778
|
+
- [Chinese Overview](./docs/zh-CN/README.md)
|
|
779
|
+
- [Product Strategy (Chinese)](./docs/zh-CN/PRODUCT_STRATEGY.md)
|
|
780
|
+
|
|
781
|
+
## Contributing
|
|
782
|
+
|
|
783
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
784
|
+
|
|
785
|
+
## Troubleshooting
|
|
786
|
+
|
|
787
|
+
See [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md).
|
|
788
|
+
|
|
789
|
+
## Changelog
|
|
790
|
+
|
|
791
|
+
See [CHANGELOG.md](./CHANGELOG.md).
|
|
792
|
+
|
|
793
|
+
## License
|
|
794
|
+
|
|
795
|
+
MIT
|