@bluenyang/reins 0.1.0 → 0.1.1

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 (37) hide show
  1. package/README.md +25 -26
  2. package/cli/dist/commands/check.js +180 -90
  3. package/cli/dist/commands/configure.js +79 -0
  4. package/cli/dist/commands/gate.js +54 -0
  5. package/cli/dist/commands/install.js +80 -30
  6. package/cli/dist/commands/metrics.js +138 -0
  7. package/cli/dist/commands/stages.js +435 -0
  8. package/cli/dist/commands/status.js +249 -0
  9. package/cli/dist/commands/update.js +70 -0
  10. package/cli/dist/lib/blocks.js +6 -1
  11. package/cli/dist/lib/detect.js +91 -1
  12. package/cli/dist/lib/fsx.js +8 -3
  13. package/cli/dist/lib/generate.js +143 -0
  14. package/cli/dist/lib/git.js +12 -1
  15. package/cli/dist/lib/harness.js +15 -4
  16. package/cli/dist/lib/metrics.js +223 -0
  17. package/cli/dist/lib/reader.js +47 -0
  18. package/cli/dist/lib/schema.js +23 -2
  19. package/cli/dist/lib/skills.js +13 -2
  20. package/cli/dist/lib/upstream.js +8 -0
  21. package/cli/dist/lib/vendor-write.js +136 -0
  22. package/cli/dist/lib/work.js +106 -0
  23. package/cli/dist/reins.js +161 -7
  24. package/docs/README.ko.md +25 -27
  25. package/harness/CHANGELOG.md +5 -0
  26. package/harness/VERSION +1 -1
  27. package/harness/policy/stops.yaml +2 -2
  28. package/harness/policy/transitions.yaml +1 -1
  29. package/harness/roles/code-review.md +6 -3
  30. package/harness/roles/pl.md +2 -1
  31. package/harness/roles/qa-design.md +1 -1
  32. package/harness/roles/qa-run.md +1 -1
  33. package/harness/templates/bus/request.yaml +8 -2
  34. package/harness/templates/bus/response.yaml +1 -0
  35. package/package.json +9 -2
  36. package/skills/reins-loop/SKILL.md +5 -1
  37. package/skills/reins-loop/references/vendor-cli.md +40 -0
package/harness/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -12,8 +12,8 @@ stops:
12
12
  - { id: B3, group: decision, kind: intent, grade: HOLD, detect: role, text: "a change conflicts with intent or spec (scope)", resume: "amend the intent or open a new one" }
13
13
  - { id: B4, group: decision, kind: intent, grade: HOLD, detect: role, text: "the roadmap is silent or contradicts itself", resume: "fix the roadmap" }
14
14
  - { id: B5, group: decision, kind: intent, grade: STOP, detect: role, text: "an external API or environment contradicts a design assumption and the scope changes", resume: "update spec.md, then HOLD for the user" }
15
- - { id: C1, group: premise, kind: knowledge, grade: STOP, detect: role, text: "the rationale for the work no longer holds", resume: "fix plan.md and the ticket first, then continue" }
16
- - { id: C2, group: premise, kind: knowledge, grade: STOP, detect: verifier, text: "the diff departs from plan.md and the plan was not updated (R45)", resume: "update plan.md in the same commit" }
15
+ - { id: P1, group: premise, kind: knowledge, grade: STOP, detect: role, text: "the rationale for the work no longer holds", resume: "fix plan.md and the ticket first, then continue" }
16
+ - { id: P2, group: premise, kind: knowledge, grade: STOP, detect: verifier, text: "the diff departs from plan.md and the plan was not updated (R45)", resume: "update plan.md in the same commit" }
17
17
  - { id: D1, group: failure, kind: knowledge, grade: ESCALATE, detect: verifier, text: "two failed test rounds in the same unit (ticket before rc.1, rc after)", resume: "root cause by the next role in the chain" }
18
18
  - { id: D2, group: failure, kind: knowledge, grade: ESCALATE, detect: verifier, text: "a red check twice with no fix in history or knowledge", resume: "root cause by the next role in the chain" }
19
19
  - { id: D3, group: failure, kind: knowledge, grade: STOP, detect: verifier, text: "flaky: passes alone, fails in the full run", resume: "isolate the scenario, mark flaky in the report, continue, report to the user" }
@@ -2,7 +2,7 @@ schema: reins/policy/transitions@1
2
2
  # Verifier transition points (design §3). `checks` are stop ids or named checks the verifier runs there.
3
3
  points:
4
4
  - { id: T1, when: before a ticket starts, checks: [B1, dependencies-done, budget-left, bindings-valid, asks-vs-decisions] }
