@weldr/runr 0.3.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +216 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +4 -0
  4. package/README.md +200 -0
  5. package/dist/cli.js +464 -0
  6. package/dist/commands/__tests__/report.test.js +202 -0
  7. package/dist/commands/compare.js +168 -0
  8. package/dist/commands/doctor.js +124 -0
  9. package/dist/commands/follow.js +251 -0
  10. package/dist/commands/gc.js +161 -0
  11. package/dist/commands/guards-only.js +89 -0
  12. package/dist/commands/metrics.js +441 -0
  13. package/dist/commands/orchestrate.js +800 -0
  14. package/dist/commands/paths.js +31 -0
  15. package/dist/commands/preflight.js +152 -0
  16. package/dist/commands/report.js +478 -0
  17. package/dist/commands/resume.js +149 -0
  18. package/dist/commands/run.js +538 -0
  19. package/dist/commands/status.js +189 -0
  20. package/dist/commands/summarize.js +220 -0
  21. package/dist/commands/version.js +82 -0
  22. package/dist/commands/wait.js +170 -0
  23. package/dist/config/__tests__/presets.test.js +104 -0
  24. package/dist/config/load.js +66 -0
  25. package/dist/config/schema.js +160 -0
  26. package/dist/context/__tests__/artifact.test.js +130 -0
  27. package/dist/context/__tests__/pack.test.js +191 -0
  28. package/dist/context/artifact.js +67 -0
  29. package/dist/context/index.js +2 -0
  30. package/dist/context/pack.js +273 -0
  31. package/dist/diagnosis/analyzer.js +678 -0
  32. package/dist/diagnosis/formatter.js +136 -0
  33. package/dist/diagnosis/index.js +6 -0
  34. package/dist/diagnosis/types.js +7 -0
  35. package/dist/env/__tests__/fingerprint.test.js +116 -0
  36. package/dist/env/fingerprint.js +111 -0
  37. package/dist/orchestrator/__tests__/policy.test.js +185 -0
  38. package/dist/orchestrator/__tests__/schema-version.test.js +65 -0
  39. package/dist/orchestrator/artifacts.js +405 -0
  40. package/dist/orchestrator/state-machine.js +646 -0
  41. package/dist/orchestrator/types.js +88 -0
  42. package/dist/ownership/normalize.js +45 -0
  43. package/dist/repo/context.js +90 -0
  44. package/dist/repo/git.js +13 -0
  45. package/dist/repo/worktree.js +239 -0
  46. package/dist/store/run-store.js +107 -0
  47. package/dist/store/run-utils.js +69 -0
  48. package/dist/store/runs-root.js +126 -0
  49. package/dist/supervisor/__tests__/evidence-gate.test.js +111 -0
  50. package/dist/supervisor/__tests__/ownership.test.js +103 -0
  51. package/dist/supervisor/__tests__/state-machine.test.js +290 -0
  52. package/dist/supervisor/collision.js +240 -0
  53. package/dist/supervisor/evidence-gate.js +98 -0
  54. package/dist/supervisor/planner.js +18 -0
  55. package/dist/supervisor/runner.js +1562 -0
  56. package/dist/supervisor/scope-guard.js +55 -0
  57. package/dist/supervisor/state-machine.js +121 -0
  58. package/dist/supervisor/verification-policy.js +64 -0
  59. package/dist/tasks/task-metadata.js +72 -0
  60. package/dist/types/schemas.js +1 -0
  61. package/dist/verification/engine.js +49 -0
  62. package/dist/workers/__tests__/claude.test.js +88 -0
  63. package/dist/workers/__tests__/codex.test.js +81 -0
  64. package/dist/workers/claude.js +119 -0
  65. package/dist/workers/codex.js +162 -0
  66. package/dist/workers/json.js +22 -0
  67. package/dist/workers/mock.js +193 -0
  68. package/dist/workers/prompts.js +98 -0
  69. package/dist/workers/schemas.js +39 -0
  70. package/package.json +47 -0
  71. package/templates/prompts/implementer.md +70 -0
  72. package/templates/prompts/planner.md +62 -0
  73. package/templates/prompts/reviewer.md +77 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,216 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.3.0] - 2026-01-01
