sheperd 0.0.0-stage → 0.1.0-beta.2

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,32 @@
1
+ rewire
2
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
3
+
4
+ This product includes software adapted from third-party projects:
5
+
6
+ --------------------------------------------------------------------------------
7
+ pi-mono (https://github.com/badlogic/pi-mono)
8
+ Used in: packages/loop/src/agent-loop.ts, packages/loop/src/types.ts
9
+ (design of the agent loop adapted from packages/agent/src/agent-loop.ts)
10
+
11
+ MIT License
12
+
13
+ Copyright (c) 2025 Mario Zechner
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+ --------------------------------------------------------------------------------
package/README.md CHANGED
@@ -1,3 +1,346 @@
1
- # Temporary Holding Version
1
+ # rewire
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An anti-slop coding harness. You give it a task; it writes a contract and a set of tests first,
4
+ freezes them, lets a model implement against them inside a sandbox, then blocks the result on
5
+ hard gates and an independent multi-model review before it commits anything to a branch. It never
6
+ reports "verified" on the strength of a model's say-so.
7
+
8
+ It works with Claude, OpenAI models and local models through [Ollama](https://ollama.com).
9
+
10
+ **Status: v0.1, TypeScript only.** The 20-task anti-slop benchmark in [`bench/`](bench/README.md)
11
+ exists and its scorer is unit-tested, but **it has not been run against real models yet**. There
12
+ are no measured pass rates, and nothing here should be read as a claim about how often rewire
13
+ catches slop. The release checklist ([`docs/v0.1-release-checklist.md`](docs/v0.1-release-checklist.md))
14
+ lists what must hold on a live run before v0.1 is called released.
15
+
16
+ ## How a run works
17
+
18
+ 1. **Spec.** The task becomes a contract (asking you clarifying questions if it is ambiguous).
19
+ 2. **Tests first.** A test-writer model writes tests that must fail against the unchanged repo
20
+ (the red check); they are then frozen and hashed.
21
+ 3. **Implement.** An implementer model works in a git worktree. Writes happen only through a
22
+ sandboxed helper (`rewire-sandbox`), and frozen tests cannot be edited.
23
+ 4. **Gates.** Hard-block checks: tests, types, lint, semgrep, gitleaks, dependency audit, frozen
24
+ test integrity.
25
+ 5. **Review.** Up to three reviewers inspect the diff (security and spec compliance always;
26
+ silent-failure when the added lines match its patterns) and must back each finding with
27
+ evidence, which may quote lines the diff removed; a verifier tries to refute them. Reviewer and verifier models are chosen from a different
28
+ model family than the implementer when one is available.
29
+ 6. **Fix loop.** Findings go back to the implementer, with progress and oscillation detection,
30
+ a re-plan, and escalation to you when it stops converging.
31
+ 7. **Result.** A verified run is committed to the branch `rewire/<runId>` with an evidence report.
32
+
33
+ ## Install
34
+
35
+ ### Install from npm
36
+
37
+ rewire is published to npm as the package **`sheperd`** (pre-release, on the `next` tag). The
38
+ command it installs is `rewire`:
39
+
40
+ ```sh
41
+ npm i -g sheperd@next
42
+ rewire doctor
43
+ ```
44
+
45
+ The package carries the CLI as one bundled file plus a prebuilt `rewire-sandbox` for your
46
+ platform, which npm installs automatically as an optional dependency
47
+ (`sheperd-darwin-arm64`, `sheperd-darwin-x64`, `sheperd-linux-x64` or `sheperd-linux-arm64`).
48
+ Supported platforms: macOS on Apple silicon or Intel, and Linux on x64 or arm64 with glibc 2.35
49
+ or newer (Ubuntu 22.04, Debian 12 or later; musl distributions such as Alpine are not supported).
50
+ Windows is not supported. If your npm install skips optional dependencies
51
+ (`--omit=optional`, `--no-optional`), the sandbox binary is missing and `rewire doctor` says so.
52
+
53
+ You still need these system tools on `PATH`: git,
54
+ [ripgrep](https://github.com/BurntSushi/ripgrep), [semgrep](https://semgrep.dev),
55
+ [gitleaks](https://github.com/gitleaks/gitleaks), and on Linux
56
+ [bubblewrap](https://github.com/containers/bubblewrap) 0.8 or newer. macOS uses the built-in
57
+ `sandbox-exec`. See the per-OS install commands below.
58
+
59
+ ### Build from source
60
+
61
+ Requirements: git, Node.js 22+, pnpm, a Rust toolchain (to build the sandbox helper),
62
+ [ripgrep](https://github.com/BurntSushi/ripgrep), [semgrep](https://semgrep.dev),
63
+ [gitleaks](https://github.com/gitleaks/gitleaks), and on Linux
64
+ [bubblewrap](https://github.com/containers/bubblewrap) 0.8 or newer. macOS uses the built-in
65
+ `sandbox-exec`. Windows is not supported. CI uses semgrep 1.186.0 and gitleaks 8.30.1, the
66
+ versions the gates were developed against.
67
+
68
+ ```sh
69
+ # macOS
70
+ brew install ripgrep semgrep gitleaks pnpm
71
+
72
+ # Debian/Ubuntu
73
+ sudo apt-get install -y git ripgrep bubblewrap pipx
74
+ pipx install semgrep==1.186.0
75
+ pipx ensurepath # then restart the shell so ~/.local/bin is on PATH
76
+ # gitleaks: download the release for your platform from
77
+ # https://github.com/gitleaks/gitleaks/releases/tag/v8.30.1
78
+ # and put the `gitleaks` binary on PATH
79
+ # pnpm: npm install -g pnpm (or corepack enable)
80
+ ```
81
+
82
+ Then build rewire from source:
83
+
84
+ ```sh
85
+ git clone <this repository> rewire && cd rewire
86
+ cargo build --release -p rewire-sandbox
87
+ pnpm install --frozen-lockfile
88
+ pnpm -r build
89
+
90
+ # put the CLI on PATH (or run `node "$PWD/packages/cli/dist/main.js"` directly)
91
+ alias rewire='node '"$PWD"'/packages/cli/dist/main.js'
92
+ ```
93
+
94
+ The CLI looks for the sandbox binary in this order:
95
+
96
+ 1. `REWIRE_SANDBOX_BIN` (a missing file is an error, never a fall-through);
97
+ 2. the newer of `target/release/` and `target/debug/` in the checkout (source builds only; the npm
98
+ package never looks for a checkout);
99
+ 3. the `sheperd-<os>-<arch>` package installed next to the CLI (only there: never via `NODE_PATH`
100
+ or other global folders). Its binary must match the sha256 recorded in the npm bundle at
101
+ build time; a package whose binary is missing, not executable, modified, or of a different
102
+ version than the CLI is an error, never a fall-through;
103
+ 4. the first absolute `PATH` entry that has `rewire-sandbox`.
104
+
105
+ `rewire doctor` reports exactly this lookup, including which step found the binary, and a run
106
+ that cannot find the binary stops in preflight, before any model call.
107
+
108
+ ## `rewire doctor`
109
+
110
+ ```sh
111
+ rewire doctor [--models <file>]
112
+ ```
113
+
114
+ Prints one line per check, `✓` or `✗` with a fix hint, and exits `0` when everything required is
115
+ present or `1` otherwise. It checks: the sandbox binary, `git`, `rg`, `semgrep`, `gitleaks`,
116
+ `bwrap` (Linux) or `sandbox-exec` (macOS), the model list, and, when any model is an Ollama model,
117
+ that Ollama is reachable and at least version 0.6.4. Run it before your first `rewire run`.
118
+
119
+ ## Usage
120
+
121
+ ```sh
122
+ rewire run "add a --json flag to the export command" [--repo <path>] [--models <file>] [--headless]
123
+ rewire run --task-file task.md [--repo <path>] [--models <file>] [--headless]
124
+ ```
125
+
126
+ `--repo` defaults to the current directory, which must be the root of a clean git repository
127
+ (a package subdirectory of a monorepo is refused with `not_repo_root` in v0.1).
128
+ `--headless` never asks questions (an ambiguous task escalates with reason
129
+ `clarification_required`) and writes machine-readable events to stdout and the human summary to
130
+ stderr.
131
+
132
+ ### Exit codes
133
+
134
+ | code | meaning |
135
+ | ---- | ---------------------------------------------------------------------------------------------- |
136
+ | 0 | the run is `verified`. This is the only success. |
137
+ | 1 | usage error, unsupported platform, a missing prerequisite, or an unexpected error |
138
+ | 2 | the run escalated to a human (see the evidence report for the reason) |
139
+ | 130 | a second Ctrl-C: forced quit (the first Ctrl-C stops the run and writes an interrupted report) |
140
+
141
+ Running `rewire` with no arguments prints the usage and exits 1; `rewire --help` prints it and exits 0.
142
+
143
+ ### Run directory
144
+
145
+ Every run writes into the target repo:
146
+
147
+ ```
148
+ .rewire/runs/<runId>/
149
+ events.jsonl every pipeline event, redacted, in emit order
150
+ contract.json the contract the spec stage produced
151
+ manifest.json the frozen tests: paths and hashes
152
+ report.md the evidence report, including the known limitations below
153
+ ```
154
+
155
+ Add `.rewire/runs/`, `.rewire/worktrees/` and `.rewire/cache/` to the repo's ignore file (not
156
+ all of `.rewire/`: `.rewire/policy.toml` is the repo policy and belongs in version control). The
157
+ result of a verified run lives on the branch `rewire/<runId>`.
158
+
159
+ ## Choosing models
160
+
161
+ With no configuration, rewire uses whatever it finds: `ANTHROPIC_API_KEY` selects
162
+ `anthropic:claude-sonnet-5-5`, `OPENAI_API_KEY` selects `openai:gpt-5`, and a reachable local
163
+ Ollama selects its first pulled model. Override the first two with `REWIRE_ANTHROPIC_MODEL` and
164
+ `REWIRE_OPENAI_MODEL`. Ollama is found at `OLLAMA_HOST` (default `http://127.0.0.1:11434`).
165
+
166
+ For control, write a `models.toml` and pass `--models <file>`, or save it as
167
+ `~/.config/rewire/models.toml` (`$XDG_CONFIG_HOME/rewire/models.toml`), which is used
168
+ automatically. Models are written `<provider>:<model>` where provider is `anthropic`, `openai` or
169
+ `ollama`.
170
+
171
+ - `available` (required): the models rewire may use. The first one is the author: it writes the
172
+ spec and tests and implements.
173
+ - `[roles]` (optional): pin a role (`spec`, `test-writer`, `implementer`, `reviewer`, `verifier`)
174
+ to a model. A pinned model must also be in `available`.
175
+
176
+ Unpinned, the reviewer is the first available model of a different family than the implementer,
177
+ and the verifier prefers a family different from both. The report records the resulting
178
+ **independence**: `cross-family` when reviewer and verifier both differ in family from the
179
+ implementer, otherwise `same-family`.
180
+
181
+ **Claude and GPT**, cross-family:
182
+
183
+ ```toml
184
+ available = ["anthropic:claude-sonnet-5-5", "openai:gpt-5"]
185
+ ```
186
+
187
+ **Claude and a local Qwen via Ollama**, cross-family, with the roles pinned:
188
+
189
+ ```toml
190
+ available = ["anthropic:claude-sonnet-5-5", "ollama:qwen2.5-coder:14b"]
191
+
192
+ [roles]
193
+ implementer = "anthropic:claude-sonnet-5-5"
194
+ reviewer = "ollama:qwen2.5-coder:14b"
195
+ ```
196
+
197
+ **Ollama only**, fully local and free, but `same-family`:
198
+
199
+ ```toml
200
+ available = ["ollama:qwen2.5-coder:14b", "ollama:qwen2.5-coder:7b"]
201
+ ```
202
+
203
+ With one model family, the reviewers and the implementer share training blind spots, so the
204
+ review is weaker than a cross-family one. Rewire still runs, and marks the evidence report
205
+ `independence: same-family` so you can discount it. Ollama models must support tool calling;
206
+ rewire checks this.
207
+
208
+ ## Benchmark
209
+
210
+ ```sh
211
+ pnpm bench:validate # checks the 20 tasks and their traps, no models, free
212
+ pnpm bench # runs the tasks against real models: costs money
213
+ ```
214
+
215
+ See [`bench/README.md`](bench/README.md). **No live run has been made yet**; the release checklist
216
+ defines what a first run must show.
217
+
218
+ ## Behaviour changes in this release
219
+
220
+ - Leftover processes fail the command on Linux too: a command that leaves a child running more than
221
+ 300 ms after it exits (a server a test suite never closes, slow workers) now fails as a sandbox
222
+ escape (`sandbox_escape`), matching macOS. Test suites that relied on this passing on Linux need
223
+ to close what they start.
224
+ - More home files are unreadable inside the sandbox: shell start-up, history and backup files
225
+ (`~/.zshrc*`, `~/.zshenv*`, `~/.zprofile*`, `~/.bashrc*`, `~/.bash_profile*`, `~/.profile*`, the
226
+ histories and `~/.zsh_sessions/`), `~/.claude*`, `~/.codex/`, `~/.gemini/`, `~/.mcp.json*`,
227
+ `~/.cursor/mcp.json`, `~/.config/openai/`, `~/.ollama/id_*`, and `.env*` files outside the
228
+ worktree. A zsh or login shell run inside the sandbox therefore does not see what those files
229
+ set; PATH still comes from the host environment.
230
+
231
+ ## Known v0.1 limitations
232
+
233
+ These are rendered into every evidence report (the first list) or are known gaps in the harness.
234
+
235
+ Stated in every report (this list is checked against the pipeline's `KNOWN_LIMITATIONS` by a test):
236
+
237
+ - The audit gate uses a registry network exception: on Linux it has full network access during that
238
+ gate, because bwrap has no domain filtering; on macOS it can reach any host on tcp/443 plus DNS,
239
+ because Seatbelt cannot filter by domain.
240
+ - Test-writer isolation from implementation bodies is prompt-level until the code index ships.
241
+ - Disputes escalate to the human; automated adjudication is deferred.
242
+ - TypeScript only: other languages are refused with pack_undetected.
243
+ - Rules cover JS/TS only (the semgrep rules and the TypeScript pack).
244
+ - Gitignored untracked files are deleted before every gate run and before the final commit (the
245
+ report lists them), so the gates see exactly the committed tree; build output the implementer
246
+ creates does not survive between gate runs.
247
+ - Host PATH passed through the sandbox.
248
+ - Credential read-deny is a deny-list, not an allow-list: listed secret files (ssh, cloud and
249
+ registry credentials, shell rc, history and backup files, ~/.claude*, other agent CLIs'
250
+ credentials and MCP configs, .env files in the worktree, the run's repo and up to three
251
+ directories below HOME) are unreadable, but the rest of HOME, other
252
+ repositories and system files stay readable by every stage, so a secret stored elsewhere can be
253
+ read and sent to a model provider.
254
+ - Dependency installs are not harness-mediated in v0.1: the gates run against the dependencies
255
+ already present (the repo's node_modules is shared into the worktree by a symlink, never
256
+ committed); a new dependency name missing from the baseRef lockfile fails the audit gate and any
257
+ lockfile change fails as protected, but other manifest dependency edits (changed ranges, file: or
258
+ git+ specs, removals) pass both.
259
+ - Tests run in the same process as the code under test: implementer code imported by a frozen test
260
+ can tamper with the assertion library or the reporter in-process; only cheap forgery is detected.
261
+ - The test runner config is owned by the harness: projects that need setupFiles, plugins, aliases or
262
+ tsconfig paths fail closed.
263
+ - Jest support is covered by unit tests only (no real jest run in the harness test suite).
264
+ - No mutation testing or metric ratchet in v0.1.
265
+ - Linux has reduced OS-layer guarantees: the OS layer doesn't block creation on Linux; the
266
+ protected-paths gate does (it re-checks every changed or untracked path against the implementer
267
+ profile); a nested .git created after the sandbox starts fails the protected-paths gate and the
268
+ gated-tree snapshot refuses it as a new gitlink, so it is never committed; case-variant spellings
269
+ are caught by the path layer and the gates, not the OS.
270
+ - Linux escape reporting is best-effort: a command that kills the in-namespace reaper (kill -9 -1,
271
+ which ends the exec with 137) or ptraces it (Yama ptrace_scope 0) avoids the escape label; the
272
+ leftover is still killed when the pid namespace is torn down.
273
+ - On macOS, a process that detaches from the sandbox faster than one poll interval can outlive its
274
+ stage; a worktree change it makes after the last gate run fails the final tree-equality check, but
275
+ the process itself may keep running.
276
+ - Fake-verification residuals: the red check and the tests gate do not detect every vacuous test (no
277
+ expect call, a snapshot alias, a hand-thrown AssertionError); mutation testing is deferred.
278
+ - The console-summary cross-check reads the last summary in the runner output, so in-process code
279
+ that prints a forged summary after the real one is not detected.
280
+ - `__mocks__` directories are protected config: mocks cannot be added or changed during a run.
281
+ - Only npm, pnpm and yarn are recognised (bun and others fall back to npm), and the lint fallback
282
+ runs a local binary named like the npx command.
283
+ - Changed native addons (.node) or WebAssembly (.wasm) files execute in the test gate without being
284
+ scanned by semgrep.
285
+ - The dependency audit's new-dependency check is by name only: declared ranges, npm aliases
286
+ (npm:<pkg>) and overrides are not checked.
287
+ - When the reviewers share the implementer's model family, the report also says
288
+ `independence: same-family`.
289
+
290
+ Also known:
291
+
292
+ - The benchmark has not been run against real models; the scorer and traps are validated only
293
+ with the faux provider and by construction (the hidden tests catch every slop patch).
294
+ - The benchmark's trap checks are pattern-based and have documented false-positive and
295
+ false-negative edges (for example SQL placeholder detection).
296
+ - gitleaks' default allowlist skips some file types (svg, pdf, go.sum).
297
+ - The review's diff summary shares one 60 s git budget and depends on `/usr/bin/od`.
298
+ - Linux sandboxing needs unprivileged user namespaces; some distributions and containers
299
+ restrict them, in which case `rewire doctor` and runs will fail. macOS and Linux are the only
300
+ supported platforms.
301
+ - Linux: the sandbox finds `bwrap` only in `/usr/bin` or `/usr/local/bin` and does not check who
302
+ owns it; a symlink in the repo that matches a write-deny glob makes every Linux exec fail closed
303
+ (exit 120).
304
+ - macOS: the OS layer does not fold Unicode default-ignorable code points the way the path layer
305
+ does, and a deny directory that is already a symlink when the run starts is writable through
306
+ the link (the frozen-tests gate hashes resolved contents, so tests stay protected).
307
+ - A command that itself exits 3, 120, 124 or 127 is indistinguishable from a sandbox deny,
308
+ internal error, timeout or missing binary: it fails closed, possibly with a misleading message.
309
+ - The descendant sweep after an exec has narrow races (a process that re-parents during the
310
+ sweep, survivors at the kill bound); see the macOS detach limitation above. A failed `kill()`
311
+ is reported as `sandbox_unavailable` (fail-closed).
312
+ - `rewire-sandbox fs-read` decodes files as UTF-8; exec output is capped at 16 MiB per stream.
313
+ `~` is expanded only in the credential read-deny globs.
314
+ - Policy command rules are advisory (the sandbox is the enforcement boundary): their tokenizer
315
+ does not expand `$VAR` or globs, and an empty pattern matches every command. The bash
316
+ pre-check over-refuses some valid shell (ANSI-C quoting, comments, heredocs, `${x:-(none)}`).
317
+ - Tools do not observe the run's abort signal; each bash call is bounded by its timeout (at most
318
+ 600 s).
319
+ - `ChatRequest.timeoutMs` is honoured by the Ollama provider only; Anthropic and OpenAI use their
320
+ SDK default timeouts. The providers' live request shapes (including tool calls) are checked by
321
+ the release checklist's live smoke run, not by CI.
322
+ - The Ollama role-fitness cache is not safe for concurrent runs (single-user CLI), and each
323
+ fitness probe costs a few model calls the first time a model digest is seen.
324
+ - `events.jsonl` has no size cap.
325
+ - An unexpected (non-`RewireError`) failure inside a stage exits 1 and keeps the worktree.
326
+ - A coverage failure in the test-writer stage (a criterion without a test) escalates without a
327
+ retry.
328
+ - Non-test files that import vitest or jest are not flagged.
329
+ - Repositories that track `node_modules` always escalate (the final commit's index guard
330
+ refuses it); the CLI prints a hint.
331
+ - The registry-client e2e test has flaked under load on a developer machine.
332
+ - No PR delivery, TUI, Python pack, plugin API or streaming in v0.1.
333
+
334
+ ## Development
335
+
336
+ ```sh
337
+ cargo test --workspace
338
+ pnpm -r build && pnpm -r test
339
+ pnpm biome check .
340
+ ```
341
+
342
+ CI runs exactly these on Ubuntu and macOS. A nightly workflow runs `pnpm bench` and needs the
343
+ repository secrets `ANTHROPIC_API_KEY` and `OPENAI_API_KEY`; it is never triggered by pushes or
344
+ pull requests.
345
+
346
+ Design notes: [`docs/DESIGN-DECISIONS.md`](docs/DESIGN-DECISIONS.md). Licensed under Apache-2.0.