agent-guardrails 0.1.3 → 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 CHANGED
@@ -7,17 +7,49 @@ Ship AI-written code with production guardrails.
7
7
  It is not trying to be another standalone coding agent or another PR review bot.
8
8
  It is trying to be the repo-aware runtime that existing agent chats call before code is trusted and merged.
9
9
 
10
- ## Start Here
10
+ For real repos, not one-off prototypes.
11
11
 
12
- If you are new, start with `setup`.
12
+ ## Start Here / 先看这里
13
+
14
+ **English**
13
15
 
14
- The intended product entry is:
16
+ If you are new, start with `setup`.
15
17
 
16
18
  1. install `agent-guardrails`
17
19
  2. run `agent-guardrails setup --agent claude-code` in your repo
18
- 3. paste the generated MCP snippet into your existing coding agent
20
+ 3. connect your existing coding agent
19
21
  4. describe the task in plain language
20
- 5. let the runtime bootstrap contract, evidence, and finish-time review automatically
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`。
21
53
 
22
54
  The CLI still matters, but it is the infrastructure and fallback layer, not the long-term main user entry.
23
55
 
@@ -27,6 +59,133 @@ If you want to see it working before using your own repo, run the demo first:
27
59
  npm run demo
28
60
  ```
29
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
+
30
189
  ## Why this exists
31
190
 
32
191
  Coding agents usually fail in predictable ways:
@@ -53,7 +212,7 @@ The moat is the combination of repo-local contracts, runtime judgment, semantic
53
212
 
54
213
  ## Setup-First Quick Start
55
214
 
56
- If you want the intended product entry, install the package and let `setup` prepare the repo plus the MCP snippet you need:
215
+ If you want the intended product entry, install the package and let `setup` prepare the repo plus the agent config you need:
57
216
 
58
217
  ```bash
59
218
  npm install -g agent-guardrails
@@ -79,7 +238,7 @@ The runtime is tested in CI on Windows, Linux, and macOS, and the README example
79
238
  - auto-initializes the repo if `.agent-guardrails/config.json` is missing
80
239
  - defaults to the `node-service` preset unless you override it with `--preset`
81
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
82
- - prints the MCP config snippet and tells you exactly where to paste it
241
+ - prints the agent config snippet and tells you exactly where to put it
83
242
  - gives you one first chat message and one canonical MCP loop
84
243
 
85
244
  Example:
@@ -89,21 +248,21 @@ npx agent-guardrails setup --agent claude-code
89
248
  npx agent-guardrails setup --agent cursor --preset nextjs
90
249
  ```
91
250
 
92
- If the agent uses a clearly safe repo-local MCP config file, you can remove even the paste step:
93
-
94
- ```bash
95
- npx agent-guardrails setup --agent claude-code --write-repo-config
96
- npx agent-guardrails setup --agent cursor --write-repo-config
97
- npx agent-guardrails setup --agent openhands --write-repo-config
98
- npx agent-guardrails setup --agent openclaw --write-repo-config
99
- ```
100
-
101
- Today that safe repo-local write path is intended for:
102
-
103
- - `claude-code` via `.mcp.json`
104
- - `cursor` via `.cursor/mcp.json`
105
- - `openhands` via `.openhands/mcp.json`
106
- - `openclaw` via `.openclaw/mcp.json`
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`
107
266
 
108
267
  If you want the current most opinionated happy path, use Claude Code first.
109
268
  For broader pilot coverage, validate the same setup-first path across:
@@ -112,20 +271,20 @@ For broader pilot coverage, validate the same setup-first path across:
112
271
  - `cursor` and `codex` as secondary paths
113
272
  - `openhands` and `openclaw` as supplementary paths
114
273
 
115
- Once you paste the generated snippet into your agent, the happy path should feel like normal chat:
116
-
117
- - You: `Add refund status transitions to the order service.`
118
- - Agent: bootstraps the task contract through `start_agent_native_loop`
119
- - Agent: makes the change, runs required commands, updates evidence
120
- - Agent: finishes through `finish_agent_native_loop` and returns a reviewer-friendly summary with scope, risk, and future maintenance guidance
121
-
122
- If you do not know how to phrase the task yet, you can still start in plain Chinese or plain English:
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
- The first recommended MCP flow is:
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:
129
288
 
130
289
  1. `read_repo_guardrails`
131
290
  2. `start_agent_native_loop`
@@ -229,6 +388,7 @@ The flagship examples are:
229
388
  - the interface-drift demo in [examples/interface-drift-demo](./examples/interface-drift-demo)
230
389
  - the boundary-violation demo in [examples/boundary-violation-demo](./examples/boundary-violation-demo)
231
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)
232
392
  - the pilot write-up in [docs/REAL_REPO_PILOT.md](./docs/REAL_REPO_PILOT.md)
233
393
 
234
394
  Together they show:
@@ -240,6 +400,7 @@ Together they show:
240
400
  - the semantic layer can block a controller that crosses a declared module boundary even when the task contract still looks narrow
241
401
  - the semantic layer can tell the difference between "a test changed" and "the right test changed"
242
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
243
404
 
244
405
  Run it with:
245
406
 
@@ -247,6 +408,12 @@ Run it with:
247
408
  node ./examples/bounded-scope-demo/scripts/run-demo.mjs all
248
409
  ```
249
410
 
411
+ Then run the Python/FastAPI baseline proof demo:
412
+
413
+ ```bash
414
+ npm run demo:python-fastapi
415
+ ```
416
+
250
417
  Then run the OSS benchmark suite:
251
418
 
252
419
  ```bash
@@ -364,6 +531,7 @@ The current product direction is a generic, repo-local production baseline for A
364
531
  - `check` enforces small-scope, test-aware, evidence-backed, reviewable changes
365
532
  - `check --review` turns the same findings into a concise reviewer-oriented report
366
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
367
535
 
368
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.
369
537
 
@@ -396,11 +564,21 @@ The next technical step is conversation-first onboarding and stronger runtime-ba
396
564
 
397
565
  Paid tiers should extend the baseline rather than replace it:
398
566
 
399
- - `Pro Local`: semantic packs, auto task generation, richer local review, and maintenance-aware workflows
400
- - `Pro Cloud`: hosted review, shared policies, trend dashboards, and centralized governance
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
401
569
 
402
570
  Baseline merge-gate features stay open source.
403
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
+
404
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.
405
583
 
406
584
  ## Supported Agents
@@ -573,6 +751,7 @@ See [docs/PRODUCT_STRATEGY.md](./docs/PRODUCT_STRATEGY.md) for the current seman
573
751
 
574
752
  ## More Docs
575
753
 
754
+ - [Proof](./docs/PROOF.md)
576
755
  - [Automation Spec](./docs/AUTOMATION_SPEC.md)
577
756
  - [Market Research](./docs/MARKET_RESEARCH.md)
578
757
  - [Strategy](./docs/PRODUCT_STRATEGY.md)