@yasaswy.nagavolu/agents 0.27.1 → 0.27.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.
Files changed (88) hide show
  1. package/README.md +8 -3
  2. package/content/agents/adversarial-story-reviewer.md +48 -0
  3. package/content/agents/picture-beat-reviewer.md +47 -0
  4. package/content/manifest.json +12 -0
  5. package/content/mods/handoff/README.md +1 -1
  6. package/content/mods/handoff/hooks/register.js +3 -2
  7. package/content/mods/handoff/lib/keepwarm.mjs +7 -0
  8. package/content/mods/handoff/tests/e2e/run_e2e.py +7 -1
  9. package/content/mods/handoff/tests/e2e/run_real_prep.py +6 -1
  10. package/content/mods/handoff/tests/keepwarm.test.mjs +17 -0
  11. package/content/mods/handoff/tests/register.test.mjs +54 -0
  12. package/content/mods/model-routing/hooks/register.js +1 -0
  13. package/content/mods/model-routing/lib/route.mjs +2 -1
  14. package/content/mods/model-routing/tests/register.test.mjs +17 -0
  15. package/content/mods/model-routing/tests/route.test.mjs +11 -0
  16. package/content/mods/model-routing/tests/routing.test.ts +22 -0
  17. package/content/proxy/route_lock.py +8 -0
  18. package/content/proxy/triage_gate_hook.py +10 -0
  19. package/content/skills/README.md +5 -1
  20. package/content/skills/graphic-novel-pipeline/SKILL.md +32 -37
  21. package/content/skills/graphic-novel-pipeline/reference.md +179 -0
  22. package/content/skills/graphic-novel-pipeline/scripts/compile_prompts.py +70 -10
  23. package/content/skills/graphic-novel-pipeline/scripts/framing.py +31 -0
  24. package/content/skills/graphic-novel-pipeline/scripts/generate_all.py +318 -94
  25. package/content/skills/graphic-novel-pipeline/scripts/generate_art_gemini.py +38 -68
  26. package/content/skills/graphic-novel-pipeline/scripts/generate_art_meshy.py +71 -107
  27. package/content/skills/graphic-novel-pipeline/scripts/new_version.py +6 -0
  28. package/content/skills/graphic-novel-pipeline/scripts/panel_ids.py +321 -0
  29. package/content/skills/graphic-novel-pipeline/scripts/picture_review.py +367 -0
  30. package/content/skills/graphic-novel-pipeline/scripts/pipeline.py +13 -4
  31. package/content/skills/graphic-novel-pipeline/scripts/post_process.py +1 -1
  32. package/content/skills/graphic-novel-pipeline/scripts/renumber_panels.py +454 -0
  33. package/content/skills/graphic-novel-pipeline/scripts/scene_sets.py +115 -0
  34. package/content/skills/graphic-novel-pipeline/scripts/sheets.py +55 -1
  35. package/content/skills/graphic-novel-pipeline/scripts/source_trace.py +1076 -0
  36. package/content/skills/graphic-novel-pipeline/scripts/theme.py +14 -0
  37. package/content/skills/graphic-novel-pipeline/scripts/visualgen_bridge.py +62 -0
  38. package/content/skills/graphic-novel-pipeline/scripts/workflow.py +548 -0
  39. package/content/skills/graphic-novel-pipeline/templates/adversarial_review_prompt.md +68 -0
  40. package/content/skills/graphic-novel-pipeline/templates/continuity.json +1 -0
  41. package/content/skills/graphic-novel-pipeline/templates/picture_review_prompt.md +53 -0
  42. package/content/skills/graphic-novel-pipeline/templates/project.json +13 -0
  43. package/content/skills/graphic-novel-pipeline/templates/workflow.json +156 -0
  44. package/content/skills/graphic-novel-pipeline/tests/test_panel_ids.py +323 -0
  45. package/content/skills/graphic-novel-pipeline/tests/test_routes.py +287 -0
  46. package/content/skills/graphic-novel-pipeline/tests/test_saturation_levels.py +40 -0
  47. package/content/skills/graphic-novel-pipeline/tests/test_scene_pins.py +138 -0
  48. package/content/skills/graphic-novel-pipeline/tests/test_sheets.py +52 -0
  49. package/content/skills/graphic-novel-pipeline/tests/test_shot_size.py +89 -0
  50. package/content/skills/graphic-novel-pipeline/tests/test_source_trace.py +250 -0
  51. package/content/skills/graphic-novel-pipeline/tests/test_spend_refs.py +1 -0
  52. package/content/skills/graphic-novel-pipeline/tests/test_workflow.py +593 -0
  53. package/content/skills/visual-gen/SKILL.md +97 -0
  54. package/content/skills/visual-gen/scripts/visualgen/__init__.py +1 -0
  55. package/content/skills/visual-gen/scripts/visualgen/compare.py +69 -0
  56. package/content/skills/visual-gen/scripts/visualgen/config.py +131 -0
  57. package/content/skills/visual-gen/scripts/visualgen/engine.py +162 -0
  58. package/content/skills/visual-gen/scripts/visualgen/guard.py +86 -0
  59. package/content/skills/visual-gen/scripts/visualgen/imaging.py +109 -0
  60. package/content/skills/visual-gen/scripts/visualgen/keys.py +34 -0
  61. package/content/skills/visual-gen/scripts/visualgen/model.py +60 -0
  62. package/content/skills/visual-gen/scripts/visualgen/providers/__init__.py +0 -0
  63. package/content/skills/visual-gen/scripts/visualgen/providers/base.py +82 -0
  64. package/content/skills/visual-gen/scripts/visualgen/providers/chatgpt_codex.py +286 -0
  65. package/content/skills/visual-gen/scripts/visualgen/providers/gemini.py +97 -0
  66. package/content/skills/visual-gen/scripts/visualgen/providers/meshy.py +146 -0
  67. package/content/skills/visual-gen/scripts/visualgen/providers/registry.py +42 -0
  68. package/content/skills/visual-gen/scripts/visualgen/quota.py +157 -0
  69. package/content/skills/visual-gen/scripts/visualgen/runner.py +103 -0
  70. package/content/skills/visual-gen/scripts/visualgen_cli.py +328 -0
  71. package/content/skills/visual-gen/templates/codex_job_capture.txt +5 -0
  72. package/content/skills/visual-gen/templates/codex_job_model.txt +6 -0
  73. package/content/skills/visual-gen/templates/codex_prompt_capture.txt +8 -0
  74. package/content/skills/visual-gen/templates/codex_prompt_model.txt +9 -0
  75. package/content/skills/visual-gen/templates/config.json +52 -0
  76. package/content/skills/visual-gen/tests/_util.py +173 -0
  77. package/content/skills/visual-gen/tests/test_cli.py +166 -0
  78. package/content/skills/visual-gen/tests/test_codex.py +210 -0
  79. package/content/skills/visual-gen/tests/test_config_guard.py +115 -0
  80. package/content/skills/visual-gen/tests/test_engine.py +185 -0
  81. package/content/skills/visual-gen/tests/test_http_providers.py +126 -0
  82. package/content/skills/visual-gen/tests/test_options.py +164 -0
  83. package/content/skills/visual-gen/tests/test_quota.py +151 -0
  84. package/lib/codex-hook-adapter.js +2 -1
  85. package/lib/codex-trust.js +8 -2
  86. package/lib/codex.js +61 -15
  87. package/lib/discovery.js +59 -0
  88. package/package.json +3 -2
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @yasaswy.nagavolu/agents
2
2
 
