@event4u/agent-config 14.19.0 → 14.21.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 (161) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +351 -156
  5. package/README.md +1 -1
  6. package/agents/templates/.ai-council.yml.example +10 -0
  7. package/dist/agent-src/commands/agent-handoff.md +42 -41
  8. package/dist/agent-src/commands/analyze/inbox.md +1 -1
  9. package/dist/agent-src/commands/analyze/{reference-repo.md → repo.md} +247 -32
  10. package/dist/agent-src/commands/analyze/roadmap-repos.md +129 -0
  11. package/dist/agent-src/commands/analyze.md +12 -7
  12. package/dist/agent-src/commands/feature/plan.md +55 -16
  13. package/dist/agent-src/commands/feature/refactor.md +8 -3
  14. package/dist/agent-src/commands/humanize.md +48 -4
  15. package/dist/agent-src/contexts/execution/contract-decision-sheet.md +22 -1
  16. package/dist/agent-src/contexts/execution/host-capability-manifest.md +11 -2
  17. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +35 -2
  18. package/dist/agent-src/contexts/execution/terminal-states.md +4 -1
  19. package/dist/agent-src/rules/evaluator-independence.md +4 -4
  20. package/dist/agent-src/rules/external-reference-deep-dive.md +2 -2
  21. package/dist/agent-src/rules/untrusted-input-defense.md +0 -2
  22. package/dist/agent-src/skills/competitive-positioning/SKILL.md +2 -2
  23. package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +1 -1
  24. package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +27 -11
  25. package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +1 -1
  26. package/dist/agent-src/skills/markitdown/SKILL.md +2 -2
  27. package/dist/agent-src/skills/repomix-packer/SKILL.md +1 -1
  28. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +28 -6
  29. package/dist/agent-src/skills/technical-specification/SKILL.md +4 -0
  30. package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -3
  31. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  32. package/dist/agent-src/templates/features.md +5 -0
  33. package/dist/agent-src/templates/roadmaps.md +29 -1
  34. package/dist/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  35. package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  36. package/dist/agent-src/templates/scripts/telemetry_report.ts +22 -2
  37. package/dist/cli/mcp/dispatch.js +10 -0
  38. package/dist/cli/mcp/stdio.js +33 -2
  39. package/dist/cli/mcp/telemetry.js +227 -0
  40. package/dist/cli-delegate/{chunk-KPBWFOPZ.js → chunk-2FTMENJL.js} +194 -37
  41. package/dist/cli-delegate/{chunk-PMEKGDED.js → chunk-2TAQ2K4V.js} +166 -1
  42. package/dist/cli-delegate/{chunk-GZTMRYCN.js → chunk-643Z7FIC.js} +79 -12
  43. package/dist/cli-delegate/{chunk-CYH5SP6M.js → chunk-I6RHFQEG.js} +151 -16
  44. package/dist/cli-delegate/{chunk-IDHUQIXP.js → chunk-J3RFNKG4.js} +41 -5
  45. package/dist/cli-delegate/{chunk-7PRE6ZV2.js → chunk-YS6XTLEK.js} +199 -4
  46. package/dist/cli-delegate/chunk-ZVBOHSVF.js +1109 -0
  47. package/dist/cli-delegate/cmd_conformance.js +88 -110
  48. package/dist/cli-delegate/cmd_doctor.js +3 -3
  49. package/dist/cli-delegate/cmd_export.js +2 -2
  50. package/dist/cli-delegate/cmd_handoff.js +42 -12
  51. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  52. package/dist/cli-delegate/cmd_prune.js +2 -2
  53. package/dist/cli-delegate/cmd_route_audit.js +1 -1
  54. package/dist/cli-delegate/cmd_session_recycle.js +59 -902
  55. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  56. package/dist/cli-delegate/cmd_sync.js +2 -2
  57. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  58. package/dist/cli-delegate/cmd_validate.js +2 -2
  59. package/dist/discovery/deprecation-report.md +1 -1
  60. package/dist/discovery/discovery-manifest.json +62 -31
  61. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  62. package/dist/discovery/discovery-manifest.summary.md +3 -3
  63. package/dist/discovery/dormancy-report.md +1 -1
  64. package/dist/discovery/orphan-report.md +1 -1
  65. package/dist/discovery/packs.json +7 -6
  66. package/dist/discovery/trust-report.md +2 -2
  67. package/dist/discovery/workspaces.json +6 -5
  68. package/dist/hooks/dispatch.js +3801 -2803
  69. package/dist/install/install.mjs +396 -168
  70. package/dist/mcp/registry-manifest.json +3 -3
  71. package/dist/mcp/server.json +2 -2
  72. package/dist/mcp/server.mjs +809 -180
  73. package/dist/scripts/ai_council/content_ceiling.js +63 -0
  74. package/dist/scripts/ai_council/seat_policy.js +106 -0
  75. package/dist/scripts/ai_council/transport_resolver.js +21 -0
  76. package/dist/scripts/mcp_server/telemetry.js +148 -0
  77. package/docs/guidelines/agent-infra/naming.md +1 -1
  78. package/docs/guidelines/agent-infra/security-lint-containment.md +46 -6
  79. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +4 -4
  80. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +1 -1
  81. package/docs/guidelines/redundancy-taxonomy.md +28 -0
  82. package/llms.txt +14 -14
  83. package/package.json +1 -1
  84. package/src/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  85. package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  86. package/src/agent-src/templates/scripts/telemetry_report.ts +22 -2
  87. package/src/config/assurance-capability-registry.json +9 -0
  88. package/src/config/gate-coverage.yml +55 -0
  89. package/src/config/gate-violation-baselines.json +18 -6
  90. package/src/config/release-gate-locality.yml +4 -3
  91. package/src/scripts/_cli/cmd_session_recycle.ts +51 -3
  92. package/src/scripts/_lib/audit_field_provenance.ts +44 -3
  93. package/src/scripts/_lib/blocked_by_marker.ts +189 -0
  94. package/src/scripts/_lib/host_capability.ts +76 -1
  95. package/src/scripts/_lib/install_reach_checks.ts +33 -1
  96. package/src/scripts/_lib/mcp_bridge.ts +222 -10
  97. package/src/scripts/_lib/mcp_consent_residual.ts +173 -0
  98. package/src/scripts/_lib/orchestration_record.ts +23 -1
  99. package/src/scripts/_lib/recycle_envelope_paths.ts +190 -0
  100. package/src/scripts/_lib/release_highlights.ts +19 -211
  101. package/src/scripts/_lib/release_material.ts +27 -77
  102. package/src/scripts/_lib/release_position.ts +96 -0
  103. package/src/scripts/_lib/review_skipped_record.ts +17 -1
  104. package/src/scripts/_lib/security_lint.ts +179 -7
  105. package/src/scripts/_lib/self_repair.ts +141 -6
  106. package/src/scripts/_lib/self_repair_store.ts +273 -7
  107. package/src/scripts/_lib/structured_ask.ts +117 -0
  108. package/src/scripts/_lib/subagent_capsule.ts +155 -3
  109. package/src/scripts/_lib/tty_prompt.ts +76 -0
  110. package/src/scripts/ai_council/api_transport.ts +163 -0
  111. package/src/scripts/ai_council/clients.ts +58 -63
  112. package/src/scripts/ai_council/config.ts +13 -0
  113. package/src/scripts/ai_council/content_ceiling.ts +79 -0
  114. package/src/scripts/ai_council/jury_aggregate.ts +178 -0
  115. package/src/scripts/ai_council/seat_policy.ts +137 -0
  116. package/src/scripts/ai_council/status_surface.ts +79 -0
  117. package/src/scripts/ai_council/transport_resolver.ts +59 -1
  118. package/src/scripts/ai_tells_rules.ts +446 -5
  119. package/src/scripts/ask_block_census.ts +499 -0
  120. package/src/scripts/bench_humanizer_eval.ts +264 -40
  121. package/src/scripts/bench_prose_tells_fp.ts +198 -0
  122. package/src/scripts/build_rule_trigger_matrix.ts +5 -0
  123. package/src/scripts/check_branch_work_committed.ts +234 -0
  124. package/src/scripts/check_mcp_doc_drift.ts +217 -0
  125. package/src/scripts/check_pack_size.ts +321 -3
  126. package/src/scripts/check_release_highlights.ts +0 -157
  127. package/src/scripts/council_cli.ts +18 -27
  128. package/src/scripts/detect_ai_tells.ts +142 -20
  129. package/src/scripts/handoff_context_hook.ts +54 -7
  130. package/src/scripts/harvest_reference_tokens.ts +698 -0
  131. package/src/scripts/hook_manifest.json +1 -1
  132. package/src/scripts/hook_manifest.yaml +31 -1
  133. package/src/scripts/hooks/concern_registry.ts +2 -0
  134. package/src/scripts/hooks/delegation_nudge_hook.ts +45 -1
  135. package/src/scripts/hooks/one_question_per_ask_hook.ts +191 -0
  136. package/src/scripts/hooks/session_eol_hook.ts +18 -7
  137. package/src/scripts/install-hooks.sh +52 -0
  138. package/src/scripts/install.ts +4 -4
  139. package/src/scripts/lint_agent_security.ts +316 -25
  140. package/src/scripts/lint_confusables.ts +42 -6
  141. package/src/scripts/lint_handoffs.ts +0 -132
  142. package/src/scripts/lint_hidden_unicode.ts +49 -7
  143. package/src/scripts/lint_instruction_smuggling.ts +42 -6
  144. package/src/scripts/lint_mcp_config_security.ts +42 -6
  145. package/src/scripts/lint_roadmap_blockers.ts +51 -1
  146. package/src/scripts/lint_roadmap_later_disposition.ts +217 -27
  147. package/src/scripts/lint_skill_frontmatter_safety.ts +43 -7
  148. package/src/scripts/mcp_server/resources.ts +41 -0
  149. package/src/scripts/mcp_server/telemetry.ts +19 -4
  150. package/src/scripts/migrate_command_suggestions.ts +1 -1
  151. package/src/scripts/orchestration_record.ts +12 -1
  152. package/src/scripts/probe_unblocked_ask.ts +135 -2
  153. package/src/scripts/release.ts +50 -95
  154. package/src/scripts/release_drill.ts +6 -10
  155. package/src/scripts/release_env.ts +1 -0
  156. package/src/scripts/release_publication.ts +40 -31
  157. package/src/scripts/self_repair_cli.ts +31 -1
  158. package/src/scripts/self_review_gate.ts +409 -15
  159. package/src/scripts/skill_scout.ts +69 -0
  160. package/dist/cli-delegate/chunk-2GNWGMAL.js +0 -172
  161. package/dist/cli-delegate/chunk-LPPWO5CE.js +0 -161
