@yasaswy.nagavolu/agents 0.26.5 → 0.26.7

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 (56) hide show
  1. package/README.md +5 -0
  2. package/bin/cli.js +114 -1
  3. package/content/agents/assistant-subagent.md +70 -0
  4. package/content/agents/execution-worker-subagent.md +2 -1
  5. package/content/agents/generic-purpose-subagent.md +2 -1
  6. package/content/agents/idea-agent/idea-council-subagent.md +5 -2
  7. package/content/agents/plan-agent/plan-council-subagent.md +5 -2
  8. package/content/agents/review-agent/architecture-diagram-council-subagent.md +5 -2
  9. package/content/agents/review-agent/review-council-subagent.md +5 -2
  10. package/content/agents/review-agent/visual-review-council-subagent.md +5 -2
  11. package/content/config/models.json +57 -0
  12. package/content/global/CLAUDE.md +13 -8
  13. package/content/global/hooks/cloudshell_guard.py +10 -11
  14. package/content/hooks/conclusion-scribe/conclusion_scribe_hook.py +5 -1
  15. package/content/manifest.json +154 -1
  16. package/content/mods/handoff/README.md +1 -1
  17. package/content/mods/handoff/tests/e2e/keepwarm_e2e.py +1 -1
  18. package/content/mods/handoff/tests/e2e/run_e2e.py +1 -1
  19. package/content/mods/handoff/tests/handoff.test.ts +53 -0
  20. package/content/mods/model-routing/.claude-plugin/plugin.json +7 -0
  21. package/content/mods/model-routing/README.md +68 -0
  22. package/content/mods/model-routing/hooks/hooks.json +4 -0
  23. package/content/mods/model-routing/hooks/register.js +125 -0
  24. package/content/mods/model-routing/lib/route.mjs +89 -0
  25. package/content/mods/model-routing/tests/decide_table.mjs +15 -0
  26. package/content/mods/model-routing/tests/e2e/payload_probe.py +16 -0
  27. package/content/mods/model-routing/tests/e2e/run_e2e.py +140 -0
  28. package/content/mods/model-routing/tests/e2e/run_routing_e2e.py +184 -0
  29. package/content/mods/model-routing/tests/register.test.mjs +236 -0
  30. package/content/mods/model-routing/tests/route.test.mjs +124 -0
  31. package/content/mods/model-routing/tests/routing.test.ts +65 -0
  32. package/content/proxy/README.md +4 -3
  33. package/content/proxy/agent_model_guard.py +210 -115
  34. package/content/proxy/handover_ledger_hook.py +9 -25
  35. package/content/proxy/headless_process.py +17 -0
  36. package/content/proxy/models_config.py +184 -0
  37. package/content/proxy/route_lock.py +19 -1
  38. package/content/proxy/routing_audit.py +125 -0
  39. package/content/proxy/routing_brief.py +72 -0
  40. package/content/proxy/routing_escalation_hook.py +111 -0
  41. package/content/proxy/routing_log.py +252 -0
  42. package/content/proxy/routing_post_hook.py +98 -0
  43. package/content/proxy/switch_model.ps1 +22 -5
  44. package/content/skills/switch-model/README.md +5 -3
  45. package/content/statusline/statusline-command.ps1 +15 -2
  46. package/content/statusline/subagent-statusline-command.ps1 +37 -14
  47. package/content/statusline/subagent-statusline-command.py +33 -9
  48. package/lib/doctor.js +20 -2
  49. package/lib/install.js +4 -0
  50. package/lib/memoryIndexCheck.js +66 -0
  51. package/lib/modValidate.js +84 -0
  52. package/lib/modelsApply.js +155 -0
  53. package/lib/modelsUsage.js +58 -0
  54. package/lib/routingCheck.js +75 -0
  55. package/lib/update.js +10 -0
  56. package/package.json +1 -1
package/README.md CHANGED
@@ -82,6 +82,8 @@ agents-cli install
82
82
  `.gitlab-ci.yml`. Needs `GITLAB_RUNNER_PAT` (set it with `agents-cli
83
83
  secrets`). Add `--json` for a machine-readable result that never contains a
84
84
  token. Exit codes: 0 ok, 1 a step failed, 2 usage error.
85
+ - `agents-cli models usage [--days N] [--json] [--target-dir <path>]` — read-only report of dispatch counts and share per role, from the guard's dispatch log (`logs/agent_dispatch.jsonl`, which records `model` and `role` per dispatch); a missing or empty log prints a note and exits 0.
86
+ - `agents-cli models apply [--dry-run] [--target-dir <path>]` — stamp `models.json` into the static consumers: the `model:` of every deployed agent file carrying a `role:` key, and each `settingsStamp` entry (default `env.CLAUDE_CODE_SUBAGENT_MODEL`) in `settings.json`. `models.json` itself ships as a normal bundle file (a local edit survives `update` unless `--theirs`); `install` and `update` run the same step automatically. `--dry-run` prints the diff and writes nothing; the settings `model` key and any key outside `settingsStamp` are never touched. To roll a model back, change that role's id in `~/.claude/models.json` and run it.
85
87
  - `agents-cli doctor [--fix] [--scan-root <dir>] [--json]` — report orphaned, missing and drifted
