@bluenyang/reins 0.3.0-rc.1 → 0.3.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@ knowledge lost in gitignored space, copies that drift apart. The full list is in
15
15
 
16
16
  ## Status
17
17
 
18
- **0.3.0-rc.1 is the release candidate** (intent 019): `npx @bluenyang/reins@0.3.0-rc.1`. 0.2.0, the latest stable, still installs the older design, in which skills and hooks called `npx @bluenyang/reins` during work; 0.3 removes that, and `reins update` moves a 0.1.x or 0.2.0 install over. What changed in each version is in [CHANGELOG.md](CHANGELOG.md); what comes next is in the [roadmap](docs/ROADMAP.md).
18
+ **0.3.0-rc.3 is the release candidate** (intents 019, 020): `npx @bluenyang/reins@0.3.0-rc.3`. 0.2.0, the latest stable, still installs the older design, in which skills and hooks called `npx @bluenyang/reins` during work; 0.3 removes that, and `reins update` moves a 0.1.x or 0.2.0 install over. What changed in each version is in [CHANGELOG.md](CHANGELOG.md); what comes next is in the [roadmap](docs/ROADMAP.md).
19
19
 
20
20
  ## How it works
21
21
 
@@ -1,41 +1,65 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { parse } from 'yaml';
4
+ import { packageHarness } from '../lib/upstream.js';
1
5
  import { CONFIRMED_MODELS, listModels, vendorOf, } from '../lib/detect.js';
2
6
  import { GROUP_ROLES, GROUPS, effectiveBindings, readLocalBindings, readTeam, } from '../lib/bindings.js';
3
7
  import { BACK, EXIT } from '../lib/prompter.js';
4
8
  import { configureBindings } from './configure.js';
9
+ import { LOCAL_DELEGATION_NOTE } from '../lib/local-delegation.js';
5
10
  const LISTER_CLI = { google: 'agy', cursor: 'cursor-agent' };
6
11
  /** When switching a group on pays for itself (design §9; Anthropic 2026-10-22). */
7
12
  export const WHEN_TO_SWITCH_ON = 'switch a group on when the PM context degrades, independent work can run in parallel, or review/audit should run on another model';
8
13
  const show = (b) => (b ? `${b.vendor} ${b.model}` : 'off (PM)');
9
14
  /** One line per group: `pl claude claude-sonnet-5-5, openai gpt-6.1-terra +1 role`. */