@@ -2,17 +2,15 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
2
2
  import {
3
3
  deriveSessionKey,
4
4
  foldRefusal,
5
- parseRecord,
6
- readInstallBoundary,
7
- sessionRefusalFile
8
- } from "./chunk-2GNWGMAL.js";
9
- import {
10
5
  isCiPoll,
11
6
  isVacuousOutput,
7
+ parseRecord,
12
8
  pendingCount,
9
+ readInstallBoundary,
10
+ sessionRefusalFile,
13
11
  statePathFor,
14
12
  validateAssumption
15
- } from "./chunk-7PRE6ZV2.js";
13
+ } from "./chunk-YS6XTLEK.js";
16
14
  import {
17
15
  readHookStdin
18
16
  } from "./chunk-F7DQWYR5.js";
@@ -36,14 +34,14 @@ import {
36
34
  frontmatterPaths,
37
35
  proseEqual,
38
36
  splitFrontmatter
39
- } from "./chunk-IDHUQIXP.js";
37
+ } from "./chunk-J3RFNKG4.js";
40
38
  import "./chunk-FTAISGDQ.js";
41
39
  import "./chunk-M2DPGFZ4.js";
42
40
  import "./chunk-BTWUYDGN.js";
43
41
  import {
44
42
  projectStoreSlug,
45
43
  resolveSessionRole
46
- } from "./chunk-KPBWFOPZ.js";
44
+ } from "./chunk-2FTMENJL.js";
47
45
  import {
48
46
  atomic_write_json,
49
47
  atomic_write_text,
@@ -60,8 +58,9 @@ import {
60
58
  import {
61
59
  atomicAppendLine,
62
60
  manifest_path,
61
+ probeHostCapabilities,
63
62
  read_manifest
64
- } from "./chunk-PMEKGDED.js";
63
+ } from "./chunk-2TAQ2K4V.js";
65
64
  import "./chunk-MWRD5YOH.js";
66
65
  import "./chunk-T7L2QK3K.js";
67
66
  import "./chunk-DMSZHXZS.js";
@@ -84,7 +83,7 @@ var YAML = __toESM(require_dist(), 1);
84
83
  import * as fs13 from "node:fs";
85
84
  import * as os7 from "node:os";
86
85
  import * as path13 from "node:path";
87
- import process6 from "node:process";
86
+ import process5 from "node:process";
88
87
  import { spawnSync as spawnSync2 } from "node:child_process";
89
88
  import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL13 } from "node:url";