86
88
  files under the install target, plus project hooks in the repo's `.claude/settings.json` and
87
89
  `settings.local.json` whose script file is missing or that are bare `python <repo>/.claude/hooks/x.py`
@@ -96,6 +98,9 @@ agents-cli install
96
98
  (harness-hygiene) does the same repair at SessionStart/UserPromptSubmit and auto-allows permission prompts
97
99
  while the global default is `bypassPermissions`. A live session already on the weaker mode is switched with
98
100
  `claude --resume <session-id> --permission-mode bypassPermissions` (`ctrl+x m` is swallowed by the VS Code terminal).
101
+ It also runs `claude plugin validate <mod> --strict` on each installed mod and prints claude's text on a failure (exit 1);
102
+ a missing or older `claude` is skipped, not a failure. A `Memory index` section lists each `~/.claude/projects/*/memory/MEMORY.md`
103
+ within 80% of, or over, Claude Code's load limit (200 lines or 25KB) with the lines it cuts; it is report only.
99
104
  It also flags path-scoped `Write(<path>)` and `NotebookEdit(<path>)` rules in `permissions.allow/deny/ask`
100
105
  (Claude Code only matches `Edit(<path>)` for file writes); `--fix`, the `project_hook_repair.js` hook and the
101
106
  `--fix-project-hooks` flag of `install`/`update` rewrite them to `Edit(<path>)` in `settings.local.json` with duplicates