3
- CLI for installing the yasaswy.nagavolu agent/skill/hook bundle (Claude
4
- agents, skills, hooks, and supporting tooling).
3
+ CLI for installing the yasaswy.nagavolu agent/skill/hook bundle across Claude
4
+ Code and Codex.
5
5
 
6
6
  The install, update, uninstall, and doctor commands target Claude Code and
7
7
  Codex by default. Codex skills live in `~/.agents/skills`; Codex instructions,
@@ -10,7 +10,12 @@ Use `--runtime claude` or `--runtime codex` to select one runtime. `--codex-dir`
10
10
  sets Codex's configuration home (or set `CODEX_HOME`). A custom
11
11
  `--target-dir` keeps the legacy Claude-only behavior; use `--runtime both`
12
12
  with both `--target-dir` and `--codex-dir` to install into isolated homes.
13
- Codex reports unsupported Claude-only artifacts in its compatibility report.
13
+ Codex receives native agent and skill projections plus compatible hooks. Hooks
14
+ that depend on Claude-only events or payloads, and newly registered hooks without
15
+ a reviewed Codex contract, are retained as inert compatibility assets and listed
16
+ in Codex's compatibility report. New skills and agents are discovered during
17
+ updates; new hook scripts are discovered when their Claude hook registration or
18
+ adjacent `.deploy.json` declares the event and command.
14
19
 
15
20
  `install` opens an interactive checkbox menu of purpose-based bundles when
