@bluenyang/reins 0.1.0 → 0.1.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.
Files changed (39) hide show
  1. package/README.md +31 -24
  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/cli/dist/scripts/sync-version.js +16 -0
  25. package/docs/README.ko.md +31 -25
  26. package/harness/CHANGELOG.md +5 -0
  27. package/harness/VERSION +1 -1
  28. package/harness/policy/stops.yaml +2 -2
  29. package/harness/policy/transitions.yaml +1 -1
  30. package/harness/roles/code-review.md +6 -3
  31. package/harness/roles/pl.md +2 -1
  32. package/harness/roles/qa-design.md +1 -1
  33. package/harness/roles/qa-run.md +1 -1
  34. package/harness/templates/bus/request.yaml +8 -2
  35. package/harness/templates/bus/response.yaml +1 -0
  36. package/package.json +10 -2
  37. package/skills/reins-loop/SKILL.md +5 -1
  38. package/skills/reins-loop/references/vendor-cli.md +40 -0
  39. package/skills/reins-setup/SKILL.md +7 -2
package/docs/README.ko.md CHANGED
@@ -14,15 +14,16 @@ BlueNyang과 Team Croffle의 저장소 열두 곳이 같은 하네스 계보를
14
14
 
15
15
  ## 상태
16
16
 
