@bluenyang/reins 0.3.4 → 0.4.0-rc.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 (66) hide show
  1. package/README.md +164 -39
  2. package/cli/dist/commands/config-gates.js +64 -6
  3. package/cli/dist/commands/config-models.js +19 -0
  4. package/cli/dist/commands/config.js +40 -16
  5. package/cli/dist/commands/configure.js +207 -47
  6. package/cli/dist/commands/install.js +91 -31
  7. package/cli/dist/commands/migrate.js +17 -20
  8. package/cli/dist/commands/update.js +164 -12
  9. package/cli/dist/lib/agents-md.js +55 -13
  10. package/cli/dist/lib/bindings.js +7 -10
  11. package/cli/dist/lib/blocks.js +82 -18
  12. package/cli/dist/lib/detect.js +88 -3
  13. package/cli/dist/lib/gate-refresh.js +35 -5
  14. package/cli/dist/lib/gate-script.js +303 -25
  15. package/cli/dist/lib/generate.js +48 -6
  16. package/cli/dist/lib/git.js +33 -0
  17. package/cli/dist/lib/migrate-plan.js +1 -1
  18. package/cli/dist/lib/profile.js +101 -0
  19. package/cli/dist/lib/prompter.js +2 -1
  20. package/cli/dist/lib/release.js +1 -1
  21. package/cli/dist/lib/schema.js +6 -3
  22. package/cli/dist/lib/upstream.js +1 -1
  23. package/cli/dist/reins.js +40 -14
  24. package/docs/README.ko.md +113 -23
  25. package/harness/CHANGELOG.md +12 -0
  26. package/harness/VERSION +1 -1
  27. package/harness/policy/common-red-lines.yaml +7 -5
  28. package/harness/roles/advisor.md +1 -1
  29. package/harness/roles/auditor.md +12 -11
  30. package/harness/roles/executor.md +4 -3
  31. package/harness/roles/implementer.md +5 -5
  32. package/harness/roles/pl.md +4 -4
  33. package/harness/roles/planner.md +7 -8
  34. package/harness/roles/pm.md +7 -8
  35. package/harness/schemas/bindings.schema.json +2 -0
  36. package/harness/schemas/install.schema.json +1 -0
  37. package/harness/schemas/intent.schema.json +9 -1
  38. package/harness/schemas/plan.schema.json +18 -0
  39. package/harness/schemas/spec.schema.json +9 -6
  40. package/harness/templates/agents-md-blocks.md +19 -54
  41. package/harness/templates/agents-md-guide.md +11 -10
  42. package/harness/templates/audit.md +14 -41
  43. package/harness/templates/history.md +1 -5
  44. package/harness/templates/intent.md +8 -19
  45. package/harness/templates/plan.md +23 -0
  46. package/harness/templates/spec.md +21 -16
  47. package/package.json +1 -1
  48. package/skills/audit/SKILL.md +27 -33
  49. package/skills/gates/SKILL.md +41 -0
  50. package/skills/implement/SKILL.md +33 -22
  51. package/skills/implement/references/procedure.md +51 -0
  52. package/skills/intent/SKILL.md +29 -20
  53. package/skills/intent/references/procedure.md +60 -0
  54. package/skills/onboard/SKILL.md +39 -28
  55. package/skills/plan/SKILL.md +35 -0
  56. package/skills/plan/references/procedure.md +52 -0
  57. package/skills/reins-setup/SKILL.md +4 -4
  58. package/skills/release/SKILL.md +18 -20
  59. package/skills/retro/SKILL.md +21 -26
  60. package/skills/review/SKILL.md +33 -17
  61. package/skills/review/references/procedure.md +50 -0
  62. package/skills/spec/SKILL.md +25 -19
  63. package/skills/spec/references/procedure.md +67 -0
  64. package/skills/merge/SKILL.md +0 -32
  65. package/skills/roadmap/SKILL.md +0 -29
  66. package/skills/test/SKILL.md +0 -26
@@ -1,39 +1,33 @@
1
1
  ---
2
2
  name: audit
3
- description: Audit a version against the flow in AGENTS.md, from the records alone — a first audit of risk before the merge and a second of procedure after the release — and commit the record under .agents/audit/. Mandatory while audit.required is true.
3
+ description: Audits a version or a range of commits for risk only — secrets, red lines, irreversible changes, unverified checks — from the records alone, in a fresh run that never sees the working conversation, and commits the record under .agents/audit/. Optional; run only when a person asks for it.
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
7
  # audit
7
8
 