package/bin/cli.js CHANGED
@@ -12,12 +12,14 @@ const pkg = JSON.parse(
12
12
  const { installBundle, defaultTargetBase, InstallError } = require('../lib/install');
13
13
  const { uninstallBundle, UninstallError } = require('../lib/uninstall');
14
14
  const { loadManifest, findBundle, ManifestError } = require('../lib/manifest');
15
- const { loadLedger, bundleKeysInLedger, LedgerError } = require('../lib/ledger');
15
+ const { loadLedger, saveLedger, bundleKeysInLedger, LedgerError } = require('../lib/ledger');
16
16
  const { updateBundles, UpdateError } = require('../lib/update');
17
17
  const { formatVersionBanner } = require('../lib/version-banner');
18
18
  const { bundleInstallState, installChip, installDetailLine, chipIsChange } = require('../lib/install-state');
19
19
  const { ledgerPath } = require('../lib/ledger');
20
20
  const { WiringError } = require('../lib/wiring');
21
+ const { applyModels, formatPlan, ModelsError } = require('../lib/modelsApply');
22
+ const { dispatchUsage, formatUsage } = require('../lib/modelsUsage');
21
23
  const {
22
24
  basicMenuBundles,
23
25
  advancedMenuBundles,
@@ -33,6 +35,7 @@ const { collectBundleSecrets, collectComponentSecrets, isResolved, promptForMiss
33
35
  const { envPath, readSecrets, removeSecret } = require('../lib/secretsStore');
34
36
  const { runSelfProfilePostInstall } = require('../lib/selfProfile');
35
37
  const { checkHealth, DoctorError } = require('../lib/doctor');
38
+ const memoryIndexCheck = require('../lib/memoryIndexCheck');
36
39
  const projectHooks = require('../lib/projectHooks');
37
40
  const modeDrift = require('../lib/modeDrift');
38
41
  const permissionRules = require('../lib/permissionRules');
@@ -69,6 +72,10 @@ Usage:
69
72
  under <dir>); --fix-project-hooks rewrites them to the fail-open launcher.
70
73
  Also reports a project defaultMode weaker than the global one; with
71
74
  --fix-project-hooks it is removed from settings.local.json
75
+ agents-cli models apply [--dry-run] [--target-dir <path>] Stamp models.json roles into agent frontmatter (model:) and the
76
+ settingsStamp keys of settings.json; --dry-run prints the diff and writes nothing
77
+ (also runs on every install and update)
78
+ agents-cli models usage [--days N] [--json] [--target-dir <path>] Dispatch counts and share per role, read from the guard's dispatch log (read-only)
72
79
  agents-cli secrets Prompt for any missing secrets across all installed bundles
73
80
  agents-cli secrets --bundle <key> Prompt for missing secrets for one bundle
74
81
  agents-cli secrets --list Show which secrets are set/missing (names only — never values)
@@ -338,6 +345,7 @@ function installOneBundle({ bundleKey, bundleTitle, targetDir, targetConfig, ite
338
345
  console.log(` ${mark('ok')} wired ${result.hooksWired.length} hook(s) into ${result.targetBase}/settings.json`);
339
346
  }
340
347
  printKeybindingReport(result);
348
+ printModelsReport(result.models);
341
349
  if (result.settingsBackupFile) {
342
350
  console.log(` ${mark()} backed up existing settings.json to ${result.settingsBackupFile} before this CLI's first write`);
343
351
  }
@@ -389,6 +397,13 @@ function installOneBundle({ bundleKey, bundleTitle, targetDir, targetConfig, ite
389
397
  * the only piece of the menu flow that isn't unit-testable without a TTY —
390
398
  * everything it calls (planSelection, installBundle) is.
391
399
  */
400
+ function printModelsReport(models) {
401
+ if (!models) return;
402
+ if (models.agents.length > 0) console.log(` ${mark('ok')} models.json: stamped ${models.agents.length} agent file(s)`);
403
+ if (models.settings.length > 0) console.log(` ${mark('ok')} models.json: set ${models.settings.map((s) => s.key).join(', ')} in settings.json`);
404
+ for (const w of models.warnings) console.log(` ${mark('skip')} models.json: ${w}`);
405
+ }
406
+
392
407
  function printKeybindingReport({ keybindingsWired = [], keybindingsKept = [], keybindingsSkipped = null, targetBase }) {
393
408
  if (keybindingsWired.length > 0) {
394
409
  const keys = keybindingsWired.map((r) => r.key).join(', ');
@@ -1058,6 +1073,7 @@ async function runUpdate(argv) {
1058
1073
  }
1059
1074
  }
1060
1075
 
1076
+ printModelsReport(result.models);
1061
1077
  printPythonSyncIssues(result.bundles);
1062
1078
  printModVersionWarnings(result.bundles.map((b) => b.bundle), result.targetBase);
1063
1079
 
@@ -1079,6 +1095,69 @@ async function runUpdate(argv) {
1079
1095
  }
1080
1096
  }
1081
1097
 
1098
+ function runModels(argv) {
1099
+ const [sub, ...rest] = argv;
1100
+ let targetDir = null;
1101
+ let dryRun = false;
1102
+ let days = null;
1103
+ let json = false;
1104
+ for (let i = 0; i < rest.length; i += 1) {
1105
+ if (rest[i] === '--days') {
1106
+ days = Number(rest[i + 1]);
1107
+ i += 1;
1108
+ if (!(days > 0)) {
1109
+ console.error('--days needs a positive number');
1110
+ return 1;
1111
+ }
1112
+ } else if (rest[i] === '--json') {
1113
+ json = true;
1114
+ } else if (rest[i] === '--target-dir') {
1115
+ targetDir = rest[i + 1];
1116
+ i += 1;
1117
+ } else if (rest[i] === '--dry-run') {
1118
+ dryRun = true;
1119
+ } else {
1120
+ console.error(`Unknown models flag: ${rest[i]}`);
1121
+ return 1;
1122
+ }
1123
+ }
1124
+ const targetBase = targetDir || defaultTargetBase();
1125
+ if (sub === 'usage') {
1126
+ const usage = dispatchUsage({ targetBase, days });
1127
+ console.log(json ? JSON.stringify(usage, null, 2) : formatUsage(usage).join('\n'));
1128
+ return 0;
1129
+ }
1130
+ if (sub !== 'apply') {
1131
+ console.error('Usage: agents-cli models apply [--dry-run] [--target-dir <path>] | models usage [--days N] [--json]');
1132
+ return 1;
1133
+ }
1134
+ try {
1135
+ const ledger = loadLedger(targetBase, pkg.version);
1136
+ const result = applyModels({ targetBase, ledger, dryRun });
1137
+ if (!result.applied) {
1138
+ console.log(`No models.json at ${targetBase} — install a bundle first.`);
1139
+ return 1;
1140
+ }
1141
+ if (dryRun) {
1142
+ for (const line of formatPlan(result)) console.log(line);
1143
+ } else {
1144
+ saveLedger(targetBase, ledger);
1145
+ for (const a of result.agents) console.log(`${mark('ok')} ${a.file}: model ${a.to}`);
1146
+ for (const s of result.settings) console.log(`${mark('ok')} settings.json ${s.key} set to ${s.to}`);
1147
+ }
1148
+ for (const w of result.warnings) console.log(`${mark('skip')} ${w}`);
1149
+ if (result.agents.length === 0 && result.settings.length === 0) console.log('Already in sync with models.json.');
1150
+ else if (dryRun) console.log('(dry run: nothing written)');
1151
+ return 0;
1152
+ } catch (err) {
1153
+ if (err instanceof ModelsError || err instanceof LedgerError || err instanceof WiringError) {
1154
+ console.error(err.message);
1155
+ return 1;
1156
+ }
1157
+ throw err;
1158
+ }
1159
+ }
1160
+
1082
1161
  function parseDoctorArgs(argv) {
1083
1162
  const args = { targetDir: null, json: false, fix: false, scanRoot: null };
1084
1163
  for (let i = 0; i < argv.length; i += 1) {
@@ -1257,9 +1336,36 @@ function runDoctor(argv) {
1257
1336
  for (const c of result.modVersions) console.log(` ${c.line}`);
1258
1337
  };
1259
1338
 
1339
+ const printModValidation = () => {
1340
+ if (!result.modValidation || result.modValidation.length === 0) return;
1341
+ console.log('\nMod validation (claude plugin validate --strict):');
1342
+ for (const c of result.modValidation) {
1343
+ console.log(` ${c.line}`);
1344
+ if (c.status === 'failed') for (const text of c.output.split(/\r?\n/)) console.log(` ${text}`);
1345
+ }
1346
+ };
1347
+
1348
+ const printMemoryIndex = () => {
1349
+ const m = result.memoryIndex;
1350
+ if (!m || m.checked === 0) return;
1351
+ console.log(`\nMemory index (Claude Code loads the first ${m.limitLines} lines or ${Math.round(m.limitBytes / 1000)}KB of each MEMORY.md; report only):`);
1352
+ if (m.findings.length === 0) console.log(` ${m.checked} index file(s) checked, none near or over the limit`);
1353
+ for (const f of m.findings) console.log(` ${memoryIndexCheck.describe(f)}`);
1354
+ };
1355
+
1356
+ const printRoutingMod = () => {
1357
+ if (!result.routingMod) return;
1358
+ console.log('\nModel routing:');
1359
+ console.log(` ${result.routingMod.line}`);
1360
+ for (const d of result.routingMod.details) console.log(` ${d}`);
1361
+ };
1362
+
1260
1363
  if (result.healthy) {
1261
1364
  console.log(`${result.targetBase}: healthy — no orphans, no missing files, no drift.`);
1262
1365
  printModVersions();
1366
+ printModValidation();
1367
+ printMemoryIndex();
1368
+ printRoutingMod();
1263
1369
  printModeDrift();
1264
1370
  return 0;
1265
1371
  }
@@ -1278,6 +1384,9 @@ function runDoctor(argv) {
1278
1384
  for (const d of result.drifted) console.log(` ${d.relTarget} (bundle: ${d.bundle})`);
1279
1385
  }
1280
1386
  printModVersions();
1387
+ printModValidation();
1388
+ printMemoryIndex();
1389
+ printRoutingMod();
1281
1390
  printProjectHooks();
1282
1391
  printModeDrift();
1283
1392
  return 1;
@@ -1323,6 +1432,10 @@ async function main(argv) {
1323
1432
  return runDoctor(rest);
1324
1433
  }
1325
1434
 
1435
+ if (command === 'models') {
1436
+ return runModels(rest);
1437
+ }
1438
+
1326
1439
  if (command === 'runner') {
1327
1440
  return require('../lib/runner').runRunnerCommand(rest);
1328
1441
  }
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: assistant-subagent
3
+ description: Does narrow, spec-driven work with a checkable result and reports; hand off to worker if the task needs design or multi-step debugging.
4
+ model: claude-haiku-5-5
5
+ role: assistant
6
+ effort: medium
7
+ omitClaudeMd: true
8
+ tools: ['Read', 'writeFile', 'Edit', 'Write', 'Bash', 'searchCode']
9
+ dispatch_tier: mandatory-review
10
+ user-invokable: false
11
+ ---
12
+
13
+ # assistant-subagent
14
+
15
+ Assistant-role worker. Handles the assistant row of the model routing table:
16
+ narrow, spec-driven work with checkable output.
17
+
18
+ | In scope | Examples |
19
+ |---|---|
20
+ | Research gathering, file/log/code reading, triage | find the failing line, summarise a log |
21
+ | Running tests/checks and reporting | run the suite, report pass/fail counts |
22
+ | Summaries and drafts | issue/PRD comments, status updates |
23
+ | Classification/extraction | label items, pull fields from text |
24
+ | Git/GitLab housekeeping | branch, status, issue and MR bookkeeping |
25
+ | Browser/UI checks | read a page, click through, screenshot, report |
26
+ | Bulk edits with an exact spec | apply a precisely described change |
27
+
28
+ Authoring new code, design-heavy or multi-step debugging, and fixing failures
29
+ that need code changes belong to the worker role. Dispatched by the main loop,
30
+ which retains grilling, architecture, and adversarial review.
31
+
32
+ ---
33
+
34
+ ## Workflow
35
+
36
+ 1. Read `goal:` and `task:` from the dispatch block. If `context:` is present, use it as a starting point.
37
+ 2. Read the files you need. Search the codebase. Run commands. Do not ask — explore.
38
+ 3. Do the work. Produce a real output, not a plan.
39
+ 4. Return exactly one signal, then the payload:
40
+
41
+ ```
42
+ READY_TO_COMMIT
43
+ files: [exact list of changed files]
44
+ commit_message: [conventional commit message]
45
+ summary: [one sentence — what changed and why]
46
+ ```
47
+ ```
48
+ FINDINGS
49
+ [concise conclusions, bullet points — no raw file dumps]
50
+ ```
51
+ ```
52
+ BLOCKED
53
+ reason: [specific blocker]
54
+ ```
55
+ ```
56
+ NEEDS_WORKER: [reason the task is outside the assistant scope]
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Hard rules
62
+
63
+ - Keep working until the task is done; do not hand it back early
64
+ - Run a real check that exercises the change (test, build, type-check, grep proving the edit landed) before reporting done; never report a change done without running it
65
+ - Do not skip a search or a check the task needs
66
+ - Outside the scope above (needs design, new code, multi-step debugging, or a capability you lack): stop and return `NEEDS_WORKER: <reason>` as the FIRST line, with what you learned so far below it — the main loop re-dispatches to worker; never push on past a capability gap
67
+ - Never security or pentest work — return `BLOCKED` with the reason
68
+ - Never spawn sub-agents
69
+ - If files changed, return `READY_TO_COMMIT`; if only reading, return `FINDINGS`
70
+ - Clean, minimal output — no padding, no repetition
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  name: execution-worker-subagent
3
- description: General-purpose worker subagent — handles any task (fix bugs, read docs, explore code, gather context, write files) with no domain restrictions.
3
+ description: Handles general tasks (fix, read, explore, write) with no domain restrictions; stops when the task is done and verified, or returns BLOCKED.
4
4
  model: claude-sonnet-5-5[1m]
5
+ role: worker
5
6
  effort: high
6
7
  tools: ['Read', 'writeFile', 'Edit', 'Write', 'Bash', 'searchCode']
7
8
  dispatch_tier: mandatory-review
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  name: generic-purpose-subagent
3
- description: General-purpose Claude (Sonnet) worker subagent — writes code, docs, configs, and scripts; runs and fixes tests; does bulk edits and research gathering. Runs on the native Anthropic API.
3
+ description: Writes code, docs, configs and scripts, runs and fixes tests, does bulk edits and research; stops when the dispatched task is done and checked, or returns BLOCKED.
4
4
  model: claude-sonnet-5-5[1m]
5
+ role: worker
5
6
  effort: high
6
7
  tools: ['Read', 'writeFile', 'Edit', 'Write', 'Bash', 'searchCode']
7
8
  dispatch_tier: mandatory-review
@@ -1,7 +1,10 @@
1
1
  ---
2
2
  name: idea-council-subagent
3
- description: Five-panel idea council — fans out to four external LLM panels plus Claude's independent take, then synthesizes converging and diverging ideas.
4
- model: claude-opus-5-5
3
+ description: Runs the five-panel idea council (four external panels plus an independent take) and synthesizes converging and diverging ideas; stops when the synthesis is delivered.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
5
8
  tools: ['Bash']
6
9
  dispatch_tier: safe
7
10
  user-invokable: false
@@ -1,7 +1,10 @@
1
1
  ---
2
2
  name: plan-council-subagent
3
- description: Five-panel planning council — fans out to four external LLM planners plus Claude's independent plan, then synthesizes a consolidated implementation plan.
4
- model: claude-opus-5-5
3
+ description: Runs the five-panel planning council (four external planners plus an independent plan) and synthesizes one implementation plan; stops when the plan is delivered.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
5
8
  tools: ['Bash']
6
9
  dispatch_tier: safe
7
10
  user-invokable: false
@@ -1,7 +1,10 @@
1
1
  ---
2
2
  name: architecture-diagram-council-subagent
3
- description: Reviews an architecture-diagram screenshot against the publish-article spec using external vision panels plus Claude's independent read, strict pass/fail verdict.
4
- model: claude-opus-5-5
3
+ description: Reviews an architecture-diagram screenshot against the publish-article spec with external vision panels plus an independent read; stops at a strict pass/fail verdict.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
5
8
  tools: ['Bash', 'Read']
6
9
  dispatch_tier: mandatory-review
7
10
  user-invokable: false
@@ -1,7 +1,10 @@
1
1
  ---
2
2
  name: review-council-subagent
3
- description: Five-panel code review council — fans out a diff to four external LLM reviewers plus Claude's independent review, then synthesizes critical/warning/nit findings and a verdict.
4
- model: claude-opus-5-5
3
+ description: Runs the five-panel code review council on a diff and synthesizes critical/warning/nit findings; stops when the verdict is delivered.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
5
8
  tools: ['Bash']
6
9
  dispatch_tier: safe
7
10
  user-invokable: false
@@ -1,7 +1,10 @@
1
1
  ---
2
2
  name: visual-review-council-subagent
3
- description: Five-panel visual review council for 3D model decimation quality — strict before/after render comparison across external vision models plus Claude, rejecting on any major/critical finding.
4
- model: claude-opus-5-5
3
+ description: Runs the five-panel visual review council on 3D model decimation quality (before/after renders); stops at a verdict, rejecting on any major or critical finding.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
5
8
  tools: ['Bash', 'Read']
6
9
  dispatch_tier: safe
7
10
  user-invokable: false
@@ -0,0 +1,57 @@
1
+ {
2
+ "description": "Single source of model IDs. Subagents run only on the roles in workerRoles; mainChat lists the founder-selected main-chat models (never dispatched). Edit a role's id to switch or roll back, then run `agents-cli models apply`.",
3
+ "roles": {
4
+ "worker": "claude-sonnet-5-5",
5
+ "assistant": "claude-haiku-5-5"
6
+ },
7
+ "workerRoles": ["worker", "assistant"],
8
+ "mainChat": {
9
+ "opus": "claude-opus-5-5",
10
+ "fable": "claude-fable-5-1"
11
+ },
12
+ "typeRoles": {
13
+ "Explore": "assistant",
14
+ "claude-code-guide": "assistant",
15
+ "statusline-setup": "assistant"
16
+ },
17
+ "aliases": {
18
+ "sonnet": "worker",
19
+ "haiku": "assistant"
20
+ },
21
+ "agentSuffix": {
22
+ "worker": "[1m]"
23
+ },
24
+ "effort": "high",
25
+ "roleEffort": {},
26
+ "escalationSignal": "NEEDS_WORKER:",
27
+ "roleBrief": {
28
+ "assistant": {
29
+ "scope": ["research gathering", "file, log and code reading and triage", "running checks and reporting", "summaries and drafts", "classification and extraction", "git and GitLab chores", "browser and UI checks", "bulk edits that have an exact spec"],
30
+ "out_of_scope": ["security or pentest work", "design", "authoring code, docs or configs without an exact spec"],
31
+ "escalation": "If the task is outside this scope, change nothing and return NEEDS_WORKER: <reason> as your first line."
32
+ },
33
+ "worker": {
34
+ "scope": ["authoring and editing code, docs, configs and scripts", "debugging", "fixing failing tests", "council deliberation", "anything an assistant escalated with NEEDS_WORKER", "any task that is not clearly assistant work"],
35
+ "out_of_scope": [],
36
+ "escalation": "Do the work. Report blockers in your final message."
37
+ }
38
+ },
39
+ "briefSkipTypes": ["-council-subagent$"],
40
+ "assistantOutOfScope": [
41
+ {
42
+ "reason": "security or pentest work",
43
+ "pattern": "\\b(pen-?test(s|ing)?|penetration[- ]test(s|ing)?|vulnerability scan(s|ning)?|exploit(s|ation)?|red[- ]team(ing)?|threat model(s|ing)?|security audit)\\b"
44
+ }
45
+ ],
46
+ "settingsStamp": {
47
+ "env.CLAUDE_CODE_SUBAGENT_MODEL": "worker",
48
+ "env.ANTHROPIC_DEFAULT_SONNET_MODEL": "worker",
49
+ "env.ANTHROPIC_DEFAULT_HAIKU_MODEL": "assistant"
50
+ },
51
+ "models": {
52
+ "claude-fable-5-1": { "context": 1000000, "inputUsdPerMTok": 10 },
53
+ "claude-opus-5-5": { "context": 1000000, "inputUsdPerMTok": 4 },
54
+ "claude-sonnet-5-5": { "context": 1000000, "inputUsdPerMTok": 2 },
55
+ "claude-haiku-5-5": { "context": 1000000, "inputUsdPerMTok": 0.1, "inputUsdPerMTokOver100K": 0.5 }
56
+ }
57
+ }
@@ -21,19 +21,24 @@ Be extremely proactive to take up the tasks from our pending list of tasks. Look
21
21
 
22
22
  ## Model Routing (HARD RULE)
23
23
 
24
- The main-loop model (Fable/Opus) is a scarce orchestration and planning resource; burn Sonnet, not Fable/Opus as subagents.
24
+ The main chat model is the founder's choice (`/model`); it is a scarce orchestration and planning resource, so subagents run only on the two roles below, never on the main-chat models.
25
25
 
26
- | Work | Who does it |
27
- |---|---|
28
- | Grilling, requirements, decisions, ADR judgments; architecture/planning/scaffolding/orchestration; adversarial review of subagent output | Fable/Opus, main loop |
29
- | Writing code/HTML/docs/mocks/configs/scripts; running+fixing tests; bulk edits; research gathering | Sonnet subagent (`generic-purpose-subagent` / `execution-worker-subagent`, `model: "claude-sonnet-5-5[1m]"`) |
26
+ Roles resolve to model IDs in `~/.claude/models.json` (repo `config/models.json`) — the one place an ID lives; change a role there, then run `agents-cli models apply`, to switch or roll back. Current: worker `claude-sonnet-5-5`, assistant `claude-haiku-5-5` (main-chat models: `claude-opus-5-5`, `claude-fable-5-1`).
27
+
28
+ | Role | Work | Subagent |
29
+ |---|---|---|
30
+ | (main chat) | Grilling, requirements, decisions, ADR judgments; architecture/planning/scaffolding/orchestration; adversarial review of subagent output | none — the main loop |
31
+ | assistant | Narrow, checkable jobs only (never the default): research gathering; file/log/code reading and triage; running tests/checks and reporting; summaries and drafts (issue/PRD comments, status); classification/extraction; git/GitLab housekeeping; browser/UI checks (read a page, click through, screenshot, report); bulk edits with an exact spec. Never security/pentest work | `assistant-subagent` |
32
+ | worker | DEFAULT for every delegated task: authoring or editing code/HTML/docs/mocks/configs/scripts; debugging; fixing failing tests; council deliberation (idea/plan/review); any task not clearly in the assistant list; anything the assistant escalated with `NEEDS_WORKER` | `generic-purpose-subagent` / `execution-worker-subagent` / council subagents |
33
+
34
+ Rule: the main chat and every orchestrator never do the work themselves; everything except decisions, planning and review is dispatched. Worker by default; assistant only for the narrow checkable jobs listed above; an assistant that hits a capability gap returns `NEEDS_WORKER: <reason>` as its first line, then re-dispatch to worker.
30
35
 
31
36
  Standalone non-Claude subagents (an agent whose entire multi-turn loop runs as a LiteLLM-routed model, e.g. old `litellm_glm`/`litellm_deepseek_flash` workers) are retired — see `docs/pure-claude-mode.md`. The only legitimate non-Claude LLM calls left are one-shot, Claude-wrapped: the idea/plan/review councils and the scribe's synthesis fallback shell out from Python to LiteLLM for a single completion, with Claude (main loop or the council subagent) driving the call and synthesizing the result — never a subagent whose own reasoning loop is a non-Claude model.
32
37
 
33
38
  - Fan-out is the standing default, never a per-request instruction: anything not already in context (a new error, screenshot, log, file, ticket, git/AWS state) is looked up by a subagent that returns conclusions and saves them to one-brain; the main loop opens nothing itself except the one line a decision needs.
34
- - Dispatch threshold: if the deliverable is > ~30 lines of file content, or > 2 mechanical steps (or any step whose raw output isn't needed verbatim for a decision), it goes to a worker subagent that returns conclusions only, never raw file dumps. Main loop holds only: reads needed for decisions, dispatch, review, and small edits to decision docs.
35
- - On Agent/Task dispatch without a custom agent, always pass `model: "sonnet"` explicitly. The bare `model:` tool parameter is schema-restricted to `sonnet`/`opus`/`haiku`/`fable` for unregistered dispatch types (`Explore`, `general-purpose`, `claude`) — they have no agent-definition file for the harness to read a model from, so any non-Claude slug there fails tool-schema validation (confirmed in production 2026-07-05). To actually get GLM-5.2 (or another LiteLLM-routed model) running a generic-purpose-shaped dispatch, use a REGISTERED project-specific agent whose own frontmatter names that model (e.g. `generic-purpose-subagent`) — that path reads the model server-side from the agent file, not from this parameter. Custom agents that specify their own model override this table.
36
- - Loop shape: Fable plans → a worker subagent executes → Fable adversarially reviews → return to user or re-instruct subagents.
39
+ - Dispatch threshold: if the deliverable is > ~30 lines of file content, or > 2 mechanical steps (or any step whose raw output isn't needed verbatim for a decision), it goes to a subagent (worker by default, per the rule above) that returns conclusions only, never raw file dumps. Main loop holds only: reads needed for decisions, dispatch, review, and small edits to decision docs.
40
+ - On Agent/Task dispatch without a custom agent, `agent_model_guard.py` injects the model from models.json: types listed in `typeRoles` (`Explore`, `claude-code-guide`, `statusline-setup`) -> `assistant`, every other type -> `worker`; any model outside the worker roles is rewritten, and any dispatch resolving to a main-chat model (opus/fable family) becomes `worker` in every project. A bare `sonnet`/`haiku` alias maps through the config `aliases`. Registered agents carry `role:` (stamped into `model:` by `agents-cli models apply`; the guard injects the live role model and drops any explicit `model` param). The bare `model:` tool parameter is schema-restricted to `sonnet`/`opus`/`haiku`/`fable` for unregistered dispatch types (`Explore`, `general-purpose`, `claude`), so any non-Claude slug there fails tool-schema validation. A non-Claude model needs a REGISTERED project-specific agent whose own frontmatter names it. Custom agents that specify their own model override this table.
41
+ - Loop shape: the main chat plans → a subagent executes → the main chat adversarially reviews → return to user or re-instruct subagents.
37
42
 
38
43
  ## Memory-First (every session)
39
44
 
@@ -41,11 +41,12 @@ PreToolUse chrome rules (malformed input and an unreadable state file deny):
41
41
  read results inside a batch, so any earlier action can act as a delay); an interactive
42
42
  action at index >= 1 is denied on any tab. Reads, scrolls and entirely non-activating
43
43
  key chords stay allowed at any index; type is interactive. A confirmation older than
44
- CONFIRM_TTL_S (15s) does not count for an interactive action. A tab on an AWS host denies every
45
- interactive action (the AWS console is read-only for agents: clicks, keystrokes,
46
- uploads, JS denied); docs.aws.amazon.com counts as non-AWS. A tabId-less interactive
47
- action is denied while ANY recorded tab is unconfirmed, stale (over 15s) or on an AWS
48
- host. A tabId listed
44
+ CONFIRM_TTL_S (15s) does not count for an interactive action. AWS console and
45
+ aws.amazon.com pages are allowed like any confirmed page (tickets, forms, checks); only
46
+ CloudShell URLs/tabs are denied. Known limit: a CloudShell panel opened inside an
47
+ ordinary console tab changes no URL, so this guard cannot see it; policy (agents never
48
+ open or type in CloudShell) stays. A tabId-less interactive
49
+ action is denied while ANY recorded tab is unconfirmed or stale (over 15s). A tabId listed
49
50
  twice in one Tab Context block is unconfirmed (and flagged if either line shows CloudShell). The deny message names tabs_context_mcp
50
51
  as the cheapest read. Guarantee: an undetected navigation is bounded by the 15s TTL
51
52
  between a read and a standalone or first-in-batch interactive action; interactive
@@ -86,8 +87,8 @@ from pathlib import Path
86
87
 
87
88
  CHROME_PREFIX = "mcp__claude-in-chrome__"
88
89
  DENY_MESSAGE = (
89
- "CloudShell is founder-only (founder rule 2026-10-03). "
90
- "Give the founder exact commands to run instead."
90
+ "CloudShell terminal commands are founder-only (founder rule 2026-10-03): give the founder "
91
+ "the exact commands to run. The rest of the AWS console (tickets, checks, forms) is allowed."
91
92
  )
92
93
 
93
94
  STATE_PATH = Path(os.environ.get("CLOUDSHELL_GUARD_STATE")
@@ -298,8 +299,6 @@ def _effective(tabs: dict, marks: dict, tid: str) -> dict:
298
299
  def _unconfirmed_reason(rec: dict, check_age: bool = True) -> str | None:
299
300
  """None when the tab's page is confirmed (reported by a response less than
300
301
  CONFIRM_TTL_S ago, non-AWS, no page change since); otherwise why interaction is not allowed."""
301
- if rec.get("aws_console"):
302
- return "is an AWS console page (the AWS console is read-only for agents)"
303
302
  if not rec or url_is_blank(rec.get("url", "")):
304
303
  return "has no confirmed page yet (run tabs_context_mcp first)"
305
304
  if rec.get("unverified"):
@@ -397,8 +396,8 @@ def decide_chrome(name: str, tool_input: object, tabs: dict | None, marks: dict
397
396
  if is_interactive(name, action):
398
397
  bad = _unconfirmed_tabs(tabs, marks)
399
398
  if bad:
400
- raise Deny(f"tabId missing while tab(s) {', '.join(bad)} are unconfirmed, stale or AWS "
401
- "pages (run tabs_context_mcp first)")
399
+ raise Deny(f"tabId missing while tab(s) {', '.join(bad)} are unconfirmed or stale "
400
+ "(run tabs_context_mcp first)")
402
401
  if cause:
403
402
  marks[WILDCARD_TAB] = _merge_cause(marks.get(WILDCARD_TAB), cause)
404
403
  return
@@ -776,7 +776,11 @@ def _format_failure_message(failures: list[dict]) -> str:
776
776
  # Windows, start_new_session on POSIX) with stdio redirected to DEVNULL
777
777
  # genuinely outlives the parent process exiting (verified with a sleep
778
778
  # child).
779
- HAIKU_MODEL = "claude-haiku-4-5-20251001"
779
+ try:
780
+ import models_config # noqa: E402
781
+ HAIKU_MODEL = models_config.role_model(models_config.load(), "assistant") or "haiku"
782
+ except ImportError: # staged bundle copy has no proxy/ sibling: the CLI alias still resolves
783
+ HAIKU_MODEL = "haiku"
780
784
  HAIKU_TIMEOUT_SECONDS = 45
781
785
  PROSE_CHAR_CAP = 300
782
786