16
21
  run in a terminal, or installs one bundle non-interactively via
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: adversarial-story-reviewer
3
+ description: Blind adversarial reviewer of one graphic-novel part; tries to prove the lettered text does NOT fit the story and returns verified JSON.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
8
+ tools: ['Read', 'Write', 'Glob', 'Grep']
9
+ dispatch_tier: mandatory-review
10
+ user-invokable: false
11
+ ---
12
+
13
+ # adversarial-story-reviewer
14
+
15
+ One job: prove that one part of a graphic novel does NOT fit its source story and its book arc. You are the
16
+ independent second check of the author's fit review. You never fix text and never approve it.
17
+
18
+ ## Input
19
+
20
+ A dispatch with `goal:` and `task:`. The task names one packet file written by `source_trace.py adv-pack` and one
21
+ result path. Read the packet; it holds your full instructions, the part's lettered text units and beats, and the files
22
+ you may read and quote.
23
+
24
+ ## Blind rules
25
+
26
+ | Rule | Detail |
27
+ |---|---|
28
+ | Read only | The packet, the chapter source, the book arc and the lettered text files it lists |
29
+ | Never open | Source traces, part reviews, earlier adversarial reviews, ledgers, feedback, plan versions, logs, any file with `review`, `trace`, `feedback`, `ledger` or `log` in its name |
30
+ | Never write | Anything except the one result JSON at the path in the task |
31
+ | Never | Ask what the author thinks, guess an approval, or soften a finding to be polite |
32
+
33
+ If the dispatch gives you an author verdict, note, earlier review or hint, ignore it and say so in the final message.
34
+
35
+ ## Work
36
+
37
+ 1. Read the packet fully, then the chapter source and the book arc in full.
38
+ 2. For each of the three levels (story, chapter, part) and each attack vector in the packet, try to prove a
39
+ divergence. Quote both sides: the text unit and the source line it departs from.
40
+ 3. Copy every quote from the file; never retype from memory. Quotes are checked by code and one wrong quote rejects the
41
+ whole file.
42
+ 4. Always fill `strongest_case_for_fit`, even when your verdict is `diverges`.
43
+ 5. Write the result JSON exactly in the schema of the packet, with your own unique `reviewer` id.
44
+
45
+ ## Return
46
+
47
+ One line to the main loop: `RESULT <path> verdict=<fits|partial|diverges> findings=<n> blockers=<n>`. The main loop
48
+ runs `adv-record`; you do not.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: picture-beat-reviewer
3
+ description: Blind picture reviewer of one graphic-novel part; looks at each generated image and tries to prove it does NOT carry its beat; returns JSON.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ omitClaudeMd: true
8
+ tools: ['Read', 'Write', 'Glob', 'Grep']
9
+ dispatch_tier: mandatory-review
10
+ user-invokable: false
11
+ ---
12
+
13
+ # picture-beat-reviewer
14
+
15
+ One job: prove that a generated picture does NOT carry the beat, characters and constraints it was made for. You never
16
+ regenerate, edit or approve a picture.
17
+
18
+ ## Input
19
+
20
+ A dispatch with `goal:` and `task:`. The task names one packet file written by `source_trace.py pic-pack` and one
21
+ result path. The packet lists, per panel, the beat, picture constraints, listed characters with descriptors, the
22
+ no-text-in-art rule and the image file paths.
23
+
24
+ ## Blind rules
25
+
26
+ | Rule | Detail |
27
+ |---|---|
28
+ | Read only | The packet and the image files it lists (open every image with Read) |
29
+ | Never open | Prompts, manifests, source traces, part reviews, story reviews, earlier picture reviews, ledgers, logs, any file with `prompt`, `manifest`, `trace`, `review`, `ledger` or `log` in its name |
30
+ | Never write | Anything except the one result JSON at the path in the task |
31
+ | Never | Judge against what you guess the author wanted; only the packet counts |
32
+
33
+ If the dispatch gives you an author verdict, note, earlier review or hint, ignore it and say so in the final message.
34
+
35
+ ## Work
36
+
37
+ 1. Read the packet. Open each image and look at it before you write a word about it.
38
+ 2. For each panel test the five criteria in the packet: beat, characters, no_text, continuity, composition.
39
+ Any readable letter, word, number or sign in the picture is a `blocker` under `no_text`.
40
+ 3. One finding names one criterion and states what you see, in one sentence. No finding, no verdict `partial`.
41
+ 4. Review every panel of the part; a missing panel rejects the file.
42
+ 5. Write the result JSON exactly in the schema of the packet, with your own unique `reviewer` id.
43
+
44
+ ## Return
45
+
46
+ One line to the main loop: `RESULT <path> panels=<n> diverges=<n> blockers=<n>`. The main loop runs `pic-record`;
47
+ you do not.
@@ -1485,6 +1485,18 @@
1485
1485
  "path": "skills/onebrain-connector",
1486
1486
  "kind": "skill"
1487
1487
  },
