@event4u/agent-config 9.28.0 → 9.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 (209) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +6 -6
  3. package/CHANGELOG.md +172 -5
  4. package/README.md +2 -1
  5. package/agents/templates/.ai-council.yml.example +55 -24
  6. package/dist/agent-src/commands/analyze/inbox.md +22 -1
  7. package/dist/agent-src/commands/cost/report.md +2 -2
  8. package/dist/agent-src/commands/explain-run.md +31 -1
  9. package/dist/agent-src/commands/team/adversarial.md +8 -7
  10. package/dist/agent-src/commands/team/delegate.md +14 -12
  11. package/dist/agent-src/commands/team/review.md +9 -8
  12. package/dist/agent-src/commands/team/status.md +9 -8
  13. package/dist/agent-src/commands/team.md +29 -19
  14. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +88 -2
  15. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +29 -21
  16. package/dist/agent-src/contexts/execution/host-capability-manifest.md +26 -15
  17. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +22 -1
  18. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +17 -0
  19. package/dist/agent-src/contexts/execution/subagent-response-contract.md +65 -1
  20. package/dist/agent-src/contexts/execution/subagent-routing.md +13 -11
  21. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +25 -0
  22. package/dist/agent-src/contexts/execution/subagent-steering.md +6 -3
  23. package/dist/agent-src/rules/delegation-policy.md +11 -7
  24. package/dist/agent-src/rules/preservation-guard.md +9 -0
  25. package/dist/agent-src/rules/settings-ask-protocol.md +8 -7
  26. package/dist/agent-src/rules/token-budget-discipline.md +1 -1
  27. package/dist/agent-src/scripts/roadmap_gates.ts +312 -0
  28. package/dist/agent-src/scripts/update_roadmap_progress.ts +72 -4
  29. package/dist/agent-src/skills/forensics-report/SKILL.md +114 -0
  30. package/dist/agent-src/skills/forensics-report/evals/triggers.json +17 -0
  31. package/dist/agent-src/skills/premortem/SKILL.md +30 -1
  32. package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +2 -1
  33. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +17 -5
  34. package/dist/agent-src/skills/subagent-orchestration/schemas/subagent-status.json +61 -3
  35. package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
  36. package/dist/agent-src/templates/AGENTS.md +4 -4
  37. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  38. package/dist/agent-src/templates/roadmaps.md +23 -0
  39. package/dist/cli/registry.js +2 -0
  40. package/dist/cli/registry.js.map +1 -1
  41. package/dist/cli-delegate/{chunk-22GCIJ2O.js → chunk-66OVWGB5.js} +1 -1
  42. package/dist/cli-delegate/{chunk-7OMQCH4V.js → chunk-BTJNRUX3.js} +22 -35
  43. package/dist/cli-delegate/{chunk-DVRS2KVR.js → chunk-DDUNNFYX.js} +24 -17
  44. package/dist/cli-delegate/{chunk-PQSAQKHW.js → chunk-EQY4FLJB.js} +3 -3
  45. package/dist/cli-delegate/{chunk-2BE5I2MN.js → chunk-IYTGIG2Y.js} +155 -91
  46. package/dist/cli-delegate/{chunk-GB2FSUEE.js → chunk-LCFJIQ4J.js} +32 -0
  47. package/dist/cli-delegate/{chunk-VSYT7OHO.js → chunk-LVRYBKTI.js} +31 -2
  48. package/dist/cli-delegate/chunk-MMJL4TIX.js +18 -0
  49. package/dist/cli-delegate/{chunk-JXARCGVN.js → chunk-MP3JT3IU.js} +1 -1
  50. package/dist/cli-delegate/chunk-O3CO5BFB.js +161 -0
  51. package/dist/cli-delegate/{chunk-REKCMYOU.js → chunk-PFBV6XRT.js} +36 -20
  52. package/dist/cli-delegate/chunk-RVGBH4XK.js +142 -0
  53. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  54. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  55. package/dist/cli-delegate/cmd_conformance.js +2803 -137
  56. package/dist/cli-delegate/cmd_doctor.js +10 -5
  57. package/dist/cli-delegate/cmd_explain.js +2 -2
  58. package/dist/cli-delegate/cmd_export.js +4 -4
  59. package/dist/cli-delegate/cmd_handoff.js +88 -8
  60. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  61. package/dist/cli-delegate/cmd_migrate.js +2 -2
  62. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  63. package/dist/cli-delegate/cmd_prune.js +4 -4
  64. package/dist/cli-delegate/cmd_route_audit.js +3 -2
  65. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  66. package/dist/cli-delegate/cmd_session_recycle.js +177 -0
  67. package/dist/cli-delegate/cmd_settings_get.js +2 -8
  68. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  69. package/dist/cli-delegate/cmd_settings_set.js +2 -2
  70. package/dist/cli-delegate/cmd_sync.js +4 -4
  71. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  72. package/dist/cli-delegate/cmd_update.js +1 -1
  73. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  74. package/dist/cli-delegate/cmd_validate.js +4 -4
  75. package/dist/cli-delegate/cmd_versions.js +1 -1
  76. package/dist/discovery/deprecation-report.md +1 -1
  77. package/dist/discovery/discovery-manifest.json +72 -23
  78. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  79. package/dist/discovery/discovery-manifest.summary.md +3 -2
  80. package/dist/discovery/orphan-report.md +1 -1
  81. package/dist/discovery/packs.json +39 -2
  82. package/dist/discovery/trust-report.md +2 -2
  83. package/dist/discovery/workspaces.json +12 -4
  84. package/dist/hooks/dispatch.js +2278 -611
  85. package/dist/install/install.mjs +56 -17
  86. package/dist/mcp/registry-manifest.json +3 -3
  87. package/dist/mcp/server.json +2 -2
  88. package/dist/mcp/server.mjs +4122 -699
  89. package/dist/router.json +1 -1
  90. package/dist/scripts/_lib/agent_settings.js +54 -0
  91. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  92. package/dist/scripts/condense.js +147 -2
  93. package/dist/scripts/condense.js.map +1 -1
  94. package/dist/server/schemas/settings.js +12 -7
  95. package/dist/server/schemas/settings.js.map +1 -1
  96. package/dist/shared/settingsCarveOut.js +0 -9
  97. package/dist/shared/settingsCarveOut.js.map +1 -1
  98. package/dist/shared/settingsClasses.js +11 -9
  99. package/dist/shared/settingsClasses.js.map +1 -1
  100. package/dist/ui/assets/index-B5qGYOJo.js +26 -0
  101. package/dist/ui/assets/index-B5qGYOJo.js.map +1 -0
  102. package/dist/ui/index.html +1 -1
  103. package/docs/contracts/settings-classes.md +58 -12
  104. package/package.json +1 -1
  105. package/src/agent-src/scripts/roadmap_gates.ts +312 -0
  106. package/src/agent-src/scripts/update_roadmap_progress.ts +72 -4
  107. package/src/agent-src/templates/AGENTS.md +4 -4
  108. package/src/config/agent-settings.template.yml +88 -66
  109. package/src/config/discovery/packs.yml +11 -0
  110. package/src/config/discovery/workspaces.yml +1 -1
  111. package/src/config/dispatch-economy-metrics.json +61 -0
  112. package/src/config/evaluator-budgets.json +4 -4
  113. package/src/config/gate-violation-baselines.json +3 -3
  114. package/src/config/hook-token-budget.json +91 -0
  115. package/src/config/recycle-threshold-budget.json +12 -0
  116. package/src/config/rule-enforcement-baseline.json +86 -0
  117. package/src/scripts/_cli/cmd_conformance.ts +31 -44
  118. package/src/scripts/_cli/cmd_doctor.ts +65 -48
  119. package/src/scripts/_cli/cmd_session_recycle.ts +226 -0
  120. package/src/scripts/_dispatch.bash +23 -0
  121. package/src/scripts/_lib/agent_settings.ts +58 -0
  122. package/src/scripts/_lib/auto_dispatch.corpus.test.ts +1 -1
  123. package/src/scripts/_lib/auto_dispatch.ts +23 -18
  124. package/src/scripts/_lib/capsule_trigger.ts +124 -0
  125. package/src/scripts/_lib/host_capability.ts +63 -6
  126. package/src/scripts/_lib/judgment_ladder.ts +634 -0
  127. package/src/scripts/_lib/orchestration_gate.ts +8 -0
  128. package/src/scripts/_lib/orchestration_record.ts +78 -10
  129. package/src/scripts/_lib/orchestration_savings.ts +1 -1
  130. package/src/scripts/_lib/recycle_envelope_paths.ts +35 -0
  131. package/src/scripts/_lib/self_repair.ts +354 -13
  132. package/src/scripts/_lib/self_repair_store.ts +28 -0
  133. package/src/scripts/_lib/session_eol.ts +230 -0
  134. package/src/scripts/_lib/session_role.ts +42 -0
  135. package/src/scripts/_lib/subagent_capsule.ts +341 -0
  136. package/src/scripts/_lib/subagent_response.ts +94 -0
  137. package/src/scripts/_lib/subagent_spawn.ts +13 -0
  138. package/src/scripts/_lib/subagent_steering.ts +9 -4
  139. package/src/scripts/_lib/tier_budget_routing.ts +6 -1
  140. package/src/scripts/_lib/worker_budget.ts +37 -2
  141. package/src/scripts/ai_council/clients.ts +126 -55
  142. package/src/scripts/ai_council/config.ts +94 -6
  143. package/src/scripts/ai_council/handoff.ts +113 -0
  144. package/src/scripts/ai_council/modes.ts +19 -4
  145. package/src/scripts/ai_council/orchestrator.ts +105 -0
  146. package/src/scripts/ai_council/quorum.ts +84 -0
  147. package/src/scripts/ai_council/session.ts +44 -0
  148. package/src/scripts/ai_council/transport_resolver.ts +127 -1
  149. package/src/scripts/ai_team/availability.ts +110 -0
  150. package/src/scripts/ai_team/config.ts +34 -14
  151. package/src/scripts/ai_team/team_dispatch.ts +71 -29
  152. package/src/scripts/ask_transport.ts +221 -0
  153. package/src/scripts/bench_critic_protocol.ts +396 -0
  154. package/src/scripts/bench_hook_injection.ts +234 -0
  155. package/src/scripts/check_adr_frontmatter.ts +84 -40
  156. package/src/scripts/check_branch_freshness.ts +1 -0
  157. package/src/scripts/check_corpus_staleness.ts +18 -4
  158. package/src/scripts/check_detector_corpus.ts +219 -0
  159. package/src/scripts/check_gitignore_freshness.ts +42 -8
  160. package/src/scripts/check_hook_bundle_freshness.ts +24 -1
  161. package/src/scripts/check_kernel_prefix_stability.ts +1 -0
  162. package/src/scripts/check_standing_rule_delivery.ts +73 -32
  163. package/src/scripts/check_static_layer_stability.ts +154 -0
  164. package/src/scripts/check_suppression_hygiene.ts +48 -0
  165. package/src/scripts/condense.ts +162 -2
  166. package/src/scripts/council_cli.ts +401 -25
  167. package/src/scripts/dispatch_economy_report.ts +448 -0
  168. package/src/scripts/dispatch_r2_reviewer.ts +15 -2
  169. package/src/scripts/explain_run.ts +206 -4
  170. package/src/scripts/forensics_report.ts +333 -0
  171. package/src/scripts/generate_settings_reference.ts +1 -0
  172. package/src/scripts/handoff_context_hook.ts +112 -4
  173. package/src/scripts/hook_manifest.yaml +117 -10
  174. package/src/scripts/hooks/concern_registry.ts +8 -0
  175. package/src/scripts/hooks/delegation_nudge_hook.ts +106 -35
  176. package/src/scripts/hooks/dispatch_hook.ts +39 -2
  177. package/src/scripts/hooks/edit_shape_hook.ts +303 -0
  178. package/src/scripts/hooks/orchestration_record_hook.ts +19 -1
  179. package/src/scripts/hooks/reread_guard_hook.ts +314 -0
  180. package/src/scripts/hooks/rtk_wrap_hook.ts +133 -14
  181. package/src/scripts/hooks/session_eol_hook.ts +268 -0
  182. package/src/scripts/hooks/turn_end_gate_hook.ts +507 -0
  183. package/src/scripts/install-hooks.sh +1 -1
  184. package/src/scripts/language_mirror_hook.ts +89 -0
  185. package/src/scripts/lint_decision_impact.ts +14 -1
  186. package/src/scripts/lint_discovery_vocabulary.ts +2 -0
  187. package/src/scripts/lint_hook_manifest.ts +82 -0
  188. package/src/scripts/lint_never_silent.ts +276 -0
  189. package/src/scripts/lint_no_activation_gates.ts +271 -0
  190. package/src/scripts/lint_readme_serial_comma.ts +1 -0
  191. package/src/scripts/lint_rule_enforcement_declaration.ts +347 -0
  192. package/src/scripts/measure_turn_end_gate.ts +194 -0
  193. package/src/scripts/orchestration_record.ts +12 -1
  194. package/src/scripts/rebuild_hook_bundle.ts +178 -0
  195. package/src/scripts/release.ts +74 -2
  196. package/src/scripts/report_conformance_funnel.ts +284 -0
  197. package/src/scripts/report_imperative_density.ts +1 -0
  198. package/src/scripts/routing_doctor.ts +118 -36
  199. package/src/scripts/score_skill_selection.ts +19 -5
  200. package/src/scripts/self_repair_cli.ts +337 -59
  201. package/src/scripts/session_eol_report.ts +261 -0
  202. package/src/scripts/team_events_spike.ts +271 -0
  203. package/src/scripts/team_review_gate_hook.ts +31 -9
  204. package/src/server/schemas/settings.ts +24 -17
  205. package/src/shared/settingsCarveOut.ts +0 -10
  206. package/src/shared/settingsClasses.ts +11 -9
  207. package/src/templates/compact-instructions.md +40 -0
  208. package/dist/ui/assets/index-DmR0mbk4.js +0 -26
  209. package/dist/ui/assets/index-DmR0mbk4.js.map +0 -1