90
89
 
@@ -150,7 +149,7 @@ function routeTargetPathsPosix(target) {
150
149
  import * as fs12 from "node:fs";
151
150
  import * as os6 from "node:os";
152
151
  import * as path12 from "node:path";
153
- import process5 from "node:process";
152
+ import process4 from "node:process";
154
153
  import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } from "node:url";
155
154
 
156
155
  // src/scripts/conformance_scan.ts
@@ -1953,6 +1952,19 @@ import * as os from "node:os";
1953
1952
  import * as path3 from "node:path";
1954
1953
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL3 } from "node:url";
1955
1954
 
1955
+ // src/scripts/_lib/audit_field_provenance.ts
1956
+ var MAX_APPLIED_IDS = 32;
1957
+ function appliedIds(values) {
1958
+ const out = [];
1959
+ for (const raw of values ?? []) {
1960
+ const v = String(raw).trim();
1961
+ if (v === "" || out.includes(v)) continue;
1962
+ out.push(v);
1963
+ if (out.length >= MAX_APPLIED_IDS) break;
1964
+ }
1965
+ return out;
1966
+ }
1967
+
1956
1968
  // src/scripts/_lib/review_skipped_record.ts
1957
1969
  var PRODUCER_PRIVACY_CLASS = "ids-only";