11
+
12
+ **Renamed to Runr.** New identity, same reliability-first mission.
13
+
14
+ ### Changed
15
+
16
+ - **Package renamed**: `agent-runner` → `@weldr/runr`
17
+ - **CLI renamed**: `agent` → `runr`
18
+ - **Directory renamed**: `.agent/` → `.runr/` (old location still works with deprecation warning)
19
+ - **Config renamed**: `agent.config.json` → `runr.config.json` (old name still works)
20
+ - **Worktrees renamed**: `.agent-worktrees/` → `.runr-worktrees/`
21
+ - **Env var renamed**: `AGENT_WORKTREES_DIR` → `RUNR_WORKTREES_DIR` (old var still works)
22
+
23
+ ### Added
24
+
25
+ - **Fun CLI aliases**: `summon` (run), `resurrect` (resume), `scry` (status), `banish` (gc)
26
+ - **Deprecation warnings**: Clear messages when using old paths/names
27
+ - **Backwards compatibility**: Old locations and names work during transition period
28
+
29
+ ### Migration
30
+
31
+ Both old and new paths are supported. To migrate:
32
+
33
+ 1. Rename `.agent/` to `.runr/`
34
+ 2. Rename `agent.config.json` to `runr.config.json`
35
+ 3. Use `runr` instead of `agent` CLI
36
+
37
+ ### Fixed
38
+
39
+ - **Guard violation diagnostics**: `stop.md` now includes specific files that caused the violation
40
+ - Scope violations list the exact files modified outside allowlist
41
+ - Lockfile violations list which lockfiles were changed
42
+ - Error message includes up to 5 file names for quick diagnosis
43
+
44
+ ## [0.2.2] - 2025-12-31
45
+
46
+ Reliability release: fixes the worktree/denylist catch-22 that caused `implement_blocked` failures.
47
+
48
+ ### Fixed
49
+
50
+ - **Worktrees moved out of `.agent/`**: Worktrees now created at `.agent-worktrees/<runId>/` instead of `.agent/worktrees/<runId>/`
51
+ - Prevents catch-22 where denylist patterns like `.agent/**` blocked worker operations
52
+ - Workers no longer see `.agent` in their absolute CWD path
53
+ - Override location with `AGENT_WORKTREES_DIR` env var
54
+ - GC command updated to scan both new and legacy locations
55
+
56
+ - **Auto-inject git excludes for agent artifacts**: `.agent/` and `.agent-worktrees/` now auto-added to `.git/info/exclude` at run start
57
+ - Fresh repos no longer need manual `.gitignore` entries for agent artifacts
58
+ - Prevents "dirty worktree" guard failures on first run
59
+
60
+ - **Guard failure diagnostics**: Full guard failure details now printed to console (not just `guard=fail`)
61
+ - Shows exact reasons, scope violations, lockfile violations, dirty files
62
+ - Makes debugging guard failures actionable
63
+
64
+ - **Built-in env_allowlist for agent artifacts**: `.agent/**` and `.agent-worktrees/**` now always treated as env noise
65
+ - Agent artifacts never trigger scope violations or dirty worktree errors
66
+ - Belt-and-suspenders with git exclude injection
67
+
68
+ - **Worktree exclude injection**: Fixed `node_modules` symlinks appearing as untracked files in worktrees
69
+ - Git only reads `.git/info/exclude` from the main repo, not worktree gitdirs
70
+ - Now writes exclude patterns to main repo's `.git/info/exclude`
71
+ - Prevents "worktree became dirty after env setup" errors
72
+
73
+ - **Tier escalation at final milestone**: `is_milestone_end` and `is_run_end` now correctly trigger at the last milestone
74
+ - Previously hardcoded to `false`, preventing tier1/tier2 from running
75
+ - Final milestone now runs all verification tiers (tier0 + tier1 + tier2)
76
+ - Fixes review loops caused by reviewer expecting `npm test` but verifier only running `npm run build`
77
+
78
+ ### Added
79
+
80
+ - **Legacy worktree warning**: Warns on startup if old worktree locations are detected
81
+ - Helps users clean up after upgrade
82
+ - Points to `agent gc` for cleanup
83
+
84
+ - **Implementer prompt scope clarification**: Added note that scope patterns are repo-relative, not absolute paths
85
+ - Prevents worker confusion when CWD contains `.agent` substrings
86
+
87
+ - **Task ownership enforcement (Phase-2)**: Tasks with `owns:` frontmatter now enforce ownership at IMPLEMENT time
88
+ - Defensive normalization via shared `src/ownership/normalize.ts` module
89
+ - Renames count as touching both old and new paths (conservative rule)
90
+ - `ownership_violation` stop reason with actionable error message
91
+
92
+ ### Testing
93
+
94
+ - **Acceptance tests for worktree fixes**: 9 tests covering auto-exclude, worktree location, and guard diagnostics
95
+ - Run with `npx vitest run test/acceptance/worktree-fixes.test.ts`
96
+
97
+ ## [0.2.1] - 2025-12-29
98
+
99
+ Adoption improvements: scope presets, better diagnostics, and OSS packaging.
100
+
101
+ ### Added
102
+
103
+ - **Scope presets**: Named pattern collections for popular frameworks
104
+ - 11 presets: `nextjs`, `react`, `drizzle`, `prisma`, `vitest`, `jest`, `playwright`, `typescript`, `tailwind`, `eslint`, `env`
105
+ - Use via `scope.presets: ["vitest", "nextjs"]` in config
106
+ - Patterns merged into allowlist at config load time
107
+ - Unknown presets warn but don't fail
108
+
109
+ - **Review digest artifact**: `review_digest.md` written when `review_loop_detected` stops a run
110
+ - Contains milestone context, review round count, full list of requested changes
111
+ - Makes debugging review loops much easier
112
+
113
+ - **Preset suggestions**: `plan_scope_violation` errors now suggest relevant presets
114
+ - e.g., "Try adding presets: [vitest] to scope.presets"
115
+
116
+ ### Documentation
117
+
118
+ - **README.md**: Quick start, configuration, CLI reference, stop reasons
119
+ - **LICENSE**: Apache 2.0 license
120
+ - **CONTRIBUTING.md**: Development workflow, code style, PR process, architecture overview
121
+ - **docs/PILOT_PROGRAM.md**: Early adopter onboarding guide
122
+
123
+ ### Improved
124
+
125
+ - Stop memo now includes descriptions and tips for `review_loop_detected` and `plan_scope_violation`
126
+
127
+ ## [0.2.0] - 2025-12-28
128
+
129
+ Resilience improvements based on dogfooding feedback.
130
+
131
+ ### Added
132
+
133
+ - **Review loop detection**: Prevents infinite IMPLEMENT→REVIEW cycles
134
+ - `max_review_rounds` config option (default: 2)
135
+ - Fingerprint-based detection for identical consecutive `request_changes`
136
+ - New stop reason: `review_loop_detected`
137
+ - Timeline event with diagnostic payload
138
+
139
+ ### Fixed
140
+
141
+ - **ESM compatibility**: `agent orchestrate wait` no longer crashes under ESM / Node 22
142
+ - Replaced `require()` with proper ESM import
143
+
144
+ - **State sync**: Removed dead `'DONE'` phase check in orchestrator reconciliation
145
+
146
+ ### Testing
147
+
148
+ - **Golden scenario 07**: `07-review-loop-detected` validates review loop detection
149
+ - **Mock worker**: New `review_always_request_changes` mode for testing
150
+
151
+ ## [0.1.0] - 2025-12-27
152
+
153
+ Initial stable release with full dual-LLM orchestration and autonomy features.
154
+
155
+ ### Added
156
+
157
+ - **Dual-LLM orchestration**: Claude for planning/review, Codex for implementation
158
+ - **Phase-based execution**: PLAN → IMPLEMENT → VERIFY → REVIEW → CHECKPOINT → FINALIZE
159
+ - **Safety guards**: Scope allowlist/denylist, lockfile protection, dirty worktree checks
160
+ - **Verification tiers**: Risk-based test selection with automatic retries
161
+ - **Worktree isolation**: Git worktrees for safe parallel runs
162
+ - **Auto-resume**: Automatic recovery from transient failures (stall timeout, worker timeout)
163
+ - **Evidence gate**: Requires proof for `no_changes_needed` claims
164
+
165
+ ### Orchestrator
166
+
167
+ - **Multi-track orchestration**: Run parallel tracks of serial steps
168
+ - **Collision detection**: Prevent merge conflicts with allowlist overlap checking
169
+ - **Collision policies**: serialize, force, fail
170
+ - **Resume support**: Resume orchestrations from any state
171
+ - **Artifact schema versioning**: All outputs include `schema_version: 1`
172
+
173
+ ### Commands
174
+
175
+ - `agent run` - Execute a task with full phase lifecycle
176
+ - `agent resume` - Resume a stopped run
177
+ - `agent status` - Show run status
178
+ - `agent report` - Generate run report
179
+ - `agent follow` - Tail run timeline in real-time
180
+ - `agent wait` - Block until run reaches terminal state
181
+ - `agent summarize` - Generate summary.json from run KPIs
182
+ - `agent compare` - Compare KPIs between two runs
183
+ - `agent doctor` - Check worker CLI availability
184
+ - `agent gc` - Clean up old worktree directories
185
+ - `agent paths` - Display canonical agent directory paths
186
+ - `agent metrics` - Show aggregated metrics across runs
187
+ - `agent version` - Show version information
188
+ - `agent orchestrate run` - Start multi-track orchestration
189
+ - `agent orchestrate resume` - Resume orchestration
190
+ - `agent orchestrate wait` - Wait for orchestration to complete
191
+
192
+ ### Diagnostics
193
+
194
+ - **Auto-diagnose stop reasons**: 10 diagnostic rules with actionable guidance
195
+ - **Structured handoff artifacts**: `stop.json` and `stop.md` for stopped runs
196
+ - **Stop reason families**: guard, budget, verification, worker, stall, auth
197
+
198
+ ### Testing
199
+
200
+ - **Golden scenario suite**: 6 deterministic integration tests
201
+ - **Mock worker modes**: delay, stall, timeout_once_then_ok, no_changes_no_evidence
202
+ - **Benchmark harness**: `scripts/bench.ts` with presets
203
+
204
+ ### Documentation
205
+
206
+ - Full documentation in `docs/` directory
207
+ - TARGET_REPO_SETUP.md for using in other projects
208
+ - Worktree strategy documentation
209
+ - CLI reference
210
+
211
+ [Unreleased]: https://github.com/vonwao/runr/compare/v0.3.0...HEAD
212
+ [0.3.0]: https://github.com/vonwao/runr/compare/v0.2.2...v0.3.0
213
+ [0.2.2]: https://github.com/vonwao/runr/compare/v0.2.1...v0.2.2
214
+ [0.2.1]: https://github.com/vonwao/runr/compare/v0.2.0...v0.2.1
215
+ [0.2.0]: https://github.com/vonwao/runr/compare/v0.1.0...v0.2.0
216
+ [0.1.0]: https://github.com/vonwao/runr/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2024 Agent Framework Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Agent Framework
2
+ Copyright 2024 Agent Framework Contributors
3
+
4
+ This product includes software developed by the Agent Framework project.
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ # Runr
2
+
3
+ Phase-gated orchestration for agent tasks.
4
+
5
+ > **Status**: v0.3.0 — Renamed from `agent-runner`. Early, opinionated, evolving.
6
+
7
+ ## The Problem
8
+
9
+ AI agents can write code. They can also:
10
+ - Claim success without verification
11
+ - Modify files they shouldn't touch
12
+ - Get stuck in infinite loops
13
+ - Fail in ways that are impossible to debug
14
+
15
+ **Runr doesn't make agents smarter. It makes them accountable.**
16
+
17
+ ## What This Does
18
+
19
+ Runr orchestrates AI workers (Claude, Codex) through a phase-based workflow with hard gates:
20
+
21
+ ```
22
+ PLAN → IMPLEMENT → VERIFY → REVIEW → CHECKPOINT → done
23
+ ↑___________| (retry if needed)
24
+ ```
25
+
26
+ Every phase has criteria. You don't advance without meeting them.
27
+
28
+ ## Why Phase Gates?
29
+
30
+ Most agent tools optimize for speed. Runr optimizes for **trust**.
31
+
32
+ When a run fails (and it will), you get:
33
+ - **Structured diagnostics** — exactly why it stopped
34
+ - **Checkpoints** — resume from where it failed
35
+ - **Scope guards** — files it couldn't touch, it didn't touch
36
+ - **Evidence** — "done" means "proven done"
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # Install
42
+ git clone https://github.com/vonwao/runr.git
43
+ cd runr && npm install && npm run build && npm link
44
+
45
+ # Verify
46
+ runr version
47
+ runr doctor
48
+
49
+ # Run a task
50
+ cd /your/project
51
+ runr run --task .runr/tasks/my-task.md --worktree
52
+ ```
53
+
54
+ > Not on npm yet. Coming soon as `@weldr/runr`.
55
+
56
+ ## Configuration
57
+
58
+ Create `.runr/runr.config.json`:
59
+
60
+ ```json
61
+ {
62
+ "agent": { "name": "my-project", "version": "1" },
63
+ "scope": {
64
+ "allowlist": ["src/**", "tests/**"],
65
+ "denylist": ["node_modules/**"],
66
+ "presets": ["vitest", "typescript"]
67
+ },
68
+ "verification": {
69
+ "tier0": ["npm run typecheck"],
70
+ "tier1": ["npm run build"],
71
+ "tier2": ["npm test"]
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### Scope Presets
77
+
78
+ Don't write patterns by hand:
79
+
80
+ ```json
81
+ {
82
+ "scope": {
83
+ "presets": ["nextjs", "vitest", "drizzle", "tailwind"]
84
+ }
85
+ }
86
+ ```
87
+
88
+ Available: `nextjs`, `react`, `drizzle`, `prisma`, `vitest`, `jest`, `playwright`, `typescript`, `tailwind`, `eslint`, `env`
89
+
90
+ ## CLI Reference
91
+
92
+ | Command | What it does |
93
+ |---------|--------------|
94
+ | `runr run --task <file>` | Start a task |
95
+ | `runr resume <id>` | Continue from checkpoint |
96
+ | `runr status [id]` | Show run state |
97
+ | `runr follow [id]` | Tail run progress |
98
+ | `runr report <id>` | Generate run report |
99
+ | `runr gc` | Clean up old runs |
100
+ | `runr doctor` | Check environment |
101
+
102
+ ### The Fun Commands
103
+
104
+ Same functionality, different vibe:
105
+
106
+ ```bash
107
+ runr summon --task task.md # run
108
+ runr resurrect <id> # resume
109
+ runr scry <id> # status
110
+ runr banish # gc
111
+ ```
112
+
113
+ ## Task Files
114
+
115
+ Tasks are markdown files:
116
+
117
+ ```markdown
118
+ # Add user authentication
119
+
120
+ ## Goal
121
+ OAuth2 login with Google.
122
+
123
+ ## Requirements
124
+ - Session management
125
+ - Protected routes
126
+ - Logout functionality
127
+
128
+ ## Success Criteria
129
+ - Users can log in with Google
130
+ - Session persists across refreshes
131
+ ```
132
+
133
+ ## Stop Reasons
134
+
135
+ When Runr stops, it tells you why:
136
+
137
+ | Reason | What happened |
138
+ |--------|---------------|
139
+ | `complete` | Task finished. Ship it. |
140
+ | `verification_failed_max_retries` | Tests failed too many times |
141
+ | `guard_violation` | Touched files outside scope |
142
+ | `review_loop_detected` | Reviewer kept requesting same changes |
143
+ | `time_budget_exceeded` | Ran out of time |
144
+
145
+ Every stop produces `stop.json` + `stop.md` with diagnostics.
146
+
147
+ ## Philosophy
148
+
149
+ **This is not magic.** Runs fail. The goal is *understandable, resumable* failure.
150
+
151
+ **This is not a chatbot.** Task in, code out. No conversation.
152
+
153
+ **This is not a code generator.** It orchestrates generators. Different job.
154
+
155
+ **Agents lie. Logs don't.** If it can't prove it, it didn't do it.
156
+
157
+ ## Migrating from agent-runner
158
+
159
+ If you're upgrading from `agent-runner`:
160
+
161
+ | Old | New |
162
+ |-----|-----|
163
+ | `agent` CLI | `runr` CLI |
164
+ | `.agent/` directory | `.runr/` directory |
165
+ | `agent.config.json` | `runr.config.json` |
166
+ | `.agent-worktrees/` | `.runr-worktrees/` |
167
+
168
+ Both old and new locations work during the transition period. You'll see deprecation warnings for old locations.
169
+
170
+ ## Development
171
+
172
+ ```bash
173
+ npm run build # compile
174
+ npm test # run tests
175
+ npm run dev -- run --task task.md # run from source
176
+ ```
177
+
178
+ ## Release History
179
+
180
+ | Version | Date | Highlights |
181
+ |---------|------|------------|
182
+ | v0.3.0 | 2026-01-01 | **Renamed to Runr**, new CLI, new directory structure |
183
+ | v0.2.2 | 2025-12-31 | Worktree location fix, guard diagnostics |
184
+ | v0.2.1 | 2025-12-29 | Scope presets, review digest |
185
+ | v0.2.0 | 2025-12-28 | Review loop detection |
186
+ | v0.1.0 | 2025-12-27 | Initial stable release |
187
+
188
+ See [CHANGELOG.md](CHANGELOG.md) for detailed release notes.
189
+
190
+ ## Contributing
191
+
192
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
193
+
194
+ ## License
195
+
196
+ Apache 2.0 — See [LICENSE](LICENSE)
197
+
198
+ ---
199
+
200
+ <sub>Existence is pain, but shipping is relief.</sub>