@ericrisco/rsc 1.0.22 → 1.0.23

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/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.22",
2
+ "version": "1.0.23",
3
3
  "counts": {
4
4
  "skills": 264
5
5
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ericrisco/rsc",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Eric Risco's agent-skills catalog as a granular, self-recommending CLI installer.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { rmSync, existsSync, cpSync, mkdirSync, readFileSync, writeFileSync, appendFileSync } from 'node:fs';
3
- import { join, dirname } from 'node:path';
3
+ import { join, dirname, basename } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { planInstall } from './install-plan.js';
6
6
  import { targetPaths, writeSkill, wireHook, unwireHook, baseDir, TARGET_IDS } from '../targets/index.js';
7
- import { targetHasAgents, writeDeveloperAgent, removeDeveloperAgent, developerAgentPath } from '../targets/agents.js';
7
+ import { targetHasAgents, writeAgents, removeAgents, agentPath, agentNames } from '../targets/agents.js';
8
8
  import { readState, writeState } from './lib/state.js';
9
9
  import { createBackup } from './lib/backups.js';
10
10
 
@@ -70,7 +70,7 @@ function managedPathsForInstall({ skillIds, target, home, cwd }) {
70
70
  const paths = targetPaths(target, home, cwd);
71
71
  const plan = planInstall({ skillIds, target, home, cwd });
72
72
  const out = [paths.stateFile, versionFile(cwd), baseVersionsFile(cwd)];
73
- if (targetHasAgents(target)) out.push(developerAgentPath(target, cwd), join(cwd, '.rsc', 'developer.json'));
73
+ if (targetHasAgents(target)) out.push(...agentNames().map((n) => agentPath(target, cwd, n)), join(cwd, '.rsc', 'developer.json'));
74
74
  for (const step of plan) {
75
75
  if (step.kind === 'skill') {
76
76
  out.push(step.to, baseDir(step.id, cwd));
@@ -103,11 +103,18 @@ export async function applyInstall({ skillIds, target, home, cwd = process.cwd()
103
103
  }
104
104
  }
105
105
  writeBaseVersions(cwd, baseVersions);
106
- // Install the `developer` subagent for targets that support file-based agents (Claude
107
- // Code, Cursor, OpenCode, Gemini, Copilot, Junie, Kiro, Codex). It runs at the balanced
108
- // tier by default (never light/Haiku); the tier lives in .rsc/developer.json, set by
109
- // `init` at onboarding and honored on every (re)install/sync.
110
- if (targetHasAgents(target)) state.agents = writeDeveloperAgent(target, cwd).length ? ['developer'] : [];
106
+ // Install the catalog's subagents for targets that support file-based agents (Claude
107
+ // Code, Cursor, OpenCode, Gemini, Copilot, Junie, Kiro, Codex): `developer` plus the three
108
+ // adversarial refuter lenses `review` dispatches at tier 2. They run at the balanced tier
109
+ // by default (never light/Haiku); the tier lives in .rsc/developer.json, set by `init` at
110
+ // onboarding and honored on every (re)install/sync.
111
+ //
112
+ // The recorded names come from what was WRITTEN, not from a hardcoded list: a state entry
113
+ // naming an agent whose file never landed answers "you have it" for something absent.
114
+ if (targetHasAgents(target)) {
115
+ const written = writeAgents(target, cwd);
116
+ state.agents = written.map((f) => basename(f).split('.')[0]);
117
+ }
111
118
  state.version = CLI_VERSION;
112
119
  writeState(paths.stateFile, state);
113
120
  mkdirSync(dirname(versionFile(cwd)), { recursive: true });
@@ -214,9 +221,12 @@ export async function purge({ home, cwd = process.cwd(), withDocs = false, dryRu
214
221
  }
215
222
  // unwireHook mutates files, so only run it for real (dry runs skip it).
216
223
  if (!dryRun) removed.push(...unwireHook(target, paths));
217
- // Remove the installed developer subagent (agent-capable targets only).
218
- const agentFile = developerAgentPath(target, cwd);
219
- if (agentFile) drop(agentFile);
224
+ // Remove the subagents this catalog installed — and only those. An uninstaller that takes
225
+ // an agent the user wrote by hand is worse than one that leaves residue.
226
+ for (const n of agentNames()) {
227
+ const agentFile = agentPath(target, cwd, n);
228
+ if (agentFile) drop(agentFile);
229
+ }
220
230
  }
221
231
  drop(join(cwd, '.rsc'), true);
222
232
  if (withDocs) drop(join(cwd, '02-DOCS'), true);
package/targets/agents.js CHANGED
@@ -1,5 +1,10 @@
1
- // rsc developer agent — installed with the harness for every target that supports
2
- // file-based subagents with a per-agent model. The agent runs at the `balanced` tier
1
+ // rsc agent registry — the agents installed with the harness for every target that supports
2
+ // file-based subagents with a per-agent model.
3
+ //
4
+ // This file shipped ONE agent with its name, description and body as module constants. Adding a
5
+ // second was therefore not "copy a block": it was turning the file into a registry without breaking
6
+ // the `developer` installs already deployed to users. The registry is the work; the refuters are its
7
+ // first client. See 02-DOCS/wiki/sdd/specs/refuter-agent.md. The agent runs at the `balanced` tier
3
8
  // (never `light`/Haiku): Sonnet for Anthropic-backed tools, the provider's mid model
4
9
  // elsewhere. The chosen tier (balanced default, or heavy) lives in `.rsc/developer.json`,
5
10
  // written by `init` at onboarding and read here so re-syncs honor it.
@@ -33,9 +38,31 @@ const AGENT_TARGETS = {
33
38
  export const AGENT_TARGET_IDS = Object.keys(AGENT_TARGETS);
34
39
  export function targetHasAgents(target) { return Boolean(AGENT_TARGETS[target]); }
35
40
 
36
- const NAME = 'developer';
37
- const DESC = 'Implementation worker: turns an approved spec+plan into working, tested code under strict TDD (red->green->refactor), one task at a time. The rsc SDD fan-out/implementation hand.';
38
- const BODY = `You are the **developer** subagent for this project — the hands of the rsc SDD chain. You execute a planned, approved task into working, tested code. You do NOT design features.
41
+ // The contract every refuter shares, in ONE place. Three lens files each carry the lens inside them
42
+ // (decided in clarify 2026-08-18: a lens passed as a parameter reintroduces the
43
+ // does-anyone-remember dependency this whole spec exists to remove) — but P5 says length is a cost,
44
+ // so the contract they share is composed, not written three times.
45
+ const REFUTER_CONTRACT = `Your mandate is to **refute readiness**, not confirm it. A reviewer looking for confirmation finds confirmation; the asymmetry is the point.
46
+
47
+ **You get exactly four inputs, and nothing else:**
48
+ 1. The task contract — the original request **plus every scope change a human explicitly approved since**. Without the approved changes, a legitimate scope revision reads as a spec gap and you will report a confident false positive.
49
+ 2. The approved spec.
50
+ 3. The exact source state (commit SHA, or a tree hash when git is absent). A verdict attaches to the state you saw, not to the project.
51
+ 4. The entry point — the one command that reruns the checks.
52
+
53
+ **You do NOT get** the builder's conversation, reasoning, defences, or draft verdict. If a claim needs the builder's justification to stand, it is not proven.
54
+
55
+ **Blind first, compare second.** Record what you attacked and what you found BEFORE you are shown the builder's conclusions. Only then may you compare and add findings; the blind record is append-only after that, never rewritten. Skip this and your fresh context is spent confirming their framing, which is the one thing it was bought to avoid.
56
+
57
+ **The attack list is the deliverable, not just the findings.** "Nothing found" without saying where you looked is indistinguishable from not having looked.
58
+
59
+ **A finding blocks only if it is caused by this change, is severe, and carries evidence** — a repro or a concrete failure scenario. A suspicion without one is a question, and questions do not block. You fix nothing: findings return through the normal loop, and a SPEC gap goes to the human, never to the builder to self-amend.`;
60
+
61
+ const AGENTS = [
62
+ {
63
+ name: 'developer',
64
+ desc: 'Implementation worker: turns an approved spec+plan into working, tested code under strict TDD (red->green->refactor), one task at a time. The rsc SDD fan-out/implementation hand.',
65
+ body: `You are the **developer** subagent for this project — the hands of the rsc SDD chain. You execute a planned, approved task into working, tested code. You do NOT design features.
39
66
 
40
67
  - Work **test-first**: smallest failing test (RED), least code to pass it (GREEN), then refactor on green. A test that never failed proves nothing.
41
68
  - One task at a time; keep the diff to that task's scope — no "while I'm here".
@@ -43,7 +70,54 @@ const BODY = `You are the **developer** subagent for this project — the hands
43
70
  - If there is no approved spec + plan for non-trivial feature work, STOP and route to \`specify\` — do not write feature code.
44
71
  - Log non-obvious decisions to \`02-DOCS/wiki/sdd/decisions.md\`. Report your diff + test output at the end.
45
72
 
46
- Full discipline lives in the \`implement\` skill.`;
73
+ Full discipline lives in the \`implement\` skill.`,
74
+ },
75
+ {
76
+ name: 'refuter-correctness',
77
+ desc: 'Adversarial reviewer, correctness lens: attacks a green diff for boundary and error-path defects, and demands that any home-grown gate prove it can both fail and pass. Fresh context, mandate to refute.',
78
+ body: `You are the **correctness** refuter for this project — one of three adversarial lenses ${'`review`'} dispatches at tier 2. What matters is not the number of lenses but their **diversity**: the worst defect this panel ever found was found by the privacy lens, which was not looking for it.
79
+
80
+ ${REFUTER_CONTRACT}
81
+
82
+ **Your lens — correctness on the boundaries, not the happy path:** off-by-one, null/empty/zero, error paths swallowed, races, the wrong operator, a value that is correct in one function and unchecked in its twin.
83
+
84
+ **And the lens this panel was missing:** when the change adds or touches a **gate, checker or guard**, ask it in BOTH directions.
85
+ - Can it fail? Feed it a known-bad input and watch it fail. A gate nobody has seen fail is not a gate.
86
+ - **Can it pass?** Feed it a known-good input and watch it pass. Over-blocking is not the safe side — a gate that fires on correct work gets muted, worked around, or wedges the pipeline that depends on it, and it is *harder* to notice because it arrives dressed as diligence.
87
+ - Watch for a check that matches **text** where it should match **structure**: "the path appears in the string" is not "the write targets that location". That exact mistake shipped twice in one day here.`,
88
+ },
89
+ {
90
+ name: 'refuter-security',
91
+ desc: 'Adversarial reviewer, security and privacy lens: hunts untrusted input reaching a sink, authz gaps, leaked secrets and data escaping where it should not. Fresh context, mandate to refute.',
92
+ body: `You are the **security and privacy** refuter for this project — one of three adversarial lenses ${'`review`'} dispatches at tier 2. Your value is that you are not looking where the others look: the worst defect this panel ever found was found by this lens, chasing something else entirely.
93
+
94
+ ${REFUTER_CONTRACT}
95
+
96
+ **Your lens:** untrusted input reaching a sink (injection, SSRF, path traversal), authorization gaps (authenticated is not authorized), secrets in the diff or in config, and **data leaving where it should not** — a log line, an error message, a file written outside its zone, a payload sent to a third party.
97
+
98
+ **Follow the trail rather than the checklist.** When something looks merely untidy — a file in an odd place, a path that repeats — ask who else cares about that location before dismissing it. That is how this lens found the worst one.`,
99
+ },
100
+ {
101
+ name: 'refuter-tests',
102
+ desc: 'Adversarial reviewer, tests-as-evidence lens: tries to make the suite pass wrongly, invents mutants the builder did not choose, and checks the spec-to-test mapping in both directions. Fresh context, mandate to refute.',
103
+ body: `You are the **tests-as-evidence** refuter for this project — one of three adversarial lenses ${'`review`'} dispatches at tier 2.
104
+
105
+ ${REFUTER_CONTRACT}
106
+
107
+ **Your lens — try to make the suite pass wrongly:** implementation keyed to test inputs, mocks swallowing the logic under test, assertions that cannot fail, coverage that touches lines without asserting anything.
108
+
109
+ **Invent mutants the builder did not choose.** Their mutant list encodes their blind spots. Watch for tests that pin less than they claim — a boundary pinned in one function and not in its twin, a magnitude left free while its boundary is fixed, an assertion satisfied by a caller that never arrived. **Before reporting a surviving mutant, prove it diverges:** construct a concrete input where mutant and original disagree. A survivor you cannot make disagree is an equivalent mutant, and reporting it sends someone to write a test that asserts non-behaviour.
110
+
111
+ **Check the mapping both ways:** every acceptance criterion needs a falsification procedure that can be made to fail, and every test should trace to something someone asked for.`,
112
+ },
113
+ ];
114
+
115
+ // Back-compat: the tier file and its reader are named for `developer` because that is what they
116
+ // configure. The refuters run at the same tier — a deliberate, reversible default: nobody has measured
117
+ // whether a heavier model finds more here, and silently tripling tier-2 cost on an unmeasured hunch is
118
+ // the wrong way to find out.
119
+ const byName = (name) => AGENTS.find((a) => a.name === name);
120
+ export const agentNames = () => AGENTS.map((a) => a.name);
47
121
 
48
122
  // `.rsc/developer.json` — the chosen tier (balanced default; never light). `init` writes
49
123
  // it on the onboarding answer; the installer reads it so every (re)install/sync matches.
@@ -60,39 +134,57 @@ export function writeDeveloperTier(cwd, tier) {
60
134
  return t;
61
135
  }
62
136
 
63
- function renderMd(spec, model) {
64
- const fm = ['---', `name: ${NAME}`, `description: "${DESC}"`, `model: ${model}`];
137
+ function renderMd(spec, model, agent) {
138
+ const fm = ['---', `name: ${agent.name}`, `description: "${agent.desc}"`, `model: ${model}`];
65
139
  if (spec.mode) fm.push(`mode: ${spec.mode}`);
66
140
  fm.push('---', '');
67
- return `${fm.join('\n')}${BODY}\n`;
141
+ return `${fm.join('\n')}${agent.body}\n`;
68
142
  }
69
- const renderJson = (model) => `${JSON.stringify({ name: NAME, description: DESC, model, prompt: BODY }, null, 2)}\n`;
70
- function renderToml(model) {
143
+ const renderJson = (model, agent) => `${JSON.stringify({ name: agent.name, description: agent.desc, model, prompt: agent.body }, null, 2)}\n`;
144
+ function renderToml(model, agent) {
71
145
  const esc = (s) => s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
72
146
  // body as a TOML multiline LITERAL string ('''…''') — no escape processing.
73
- return `name = "${NAME}"\ndescription = "${esc(DESC)}"\nmodel = "${model}"\ndeveloper_instructions = '''\n${BODY}\n'''\n`;
147
+ return `name = "${agent.name}"\ndescription = "${esc(agent.desc)}"\nmodel = "${model}"\ndeveloper_instructions = '''\n${agent.body}\n'''\n`;
74
148
  }
75
149
 
76
- export function developerAgentPath(target, cwd) {
150
+ export function agentPath(target, cwd, name = 'developer') {
77
151
  const spec = AGENT_TARGETS[target];
78
- return spec ? join(cwd, ...spec.dir.split('/'), `${NAME}${spec.ext}`) : null;
152
+ return spec ? join(cwd, ...spec.dir.split('/'), `${name}${spec.ext}`) : null;
79
153
  }
80
154
 
81
- export function writeDeveloperAgent(target, cwd, tier = readDeveloperTier(cwd)) {
155
+ export function writeAgents(target, cwd, tier = readDeveloperTier(cwd)) {
82
156
  const spec = AGENT_TARGETS[target];
83
157
  if (!spec) return [];
84
158
  const model = spec.model(tier);
85
- const content = spec.format === 'json' ? renderJson(model)
86
- : spec.format === 'toml' ? renderToml(model)
87
- : renderMd(spec, model);
88
- const path = developerAgentPath(target, cwd);
89
- mkdirSync(dirname(path), { recursive: true });
90
- writeFileSync(path, content);
91
- return [path];
159
+ const written = [];
160
+ for (const agent of AGENTS) {
161
+ const content = spec.format === 'json' ? renderJson(model, agent)
162
+ : spec.format === 'toml' ? renderToml(model, agent)
163
+ : renderMd(spec, model, agent);
164
+ const path = agentPath(target, cwd, agent.name);
165
+ mkdirSync(dirname(path), { recursive: true });
166
+ writeFileSync(path, content);
167
+ written.push(path);
168
+ }
169
+ return written;
92
170
  }
93
171
 
94
- export function removeDeveloperAgent(target, cwd) {
95
- const path = developerAgentPath(target, cwd);
96
- if (path && existsSync(path)) { rmSync(path, { force: true }); return [path]; }
97
- return [];
172
+ /**
173
+ * Remove only the agents this catalog ships. An uninstaller that takes an agent the user wrote by hand
174
+ * is worse than one that leaves residue.
175
+ */
176
+ export function removeAgents(target, cwd) {
177
+ const removed = [];
178
+ for (const agent of AGENTS) {
179
+ const path = agentPath(target, cwd, agent.name);
180
+ if (path && existsSync(path)) { rmSync(path, { force: true }); removed.push(path); }
181
+ }
182
+ return removed;
98
183
  }
184
+
185
+ // ── back-compat aliases. Kept because `developer` is already installed in user repos and in
186
+ // capabilities.js's spec derivation; renaming their imports is not worth breaking a deployed install.
187
+ export const developerAgentPath = (target, cwd) => agentPath(target, cwd, 'developer');
188
+ export const writeDeveloperAgent = (target, cwd, tier = readDeveloperTier(cwd)) => writeAgents(target, cwd, tier);
189
+ export const removeDeveloperAgent = (target, cwd) => removeAgents(target, cwd);
190
+ export { byName as agentByName };