@yasaswy.nagavolu/agents 0.28.1 → 0.30.0

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 (179) hide show
  1. package/README.md +11 -0
  2. package/bin/cli.js +77 -11
  3. package/content/agents/synth-auditor.md +59 -0
  4. package/content/global/hooks/lib/modeDrift.js +2 -2
  5. package/content/hooks/conclusion-scribe/README.md +31 -22
  6. package/content/hooks/conclusion-scribe/conclusion_scribe_hook.py +145 -45
  7. package/content/hooks/conclusion-scribe/test_conclusion_scribe_hook.py +274 -0
  8. package/content/hooks/worktree-registry/README.md +51 -0
  9. package/content/hooks/worktree-registry/test_worktree_registry.py +340 -0
  10. package/content/hooks/worktree-registry/worktree_registry.py +322 -0
  11. package/content/manifest.json +169 -5
  12. package/content/mods/handoff/.claude-plugin/plugin.json +1 -1
  13. package/content/mods/handoff/HINT-PEEK.md +36 -0
  14. package/content/mods/handoff/README.md +5 -5
  15. package/content/mods/handoff/hooks/register.js +59 -2
  16. package/content/mods/handoff/lib/hint.mjs +34 -0
  17. package/content/mods/handoff/lib/peek.mjs +65 -0
  18. package/content/mods/handoff/lib/policy.mjs +1 -0
  19. package/content/mods/handoff/tests/e2e/run_e2e.py +3 -0
  20. package/content/mods/handoff/tests/e2e/tui_hint_peek_e2e.py +116 -0
  21. package/content/mods/handoff/tests/handoff.test.ts +34 -2
  22. package/content/mods/handoff/tests/hint.test.mjs +70 -0
  23. package/content/mods/handoff/tests/peek.test.mjs +98 -0
  24. package/content/mods/handoff/tests/register-hint-peek.test.mjs +292 -0
  25. package/content/mods/handoff/tests/template.test.mjs +1 -1
  26. package/content/mods/model-routing/.claude-plugin/plugin.json +2 -2
  27. package/content/mods/model-routing/README.md +20 -3
  28. package/content/mods/model-routing/hooks/register.js +26 -5
  29. package/content/mods/model-routing/lib/route.mjs +72 -1
  30. package/content/mods/model-routing/tests/e2e/run_routing_e2e.py +5 -2
  31. package/content/mods/model-routing/tests/e2e/run_workflow_e2e.py +158 -0
  32. package/content/mods/model-routing/tests/register.test.mjs +54 -2
  33. package/content/mods/model-routing/tests/route.test.mjs +93 -4
  34. package/content/mods/model-routing/tests/routing.test.ts +28 -0
  35. package/content/mods/model-routing/tests/workflow_parity.mjs +14 -0
  36. package/content/proxy/README.md +5 -1
  37. package/content/proxy/agent_model_guard.py +18 -4
  38. package/content/proxy/bg_process_register_hook.py +12 -13
  39. package/content/proxy/bg_process_registry.py +96 -9
  40. package/content/proxy/chat_inbox_hook.py +39 -9
  41. package/content/proxy/chat_ledger.py +146 -7
  42. package/content/proxy/chromium_gpu.py +65 -0
  43. package/content/proxy/execution_worker_review_gate.py +837 -23
  44. package/content/proxy/handover_ledger_hook.py +36 -9
  45. package/content/proxy/html_mocker_monitor_guard.py +3 -3
  46. package/content/proxy/html_mocker_subagent_guard.py +1 -1
  47. package/content/proxy/litellm/call_feed.ps1 +1 -0
  48. package/content/proxy/litellm/call_log.py +3 -0
  49. package/content/proxy/mem_sampler.py +139 -8
  50. package/content/proxy/memory_first_hook.py +41 -1
  51. package/content/proxy/memory_reclaim.py +4 -3
  52. package/content/proxy/portal/README.md +7 -0
  53. package/content/proxy/portal/aggregator.py +4 -1
  54. package/content/proxy/portal/portal_wait.ps1 +42 -0
  55. package/content/proxy/portal/register-autostart.ps1 +3 -1
  56. package/content/proxy/portal/start-portal.ps1 +13 -2
  57. package/content/proxy/portal/supervise_portal_hidden.vbs +4 -2
  58. package/content/proxy/proc_policy.py +52 -9
  59. package/content/proxy/project_resolver.py +3 -1
  60. package/content/proxy/route_lock.py +349 -6
  61. package/content/proxy/routing_escalation_hook.py +3 -1
  62. package/content/proxy/routing_log.py +19 -1
  63. package/content/proxy/routing_post_hook.py +3 -1
  64. package/content/proxy/tracking_sweep.py +60 -0
  65. package/content/proxy/video_encoder.py +96 -0
  66. package/content/scripts/backfill_armed_repos.py +78 -0
  67. package/content/scripts/gitlab_api.py +2 -1
  68. package/content/scripts/review_pass.py +256 -0
  69. package/content/scripts/test_review_pass.py +262 -0
  70. package/content/scripts/tests/test_gitlab_api_utf8.py +33 -0
  71. package/content/scripts/validate_violations_schema.py +133 -0
  72. package/content/skills/README.md +5 -1
  73. package/content/skills/android-emulator/SKILL.md +43 -0
  74. package/content/skills/android-emulator/emulator_launch.py +255 -0
  75. package/content/skills/android-emulator/tests/test_emulator_launch.py +176 -0
  76. package/content/skills/ci-runner/SKILL.md +5 -0
  77. package/content/skills/disk-cleanup/SKILL.md +2 -2
  78. package/content/skills/disk-cleanup/purge_walker.ps1 +15 -2
  79. package/content/skills/disk-cleanup/worktree_audit.ps1 +128 -30
  80. package/content/skills/edit-videos/SKILL.md +1 -1
  81. package/content/skills/edit-videos/engine/blur.py +5 -4
  82. package/content/skills/edit-videos/engine/ffmpeg_io.py +9 -0
  83. package/content/skills/edit-videos/engine/timeline.py +12 -11
  84. package/content/skills/edit-videos/tests/conftest.py +6 -0
  85. package/content/skills/edit-videos/tests/test_timeline.py +26 -0
  86. package/content/skills/graphic-novel-pipeline/SKILL.md +13 -13
  87. package/content/skills/graphic-novel-pipeline/reference.md +71 -4
  88. package/content/skills/graphic-novel-pipeline/scripts/comic_txt.py +1130 -0
  89. package/content/skills/graphic-novel-pipeline/scripts/comic_txt_html.py +417 -0
  90. package/content/skills/graphic-novel-pipeline/scripts/compile_prompts.py +13 -1
  91. package/content/skills/graphic-novel-pipeline/scripts/direction.py +81 -0
  92. package/content/skills/graphic-novel-pipeline/scripts/synth_audit.py +353 -0
  93. package/content/skills/graphic-novel-pipeline/scripts/workflow.py +212 -21
  94. package/content/skills/graphic-novel-pipeline/templates/comic_txt_FORMAT.md +140 -0
  95. package/content/skills/graphic-novel-pipeline/templates/workflow.json +36 -0
  96. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/comic_txt/WORLD.md +111 -0
  97. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/comic_txt/_audit/1_duty_audit.md +53 -0
  98. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/comic_txt/ch1_duty.md +849 -0
  99. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/plan/book_arc.json +45 -0
  100. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/plan/cast.json +2227 -0
  101. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/plan/novel_b/ch1_captions_draft.json +105 -0
  102. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/plan/novel_b/ch1_comic_txt_lock.json +24 -0
  103. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/plan/novel_b/ch1_parts.json +1220 -0
  104. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/project.json +308 -0
  105. package/content/skills/graphic-novel-pipeline/tests/fixtures/comic_txt_ch1/source/synth_txt/1_duty_part.txt +89 -0
  106. package/content/skills/graphic-novel-pipeline/tests/test_comic_txt.py +638 -0
  107. package/content/skills/graphic-novel-pipeline/tests/test_comic_txt_html.py +219 -0
  108. package/content/skills/graphic-novel-pipeline/tests/test_direction.py +128 -0
  109. package/content/skills/graphic-novel-pipeline/tests/test_synth_audit.py +214 -0
  110. package/content/skills/graphic-novel-pipeline/tests/test_workflow_chapter.py +284 -0
  111. package/content/skills/heavy-gate-runner/SKILL.md +1 -1
  112. package/content/skills/heavy-gate-runner/heavy_gate_runner.py +23 -2
  113. package/content/skills/heavy-gate-runner/tests/test_heavy_gate_runner.py +48 -0
  114. package/content/skills/html-mocker/SKILL.md +2 -1
  115. package/content/skills/html-mocker/mocker.py +18 -2
  116. package/content/skills/html-mocker/tests/test_mocker_renderer.py +45 -0
  117. package/content/skills/html-mocker/tests/test_software_renderer_default.py +6 -0
  118. package/content/skills/low-ram-advisor/SKILL.md +17 -2
  119. package/content/skills/low-ram-advisor/advisor.py +94 -15
  120. package/content/skills/low-ram-advisor/autofree.py +265 -0
  121. package/content/skills/low-ram-advisor/deep_report.py +553 -0
  122. package/content/skills/low-ram-advisor/memprobe.py +327 -0
  123. package/content/skills/low-ram-advisor/memwatch.py +247 -0
  124. package/content/skills/low-ram-advisor/pooltags.py +145 -0
  125. package/content/skills/low-ram-advisor/ram_prompt.py +74 -0
  126. package/content/skills/low-ram-advisor/tests/conftest.py +10 -0
  127. package/content/skills/low-ram-advisor/tests/test_advisor.py +2 -1
  128. package/content/skills/low-ram-advisor/tests/test_advisor_deep.py +45 -0
  129. package/content/skills/low-ram-advisor/tests/test_autofree.py +210 -0
  130. package/content/skills/low-ram-advisor/tests/test_deep_report.py +386 -0
  131. package/content/skills/low-ram-advisor/tests/test_deep_report_noise.py +286 -0
  132. package/content/skills/low-ram-advisor/tests/test_memwatch.py +175 -0
  133. package/content/skills/low-ram-advisor/tests/test_pooltags.py +96 -0
  134. package/content/skills/low-ram-advisor/tests/test_ram_prompt.py +102 -0
  135. package/content/skills/make-space/SKILL.md +17 -7
  136. package/content/skills/make-space/allowlist.json +10 -0
  137. package/content/skills/make-space/make_space.ps1 +94 -11
  138. package/content/skills/make-space/scratch_guard.ps1 +189 -0
  139. package/content/skills/make-space/space_guard.ps1 +14 -2
  140. package/content/skills/make-space/tests/conftest.py +8 -0
  141. package/content/skills/make-space/tests/test_scratch_cleanup.py +246 -0
  142. package/content/skills/make-space/tests/test_worktree_audit.py +153 -0
  143. package/content/skills/publish-article/SKILL.md +4 -0
  144. package/content/skills/publish-article/publish_article.py +24 -8
  145. package/content/skills/publish-article/tests/conftest.py +7 -0
  146. package/content/skills/publish-article/tests/test_publish_article.py +6 -0
  147. package/content/skills/ship-the-code/SKILL.md +4 -3
  148. package/content/skills/ship-the-code/ship.py +171 -16
  149. package/content/skills/ship-the-code/tests/test_ship.py +352 -0
  150. package/content/statusline/orchestration-line.ps1 +139 -0
  151. package/content/statusline/orchestration_line.py +184 -0
  152. package/content/statusline/statusline-command.ps1 +3 -1
  153. package/content/statusline/statusline-command.py +7 -1
  154. package/content/statusline/subagent-row-stats.ps1 +43 -0
  155. package/content/statusline/subagent-statusline-command.ps1 +6 -0
  156. package/content/statusline/subagent-statusline-command.py +12 -0
  157. package/content/statusline/subagent_row_stats.py +52 -0
  158. package/lib/bypassOnly.js +85 -0
  159. package/lib/claudeProfile.js +157 -0
  160. package/lib/codex-compatibility.json +1 -1
  161. package/lib/codex.js +1 -1
  162. package/lib/doctor.js +6 -1
  163. package/lib/memSafety.js +1 -0
  164. package/lib/portalHealth.js +61 -0
  165. package/lib/runner/args.js +16 -3
  166. package/lib/runner/budget.js +227 -0
  167. package/lib/runner/index.js +110 -4
  168. package/lib/runner/janitor.js +281 -0
  169. package/lib/runner/janitorPlan.js +166 -0
  170. package/lib/runner/janitorTask.js +57 -0
  171. package/lib/runner/jobs.js +32 -0
  172. package/lib/runner/managed.js +92 -0
  173. package/lib/runner/pool.js +281 -0
  174. package/lib/runner/profiles/linuxDocker.js +40 -7
  175. package/lib/runner/register_ci_janitor.ps1 +54 -0
  176. package/lib/staleCheckout.js +65 -0
  177. package/package.json +1 -1
  178. package/templates/ci/README.md +11 -0
  179. package/templates/ci/base.yml +2 -0