10
- export function groupLine(group, spec) {
15
+ export function groupLine(group, spec, mode) {
11
16
  if (!spec)
12
17
  return `${group.padEnd(12)} off — the PM does it`;
18
+ const tag = mode === 'multi'
19
+ ? ''
20
+ : group === 'auditor'
21
+ ? ' (recommended audit model)'
22
+ : ' (used in multi only)';
13
23
  const models = spec.models?.length
14
24
  ? spec.models.map(show).join(', ')
15
25
  : spec.vendor && spec.model
16
26
  ? show({ vendor: spec.vendor, model: spec.model })
17
27
  : '—';
18
28
  const n = Object.keys(spec.roles ?? {}).length;
19
- return `${group.padEnd(12)} ${models}${n ? ` +${n} role${n > 1 ? 's' : ''}` : ''}`;
29
+ return `${group.padEnd(12)} ${models}${n ? ` +${n} role${n > 1 ? 's' : ''}` : ''}${tag}`;
20
30
  }
21
- /** Models of `vendor` already known here: confirmed ones and those in the current files. */
31
+ /** The packaged list of known models per vendor (`harness/models.yaml`, spec ST-2). */
32
+ export function catalogue() {
33
+ const p = join(packageHarness(), 'models.yaml');
34
+ if (!existsSync(p))
35
+ return {};
36
+ const doc = parse(readFileSync(p, 'utf8'));
37
+ return doc?.vendors ?? {};
38
+ }
39
+ /** Models of `vendor` known here: the packaged list, confirmed ones, and the current files' bindings of that vendor. */
22
40
  export function knownModels(vendor, current) {
23
- const out = [...CONFIRMED_MODELS];
41
+ const out = [
42
+ ...(catalogue()[vendor] ?? []),
43
+ ...[...CONFIRMED_MODELS].filter((m) => vendorOf(m) === vendor),
44
+ ];
45
+ const take = (b) => {
46
+ if (b && b.vendor === vendor)
47
+ out.push(b.model);
48
+ };
24
49
  for (const d of current) {
25
- if (d.default)
26
- out.push(d.default.model);
50
+ take(d.default);
27
51
  for (const g of Object.values(d.groups ?? {})) {
28
52
  if (!g)
29
53
  continue;
30
- if (g.model)
31
- out.push(g.model);
54
+ if (g.vendor && g.model)
55
+ take({ vendor: g.vendor, model: g.model });
32
56
  for (const m of g.models ?? [])
33
- out.push(m.model);
57
+ take(m);
34
58
  for (const r of Object.values(g.roles ?? {}))
35
- out.push(r.model);
59
+ take(r);
36
60
  }
37
61
  }
38
- return [...new Set(out)].filter((m) => vendorOf(m) === vendor || !vendorOf(m));
62
+ return [...new Set(out)];
39
63
  }
40
64
  /**
41
65
  * The models-and-roles screen (design §9): scope, the PM's model, each group (off, one model, several for
@@ -55,6 +79,8 @@ export async function modelsScreen(o) {
55
79
  prompter.note(`${label}: written to .loctx/bindings.local.yaml (this user only)`);
56
80
  else
57
81
  prompter.note(`${label}: written to .agents/harness/bindings.yaml, generated files and AGENTS.md refreshed — commit them`);
82
+ if (r.localDelegation)
83
+ prompter.note(LOCAL_DELEGATION_NOTE(r.localDelegation));
58
84
  };
59
85
  for (;;) {
60
86
  const doc = effectiveBindings(root);
@@ -62,16 +88,19 @@ export async function modelsScreen(o) {
62
88
  prompter.note('no version-2 bindings.yaml here — run `reins install` or `reins update`');
63
89
  return 'back';
64
90
  }
65
- prompter.note(WHEN_TO_SWITCH_ON);
91
+ const single = doc.mode !== 'multi';
92
+ prompter.note(single
93
+ ? 'single: the PM does every role; the assignments below are used only after switching to multi (the auditor model is the recommended audit model either way)'
94
+ : WHEN_TO_SWITCH_ON);
66
95
  const options = [
67
96
  { value: 'back', label: '< Configuration' },
68
97
  { value: 'exit', label: 'exit' },
69
98
  {
70
99
  value: 'scope',
71
- label: `scope: ${scope === 'local' ? 'local | global' : 'global | local'}`,
100
+ label: `scope: ${scope === 'local' ? 'local | project' : 'project | local'}`,
72
101
  },
73
102
  { value: 'default', label: `${'PM'.padEnd(12)} ${show(doc.default)}` },
74
- ...GROUPS.map((g) => ({ value: g, label: groupLine(g, doc.groups?.[g]) })),
103
+ ...GROUPS.map((g) => ({ value: g, label: groupLine(g, doc.groups?.[g], doc.mode) })),
75
104
  ];
76
105
  const v = await prompter.select({
77
106
  message: `Models and roles (mode: ${doc.mode ?? 'single'})`,
@@ -87,7 +116,11 @@ export async function modelsScreen(o) {
87
116
  initial: scope,
88
117
  options: [
89
118
  { value: 'local', label: 'local', hint: '.loctx/bindings.local.yaml, this user only' },
90
- { value: 'global', label: 'global', hint: 'bindings.yaml, committed, regenerates files' },
119
+ {
120
+ value: 'project',
121
+ label: 'project',
122
+ hint: 'the team: .agents/harness/bindings.yaml, committed, regenerates files',
123
+ },
91
124
  ],
92
125
  });
93
126
  if (s === EXIT)
@@ -104,17 +137,17 @@ export async function modelsScreen(o) {
104
137
  await write({ set: [`default=${b.vendor}:${b.model}`] }, `PM → ${show(b)}`);
105
138
  continue;
106
139
  }
107
- const r = await groupScreen(o, v, doc.groups?.[v], write);
140
+ const r = await groupScreen(o, v, doc.groups?.[v], write, doc.mode);
108
141
  if (r === 'exit')
109
142
  return 'exit';
110
143
  }
111
144
  }
112
- async function groupScreen(o, group, spec, write) {
145
+ async function groupScreen(o, group, spec, write, mode) {
113
146
  const { prompter } = o;
114
147
  const many = group === 'pl' || group === 'advisor';
115
148
  const roles = GROUP_ROLES[group];
116
149
  const pick = await prompter.select({
117
- message: `${group}: ${groupLine(group, spec).slice(12).trim()}`,
150
+ message: `${group}: ${groupLine(group, spec, mode).slice(12).trim()}`,
118
151
  options: [
119
152
  { value: 'back', label: '< back' },
120
153
  { value: 'one', label: many ? 'one model' : 'set the model' },
@@ -1,8 +1,9 @@
1
1
  import { effectiveBindings, resolveRoles } from '../lib/bindings.js';
2
2
  import { newModelCache, vendors } from '../lib/detect.js';
3
3
  import { repoRoot } from '../lib/git.js';
4
- import { modelsScreen } from './config-models.js';
4
+ import { groupLine, modelsScreen } from './config-models.js';
5
5
  import { configureBindings } from './configure.js';
6
+ import { LOCAL_DELEGATION_NOTE } from '../lib/local-delegation.js';
6
7
  import { clackPrompter, isInteractive } from '../lib/prompter.js';
7
8
  export const CONFIG_HINT = 'change with: reins config bindings --set <default|group|group.role>=<model> [--local] (see: reins config bindings --help)';
8
9
  /** The effective settings as text: mode, audit, the PM, each role that is on. */
@@ -15,6 +16,13 @@ export function formatBindings(doc) {
15
16
  const on = resolveRoles(doc).filter((r) => r.on);
16
17
  if (on.length === 0)
17
18
  lines.push(' every role: the PM');
19
+ if (doc.mode !== 'multi') {
20
+ const kept = Object.entries(doc.groups ?? {}).filter(([, s]) => s && JSON.stringify(s) !== '{}');
21
+ for (const [g, s] of kept)
22
+ lines.push(` ${g.padEnd(26)} ${groupLine(g, s, doc.mode)
23
+ .slice(12)
24
+ .trim()}`);
25
+ }
18
26
  for (const r of on)
19
27
  lines.push(` ${`${r.group}/${r.role}`.padEnd(26)} ${r.models.map((b) => `${b.vendor} ${b.model}`).join(', ')} (${r.source})`);
20
28
  const tools = Object.entries(doc.tools ?? {})
@@ -87,6 +95,8 @@ export async function runConfig(o = {}) {
87
95
  tools: found.map((t) => `${t.name}=${picked.includes(t.name) ? 'on' : 'off'}`),
88
96
  });
89
97
  prompter.note(r.refused ? `not changed: ${r.refused}` : 'agent tools written — commit bindings.yaml');
98
+ if (r.localDelegation)
99
+ prompter.note(LOCAL_DELEGATION_NOTE(r.localDelegation));
90
100
  continue;
91
101
  }
92
102
  if (v === 'mode') {
@@ -103,9 +113,11 @@ export async function runConfig(o = {}) {
103
113
  const r = await configureBindings({ cwd: root, mode: m });
104
114
  prompter.note(r.refused
105
115
  ? `not changed: ${r.refused}`
106
- : r.reconcile
107
- ? `mode ${m}: AGENTS.md has a reconcile note — the PM merges it in the next conversation`
116
+ : r.modeChanged
117
+ ? `mode ${m}: AGENTS.md has a mode-changed note — the PM checks the project sections in the next conversation`
108
118
  : `mode ${m}: already so`);
119
+ if (r.localDelegation)
120
+ prompter.note(LOCAL_DELEGATION_NOTE(r.localDelegation));
109
121
  continue;
110
122
  }
111
123
  const off = doc?.audit?.required !== false;
@@ -119,5 +131,7 @@ export async function runConfig(o = {}) {
119
131
  }
120
132
  const r = await configureBindings({ cwd: root, audit: off ? 'off' : 'on' });
121
133
  prompter.note(r.refused ? `not changed: ${r.refused}` : `audit ${off ? 'off' : 'required'}`);
134
+ if (r.localDelegation)
135
+ prompter.note(LOCAL_DELEGATION_NOTE(r.localDelegation));
122
136
  }
123
137
  }
@@ -3,12 +3,13 @@ import { join } from 'node:path';
3
3
  import { parse, parseDocument } from 'yaml';
4
4
  import { subdirProposals, vendorOf, vendors } from '../lib/detect.js';
5
5
  import { GROUP_ROLES, GROUPS, effectiveBindings, readLocalBindings, readTeam, resolveRoles, validateBindings, writeBindings, } from '../lib/bindings.js';
6
- import { placeNote, reconcileNote, renderBlocks } from '../lib/agents-md.js';
6
+ import { modeChangedNote, placeNote, renderBlocks } from '../lib/agents-md.js';
7
7
  import { applyBlocks } from '../lib/blocks.js';