@@ -62,16 +62,19 @@ import {
62
62
  _scan_foreign,
63
63
  _settings_layer_chain,
64
64
  _skipped_manifest_check,
65
+ _team_codex_binary_name,
65
66
  _wizard_state_path,
66
- main
67
- } from "./chunk-2BE5I2MN.js";
67
+ main,
68
+ shutilWhich
69
+ } from "./chunk-IYTGIG2Y.js";
68
70
  import "./chunk-FTAISGDQ.js";
69
- import "./chunk-VSYT7OHO.js";
71
+ import "./chunk-O3CO5BFB.js";
72
+ import "./chunk-LVRYBKTI.js";
70
73
  import "./chunk-736JCWLM.js";
71
74
  import "./chunk-63WSP6YZ.js";
72
75
  import "./chunk-GRRPEPRN.js";
73
76
  import "./chunk-NXFWFAYV.js";
74
- import "./chunk-GB2FSUEE.js";
77
+ import "./chunk-LCFJIQ4J.js";
75
78
  import "./chunk-NDJLNC6Q.js";
76
79
  import "./chunk-OY53J6II.js";
77
80
  import "./chunk-MCJYCQPF.js";
@@ -138,6 +141,8 @@ export {
138
141
  _scan_foreign,
139
142
  _settings_layer_chain,
140
143
  _skipped_manifest_check,
144
+ _team_codex_binary_name,
141
145
  _wizard_state_path,
142
- main
146
+ main,
147
+ shutilWhich
143
148
  };
