@yasaswy.nagavolu/agents 0.27.2 → 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.
- package/content/agents/adversarial-story-reviewer.md +48 -0
- package/content/agents/picture-beat-reviewer.md +47 -0
- package/content/manifest.json +12 -0
- package/content/mods/handoff/README.md +1 -1
- package/content/mods/handoff/hooks/register.js +3 -2
- package/content/mods/handoff/lib/keepwarm.mjs +7 -0
- package/content/mods/handoff/tests/e2e/run_e2e.py +7 -1
- package/content/mods/handoff/tests/e2e/run_real_prep.py +6 -1
- package/content/mods/handoff/tests/keepwarm.test.mjs +17 -0
- package/content/mods/handoff/tests/register.test.mjs +54 -0
- package/content/mods/model-routing/hooks/register.js +1 -0
- package/content/mods/model-routing/lib/route.mjs +2 -1
- package/content/mods/model-routing/tests/register.test.mjs +17 -0
- package/content/mods/model-routing/tests/route.test.mjs +11 -0
- package/content/mods/model-routing/tests/routing.test.ts +22 -0
- package/content/proxy/route_lock.py +8 -0
- package/content/proxy/triage_gate_hook.py +10 -0
- package/content/skills/README.md +5 -1
- package/content/skills/graphic-novel-pipeline/SKILL.md +32 -37
- package/content/skills/graphic-novel-pipeline/reference.md +179 -0
- package/content/skills/graphic-novel-pipeline/scripts/compile_prompts.py +70 -10
- package/content/skills/graphic-novel-pipeline/scripts/framing.py +31 -0
- package/content/skills/graphic-novel-pipeline/scripts/generate_all.py +318 -94
- package/content/skills/graphic-novel-pipeline/scripts/generate_art_gemini.py +38 -68
- package/content/skills/graphic-novel-pipeline/scripts/generate_art_meshy.py +71 -107
- package/content/skills/graphic-novel-pipeline/scripts/new_version.py +6 -0
- package/content/skills/graphic-novel-pipeline/scripts/panel_ids.py +321 -0
- package/content/skills/graphic-novel-pipeline/scripts/picture_review.py +367 -0
- package/content/skills/graphic-novel-pipeline/scripts/pipeline.py +13 -4
- package/content/skills/graphic-novel-pipeline/scripts/post_process.py +1 -1
- package/content/skills/graphic-novel-pipeline/scripts/renumber_panels.py +454 -0
- package/content/skills/graphic-novel-pipeline/scripts/scene_sets.py +115 -0
- package/content/skills/graphic-novel-pipeline/scripts/sheets.py +55 -1
- package/content/skills/graphic-novel-pipeline/scripts/source_trace.py +1076 -0
- package/content/skills/graphic-novel-pipeline/scripts/theme.py +14 -0
- package/content/skills/graphic-novel-pipeline/scripts/visualgen_bridge.py +62 -0
- package/content/skills/graphic-novel-pipeline/scripts/workflow.py +548 -0
- package/content/skills/graphic-novel-pipeline/templates/adversarial_review_prompt.md +68 -0
- package/content/skills/graphic-novel-pipeline/templates/continuity.json +1 -0
- package/content/skills/graphic-novel-pipeline/templates/picture_review_prompt.md +53 -0
- package/content/skills/graphic-novel-pipeline/templates/project.json +13 -0
- package/content/skills/graphic-novel-pipeline/templates/workflow.json +156 -0
- package/content/skills/graphic-novel-pipeline/tests/test_panel_ids.py +323 -0
- package/content/skills/graphic-novel-pipeline/tests/test_routes.py +287 -0
- package/content/skills/graphic-novel-pipeline/tests/test_saturation_levels.py +40 -0
- package/content/skills/graphic-novel-pipeline/tests/test_scene_pins.py +138 -0
- package/content/skills/graphic-novel-pipeline/tests/test_sheets.py +52 -0
- package/content/skills/graphic-novel-pipeline/tests/test_shot_size.py +89 -0
- package/content/skills/graphic-novel-pipeline/tests/test_source_trace.py +250 -0
- package/content/skills/graphic-novel-pipeline/tests/test_spend_refs.py +1 -0
- package/content/skills/graphic-novel-pipeline/tests/test_workflow.py +593 -0
- package/content/skills/visual-gen/SKILL.md +97 -0
- package/content/skills/visual-gen/scripts/visualgen/__init__.py +1 -0
- package/content/skills/visual-gen/scripts/visualgen/compare.py +69 -0
- package/content/skills/visual-gen/scripts/visualgen/config.py +131 -0
- package/content/skills/visual-gen/scripts/visualgen/engine.py +162 -0
- package/content/skills/visual-gen/scripts/visualgen/guard.py +86 -0
- package/content/skills/visual-gen/scripts/visualgen/imaging.py +109 -0
- package/content/skills/visual-gen/scripts/visualgen/keys.py +34 -0
- package/content/skills/visual-gen/scripts/visualgen/model.py +60 -0
- package/content/skills/visual-gen/scripts/visualgen/providers/__init__.py +0 -0
- package/content/skills/visual-gen/scripts/visualgen/providers/base.py +82 -0
- package/content/skills/visual-gen/scripts/visualgen/providers/chatgpt_codex.py +286 -0
- package/content/skills/visual-gen/scripts/visualgen/providers/gemini.py +97 -0
- package/content/skills/visual-gen/scripts/visualgen/providers/meshy.py +146 -0
- package/content/skills/visual-gen/scripts/visualgen/providers/registry.py +42 -0
- package/content/skills/visual-gen/scripts/visualgen/quota.py +157 -0
- package/content/skills/visual-gen/scripts/visualgen/runner.py +103 -0
- package/content/skills/visual-gen/scripts/visualgen_cli.py +328 -0
- package/content/skills/visual-gen/templates/codex_job_capture.txt +5 -0
- package/content/skills/visual-gen/templates/codex_job_model.txt +6 -0
- package/content/skills/visual-gen/templates/codex_prompt_capture.txt +8 -0
- package/content/skills/visual-gen/templates/codex_prompt_model.txt +9 -0
- package/content/skills/visual-gen/templates/config.json +52 -0
- package/content/skills/visual-gen/tests/_util.py +173 -0
- package/content/skills/visual-gen/tests/test_cli.py +166 -0
- package/content/skills/visual-gen/tests/test_codex.py +210 -0
- package/content/skills/visual-gen/tests/test_config_guard.py +115 -0
- package/content/skills/visual-gen/tests/test_engine.py +185 -0
- package/content/skills/visual-gen/tests/test_http_providers.py +126 -0
- package/content/skills/visual-gen/tests/test_options.py +164 -0
- package/content/skills/visual-gen/tests/test_quota.py +151 -0
- package/lib/codex-trust.js +8 -2
- package/lib/codex.js +2 -1
- package/package.json +1 -1
|
@@ -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.
|
package/content/manifest.json
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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()
|
|
@@ -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
|
package/content/skills/README.md
CHANGED
|
@@ -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
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: graphic-novel-pipeline
|
|
3
|
-
description: Run or continue an audio-or-text to graphic-novel pipeline (book arc, chapter plans with a review and feedback loop, swappable theme file with colour roles, image prompts, Meshy generation with spend cap and credits ledger, deterministic post-process, curation, page layout variants, exports for tablet, print, phone and web). Use when the user says "start a new graphic novel", "turn this audio/text into a graphic novel", "plan the book arc", "plan the panels", "review the plan", "record my feedback", "new plan version", "change the theme", "keep the characters and colours consistent", "compile prompts", "generate the images", "post-process the images", "curate the images", "build the pages", "export the novel", "publish checklist", "graphic novel status", "meshy credits", "pause generation", or invokes /graphic-novel-pipeline.
|
|
3
|
+
description: Run or continue an audio-or-text to graphic-novel pipeline (book arc, chapter plans with a review and feedback loop, swappable theme file with colour roles, image prompts, Meshy generation with spend cap and credits ledger, deterministic post-process, curation, page layout variants, exports for tablet, print, phone and web). Use when the user says "start a new graphic novel", "turn this audio/text into a graphic novel", "plan the book arc", "plan the panels", "review the plan", "record my feedback", "new plan version", "change the theme", "keep the characters and colours consistent", "compile prompts", "generate the images", "post-process the images", "curate the images", "build the pages", "export the novel", "publish checklist", "review the part", "three-level review", "part review", "what is next", "workflow status", "capabilities", "picture review", "graphic novel status", "meshy credits", "pause generation", or invokes /graphic-novel-pipeline.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# graphic-novel-pipeline
|
|
7
7
|
|
|
8
8
|
WHAT: one repeatable pipeline per project. Mechanics live in `scripts/`; paths, gates and state
|
|
9
9
|
in the project's `project.json`; invariants in `style/continuity.json`; the look in `style/themes/<id>.json`.
|
|
10
|
-
Project docs: `docs/architecture.md`, `docs/repo-layout.md`, `docs/how-to-use.md`, `docs/style-research.md`.
|
|
10
|
+
Project docs: `docs/architecture.md`, `docs/repo-layout.md`, `docs/how-to-use.md`, `docs/style-research.md`. Layout variants and theme swaps are free to re-render; new model art costs credits.
|
|
11
11
|
|
|
12
12
|
## Stages
|
|
13
|
-
|
|
14
13
|
```yaml
|
|
15
14
|
stages:
|
|
16
15
|
S2_concept: {out: concept/}
|
|
@@ -27,8 +26,6 @@ stages:
|
|
|
27
26
|
S10_publish: {out: checklist, gate: G4}
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
Layout variants and theme swaps are free to re-render; new model art costs credits.
|
|
31
|
-
|
|
32
29
|
## Commands
|
|
33
30
|
|
|
34
31
|
Run: `python ~/.claude/skills/graphic-novel-pipeline/scripts/pipeline.py [--root DIR] <command> [args]`
|
|
@@ -43,7 +40,7 @@ Run: `python ~/.claude/skills/graphic-novel-pipeline/scripts/pipeline.py [--root
|
|
|
43
40
|
| `generate` | Manifest -> images; dry run unless `--yes-spend` | G2 (cap) |
|
|
44
41
|
| `post` | S6b: quantise (soft with `strength`), pixel snap, grain, drain, QA (Pillow; no credits) | none |
|
|
45
42
|
| `curate` | Contact sheets, panel manifest, print-dpi check | none |
|
|
46
|
-
| `credits` | Show or set the Meshy credits ledger | none |
|
|
43
|
+
| `credits` | Show or set the Meshy credits ledger (chatgpt spends none) | none |
|
|
47
44
|
| `pause`, `resume` | Create or delete the `PAUSE` file | none |
|
|
48
45
|
| `layout`, `export`, `publish` | No generic script: dispatch a worker with the project's builders | G3, none, G4 |
|
|
49
46
|
|
|
@@ -57,48 +54,46 @@ Run: `python ~/.claude/skills/graphic-novel-pipeline/scripts/pipeline.py [--root
|
|
|
57
54
|
| G3 | Which layout variant and typography? | `stages.S8_layout_variants.gate_status` |
|
|
58
55
|
| G4 | Release checklist complete? | `stages.S10_publish.gate_status` |
|
|
59
56
|
|
|
60
|
-
|
|
57
|
+
`reference.md` (same folder): routes (`chatgpt`, `meshy`, `google`), guards, exit codes, Meshy spend checks, and the schema keys of continuity, plan, panel, cast and theme. Image work goes through the visual-gen skill; a missing skill stops the run.
|
|
58
|
+
|
|
59
|
+
## Workflow
|
|
60
|
+
|
|
61
|
+
Start every session and every part with `python scripts/workflow.py --chapter N next`: the one next step, its owner (auto or founder) and the exact command, so no step is repeated or forgotten. `status` lists every step. Founder stops (text approval, image budget, look, any story or text change) are never run by an agent. Every stage, command, gate and what it blocks: `reference.md` section Capabilities, generated from `templates/workflow.json`.
|
|
62
|
+
```yaml
|
|
63
|
+
workflow: {state: plan/<novel>/ch<N>_workflow.json, config: project.json workflow{commands, lettering_check, export_glob}, cli: [status, next, done, init, capabilities]}
|
|
64
|
+
reviewers: {story: agents/adversarial-story-reviewer via adv-pack and adv-record, picture: agents/picture-beat-reviewer via pic-pack and pic-record, rule: blind, worker role, fresh id each round}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Source trace
|
|
61
68
|
|
|
62
|
-
|
|
69
|
+
Story text never drifts from the source: every panel is traced to verbatim quotes in `source/`, every part fits three levels (book arc, chapter source, part beats), and a blind adversarial subagent tries to prove each part does NOT fit. A changed text must be re-checked.
|
|
70
|
+
```yaml
|
|
71
|
+
source_trace:
|
|
72
|
+
config: project.json source_trace # enforce_novels, trace, plan, lettering, allowed_roots, story_roots, part_roots, strict
|
|
73
|
+
check_record: source_trace.py --chapter N check|record [--panels 1.1], part-check|part-record --part P1 # trace plan/<novel>/ch<N>_source_trace.json, part review ch<N>_part_review.json (schemas: reference.md); check exit 1: no entry, quote not verbatim, outside roots, diverges, stale; record stamps the hash after a deliberate re-check, logged; part-record refuses while a level or adversarial review fails
|
|
74
|
+
after_each_part: [part-record by author, adv-pack (blind packet and dispatch line), dispatch blind reviewer as worker with a fresh id, adv-record --file result.json (refuses unverifiable quote, same or reused reviewer, stale hash, no packet), fix text or add resolutions, part-check]
|
|
75
|
+
gates: {compile and generate: panel trace, and part K+1 needs a current review and a passing adversarial review of part K (exit 7); lettering approve: part review not stale; import and export: panel trace; override: --override-source-trace REASON, logged to plan/<novel>/source_trace_log.jsonl}
|
|
76
|
+
```
|
|
63
77
|
|
|
64
78
|
## Hard rules
|
|
65
79
|
|
|
66
|
-
- Never
|
|
67
|
-
- Never call a route whose `enabled` flag is false. Never print or log a key (`gn_common.env_value` only).
|
|
80
|
+
- Never record a trace without reading the quoted source lines. A `diverges` verdict is fixed in the text, not overridden. A reviewer subagent never sees the author's verdicts.
|
|
81
|
+
- Never generate without G0, G2, an explicit spend cap and an approved part (`generate_all.py` refuses). Never call a route whose `enabled` flag is false. Never print or log a key (`gn_common.env_value` only).
|
|
68
82
|
- Pause = create `PAUSE`; resume = delete it. Every paid call checks it first (exit 3, no retry). Run paid jobs in the background; never rely on messages to stop a run.
|
|
69
83
|
- Roles, not values: plan and briefs name colour roles (`cloth_a`), never a hex or a style word. Hex and style live only in the theme file. Value order, panel count, grid, text units, identity, shot, placement and realm do not change on a theme swap.
|
|
70
|
-
- The model cannot lock a palette, halftone or pixel grid: do that in S6b code, never in the prompt.
|
|
71
|
-
- Awareness realm = the duty image drained by code (one ink, texture off). The awareness mark is one RGBA silhouette of the protagonist drawn in layout, partly outside the frame, only on panels flagged `awareness_mark: mark`. The prompt never mentions it and no corner is reserved.
|
|
84
|
+
- The model cannot lock a palette, halftone or pixel grid: do that in S6b code, never in the prompt. Awareness realm = the duty image drained by code (one ink, texture off). The awareness mark is one RGBA silhouette of the protagonist drawn in layout, partly outside the frame, only on panels flagged `awareness_mark: mark`. The prompt never mentions it and no corner is reserved.
|
|
72
85
|
- Text is lettered in layout, never by the image model: one unit, 25 words at most. Naming: with `continuity.naming` = `{policy: roles_only, novels: [], forbidden_names: [...]}` no text unit, brief or compiled prompt holds a personal name or a capitalised cast first name (`compile` and `style` lint it); write a role, a pronoun or direct address. Default policy is `free`. No-text lint (`notext.py`, run by `compile` on every panel and sheet prompt): a quoted string, a `Caption:` / `Thought bubble:` / `Speech:` label, a currency sign, a digit (ratios, degrees and unit counts excepted), a writable-object word (list, bill, label, note, calendar, book ...), a letter tag such as `clothes A`, or a cloud count above the plan's `clouds` is a lint error; describe blank or scribbled surfaces instead, and list a one-off exception in `continuity.notext_allow`.
|
|
73
|
-
- Record every founder comment in a ledger first; change a plan only as a new version; every version carries `book_thesis` and `continuity_facts`.
|
|
74
|
-
- Ask the founder at each gate. Never move or delete project files from this skill. Browsers headless only.
|
|
75
|
-
|
|
76
|
-
## Schema keys
|
|
77
|
-
|
|
78
|
-
| Key | File | Rule |
|
|
79
|
-
|---|---|---|
|
|
80
|
-
| `extra_roles` | continuity | Role ids beyond the 12 core roles; each ranked in `value_order`; the theme palette must hold every one. `role_sharing` is optional and informational |
|
|
81
|
-
| `characters.<ref>.clothing` | continuity | Always listed in every prompt of the character |
|
|
82
|
-
| `characters.<ref>.props` | continuity | `{item, role}` list; listed only when the panel names the item in `props_in_panel` |
|
|
83
|
-
| `props_in_panel` | panel `characters[]` entry | List of prop items for this panel; an unknown item is a lint error |
|
|
84
|
-
| `world_facts` | continuity, or plan (plan wins) | `id -> {kind: place\|object\|rule, text}`; id is not a character ref or continuity key; text holds no hex or style word |
|
|
85
|
-
| `framing`, `scene_framing` | panel, continuity | `scene_framing` = `{policy: pose_first\|free, sentence, pose_words?, distance_words?}`. Under `pose_first` every panel needs `framing`: one sentence with the pose, place, camera distance and angle; with characters it needs a pose word. Compile opens the scene with `framing` then `sentence` (a scene, not a sheet) |
|
|
86
|
-
| `continuity_refs` | panel | A world fact id here injects its `text`; `continuity_facts` keys may be character refs or world fact ids |
|
|
87
|
-
| `awareness_mark` | panel, continuity, theme | Panel: `none` or `mark`, required; layout only, the prompt is identical; retired `awareness_head*` fields are a lint error. Continuity `awareness_mark` and theme `layout_assets.awareness_mark`: colour role, asset, anchor `top_left` or `top_middle`, `height_frac_of_panel`, `overhang_frac`, `gutter_margin_frac` >= overhang |
|
|
88
|
-
| `cast_sheet_plan.preprod`, `preprod_ch<N>` | plan/cast.json | One block per chapter: `{novel, chapter, anchor, sheet_dir?, units[]}`; each unit `{id, item, cast_id, sheet, views[], ai_model, refs[], layout, person?, props_in_panel?}` compiles to a `kind: sheet` manifest entry (`part_key` `<letter>-ch<N>-preprod`, `out_path` `<art>/<sheet_dir>/<id>.png`, `refs`, `ai_model`); `sheet_dir` is `_sheets` (default) or a folder under it; `refs` are `anchor` or `unit:<id>` of an earlier unit of the same block, at most 5 |
|
|
89
|
-
| `cast_sheet_plan.preprod.panel_refs` | plan/cast.json | `{default_model, models: {model: [panel ids]}, by_cast: {cast id: unit id}, no_sheet: [cast ids], extra: {panel id: [unit ids or `panel:<panel id>`]}, anchor_in_panels?: bool}`; `panel:<id>` is the image of another panel of the chapter (`<art>/ch<N>/<id>.png`), not checked on disk at compile; compile adds `refs` (anchor, then by_cast sheets of the panel's cast, then extras; at most 5) and `ai_model` to each panel; `anchor_in_panels: false` drops the anchor from panels (use it when the anchor is a scene: image-to-image copies its layout) and a panel left with no sheet is a lint error; a cast id in neither `by_cast` nor `no_sheet` is a lint error. `generate` refuses a run (exit 2, no spend) when a local ref is neither on disk nor made by an earlier entry of the run; the dry run reports it |
|
|
90
|
-
| `post.quantise.strength` | theme | 0..1 blend toward the palette snap; default 1 (full snap) |
|
|
91
|
-
| `post.quantise.skip_lightness` | theme | `[lo, hi]` luma % left unsnapped; default null |
|
|
86
|
+
- Record every founder comment in a ledger first; change a plan only as a new version; every version carries `book_thesis` and `continuity_facts`. Ask the founder at each gate. Never move or delete project files from this skill. Browsers headless only. Panel id = `<part number>.<index in part>` (`2.4` is panel 4 of P2); the layout page is the separate `page` field, never part of the id. `panel_ids.py check` gates compile, generate, letter validate and part review; renumber only with `renumber_panels.py` (`pipeline.py ids map`, then `renumber`).
|
|
92
87
|
|
|
93
88
|
## Scripts
|
|
94
89
|
|
|
95
90
|
| File | Purpose |
|
|
96
91
|
|---|---|
|
|
97
92
|
| `pipeline.py`, `gn_common.py`, `theme.py` | Dispatcher, root and keys and ledgers, theme validation and colour maths |
|
|
98
|
-
| `compile_prompts.py`, `sheets.py`, `naming.py`, `framing.py`, `notext.py`, `post_process.py` | Brief to prompt with lint; character sheet entries from the cast file; roles-only naming lint; pose-first scene framing lint; no-text prompt lint; S6b post-process and QA (skips sheets) |
|
|
99
|
-
| `generate_all.py`, `generate_art_meshy.py`, `generate_art_gemini.py` | Gated generation; Meshy and
|
|
100
|
-
| `new_version.py`, `build_review.py`, `ledger_template.md` | Plan versions, review page, feedback ledger |
|
|
101
|
-
| `
|
|
93
|
+
| `compile_prompts.py`, `sheets.py`, `naming.py`, `framing.py`, `scene_sets.py`, `notext.py`, `post_process.py` | Brief to prompt with lint; character sheet entries from the cast file; roles-only naming lint; pose-first scene framing lint; per-set layout and camera corner; no-text prompt lint; S6b post-process and QA (skips sheets) |
|
|
94
|
+
| `generate_all.py`, `visualgen_bridge.py`, `generate_art_meshy.py`, `generate_art_gemini.py` | Gated generation over routes; bridge to visual-gen; Meshy and Gemini shims over its providers |
|
|
95
|
+
| `new_version.py`, `build_review.py`, `ledger_template.md`, `panel_ids.py`, `renumber_panels.py` | Plan versions, review page, feedback ledger; panel id rule (check, expected, map) and the atomic renumber (page field, art rename, oplog marker) |
|
|
96
|
+
| `source_trace.py`, `workflow.py`, `picture_review.py`, `templates/` | Trace, part review, blind adversarial and picture reviews, gates; workflow state machine; reviewer prompts and `workflow.json` (stdlib only) |
|
|
97
|
+
| `tests/test_*.py` | Plain python, no runner: `python tests/test_roles.py`; one file per area (`test_source_trace.py` covers the gates) |
|
|
102
98
|
|
|
103
|
-
New project: copy `templates
|
|
104
|
-
`status`, `plan`, `review` until a part is approved, `style`, `compile`, `credits`, `generate`, `post`, `curate`.
|
|
99
|
+
New project: copy `templates/*.json` into the root, then `status`, `plan`, `review`, `style`, `compile`, `credits`, `generate`, `post`, `curate`.
|