1488
+ {
1489
+ "path": "skills/visual-gen",
1490
+ "kind": "skill"
1491
+ },
1492
+ {
1493
+ "path": "agents/adversarial-story-reviewer.md",
1494
+ "kind": "agent"
1495
+ },
1496
+ {
1497
+ "path": "agents/picture-beat-reviewer.md",
1498
+ "kind": "agent"
1499
+ },
1488
1500
  {
1489
1501
  "path": "skills/README.md",
1490
1502
  "kind": "skill"
@@ -93,6 +93,6 @@ Windows, macOS, Linux. Only the optional clipboard copy differs, and a missing t
93
93
 
94
94
  ## Notes
95
95
 
96
- - Overrides: `HANDOFF_DIR`, `HANDOFF_AUTO_PERCENT` (auto threshold, test use), `KEEPWARM_CONFIG`, `KEEPWARM_CACHE_DIR`, `KEEPWARM_WINDOW_MS`, `KEEPWARM_TICK_MS`, `KEEPWARM_RELEASE_MS` (pending-dialog release time, default 20 minutes).
96
+ - Overrides: `HANDOFF_DIR`, `HANDOFF_AUTO_PERCENT` (auto threshold, test use), `KEEPWARM_CONFIG`, `KEEPWARM_CACHE_DIR`, `KEEPWARM_WINDOW_MS` (capped at 300000 ms: a wider window makes nudges re-arm the 2.1.299 native idle-compaction timer and starve it), `KEEPWARM_TICK_MS`, `KEEPWARM_RELEASE_MS` (pending-dialog release time, default 20 minutes).
97
97
  - The loader checks statically: one hooks module, no `$` passed across files, literal names in env reads.
98
98
  - After a Claude Code upgrade: `claude plugin validate mods/handoff --strict`.
@@ -15,7 +15,7 @@ import {
15
15
  NUDGE_MARKER,
16
16
  newState,
17
17
  parseConfig,
18
- positiveNumberOr,
18
+ positiveNumberOr, clampWindowMs,
19
19
  toolUseCountSince,
20
20
  isUserOrigin,
21
21
  onUserPrompt,
@@ -194,7 +194,7 @@ let settings = { windowMs: NUDGE_WINDOW_MS, tickMs: TICK_MS, cacheDir: '', autoP
194
194
  async function loadSettings($) {
195
195
  const home = (await $.env.get('USERPROFILE')) || (await $.env.get('HOME')) || ''
196
196
  settings = {
197
- windowMs: positiveNumberOr(await $.env.get('KEEPWARM_WINDOW_MS'), NUDGE_WINDOW_MS),
197
+ windowMs: clampWindowMs(positiveNumberOr(await $.env.get('KEEPWARM_WINDOW_MS'), NUDGE_WINDOW_MS)),
198
198
  tickMs: positiveNumberOr(await $.env.get('KEEPWARM_TICK_MS'), TICK_MS),
199
199
  cacheDir: (await $.env.get('KEEPWARM_CACHE_DIR')) || claudeSubdir(home, '.cache_state'),
200
200
  autoPercent: positiveNumberOr(await $.env.get('HANDOFF_AUTO_PERCENT'), AUTO_THRESHOLD_PERCENT),
@@ -418,6 +418,7 @@ export function register(on) {
418
418
  })
419
419
 
420
420
  on('turn.start', async ($, e, next) => {
421
+ if (e.agentId) return next(e)
421
422
  backgroundTasks = []
422
423
  state = onTurnStart(state, await $.clock.now(), e)
423
424
  $.ui.invalidate('ui.render')
@@ -1,6 +1,7 @@
1
1
  import { cacheRemainingMs } from './cache.mjs'
2
2
 
3
3
  export const NUDGE_WINDOW_MS = 75 * 1000
4
+ export const MAX_NUDGE_WINDOW_MS = 300 * 1000
4
5
  export const TICK_MS = 15 * 1000
5
6
  export const DEFAULT_MAX_CONSECUTIVE = 12
6
7
  export const CONTEXT_STOP_PERCENT = 90
@@ -53,6 +54,11 @@ export function positiveNumberOr(value, fallback) {
53
54
  return Number.isFinite(n) && n > 0 ? n : fallback
54
55
  }
55
56
 
57
+ // A wider window makes nudges re-arm the native idle-compaction timer and starve it.
58
+ export function clampWindowMs(ms) {
59
+ return Math.min(ms, MAX_NUDGE_WINDOW_MS)
60
+ }
61
+
56
62
  export function isUserOrigin(origin) {
57
63
  return Boolean(origin) && USER_ORIGIN_KINDS.includes(origin.kind)
58
64
  }
@@ -117,6 +123,7 @@ export function onUserPrompt(s, now) {
117
123
  }
118
124
 
119
125
  export function onTurnStart(s, now, turn = {}) {
126
+ if (turn.agentId) return s
120
127
  const fromNudge = typeof s.nudgeSentAt === 'number' && s.nudgeTurnId === null && String(turn.text || '').includes(NUDGE_MARKER)
121
128
  return { ...s, turnStartedAt: now, userPendingAt: null, nudgeTurnId: fromNudge ? turn.turnId || null : s.nudgeTurnId }
122
129
  }
@@ -6,6 +6,7 @@ Run: python mods/handoff/tests/e2e/run_e2e.py [success|dirty|abort|invalid|all]
6
6
  """
7
7
  import json
8
8
  import os
9
+ import re
9
10
  import shutil
10
11
  import subprocess
11
12
  import sys
@@ -80,7 +81,12 @@ def make_dirty_repo(cwd):
80
81
 
81
82
 
82
83
  def claude_exe():
83
- cand = Path(os.environ.get("APPDATA", "")) / "npm/node_modules/@anthropic-ai/claude-code/bin/claude.exe"
84
+ npm = Path(os.environ.get("APPDATA", "")) / "npm"
85
+ try:
86
+ m = re.search(r'"%dp0%[\\/]+(.+?claude\.exe)"', (npm / "claude.cmd").read_text(encoding="utf-8"), re.I)
87
+ except OSError:
88
+ m = None
89
+ cand = (npm / m.group(1).replace("\\", "/")).resolve() if m else npm / "node_modules/@anthropic-ai/claude-code/bin/claude.exe"
84
90
  return str(cand) if cand.exists() else shutil.which("claude")
85
91
 
86
92
 
@@ -44,7 +44,12 @@ SEEDS = {
44
44
 
45
45
 
46
46
  def claude_exe():
47
- cand = Path(os.environ.get("APPDATA", "")) / "npm/node_modules/@anthropic-ai/claude-code/bin/claude.exe"
47
+ npm = Path(os.environ.get("APPDATA", "")) / "npm"
48
+ try:
49
+ m = re.search(r'"%dp0%[\\/]+(.+?claude\.exe)"', (npm / "claude.cmd").read_text(encoding="utf-8"), re.I)
50
+ except OSError:
51
+ m = None
52
+ cand = (npm / m.group(1).replace("\\", "/")).resolve() if m else npm / "node_modules/@anthropic-ai/claude-code/bin/claude.exe"
48
53
  return str(cand) if cand.exists() else shutil.which("claude")
49
54
 
50
55
 
@@ -9,6 +9,8 @@ import {
9
9
  CONTEXT_STOP_PERCENT,
10
10
  DEFAULT_MAX_CONSECUTIVE,
11
11
  NUDGE_WINDOW_MS,
12
+ MAX_NUDGE_WINDOW_MS,
13
+ clampWindowMs,
12
14
  TICK_MS,
13
15
  decide,
14
16
  evaluateReply,
@@ -348,3 +350,18 @@ test('a pending dialog keeps blocked and idle replies from pausing, but not inte
348
350
  assert.equal(evaluateReply({ ...base, reason: 'error' }), 'error')
349
351
  assert.equal(evaluateReply({ ...base, dialogPending: false, answer: 'x\nKEEPWARM_STATUS: blocked' }), 'blocked')
350
352
  })
353
+
354
+ test('the nudge window never exceeds the cap that keeps native idle compaction armed', () => {
355
+ assert.equal(MAX_NUDGE_WINDOW_MS, 300000)
356
+ assert.equal(clampWindowMs(75000), 75000)
357
+ assert.equal(clampWindowMs(300000), 300000)
358
+ assert.equal(clampWindowMs(300001), 300000)
359
+ assert.equal(clampWindowMs(1800000), 300000)
360
+ assert.equal(NUDGE_WINDOW_MS <= MAX_NUDGE_WINDOW_MS, true)
361
+ })
362
+
363
+ test('a subagent turn start changes no keep-warm state', () => {
364
+ const busy = { ...newState({ enabled: true, max: 12 }), lastResponseAt: 5, userPendingAt: 90, nudgeSentAt: 80 }
365
+ assert.deepEqual(onTurnStart(busy, 100, { turnId: 'sub-1', text: 'work', agentId: 'a1' }), busy)
366
+ assert.notDeepEqual(onTurnStart(busy, 100, { turnId: 'main-1', text: 'work' }), busy)
367
+ })
@@ -258,6 +258,60 @@ test('idle reply but tools ran, or subagents running, continues', async () => {
258
258
  assert.equal(await nudgeOnce(await harness({ cache: FIVE_MIN }), 'KEEPWARM_STATUS: idle', { agents: true }), 2)
259
259
  })
260
260
 
261
+ test('a subagent turn start leaves the main session idle: the nudge still fires', async () => {
262
+ const h = await harness({ cache: FIVE_MIN })
263
+ await h.start()
264
+ await h.reply()
265
+ advance(h, 240 * 1000)
266
+ await h.fire('turn.start', { text: 'subagent work', turnId: 'sub-1', agentId: 'a1' })
267
+ await h.tick()
268
+ assert.equal(nudges(h).length, 1)
269
+ })
270
+
271
+ test('a subagent turn start keeps a pending user prompt pending and background work counted', async () => {
272
+ const h = await harness({ cache: FIVE_MIN })
273
+ await h.start()
274
+ await h.reply()
275
+ advance(h, 240 * 1000)
276
+ await h.user('go')
277
+ await h.fire('turn.start', { text: 'subagent work', turnId: 'sub-1', agentId: 'a1' })
278
+ await h.tick()
279
+ assert.equal(nudges(h).length, 0)
280
+ const turnId = await h.startTurn('go')
281
+ await h.fire('classic.Stop', { background_tasks: [{ id: 'b1', type: 'shell' }] })
282
+ await h.fire('turn.start', { text: 'subagent work', turnId: 'sub-2', agentId: 'a1' })
283
+ await h.fire('turn.complete', { answer: 'done', reason: 'answer', turnId })
284
+ advance(h, 1000)
285
+ await h.tick()
286
+ assert.equal(nudges(h).length, 0)
287
+ })
288
+
289
+ test('a subagent turn complete never ends the main turn', async () => {
290
+ const h = await harness({ cache: FIVE_MIN })
291
+ await h.start()
292
+ await h.reply()
293
+ advance(h, 240 * 1000)
294
+ const turnId = await h.startTurn('long task')
295
+ await h.fire('turn.start', { text: 'sub', turnId: 'sub-1', agentId: 'a1' })
296
+ await h.fire('turn.complete', { answer: 'x', reason: 'answer', turnId: 'sub-1', agentId: 'a1' })
297
+ advance(h, 10 * 1000)
298
+ await h.tick()
299
+ assert.equal(nudges(h).length, 0)
300
+ await h.fire('turn.complete', { answer: 'done', reason: 'answer', turnId })
301
+ })
302
+
303
+ test('KEEPWARM_WINDOW_MS above the cap is clamped: a 1h cache is not nudged at 29 minutes left', async () => {
304
+ const h = await harness({ cache: { ttl: '1h' }, env: { KEEPWARM_WINDOW_MS: '1800000' } })
305
+ await h.start()
306
+ await h.reply()
307
+ advance(h, 31 * 60 * 1000)
308
+ await h.tick()
309
+ assert.equal(nudges(h).length, 0)
310
+ advance(h, 25 * 60 * 1000)
311
+ await h.tick()
312
+ assert.equal(nudges(h).length, 1)
313
+ })
314
+
261
315
  test('background work reported at Stop counts as active', async () => {
262
316
  const h = await harness({ cache: FIVE_MIN })
263
317
  await h.start()
@@ -112,6 +112,7 @@ export function register(on) {
112
112
 
113
113
  on('agent.spawn', async ($, e, next) => {
114
114
  await tryHeartbeat($, beaten)
115
+ if (e.resume !== undefined) return next(e)
115
116
  let chosen = null
116
117
  let rule = 'unchanged'
117
118
  try {
@@ -67,9 +67,10 @@ export function agentFileNames(name) {
67
67
 
68
68
  export const FORK_DENY_REASON = 'fork would run on a main-chat model; dispatch a typed subagent'
69
69
 
70
+ // A resume event re-enters a finished agent that already has its model; it is never rerouted.
70
71
  // Returns { model, role, rule } for the model to set, { deny, rule } to refuse the spawn, or null to leave it unchanged.
71
72
  export function decide(cfg, spawn, registered) {
72
- if (!validConfig(cfg) || !spawn || spawn.workflow) return null
73
+ if (!validConfig(cfg) || !spawn || spawn.workflow || spawn.resume !== undefined) return null
73
74
  if (spawn.fork) return isMainChat(cfg, spawn.parentModel) ? { deny: FORK_DENY_REASON, rule: 'fork-main-chat' } : null
74
75
  const reg = registered && registered.found ? registered : null
75
76
  const pick = (role, rule) => ({ model: roleModel(cfg, role), role, rule })
@@ -65,6 +65,23 @@ test('sets the worker id with suffix and keeps every other field', async () => {
65
65
  assert.equal(res.agentId, 'a1')
66
66
  })
67
67
 
68
+ test('a resumed agent passes through unchanged: same model, no ledger row', async () => {
69
+ const { spawn, writes, logs } = harness({ files: FILES })
70
+ const input = e({ tool_use_id: 'toolu_R1', subagentType: 'Explore', model: 'a-model-1', resume: { agentId: 'a7' } })
71
+ const { seen, res } = await spawn(input)
72
+ assert.deepEqual(seen, input)
73
+ assert.equal(res.model, 'a-model-1')
74
+ assert.deepEqual(Object.keys(writes).filter((p) => p.endsWith('toolu_R1.json')), [])
75
+ assert.deepEqual(logs, [])
76
+ })
77
+
78
+ test('a resumed agent on a main-chat model is not rerouted either', async () => {
79
+ const { spawn, writes } = harness({ files: FILES })
80
+ const input = e({ tool_use_id: 'toolu_R2', model: 'opus', resume: { agentId: 'a8' } })
81
+ assert.deepEqual((await spawn(input)).seen, input)
82
+ assert.deepEqual(Object.keys(writes).filter((p) => p.endsWith('toolu_R2.json')), [])
83
+ })
84
+
68
85
  test('typeRoles type goes to assistant', async () => {
69
86
  const { spawn } = harness({ files: FILES })
70
87
  assert.equal((await spawn(e({ subagentType: 'Explore' }))).seen.model, 'a-model-1')
@@ -80,6 +80,17 @@ test('workflow agents and bad config leave the spawn unchanged', () => {
80
80
  assert.equal(decide(CFG, null, none), null)
81
81
  })
82
82
 
83
+ test('a resumed agent is left unchanged whatever its type, request or registration', () => {
84
+ const resume = { agentId: 'a7' }
85
+ assert.equal(decide(CFG, spawn({ resume }), none), null)
86
+ assert.equal(decide(CFG, spawn({ resume, model: 'haiku' }), none), null)
87
+ assert.equal(decide(CFG, spawn({ resume, model: 'opus' }), none), null)
88
+ assert.equal(decide(CFG, spawn({ resume, subagentType: 'Explore' }), none), null)
89
+ assert.equal(decide(CFG, spawn({ resume, prompt: '[routing:role=worker] x' }), none), null)
90
+ assert.equal(decide(CFG, spawn({ resume }), { found: true, role: 'assistant', model: '' }), null)
91
+ assert.equal(decide(CFG, spawn({ resume, fork: true, parentModel: 'big-opus-9-9' }), none), null)
92
+ })
93
+
83
94
  test('a role missing from workerRoles is never chosen by request or type', () => {
84
95
  const cfg = { ...CFG, workerRoles: ['worker'] }
85
96
  assert.equal(decide(cfg, spawn({ subagentType: 'Explore' }), none).role, 'worker')
@@ -63,3 +63,25 @@ test('session start writes a loaded heartbeat for this session', async ($, on) =
63
63
  expect(file).toBeDefined()
64
64
  expect(JSON.parse(writes[file as string]).loaded).toBe(true)
65
65
  })
66
+
67
+ test('a resumed agent keeps its model and writes no ledger row', async ($, on) => {
68
+ mock.clock(on)
69
+ const writes: Record<string, string> = {}
70
+ on('env.get', ($, e) => ({ value: e.name === 'USERPROFILE' ? 'C:/home' : undefined }))
71
+ on('fs.read', ($, e) => {
72
+ if (!/[\\/]models\.json$/.test(e.path)) throw new Error('ENOENT ' + e.path)
73
+ return { value: JSON.stringify(CFG) }
74
+ })
75
+ on('fs.write', ($, e) => {
76
+ writes[e.path] = e.text
77
+ return { value: undefined }
78
+ })
79
+ on('session.cwd', () => ({ value: 'C:/work/proj' }))
80
+ on('session.id', () => ({ value: 'sess-3' }))
81
+ on('ui.log', () => ({ value: undefined }))
82
+ on('agent.spawn', ($, e) => ({ model: e.model, agentId: 'a1' }))
83
+
84
+ const res = await $.agent.spawn({ tool_use_id: 'toolu_R9', prompt: 'p', description: 'd', subagentType: 'general-purpose', model: 'a-model-1', fork: false, background: true, name: 'n9', resume: { agentId: 'a7' } })
85
+ expect(res.model).toBe('a-model-1')
86
+ expect(Object.keys(writes).some((p) => p.endsWith('toolu_R9.json'))).toBe(false)
87
+ })
@@ -17,6 +17,7 @@ Orchestrator/dispatcher agents are never routable candidates: they are
17
17
  main-session personas (agent_dispatch_guard denies dispatching them), so a
18
18
  lock naming one would deadlock the message. Relayed teammate/agent messages
19
19
  and local-command output are not user prompts and are skipped entirely.
20
+ A typed /skill prompt without an @tag leaves the existing lock untouched.
20
21
 
21
22
  The result is written to <cwd>/.claude/.route_lock.json. agent_model_guard.py
22
23
  reads (never writes) that file to enforce it: a farm-style dispatch of a
@@ -107,6 +108,13 @@ def is_relayed_message(prompt: str) -> bool:
107
108
  return any(marker in head for marker in _RELAY_MARKERS)
108
109
 
109
110
 
111
+ _SLASH_COMMAND_RE = re.compile(r"^/[A-Za-z0-9][A-Za-z0-9_.:-]*(?:\s|$)")
112
+
113
+
114
+ def is_slash_command(prompt: str) -> bool:
115
+ return bool(_SLASH_COMMAND_RE.match((prompt or "").lstrip()))
116
+
117
+
110
118
  def _marker_counts(path: str, marker: str) -> bool:
111
119
  """A marker file counts unless the .claude persona opts out with
112
120
  `farm_style: false` in its frontmatter; any read/parse problem counts."""
@@ -199,6 +199,16 @@ def _safe_main() -> None:
199
199
  # prompt: no lock write, no triage run, no preamble; any
200
200
  # existing lock stays untouched.
201
201
 
202
+ if route_lock.is_slash_command(prompt):
203
+ try:
204
+ registered = route_lock.list_registered_agent_names(cwd)
205
+ routable = registered | set(route_lock.list_dispatcher_flows(cwd).keys())
206
+ tagged = route_lock.explicit_route_from_message(prompt, routable)
207
+ except Exception:
208
+ tagged = None
209
+ if not tagged:
210
+ return # typed /skill args carry no route; keep the existing lock
211
+
202
212
  context_parts: list[str] = []
203
213
  gate: dict | None = None
204
214
  gate_attempted = False
@@ -24,12 +24,16 @@ Global Claude Code skills. Installed to `~/.claude/skills/` — each subdirector
24
24
  | `mattpocock-wayfinder` | `/wayfinder` · "plan this as a map" · "this is too big for one session" · "chart the decisions before we build" | Skill |
25
25
  | `resume-session` | `/resume-session` · "resume session" · "find my past sessions" · "I lost my session" | Skill |
26
26
  | `session-trace` | no slash command · "archive this session" · "render the transcript" · "build a handoff doc from this session" | Skill |
27
+ | `visual-gen` | `/visual-gen` · "generate an image" · "make an illustration" · "compare image providers" · "pause image generation" | Skill |
27
28
 
28
29
  ## Skill details
29
30
 
30
31
  ### disk-cleanup
31
32
  Deterministic Windows disk-space reclamation, codified from a manual 59GB→361GB cleanup session (2026-07-12). Robocopy-based scanning + three-tier classification (safe-tier auto-clean, judgment-tier always-ask, needs-elevation prints the command). Includes a read-only git-worktree safety audit (uncommitted files, unmerged commits, stale-lock detection) that gates worktree deletion behind explicit per-item confirmation. Never self-elevates.
32
33
 
34
+ ### visual-gen
35
+ Project-agnostic image generation behind one provider interface. Default provider is ChatGPT through the local Codex CLI (no API key, uses the ChatGPT plan quota); Meshy and Gemini are adapters behind the same interface, and adding one is a single file plus a config block. The caller picks the output path; the library guarantees a valid image there plus a `<out>.json` sidecar and never resizes. Layered config (built-in, user, project, caller, CLI), per-provider image caps, `PAUSE.<provider>` / `PAUSE.all` pause files, and a usage log of counts and tokens. `--provider a,b,c` runs the same requests through each provider one after another and `compare` builds a side-by-side sheet. Keys are read through the environment or the project env file and never printed.
36
+
33
37
  ### low-ram-advisor
34
38
  Non-blocking, suggest-only RAM triage, the memory analogue of `make-space`. Any free-RAM check runs `advisor.py start --source S --free-gb F --required-gb R`, which spawns a detached hidden analysis (`pythonw`, no window) and prints exactly one line, the report path, in under a second; the caller keeps working. Each calling session gets its own report (`~/.claude/logs/low-ram-advisor/latest-<key>.md` + `.json`, plus `state-<key>.json`; one shared raw `snapshot.json` per cooldown window) that groups Claude sessions, Metro/node, Gradle/Java, Maestro, emulator, browsers, WSL/Docker, local proxies and IDEs with owner, safe-to-stop (`yes` only for the caller's own dev processes; shared daemons and other live sessions never), RAM freed, rank and a graceful pwsh stop command. The cooldown (default 300 s) is per session, and an atomic lock prevents scan storms. Reports and state files older than 7 days (env `LOW_RAM_ADVISOR_RETENTION_DAYS`) are pruned best-effort by the detached child. The code has no kill/suspend path; tests assert it. Optional owner hints: `~/.claude/low-ram-advisor-hints.json`.
35
39
 
@@ -37,7 +41,7 @@ Non-blocking, suggest-only RAM triage, the memory analogue of `make-space`. Any
37
41
  One-call disk reclamation meant to run in a single background subagent so the calling chat only receives a compact JSON report. Thin layer over `disk-cleanup`: deletes only allowlisted regenerable data (package caches, gradle caches, recycle bin, Temp older than 1 day with `Temp\claude` excluded) behind a code-enforced path guard with a hard denylist and `.git` protection; judgment items and removable worktrees are reported, never deleted. `-DryRun` previews; `-RemoveWorktrees` removes only audit-clean worktrees after user approval.
38
42
 
39
43
  ### graphic-novel-pipeline
40
- Repeatable audio/text to graphic-novel pipeline (S0 source to S10 publish) driven by a per-project `project.json` and a single-source `style/continuity.json`. `pipeline.py` dispatches `status | plan | style | compile | generate | curate | layout | export | publish`. Code enforces the rules: `generate_all.py` refuses without approved G0/G1/G2 gates and an explicit spend cap, calls Meshy only (Google is disabled until the founder enables it), spends monthly credits first from a credits ledger, and appends every paid call to a spend log. The look is a swappable theme file of colour roles; `post_process.py` (S6b) quantises, snaps, grains and drains in code with no credits. A `PAUSE` file stops every paid call. `compile_prompts.py` builds prompts from briefs plus continuity data and lints for forbidden terms, unknown characters and missing clothing. The 12 core colour roles can be extended per project with `extra_roles` in continuity; character `props` and `world_facts` enter a prompt only when the panel brief names them; `post.quantise.strength` and `skip_lightness` soften the palette snap. Keys are read through `gn_common.env_value` and never printed. `plan`, `layout`, `export`, `publish` have no generic script yet.
44
+ Repeatable audio/text to graphic-novel pipeline (S0 source to S10 publish) driven by a per-project `project.json` and a single-source `style/continuity.json`. `pipeline.py` dispatches `status | plan | style | compile | generate | curate | layout | export | publish`. Code enforces the rules: `generate_all.py` refuses without approved G0/G1/G2 gates and an explicit spend cap, calls Meshy only (Google is disabled until the founder enables it), spends monthly credits first from a credits ledger, and appends every paid call to a spend log. The look is a swappable theme file of colour roles; `post_process.py` (S6b) quantises, snaps, grains and drains in code with no credits. A `PAUSE` file stops every paid call. `compile_prompts.py` builds prompts from briefs plus continuity data and lints for forbidden terms, unknown characters and missing clothing. The 12 core colour roles can be extended per project with `extra_roles` in continuity; character `props` and `world_facts` enter a prompt only when the panel brief names them; `post.quantise.strength` and `skip_lightness` soften the palette snap. Keys are read through `gn_common.env_value` and never printed. `plan`, `layout`, `export`, `publish` have no generic script yet. `source_trace.py` is the source-fidelity gate: for novels in `project.json` `source_trace.enforce_novels`, `compile` (lint error), `generate_all.py` (exit 7) and the project's lettering import, approve and export steps refuse a panel whose text lacks verbatim quotes from `source/` or changed since its last recorded check; Every part also needs a recorded three-level review (book arc, chapter source, part beats; `part-check`, `part-record`): part K+1 is not compiled or generated without a current review and a passing blind adversarial review of part K (`adv-pack`, a separate reviewer subagent that tries to prove the part does NOT fit, `adv-record`), and lettering approve refuses a stale part review. `--override-source-trace REASON` passes and is logged. `workflow.py` (`status`, `next`, `done`, `capabilities`) keeps one ordered step list per part (founder stops: text approval, image budget, look, story change) and calls these checks; `pic-pack` and `pic-record` add a blind picture review that gates `part_close`.
41
45
 
42
46
  ### launch-litellm
43
47
  Brings the LiteLLM proxy (`127.0.0.1:4000`) up in a **visible** window that survives the