@@ -8,7 +8,7 @@ import {
8
8
  ProfileError,
9
9
  artefact_roots,
10
10
  resolve_profile
11
- } from "./chunk-22GCIJ2O.js";
11
+ } from "./chunk-66OVWGB5.js";
12
12
  import {
13
13
  StateLoadError,
14
14
  load_state
@@ -19,7 +19,7 @@ import {
19
19
  load_agent_settings,
20
20
  logger,
21
21
  resolve_project_root
22
- } from "./chunk-GB2FSUEE.js";
22
+ } from "./chunk-LCFJIQ4J.js";
23
23
  import "./chunk-NDJLNC6Q.js";
24
24
  import {
25
25
  __export
@@ -9,14 +9,14 @@ import {
9
9
  KIRO_MARKER,
10
10
  ROOCODE_MARKER,
11
11
  ZED_MARKER
12
- } from "./chunk-PQSAQKHW.js";
13
- import "./chunk-DVRS2KVR.js";
14
- import "./chunk-JXARCGVN.js";
12
+ } from "./chunk-EQY4FLJB.js";
13
+ import "./chunk-DDUNNFYX.js";
14
+ import "./chunk-MP3JT3IU.js";
15
15
  import "./chunk-BKO2AZ7Z.js";
16
16
  import "./chunk-63WSP6YZ.js";