17
- 버전 0.1.0은 프리릴리스이며 계획의 1차(round one)입니다. 아직 npm에 올라가 있지 않고 Claude Code
18
- 플러그인 매니페스트도 없습니다. 그래서 지금은 `npx @bluenyang/reins`가 동작하지 않으니 소스에서
19
- 빌드해야 합니다([소스에서 시작하기](#소스에서-시작하기) 참고). 생성되는 벤더 파일은 Claude Code만
20
- 검증했습니다.
17
+ 0.1.0이 npm에 있습니다: `npx @bluenyang/reins <command>`. 계획의 1차(round one)로, graph 단계이며
18
+ 생성되는 벤더 파일은 Claude Code만 검증했습니다. loop와 harness 단계는 0.2에서 graph로부터 깎아
19
+ 냅니다. 알려진 문제는 [CHANGELOG.md](../CHANGELOG.md)에 있고, 그 수정은 0.1.1로 나갑니다. 0.1.2에서는
20
+ Claude Code 플러그인을 추가합니다.
21
21
 
22
- reins는 자기 루프로 자기 자신을 개발합니다. intent 001(`reins status`)은 intent → spec → plan →
23
- ticket 순서를 거쳤고 T1~T5 검사를 통과했으며 코드 리뷰는 Codex가 맡았습니다. 이때 다른 벤더에 묶인
24
- 역할은 각 벤더 CLI(`codex exec`, `agy -p`)로 돌았습니다. `reins-loop` 스킬에 따라 주 에이전트가
25
- 호출한 것이며 CLI가 벤더를 스스로 부르는 기능은 아직 없습니다.
22
+ reins는 자기 루프로 자기 자신을 개발합니다. intent 001(`reins status`), 002(`reins metrics`),
23
+ 003(위반 시나리오)이 각각 intent → spec → plan → ticket 순서를 거쳤고, T1~T5 검사를 통과했으며 코드
24
+ 리뷰는 Codex가 맡았습니다. 다른 벤더에 묶인 역할은 각 벤더 CLI(`codex exec`, `agy -p`)로
25
+ 돌았습니다. `reins-loop` 스킬에 따라 주 에이전트가 호출한 것이며 CLI가 벤더를 스스로 부르는 기능은
26
+ 아직 없습니다.
26
27
 
27
28
  ## 사다리
28
29
 
@@ -77,30 +78,35 @@ qa-run, deploy, docs, advisor. 역할 파일마다 해서는 안 되는 일이
77
78
  | `.claude/` | 합니다 | `.agents/`에서 생성한 파일, 직접 고치지 않습니다 |
78
79
  | `.loctx/` | 안 합니다 (gitignore) | ticket, 보고서, 인수인계 `bus/`, `history/`, 로컬 로드맵 |
79
80
 
80
- ## 소스에서 시작하기
81
+ ## 시작하기
81
82
 
82
- Node 20 이상과 pnpm이 필요합니다.
83
+ Claude Code에서는 플러그인을 설치하면 저장소 설정까지 맡길 수 있습니다.
83
84
 
84
- ```sh
85
- git clone https://github.com/bluenyang/reins.git
86
- cd reins
87
- pnpm install
88
- pnpm build
85
+ ```
86
+ /plugin marketplace add bluenyang/reins
87
+ /plugin install reins@bluenyang
88
+ /reins:reins-setup
89
89
  ```
90
90
 
91
- CLI는 설치하려는 저장소의 루트에서 실행합니다. 저장소에 커밋이 하나 이상 있어야 합니다(0.1.0의
92
- `check`는 커밋이 없는 저장소에서 실패합니다).
91
+ Codex, Antigravity, Cursor나 터미널에서는 CLI를 씁니다. Node 20 이상이 필요합니다. 설치하려는 저장소의 루트에서 실행하며, 저장소에 커밋이 하나 이상 있어야
92
+ 합니다(0.1.0의 `check`는 커밋이 없는 저장소에서 실패합니다).
93
93
 
94
94
  ```sh
95
- node /path/to/reins/cli/dist/reins.js install graph --dry-run # 쓸 파일을 미리 보여 줍니다
96
- node /path/to/reins/cli/dist/reins.js install graph --mode auto # 파일을 놓고 CLI를 감지해 기본값을 적용합니다
97
- node /path/to/reins/cli/dist/reins.js check --drift # 원본과 생성물이 맞으면 "drift: ok"를 출력합니다
98
- node /path/to/reins/cli/dist/reins.js status # intent, ticket, bus, 마지막 history
95
+ npx @bluenyang/reins install graph --dry-run # 쓸 파일을 미리 보여 줍니다
96
+ npx @bluenyang/reins install graph --mode auto # 파일을 놓고 CLI를 감지해 기본값을 적용합니다
97
+ npx @bluenyang/reins check --drift # 원본과 생성물이 맞으면 "drift: ok"를 출력합니다
98
+ npx @bluenyang/reins status # intent, ticket, bus, 마지막 history
99
99
  ```
100
100
 
101
101
  3·4세대 하네스가 있는 저장소에는 `install`이 거부하고 `migrate`를 안내합니다. 훅은 설치 안내문에서
102
- 제안만 하고 `--hooks`를 줄 때만 추가합니다. 배포되면 같은 명령을 `npx @bluenyang/reins <command>`로
103
- 실행하게 할 계획입니다.
102
+ 제안만 하고 `--hooks`를 줄 때만 추가합니다.
103
+
104
+ 설치한 뒤에는 에이전트로 일합니다. Claude Code에서는 `/reins-setup`을 한 번 실행하고, 새 요청마다
105
+ `/reins-intent`를 씁니다. Codex, Antigravity, Cursor는 같은 스킬을 `.agents/skills/`에서 읽습니다.
106
+ CLI는 스킬이 알아서 부릅니다.
107
+
108
+ reins 자체를 개발하려면 `git clone https://github.com/bluenyang/reins.git` 후 `pnpm install`,
109
+ `pnpm build`를 하고 `node cli/dist/reins.js <command>`로 실행합니다([CONTRIBUTING](CONTRIBUTING.ko.md) 참고).
104
110
 
105
111
  ## 명령
106
112
 
@@ -135,9 +141,9 @@ T1(`ticket-start`), T2(`pre-commit`), T3(`verdict`), T4(`pre-push`), T5(`rc-clos
135
141
 
136
142
  | 버전 | 내용 |
137
143
  |---|---|
138
- | 0.1 | graph 설계, 이 저장소의 자기 설치·자기 이전, 검증기, 스킬 세 개, README. 0.1.0을 npm에 배포합니다 |
144
+ | 0.1 | graph 설계, 이 저장소의 자기 설치·자기 이전, 검증기, 스킬 세 개, metrics, 위반 시나리오. 0.1.0 배포됨, 0.1.1 안정화(루프가 찾은 문제 수정), 0.1.2 Claude Code 플러그인(마켓플레이스 설치) |
139
145
  | 0.2 | graph에서 loop·harness 깎기, Codex·Gemini·Cursor 생성물, `recall`·`doctor`·예산 정지, 이전 세대 하네스 시험 이전 |
140
- | 0.3 | Claude Code 플러그인, Team Croffle 저장소에 적용 |
146
+ | 0.3 | Team Croffle 저장소에 적용 |
141
147
  | 1.0 | 정해진 일정은 없습니다. 0.x에서 기능을 더해 가다가 메인테이너가 체계가 잡혔다고 판단할 때 1.0이 됩니다. 안정화만으로 1.0이 되지는 않습니다 |
142
148
 
143
149
  ## 문서
@@ -4,6 +4,11 @@ Read by `reins update`: it lists the entries newer than a project's pinned versi
4
4
  `[skill]` needs the project's own sections touched — `reins update` then points to `/reins-update`,
5
5
  where the PM proposes those changes for the user to approve.
6
6
 
7
+ ## 0.1.1
8
+ - qa-design default binding is now gemini-4-argon-high and qa-run gemini-3.8-flash-medium (fallbacks unchanged).
9
+ - Generated settings deny `Bash(git commit -n *)` alongside `--no-verify`.
10
+ - Premise stops C1 and C2 are now P1 and P2, so a stop reason id has one meaning; red lines C1–C10 are unchanged. `metrics` still reads old C1/C2 records as P1/P2.
11
+
7
12
  ## 0.1.0
8
13
  - First harness: twelve roles, red lines C1–C10, stop conditions A1–G2, schemas, templates, Node knowledge seeds.
9
14
  - Workflow block: committing each finished unit as you go is part of the work.
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.2",
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"
@@ -27,6 +30,7 @@
27
30
  "fmt:check": "oxfmt --check cli/src cli/test test",
28
31
  "test": "vitest run",
29
32
  "check": "pnpm lint && pnpm fmt:check && pnpm typecheck && pnpm test",
33
+ "version": "pnpm -s build && node cli/dist/scripts/sync-version.js && git add .claude-plugin/plugin.json skills/reins-setup/SKILL.md",
30
34
  "prepare": "husky"
31
35
  },
32
36
  "dependencies": {
@@ -41,5 +45,9 @@
41
45
  "oxlint": "^1.89.0",
42
46
  "typescript": "^7.0.2",
43
47
  "vitest": "^5.0.5"
48
+ },
49
+ "homepage": "https://github.com/bluenyang/reins#readme",
50
+ "bugs": {
51
+ "url": "https://github.com/bluenyang/reins/issues"
44
52
  }
45
53
  }
@@ -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.
@@ -6,8 +6,13 @@ description: Install reins in this repository, or move an existing harness onto
6
6
  # reins-setup
7
7
 
8
8
  You act as the **pm** role (`.agents/harness/roles/pm.md` once installed). The CLI does the work; you collect
9
- the answers only the user can give and report what happened. Run the CLI as `npx @bluenyang/reins …`
10
- (inside the reins repository itself: `node cli/dist/reins.js …`).
9
+ the answers only the user can give and report what happened. Run the CLI as `npx @bluenyang/reins@0.1.2 …`
10
+ (the version is pinned to this skill's release; inside the reins repository itself: `node cli/dist/reins.js …`).
11
+
12
+ Defaults from the plugin settings: language `${user_config.language}`, install mode `${user_config.default_mode}`.
13
+ If either still starts with `${` (unsubstituted — this copy lives in a project, not the plugin), use the built-in
14
+ default of step 2 instead. Use these only as the defaults you propose; change `--mode` to `auto` only after the
15
+ user confirms it.
11
16
 
12
17
  1. **Look first.** `reins install graph --dry-run --json` → read `generation` and `refused`.
13
18
  - `refused` (3rd/4th-generation harness) → `reins migrate <tier> --dry-run` and show the moves.