8
- ## 1. When
9
- Twice in a version. The **first audit** comes after CI passes and before the merge. The **second audit** comes after the stable release (or when the user closes a version that has none), right before the retro. While `audit.required` in `.agents/harness/bindings.yaml` is true, both are mandatory — never skip one.
10
-
11
- ## 2. Procedure
12
- Both audits run in a fresh context that gets only the records, never the working conversation (auditor if switched on; without one, a new run of your own model, or another one the user chooses). The audit runs without a network; a record it lacks is "cannot confirm" and is asked of the PM. The audit run is read-only: it returns the record as its answer, in the form of `.agents/harness/templates/audit.md`. The PM keeps that answer as it came under `.loctx/reports/<version>/` and writes it unchanged to `.agents/audit/<version>.md` — never rewording, shortening or dropping a verdict. An audit goes through the history, finds what went wrong and says what to put right; it does not check every commit against every sentence of the rules. An audit still catches everything. It reads the `kind: accepted-finding` entries of `.agents/knowledge/`: a finding inside what such an entry accepts is listed as a **known acceptance**, naming the entry's file, and not as a violation; outside it, it is a violation as before.
13
-
14
- ### First audit — before the merge
15
- 1. It audits the PR that carries the accepted spec's work units (units added with approval too), on its branch. A PR of records, documents or release documents only, and the PR of a small fix made as an adjustment after the first audit, go without one: say so and why in one line of the PR body. The second audit looks at those merged before it.
16
- 2. Before handing the audit over, the PM collects the PR and its CI checks as the repository host's CLI prints them, unedited (e.g. `gh pr view <n> --json number,headRefOid,body`, `gh pr checks <n>`), into files under `.loctx/reports/<version>/`, and passes their paths to the audit. Do not summarise or rewrite them. Then fill in the gate logs: for every commit of the branch, `.loctx/reports/gates/<tree>.log` (`<tree>` is `git rev-parse <commit>^{tree}`) should hold a run with `worktree: clean` and `exit: 0`. Hooks leave these logs as you commit, but a commit made again by a rebase, on another machine or past the hook has none. For each commit without one, with a clean work tree: `git checkout --detach <commit>`, prepare it as the project needs (install dependencies), run `sh .agents/harness/run-gates.sh audit`, and return to your branch. Do not fix a run that fails; pass it on as it is. If the project has no `run-gates.sh`, say so instead.
17
- 3. Read: AGENTS.md and the harness settings as they were, the intent, spec, `docs/ROADMAP.md`, `.loctx/ROADMAP.local.md`, `.agents/knowledge/`, git history, history, gate and test logs, the gate logs per commit (`.loctx/reports/gates/<tree>.log`), the PR and CI records the PM collected (`.loctx/reports/<version>/`).
18
- 4. Look for **risk**, step by step: local roadmap → roadmap → intent → approval → spec → approval → implementation and commits → review → test → PR and CI. Kept, violated, cannot confirm (no evidence path), or skipped on the user's instruction (recorded in `waivers:`). Judge against the rules in force at the time. What counts as risk: an approval that is missing or was not given by the user; scope beyond the intent and spec; a red line; a work unit that was not reviewed (unless the spec's adjustment record says so and why); a check that failed or cannot be confirmed; a generated or harness file changed by hand. Commits: each commit is a meaningful unit — a point you can revert or reset to without taking other working work or features with it; several commits for one work unit (implementation, review fixes) are fine, and small units that may be reverted together may share one. A commit that mixes unrelated work, so one part cannot be reverted alone, is a violation. Gates: for each commit, the log of its tree holds a run with `worktree: clean` and `exit: 0` — say whether it was left at commit time (`stage: pre-commit`, `pre-push`) or filled in before the audit (`stage: audit`); no such run is "cannot confirm", and a clean run whose last `exit:` is not 0 is a violation. A work unit added, dropped or rescoped without approval is a violation; an adjustment recorded in the spec is kept; an adjustment made without a record is a violation whose remedy is the record. A generated or harness file changed by a commit that is not an `update`/`config` commit is a violation. In `.claude/settings.json` only reins' deny rules count (listed under `owned:` in `.agents/harness/generated.yaml`); the user's own entries there are not drift.
19
- 5. Criticise each violation precisely and give a remedy, and rate each violation's severity; for a high one, get opinions given without seeing each other from pl/discussion or advisor/committee (if switched on) and put them beside the remedy with the paths of their originals; list each known acceptance apart from the violations. The PM writes the answer under `## 1차 감사` and commits the record on the PR branch, so that it is merged with the work. Push it: that commit moves the PR's head, so wait for CI again.
20
- 6. The PM reports to the user — this is the one report of the flow (`merge`): fix a violation before the merge, or the user accepts it. Write the user's decision under `### 사용자 처리`, commit and push; a fix goes the same way, and the merge waits until CI is green on the last of these commits. A fix made after the audit is not audited again; only a high-risk violation whose fix is a large change is, and the PM writes there which it was and why.
21
-
22
- ### Second audit — after the release
23
- 1. Before handing the audit over, the PM collects for every PR merged in the version — its number, who merged it and when, the merge commit and head SHA, each CI check and its result — as the host's CLI prints them, unedited (e.g. `gh pr view <n> --json number,mergedBy,mergedAt,mergeCommit,headRefOid,body`, `gh pr checks <n>`); the user's words for each merge; the records of the releases (the workflow runs, the tags); the table of branch SHAs and default-branch SHAs, when a merge rewrote the commits; and the gate logs of the commits made after the starting point below, filled in as above. The range starts at the end SHA of the first audit record's `first.range`; when the merge rewrote the commits, it starts at the matching default-branch SHA from the SHA table. The PM copies that SHA into the audit request as it is, and into `second.range` unchanged; when the table lacks that SHA, the PM fills the table first instead of guessing the range.
24
- 2. It looks at **procedure only**, from the starting point in 1 to the version's last commit: whether each merge had the user's instruction and how it was merged; the CI and release records; the release documents; and whether the records are complete — the user's decisions on the first audit, waivers, the spec's adjustment record, the reason line of each PR that went without a first audit.
25
- 3. It does not tell anyone to fix anything: it lists what is handed to the retro, with each known acceptance apart. The PM writes the answer under `## 2차 감사` and, beneath it, the SHA table under `### SHA 대응`. It has no user-decision section: the retro reads it, and what the user decides there goes under `### 회고에서의 처리`. The record is committed with the retro's commits, in one PR. That closing PR — this record, the retro's changes — is audited by neither audit.
26
-
27
- ## 3. Delegation
28
- Check `.loctx/delegation.local.md` if it exists, otherwise the delegation table in AGENTS.md. If the role group named here has a model, hand it the work with the list of files and decisions it needs and wait for its report; otherwise do it yourself. Read-heavy work (research, large log summaries, review) or urgent parallel work on independent units may go to subagents of your own model. A role never calls another model; it returns to you. Always keep the request sent to another model and its final answer in .loctx/reports/<version>/ as they came, when you get them; they are deleted after the retro. The audit never runs inside the working conversation.
29
-
30
- ## 4. Files and lifetime
31
- - `.agents/audit/<version>.md` — one file per version with both audits; committed, kept.
32
- - `.loctx/reports/<version>/` PR and CI records, and the audit run's answer as it came — deleted after the retro, once summarised in the audit record.
33
- - `.loctx/reports/gates/<tree>.log` — written by the hooks and by the PM before each audit; deleted in the retro.
34
-
35
- ## 5. Next
36
- After the first audit: `merge` (the merge itself). After the second: `retro`.
37
-
38
- ## 6. Stop and ask
39
- - A passing audit does not vouch for direction or code quality; say so in the report.
9
+ Run this only when a person asks for it. The audit is optional and looks at risk only: it does not judge
10
+ the procedure, the direction or the quality of the code.
11
+
12
+ ## What to do
13
+ 1. Agree with the person on the range (`<base>..<head>`, or a pull request) and the model. The audit runs in
14
+ a fresh run of your own model or of a model the person picks; the `auditor` in the delegation table, if
15
+ one is set, is the recommended model.
16
+ 2. Collect the records into `.loctx/reports/<version>/`, as the tools print them and unedited: the spec and
17
+ plans, `git log` of the range, the gate logs (`.loctx/reports/gates/`), and the pull request and CI
18
+ records (for example `gh pr view <n> --json number,headRefOid,body` and `gh pr checks <n>`).
19
+ 3. Hand the auditor the paths of those records and `.agents/harness/policy/common-red-lines.yaml`. It reads
20
+ only them, never this conversation, runs read-only and without a network, and returns its record in the
21
+ form of `.agents/harness/templates/audit.md`.
22
+ 4. For each risk it gives a verdict — none found, found, or cannot confirm (no record to show it) — with
23
+ the evidence paths, and for what it found, what to fix:
24
+ - **secrets**: secret files or keys in the diff or the history;
25
+ - **red lines**: anything in `common-red-lines.yaml`;
26
+ - **irreversible changes**: migrations, data or production changes, deletions, force pushes, tags;
27
+ - **unverified checks**: a pass with no raw output, a gate that did not run, red or missing CI.
28
+ 5. Write the answer unchanged to `.agents/audit/<version>.md` (append when the file exists), commit it on a
29
+ branch, and report to the person. What to fix is the person's to decide.
30
+
31
+ ## Keep in mind
32
+ - A generated file a person edited by hand is not a finding; `reins update` shows drift.
33
+ - A passing audit does not vouch for the direction or the quality of the code; say so in the report.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: gates
3
+ description: Designs and tidies the project's gates with the user — which checks run, for which areas and at which hook stage — proposing what to take out before what to add, and changes .agents/harness/gates.yaml in a commit of its own. Use when the user wants to change the gates, a gate is slow, always fails or runs for nothing, or the hooks run too much or too little.
4
+ ---
5
+
6
+ # gates
7
+
8
+ The gates are the project's own checks. `.agents/harness/run-gates.sh` reads `.agents/harness/gates.yaml` each
9
+ time a hook runs it; the user decides what is in that file, with you.
10
+
11
+ ## How gates.yaml is read
12
+ - `areas:` names path globs from the repository root: `*` stays within a directory, `**` crosses them, `?` is
13
+ one character. Quote a glob that starts with `*` (`"*.md"`).
14
+ - A gate's `areas:` lists area names. A gate without `areas` always runs. `on:` lists the hook stages it runs
15
+ at (`pre-commit`, `pre-push`); without `on` it runs at every stage.
16
+ - At `pre-commit` and `pre-push` the script works out the changed files (the staged files; the pushed commits)
17
+ and runs a gate only when a changed file is in one of its areas. When it cannot tell, every area counts.
18
+ Any other stage (`manual`, `ci`, `audit`, …) runs every required gate. The full check belongs to CI.
19
+ - Block style only: lists as `- item` lines, no `{ }` or `[ ]`. Another shape stops the script before any gate
20
+ runs. `optional: true` keeps a gate out of the hooks.
21
+ - Each run's log (`.loctx/reports/gates/<tree>.log`) says which gates ran, which were skipped and why.
22
+
23
+ ## Procedure
24
+ 1. Read `gates.yaml`, the scripts and targets the gates call, the CI workflows, and the recent gate logs. If
25
+ the user ran `reins config gates --refresh`, read `.loctx/gates-refresh.md`; you never run reins yourself.
26
+ 2. Propose what to take out or tidy first, each with its evidence: a gate that always fails, one that is slow
27
+ for what it catches, two that run the same thing (or one another script already runs), one whose script or
28
+ target is gone, an area no gate names, a gate that runs for areas it does not check.
29
+ 3. Then propose what to add or narrow: areas for a gate that runs for every change, a slow gate moved to
30
+ `pre-push`, a check CI runs that the hooks miss. Narrowing a gate means it runs less: say what would no
31
+ longer be checked before the commit and where it is still checked.
32
+ 4. A gate that fails: show the failure and ask the user before you change the gate or the code it checks.
33
+ Never weaken, skip or delete a failing gate to get a commit through.
34
+ 5. Apply what the user accepts to `gates.yaml` and nothing else, in a commit of its own
35
+ (`chore(gates): …`) that names what changed and why, so the user can read it alone. Run
36
+ `sh .agents/harness/run-gates.sh manual` once and give the log's path.
37
+
38
+ ## Never
39
+ - Edit `.agents/harness/run-gates.sh` or the hook files: reins writes them.
40
+ - Change `gates.yaml` in the same commit as other work, or without the user's word.
41
+ - Narrow an area or a stage so that a check you are about to fail does not run.
@@ -1,32 +1,43 @@
1
1
  ---