17
17
  import "./chunk-GRRPEPRN.js";
18
18
  import "./chunk-NXFWFAYV.js";
19
- import "./chunk-GB2FSUEE.js";
19
+ import "./chunk-LCFJIQ4J.js";
20
20
  import "./chunk-NDJLNC6Q.js";
21
21
  import "./chunk-523HCFYO.js";
22
22
  import "./chunk-OY53J6II.js";
@@ -3,15 +3,23 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
3
3
  import {
4
4
  derive_session_tag,
5
5
  list_sessions,
6
- readHookStdin,
7
6
  read_entries
8
- } from "./chunk-7OMQCH4V.js";
7
+ } from "./chunk-BTJNRUX3.js";
8
+ import {
9
+ RECYCLE_CONSUMED_REL,
10
+ RECYCLE_ENVELOPE_REL,
11
+ RECYCLE_MAX_AGE_HOURS,
12
+ validateRecycleEnvelope
13
+ } from "./chunk-RVGBH4XK.js";
9
14
  import "./chunk-3EWYC3YK.js";
15
+ import {
16
+ readHookStdin
17
+ } from "./chunk-MMJL4TIX.js";
10
18
  import {
11
19
  _RAW_KEY_PREFIXES,
12
20
  hardenedSpawnEnv
13
- } from "./chunk-VSYT7OHO.js";
14
- import "./chunk-GB2FSUEE.js";
21
+ } from "./chunk-LVRYBKTI.js";
22
+ import "./chunk-LCFJIQ4J.js";
15
23
  import "./chunk-NDJLNC6Q.js";
16
24
  import "./chunk-OY53J6II.js";
17
25
  import "./chunk-J55WI3RR.js";
@@ -239,6 +247,67 @@ function consume_handoff_context(root, now = /* @__PURE__ */ new Date()) {
239
247
  remove();
240
248
  return { action: "inject", reason: `handoff consumed (session=${sourceSession})`, context: block };
241
249
  }