8
8
  import { generateVendorFiles } from '../lib/generate.js';
9
9
  import { repoRoot } from '../lib/git.js';
10
10
  import { writeGenerated } from '../lib/vendor-write.js';
11
11
  import { packageHarness } from '../lib/upstream.js';
12
+ import { syncLocalDelegation } from '../lib/local-delegation.js';
12
13
  /** A model given alone, or `vendor:model`. */
13
14
  export function parseBinding(v) {
14
15
  const s = v.trim();
@@ -19,8 +20,8 @@ export function parseBinding(v) {
19
20
  return { vendor: s.slice(0, i), model: s.slice(i + 1) };
20
21
  return { vendor: vendorOf(s), model: s };
21
22
  }
22
- /** Rewrite AGENTS.md's managed blocks for these settings (design §5); a mode change adds the reconcile note. */
23
- export function refreshAgents(root, doc, modeChanged) {
23
+ /** Rewrite AGENTS.md's managed blocks for these settings (design §5); a mode change adds the light mode-changed note (ST-5). */
24
+ export function refreshAgents(root, doc, modeFrom) {
24
25
  const ap = join(root, 'AGENTS.md');
25
26
  if (!existsSync(ap))
26
27
  return false;
@@ -30,12 +31,10 @@ export function refreshAgents(root, doc, modeChanged) {
30
31
  ? String(parse(readFileSync(pin, 'utf8'))?.language ?? 'ko')
31
32
  : 'ko';
32
33
  let text = applyBlocks(before, renderBlocks(packageHarness(), doc, language)).text;
33
- if (modeChanged) {
34
- // a previous text the PM has not reconciled yet is older and stays; the current one is still in AGENTS.md
35
- const prev = join(root, '.agents/AGENTS.previous.md');
36
- if (!(existsSync(prev) && before.includes('<!-- reins:reconcile pending -->')))
37
- writeFileSync(prev, before);
38
- text = placeNote(text, reconcileNote(`The user switched the mode to ${doc.mode ?? 'single'}.`), 'reconcile');
34
+ if (modeFrom !== undefined) {
35
+ // a pending note from an earlier switch is replaced by one that names the latest change
36
+ text = text.replace(/<!-- reins:mode-changed (?:pending|done) -->\n(?:> \*\*Mode changed from [^\n]*\n)?\n?/, '');
37
+ text = placeNote(text, modeChangedNote(modeFrom, doc.mode ?? 'single'), 'mode-changed');
39
38
  }
40
39
  if (text !== before)
41
40
  writeFileSync(ap, text);
@@ -174,15 +173,24 @@ export async function configureBindings(o) {
174
173
  const doc = effective();
175
174
  return { changed: [], doc, roles: resolveRoles(doc) };
176
175
  }
177
- writeBindings(root, next, o.local ? 'local' : 'global');
176
+ writeBindings(root, next, o.local ? 'local' : 'project');
178
177
  const doc = effective();
178
+ const local = syncLocalDelegation(root);
179
179
  if (o.local)
180
- return { changed, doc, roles: resolveRoles(doc) };
180
+ return { changed, doc, roles: resolveRoles(doc), localDelegation: local };
181
181
  const teamNow = readTeam(root).doc;
182
- const modeChanged = (team.doc.mode ?? 'single') !== (teamNow.mode ?? 'single');
182
+ const from = team.doc.mode ?? 'single';
183
+ const modeChanged = from !== (teamNow.mode ?? 'single');
183
184
  const generated = writeGenerated(root, generateVendorFiles(root), false);
184
- refreshAgents(root, teamNow, modeChanged);
185
- return { changed, doc, roles: resolveRoles(doc), generated, reconcile: modeChanged || undefined };
185
+ refreshAgents(root, teamNow, modeChanged ? from : undefined);
186
+ return {
187
+ changed,
188
+ doc,
189
+ roles: resolveRoles(doc),
190
+ generated,
191
+ modeChanged: modeChanged || undefined,
192
+ localDelegation: local,
193
+ };
186
194
  }
187
195
  /** `reins configure gates [--add <name>…]` (spec S-7): subdirectory proposals, appended after the existing gates. */
188
196
  export function configureGates(o = {}) {
@@ -11,7 +11,8 @@ import { harnessVersion, packageHarness, packageSkills, packageVersion } from '.
11
11
  import { generateVendorFiles } from '../lib/generate.js';
12
12
  import { defaultBindings, readTeam } from '../lib/bindings.js';
13
13
  import { overlayReader, workTreeReader } from '../lib/reader.js';
14
- import { onboardingNote, placeNote, renderBlocks } from '../lib/agents-md.js';
14
+ import { LOCAL_DELEGATION, onboardingNote, placeNote, renderBlocks } from '../lib/agents-md.js';
15
+ import { syncLocalDelegation } from '../lib/local-delegation.js';
15
16
  import { writeGenerated } from '../lib/vendor-write.js';
16
17
  /** Upstream harness files installed into `.agents/harness/` (design §1): everything but seeds and the changelog. */
17
18
  export function harnessFiles(all) {
@@ -364,5 +365,12 @@ export async function runInstall(o) {
364
365
  for (const r of generated.refused)
365
366
  notes.push(`left alone ${r.path}: ${r.why}`);
366
367
  }
368
+ // a person's own delegation table follows the delegation block just written (spec 020 S-2)
369
+ const hadLocal = existsSync(join(root, LOCAL_DELEGATION));
370
+ const local = syncLocalDelegation(root, !!o.dryRun);
371
+ if (local === 'removed')
372
+ applied.removed.push(LOCAL_DELEGATION);
373
+ else if (local)
374
+ (hadLocal ? applied.changed : applied.created).push(LOCAL_DELEGATION);
367
375
  return { root, generation: gen, applied, generated, notes };
368
376
  }
@@ -208,7 +208,7 @@ async function updateNow(o) {
208
208
  const { doc, notes } = convertV1(team.v1);
209
209
  res.converted = notes;
210
210
  if (!o.dryRun)
211
- writeBindings(root, doc, 'global');
211
+ writeBindings(root, doc, 'project');
212
212
  else
213
213
  pending.push({ path: '.agents/harness/bindings.yaml', content: stringify(doc) });
214
214
  }
@@ -31,10 +31,17 @@ export function callLine(b, cli, writes) {
31
31
  }
32
32
  }
33
33
  const WRITES = new Set(['implementer', 'planner', 'auditor']);
34
- /** The `## Delegation` section for this bindings file. */
35
- export function renderDelegation(doc) {
34
+ /** Where `config`, `install` and `update` write a person's own delegation table (spec 020 S-1). */
35
+ export const LOCAL_DELEGATION = '.loctx/delegation.local.md';
36
+ /**
37
+ * The `## Delegation` section for this bindings file. `local` renders a person's own table: no pointer to
38
+ * itself, and a Claude role names its `rs-*` file only when the team generated that file with the same model.
39
+ */
40
+ export function renderDelegation(doc, local) {
36
41
  const pm = pmBinding(doc);
37
42
  const lines = ['## Delegation', ''];
43
+ if (!local)
44
+ lines.push(`If \`${LOCAL_DELEGATION}\` exists, follow it instead of this section (your personal settings; \`reins config --local\` writes it).`, '');
38
45
  if (doc.mode !== 'multi') {
39
46
  lines.push(`Mode: **single** — you are the PM (${pm.vendor} ${pm.model}) and do every role yourself, stage by stage. You may use subagents of your own model for read-heavy work (research, large log summaries, review, audit) and, when urgent, for parallel work on independent units; keep connected work (plan and implementation of one feature) in one run. Switching to multi is the user's choice.`);
40
47
  }
@@ -45,18 +52,49 @@ export function renderDelegation(doc) {
45
52
  let k = 0;
46
53
  for (const b of r.models) {
47
54
  const cli = doc.tools?.[b.vendor]?.cli ?? b.vendor;
48
- const how = b.vendor === 'claude'
49
- ? `subagent \`${agents[k++].name}\``
50
- : callLine(b, cli, WRITES.has(r.group));
55
+ let how;
56
+ if (b.vendor !== 'claude')
57
+ how = callLine(b, cli, WRITES.has(r.group));
58
+ else {
59
+ const name = agents[k++].name;
60
+ how =
61
+ !local || local.teamAgents.some((a) => a.name === name && a.model === b.model)
62
+ ? `subagent \`${name}\``
63
+ : `a general subagent on \`${b.model}\`, given the \`${r.role}\` section of \`.agents/harness/roles/${r.group}.md\``;
64
+ }
51
65
  lines.push(`| ${r.group}/${r.role} | ${b.vendor} ${b.model} | ${how} |`);
52
66
  }
53
67
  }
54
68
  lines.push('', 'Routine review takes one reviewer; `pl/discussion` and `advisor/committee` (every listed model, without seeing each other) are for large decisions, audit remedies, incidents and unresolved disagreements.');
55
69
  }
56
70
  const a = auditBinding(doc);
57
- lines.push('', `Audit: ${doc.audit?.required === false ? '**switched off by the user**' : '**required every version**'}; run it on ${a.vendor} ${a.model} in a fresh run that gets only the records, never this conversation.`, 'If `.loctx/bindings.local.yaml` exists, it overrides this section for you.');
71
+ lines.push('', `Audit: ${doc.audit?.required === false ? '**switched off by the user**' : '**required every version**'}; run it on ${a.vendor} ${a.model} in a fresh run that gets only the records, never this conversation.`);
58
72
  return lines.join('\n');
59
73
  }
74
+ /**
75
+ * A person's own delegation table, or null when their settings delegate exactly as the team's do
76
+ * (compared as rendered text, so a personal file that repeats the team's values makes none).
77
+ * `managed` says whether the team's agent file of that name is one reins wrote and nobody changed since;
78
+ * only those are named, so the table never sends work to a file reins refused to write.
79
+ */
80
+ export function localDelegation(team, effective, managed = () => true) {
81
+ if (renderDelegation(effective) === renderDelegation(team))
82
+ return null;
83
+ const teamAgents = team.mode === 'multi'
84
+ ? resolveRoles(team)
85
+ .filter((r) => r.on)
86
+ .flatMap(claudeAgents)
87
+ .filter((a) => managed(a.name))
88
+ : [];
89
+ return [
90
+ '# Personal delegation table',
91
+ '',
92
+ `> Written by reins from \`.agents/harness/bindings.yaml\` and your \`.loctx/bindings.local.yaml\` — this machine only. Do not edit it; the user changes it with \`reins config --local\` in a terminal, which removes it once it matches the team's table again. Follow it instead of the \`## Delegation\` section of AGENTS.md.`,
93
+ '',
94
+ renderDelegation(effective, { teamAgents }),
95
+ '',
96
+ ].join('\n');
97
+ }
60
98
  /** The managed blocks for this project, from the packaged template. */
61
99
  export function renderBlocks(harness, doc, language) {
62
100
  const text = readFileSync(join(harness, 'templates/agents-md-blocks.md'), 'utf8')
@@ -89,11 +127,20 @@ export function reconcileNote(why) {
89
127
  ].join('\n');
90
128
  }
91
129
  /** Put a note right after the first H1 (or at the top) unless one of that kind is still pending. */
130
+ /** The light check after a mode switch (design §5, spec ST-5): only the delegation block changed. */
131
+ export function modeChangedNote(from, to) {
132
+ return [
133
+ '<!-- reins:mode-changed pending -->',
134
+ `> **Mode changed from ${from} to ${to}.** reins rewrote the delegation section. In the next conversation (the \`onboard\` skill), check that the project sections below say nothing that contradicts the new mode, then change the marker above to \`<!-- reins:mode-changed done -->\`.`,
135
+ ].join('\n');
136
+ }
92
137
  export function placeNote(text, note, kind) {
93
138
  if (text.includes(`<!-- reins:${kind} pending -->`))
94
139
  return text;
95
140
  // a finished one gives way to the new one (e.g. a second mode switch)
96
- text = text.replace(new RegExp(`<!-- reins:${kind} done -->\\n(?:> [^\\n]*\\n)?\\n?`), '');
141
+ // only the note reins wrote goes with its marker; a project quote under it stays
142
+ const lead = { onboarding: 'Onboarding', reconcile: 'Reconcile', 'mode-changed': 'Mode changed' }[kind];
143
+ text = text.replace(new RegExp(`<!-- reins:${kind} done -->\\n(?:> \\*\\*${lead}[^\\n]*\\n)?\\n?`), '');
97
144
  const m = /^# .*\n/m.exec(text);
98
145
  if (!m)
99
146
  return `${note}\n\n${text}`;
@@ -195,7 +195,7 @@ export function convertV1(v1) {
195
195
  if (k in v1)
196
196
  notes.push(`${k}: dropped (no run-time keys)`);
197
197
  if (doc.groups)
198
- notes.push('mode: single; switch to multi with config to use the groups above');
198
+ notes.push('mode: single — the groups above are kept for multi and unused until then; switch with `reins config`, or remove them with `reins config bindings --off <group>…`');
199
199
  return { doc, notes };
200
200
  }
201
201
  /** The committed team file and the git-ignored personal override (design §5). */
@@ -235,7 +235,7 @@ export function effectiveBindings(root) {
235
235
  }
236
236
  const HEADER = '# reins model assignment (design §5) — the user changes it with `reins config`; nothing reads it while you work\n';
237
237
  export function writeBindings(root, doc, scope) {
238
- const p = join(root, scope === 'global' ? TEAM_BINDINGS : LOCAL_BINDINGS);
238
+ const p = join(root, scope === 'project' ? TEAM_BINDINGS : LOCAL_BINDINGS);
239
239
  mkdirSync(dirname(p), { recursive: true });
240
240
  writeFileSync(p, `${HEADER}${stringify({ ...doc, schema: 'reins/bindings@2' })}`);
241
241
  }
@@ -0,0 +1,40 @@
1
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { LOCAL_DELEGATION, localDelegation } from './agents-md.js';
4
+ import { effectiveBindings, readTeam } from './bindings.js';
5
+ import { sha } from './generate.js';
6
+ import { readManifest } from './vendor-write.js';
7
+ /**
8
+ * Bring `.loctx/delegation.local.md` in line with this person's settings (spec 020 S-1, S-2): written when
9
+ * they delegate differently from the team, removed when they no longer do. Called by whatever writes the
10
+ * AGENTS.md delegation block — `config` at either scope, `install`, `update` — never while a project works.
11
+ */
12
+ export function syncLocalDelegation(root, dryRun = false) {
13
+ const team = readTeam(root).doc;
14
+ if (!team)
15
+ return undefined;
16
+ const p = join(root, LOCAL_DELEGATION);
17
+ const files = readManifest(root).files;
18
+ // a team agent file counts only when reins wrote it and it is unchanged (review: a refused file is not ours)
19
+ const managed = (name) => {
20
+ const f = `.claude/agents/${name}.md`;
21
+ const abs = join(root, f);
22
+ return files[f] !== undefined && existsSync(abs) && sha(readFileSync(abs, 'utf8')) === files[f];
23
+ };
24
+ const want = localDelegation(team, effectiveBindings(root), managed);
25
+ const have = existsSync(p) ? readFileSync(p, 'utf8') : null;
26
+ if (want === have)
27
+ return undefined;
28
+ if (want === null) {
29
+ if (!dryRun)
30
+ rmSync(p, { force: true });
31
+ return 'removed';
32
+ }
33
+ if (!dryRun) {
34
+ mkdirSync(dirname(p), { recursive: true });
35
+ writeFileSync(p, want);
36
+ }
37
+ return 'written';
38
+ }
39
+ /** What `config` says after writing or removing the table (spec 020 S-4-3). */
40
+ export const LOCAL_DELEGATION_NOTE = (what) => `personal delegation table ${what} (${LOCAL_DELEGATION}): tell a running agent session to re-read it, or start a new one`;
@@ -50,16 +50,16 @@ export function scriptedPrompter(answers) {
50
50
  const queue = [...answers];
51
51
  const asked = [];
52
52
  const notes = [];
53
- const next = (kind, message, values) => {
54
- asked.push({ kind, message, values });
53
+ const next = (kind, message, values, labels) => {
54
+ asked.push({ kind, message, values, ...(labels ? { labels } : {}) });
55
55
  return queue.length ? queue.shift() : EXIT;
56
56
  };
57
57
  return {
58
58
  asked,
59
59
  notes,
60
60
  remaining: () => queue.length,
61
- select: async (q) => next('select', q.message, q.options.map((o) => o.value)),
62
- multiselect: async (q) => next('multiselect', q.message, q.options.map((o) => o.value)),
61
+ select: async (q) => next('select', q.message, q.options.map((o) => o.value), q.options.map((o) => o.label)),
62
+ multiselect: async (q) => next('multiselect', q.message, q.options.map((o) => o.value), q.options.map((o) => o.label)),
63
63
  text: async (q) => next('text', q.message),
64
64
  confirm: async (q) => next('confirm', q.message),
65
65
  note: (m) => {
package/cli/dist/reins.js CHANGED
@@ -5,6 +5,7 @@ import { runInstall } from './commands/install.js';
5
5
  import { runMigrate } from './commands/migrate.js';
6
6
  import { formatUpdate, runUpdate } from './commands/update.js';
7
7
  import { configureBindings, configureGates } from './commands/configure.js';
8
+ import { LOCAL_DELEGATION_NOTE } from './lib/local-delegation.js';
8
9
  import { formatBindings, runConfig } from './commands/config.js';
9
10
  import { defaultsAsker, stdinAsker } from './lib/ask.js';
10
11
  import { clackPrompter, isInteractive } from './lib/prompter.js';
@@ -191,8 +192,10 @@ config
191
192
  process.stdout.write(`${formatBindings(r.doc)}\n`);
192
193
  if (!o.show)
193
194
  process.stdout.write(r.changed.length ? `changed: ${r.changed.join(', ')}\n` : 'no change\n');
194
- if (r.reconcile)
195
- process.stdout.write('• AGENTS.md has a reconcile note — the PM merges it in the next conversation\n');
195
+ if (r.localDelegation)
196
+ process.stdout.write(`• ${LOCAL_DELEGATION_NOTE(r.localDelegation)}\n`);
197
+ if (r.modeChanged)
198
+ process.stdout.write('• AGENTS.md has a mode-changed note — the PM checks the project sections in the next conversation\n');
196
199
  const g = r.generated;
197
200
  if (g) {
198
201
  for (const p of g.written)
package/docs/README.ko.md CHANGED
@@ -8,7 +8,7 @@ BlueNyang과 Team Croffle의 저장소 열두 곳이 같은 하네스 계통을
8
8
 
9
9
  ## 상태
10
10
 
11
- **0.3.0-rc.1이 릴리스 후보입니다**(intent 019): `npx @bluenyang/reins@0.3.0-rc.1`. 최신 stable인 0.2.0은 아직 이전 설계를 설치합니다. 그 설계에서는 스킬과 훅이 작업 중에 `npx @bluenyang/reins`를 불렀습니다. 0.3은 그것을 없애고, `reins update`가 0.1.x·0.2.0 설치를 옮깁니다. 버전마다 바뀐 것은 [CHANGELOG.md](../CHANGELOG.md)에, 앞으로의 계획은 [로드맵](ROADMAP.ko.md)에 있습니다.
11
+ **0.3.0-rc.3가 릴리스 후보입니다**(intent 019, 020): `npx @bluenyang/reins@0.3.0-rc.3`. 최신 stable인 0.2.0은 아직 이전 설계를 설치합니다. 그 설계에서는 스킬과 훅이 작업 중에 `npx @bluenyang/reins`를 불렀습니다. 0.3은 그것을 없애고, `reins update`가 0.1.x·0.2.0 설치를 옮깁니다. 버전마다 바뀐 것은 [CHANGELOG.md](../CHANGELOG.md)에, 앞으로의 계획은 [로드맵](ROADMAP.ko.md)에 있습니다.
12
12
 
13
13
  ## 동작 방식
14
14
 
@@ -3,6 +3,8 @@
3
3
  Read by `reins update`: it lists the entries newer than a project's pinned version.
4
4
 
5
5
  ## 0.3.0
6
+ - rc.3: every skill's delegation section and the delegation block point to `.loctx/delegation.local.md` first; the flow block, `implement`, `spec`, `audit` and the implementer, planner and auditor roles commit at meaningful units (revertible without taking other work along) instead of one commit per unit; the audit reads PR and CI records the PM collects and stays offline.
7
+ - rc.2: `models.yaml` lists known models per vendor; a mode switch adds `reins:mode-changed` (no AGENTS.previous.md); the `onboard` skill handles it.
6
8
  - Seven role groups replace the twelve roles; bindings.yaml version 2 (mode, audit, groups); `update` converts version 1.
7
9
  - Eleven stage skills without the `reins-` prefix replace the ten `reins-*` skills; none calls reins.
8
10
  - AGENTS.md blocks: notice, layout, settings, flow, delegation, records, stops, language; an onboarding or reconcile note for the PM.
@@ -0,0 +1,8 @@
1
+ # Known models per vendor (design §9): what `reins config` offers when a vendor's CLI cannot list its own.
2
+ # agy and cursor-agent list theirs; this list is their fallback. `other` always lets the user type an ID.
3
+ schema: reins/models@1
4
+ vendors:
5
+ claude: [claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-1]
6
+ openai: [gpt-6.1-sol, gpt-6.1-terra, gpt-6-astra]
7
+ google: [gemini-4-argon-high, gemini-4-argon-medium, gemini-4-argon-low, gemini-3.8-flash-medium]
8
+ cursor: [cursor-grok-4.5-high-fast]
@@ -8,10 +8,11 @@ roles:
8
8
  - "judge code quality or test results as such; they are evidence that a step ran"
9
9
  - "call a step kept without an evidence path; that is \"cannot confirm\""
10
10
  - "read the working conversation"
11
+ - "fetch from the network; a record it lacks is \"cannot confirm\" and is asked of the PM"
11
12
  tools: { write: true, shell: true, push: false }
12
13
  ---
13
14
  # auditor
14
15
 
15
- Reads: AGENTS.md and the harness settings as they were, the intent, spec, `docs/ROADMAP.md`, `.loctx/ROADMAP.local.md`, git history, history, gate and test logs.
16
+ Reads: AGENTS.md and the harness settings as they were, the intent, spec, `docs/ROADMAP.md`, `.loctx/ROADMAP.local.md`, git history, history, gate and test logs, and the PR and CI records the PM collected (`.loctx/reports/<version>/`): PR number, who merged it and when, merge and head SHA, CI checks and results, the gate output in the PR body, as the host's CLI printed them.
16
17
 
17
- For each step of the flow (local roadmap → roadmap → intent → approval → spec → approval → implementation and commits → review → test → merge): kept, violated, cannot confirm, or skipped on the user's instruction (recorded in `waivers:`). Judge against the rules in force at the time. A generated or harness file changed by a commit that is not an `update`/`config` commit is a violation. For each violation: the criticism, and a remedy (by severity, with PL or Advisor opinions).
18
+ For each step of the flow (local roadmap → roadmap → intent → approval → spec → approval → implementation and commits → review → test → merge): kept, violated, cannot confirm, or skipped on the user's instruction (recorded in `waivers:`). Judge against the rules in force at the time. 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. Changing the spec's work units themselves (adding, dropping, scope, order) without approval is a violation. A generated or harness file changed by a commit that is not an `update`/`config` commit is a violation. For each violation: the criticism, and a remedy (by severity, with PL or Advisor opinions).
@@ -22,6 +22,6 @@ roles:
22
22
  ---
23
23
  # implementer
24
24
 
25
- - One work unit, one commit; the commit message names its spec items (S-n, W-n). The project's hooks run the gates.
25
+ - Commit at meaningful units — a point you can revert or reset to without taking other working work or features with it; a unit may take several commits, unrelated work never shares one; the commit message names its spec items (S-n, W-n). The project's hooks run the gates.
26
26
  - The code, tests and documents of one feature may be done in one run.
27
27
  - When the plan turns out wrong, update the intent or spec in the same commit, or stop and ask the PM.
@@ -17,5 +17,5 @@ roles:
17
17
  # planner
18
18
 
19
19
  - Every S-n names the intent sentence it comes from.
20
- - Work units are small enough that each lands as one commit passing the project's gates.
20
+ - Work units are small enough to be reverted on their own without taking other work with them; each commit passes the project's gates.
21
21
  - The spec's `summary_for_user` is 3–5 lines the user can answer with 진행 or 수정.
@@ -6,14 +6,14 @@
6
6
  ## Layout
7
7
 
8
8
  - `.agents/` — committed agent context: `intent/<NNN>_<slug>/{intent,spec}.md`, `audit/<version>.md`, `knowledge/`, `harness/` (settings, roles, templates), `skills/` (the stage skills).
9
- - `.loctx/` — this machine only (gitignored): `ROADMAP.local.md`, `history/<version>.md`, `reports/<version>/`, `context/`, `bindings.local.yaml`.
9
+ - `.loctx/` — this machine only (gitignored): `ROADMAP.local.md`, `history/<version>.md`, `reports/<version>/`, `context/`, `bindings.local.yaml`, `delegation.local.md`.
10
10
  - `docs/ROADMAP.md` — the public roadmap.
11
11
  <!-- reins:end layout -->
12
12
 
13
13
  <!-- reins:begin settings v=0.3.0 -->
14
14
  ## Settings
15
15
 
16
- - `.agents/harness/bindings.yaml` — the mode (`single` or `multi`), which model does which role group, and `audit.required`. A personal override may sit in `.loctx/bindings.local.yaml`; when it exists, it wins.
16
+ - `.agents/harness/bindings.yaml` — the mode (`single` or `multi`), which model does which role group, and `audit.required`. A personal override may sit in `.loctx/bindings.local.yaml`; when it exists, it wins, and when it changes who does what, `.loctx/delegation.local.md` holds that person's delegation table.
17
17
  - **When `audit.required` is true (the default), every version ends with an audit (skill `audit`). It is mandatory: never skip it; only the user switches it off.**
18
18
  - `.agents/harness/gates.yaml` — the project's own check commands; the hooks and the `test` skill run them as they are.
19
19
  - `.agents/harness/roles/<group>.md` — what each role does, must not do, and which tools it may use.
@@ -27,10 +27,10 @@ Follow these steps in order; each has a skill in `.agents/skills/`, and each ski
27
27
  1. `roadmap` — ideas go to `.loctx/ROADMAP.local.md`; once settled with the user, to `docs/ROADMAP.md`.
28
28
  2. `intent` — the PM writes the direction and the plan; **the user approves**.
29
29
  3. `spec` — the spec, its work units (W-n) and checks (V-n); **the user answers 진행 or 수정 on its summary, every time**.
30
- 4. `implement` → `review` — one work unit, one commit, naming its spec items.
30
+ 4. `implement` → `review` — commit at meaningful units (a point you can revert or reset to without taking other working work or features with it), each naming its spec items; changing the spec's work units needs the spec changed and approved first.
31
31
  5. `test` → `merge` → **`audit`** (after the merge, before the rc) → `release` → `retro` (after stable), then delete the version's working files.
32
32
 
33
- The first conversation after installation (or after a reconcile marker appears in this file) starts with `onboard`.
33
+ The first conversation after installation (or after a reconcile or mode-changed marker appears in this file) starts with `onboard`.
34
34
  <!-- reins:end flow -->
35
35
 
36
36
  <!-- reins:begin delegation v=0.3.0 -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluenyang/reins",
3
- "version": "0.3.0-rc.1",
3
+ "version": "0.3.0-rc.3",
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
6
  "repository": {
@@ -9,17 +9,19 @@ description: Audit a merged version against the flow in AGENTS.md, from the reco
9
9
  After the merge, before the rc. While `audit.required` in `.agents/harness/bindings.yaml` is true, this is mandatory — never skip it.
10
10
 
11
11
  ## 2. Procedure
12
- 1. Run in a fresh context that gets only the records, never the working conversation (auditor if switched on; in single mode, a new run — another vendor, or the same vendor's top model — chosen by the user).
13
- 2. Read: AGENTS.md and the harness settings as they were, the intent, spec, `docs/ROADMAP.md`, `.loctx/ROADMAP.local.md`, git history, history, gate and test logs.
14
- 3. Judge each step: local roadmap → roadmap → intent → approval → spec → approval → implementation and commits → review → test → merge. 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. A generated or harness file changed by a commit that is not an `update`/`config` commit is a violation.
15
- 4. Write `.agents/audit/<version>.md` from `.agents/harness/templates/audit.md`: criticise each violation precisely and give a remedy (pl or advisor opinions by severity).
16
- 5. The PM reports to the user: fix it, or the user accepts it. Commit the record with the user's decision.
12
+ 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, and the gate output in the PR body — as the repository host's CLI prints them, unedited (e.g. `gh pr view <n> --json number,mergedBy,mergedAt,mergeCommit,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.
13
+ 2. Run in a fresh context that gets only the records, never the working conversation (auditor if switched on; in single mode, a new run — another vendor, or the same vendor's top model — chosen by the user).
14
+ 3. Read: AGENTS.md and the harness settings as they were, the intent, spec, `docs/ROADMAP.md`, `.loctx/ROADMAP.local.md`, git history, history, gate and test logs, the PR and CI records the PM collected (`.loctx/reports/<version>/`). The audit runs without a network; a record it lacks is "cannot confirm" and is asked of the PM.
15
+ 4. Judge each step: local roadmap → roadmap → intent → approval → spec → approval → implementation and commits → review → test → merge. 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. 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. Changing the spec's work units themselves (adding, dropping, scope, order) without approval is a violation. A generated or harness file changed by a commit that is not an `update`/`config` commit is a violation.
16
+ 5. Write `.agents/audit/<version>.md` from `.agents/harness/templates/audit.md`: criticise each violation precisely and give a remedy (pl or advisor opinions by severity).
17
+ 6. The PM reports to the user: fix it, or the user accepts it. Commit the record with the user's decision.
17
18
 
18
19
  ## 3. Delegation
19
- Check 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. The audit never runs inside the working conversation.
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. The audit never runs inside the working conversation.
20
21
 
21
22
  ## 4. Files and lifetime
22
23
  - `.agents/audit/<version>.md` — committed, kept.
24
+ - `.loctx/reports/<version>/` PR and CI records — deleted after the retro, once summarised in the audit record.
23
25
 
24
26
  ## 5. Next
25
27
  `release`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: implement
3
- description: Implement the spec's work units in order, one commit each, and fill the self-review table. Use when the spec is accepted, or the user says implement or continue.
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.
4
4
  ---
5
5
 
6
6
  # implement
@@ -12,11 +12,12 @@ The spec is accepted and has open work units.
12
12
  1. Work on a feature branch (`type/topic`), never the default branch.
13
13
  2. Take the next open work unit. Implement it so the requirement holds everywhere it applies — never to pass.
14
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: `type(scope): title` naming the spec items (S-n, W-n). Tick the work unit in `spec.md` with the commit.
16
- 5. When the plan turns out wrong, update the intent or spec in the same commit, or stop and ask.
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. If the spec's work units themselves must change (added, dropped, rescoped, reordered), stop: change the spec with the reason, get the user's 진행 or 수정 on the summary, then go on.
16
+ 5. Commit: `type(scope): title` naming the spec items (S-n, W-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.
17
18
 
18
19
  ## 3. Delegation
19
- Check 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. 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.
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. 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.
20
21
 
21
22
  ## 4. Files and lifetime
22
23
  - Commits — kept.
@@ -27,4 +28,5 @@ Check the delegation table in AGENTS.md. If the role group named here has a mode
27
28
 
28
29
  ## 6. Stop and ask
29
30
  - Two failures in the same work unit: stop, find the cause (pl or advisor opinions by severity), or bring options to the user.
30
- - A change outside the work unit.
31
+ - A change outside the spec's approved work units (working across approved units that may be reverted together is fine).
32
+ - The spec's work units need to change (added, dropped, rescoped, reordered): the spec changes and is approved first.
@@ -15,7 +15,7 @@ A settled roadmap item has no approved intent.
15
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.
16
16
 
17
17
  ## 3. Delegation
18
- Check 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. The intent itself is always written by the PM.
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. The intent itself is always written by the PM.
19
19
 
20
20
  ## 4. Files and lifetime
21
21
  - `intent.md` — committed, kept.
@@ -14,7 +14,7 @@ The version is tested.
14
14
  3. Merge only when the required checks pass, the way the repository merges (rebase, squash …). Red CI goes back to `implement`.
15
15
 
16
16
  ## 3. Delegation
17
- Check 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. Executor (deployer) does this when switched on, within the same limits.
17
+ 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. Executor (deployer) does this when switched on, within the same limits.
18
18
 
19
19
  ## 4. Files and lifetime
20
20
  - The PR — on the forge, kept.
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: onboard
3
- description: First conversation after reins install, migrate or a mode switch — read the project, ask the user, and write or reconcile the project sections of AGENTS.md. Use when AGENTS.md shows reins:onboarding pending or reins:reconcile pending.
3
+ description: First conversation after reins install, migrate or a mode switch — read the project, ask the user, and write or reconcile the project sections of AGENTS.md. Use when AGENTS.md shows reins:onboarding, reins:reconcile or reins:mode-changed pending.
4
4
  ---
5
5
 
6
6
  # onboard
7
7
 
8
8
  ## 1. When
9
- AGENTS.md has `<!-- reins:onboarding pending -->` or `<!-- reins:reconcile pending -->`. Do this before any other work.
9
+ AGENTS.md has `<!-- reins:onboarding pending -->`, `<!-- reins:reconcile pending -->` or `<!-- reins:mode-changed 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.
10
12
 
11
13
  ## 2. Procedure
12
14
  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).
@@ -15,7 +17,7 @@ AGENTS.md has `<!-- reins:onboarding pending -->` or `<!-- reins:reconcile pendi
15
17
  4. Set the marker to `done` (`<!-- reins:onboarding done -->` / `<!-- reins:reconcile done -->`), delete `.agents/AGENTS.previous.md`, and commit on a branch.
16
18
 
17
19
  ## 3. Delegation
18
- Check 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. Onboarding itself stays with the PM.
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. Onboarding itself stays with the PM.
19
21
 
20
22
  ## 4. Files and lifetime
21
23
  - AGENTS.md project sections — committed, kept.
@@ -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.0-rc.1 install --mode <mode>`
19
- - an older harness or `.ai/`: `npx @bluenyang/reins@0.3.0-rc.1 migrate --dry-run`, then without `--dry-run`
20
- - reins already installed: `npx @bluenyang/reins@0.3.0-rc.1 update`
21
- - to change models, the mode or the audit later: `npx @bluenyang/reins@0.3.0-rc.1 config` (the user can run `reins config`)
18
+ - nothing installed: `npx @bluenyang/reins@0.3.0-rc.3 install --mode <mode>`
19
+ - an older harness or `.ai/`: `npx @bluenyang/reins@0.3.0-rc.3 migrate --dry-run`, then without `--dry-run`
20
+ - reins already installed: `npx @bluenyang/reins@0.3.0-rc.3 update`
21
+ - to change models, the mode or the audit later: `npx @bluenyang/reins@0.3.0-rc.3 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.
@@ -14,7 +14,7 @@ The version is audited (or the user accepted its findings).
14
14
  3. After the rc, fixes are stabilisation work units; then the next rc.
15
15
 
16
16
  ## 3. Delegation
17
- Check 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. Executor (deployer) does this when switched on, within the same limits.
17
+ 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. Executor (deployer) does this when switched on, within the same limits.
18
18
 
19
19
  ## 4. Files and lifetime
20
20
  - Tags, release notes — on the forge, kept.
@@ -16,7 +16,7 @@ After stable, or when the user declares a version without stable closed.
16
16
  5. Delete `.loctx/reports/<version>/`.
17
17
 
18
18
  ## 3. Delegation
19
- Check 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.
19
+ 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.
20
20
 
21
21
  ## 4. Files and lifetime
22
22
  - `.loctx/history/<version>.md` — local, kept.
@@ -15,7 +15,7 @@ Work units are done and not reviewed.
15
15
  4. A large decision or an unresolved disagreement: pl/discussion (every assigned model, without seeing each other); combine with the originals attached, keeping minority views.
16
16
 
17
17
  ## 3. Delegation
18
- Check 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.
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.
19
19
 
20
20
  ## 4. Files and lifetime
21
21
  - Review notes under `.loctx/reports/<version>/` — deleted after the retro, once summarised.
@@ -15,7 +15,7 @@ The user brings an idea, a change of plan, or asks what comes next.
15
15
  4. Name the version of the next work and hand over to `intent`.
16
16
 
17
17
  ## 3. Delegation
18
- Check 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.
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.
19
19
 
20
20
  ## 4. Files and lifetime
21
21
  - `.loctx/ROADMAP.local.md` — local, the user keeps it.
@@ -9,13 +9,13 @@ description: Turn an approved intent into spec.md — interpretation, design, wo
9
9
  The intent is approved and has no accepted spec.
10
10
 
11
11
  ## 2. Procedure
12
- 1. Write `spec.md` from `.agents/harness/templates/spec.md`: interpretation (S-n, each naming the intent sentence it comes from), design, **work units** (W-n — each lands as one commit passing the gates), **checks** (V-n — what to run, the expected result, how a fail looks), concerns, out of scope.
12
+ 1. Write `spec.md` from `.agents/harness/templates/spec.md`: interpretation (S-n, each naming the intent sentence it comes from), design, **work units** (W-n — each can be reverted on its own without taking other work with it; its commits pass the gates), **checks** (V-n — what to run, the expected result, how a fail looks), concerns, out of scope.
13
13
  2. Review it against the user's own words, the intent and the product boundary (pl/plan-reviewer and pl/qa-plan-reviewer if switched on; else review it yourself and say so).
14
14
  3. Write `summary_for_user` (3–5 lines) and show it. Wait for 진행 or 수정 — every time, no auto-accept.
15
15
  4. On 진행: add `{ role: user, by, at, words, rev, kind: summary }` to `approvals:`, set `status: accepted`, commit.
16
16
 
17
17
  ## 3. Delegation
18
- Check 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. Planner (spec-writer, qa-designer) does steps 1 when switched on.
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. Planner (spec-writer, qa-designer) does steps 1 when switched on.
19
19
 
20
20
  ## 4. Files and lifetime
21
21
  - `spec.md` — committed, kept.
@@ -14,7 +14,7 @@ Every work unit of the version is reviewed.
14
14
  3. A fail goes back to the PM → `implement`.
15
15
 
16
16
  ## 3. Delegation
17
- Check 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. Executor (qa-runner) runs the checks when switched on; tool-executor summarises a large log.
17
+ 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. Executor (qa-runner) runs the checks when switched on; tool-executor summarises a large log.
18
18
 
19
19
  ## 4. Files and lifetime
20
20
  - `.loctx/reports/<version>/` test logs — deleted after the retro, once summarised.