5
- - { id: T2, when: before a commit (hook), checks: [C2, C10, F2, C4, C5] }
5
+ - { id: T2, when: before a commit (hook), checks: [P2, C10, F2, C4, C5] }
6
6
  - { id: T3, when: at a gate or test verdict, checks: [D1, D2, D3, D4, D5, evidence-present] }
7
7
  - { id: T4, when: before leaving the machine, checks: [A1, A2, A3, A4, C6, loop-step] }
8
8
  - { id: T5, when: an rc closes, checks: [E3, no-open-tickets, history-written, plan-agreement] }
@@ -16,6 +16,9 @@ must_not:
16
16
 
17
17
  # code-review
18
18
 
19
- 1. Compare the diff with plan.md 'files that change' and 'order of work' — anything outside is C10.
20
- 2. Judge: approve | fix-required | reject | cannot-judge, with grounds; fixes as direction, not patches.
21
- 3. Hand back with may_proceed and major_issues.
19
+ 1. Read only the diff and the request body you were given. Do not explore the repository or open other files. Read English docs only (never `.ko.md`).
20
+ 1a. Requirement text (`changes[].requirement`) and the allowed file list (top-level `why`, "allowed files:") come inside the request; do not open the spec or plan.
21
+ 2. Do not re-run gates or any command; cite the evidence paths from `changes[].evidence`.
22
+ 3. Judge each change against its `changes[].why` (S-n); any file in the diff outside the allowed files is itself a finding (C10).
23
+ 4. Decide: approve | fix-required | reject | cannot-judge, with grounds; fixes as direction, not patches.
24
+ 5. Hand back with may_proceed and major_issues. A re-review receives the fix diff only.
@@ -18,4 +18,5 @@ must_not:
18
18
  1. From an accepted spec: write plan.md (files that change, order of work, risks, proof, test checklist). Each order-of-work item becomes one ticket.
19
19
  2. For each ticket: hand to an implementer (bus kind: implement) with the plan section and knowledge hits. A ticket's checklist items are the expected commit units.
20
20
  3. On a verify-tool failure summary: decide fix (new ticket or same ticket) or escalate per the chain.
21
- 4. When all planned tickets are done → rc.1 is ready; stabilization tickets afterwards only.
21
+ 4. For a review request (bus kind: review) fill `changes[]: {path, what, why: <S-n>, evidence: <report path>}` per change, plus `requirement` on each change (the spec text of its S-n, one quoted line) and, in the request's top-level `why`, `allowed files:` with the plan's file list for the ticket; the reviewer gets nothing else but that request and the diff, so never needs the spec or plan.
22
+ 5. When all planned tickets are done → rc.1 is ready; stabilization tickets afterwards only.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  role: qa-design
3
- default_binding: "gemini-3.1-pro"
3
+ default_binding: "gemini-4-argon-high"
4
4
  fallback_binding: "claude-opus-5-5"
5
5
  summary: "Designs test scenarios from intent, roadmap and architecture — never from code. Gives the first review of spec and a light review of plan."
6
6
  may:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  role: qa-run
3
- default_binding: "gemini-3.8-flash"
3
+ default_binding: "gemini-3.8-flash-medium"
4
4
  fallback_binding: "claude-haiku-5-5"
5
5
  summary: "Runs the designed scenarios and judges them; anything ambiguous fails."
6
6
  may:
@@ -1,3 +1,4 @@
1
+ # Quoting: wrap any value that contains ": " or " #", or starts with one of - [ { * & ! | > ' " % @, in double quotes.
1
2
  schema: reins/bus/request@1
2
3
  id: 000-1_01
3
4
  from: pl
@@ -5,8 +6,13 @@ to: implementer
5
6
  ticket: 000-1
6
7
  intent: "000"
7
8
  kind: implement
8
- changes: []
9
- why: ""
9
+ changes:
10
+ - path: "cli/src/example.ts"
11
+ what: "one line: what changed"
12
+ why: "S-1"
13
+ requirement: "S-1: requirement text quoted from the spec, one line"
14
+ evidence: ".loctx/reports/<gate>.log"
15
+ why: "allowed files: <the plan's file list for the ticket, comma separated>"
10
16
  tried: []
11
17
  not_tried: []
12
18
  deadline: null
@@ -1,3 +1,4 @@
1
+ # Quoting: wrap any value that contains ": " or " #", or starts with one of - [ { * & ! | > ' " % @, in double quotes.
1
2
  schema: reins/bus/response@1
2
3
  request: 000-1_01
3
4
  from: implementer
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@bluenyang/reins",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Installs, migrates and updates an agent harness (harness → loop → graph) that keeps coding agents inside their permitted roles.",
5
5
  "license": "MIT",