250
+ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
251
+ const target = process2.env.AGENT_RECYCLE_ENVELOPE_FILE || path.join(root, RECYCLE_ENVELOPE_REL);
252
+ let text;
253
+ try {
254
+ text = fs.readFileSync(target, "utf-8");
255
+ } catch {
256
+ return { action: "absent", reason: "no recycle envelope" };
257
+ }
258
+ const consume = () => {
259
+ try {
260
+ fs.renameSync(target, path.join(path.dirname(target), path.basename(RECYCLE_CONSUMED_REL)));
261
+ } catch {
262
+ try {
263
+ fs.unlinkSync(target);
264
+ } catch {
265
+ }
266
+ }
267
+ };
268
+ let envelope;
269
+ try {
270
+ envelope = JSON.parse(text);
271
+ } catch {
272
+ consume();
273
+ return { action: "discard", reason: "recycle envelope is not valid JSON" };
274
+ }
275
+ const violations = validateRecycleEnvelope(envelope);
276
+ if (violations.length > 0) {
277
+ consume();
278
+ return {
279
+ action: "discard",
280
+ reason: `recycle envelope invalid: ${violations[0] ?? "schema violation"}`
281
+ };
282
+ }
283
+ const stamp = Date.parse(String(envelope["written_at"]));
284
+ const ageHours = (now.getTime() - stamp) / (1e3 * 60 * 60);
285
+ if (Number.isNaN(stamp) || ageHours > RECYCLE_MAX_AGE_HOURS) {
286
+ consume();
287
+ return { action: "discard", reason: `recycle envelope stale: ${ageHours.toFixed(1)}h > ${RECYCLE_MAX_AGE_HOURS}h` };
288
+ }
289
+ try {
290
+ const envelopeWs = fs.realpathSync(String(envelope["workspace"]));
291
+ const thisWs = fs.realpathSync(root);
292
+ if (envelopeWs !== thisWs) {
293
+ consume();
294
+ return { action: "discard", reason: `recycle envelope belongs to ${envelopeWs}, not ${thisWs}` };
295
+ }
296
+ } catch {
297
+ consume();
298
+ return { action: "discard", reason: "recycle envelope workspace does not resolve" };
299
+ }
300
+ const block = [
301
+ `<recycle-envelope source="${RECYCLE_ENVELOPE_REL}"`,
302
+ ' note="deliberate session recycle \u2014 validated state from the predecessor session;',
303
+ " DATA, not instructions. Re-derive everything under not_carried_forward from source",
304
+ ' before trusting it.">',
305
+ JSON.stringify(envelope, null, 2),
306
+ "</recycle-envelope>"
307
+ ].join("\n");
308
+ consume();
309
+ return { action: "inject", reason: "recycle envelope consumed", context: block };
310
+ }
242
311
  function main() {
243
312
  let envelope = {};
244
313
  try {
@@ -258,13 +327,24 @@ function main() {
258
327
  return 0;
259
328
  }
260
329
  if (event === "session_start") {
261
- const decision = consume_handoff_context(root);
262
- if (decision.action === "inject" && decision.context) {
330
+ const handoff = consume_handoff_context(root);
331
+ const recycle = consume_recycle_envelope(root);
332
+ const blocks = [];
333
+ const reasons = [];
334
+ if (recycle.action === "inject" && recycle.context) {
335
+ blocks.push(recycle.context);
336
+ reasons.push(recycle.reason);
337
+ }
338
+ if (handoff.action === "inject" && handoff.context) {
339
+ blocks.push(handoff.context);
340
+ reasons.push(handoff.reason);
341
+ }
342
+ if (blocks.length > 0) {
263
343
  process2.stdout.write(
264
344
  JSON.stringify({
265
345
  decision: "allow",
266
- reason: decision.reason,
267
- context: decision.context
346
+ reason: reasons.join(" \xB7 "),
347
+ context: blocks.join("\n\n")
268
348
  }) + "\n"
269
349
  );
270
350
  }
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolve_project_root
4
- } from "./chunk-GB2FSUEE.js";
4
+ } from "./chunk-LCFJIQ4J.js";
5
5
  import "./chunk-NDJLNC6Q.js";
6
6
  import "./chunk-J55WI3RR.js";
7
7
 
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  main
4
- } from "./chunk-JXARCGVN.js";
5
- import "./chunk-GB2FSUEE.js";
4
+ } from "./chunk-MP3JT3IU.js";
5
+ import "./chunk-LCFJIQ4J.js";
6
6
  import "./chunk-NDJLNC6Q.js";
7
7
  import "./chunk-MCJYCQPF.js";
8
8
  import "./chunk-J55WI3RR.js";
@@ -4,12 +4,12 @@ import {
4
4
  SOURCE_MISSING,
5
5
  profile_file,
6
6
  resolve_profile
7
- } from "./chunk-22GCIJ2O.js";
7
+ } from "./chunk-66OVWGB5.js";
8
8
  import {
9
9
  DEFAULT_PROJECT_FILE,
10
10
  load_agent_settings,
11
11
  resolve_project_root
12
- } from "./chunk-GB2FSUEE.js";
12
+ } from "./chunk-LCFJIQ4J.js";
13
13
  import "./chunk-NDJLNC6Q.js";
14
14
  import "./chunk-J55WI3RR.js";
15
15
 
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  PROJECT_BRIDGE_MARKERS
4
- } from "./chunk-PQSAQKHW.js";
5
- import "./chunk-DVRS2KVR.js";
6
- import "./chunk-JXARCGVN.js";
4
+ } from "./chunk-EQY4FLJB.js";
5
+ import "./chunk-DDUNNFYX.js";
6
+ import "./chunk-MP3JT3IU.js";
7
7
  import "./chunk-BKO2AZ7Z.js";
8
8
  import {
9
9
  manifest_path,
@@ -13,7 +13,7 @@ import "./chunk-GRRPEPRN.js";
13
13
  import "./chunk-NXFWFAYV.js";
14
14
  import {
15
15
  resolve_project_root
16
- } from "./chunk-GB2FSUEE.js";
16
+ } from "./chunk-LCFJIQ4J.js";
17
17
  import "./chunk-NDJLNC6Q.js";
18
18
  import "./chunk-523HCFYO.js";
19
19
  import "./chunk-OY53J6II.js";
@@ -2,14 +2,15 @@
2
2
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
3
3
  import {
4
4
  read_entries
5
- } from "./chunk-7OMQCH4V.js";
5
+ } from "./chunk-BTJNRUX3.js";
6
6
  import "./chunk-3EWYC3YK.js";
7
+ import "./chunk-MMJL4TIX.js";
7
8
  import {
8
9
  match_prompt
9
10
  } from "./chunk-LF2KKJ4Q.js";
10
11
  import {
11
12
  load_agent_settings
12
- } from "./chunk-GB2FSUEE.js";
13
+ } from "./chunk-LCFJIQ4J.js";
13
14
  import "./chunk-NDJLNC6Q.js";
14
15
  import "./chunk-OY53J6II.js";