2
2
  name: implement
3
- description: Implement the spec's work units in order, committing at meaningful units, and fill the self-review table. Use when the spec is accepted, or the user says implement or continue.
3
+ description: Builds what a confirmed plan says, the way the person asked (directly, with subagents, through another vendor's model, in parallel), commits at meaningful units, pushes the work branch, opens the pull request and writes the completion report; also handles the fast lane for small fixes and changes a person made by hand. Use when a plan is agreed, or the person asks for a fix or to continue.
4
4
  ---
5
5
 
6
6
  # implement
7
7
 
8
- ## 1. When
9
- The spec is accepted and has open work units.
8
+ If `references/procedure.md` sits next to this file, read it for the step-by-step procedure.
10
9
 
11
- ## 2. Procedure
12
- 1. When work starts, check whether `.loctx/delegation.local.md` exists; if it does, open it before anything else and use its table. Work on a feature branch (`type/topic`), never the default branch.
13
- 2. Take the next open work unit. Implement it so the requirement holds everywhere it applies — never to pass.
14
- 3. Run the project's gates (`.agents/harness/gates.yaml`; the hooks run them too). Keep the raw output under `.loctx/reports/<version>/`.
15
- 4. Commit at meaningful units: each commit is a point you can revert or reset to without taking other working work or features with it. One work unit may take several commits (implementation, review fixes); small units that may be reverted together may share one; never mix unrelated work in one commit. Adding, dropping or rescoping a work unit is a change of the spec: stop, change the spec with the reason, and get the user's 진행 or 수정 on the summary. Anything smaller is an adjustment — another method inside the same unit, a small fix that a review, an audit or the check of an rc asks for, another order of the units, a change with a similar precedent in `.agents/knowledge/` or history: go on, record it in the spec's adjustment record as `- A-n (date, W-n) what · why · commit`, and list the adjustments in the report at the end of the flow. If you cannot tell which it is, stop and ask.
16
- 5. Commit: `type(scope): title` naming the spec items (S-n, W-n); a commit that makes an adjustment names its `A-n`. Tick the work unit in `spec.md` with the commit.
17
- 6. When the plan turns out wrong, update the intent or spec in the same commit, or stop and ask.
10
+ ## What to do
11
+ 1. Work on a branch `type/topic` taken from a freshly pulled default branch; never commit on the default
12
+ branch.
13
+ 2. Build the way the person said: yourself, with subagents, through a role in the delegation table, in
14
+ parallel. If they said nothing, follow the delegation table. Hand a role the files and decisions it
15
+ needs, and keep the request and its answer as they came under `.loctx/reports/<version>/`.
16
+ 3. Build so that each requirement holds everywhere it applies, never only so a check passes.
17
+ 4. Commit at meaningful units: each commit is a point you can revert to without taking other working
18
+ work with it. Name the spec items in the message (`R-n`, the plan). The hooks run the gates; never
19
+ bypass them (`--no-verify`) or hide a failing exit code.
20
+ 5. When the work departs from the plan, change the plan file, say so in one line, and go on. A departure
21
+ that leaves the spec goes back to the person first.
22
+ 6. Push the work branch and open the pull request. That is as far as you go: the person merges and
23
+ releases. A branch behind the default branch is rebased and pushed with
24
+ `git push --force-with-lease origin <branch>`, naming the branch.
25
+ 7. Get the first review (`review`), then write the completion report to the person and into the pull
26
+ request body: what changed; a short summary of the structure; where it departed from the plan;
27
+ verification results with the raw log paths; "fast lane" if it was one; the review table.
18
28
 
19
- ## 3. Delegation
20
- Check `.loctx/delegation.local.md` if it exists, otherwise the delegation table in AGENTS.md. If the role group named here has a model, hand it the work with the list of files and decisions it needs and wait for its report; otherwise do it yourself. Read-heavy work (research, large log summaries, review) or urgent parallel work on independent units may go to subagents of your own model. A role never calls another model; it returns to you. Always keep the request sent to another model and its final answer in .loctx/reports/<version>/ as they came, when you get them; they are deleted after the retro. Implementer (code, qa, doc) does the units when switched on; independent units may run in parallel; the code, tests and documents of one feature stay in one run.
29
+ ## The fast lane
30
+ A defect fix or a small change goes without a spec or a plan when it stays within one area of
31
+ `.agents/harness/gates.yaml` and touches no public entry point, schema, dependency or migration. There is
32
+ no size limit: you judge. It still gets the first review, and the completion report says "fast lane".
21
33
 
22
- ## 4. Files and lifetime
23
- - Commits — kept.
24
- - `.loctx/reports/<version>/` gate logs — deleted after the retro, once summarised.
34
+ ## Changes a person made
35
+ Before you build on code a person changed (their commits, or edits in the working tree), read the change.
36
+ If it is reasonable or its intent is visible, accept it and build on it. If it looks wrong or you cannot
37
+ tell what it is for, ask the person before you change or revert it.
25
38
 
26
- ## 5. Next
27
- `review`.
28
-
29
- ## 6. Stop and ask
30
- - Two failures in the same work unit: stop, find the cause (pl or advisor opinions by severity), or bring options to the user.
31
- - A work unit has to be added, dropped or rescoped: the spec changes and is approved first. A smaller adjustment does not stop the work (2.4); working across approved units that may be reverted together is fine.
32
- - A user who does not accept an adjustment when it is reported: treat it as a change of the spec — revert it or get it approved.
39
+ ## Stop and find the cause
40
+ - The same work failed twice; check output is empty or doubtful; a pass has no raw output behind it.
41
+ - An irreversible action (force push to the default branch or a tag, deleting a tag, data or production
42
+ changes) or a red line (`.agents/harness/policy/common-red-lines.yaml`): ask the person.
43
+ - When the person interrupts, write the resume point in `.loctx/history/<version>.md`.
@@ -0,0 +1,51 @@
1
+ # implement — step by step
2
+
3
+ For a model with a small context: one step at a time; keep a short running note of what you did.
4
+
5
+ ## Steps
6
+ 1. `git switch <default> && git pull`, then `git switch -c <type>/<topic>` (`feat/offline-export`).
7
+ 2. Read the agreed plan. Take its files in order. For each file: read it, change it, run the narrowest
8
+ check that covers it (one test file, the type check).
9
+ 3. Before each commit, ask: can this commit be reverted without breaking other work that already works?
10
+ If not, keep going until it can. Commit with `type(scope): title` and name the plan and `R-n`:
11
+ `feat(report): PDF export from the print renderer (spec 031 plan 1, R-1)`.
12
+ 4. Let the hooks run the gates. If a gate fails, read the output, fix the cause, commit again. Never pass
13
+ `--no-verify`, never pipe a check so its exit code is lost.
14
+ 5. If you have to do something the plan does not say, edit the plan file (`## 바꿀 파일과 순서`), and write
15
+ one line to the person: "Departing from plan 1: <what> because <why>."
16
+ 6. If the same thing fails twice for the same cause, stop and write down what you tried; ask for help.
17
+ 7. Run the plan's verification commands. Save each raw output to the path the plan names.
18
+ 8. `git push -u origin <type>/<topic>`, then open the pull request (for example `gh pr create`).
19
+ 9. Get the first review (the `review` skill). Fix what it says is Important.
20
+ 10. Write the completion report (format below) to the person and into the pull request body. Stop: the
21
+ person checks the report, merges and releases.
22
+
23
+ ## The completion report
24
+ ```markdown
25
+ ## What changed
26
+ - PDF export of a month's report (R-1, R-2).
27
+ ## Structure
28
+ - `src/report/print.ts` renders to bytes; `src/report/export.ts` saves them.
29
+ ## Departures from the plan
30
+ - Added `src/report/name.ts` for the file name (threat in plan 1), not in the file list.
31
+ ## Verification
32
+ - `pnpm test report`: 14 passed — `.loctx/reports/1.4.0/plan-1/test.log`
33
+ ## Review
34
+ | finding | fix | proof or re-review |
35
+ |---|---|---|
36
+ | Important: month 0 accepted (`export.ts:12`) | range check | `test/report/export.test.ts` "rejects month 0" passes |
37
+ ```
38
+ For a fast-lane change, put "fast lane" as the first line and skip "Departures from the plan".
39
+
40
+ ## Handing a unit to another model
41
+ When `implementer/code` (or `qa`, `doc`) has a model, send it one unit at a time:
42
+ ```markdown
43
+ # task: plan 1, steps 1-2
44
+ goal: <the plan's step, copied>
45
+ read: the agreed plan .agents/spec/031_offline-export/plan.md, src/report/print.ts
46
+ decisions: one month only; file names from digits only
47
+ do not: touch files outside the list, push, merge, change the gates
48
+ return: the commits made (hash, title), the commands run and their raw output paths, every guess marked "guess"
49
+ ```
50
+ Keep the task and the answer under `.loctx/reports/<version>/`. Check its commits yourself before the
51
+ next unit.
@@ -1,29 +1,38 @@
1
1
  ---
2
2
  name: intent
3
- description: Write the intent of one piece of work — the direction and the plan in the user's words — and record the user's approval. Use when the user starts work on a settled roadmap item that has no approved intent yet.
3
+ description: Sorts out an idea with the person — researches what is already there, objects or offers another option when the idea does not hold up, asks why, what, how and what it should end up as — and keeps it as a local note under .loctx/intent/; what the person settles goes into docs/ROADMAP.md. Use when the person talks about an idea, a problem or something they may want later.
4
4
  ---
5
5
 
6
6
  # intent
7
7
 
8
- ## 1. When
9
- A settled roadmap item has no approved intent, the user started this work, and the previous loop is closed (its retro is done). An intent added to the version in work belongs to the same loop. If the user asks for the next intent before the retro, record a waiver and write it.
8
+ An intent is a local note of one idea: what was asked, what you found, what was answered. It is not a
9
+ contract and nobody approves it. Many pile up; they are dropped or changed as the person thinks.
10
10
 
11
- ## 2. Procedure
12
- 1. When work starts, check whether `.loctx/delegation.local.md` exists; if it does, open it before anything else and use its table. Then create `.agents/intent/<NNN>_<slug>/intent.md` from `.agents/harness/templates/intent.md` (next free number).
13
- 2. Write it in the user's words: problem, desired result, **plan** (order of work), scope, constraints, open questions, not doing. Quote the user; mark your own interpretation as yours. Decisions you made go under "decided by agents" with the alternative and the reason.
14
- 3. Ask only the open questions the user must answer. For a large or abstract request, get opinions first (pl/discussion or advisor/committee, if switched on) and show where they differ.
15
- 4. Show the intent and ask for approval. When the user approves, add `{ role: user, by, at, words, rev }` to `approvals:` (quote the words; `rev` is the commit you showed), set `status: approved`, commit.
11
+ If `references/procedure.md` sits next to this file, read it for the step-by-step procedure.
16
12
 
17
- ## 3. Delegation
18
- Check `.loctx/delegation.local.md` if it exists, otherwise the delegation table in AGENTS.md. If the role group named here has a model, hand it the work with the list of files and decisions it needs and wait for its report; otherwise do it yourself. Read-heavy work (research, large log summaries, review) or urgent parallel work on independent units may go to subagents of your own model. A role never calls another model; it returns to you. Always keep the request sent to another model and its final answer in .loctx/reports/<version>/ as they came, when you get them; they are deleted after the retro. The intent itself is always written by the PM.
13
+ ## What to do
14
+ 1. Look before you ask. Read what touches the idea: the code, `docs/ROADMAP.md`, `.loctx/ROADMAP.local.md`,
15
+ the other notes in `.loctx/intent/`, the specs in `.agents/spec/`, `.agents/knowledge/`, and the decisions
16
+ in history (`grep -l 'decisions:.*<keyword>' .loctx/history/* .agents/knowledge/*`).
17
+ 2. Say what you found. If the idea does not hold up — it is already there, it conflicts with a recorded
18
+ decision, a smaller change gets the same result, it costs more than it brings — say so with the evidence
19
+ and offer another option. Do not raise again a proposal the person already rejected.
20
+ 3. Ask what the files cannot tell you, in one batch, each question with your proposed answer:
21
+ - why: the problem, and who has it;
22
+ - what: what changes for the person or the user of the project;
23
+ - how: the direction, when there is a choice;
24
+ - the end: what it should look like when it is done, and what is left out.
25
+ 4. Write the note to `.loctx/intent/<YYYY-MM-DD>_<slug>.md` from `.agents/harness/templates/intent.md`,
26
+ in the language of documents the person reads. Keep their words; mark your own reading as yours. Update
27
+ the same note as the talk goes on.
28
+ 5. Set `status:` as the person decides: `idea` while it is open, `adopted` when they settle it, `dropped`
29
+ when they let it go. Never delete a note yourself.
30
+ 6. When the person settles an idea, write it into `docs/ROADMAP.md` as a main change of the version it
31
+ belongs to (and into its other language edition, if the project keeps one). Only what they settled goes
32
+ there.
19
33
 
20
- ## 4. Files and lifetime
21
- - `intent.md` — committed, kept.
22
-
23
- ## 5. Next
24
- `spec`.
25
-
26
- ## 6. Stop and ask
27
- - Never record an approval the user did not give.
28
- - The user named a version, answered a question about the plan, or a release is waiting for them: none of these starts an intent. Write the idea to the roadmap and wait for the user to start the work.
29
- - The user tells you to skip a step: record it in `waivers:` (`{ step, words, at, scope: once }`) now; it applies once.
34
+ ## Keep in mind
35
+ - Naming a version says where an idea belongs; it does not start the work.
36
+ - `.loctx/` is not committed. The agreed gist reaches others through the spec's head (`spec`).
37
+ - A large or unclear idea: get opinions given without seeing each other (`pl/discussion` or
38
+ `advisor/committee` in the delegation table, if they have a model) and show where they differ.
@@ -0,0 +1,60 @@
1
+ # intent — step by step
2
+
3
+ For a model with a small context: do one step at a time and write down what you found before the next.
4
+
5
+ ## Steps
6
+ 1. Name the idea in one line, in the person's words. Pick a slug: two or three lowercase words joined by
7
+ hyphens (`offline-export`).
8
+ 2. Search before you ask. Run, and keep only the lines that matter:
9
+ - `ls .loctx/intent/` — is there a note on the same idea? If so, update that note instead of a new one.
10
+ - `grep -n -i '<keyword>' docs/ROADMAP.md .loctx/ROADMAP.local.md`
11
+ - `grep -l 'decisions:.*<keyword>' .loctx/history/* .agents/knowledge/*`
12
+ - `grep -rl '<keyword>' .agents/spec/` and the code paths the idea touches.
13
+ 3. Judge the idea against what you found. Write one of:
14
+ - "holds up" — nothing contradicts it;
15
+ - "already there" — name the file;
16
+ - "conflicts with <decision file>" — quote the decision;
17
+ - "cheaper way" — describe the other option and what it gives up.
18
+ If it is not "holds up", tell the person and offer the other option before you ask anything else.
19
+ 4. Draft the questions the files did not answer. At most one per heading, each with a proposed answer:
20
+ why, what, how, the end (what done looks like, what is left out).
21
+ 5. Ask them in one message. Wait for the answers.
22
+ 6. Write the note (format below). Use today's date in the file name.
23
+ 7. When the person settles it: set `status: adopted`, add one line under the version in
24
+ `docs/ROADMAP.md` (and the other language edition, if there is one), and say which line you added.
25
+ When they let it go: set `status: dropped`. Never delete a note.
26
+
27
+ ## The note: `.loctx/intent/<YYYY-MM-DD>_<slug>.md`
28
+ ```markdown
29
+ ---
30
+ slug: offline-export
31
+ date: 2026-12-01
32
+ status: idea
33
+ ---
34
+ ## 아이디어
35
+ Export the month's report without a network. (the person, 2026-12-01)
36
+ ## 왜
37
+ Field staff have no signal on site. (the person)
38
+ ## 무엇을, 어떻게, 결국 어떻게 되어야 하나
39
+ - 무엇: a "save as file" button on the report screen.
40
+ - 어떻게: my reading — reuse the PDF renderer of the print view.
41
+ - 결국: the same report as online, opened from the phone's files.
42
+ ## 조사한 것
43
+ - docs/ROADMAP.md: no export item yet.
44
+ - .agents/knowledge/2026-10-02_no-native-plugins.md: no native plugins — the renderer must stay in JS.
45
+ ## 다른 안
46
+ - Cache the last report in the app instead: less work, but no file to share.
47
+ ## 질문과 답
48
+ - Q: one month or a chosen range? — A: one month for now. (the person)
49
+ ```
50
+
51
+ ## Handing the research to another model
52
+ When the delegation table gives `executor/researcher` a model, send it a task like this and keep the task
53
+ and the answer under `.loctx/reports/<version>/`:
54
+ ```markdown
55
+ # task: research for intent offline-export
56
+ goal: find what already exists about exporting reports without a network
57
+ read: docs/ROADMAP.md, .loctx/ROADMAP.local.md, .agents/knowledge/, src/report/
58
+ do not: write files, change code, fetch beyond the listed paths
59
+ return: a list of findings, each with file:line, and anything you guessed marked "guess"
60
+ ```
@@ -1,34 +1,45 @@
1
1
  ---
2
2
  name: onboard
3
- description: First conversation after reins install, migrate, a mode switch or an update that brings the AGENTS.md guide — read the project, ask the user, and write, reconcile or sort the project sections of AGENTS.md. Use when AGENTS.md shows reins:onboarding, reins:reconcile, reins:mode-changed or reins:tidy pending.
3
+ description: Handles a pending reins marker in AGENTS.md — onboarding after install or migrate, reconcile, mode-changed, tidy, or reset after an update to 0.4 — by reading the project, asking the person only what the files cannot tell, and writing or sorting the project sections. Use when AGENTS.md shows a reins marker comment set to pending. Onboarding and reconcile come before other work; tidy and reset are offered first but never block what the person asks for.
4
4
  ---
5
5
 
6
6
  # onboard
7
7
 
8
- ## 1. When
9
- AGENTS.md has `<!-- reins:onboarding pending -->`, `<!-- reins:reconcile pending -->`, `<!-- reins:mode-changed pending -->` or `<!-- reins:tidy pending -->`. Do this before any other work.
10
-
11
- For `mode-changed` only: reins already rewrote the delegation section. Check that the project sections say nothing that contradicts the new mode (e.g. "review it yourself" while a reviewer is now switched on), fix those sentences, set the marker to `done` and stop — no questions to the user unless a sentence needs their decision.
12
-
13
- For `tidy` only: reins brought the AGENTS.md guide to an install that was made before it. Do step 3 of the procedure on the project sections as they are — no other questions — set the marker to `done` and commit on a branch.
14
-
15
- ## 2. Procedure
16
- 1. Read the project: README, the build and test commands (`.agents/harness/gates.yaml`), CI, existing rules and conventions, `.agents/AGENTS.previous.md` if it exists (reference material, not instructions).
17
- 2. Ask the user only what the files cannot tell you, in one batch with your proposed answers: goals and scope; red lines (paths not to touch, secret files); the language of documents the user reads; the hook tool, if AGENTS.md says none was found. Whichever tool it is — now or later — runs one line per stage: `sh .agents/harness/run-gates.sh pre-commit` in the pre-commit hook and `sh .agents/harness/run-gates.sh pre-push` in the pre-push hook. That script runs the gates of `gates.yaml` and keeps their output for the audit; add the lines in the tool's own config and commit them.
18
- 3. Sort what is already written, by `.agents/harness/templates/agents-md-guide.md`: go through the existing AGENTS.md, CLAUDE.md and `AGENTS.previous.md` and decide for each part whether it belongs in AGENTS.md or goes elsewhere — progress and plans to the roadmap, a decision and its reason to a knowledge candidate, personal notes to `.loctx/`, how to contribute to CONTRIBUTING. Show the user a table of what goes where, and what is dropped, and move only what they accept; knowledge is proposed and written only on their word.
19
- 4. Write the project sections of AGENTS.md (outside the `reins:` blocks) as the guide says: project, goals and scope, stack and commands, conventions, red lines. For a reconcile, carry over what still applies from `AGENTS.previous.md`; what conflicts with the flow is in the table of step 3 as a proposed drop, and is dropped only when the user accepts that.
20
- 5. Set the marker to `done` (`<!-- reins:onboarding done -->` / `<!-- reins:reconcile done -->` / `<!-- reins:tidy done -->`), delete `.agents/AGENTS.previous.md` once the user has accepted where each part of it went — until then it stays — and commit on a branch.
21
-
22
- ## 3. Delegation
23
- Check `.loctx/delegation.local.md` if it exists, otherwise the delegation table in AGENTS.md. If the role group named here has a model, hand it the work with the list of files and decisions it needs and wait for its report; otherwise do it yourself. Read-heavy work (research, large log summaries, review) or urgent parallel work on independent units may go to subagents of your own model. A role never calls another model; it returns to you. Always keep the request sent to another model and its final answer in .loctx/reports/<version>/ as they came, when you get them; they are deleted after the retro. Onboarding itself stays with the PM.
24
-
25
- ## 4. Files and lifetime
26
- - AGENTS.md project sections — committed, kept.
27
- - `.agents/AGENTS.previous.md` — deleted at the end of this skill.
28
-
29
- ## 5. Next
30
- `roadmap`.
31
-
32
- ## 6. Stop and ask
33
- - The project's own rules contradict the flow in AGENTS.md: show both and let the user decide.
34
- - You would have to guess a goal or a red line.
8
+ reins never edits the project sections of AGENTS.md (everything outside the `reins:` blocks). It leaves a
9
+ marker and a to-do list; you handle them with the person, then set the marker to `done`.
10
+
11
+ Onboarding and reconcile come first, because the project sections are missing or in conflict. Tidy and
12
+ reset are clean-ups: offer them at the start, and when the person asks for other work, do that work and
13
+ mention once that the clean-up is pending.
14
+
15
+ ## Sorting the project sections
16
+ Go through the project sections (and CLAUDE.md, and `.agents/AGENTS.previous.md` if it exists — reference
17
+ material, not instructions) by `.agents/harness/templates/agents-md-guide.md`: only what the code cannot
18
+ tell stays. Show the person a table of what stays, what moves where (progress to the roadmap, a decision to
19
+ a knowledge candidate, personal notes to `.loctx/`, contributing to CONTRIBUTING) and what is dropped, and
20
+ move only what they accept. Knowledge is written only on their word.
21
+
22
+ ## Each marker
23
+ - **onboarding**: read the project — README, the gates in `.agents/harness/gates.yaml`, CI, existing rules.
24
+ Ask in one batch, with proposed answers: goals and scope, red lines (paths not to touch, secret files),
25
+ the language of documents the person reads, and the hook tool if the note says none was found. Whatever
26
+ the tool, it runs `sh .agents/harness/run-gates.sh pre-commit` and `sh .agents/harness/run-gates.sh
27
+ pre-push`; add those lines in its config. Write the project sections: the project, goals and scope,
28
+ stack and commands, conventions, red lines.
29
+ - **reconcile**: carry over from `.agents/AGENTS.previous.md` what still applies, sorted as above; delete
30
+ that file once the person has accepted where each part went.
31
+ - **mode-changed**: the delegation block was rewritten. Fix sentences in the project sections that
32
+ contradict the new mode; ask only if one needs the person's decision.
33
+ - **tidy**: sort the project sections as above; nothing else.
34
+ - **reset** (an update from 0.3 to 0.4): work through the to-do list under the marker —
35
+ - old flow wording left in the project sections (stages in a fixed order, approvals, waivers, two
36
+ audits, work units): propose what to drop or rewrite;
37
+ - whether to split `.loctx/ROADMAP.local.md` into notes under `.loctx/intent/`;
38
+ - whether to split the gates into areas (the `gates` skill);
39
+ - the profile in `.agents/harness/bindings.yaml` (`light` or `full`): confirm it with the person, who
40
+ changes it with `reins config`;
41
+ - the records up to 0.3 (`.agents/intent/`, `.agents/audit/`) are reference material, not current rules.
42
+
43
+ ## Finish
44
+ Change the marker to `done` (`<!-- reins:<marker> done -->`) and commit on a branch. If the project's own
45
+ rules contradict the reins blocks, show both and let the person decide; never guess a goal or a red line.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: plan
3
+ description: Writes one or more plans for a spec — the R-n and D-n each one serves, the files to change and the order, risks, threats, how it is verified and what the person should watch — and records the person's confirmation as one line, agreed with their words. Use when a spec, or part of it, is ready to be built.
4
+ ---
5
+
6
+ # plan
7
+
8
+ Confirming the plan is one of the five things a person does. Nothing is built from a plan they have not
9
+ confirmed; after that, the work goes on without asking.
10
+
11
+ If `references/procedure.md` sits next to this file, read it for the step-by-step procedure.
12
+
13
+ ## What to do
14
+ 1. Read the spec and what the work touches. Cut the work into plans that can each be reviewed as one pull
15
+ request: one plan for a small spec, several when parts can be built and merged apart.
16
+ 2. Write each plan next to its spec, as `plan.md` or `plan-<n>.md`, from
17
+ `.agents/harness/templates/plan.md`, in the language of documents the person reads:
18
+ - `from:` the `R-n` and `D-n` it serves;
19
+ - the files to change, in order;
20
+ - risks: what could break, and how you will notice;
21
+ - threats: how the change could be misused or bypassed;
22
+ - verification: the commands to run, what passing looks like, where the raw output goes;
23
+ - what the person should watch in the result.
24
+ 3. A reviewer may check the plans against the spec first (`pl/plan-reviewer` or `pl/qa-plan-reviewer` in
25
+ the delegation table, if they have a model).
26
+ 4. Show the person a short summary of each plan and ask them to confirm it.
27
+ 5. When they confirm, write their words into the plan's front matter as
28
+ `agreed: { at: <date>, words: "<what they said>" }`, set the spec to `status: in-progress`, and commit.
29
+ Never write words the person did not say.
30
+ 6. When they ask for changes, change the plan and ask again.
31
+
32
+ ## Keep in mind
33
+ - A defect fix or a small change can skip the spec and the plan (the fast lane in `implement`).
34
+ - Departing from a confirmed plan while building is allowed: `implement` says so and gathers it in the
35
+ completion report. A change that moves the work outside the spec goes back to the person.
@@ -0,0 +1,52 @@
1
+ # plan — step by step
2
+
3
+ For a model with a small context: do one step at a time and write down what you found before the next.
4
+
5
+ ## Steps
6
+ 1. Read the spec. List its `R-n` and `D-n`.
7
+ 2. Decide how many plans. One plan is one pull request: it can be reviewed on its own and merged without
8
+ the others breaking the build. A small spec has one plan (`plan.md`); otherwise `plan-1.md`,
9
+ `plan-2.md`, … in the order they are built.
10
+ 3. For each plan, write `from:` — the `R-n` and `D-n` it serves. Every `R-n` must be in some plan; say so
11
+ if one is not.
12
+ 4. List the files to change, in order, each with one line on what changes. Read each file first; do not
13
+ list a file you have not opened.
14
+ 5. Write the risks: what could break, and how you would notice (a test, a log, a command).
15
+ 6. Write the threats: how the change could be misused or bypassed, and what limits it.
16
+ 7. Write the verification: the exact commands, what passing looks like, and where the raw output goes
17
+ (`.loctx/reports/<version>/`). A check without a command is not a check.
18
+ 8. Write what the person should watch: the two or three places where your judgement could be wrong.
19
+ 9. Show the person a summary of each plan (three to five lines) and ask: "Is this plan right?"
20
+ 10. When they confirm, add `agreed: { at: <today>, words: "<their words, exactly>" }` to the front matter,
21
+ set the spec's `status: in-progress`, and commit. If they ask for changes, change the plan and ask
22
+ again. Never write `agreed` from your own words.
23
+
24
+ ## The plan: `.agents/spec/<NNN>_<slug>/plan.md`
25
+ ```markdown
26
+ ---
27
+ spec: "031"
28
+ plan: 1
29
+ title: PDF export from the print renderer
30
+ from: R-1, R-2, D-1
31
+ agreed: { at: 2026-12-02, words: "좋아요, 진행" }
32
+ ---
33
+ # plan 1 — PDF export from the print renderer
34
+
35
+ ## 바꿀 파일과 순서
36
+ 1. `src/report/print.ts`: split rendering from the print call so it can return bytes.
37
+ 2. `src/report/export.ts` (new): save the bytes as `<month>.pdf` through the file API.
38
+ 3. `test/report/export.test.ts` (new): the figures of a fixture month match the online report.
39
+ ## 위험
40
+ - The print view changes too: the existing print test must still pass.
41
+ ## 위협
42
+ - A crafted month name writes outside the download folder: the name is built from digits only.
43
+ ## 검증
44
+ - `pnpm test report` passes; raw output to `.loctx/reports/1.4.0/plan-1/test.log`.
45
+ ## 사람이 볼 점
46
+ - Whether the file name format is what the office expects.
47
+ ```
48
+
49
+ ## Handing a review of the plan to another model
50
+ When `pl/plan-reviewer` has a model, send it the spec and the plan, and ask: "Does every R-n have a plan?
51
+ Does each verification have a command? List gaps with the line they concern." Keep the task and the
52
+ answer under `.loctx/reports/<version>/`.
@@ -15,10 +15,10 @@ If either still starts with `${` (unsubstituted — this copy lives in a project
15
15
  1. **Look.** Is there an `.agents/harness/` (reins installed), an `.ai/` workspace, or an older harness
16
16
  (`.claude/commands/`, many skills)? Say which.
17
17
  2. **Show the user the command** for their terminal, with the version pinned to this skill's release:
18
- - nothing installed: `npx @bluenyang/reins@0.3.4 install --mode <mode>`
19
- - an older harness or `.ai/`: `npx @bluenyang/reins@0.3.4 migrate --dry-run`, then without `--dry-run`
20
- - reins already installed: `npx @bluenyang/reins@0.3.4 update`
21
- - to change models, the mode or the audit later: `npx @bluenyang/reins@0.3.4 config` (the user can run `reins config`)
18
+ - nothing installed: `npx @bluenyang/reins@0.4.0-rc.2 install --mode <mode>`
19
+ - an older harness or `.ai/`: `npx @bluenyang/reins@0.4.0-rc.2 migrate --dry-run`, then without `--dry-run`
20
+ - reins already installed: `npx @bluenyang/reins@0.4.0-rc.2 update`
21
+ - to change models, the mode, the profile or the recommended audit model later: `npx @bluenyang/reins@0.4.0-rc.2 config` (the user can run `reins config`)
22
22
  Run it yourself only when the user asks you to, and only that command.
23
23
  3. **Explain what follows.** reins writes AGENTS.md blocks with an onboarding note; the next conversation starts
24
24
  with the `onboard` skill, which reads the project, asks the user, and writes AGENTS.md's project sections.