package/README.md CHANGED
@@ -91,6 +91,9 @@ agents-cli install
91
91
  secrets --list` — see [Secrets](#secrets) below.
92
92
  - `agents-cli update --yes` / `agents-cli update --bundle <key> --yes` — see
93
93
  [Updating](#updating) below.
94
+ Run from a git checkout, `update` refuses (exit 1, nothing deployed) when HEAD is behind origin's default branch,
95
+ because it would deploy older files over newer ones; `--allow-stale` overrides, and an unreachable remote only warns.
96
+ `doctor` checks ledger hashes, not source drift, so it cannot detect a stale deploy.
94
97
  - `agents-cli runner install --group-id <id> | --project-id <id>` — install a
95
98
  ready GitLab CI runner on this machine (`linux-docker`, or `macos-shell` on
96
99
  a Mac). `runner status` / `runner doctor` / `runner uninstall` check,
@@ -110,10 +113,18 @@ agents-cli install
110
113
  `--scan-root <dir>` checks every git repo directly under `<dir>` instead of the cwd repo. `install` and `update`
111
114
  accept the same `--scan-root` plus `--fix-project-hooks` and report (or fix) bare project hooks after the run.
112
115
  Paste-ready fix from inside any repo: `npx -y @yasaswy.nagavolu/agents@latest doctor --fix`.
116
+ On Windows it also reports a hard-coded `claude` alias or function in the PowerShell profiles
117
+ (`Documents/PowerShell` and `Documents/WindowsPowerShell`), which bypasses the `%APPDATA%/npm` shims and ignores every
118
+ Claude Code upgrade; `--fix` (and every `install`/`update`) replaces it with a managed `claude` function that follows the
119
+ `claude.cmd` shim, after a `.bak-<date>` backup.
113
120
  It also fails on Python hook launch problems: a hook or statusline command starting with a bare `python`/`python3`/`py`
114
121
  token (the Microsoft Store stub makes it fail), a missing `hooks/pyrun.js` launcher, an unresolvable interpreter, and a
115
122
  WindowsApps python stub ahead of a real interpreter on PATH; `--fix` rewrites the bare tokens to
116
123
  `node <target>/hooks/pyrun.js <script>` and never edits PATH or App Execution Aliases.
124
+ It also checks `~/.claude/settings.json` for bypass-only, no auto mode: `permissions.defaultMode` `bypassPermissions`,
125
+ `permissions.disableAutoMode` `disable`, `skipDangerousModePermissionPrompt` `true`, `useAutoModeDuringPlan` `false`, and no
126
+ `permissions.disableBypassPermissionsMode`. `--fix`, `install` and `update` set those keys and leave every other key,
127
+ including `permissions.deny`, untouched; a project `defaultMode` weaker than `bypassPermissions` is flagged too.
117
128
  It also flags a project `permissions.defaultMode` weaker than the global default in `~/.claude/settings.json`
118
129
  (for example `dontAsk` under a global `bypassPermissions`); `--fix` removes it from `settings.local.json`
119
130
  only, a committed `settings.json` is reported and never edited. The `permission_mode_enforce.js` hook
package/bin/cli.js CHANGED
@@ -38,11 +38,15 @@ const { checkHealth, DoctorError } = require('../lib/doctor');
38
38
  const memoryIndexCheck = require('../lib/memoryIndexCheck');
39
39
  const projectHooks = require('../lib/projectHooks');
40
40
  const modeDrift = require('../lib/modeDrift');
41
+ const bypassOnly = require('../lib/bypassOnly');
41
42
  const permissionRules = require('../lib/permissionRules');
42
43
  const pythonHooks = require('../lib/pythonHooks');
43
44
  const pyrun = require('../lib/pyrun');
44
45
  const { checkModVersions } = require('../lib/claudeVersion');
45
46
  const memSafety = require('../lib/memSafety');
47
+ const portalHealth = require('../lib/portalHealth');
48
+ const { staleCheckoutGate } = require('../lib/staleCheckout');
49
+ const claudeProfile = require('../lib/claudeProfile');
46
50
 
47
51
  const PACKAGE_ROOT = path.join(__dirname, '..');
48
52
  // One styler for the whole process: colors on only for a real TTY stdout
@@ -135,6 +139,8 @@ Flags for update:
135
139
  --json Print a machine-readable summary instead of prose
136
140
  --theirs Non-interactive: resolve every file conflict by taking the new source
137
141
  --keep-mine Non-interactive: resolve every file conflict by keeping your on-disk version
142
+ --allow-stale Update even when this checkout is behind origin's default branch (default: refused;
143
+ doctor checks ledger hashes, not source drift, so it cannot catch a stale deploy)
138
144
 
139
145
  Update compares each installed file's source hash, ledger hash, and on-disk
140
146
  hash: a file no one has touched since install is silently overwritten when
@@ -171,10 +177,12 @@ Flags for runner:
171
177
  runner status | doctor | uninstall Check, diagnose (docker, PAT scopes, online) or remove it
172
178
  runner attach | detach --project-id <id> Enable/disable the saved runners on a project (--no-cloud on
173
179
  attach also turns off cloud runners for it)
180
+ runner pool --pool-file <spec> [--apply] Merge runners into one capped pool (dry run without --apply; refuses while a job runs)
181
+ runner janitor [--dry-run] [--watch] Remove finished job containers, per-job volumes and unused images; --watch cleans after every job
174
182
  runner init-project [--profile node|python|docker|macos|blank] [--write] [--attach --project-id <id>]
175
183
  Write a .gitlab-ci.yml that uses the shared templates (dry run unless --write)
176
184
  --profile <auto|linux|macos> Install profile (default auto); --name, --tags, --concurrent, --url, --image,
177
- --cache-volume, --protected, --run-untagged/--no-run-untagged, --dry-run
185
+ --cache-volume, --job-memory <size>, --job-cpus <n>, --no-janitor, --fix (doctor), --protected, --run-untagged/--no-run-untagged, --dry-run
178
186
  --json Print a machine-readable result (never contains a token or PAT)
179
187
  Needs a GitLab PAT in GITLAB_RUNNER_PAT (or GITLAB_TOKEN): set it with "agents-cli secrets".
180
188
  Exit codes: 0 ok, 1 a step failed, 2 usage error.
@@ -197,6 +205,10 @@ whose script file is missing, and a bare (non-launcher) project hook command, wh
197
205
  and so blocks every tool call when it is a PreToolUse hook. A launcher-form hook with a missing file fails open but is still
198
206
  reported. Without --fix nothing is modified.
199
207
 
208
+ doctor also checks the PowerShell profiles (Documents/PowerShell and Documents/WindowsPowerShell) for a hard-coded claude alias or
209
+ function, which bypasses the %APPDATA%/npm shims and so ignores every Claude Code upgrade. --fix (and every install/update) replaces it
210
+ with a managed claude function that follows the shim, after a .bak-<date> backup. Windows only.
211
+
200
212
  doctor also fails on Python hook launch problems: a hook or statusline command in <target>/settings.json or the
201
213
  project settings that starts with a bare python/python3/py token (the Microsoft Store stub makes it fail), a
202
214
  hooks/pyrun.js launcher that is not installed, an interpreter that does not resolve, and a WindowsApps python stub
@@ -204,9 +216,13 @@ ahead of a real interpreter on PATH. --fix rewrites the bare tokens to "node <ta
204
216
  it never edits PATH or App Execution Aliases.
205
217
 
206
218
  doctor also flags a project .claude/settings.json or settings.local.json whose permissions.defaultMode is weaker
207
- than the global default in <target>/settings.json (for example "dontAsk" under a global "bypassPermissions"), which
208
- silently downgrades every session in that repo. --fix removes the key from settings.local.json only; a committed
209
- settings.json is reported, never edited.
219
+ than bypassPermissions (for example "dontAsk" or "auto"), which silently downgrades every session in that repo.
220
+ --fix removes the key from settings.local.json only; a committed settings.json is reported, never edited.
221
+
222
+ doctor also checks <target>/settings.json for bypassPermissions only with no auto mode: permissions.defaultMode
223
+ "bypassPermissions", permissions.disableAutoMode "disable", skipDangerousModePermissionPrompt true,
224
+ useAutoModeDuringPlan false, and no permissions.disableBypassPermissionsMode. --fix (and every update) sets
225
+ those keys and leaves all other keys, including permissions.deny, untouched.
210
226
 
211
227
  doctor reports, without changing anything: orphans (files/directories sitting inside
212
228
  a path this CLI manages that the ledger does not claim — e.g. a stale file left behind
@@ -1004,7 +1020,7 @@ async function runSecrets(argv) {
1004
1020
  }
1005
1021
 
1006
1022
  function parseUpdateArgs(argv) {
1007
- const args = { bundle: null, yes: false, targetDir: null, targetConfig: null, json: false, theirs: false, keepMine: false, noScheduledTasks: false };
1023
+ const args = { bundle: null, yes: false, targetDir: null, targetConfig: null, json: false, theirs: false, keepMine: false, noScheduledTasks: false, allowStale: false };
1008
1024
  for (let i = 0; i < argv.length; i += 1) {
1009
1025
  const arg = argv[i];
1010
1026
  if (arg === '--bundle') {
@@ -1026,6 +1042,8 @@ function parseUpdateArgs(argv) {
1026
1042
  args.keepMine = true;
1027
1043
  } else if (arg === '--no-scheduled-tasks') {
1028
1044
  args.noScheduledTasks = true;
1045
+ } else if (arg === '--allow-stale') {
1046
+ args.allowStale = true;
1029
1047
  } else {
1030
1048
  throw new UpdateError(`Unknown update flag: ${arg}`);
1031
1049
  }
@@ -1091,6 +1109,8 @@ async function runUpdate(argv) {
1091
1109
  const strategy = args.theirs ? 'theirs' : args.keepMine ? 'keep-mine' : undefined;
1092
1110
 
1093
1111
  try {
1112
+ const stale = staleCheckoutGate(path.dirname(loadManifest(PACKAGE_ROOT).manifestPath), { allowStale: args.allowStale });
1113
+ if (stale !== null) return stale;
1094
1114
  const result = await updateBundles({
1095
1115
  packageRoot: PACKAGE_ROOT,
1096
1116
  bundleKey: args.bundle,
@@ -1270,6 +1290,18 @@ Project hooks (${step.findings.length} finding(s), ${step.repos.length} repo(s)
1270
1290
  }
1271
1291
  }
1272
1292
 
1293
+ function printClaudeProfileReport(report, { fixRequested }) {
1294
+ for (const f of report.fixed) console.log(`\nInstalled the claude shim launcher in ${f.file} (backup: ${f.backup}); open a new terminal tab or run \`. $PROFILE\` to load it.`);
1295
+ if (report.findings.length === 0 || report.fixed.length > 0) return;
1296
+ console.log(`\nPowerShell profile claude command (${report.findings.length} finding(s)):`);
1297
+ for (const f of report.findings) console.log(` ${claudeProfile.describeProfileFinding(f)}`);
1298
+ if (!fixRequested) console.log(` Fix: ${claudeProfile.FIX_COMMAND}`);
1299
+ }
1300
+
1301
+ function claudeProfileStep(targetBase, fix) {
1302
+ return claudeProfile.checkClaudeProfile({ home: path.dirname(targetBase), fix });
1303
+ }
1304
+
1273
1305
  function printPythonLaunchReport(py) {
1274
1306
  if (py.fixed.length > 0) {
1275
1307
  console.log(`\nRewrote ${py.fixed.length} bare python hook command(s) to the pyrun launcher:`);
@@ -1284,6 +1316,20 @@ function printPythonLaunchReport(py) {
1284
1316
  if (py.findings.length > 0 && !py.fixRequested) console.log(` Fix: ${projectHooks.FIX_COMMAND}`);
1285
1317
  }
1286
1318
 
1319
+ function printBypassOnlyReport(bypass) {
1320
+ if (bypass.error) console.log(`
1321
+ ${bypass.error}`);
1322
+ if (bypass.fixed.length > 0) {
1323
+ console.log(`
1324
+ Set ${bypass.fixed.length} key(s) in ${bypass.file} for bypassPermissions only, no auto mode:`);
1325
+ for (const d of bypass.fixed) console.log(` ${bypassOnly.describeDrift(d)}`);
1326
+ }
1327
+ if (bypass.findings.length === 0) return;
1328
+ console.log(`
1329
+ Bypass-only drift in ${bypass.file} (${bypass.findings.length} key(s), fix: agents-cli doctor --fix or agents-cli update):`);
1330
+ for (const d of bypass.findings) console.log(` ${bypassOnly.describeDrift(d)}`);
1331
+ }
1332
+
1287
1333
  function printModeDriftReport(modes) {
1288
1334
  if (modes.fixed.length > 0) {
1289
1335
  console.log(`\nRemoved ${modes.fixed.length} defaultMode override(s) weaker than the global "${modes.globalMode}":`);
@@ -1326,7 +1372,7 @@ function splitProjectHookFlags(argv) {
1326
1372
  return { rest, opts };
1327
1373
  }
1328
1374
 
1329
- async function withProjectHookStep(argv, run) {
1375
+ async function withProjectHookStep(argv, run, { healBypass = false } = {}) {
1330
1376
  const { rest, opts } = splitProjectHookFlags(argv);
1331
1377
  const code = await run(rest);
1332
1378
  try {
@@ -1338,12 +1384,16 @@ async function withProjectHookStep(argv, run) {
1338
1384
  });
1339
1385
  if (step.error) console.error(step.error);
1340
1386
  printProjectHookReport(step, { fixRequested: opts.fix });
1387
+ const targetBase = opts.targetDir || defaultTargetBase();
1388
+ printClaudeProfileReport(claudeProfileStep(targetBase, healBypass || opts.fix), { fixRequested: opts.fix });
1389
+ printBypassOnlyReport(bypassOnly.checkBypassOnly({ targetBase, fix: healBypass || opts.fix }));
1341
1390
  printModeDriftReport(
1342
1391
  modeDrift.checkModeDrift({
1343
- targetBase: opts.targetDir || defaultTargetBase(),
1392
+ targetBase,
1344
1393
  cwd: process.cwd(),
1345
1394
  scanRoot: opts.scanRoot ? path.resolve(opts.scanRoot) : null,
1346
1395
  fix: opts.fix,
1396
+ expectedMode: bypassOnly.BYPASS,
1347
1397
  })
1348
1398
  );
1349
1399
  printRuleMigrationReport(
@@ -1379,7 +1429,8 @@ function runDoctor(argv) {
1379
1429
  scanRoot: args.scanRoot ? path.resolve(args.scanRoot) : null,
1380
1430
  targetBase: args.targetDir || defaultTargetBase(),
1381
1431
  };
1382
- const modes = modeDrift.checkModeDrift({ ...scope, fix: args.fix });
1432
+ const bypass = bypassOnly.checkBypassOnly({ targetBase: scope.targetBase, fix: args.fix });
1433
+ const modes = modeDrift.checkModeDrift({ ...scope, fix: args.fix, expectedMode: bypassOnly.BYPASS });
1383
1434
  const rules = permissionRules.checkRuleMigration({ ...scope, fix: args.fix });
1384
1435
  const hooks = projectHooks.projectHooksStep({ ...scope, fix: args.fix });
1385
1436
  if (hooks.error) {
@@ -1399,12 +1450,15 @@ function runDoctor(argv) {
1399
1450
  console.error(py.error);
1400
1451
  return 1;
1401
1452
  }
1453
+ const profileStep = claudeProfileStep(scope.targetBase, args.fix);
1402
1454
  const { fixed } = hooks;
1455
+ result.claudeProfile = profileStep;
1403
1456
  result.projectHooks = { repos: hooks.repos, findings: hooks.findings, fixed };
1404
1457
  result.modeDrift = { globalMode: modes.globalMode, findings: modes.findings, fixed: modes.fixed };
1458
+ result.bypassOnly = { file: bypass.file, findings: bypass.findings, fixed: bypass.fixed, error: bypass.error };
1405
1459
  result.permissionRules = { findings: rules.findings, fixed: rules.fixed };
1406
1460
  result.pythonLaunch = { files: py.files, findings: py.findings, fixed: py.fixed, missingLaunchers: py.missingLaunchers, interpreter: py.interpreter, stubs: py.stubs };
1407
- result.healthy = result.healthy && hooks.findings.length === 0 && modes.findings.length === 0 && rules.findings.length === 0 && py.healthy;
1461
+ result.healthy = result.healthy && hooks.findings.length === 0 && bypass.findings.length === 0 && !bypass.error && modes.findings.length === 0 && rules.findings.length === 0 && py.healthy && (profileStep.findings.length === 0 || profileStep.fixed.length > 0);
1408
1462
 
1409
1463
  if (args.json) {
1410
1464
  console.log(JSON.stringify(result, null, 2));
@@ -1413,6 +1467,8 @@ function runDoctor(argv) {
1413
1467
 
1414
1468
  const printProjectHooks = () => printProjectHookReport(hooks, { fixRequested: args.fix });
1415
1469
  const printModeDrift = () => {
1470
+ printClaudeProfileReport(profileStep, { fixRequested: args.fix });
1471
+ printBypassOnlyReport(bypass);
1416
1472
  printModeDriftReport(modes);
1417
1473
  printRuleMigrationReport(rules);
1418
1474
  };
@@ -1449,6 +1505,14 @@ function runDoctor(argv) {
1449
1505
  for (const w of m.warnings) console.log(` ${mark('skip')} ${w}`);
1450
1506
  };
1451
1507
 
1508
+ const printPortal = () => {
1509
+ const p = result.portal;
1510
+ if (!p) return;
1511
+ console.log('\nUsage portal:');
1512
+ for (const line of portalHealth.describePortal(p)) console.log(` ${line}`);
1513
+ for (const f of p.findings) console.log(` ${mark('fail')} ${f}`);
1514
+ };
1515
+
1452
1516
  const printRoutingMod = () => {
1453
1517
  if (!result.routingMod) return;
1454
1518
  console.log('\nModel routing:');
@@ -1464,6 +1528,7 @@ function runDoctor(argv) {
1464
1528
  printMemoryIndex();
1465
1529
  printRoutingMod();
1466
1530
  printMemorySafety();
1531
+ printPortal();
1467
1532
  printModeDrift();
1468
1533
  return 0;
1469
1534
  }
@@ -1486,6 +1551,7 @@ function runDoctor(argv) {
1486
1551
  printMemoryIndex();
1487
1552
  printRoutingMod();
1488
1553
  printMemorySafety();
1554
+ printPortal();
1489
1555
  printProjectHooks();
1490
1556
  printPythonLaunchReport(py);
1491
1557
  printModeDrift();
@@ -1560,7 +1626,7 @@ async function main(argv, { captureSelection = false } = {}) {
1560
1626
  }
1561
1627
 
1562
1628
  if (command === 'install') {
1563
- return withProjectHookStep(rest, args => runInstall(args, { captureSelection }));
1629
+ return withProjectHookStep(rest, args => runInstall(args, { captureSelection }), { healBypass: true });
1564
1630
  }
1565
1631
 
1566
1632
  if (command === 'uninstall') {
@@ -1572,7 +1638,7 @@ async function main(argv, { captureSelection = false } = {}) {
1572
1638
  }
1573
1639
 
1574
1640
  if (command === 'update') {
1575
- return withProjectHookStep(rest, runUpdate);
1641
+ return withProjectHookStep(rest, runUpdate, { healBypass: true });
1576
1642
  }
1577
1643
 
1578
1644
  if (command === 'doctor') {
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: synth-auditor
3
+ description: Audits one chapter's organised synth text against its raw voice transcript and adds every missing detail, additively, with a verified audit table.
4
+ model: claude-sonnet-5-5[1m]
5
+ role: worker
6
+ effort: high
7
+ tools: ['Read', 'Write', 'Edit', 'Glob', 'Grep', 'Bash']
8
+ dispatch_tier: mandatory-review
9
+ user-invokable: false
10
+ ---
11
+
12
+ # synth-auditor
13
+
14
+ One job per dispatch: for one chapter N, find every detail in the raw transcript that the synth lacks, add it to the synth
15
+ without changing what is there, and write the audit table. Stage `source -> comic_txt` of graphic-novel-pipeline.
16
+
17
+ ## Input
18
+
19
+ A dispatch with `goal:` and `task:` naming the chapter and the project root. Files, relative to the root:
20
+
21
+ | File | Role |
22
+ |---|---|
23
+ | `source/raw_text/N_*.txt` | Voice transcript, unordered, speech-to-text errors. Line numbers are physical file lines |
24
+ | `source/synth_txt/N_*.txt` | Organised synth: beats `[n]` with Story (video), Speaker's reading, Terms; CARRIES FORWARD; OPEN / UNCLEAR |
25
+ | `comic_txt/_audit/N_<slug>_audit.md` | Your output table |
26
+
27
+ ## Work
28
+
29
+ 1. Read the whole raw file, then the whole synth. Walk the raw file line by line; for each idea, name, example, joke,
30
+ hedge, question, number or reaction ask: is it in the synth beat where it belongs?
31
+ 2. Repeated narration (the video text appears several times) is checked once. Verbal tics and session meta
32
+ ("okay", "next section") are filler: log them, add nothing.
33
+ 3. Edit the synth, additive only:
34
+ - Never delete, reword, reorder or reflow an existing line. Append a sentence to the end of the right line, or insert a
35
+ new line inside the right beat (` Speaker's reading (added): ...`).
36
+ - Use the beat's own labels: narrator text goes in `Story (video)`, the speaker's own words in `Speaker's reading`.
37
+ - End every addition with its source tag: `(raw L5)` or `(raw p1 L1, p2 L15)` for a chapter with two raw files.
38
+ - Keep the speaker's hedges and wording. Keep short quotes in double quotes.
39
+ 4. Garbled, cut-off or unknown words: never repair silently. Add a bullet to OPEN / UNCLEAR:
40
+ `- Raw line N: "exact words" - what is unclear, likely reading [?]`. A guess inside a beat carries `[?]`.
41
+ 5. Write the audit table (rows in raw order). Columns: raw location, quote, target beat, action.
42
+ - Raw location: `L5`, `L1, L5`, or `p2 L15` with two raw files.
43
+ - Quote: 3 to 25 words, copied from the raw file inside double quotes. Use ` ... ` to skip words; each part must be
44
+ verbatim. Case and punctuation may differ; words may not.
45
+ - Target beat: `[n] story`, `[n] reading` or `OPEN`.
46
+ - Action: `added`, `added ("short detail")`, `flagged-uncertain (why)` or `skipped-filler (why)`.
47
+ - End with a counts line: found, added, flagged, skipped.
48
+ 6. Run `python ~/.claude/skills/graphic-novel-pipeline/scripts/synth_audit.py check --chapter N` from the root. Exit 0 is
49
+ required. Fix your edits or your table (not the base lines) until it passes. Read the `warn` lines too.
50
+
51
+ ## Never
52
+
53
+ - Invent a detail, merge a flagged phrase into a beat as fact, or fill a gap from outside knowledge.
54
+ - Edit anything except the synth file and the audit table. Never commit.
55
+
56
+ ## Return
57
+
58
+ `READY_TO_COMMIT` with files and the check summary line (rows, added confirmed, warnings), or `BLOCKED` with the failing
59
+ check output. The main loop reviews the diff.
@@ -76,8 +76,8 @@ function resolveRepos({ cwd, scanRoot }) {
76
76
  return scanRoot ? listGitRepos(scanRoot) : [currentRepo(cwd || process.cwd())].filter(Boolean);
77
77
  }
78
78
 
79
- function checkModeDrift({ targetBase, cwd, scanRoot, fix = false }) {
80
- const globalMode = globalDefaultMode(targetBase);
79
+ function checkModeDrift({ targetBase, cwd, scanRoot, fix = false, expectedMode = null }) {
80
+ const globalMode = expectedMode || globalDefaultMode(targetBase);
81
81
  const repos = resolveRepos({ cwd, scanRoot });
82
82
  if (!globalMode) return { globalMode: null, repos, findings: [], fixed: [] };
83
83
  const fixed = fix ? repos.flatMap((repo) => fixRepoModes(repo, globalMode)) : [];
@@ -1,35 +1,52 @@
1
1
  # conclusion-scribe hook
2
2
 
3
- A Claude Code **Stop hook** that makes conclusive responses get **filed, not
4
- just spoken**. Three deterministic stages, all in code:
3
+ A Claude Code **Stop and SessionEnd hook** that makes conclusive responses get
4
+ **filed, not just spoken** -- silently, in the background, never blocking a turn.
5
+ Three deterministic stages, all in code:
5
6
 
6
- 1. **Detect** — regex, no judgment: the final assistant message is
7
+ 1. **Detect** -- regex, no judgment: the final assistant message is
7
8
  "conclusion-shaped" if it contains a commit SHA + ship-language
8
9
  (shipped/fixed/live/pushed/committed/green/mandate/closed/deployed), or a
9
10
  GitLab issue URL.
10
- 2. **Force** — if no machine-parseable ` ```scribe ` JSON block is attached,
11
- the hook blocks the response from ending until the model appends one.
12
- Loop-safe (`stop_hook_active` — never blocks twice).
13
- 3. **File** — the hook script itself (not the LLM) posts a note to the
14
- referenced GitLab issue and writes a memory to a one-brain MCP endpoint.
15
- The LLM authors only the summary text.
11
+ 2. **Facts** -- the hook script itself (not an LLM) extracts commits, issue,
12
+ project and HEAD, then posts a facts-only note to the referenced GitLab issue
13
+ and writes a one-brain memory. Dedup key: (project, issue, HEAD sha).
14
+ 3. **Prose** -- a detached Haiku worker adds a short summary to that record.
15
+
16
+ | Event | Role | Budget |
17
+ |---|---|---|
18
+ | `Stop` | Files facts synchronously after every turn; reports earlier background failures once | 30 s |
19
+ | `SessionEnd` | Final flush: re-checks the last assistant message (tail read of the transcript) and hands a conclusive one to a detached `--flush-worker`; prints nothing (CC discards SessionEnd output) | CC allows 1.5 s; the hook returns in well under that |
20
+
21
+ Stop and SessionEnd share the dedup key and an atomic claim (`_claim_entry`), so a
22
+ conclusion is filed once whichever runs first; the second becomes a no-op. A
23
+ claim older than 60 s counts as abandoned. SessionEnd covers sessions that end
24
+ without a Stop for the last message (interrupt, `/clear`, resume, logout, `-p`
25
+ exit). A filing warning in the flush worker goes to the background-failure log and
26
+ is reported by the next session's first Stop.
27
+
28
+ All streams, files and child-process pipes are UTF-8 (`errors="replace"`), so a non-ASCII character such as an arrow cannot fail the Haiku stage under a Windows legacy code page.
16
29
 
17
30
  ## Install (plug and play)
18
31
 
19
32
  1. Copy `conclusion_scribe_hook.py` to `~/.claude/hooks/`.
20
33
  2. Create `~/.claude/hooks/conclusion-scribe.env` from
21
- `conclusion-scribe.env.example` — your project map, token source, and
34
+ `conclusion-scribe.env.example` -- your project map, token source, and
22
35
  memory endpoint live there, never in the code.
23
- 3. Wire into `~/.claude/settings.json`:
36
+ 3. Wire into `~/.claude/settings.json` (the `self-conclusion-scribe` bundle does
37
+ this for you):
24
38
 
25
39
  ```json
26
40
  "Stop": [{"hooks": [{"type": "command",
27
41
  "command": "node <home>/.claude/hooks/pyrun.js <home>/.claude/hooks/conclusion_scribe_hook.py",
28
- "timeout": 30}]}]
42
+ "timeout": 30}]}],
43
+ "SessionEnd": [{"hooks": [{"type": "command",
44
+ "command": "node <home>/.claude/hooks/pyrun.js <home>/.claude/hooks/conclusion_scribe_hook.py",
45
+ "timeout": 5}]}]
29
46
  ```
30
47
 
31
- Sessions started after wiring fire it automatically. No config → the hook
32
- fails open (detect/force still work; filing legs no-op).
48
+ Sessions started after wiring fire it automatically. No config -> the hook
49
+ fails open (detect works; filing legs no-op).
33
50
 
34
51
  ## PROJECT_MAP auto-discovery
35
52
 
@@ -65,14 +82,6 @@ notifications/initialized → tools/call `remember` with `Mcp-Session-Id`);
65
82
  point it at any MCP server exposing a `remember` tool, or leave it
66
83
  unconfigured to skip the leg.
67
84
 
68
- ## scribe block schema
69
-
70
- ```scribe
71
- {"summary": "2-4 sentence conclusion", "commits": ["<sha>"],
72
- "tests": "<result>", "issue": "<repo>#<iid>", "tags": ["..."],
73
- "project": "<project-or-null>"}
74
- ```
75
-
76
85
  ## Tests
77
86
 
78
87
  `SCRIBE_HOOK_DRY_RUN=1` stubs both filing legs; `SCRIBE_HOOK_CONFIG` points