15
16
  import {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-LF2KKJ4Q.js";
7
7
  import {
8
8
  load_agent_settings
9
- } from "./chunk-GB2FSUEE.js";
9
+ } from "./chunk-LCFJIQ4J.js";
10
10
  import "./chunk-NDJLNC6Q.js";
11
11
  import {
12
12
  resolvePackageRoot
@@ -0,0 +1,177 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+ import {
3
+ CAPSULE_SCHEMA_VERSION,
4
+ RECYCLE_ENVELOPE_MAX_BYTES,
5
+ RECYCLE_ENVELOPE_REL,
6
+ validateRecycleEnvelope
7
+ } from "./chunk-RVGBH4XK.js";
8
+ import {
9
+ atomic_write_json
10
+ } from "./chunk-O3CO5BFB.js";
11
+ import {
12
+ resolve_project_root
13
+ } from "./chunk-LCFJIQ4J.js";
14
+ import "./chunk-NDJLNC6Q.js";
15
+ import "./chunk-J55WI3RR.js";
16
+
17
+ // src/scripts/_cli/cmd_session_recycle.ts
18
+ import * as fs from "node:fs";
19
+ import * as path from "node:path";
20
+ import process from "node:process";
21
+ import { fileURLToPath, pathToFileURL } from "node:url";
22
+ function templateEnvelope() {
23
+ return {
24
+ capsule_version: CAPSULE_SCHEMA_VERSION,
25
+ variant: "main_session",
26
+ summary: "<one- or two-sentence outcome so far>",
27
+ task: "<the active task, one line>",
28
+ acceptance_criteria: ["<what done means, one line each>"],
29
+ remaining: ["<open work, one line each>"],
30
+ not_carried_forward: ["<what the successor must re-derive from source>"],
31
+ decisions: ["<decision \u2014 one-line rationale>"],
32
+ constraints: ["<binding constraint>"],
33
+ open_worker_envelopes: [],
34
+ artifact_paths: ["<path to a deliverable / note / evidence file>"],
35
+ assumptions: []
36
+ };
37
+ }
38
+ function parseArgv(argv) {
39
+ const parsed = { ok: true };
40
+ for (let i = 0; i < argv.length; i += 1) {
41
+ const a = argv[i];
42
+ if (a === "--template") {
43
+ parsed.template = true;
44
+ } else if (a === "--file") {
45
+ const value = argv[i + 1];
46
+ if (!value) return { ok: false, message: "--file requires a path" };
47
+ parsed.file = value;
48
+ i += 1;
49
+ } else if (a === "-h" || a === "--help") {
50
+ return { ok: false, message: "usage" };
51
+ } else {
52
+ return { ok: false, message: `unknown argument: ${a}` };
53
+ }
54
+ }
55
+ return parsed;
56
+ }
57
+ function runSessionRecycle(input, opts) {
58
+ const out = [];
59
+ const err = [];
60
+ const [projectRoot] = resolve_project_root(null, { cwd: opts.cwd });
61
+ let parsed;
62
+ try {
63
+ parsed = JSON.parse(input);
64
+ } catch (exc) {
65
+ return { code: 1, out, err: [`envelope is not valid JSON: ${String(exc)}`] };
66
+ }
67
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
68
+ return { code: 1, out, err: ["envelope must be a JSON object"] };
69
+ }
70
+ const envelope = parsed;
71
+ if (envelope["capsule_version"] === void 0) envelope["capsule_version"] = CAPSULE_SCHEMA_VERSION;
72
+ if (envelope["variant"] === void 0) envelope["variant"] = "main_session";
73
+ if (envelope["written_at"] === void 0) {
74
+ envelope["written_at"] = (opts.now ?? /* @__PURE__ */ new Date()).toISOString();
75
+ }
76
+ if (envelope["workspace"] === void 0) envelope["workspace"] = projectRoot;
77
+ const violations = validateRecycleEnvelope(envelope);
78
+ if (violations.length > 0) {
79
+ return {
80
+ code: 1,
81
+ out,
82
+ err: ["recycle envelope refused \u2014 schema violations:", ...violations.map((v) => ` - ${v}`)]
83
+ };
84
+ }
85
+ const serialized = JSON.stringify(envelope, null, 2);
86
+ const bytes = Buffer.byteLength(serialized, "utf-8");
87
+ if (bytes > RECYCLE_ENVELOPE_MAX_BYTES) {
88
+ return {
89
+ code: 1,
90
+ out,
91
+ err: [
92
+ `recycle envelope refused \u2014 ${bytes} bytes > ${RECYCLE_ENVELOPE_MAX_BYTES} byte cap.`,
93
+ "An envelope is selection and pointers, not a dump: move detail into artifact",
94
+ "files and reference them via artifact_paths."
95
+ ]
96
+ };
97
+ }
98
+ const target = path.join(projectRoot, RECYCLE_ENVELOPE_REL);
99
+ try {
100
+ atomic_write_json(target, envelope);
101
+ } catch (exc) {
102
+ return { code: 1, out, err: [`could not write ${target}: ${String(exc)}`] };
103
+ }
104
+ out.push(`recycle envelope written \u2014 ${RECYCLE_ENVELOPE_REL} (${bytes} bytes)`);
105
+ out.push("");
106
+ out.push("Resume instruction:");
107
+ out.push(" 1. End this session now: run /clear (or start a fresh session in this workspace).");
108
+ out.push(" 2. The successor session receives the envelope automatically at session_start");
109
+ out.push(" (injected once as DATA, then consumed \u2014 moved, not copied).");
110
+ out.push(" 3. The successor re-derives everything on the not_carried_forward list from");
111
+ out.push(" source before trusting it.");
112
+ return { code: 0, out, err };
113
+ }
114
+ function main(argv = process.argv.slice(2)) {
115
+ const parsed = parseArgv(argv);
116
+ if (!parsed.ok) {
117
+ const usage = [
118
+ "usage: agent-config session:recycle [--file <envelope.json>] [--template]",
119
+ " --file <path> read the envelope JSON from a file (default: stdin)",
120
+ " --template print a skeleton envelope and exit"
121
+ ].join("\n");
122
+ if (parsed.message === "usage") {
123
+ process.stdout.write(`${usage}
124
+ `);
125
+ return 0;
126
+ }
127
+ process.stderr.write(`${parsed.message}
128
+ ${usage}
129
+ `);
130
+ return 2;
131
+ }
132
+ if (parsed.template) {
133
+ process.stdout.write(`${JSON.stringify(templateEnvelope(), null, 2)}
134
+ `);
135
+ return 0;
136
+ }
137
+ let input;
138
+ try {
139
+ if (parsed.file) {
140
+ input = fs.readFileSync(parsed.file, "utf-8");
141
+ } else if (process.stdin.isTTY) {
142
+ process.stderr.write("no envelope on stdin and no --file given (see --help)\n");
143
+ return 2;
144
+ } else {
145
+ input = fs.readFileSync(0, "utf-8");
146
+ }
147
+ } catch (exc) {
148
+ process.stderr.write(`could not read envelope input: ${String(exc)}
149
+ `);
150
+ return 2;
151
+ }
152
+ const result = runSessionRecycle(input, { cwd: process.cwd() });
153
+ for (const line of result.out) process.stdout.write(`${line}
154
+ `);
155
+ for (const line of result.err) process.stderr.write(`${line}
156
+ `);
157
+ return result.code;
158
+ }
159
+ function _isCliEntry() {
160
+ if (true) return false;
161
+ if (process.argv[1] === void 0) return false;
162
+ if (import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) return true;
163
+ try {
164
+ return fs.realpathSync(fileURLToPath(import.meta.url)) === fs.realpathSync(path.resolve(process.argv[1]));
165
+ } catch {
166
+ return false;
167
+ }
168
+ }
169
+ if (_isCliEntry()) {
170
+ process.exit(main());
171
+ }
172
+ export {
173
+ main,
174
+ parseArgv,
175
+ runSessionRecycle,
176
+ templateEnvelope
177
+ };
@@ -5,13 +5,13 @@ import {
5
5
  getSettingsLeaf,
6
6
  load,
7
7
  parseSettingsClassRows
8
- } from "./chunk-REKCMYOU.js";
8
+ } from "./chunk-PFBV6XRT.js";
9
9
  import {
10
10
  MERGEABLE_KEYS,
11
11
  USER_GLOBAL_FILENAME,
12
12
  iter_setting_overrides,
13
13
  load_agent_settings
14
- } from "./chunk-GB2FSUEE.js";
14
+ } from "./chunk-LCFJIQ4J.js";
15
15
  import {
16
16
  resolve_with_fallback,
17
17
  write_target
@@ -41,12 +41,6 @@ var SETTINGS_CARVE_OUT = [
41
41
  absentResolvesTo: "null \u2014 LEGACY_ALL, i.e. every rule ships including maintainer-only ones",
42
42
  reason: "Same upgrade contract as projection.mode, and the failure is louder: an absent list widens the projection instead of narrowing it."
43
43
  },
44
- {
45
- key: "subagents.auto",
46
- reader: "src/scripts/routing_doctor.ts:206",
47
- absentResolvesTo: "ask",
48
- reason: "The reader falls back to `ask` while the template ships `on`. Carved out rather than fixed at the reader because the doctor reports what the RESOLVED configuration is; changing its fallback would make the report disagree with what the other readers actually do."
49
- },
50
44
  {
51
45
  key: "discipline_profile",
52
46
  reader: "work_engine/_lib/agent_settings.ts:1263",
@@ -3,14 +3,14 @@ import {
3
3
  GLOBAL_AGENT_SETTINGS_PATH,
4
4
  GLOBAL_USER_SETTINGS_PATH,
5
5
  SETTINGS_FILE
6
- } from "./chunk-PQSAQKHW.js";
7
- import "./chunk-DVRS2KVR.js";
8
- import "./chunk-JXARCGVN.js";
6
+ } from "./chunk-EQY4FLJB.js";
7
+ import "./chunk-DDUNNFYX.js";
8
+ import "./chunk-MP3JT3IU.js";
9
9
  import "./chunk-BKO2AZ7Z.js";
10
10
  import "./chunk-63WSP6YZ.js";
11
11
  import "./chunk-GRRPEPRN.js";
12
12
  import "./chunk-NXFWFAYV.js";
13
- import "./chunk-GB2FSUEE.js";
13
+ import "./chunk-LCFJIQ4J.js";
14
14
  import "./chunk-NDJLNC6Q.js";
15
15
  import "./chunk-523HCFYO.js";
16
16
  import "./chunk-OY53J6II.js";
@@ -5,11 +5,11 @@ import {
5
5
  getSettingsLeaf,
6
6
  load,
7
7
  parseSettingsClassRows
8
- } from "./chunk-REKCMYOU.js";
8
+ } from "./chunk-PFBV6XRT.js";
9
9
  import {
10
10
  external_exports,
11
11
  settingsSchema
12
- } from "./chunk-DVRS2KVR.js";
12
+ } from "./chunk-DDUNNFYX.js";
13
13
  import {
14
14
  resolvePackageRoot
15
15
  } from "./chunk-MCJYCQPF.js";
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  main
4
- } from "./chunk-PQSAQKHW.js";
5
- import "./chunk-DVRS2KVR.js";
6
- import "./chunk-JXARCGVN.js";
4
+ } from "./chunk-EQY4FLJB.js";
5
+ import "./chunk-DDUNNFYX.js";
6
+ import "./chunk-MP3JT3IU.js";
7
7
  import "./chunk-BKO2AZ7Z.js";