1958
1970
  function isNonNegInt(n) {
@@ -1981,7 +1993,8 @@ function buildReviewSkippedLine(input) {
1981
1993
  risk_class: input.diff_lines >= HIGH_RISK_DIFF_LINES ? "high" : "medium",
1982
1994
  memory: { asks: 0, hits: 0 },
1983
1995
  verify: { claims: 0, first_try_passes: 0 },
1984
- rules_applied: ["delegation-policy"],
1996
+ // COMPUTED, never a producer constant.
1997
+ rules_applied: appliedIds(input.rules_applied),
1985
1998
  // MANDATORY on every audit line, same as the orchestration producer.
1986
1999
  privacy_class: PRODUCER_PRIVACY_CLASS,
1987
2000
  // `skills_applied` is OMITTED here, deliberately and not by oversight.
@@ -3451,55 +3464,6 @@ import fs7 from "node:fs";
3451
3464
  import path7 from "node:path";
3452
3465
  import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
3453
3466
 
3454
- // src/scripts/_lib/host_capability.ts
3455
- import process2 from "node:process";
3456
- var SAFE_DEFAULT = {
3457
- schema_version: 1,
3458
- subagent_spawn: false,
3459
- parallel_spawn: false,
3460
- status_polling: false,
3461
- separate_quota_pool: false,
3462
- agent_teams: false,
3463
- worker_respawn: false
3464
- };
3465
- function asBool(value) {
3466
- return value === true;
3467
- }
3468
- function normalizeHostManifest(input) {
3469
- if (input === null || typeof input !== "object") {
3470
- return { ...SAFE_DEFAULT };
3471
- }
3472
- const src = input;
3473
- return {
3474
- schema_version: 1,
3475
- subagent_spawn: asBool(src.subagent_spawn),
3476
- parallel_spawn: asBool(src.parallel_spawn),
3477
- status_polling: asBool(src.status_polling),
3478
- separate_quota_pool: asBool(src.separate_quota_pool),
3479
- agent_teams: asBool(src.agent_teams),
3480
- worker_respawn: asBool(src.worker_respawn)
3481
- };
3482
- }
3483
- var HOST_CAPABILITY_REGISTRY = {
3484
- claude: { subagent_spawn: true, parallel_spawn: true }
3485
- };
3486
- function resolveHostCapabilities(hostId, override) {
3487
- if (override !== void 0 && override !== null && typeof override === "object" && !Array.isArray(override)) {
3488
- return normalizeHostManifest(override);
3489
- }
3490
- const row = hostId !== null && hostId !== void 0 ? HOST_CAPABILITY_REGISTRY[hostId] : void 0;
3491
- if (row === void 0) {
3492
- return { ...SAFE_DEFAULT };
3493
- }
3494
- return { ...SAFE_DEFAULT, ...row, schema_version: 1 };
3495
- }
3496
- function probeHostCapabilities(hostId) {
3497
- const base = resolveHostCapabilities(hostId);
3498
- const flag = process2.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
3499
- const probedAgentTeams = typeof flag === "string" && flag !== "";
3500
- return { ...base, agent_teams: base.agent_teams || probedAgentTeams };
3501
- }
3502
-
3503
3467
  // src/scripts/_lib/auto_dispatch.ts
3504
3468
  var SIZE_FLOOR = 1;
3505
3469
  function inSession(reason) {
@@ -3889,6 +3853,12 @@ function buildNudgeLine(rung, classification, sliceCount, tier) {
3889
3853
  if (rung === 0.5) {
3890
3854
  return `<delegation-nudge>rung-0.5: ask, est. <1k tokens. This is a single bounded question \u2014 answer it via ONE completion (\`./scripts-run src/scripts/ask_transport "<question>"\`) instead of a subagent spawn (measured spawn floor: ~251k tokens) \u2014 ${classification.reason}.</delegation-nudge>`;
3891
3855
  }
3856
+ if (rung === 4) {
3857
+ return `<delegation-nudge>rung-4: council. This is contested judgment, not a slice to dispatch \u2014 route it to the council yourself via \`./scripts-run src/scripts/council_cli run --input <file>\` (check reachability first with \`agent-config council:status\`; the file path is the input, never an inline question). Not a spawn, and not run for you \u2014 ${classification.reason}.</delegation-nudge>`;
3858
+ }
3859
+ if (rung === 3) {
3860
+ return `<delegation-nudge>rung-3: team. These slices must see each other's state during the run, so a set of independent subagent spawns cannot express it \u2014 use the host teams primitive, or fall back to \`./scripts-run src/scripts/ask_transport "<question>"\` for a bounded sub-question. Not a spawn, and not run for you \u2014 ${classification.reason}.</delegation-nudge>`;
3861
+ }
3892
3862
  const modeLabel = classification.mode ?? "single-slice";
3893
3863
  return `<delegation-nudge>${rungLabel}: dispatch ${modeLabel} (${sliceCount} ${unit}, ${tier} tier recommended). Consider dispatching via subagent-orchestration instead of doing every slice in-session \u2014 ${classification.reason}.</delegation-nudge>`;
3894
3864
  }
@@ -3907,6 +3877,14 @@ function classifyPrompt(prompt, workspace_root, hostId) {
3907
3877
  agentTeams,
3908
3878
  insideSubagentSession: sessionRole !== "orchestrator"
3909
3879
  });
3880
+ if (ladder.verdict === "team" || ladder.verdict === "council") {
3881
+ return {
3882
+ classification: { delegable: false, action: "ask", mode: null, reason: ladder.reason },
3883
+ sliceCount: 0,
3884
+ tier: recommendSliceTier(downshift, separate_quota_pool),
3885
+ rung: ladder.rung
3886
+ };
3887
+ }
3910
3888
  if (ladder.verdict !== "subagent") {
3911
3889
  return null;
3912
3890
  }
@@ -4668,7 +4646,7 @@ if (_isCliEntry8()) {
4668
4646
  import * as fs9 from "node:fs";
4669
4647
  import * as os3 from "node:os";
4670
4648
  import * as path9 from "node:path";
4671
- import process3 from "node:process";
4649
+ import process2 from "node:process";
4672
4650
  import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
4673
4651
  var _HERE = fileURLToPath9(import.meta.url);
4674
4652
  var REPO_ROOT2 = path9.resolve(path9.dirname(_HERE), "..", "..");
@@ -4877,7 +4855,7 @@ function render2(d) {
4877
4855
  return lines.join("\n");
4878
4856
  }
4879
4857
  function main9(argv) {
4880
- const args = argv ?? process3.argv.slice(2);
4858
+ const args = argv ?? process2.argv.slice(2);
4881
4859
  let projectDir = path9.join(REPO_ROOT2, PROJECT_RULES);
4882
4860
  let globalDir = path9.join(os3.homedir(), GLOBAL_RULES);
4883
4861
  let sourceDir = path9.join(REPO_ROOT2, PROJECTION_SOURCE);
@@ -4890,7 +4868,7 @@ function main9(argv) {
4890
4868
  if (a === "--project" || a === "--global" || a === "--source") {
4891
4869
  const v = value(i);
4892
4870
  if (v === null) {
4893
- process3.stderr.write(`report_carrier_divergence: ${a} needs a directory
4871
+ process2.stderr.write(`report_carrier_divergence: ${a} needs a directory
4894
4872
  `);
4895
4873
  return 1;
4896
4874
  }
@@ -4900,31 +4878,31 @@ function main9(argv) {
4900
4878
  else sourceDir = resolved;
4901
4879
  i += 1;
4902
4880
  } else if (a === "--help" || a === "-h") {
4903
- process3.stdout.write(
4881
+ process2.stdout.write(
4904
4882
  "usage: report_carrier_divergence [--project DIR] [--global DIR] [--source DIR]\n"
4905
4883
  );
4906
4884
  return 0;
4907
4885
  } else if (a !== void 0 && a.startsWith("--") && a !== "--quiet") {
4908
- process3.stderr.write(`report_carrier_divergence: unknown flag ${a}
4886
+ process2.stderr.write(`report_carrier_divergence: unknown flag ${a}
4909
4887
  `);
4910
4888
  return 1;
4911
4889
  }
4912
4890
  }
4913
- process3.stdout.write(`${render2(compareCarriers(projectDir, globalDir, sourceDir))}
4891
+ process2.stdout.write(`${render2(compareCarriers(projectDir, globalDir, sourceDir))}
4914
4892
  `);
4915
4893
  return 0;
4916
4894
  }
4917
4895
  function _isCliEntry9() {
4918
- if (process3.argv[1] === void 0) return false;
4919
- if (import.meta.url === pathToFileURL9(path9.resolve(process3.argv[1])).href) return true;
4896
+ if (process2.argv[1] === void 0) return false;
4897
+ if (import.meta.url === pathToFileURL9(path9.resolve(process2.argv[1])).href) return true;
4920
4898
  try {
4921
- return fs9.realpathSync(_HERE) === fs9.realpathSync(path9.resolve(process3.argv[1]));
4899
+ return fs9.realpathSync(_HERE) === fs9.realpathSync(path9.resolve(process2.argv[1]));
4922
4900
  } catch {
4923
4901
  return false;
4924
4902
  }
4925
4903
  }
4926
4904
  if (_isCliEntry9()) {
4927
- process3.exit(main9());
4905
+ process2.exit(main9());
4928
4906
  }
4929
4907
 
4930
4908
  // src/scripts/report_skill_activation.ts
@@ -5241,7 +5219,7 @@ if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL10(path10.res
5241
5219
  import * as fs11 from "node:fs";
5242
5220
  import * as os5 from "node:os";
5243
5221
  import * as path11 from "node:path";
5244
- import process4 from "node:process";
5222
+ import process3 from "node:process";
5245
5223
  import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
5246
5224
  var _HERE3 = fileURLToPath11(import.meta.url);
5247
5225
  var REPO_ROOT4 = path11.resolve(path11.dirname(_HERE3), "..", "..");
@@ -5503,7 +5481,7 @@ function render4(r) {
5503
5481
  return lines.join("\n");
5504
5482
  }
5505
5483
  function main11(argv) {
5506
- const args = argv ?? process4.argv.slice(2);
5484
+ const args = argv ?? process3.argv.slice(2);
5507
5485
  let limit = 30;
5508
5486
  let json = false;
5509
5487
  const stores = [];
@@ -5516,7 +5494,7 @@ function main11(argv) {
5516
5494
  if (a === "--limit") {
5517
5495
  const v = value(i);
5518
5496
  if (v === null) {
5519
- process4.stderr.write("report_skill_obligation_violations: --limit needs a number\n");
5497
+ process3.stderr.write("report_skill_obligation_violations: --limit needs a number\n");
5520
5498
  return 1;
5521
5499
  }
5522
5500
  limit = Number.parseInt(v, 10);
@@ -5524,7 +5502,7 @@ function main11(argv) {
5524
5502
  } else if (a === "--store") {
5525
5503
  const v = value(i);
5526
5504
  if (v === null) {
5527
- process4.stderr.write("report_skill_obligation_violations: --store needs a path\n");
5505
+ process3.stderr.write("report_skill_obligation_violations: --store needs a path\n");
5528
5506
  return 1;
5529
5507
  }
5530
5508
  stores.push(v);
@@ -5532,40 +5510,40 @@ function main11(argv) {
5532
5510
  } else if (a === "--json") {
5533
5511
  json = true;
5534
5512
  } else if (a === "--help" || a === "-h") {
5535
- process4.stdout.write(
5513
+ process3.stdout.write(
5536
5514
  "usage: report_skill_obligation_violations [--limit N] [--store PATH]... [--json]\n"
5537
5515
  );
5538
5516
  return 0;
5539
5517
  } else if (a !== void 0 && a.startsWith("--") && a !== "--quiet") {
5540
- process4.stderr.write(`report_skill_obligation_violations: unknown flag ${a}
5518
+ process3.stderr.write(`report_skill_obligation_violations: unknown flag ${a}
5541
5519
  `);
5542
5520
  return 1;
5543
5521
  }
5544
5522
  }
5545
5523
  if (!Number.isFinite(limit) || limit <= 0) {
5546
- process4.stderr.write("report_skill_obligation_violations: --limit must be a positive integer\n");
5524
+ process3.stderr.write("report_skill_obligation_violations: --limit must be a positive integer\n");
5547
5525
  return 1;
5548
5526
  }
5549
5527
  if (stores.length === 0) stores.push(defaultStore3(REPO_ROOT4));
5550
5528
  for (const store of stores) {
5551
5529
  const r = scanStore2(REPO_ROOT4, store, limit);
5552
- process4.stdout.write(json ? `${JSON.stringify(r, null, 2)}
5530
+ process3.stdout.write(json ? `${JSON.stringify(r, null, 2)}
5553
5531
  ` : `${render4(r)}
5554
5532
  `);
5555
5533
  }
5556
5534
  return 0;
5557
5535
  }
5558
5536
  function _isCliEntry10() {
5559
- if (process4.argv[1] === void 0) return false;
5560
- if (import.meta.url === pathToFileURL11(path11.resolve(process4.argv[1])).href) return true;
5537
+ if (process3.argv[1] === void 0) return false;
5538
+ if (import.meta.url === pathToFileURL11(path11.resolve(process3.argv[1])).href) return true;
5561
5539
  try {
5562
- return fs11.realpathSync(_HERE3) === fs11.realpathSync(path11.resolve(process4.argv[1]));
5540
+ return fs11.realpathSync(_HERE3) === fs11.realpathSync(path11.resolve(process3.argv[1]));
5563
5541
  } catch {
5564
5542
  return false;
5565
5543
  }
5566
5544
  }
5567
5545
  if (_isCliEntry10()) {
5568
- process4.exit(main11());
5546
+ process3.exit(main11());
5569
5547
  }
5570
5548
 
5571
5549
  // src/scripts/report_conformance_funnel.ts
@@ -5709,7 +5687,7 @@ function render5(r) {
5709
5687
  return lines.join("\n");
5710
5688
  }
5711
5689
  function main12(argv) {
5712
- const args = argv ?? process5.argv.slice(2);
5690
+ const args = argv ?? process4.argv.slice(2);
5713
5691
  const opts = {};
5714
5692
  const value = (i) => {
5715
5693
  const v = args[i + 1];
@@ -5720,7 +5698,7 @@ function main12(argv) {
5720
5698
  if (a === "--store" || a === "--project" || a === "--global" || a === "--source") {
5721
5699
  const v = value(i);
5722
5700
  if (v === null) {
5723
- process5.stderr.write(`report_conformance_funnel: ${a} needs a value
5701
+ process4.stderr.write(`report_conformance_funnel: ${a} needs a value
5724
5702
  `);
5725
5703
  return 1;
5726
5704
  }
@@ -5734,37 +5712,37 @@ function main12(argv) {
5734
5712
  const v = value(i);
5735
5713
  const n = v === null ? Number.NaN : Number.parseInt(v, 10);
5736
5714
  if (!Number.isFinite(n) || n <= 0) {
5737
- process5.stderr.write("report_conformance_funnel: --limit must be a positive integer\n");
5715
+ process4.stderr.write("report_conformance_funnel: --limit must be a positive integer\n");
5738
5716
  return 1;
5739
5717
  }
5740
5718
  opts.limit = n;
5741
5719
  i += 1;
5742
5720
  } else if (a === "--help" || a === "-h") {
5743
- process5.stdout.write(
5721
+ process4.stdout.write(
5744
5722
  "usage: report_conformance_funnel [--store PATH] [--limit N]\n [--project DIR] [--global DIR] [--source DIR]\n"
5745
5723
  );
5746
5724
  return 0;
5747
5725
  } else if (a !== void 0 && a.startsWith("--") && a !== "--quiet") {
5748
- process5.stderr.write(`report_conformance_funnel: unknown flag ${a}
5726
+ process4.stderr.write(`report_conformance_funnel: unknown flag ${a}
5749
5727
  `);
5750
5728
  return 1;
5751
5729
  }
5752
5730
  }
5753
- process5.stdout.write(`${render5(buildFunnel(opts))}
5731
+ process4.stdout.write(`${render5(buildFunnel(opts))}
5754
5732
  `);
5755
5733
  return 0;
5756
5734
  }
5757
5735
  function _isCliEntry11() {
5758
- if (process5.argv[1] === void 0) return false;
5759
- if (import.meta.url === pathToFileURL12(path12.resolve(process5.argv[1])).href) return true;
5736
+ if (process4.argv[1] === void 0) return false;
5737
+ if (import.meta.url === pathToFileURL12(path12.resolve(process4.argv[1])).href) return true;
5760
5738
  try {
5761
- return fs12.realpathSync(_HERE4) === fs12.realpathSync(path12.resolve(process5.argv[1]));
5739
+ return fs12.realpathSync(_HERE4) === fs12.realpathSync(path12.resolve(process4.argv[1]));
5762
5740
  } catch {
5763
5741
  return false;
5764
5742
  }
5765
5743
  }
5766
5744
  if (_isCliEntry11()) {
5767
- process5.exit(main12());
5745
+ process4.exit(main12());
5768
5746
  }
5769
5747
 
5770
5748
  // src/scripts/_cli/cmd_conformance.ts
@@ -5779,22 +5757,22 @@ var CONFORMANCE_CHECK_IDS = [
5779
5757
  ];
5780
5758
  var THIN_STUB_MARKER = "Routed rule \u2014 load the body on trigger-match";
5781
5759
  function print(s = "") {
5782
- process6.stdout.write(`${s}
5760
+ process5.stdout.write(`${s}
5783
5761
  `);
5784
5762
  }
5785
5763
  function eprint(s = "") {
5786
- process6.stderr.write(`${s}
5764
+ process5.stderr.write(`${s}
5787
5765
  `);
5788
5766
  }
5789
5767
  function conformanceLogPath() {
5790
- const override = process6.env["AGENT_CONFIG_CONFORMANCE_LOG"];
5768
+ const override = process5.env["AGENT_CONFIG_CONFORMANCE_LOG"];
5791
5769
  if (override && override.trim().length > 0) {
5792
5770
  return override;
5793
5771
  }
5794
5772
  return path13.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
5795
5773
  }
5796
5774
  function installLogPath() {
5797
- const override = process6.env["AGENT_CONFIG_INSTALL_LOG"];
5775
+ const override = process5.env["AGENT_CONFIG_INSTALL_LOG"];
5798
5776
  if (override && override.trim().length > 0) {
5799
5777
  return override;
5800
5778
  }
@@ -6092,7 +6070,7 @@ function _check_host_manifest(projectRoot) {
6092
6070
  };
6093
6071
  }
6094
6072
  function runConformanceChecks(opts = {}) {
6095
- const projectRoot = opts.projectRoot ?? process6.cwd();
6073
+ const projectRoot = opts.projectRoot ?? process5.cwd();
6096
6074
  const packageRoot = opts.packageRoot ?? PACKAGE_ROOT;
6097
6075
  const checks = [];
6098
6076
  checks.push(_check_txlog_clean());
@@ -6133,7 +6111,7 @@ function _parse(argv) {
6133
6111
  while (i < argv.length) {
6134
6112
  const a = argv[i];
6135
6113
  if (a === "-h" || a === "--help") {
6136
- process6.stdout.write(USAGE2);
6114
+ process5.stdout.write(USAGE2);
6137
6115
  throw new ArgparseExit(0);
6138
6116
  }
6139
6117
  if (a === "--json") {
@@ -6147,16 +6125,16 @@ function _parse(argv) {
6147
6125
  opts.project = a.slice(a.indexOf("=") + 1);
6148
6126
  } else {
6149
6127
  if (i + 1 >= argv.length) {
6150
- process6.stderr.write(USAGE2);
6151
- process6.stderr.write("agent-config conformance: error: --project expects a value\n");
6128
+ process5.stderr.write(USAGE2);
6129
+ process5.stderr.write("agent-config conformance: error: --project expects a value\n");
6152
6130
  throw new ArgparseExit(2);
6153
6131
  }
6154
6132
  opts.project = argv[i + 1];
6155
6133
  i += 1;
6156
6134
  }
6157
6135
  } else {
6158
- process6.stderr.write(USAGE2);
6159
- process6.stderr.write(`agent-config conformance: error: unrecognized argument ${a}
6136
+ process5.stderr.write(USAGE2);
6137
+ process5.stderr.write(`agent-config conformance: error: unrecognized argument ${a}
6160
6138
  `);
6161
6139
  throw new ArgparseExit(2);
6162
6140
  }
@@ -6165,7 +6143,7 @@ function _parse(argv) {
6165
6143
  return opts;
6166
6144
  }
6167
6145
  function main13(argv = null) {
6168
- const opts = _parse(argv !== null ? Array.from(argv) : process6.argv.slice(2));
6146
+ const opts = _parse(argv !== null ? Array.from(argv) : process5.argv.slice(2));
6169
6147
  if (opts.funnel) {
6170
6148
  print(render5(buildFunnel()));
6171
6149
  return 0;
@@ -6236,27 +6214,27 @@ function main13(argv = null) {
6236
6214
  return failed ? 1 : 0;
6237
6215
  }
6238
6216
  function _isCliEntry12() {
6239
- if (process6.argv[1] === void 0) {
6217
+ if (process5.argv[1] === void 0) {
6240
6218
  return false;
6241
6219
  }
6242
- const argvUrl = pathToFileURL13(path13.resolve(process6.argv[1])).href;
6220
+ const argvUrl = pathToFileURL13(path13.resolve(process5.argv[1])).href;
6243
6221
  if (import.meta.url === argvUrl) {
6244
6222
  return true;
6245
6223
  }
6246
6224
  try {
6247
6225
  const here = fs13.realpathSync(fileURLToPath13(import.meta.url));
6248
- const argv = fs13.realpathSync(path13.resolve(process6.argv[1]));
6226
+ const argv = fs13.realpathSync(path13.resolve(process5.argv[1]));
6249
6227
  return here === argv;
6250
6228
  } catch {
6251
6229
  return false;
6252
6230
  }
6253
6231
  }
6254
- if (_isCliEntry12() || process6.argv[1] === _HERE5) {
6232
+ if (_isCliEntry12() || process5.argv[1] === _HERE5) {
6255
6233
  try {
6256
- process6.exitCode = main13(process6.argv.slice(2));
6234
+ process5.exitCode = main13(process5.argv.slice(2));
6257
6235
  } catch (e) {
6258
6236
  if (e instanceof ArgparseExit) {
6259
- process6.exitCode = e.code;
6237
+ process5.exitCode = e.code;
6260
6238
  } else {
6261
6239
  throw e;
6262
6240
  }
@@ -66,13 +66,13 @@ import {
66
66
  _wizard_state_path,
67
67
  main,
68
68
  shutilWhich
69
- } from "./chunk-IDHUQIXP.js";
69
+ } from "./chunk-J3RFNKG4.js";
70
70
  import "./chunk-FTAISGDQ.js";
71
71
  import "./chunk-M2DPGFZ4.js";
72
72
  import "./chunk-BTWUYDGN.js";
73
- import "./chunk-KPBWFOPZ.js";
73
+ import "./chunk-2FTMENJL.js";
74
74
  import "./chunk-E4XIZDIB.js";
75
- import "./chunk-PMEKGDED.js";
75
+ import "./chunk-2TAQ2K4V.js";
76
76
  import "./chunk-MWRD5YOH.js";
77
77
  import "./chunk-T7L2QK3K.js";
78
78
  import "./chunk-DMSZHXZS.js";
@@ -9,13 +9,13 @@ import {
9
9
  KIRO_MARKER,
10
10
  ROOCODE_MARKER,
11
11
  ZED_MARKER
12
- } from "./chunk-GZTMRYCN.js";
12
+ } from "./chunk-643Z7FIC.js";
13
13
  import "./chunk-4FS4WRXP.js";
14
14
  import "./chunk-6RJA2F5A.js";
15
15
  import "./chunk-WOKWX5PL.js";
16
16
  import "./chunk-523HCFYO.js";
17
17
  import "./chunk-A4QJ6ENT.js";
18
- import "./chunk-PMEKGDED.js";
18
+ import "./chunk-2TAQ2K4V.js";
19
19
  import "./chunk-MWRD5YOH.js";
20
20
  import "./chunk-T7L2QK3K.js";
21
21
  import "./chunk-DMSZHXZS.js";
@@ -6,19 +6,21 @@ import {
6
6
  read_entries
7
7
  } from "./chunk-PKOBQADP.js";
8
8
  import {
9
- RECYCLE_CONSUMED_REL,
10
- RECYCLE_ENVELOPE_REL,
11
9
  RECYCLE_MAX_AGE_HOURS,
12
10
  collectRepoAnchor,
13
- describeDrift
14
- } from "./chunk-LPPWO5CE.js";
15
- import "./chunk-CYH5SP6M.js";
11
+ describeDrift,
12
+ env_session_id,
13
+ predecessorTracePresent,
14
+ recycle_consumed_rel,
15
+ resolveContinuityRecord
16
+ } from "./chunk-ZVBOHSVF.js";
17
+ import "./chunk-I6RHFQEG.js";
16
18
  import {
17
19
  hasBoundaryMarker,
18
20
  scanEnvelopeDirectives,
19
21
  validateRecycleEnvelope,
20
22
  wrapAsPriorSessionData
21
- } from "./chunk-7PRE6ZV2.js";
23
+ } from "./chunk-YS6XTLEK.js";
22
24
  import {
23
25
  readHookStdin
24
26
  } from "./chunk-F7DQWYR5.js";
@@ -27,8 +29,10 @@ import {
27
29
  _RAW_KEY_PREFIXES,
28
30
  hardenedSpawnEnv,
29
31
  projectStoreSlug
30
- } from "./chunk-KPBWFOPZ.js";
32
+ } from "./chunk-2FTMENJL.js";
31
33
  import "./chunk-E4XIZDIB.js";
34
+ import "./chunk-MWRD5YOH.js";
35
+ import "./chunk-T7L2QK3K.js";
32
36
  import "./chunk-OY53J6II.js";
33
37
  import "./chunk-NLP54U3J.js";
34
38
  import "./chunk-NDJLNC6Q.js";
@@ -264,8 +268,19 @@ function consume_handoff_context(root, now = /* @__PURE__ */ new Date()) {
264
268
  remove();
265
269
  return guardedInjection(block, `handoff consumed (session=${sourceSession})`);
266
270
  }
267
- function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
268
- const target = process2.env.AGENT_RECYCLE_ENVELOPE_FILE || path.join(root, RECYCLE_ENVELOPE_REL);
271
+ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date(), session_id = void 0) {
272
+ const sessionId = session_id === void 0 ? env_session_id() : session_id;
273
+ const override = process2.env.AGENT_RECYCLE_ENVELOPE_FILE;
274
+ let target;
275
+ if (override !== void 0 && override !== "") {
276
+ target = override;
277
+ } else {
278
+ const resolved = resolveContinuityRecord(root, sessionId);
279
+ if (resolved.file === null) {
280
+ return { action: "absent", reason: resolved.reason };
281
+ }
282
+ target = resolved.file;
283
+ }
269
284
  let text;
270
285
  try {
271
286
  text = fs.readFileSync(target, "utf-8");
@@ -274,7 +289,10 @@ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
274
289
  }
275
290
  const consume = () => {
276
291
  try {
277
- fs.renameSync(target, path.join(path.dirname(target), path.basename(RECYCLE_CONSUMED_REL)));
292
+ fs.renameSync(
293
+ target,
294
+ path.join(path.dirname(target), path.basename(recycle_consumed_rel(sessionId)))
295
+ );
278
296
  } catch {
279
297
  try {
280
298
  fs.unlinkSync(target);
@@ -314,12 +332,20 @@ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
314
332
  consume();
315
333
  return { action: "discard", reason: "recycle envelope workspace does not resolve" };
316
334
  }
335
+ const predecessor = String(envelope["predecessor"] ?? "").trim();
336
+ if (predecessor !== "" && !predecessorTracePresent(root, predecessor)) {
337
+ consume();
338
+ return {
339
+ action: "discard",
340
+ reason: `recycle envelope names predecessor "${predecessor}", which has no trace in this workspace`
341
+ };
342
+ }
317
343
  const drift = describeDrift(envelope, collectRepoAnchor(root));
318
344
  const warnings = scanEnvelopeDirectives(envelope);
319
345
  const focus = (process2.env.AGENT_RESUME_FOCUS ?? "").trim();
320
346
  const block = wrapAsPriorSessionData(JSON.stringify(envelope, null, 2), {
321
347
  kind: "recycle-envelope",
322
- source: RECYCLE_ENVELOPE_REL,
348
+ source: path.relative(root, target) || path.basename(target),
323
349
  warnings: [
324
350
  ...drift,
325
351
  ...focus ? [`FOCUS: attack "${focus}" first \u2014 the rest of this envelope is context.`] : [],
@@ -353,7 +379,11 @@ function main() {
353
379
  }
354
380
  if (event === "session_start") {
355
381
  const handoff = consume_handoff_context(root);
356
- const recycle = consume_recycle_envelope(root);
382
+ const recycle = consume_recycle_envelope(
383
+ root,
384
+ /* @__PURE__ */ new Date(),
385
+ String(envelope["session_id"] ?? "").trim() || env_session_id()
386
+ );
357
387
  const blocks = [];
358
388
  const reasons = [];
359
389
  if (recycle.action === "inject" && recycle.context) {
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
3
3
  import {
4
4
  memory_get_v1
5
- } from "./chunk-CYH5SP6M.js";
5
+ } from "./chunk-I6RHFQEG.js";
6
6
  import "./chunk-I3EIN2YG.js";
7
7
  import "./chunk-OY53J6II.js";
8
8
  import "./chunk-J55WI3RR.js";
@@ -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
  PROJECT_BRIDGE_MARKERS
4
- } from "./chunk-GZTMRYCN.js";
4
+ } from "./chunk-643Z7FIC.js";
5
5
  import "./chunk-4FS4WRXP.js";
6
6
  import "./chunk-6RJA2F5A.js";
7
7
  import "./chunk-WOKWX5PL.js";
@@ -10,7 +10,7 @@ import "./chunk-A4QJ6ENT.js";
10
10
  import {
11
11
  manifest_path,
12
12
  read_manifest
13
- } from "./chunk-PMEKGDED.js";
13
+ } from "./chunk-2TAQ2K4V.js";
14
14
  import "./chunk-MWRD5YOH.js";
15
15
  import "./chunk-T7L2QK3K.js";
16
16
  import "./chunk-DMSZHXZS.js";
@@ -3,7 +3,7 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
3
3
  import {
4
4
  read_entries
5
5
  } from "./chunk-PKOBQADP.js";
6
- import "./chunk-CYH5SP6M.js";
6
+ import "./chunk-I6RHFQEG.js";
7
7
  import "./chunk-F7DQWYR5.js";
8
8
  import "./chunk-I3EIN2YG.js";
9
9
  import {