6
- "repository": "github:bluenyang/reins",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/bluenyang/reins.git"
9
+ },
7
10
  "type": "module",
8
11
  "bin": {
9
12
  "reins": "cli/dist/reins.js"
@@ -41,5 +44,9 @@
41
44
  "oxlint": "^1.89.0",
42
45
  "typescript": "^7.0.2",
43
46
  "vitest": "^5.0.5"
47
+ },
48
+ "homepage": "https://github.com/bluenyang/reins#readme",
49
+ "bugs": {
50
+ "url": "https://github.com/bluenyang/reins/issues"
44
51
  }
45
52
  }
@@ -22,11 +22,15 @@ Exit codes 0/10/20/30. Use `npx @bluenyang/reins` (inside the reins repository:
22
22
  names recorded decisions that may already answer them.
23
23
  5. Branch `type/<NNN>-<slug>` from the default branch. implementer (`reins-implementer` subagent):
24
24
  ticket → plan section → `reins recall` → implement, **one commit per finished unit** (the hook runs **T2**).
25
- A diff outside the plan updates plan.md's departure log in the same commit (C2), or opens a new ticket (C10).
25
+ A diff outside the plan updates plan.md's departure log in the same commit (P2), or opens a new ticket (C10).
26
26
  6. **Verify.** Write `.loctx/bus/<id>_<nn>.request.yaml` (`kind: verify`); verify-tool runs
27
27
  `reins gate --ticket <id>` and answers in `<id>_<nn>.response.yaml` with the report paths as `evidence:`.
28
+ Bus values that contain `: ` or ` #`, or start with one of `- [ { * & ! | > ' " % @`, go in double quotes; an unquoted one breaks the YAML and the check stops with F2.
28
29
  **T3** `reins check --stage verdict --ticket <id>`. Fail → back to 5 (a second failure escalates, D1).
29
30
  7. **Review.** code-review gets the diff against plan and spec (`kind: review`) and proposes fixes only;
31
+ Prompt = the role's `must_not` + its procedure (body of code-review.md) + the request + the COMPLETE `git diff <range>` (all files; only
32
+ installed copies under `.agents/` and `.claude/` may be excluded by path) + "do not run commands, do not re-run checks";
33
+ after a fix, re-review gets the fix commit's diff only. CLI recipes: `references/vendor-cli.md`.
30
34
  pl decides fix or proceed. Nobody judges their own work.
31
35
  8. **Close.** `status: done`; one history page or line in `.loctx/history/` naming the ticket id, its commits,
32
36
  and a `decisions:` line; then delete the ticket file and its bus files.
@@ -0,0 +1,40 @@
1
+ # Vendor CLI recipes
2
+
3
+ How to call each role through its vendor CLI: read-only mode, output location, token source.
4
+ Report tokens with `reins metrics record --role <r> --tokens <n> --ticket <id>`; no count, no record.
5
+
6
+ ## code-review — codex
7
+
8
+ ```
9
+ codex exec -m <model> -s read-only --ephemeral -C <repo> -o <response.yaml> - < prompt.md
10
+ ```
11
+
12
+ - Read-only sandbox (`-s read-only`), no session kept (`--ephemeral`); the answer is written to `-o`.
13
+ - `prompt.md` = the role's `must_not` + its procedure (the body of code-review.md) + the bus request + the COMPLETE
14
+ `git diff <range>` inlined (all files, not filtered to `changes[]` paths; only `.agents/` and `.claude/` installed
15
+ copies may be excluded by path) + "do not run commands, do not re-run checks".
16
+ - Output lands in the `-o` file.
17
+ - Re-review: inline only the fix commit's diff.
18
+ - Tokens: the line after `tokens used` in the output.
19
+
20
+ ## qa-design — agy
21
+
22
+ ```
23
+ agy -p "<prompt>" --model <model> --mode plan
24
+ ```
25
+
26
+ - Plan mode is read-only. Inline the spec and plan text in the prompt; the reviewer reads no files.
27
+ - Output: redirect stdout to a file (`> response.yaml`).
28
+ - Tokens: the usage field when present.
29
+
30
+ ## lookup — cursor-agent
31
+
32
+ ```
33
+ cursor-agent -p --plan --model <model> "<prompt>"
34
+ ```
35
+
36
+ - Output: redirect stdout to a file. `--plan` is read-only. With `--output-format json`, tokens come from the usage field when present.
37
+
38
+ ## Claude roles
39
+
40
+ Call the `reins-<role>` subagent. It returns text; the pl writes it to the response file. Tokens: the Agent result's token count.