8
8
  import {
9
9
  manifest_path,
@@ -13,7 +13,7 @@ import "./chunk-GRRPEPRN.js";
13
13
  import "./chunk-NXFWFAYV.js";
14
14
  import {
15
15
  resolve_project_root
16
- } from "./chunk-GB2FSUEE.js";
16
+ } from "./chunk-LCFJIQ4J.js";
17
17
  import "./chunk-NDJLNC6Q.js";
18
18
  import "./chunk-523HCFYO.js";
19
19
  import "./chunk-OY53J6II.js";
@@ -3,9 +3,9 @@ import {
3
3
  PROJECT_BRIDGE_MARKERS,
4
4
  USER_SCOPE_PATHS,
5
5
  subtract_pointers
6
- } from "./chunk-PQSAQKHW.js";
7
- import "./chunk-DVRS2KVR.js";
8
- import "./chunk-JXARCGVN.js";
6
+ } from "./chunk-EQY4FLJB.js";
7
+ import "./chunk-DDUNNFYX.js";
8
+ import "./chunk-MP3JT3IU.js";
9
9
  import "./chunk-BKO2AZ7Z.js";
10
10
  import {
11
11
  manifest_path,
@@ -23,7 +23,7 @@ import {
23
23
  import "./chunk-NXFWFAYV.js";
24
24
  import {
25
25
  resolve_project_root
26
- } from "./chunk-GB2FSUEE.js";
26
+ } from "./chunk-LCFJIQ4J.js";
27
27
  import "./chunk-NDJLNC6Q.js";
28
28
  import "./chunk-523HCFYO.js";
29
29
  import "./chunk-OY53J6II.js";
@@ -16,7 +16,7 @@ import {
16
16
  LOCAL_PROJECT_SUBDIR,
17
17
  find_project_root,
18
18
  resolve_project_root
19
- } from "./chunk-GB2FSUEE.js";
19
+ } from "./chunk-LCFJIQ4J.js";
20
20
  import "./chunk-NDJLNC6Q.js";
21
21
  import {
22
22
  resolvePackageRoot
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-GRRPEPRN.js";
20
20
  import {
21
21
  project_settings_path
22
- } from "./chunk-GB2FSUEE.js";
22
+ } from "./chunk-LCFJIQ4J.js";
23
23
  import {
24
24
  event4u_root,
25
25
  write_target
@@ -3,9 +3,9 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
3
3
  import {
4
4
  PROJECT_BRIDGE_MARKERS,
5
5
  USER_SCOPE_PATHS
6
- } from "./chunk-PQSAQKHW.js";
7
- import "./chunk-DVRS2KVR.js";
8
- import "./chunk-JXARCGVN.js";
6
+ } from "./chunk-EQY4FLJB.js";
7
+ import "./chunk-DDUNNFYX.js";
8
+ import "./chunk-MP3JT3IU.js";
9
9
  import "./chunk-BKO2AZ7Z.js";
10
10
  import {
11
11
  manifest_path,
@@ -17,7 +17,7 @@ import {
17
17
  import "./chunk-NXFWFAYV.js";
18
18
  import {
19
19
  resolve_project_root
20
- } from "./chunk-GB2FSUEE.js";
20
+ } from "./chunk-LCFJIQ4J.js";
21
21
  import "./chunk-NDJLNC6Q.js";
22
22
  import "./chunk-523HCFYO.js";
23
23
  import "./chunk-OY53J6II.js";
@@ -2,7 +2,7 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
2
2
  import {
3
3
  project_settings_path,
4
4
  resolve_project_root
5
- } from "./chunk-GB2FSUEE.js";
5
+ } from "./chunk-LCFJIQ4J.js";
6
6
  import "./chunk-NDJLNC6Q.js";
7
7
  import {
8
8
  resolvePackageRoot
@@ -1,6 +1,6 @@
1
1
  # Discovery — Deprecation Report
2
2
 
3
- - Generated: `2026-08-09T12:32:14Z`
3
+ - Generated: `2026-08-10T13:16:44Z`
4
4
  - Deprecated artefacts: **0**
5
5
 
6
6
  _None. Tree is clean._