@event4u/agent-config 14.21.0 → 14.23.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 (235) 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 +164 -187
  5. package/CREDITS.md +37 -0
  6. package/README.md +1 -1
  7. package/dist/agent-src/commands/analyze/inbox.md +380 -5
  8. package/dist/agent-src/commands/analyze/repo.md +4 -2
  9. package/dist/agent-src/commands/pr/merge.md +47 -38
  10. package/dist/agent-src/commands/roadmap/next.md +8 -0
  11. package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +69 -0
  12. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +5 -5
  13. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +12 -0
  14. package/dist/agent-src/rules/external-code-graph-interop.md +19 -14
  15. package/dist/agent-src/rules/notes-first-reasoning.md +36 -25
  16. package/dist/agent-src/rules/token-efficiency.md +26 -3
  17. package/dist/agent-src/scripts/_cli_entry.ts +51 -0
  18. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +120 -27
  19. package/dist/agent-src/scripts/roadmap_gates.ts +4 -20
  20. package/dist/agent-src/scripts/roadmap_set_step.ts +5 -2
  21. package/dist/agent-src/scripts/stubs_due.ts +4 -18
  22. package/dist/agent-src/scripts/update_roadmap_progress.ts +7 -24
  23. package/dist/agent-src/skills/code-intelligence/SKILL.md +82 -1
  24. package/dist/agent-src/skills/git-workflow/references/push-closes-its-loop.md +9 -0
  25. package/dist/agent-src/skills/roadmap-writing/SKILL.md +17 -0
  26. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +52 -2
  27. package/dist/agent-src/templates/agent-settings.md +0 -1
  28. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  29. package/dist/cli/registry.js +1 -1
  30. package/dist/cli-delegate/_cli_entry.js +8 -0
  31. package/dist/cli-delegate/_lib/pin_resolver.js +170 -0
  32. package/dist/cli-delegate/archival_sweep.js +8 -0
  33. package/dist/cli-delegate/archive_completed_roadmaps.js +542 -0
  34. package/dist/cli-delegate/check_update_banner.js +923 -0
  35. package/dist/cli-delegate/{chunk-ZVBOHSVF.js → chunk-2KKXJW25.js} +23 -9
  36. package/dist/cli-delegate/chunk-5EK5WQN6.js +28 -0
  37. package/dist/cli-delegate/chunk-7XGD2OEU.js +96 -0
  38. package/dist/cli-delegate/chunk-DBH4AHDK.js +155 -0
  39. package/dist/cli-delegate/{chunk-4FS4WRXP.js → chunk-IAI3XL43.js} +15 -3
  40. package/dist/cli-delegate/chunk-JO25G5H7.js +20 -0
  41. package/dist/cli-delegate/{chunk-643Z7FIC.js → chunk-KCNTUSPI.js} +7 -1
  42. package/dist/cli-delegate/chunk-LTYVIY76.js +7961 -0
  43. package/dist/cli-delegate/chunk-QAJS5YWY.js +999 -0
  44. package/dist/cli-delegate/{chunk-YS6XTLEK.js → chunk-TYSY33MD.js} +56 -6
  45. package/dist/cli-delegate/chunk-ULET4BYS.js +328 -0
  46. package/dist/cli-delegate/chunk-YDQSHTD7.js +187 -0
  47. package/dist/cli-delegate/chunk-YWVXLR44.js +48 -0
  48. package/dist/cli-delegate/chunk-ZZQBUHFK.js +273 -0
  49. package/dist/cli-delegate/cmd_conformance.js +2 -2
  50. package/dist/cli-delegate/cmd_export.js +2 -2
  51. package/dist/cli-delegate/cmd_handoff.js +45 -13
  52. package/dist/cli-delegate/cmd_prune.js +2 -2
  53. package/dist/cli-delegate/cmd_session_recycle.js +4 -14
  54. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  55. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  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/cli-delegate/dashboard_mode.js +16 -0
  60. package/dist/cli-delegate/gate_budget.js +24 -0
  61. package/dist/cli-delegate/gate_execute.js +25 -0
  62. package/dist/cli-delegate/guarded_baseline.js +18 -0
  63. package/dist/cli-delegate/resume_probe.js +22 -0
  64. package/dist/cli-delegate/roadmap_gates.js +638 -0
  65. package/dist/cli-delegate/roadmap_set_step.js +173 -0
  66. package/dist/cli-delegate/stub_queue.js +47 -0
  67. package/dist/cli-delegate/stubs_due.js +38 -0
  68. package/dist/cli-delegate/ticket_bundles.js +59 -0
  69. package/dist/cli-delegate/update_roadmap_progress.js +60 -0
  70. package/dist/discovery/deprecation-report.md +1 -1
  71. package/dist/discovery/discovery-manifest.json +13 -13
  72. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  73. package/dist/discovery/discovery-manifest.summary.md +1 -1
  74. package/dist/discovery/dormancy-report.md +1 -1
  75. package/dist/discovery/orphan-report.md +1 -1
  76. package/dist/discovery/packs.json +2 -2
  77. package/dist/discovery/trust-report.md +1 -1
  78. package/dist/discovery/workspaces.json +2 -2
  79. package/dist/hooks/dispatch.js +1813 -946
  80. package/dist/install/claudeLayerCarriage.js +237 -0
  81. package/dist/install/claudePathsPlan.js +79 -0
  82. package/dist/install/hostLayerFingerprint.js +1 -1
  83. package/dist/install/install.mjs +21 -3
  84. package/dist/install/partitionEligibility.js +231 -117
  85. package/dist/install/ruleLayerPartition.js +10 -7
  86. package/dist/mcp/registry-manifest.json +2 -2
  87. package/dist/mcp/server.json +2 -2
  88. package/dist/mcp/server.mjs +10870 -7641
  89. package/dist/scripts/_lib/lean_projection_mode.js +108 -0
  90. package/dist/scripts/_lib/router_match.js +243 -0
  91. package/dist/scripts/_lib/rule_injection.js +216 -0
  92. package/dist/scripts/condense.js +52 -45
  93. package/dist/scripts/project_thin_rules.js +139 -19
  94. package/dist/server/schemas/settings.js +16 -3
  95. package/docs/MIGRATION.md +105 -1
  96. package/docs/contracts/settings-classes.md +40 -8
  97. package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +73 -0
  98. package/docs/guidelines/agent-infra/notes-horizon-mechanics.md +90 -0
  99. package/llms.txt +1 -1
  100. package/package.json +7 -4
  101. package/src/agent-src/scripts/_cli_entry.ts +51 -0
  102. package/src/agent-src/scripts/archive_completed_roadmaps.ts +120 -27
  103. package/src/agent-src/scripts/roadmap_gates.ts +4 -20
  104. package/src/agent-src/scripts/roadmap_set_step.ts +5 -2
  105. package/src/agent-src/scripts/stubs_due.ts +4 -18
  106. package/src/agent-src/scripts/update_roadmap_progress.ts +7 -24
  107. package/src/config/agent-settings.template.yml +47 -1
  108. package/src/config/continuity-surface.json +516 -0
  109. package/src/config/estate-count-budget.json +1 -1
  110. package/src/config/evaluator-budgets.json +4 -4
  111. package/src/config/gate-coverage.yml +29 -8
  112. package/src/config/gate-violation-baselines.json +8 -8
  113. package/src/config/gitignore-block.txt +19 -0
  114. package/src/config/hook-token-budget.json +7 -6
  115. package/src/config/host-injection-effect.json +73 -0
  116. package/src/config/packed-binary-manifest.json +33 -0
  117. package/src/config/preamble-payload-budget.json +112 -105
  118. package/src/config/publish-surface.json +4 -2
  119. package/src/config/routing-coverage-seed.json +9 -2
  120. package/src/install/claudeLayerCarriage.ts +273 -0
  121. package/src/install/claudePathsPlan.ts +76 -0
  122. package/src/install/hostLayerFingerprint.ts +1 -1
  123. package/src/install/partitionEligibility.ts +261 -127
  124. package/src/install/ruleLayerPartition.ts +19 -23
  125. package/src/scripts/_cli/cmd_session_recycle.ts +2 -25
  126. package/src/scripts/_cli/handoff_sessions.ts +14 -44
  127. package/src/scripts/_dispatch.bash +77 -27
  128. package/src/scripts/_lib/auto_dispatch.ts +2 -2
  129. package/src/scripts/_lib/catalogue_layer_parity.ts +146 -0
  130. package/src/scripts/_lib/continuity_slot.ts +295 -0
  131. package/src/scripts/_lib/continuity_surface.ts +296 -0
  132. package/src/scripts/_lib/continuity_writer.ts +253 -0
  133. package/src/scripts/_lib/corpus_manifest.ts +26 -9
  134. package/src/scripts/_lib/hook_settings.ts +86 -1
  135. package/src/scripts/_lib/injection_effect.ts +151 -0
  136. package/src/scripts/_lib/layer_overlap_notice.ts +50 -6
  137. package/src/scripts/_lib/lean_projection_mode.ts +127 -0
  138. package/src/scripts/_lib/packed_binary_predicate.ts +262 -0
  139. package/src/scripts/_lib/pin_resolver.ts +13 -0
  140. package/src/scripts/_lib/recycle_envelope_paths.ts +109 -21
  141. package/src/scripts/_lib/regression_neighbourhood.ts +159 -22
  142. package/src/scripts/_lib/retired_status.ts +74 -0
  143. package/src/scripts/_lib/session_eol.ts +44 -0
  144. package/src/scripts/_lib/session_index_trust.ts +346 -0
  145. package/src/scripts/_lib/skill_catalogue.ts +156 -21
  146. package/src/scripts/_lib/standing_bound_ratchet.ts +154 -0
  147. package/src/scripts/_lib/subagent_capsule.ts +117 -8
  148. package/src/scripts/_lib/vendored_grammar_upstream.ts +280 -0
  149. package/src/scripts/ai_council/api_transport.ts +5 -0
  150. package/src/scripts/ai_council/deliberation_metrics.ts +353 -0
  151. package/src/scripts/ai_council/prompts.ts +9 -0
  152. package/src/scripts/ai_council/synthesis_disagreement.ts +206 -0
  153. package/src/scripts/audit_mcp_tools.ts +69 -25
  154. package/src/scripts/build_mcp_catalog.ts +24 -1
  155. package/src/scripts/capture_skill_catalogue.ts +24 -11
  156. package/src/scripts/check_candidate_lines.ts +499 -0
  157. package/src/scripts/check_continuity_surface.ts +475 -0
  158. package/src/scripts/check_dependency_floors.ts +13 -6
  159. package/src/scripts/check_estate_count.ts +40 -79
  160. package/src/scripts/check_host_tree_parity.ts +291 -0
  161. package/src/scripts/check_pack_size.ts +262 -23
  162. package/src/scripts/check_preamble_payload_budget.ts +136 -7
  163. package/src/scripts/check_roadmap_trackable.ts +19 -16
  164. package/src/scripts/check_rule_layer_partition.ts +54 -34
  165. package/src/scripts/check_rule_projection_integrity.ts +102 -2
  166. package/src/scripts/check_single_delivery.ts +97 -31
  167. package/src/scripts/check_update_banner.ts +13 -0
  168. package/src/scripts/ci_settle.ts +205 -5
  169. package/src/scripts/code_graph/build.ts +217 -15
  170. package/src/scripts/code_graph/cli.ts +334 -15
  171. package/src/scripts/code_graph/detect.ts +38 -0
  172. package/src/scripts/code_graph/extract.ts +11 -0
  173. package/src/scripts/code_graph/grammar_probe.ts +43 -0
  174. package/src/scripts/code_graph/loader.ts +88 -14
  175. package/src/scripts/code_graph/query.ts +144 -11
  176. package/src/scripts/code_graph/resolution_tiers.ts +238 -0
  177. package/src/scripts/code_graph/sqlite_store.ts +262 -6
  178. package/src/scripts/code_graph/types.ts +117 -3
  179. package/src/scripts/code_graph/validate.ts +26 -1
  180. package/src/scripts/code_graph/verbs.ts +590 -0
  181. package/src/scripts/condense.ts +54 -42
  182. package/src/scripts/corpus_manifest.ts +5 -5
  183. package/src/scripts/council_cli.ts +11 -12
  184. package/src/scripts/count_intent_disagreement.ts +426 -0
  185. package/src/scripts/handoff_context_hook.ts +118 -1
  186. package/src/scripts/hook_effect_doctor.ts +82 -1
  187. package/src/scripts/hook_manifest.json +1 -1
  188. package/src/scripts/hook_manifest.yaml +87 -12
  189. package/src/scripts/hooks/block_speaking_inbox_dir.ts +182 -16
  190. package/src/scripts/hooks/chain_nudge_hook.ts +282 -0
  191. package/src/scripts/hooks/code_graph_context_hook.ts +201 -0
  192. package/src/scripts/hooks/concern_registry.ts +4 -2
  193. package/src/scripts/hooks/host_semantics.ts +1 -1
  194. package/src/scripts/hooks/orchestration_record_hook.ts +2 -2
  195. package/src/scripts/hooks/push_settle_hook.ts +3 -2
  196. package/src/scripts/hooks/rule_inject_hook.ts +108 -21
  197. package/src/scripts/hooks/session_eol_hook.ts +120 -2
  198. package/src/scripts/hooks/skill_route_hook.ts +11 -4
  199. package/src/scripts/hot_context_hook.ts +62 -7
  200. package/src/scripts/inbox_source_census.ts +322 -0
  201. package/src/scripts/install-hooks.sh +82 -0
  202. package/src/scripts/{lint_carrier_integrity.ts → lint_deferral_integrity.ts} +60 -214
  203. package/src/scripts/lint_plan_risk_register.ts +13 -17
  204. package/src/scripts/lint_roadmap_blockers.ts +164 -1
  205. package/src/scripts/mcp_server/consumer_tool_catalog.json +152 -2
  206. package/src/scripts/mcp_server/graph_tools.ts +294 -0
  207. package/src/scripts/mcp_server/path_util.ts +31 -0
  208. package/src/scripts/mcp_server/suggest_skill.ts +72 -0
  209. package/src/scripts/mcp_server/tool_catalog_source.ts +7 -1
  210. package/src/scripts/mcp_server/tools.ts +5 -69
  211. package/src/scripts/media/lib/adapter-contract.md +7 -2
  212. package/src/scripts/media/lib/fixtures/flux/asset-0001.png +0 -0
  213. package/src/scripts/media/lib/fixtures/gemini-image/asset-0001.png +0 -0
  214. package/src/scripts/media/lib/fixtures/ideogram/asset-0001.png +0 -0
  215. package/src/scripts/model_rule_injection.ts +61 -4
  216. package/src/scripts/project_thin_rules.ts +149 -16
  217. package/src/scripts/rdp_candidates_delta.ts +276 -0
  218. package/src/scripts/rdp_quality_eval.ts +217 -19
  219. package/src/scripts/release_mix_taxonomy.json +3 -2
  220. package/src/scripts/report_host_injection_effect.ts +189 -0
  221. package/src/scripts/report_layer_overlap.ts +41 -0
  222. package/src/scripts/report_skill_menu_census.ts +341 -0
  223. package/src/scripts/report_standing_payload_by_host.ts +650 -0
  224. package/src/scripts/schemas/agent-settings.schema.json +7 -1
  225. package/src/scripts/session_memory_index.ts +81 -8
  226. package/src/scripts/skill_tools/score_skill_relevance.ts +70 -6
  227. package/src/scripts/skill_tools/suggest_skill_for_task.ts +37 -3
  228. package/src/server/schemas/settings.ts +23 -4
  229. package/src/vendor/grammars/README.md +86 -0
  230. package/src/vendor/grammars/tree-sitter-javascript.wasm +0 -0
  231. package/src/vendor/grammars/tree-sitter-php.wasm +0 -0
  232. package/src/vendor/grammars/tree-sitter-typescript.wasm +0 -0
  233. package/src/scripts/_lib/carrier_status.ts +0 -118
  234. package/src/scripts/_lib/estate_carrier_cases.ts +0 -72
  235. package/src/scripts/hooks/code_graph_nudge_hook.ts +0 -191
@@ -48,7 +48,8 @@ import {
48
48
  // bundled-CLI-entry-guard landmine. Verified before wiring, not assumed.
49
49
  import { build_thin } from './project_thin_rules.js';
50
50
  import { build_claude_hook_matrix } from './_lib/claude_settings_hooks.js';
51
- import { normalizeLeanProjectionMode, writesThinFiles, type LeanProjectionMode } from './_lib/lean_projection_mode.js';
51
+ import { describeDroppedHosts, normalizeLeanProjectionMode, resolveLeanProjectionHosts, thinsHost,
52
+ writesThinFiles, type LeanProjectionHosts, type LeanProjectionMode } from './_lib/lean_projection_mode.js';
52
53
  import { is_claude_builtin_name } from './_lib/claude_builtin_names.js';
53
54
  import { project_settings_path, load_agent_settings } from './_lib/agent_settings.js';
54
55
  import { rule_is_compile_enabled } from './_lib/compile_time_toggles.js';
@@ -265,9 +266,9 @@ export {
265
266
  } from '../install/claudePathsPlan.js';
266
267
  import { rule_in_scope } from '../install/ruleInScope.js';
267
268
  import { pruneEmptyDirs } from './_lib/prune_empty_dirs.js';
268
- import { commandsWithheld, partitionActive, personaPartition, setPartitionAnnounce } from '../install/partitionEligibility.js'; // ADR-236
269
+ import { claudeLayerHolds, commandWithheld, keepInProjectLayer, personaPartition } from '../install/partitionEligibility.js'; // ADR-236
269
270
  import { dedupableRules, partitionRulesForDir } from '../install/ruleLayerPartition.js'; // ADR-236, per-host evidence
270
- import { _claude_paths_plan, derive_trigger_globs } from '../install/claudePathsPlan.js';
271
+ import { _claude_paths_plan, applies_when, derive_trigger_globs } from '../install/claudePathsPlan.js';
271
272
 
272
273
  const _HERE = path.dirname(fileURLToPath(import.meta.url)); // <repo>/src/scripts
273
274
  const _DEFAULT_PROJECT_ROOT = path.resolve(_HERE, '..', '..');
@@ -320,7 +321,6 @@ function _deriveState(root: string): ModuleState {
320
321
  }
321
322
 
322
323
  export const MODULE_STATE: ModuleState = _deriveState(_DEFAULT_PROJECT_ROOT);
323
- setPartitionAnnounce(success); // ADR-236: the mode line must be visible at the default level
324
324
 
325
325
  /**
326
326
  * Test seam — reassign one or more module-state fields, mirroring the pytest
@@ -459,14 +459,17 @@ function _read_projection_scope_dedup(): boolean {
459
459
  }
460
460
 
461
461
 
462
- function _lean_projection_mode(): LeanProjectionMode {
462
+ function _lean_projection_settings(): { mode: LeanProjectionMode; hosts: LeanProjectionHosts } {
463
463
  const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
464
464
  const lean = data['lean_projection'];
465
- const raw =
465
+ const obj =
466
466
  typeof lean === 'object' && lean !== null && !Array.isArray(lean)
467
- ? (lean as Record<string, unknown>)['mode']
468
- : '';
469
- return normalizeLeanProjectionMode(raw);
467
+ ? (lean as Record<string, unknown>)
468
+ : {};
469
+ return {
470
+ mode: normalizeLeanProjectionMode(obj['mode'] ?? ''),
471
+ hosts: resolveLeanProjectionHosts(obj['hosts']),
472
+ };
470
473
  }
471
474
 
472
475
  // --- hashing -----------------------------------------------------------------
@@ -1120,21 +1123,17 @@ export function generate_rule_symlinks(): number {
1120
1123
  const rules = _scoped_rule_basenames();
1121
1124
  const tool_dirs = _filter_tool_dirs(TOOL_DIRS);
1122
1125
 
1126
+ const lean = _lean_projection_settings();
1127
+ for (const warning of describeDroppedHosts(lean.hosts)) _print(` ⚠️ ${warning}`);
1123
1128
  let thin_files: Record<string, string> | null = null;
1124
- if (writesThinFiles(_lean_projection_mode())) {
1125
- // DEAD-SWITCH REPAIR (road-to-renewal-foundation Phase 2). This branch
1126
- // used to THROW: the port was skipped as "out of scope, not exercised by
1127
- // golden parity", which left a documented, settings-selectable mode that
1128
- // could only ever crash. `build_thin` was ported and has been present the
1129
- // whole time — the wiring was the only thing missing.
1130
- //
1131
- // Scope note: this repairs the SWITCH only. The default stays
1132
- // `eager-all`. Flipping it is parked behind the thin-projection honest
1133
- // null (thin win-rate 36.2% < the 48% pre-registered threshold), and
1134
- // nothing here disturbs that verdict — but a mode that throws cannot
1135
- // even be re-measured, which is why the repair earns its place alone.
1129
+ if (writesThinFiles(lean.mode)) {
1130
+ // `thin` stays parked behind the thin-projection honest null (win-rate
1131
+ // 36.2% against a 48% pre-registered threshold, ADR-202). `delivery` is
1132
+ // NOT gated by that null and citing it as one is K7: delivery re-delivers
1133
+ // identical bytes, is licensed by `docs/CLAIMS.md:365` on delivery
1134
+ // equivalence and cost, and needs a recall floor rather than a judge.
1136
1135
  thin_files = Object.fromEntries(
1137
- build_thin(MODULE_STATE.RULES_SOURCE, _read_rule_workspaces()),
1136
+ build_thin(MODULE_STATE.RULES_SOURCE, _read_rule_workspaces(), (m) => _print(` ⚠️ ${m}`)),
1138
1137
  );
1139
1138
  }
1140
1139
 
@@ -1184,7 +1183,7 @@ export function generate_rule_symlinks(): number {
1184
1183
  if (_existsOrSymlink(link)) {
1185
1184
  fs.unlinkSync(link);
1186
1185
  }
1187
- if (thin_files !== null) {
1186
+ if (thin_files !== null && thinsHost(lean.mode, lean.hosts.hosts, _DIR_TOOL_ID[tool_dir] ?? '')) {
1188
1187
  _writeText(link, thin_files[rule] as string);
1189
1188
  } else if (tool_dir === '.claude/rules') {
1190
1189
  // Host-native activation (P3.1): emit the rule with the host's
@@ -1299,7 +1298,7 @@ export function _emit_cursor_mdc(source: string, target: string): void {
1299
1298
  const globs = always_apply ? [] : derive_trigger_globs(meta);
1300
1299
  const lines = [
1301
1300
  '---',
1302
- `description: ${_yaml_scalar(description)}`,
1301
+ `description: ${_yaml_scalar(always_apply ? description : applies_when(description, meta))}`,
1303
1302
  `globs: ${globs.join(',')}`,
1304
1303
  `alwaysApply: ${always_apply ? 'true' : 'false'}`,
1305
1304
  '---',
@@ -1321,7 +1320,7 @@ export function _emit_windsurf_rule(source: string, target: string): void {
1321
1320
  const lines = [
1322
1321
  '---',
1323
1322
  `trigger: ${trigger}`,
1324
- `description: ${_yaml_scalar(description)}`,
1323
+ `description: ${_yaml_scalar(always_apply ? description : applies_when(description, meta))}`,
1325
1324
  `globs: ${globs.join(',')}`,
1326
1325
  '---',
1327
1326
  '',
@@ -1628,23 +1627,22 @@ function _render_native_model_md(src_md: string, tier: string): string {
1628
1627
  }
1629
1628
 
1630
1629
  export function generate_claude_skills(active_skill_names: ReadonlySet<string> | null = null): number {
1631
- if (partitionActive(MODULE_STATE.PROJECT_ROOT)) active_skill_names = new Set<string>();
1632
1630
  if (!_exists(MODULE_STATE.SKILLS_SOURCE)) {
1633
1631
  process.stderr.write(' ⚠️ dist/agent-src/skills/ not found — skipping skills\n');
1634
1632
  return 0;
1635
1633
  }
1636
1634
 
1637
- let skills = _iterdirSorted(MODULE_STATE.SKILLS_SOURCE)
1635
+ const all_skills = _iterdirSorted(MODULE_STATE.SKILLS_SOURCE)
1638
1636
  .filter((p) => _isDir(p))
1639
1637
  .map((p) => path.basename(p))
1640
1638
  .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
1639
+ // ADR-236: withhold every skill `~/.claude/skills` holds — see `keepInProjectLayer`.
1640
+ let skills = keepInProjectLayer('skills', all_skills);
1641
1641
  if (active_skill_names !== null) {
1642
1642
  skills = skills.filter((s) => active_skill_names.has(s));
1643
1643
  }
1644
1644
  const skill_set = new Set(skills);
1645
- const command_slugs = partitionActive(MODULE_STATE.PROJECT_ROOT)
1646
- ? new Set<string>()
1647
- : new Set([...iterCommands()].map(([, slug]) => slug));
1645
+ const command_slugs = _emitted_wrapper_slugs(new Set(all_skills));
1648
1646
 
1649
1647
  _mkdirp(MODULE_STATE.CLAUDE_SKILLS_DIR);
1650
1648
  const auto = _read_model_auto_switch() === 'auto';
@@ -1737,6 +1735,22 @@ function _nested_command_subpath(source_file: string): string | null {
1737
1735
  return sub.includes('/') ? sub : null;
1738
1736
  }
1739
1737
 
1738
+ /** The emitter's four skips, in one place — see `emittedWrapperSlugs`. */
1739
+ const _wrapper_is_emitted = (f: string, s: string, skills: ReadonlySet<string>): boolean =>
1740
+ !skills.has(s) &&
1741
+ _nested_command_subpath(f) === null &&
1742
+ !is_claude_builtin_name(s) &&
1743
+ !claudeLayerHolds('skills', s);
1744
+
1745
+ /** Wrapper slugs the command emitter really writes — see `emittedWrapperSlugs`. */
1746
+ function _emitted_wrapper_slugs(skill_names: ReadonlySet<string>): Set<string> {
1747
+ return new Set(
1748
+ [...iterCommands()]
1749
+ .filter(([f, s]) => _wrapper_is_emitted(f, s, skill_names))
1750
+ .map(([, slug]) => slug),
1751
+ );
1752
+ }
1753
+
1740
1754
  /**
1741
1755
  * Project-scope `.claude/commands/<cluster>/<sub>.md` — the colon form.
1742
1756
  *
@@ -1749,7 +1763,7 @@ function _nested_command_subpath(source_file: string): string | null {
1749
1763
  *
1750
1764
  * Emitting the nested form here lets `generate_claude_commands` stop wrapping
1751
1765
  * the clustered commands: one listing, same reachability, and reachability no
1752
- * longer depends on a global deploy. Dedup AND precedence: `commandsWithheld`.
1766
+ * longer depends on a global deploy. Dedup AND precedence: `commandWithheld`.
1753
1767
  *
1754
1768
  * ADR-003 (colon canonical for clusters) and ADR-044 (flat commands stay
1755
1769
  * hyphenated) both hold: flat commands are untouched and keep their wrapper.
@@ -1757,8 +1771,6 @@ function _nested_command_subpath(source_file: string): string | null {
1757
1771
  export function generate_claude_project_commands(
1758
1772
  active_command_slugs: ReadonlySet<string> | null = null,
1759
1773
  ): number {
1760
- if (commandsWithheld(MODULE_STATE.PROJECT_ROOT)) active_command_slugs = new Set<string>();
1761
- // Returns before the stale sweep — invariant, see `commandsWithheld`.
1762
1774
  if (!_isDir(path.join(MODULE_STATE.PROJECT_ROOT, 'src', 'domains'))) {
1763
1775
  return 0;
1764
1776
  }
@@ -1768,7 +1780,7 @@ export function generate_claude_project_commands(
1768
1780
  continue;
1769
1781
  }
1770
1782
  const sub = _nested_command_subpath(source_file);
1771
- if (sub !== null) {
1783
+ if (sub !== null && !commandWithheld(`${sub}.md`)) {
1772
1784
  nested.push([source_file, sub]);
1773
1785
  }
1774
1786
  }
@@ -1805,7 +1817,6 @@ export function generate_claude_project_commands(
1805
1817
  }
1806
1818
 
1807
1819
  export function generate_claude_commands(active_command_slugs: ReadonlySet<string> | null = null): number {
1808
- if (partitionActive(MODULE_STATE.PROJECT_ROOT)) active_command_slugs = new Set<string>();
1809
1820
  if (!_isDir(path.join(MODULE_STATE.PROJECT_ROOT, 'src', 'domains'))) {
1810
1821
  process.stderr.write(' ⚠️ src/domains/ not found — skipping commands\n');
1811
1822
  return 0;
@@ -1826,6 +1837,7 @@ export function generate_claude_commands(active_command_slugs: ReadonlySet<strin
1826
1837
  let count = 0;
1827
1838
  let skipped = 0;
1828
1839
  let reserved = 0;
1840
+ let withheld = 0;
1829
1841
  let rendered = 0;
1830
1842
  const auto = _read_model_auto_switch() === 'auto';
1831
1843
  for (const [source_file, slug] of iterCommands()) {
@@ -1854,6 +1866,9 @@ export function generate_claude_commands(active_command_slugs: ReadonlySet<strin
1854
1866
  reserved += 1;
1855
1867
  continue;
1856
1868
  }
1869
+ // ADR-236 per-name: the INSTALLER re-projects visible flat commands as
1870
+ // `~/.claude/skills/<slug>/SKILL.md` (install.ts:_apply_claude_flat_command_wrappers).
1871
+ if (claudeLayerHolds('skills', slug)) { withheld += 1; continue; }
1857
1872
  current_slugs.add(slug);
1858
1873
 
1859
1874
  const skill_dir = path.join(MODULE_STATE.CLAUDE_SKILLS_DIR, slug);
@@ -1906,6 +1921,9 @@ export function generate_claude_commands(active_command_slugs: ReadonlySet<strin
1906
1921
  if (reserved) {
1907
1922
  msg += ` (${reserved} withheld — Claude Code built-in name)`;
1908
1923
  }
1924
+ if (withheld > 0) {
1925
+ msg += ` (${withheld} withheld — ~/.claude/skills carries the wrapper)`;
1926
+ }
1909
1927
  if (removed_dirs) {
1910
1928
  msg += ` (${removed_dirs} stale dirs removed)`;
1911
1929
  }
@@ -2244,19 +2262,13 @@ export function generate_persona_symlinks(): number {
2244
2262
  _print(' ⚠️ dist/agent-src/personas/ not found — skipping personas');
2245
2263
  return 0;
2246
2264
  }
2247
- const personas = _rglobSorted(MODULE_STATE.PERSONAS_SOURCE, '*.md')
2248
- .filter((p) => _isFile(p) && path.basename(p, '.md') !== 'README')
2249
- .map((p) => path.basename(p))
2250
- // glob('*.md') is non-recursive in Python; mirror that — only top level.
2251
- .filter((name) => _isFile(path.join(MODULE_STATE.PERSONAS_SOURCE, name)));
2252
2265
  // Python uses PERSONAS_SOURCE.glob("*.md") (non-recursive). Re-derive
2253
2266
  // from a direct listing to match exactly.
2254
2267
  const direct = _iterdirSorted(MODULE_STATE.PERSONAS_SOURCE)
2255
2268
  .filter((p) => p.endsWith('.md') && _isFile(p) && path.basename(p, '.md') !== 'README')
2256
2269
  .map((p) => path.basename(p))
2257
2270
  .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
2258
- void personas;
2259
- const partition = personaPartition(MODULE_STATE.PROJECT_ROOT, direct);
2271
+ const partition = personaPartition(direct);
2260
2272
  const tool_dirs = _filter_tool_dirs(PERSONA_TOOL_DIRS);
2261
2273
  let total = 0;
2262
2274
  for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
@@ -23,7 +23,7 @@ import * as path from 'node:path';
23
23
  import process from 'node:process';
24
24
  import { fileURLToPath } from 'node:url';
25
25
 
26
- import { partitionActive } from '../install/partitionEligibility.js';
26
+ import { resolveHostLayerVerdict } from '../install/partitionEligibility.js';
27
27
  import {
28
28
  type CorpusManifest,
29
29
  captureManifest,
@@ -126,9 +126,9 @@ export function parseArgs(argv: readonly string[]): Parsed | string {
126
126
  /**
127
127
  * One real capture over the real tree.
128
128
  *
129
- * This is the one caller for which the process globals `partitionActive` reads
130
- * — the host layer under the running user's home, and the install lockfile —
131
- * ARE this run's own host, so it is the one caller that passes the predicate.
129
+ * This is the one caller for which the process globals `resolveHostLayerVerdict`
130
+ * reads — the host layer under the running user's home, and the install lockfile
131
+ * — ARE this run's own host, so it is the one caller that passes the predicate.
132
132
  * Everywhere else the field stays `null` rather than recording some other
133
133
  * machine's state under this tree's name.
134
134
  */
@@ -138,7 +138,7 @@ function capture(limit: number): CorpusManifest {
138
138
  userHome: process.env['HOME'] ?? os.homedir(),
139
139
  limit,
140
140
  enumerationRule: ENUMERATION_RULE_ID,
141
- partitionActive,
141
+ hostLayerVerified: (root) => resolveHostLayerVerdict(root).verified,
142
142
  });
143
143
  }
144
144
 
@@ -93,6 +93,7 @@ import {
93
93
  _quorum_min_present_from,
94
94
  _quorum_setting_from,
95
95
  } from './ai_council/quorum_wiring.js';
96
+ import { measureDeliberation, runCallsFrom } from './ai_council/deliberation_metrics.js';
96
97
  import { formatQualificationLine, type MemberQualification } from './ai_council/qualification.js';
97
98
  import {
98
99
  absenceReasonFor,
@@ -2730,18 +2731,15 @@ function cmd_run(
2730
2731
  }
2731
2732
  const estimated_total = estimates.reduce((acc, e) => acc + _total_usd(e), 0.0);
2732
2733
  let actual_total = 0.0;
2733
- const all_responses: CouncilResponse[] = [...responses];
2734
- if (peer_review !== null) {
2735
- all_responses.push(...peer_review.responses);
2736
- }
2737
- if (consensus !== null) {
2738
- all_responses.push(...consensus.extraction_responses);
2739
- all_responses.push(...consensus.scoring_responses);
2740
- }
2741
- if (chairman !== null && chairman.response !== null) {
2742
- all_responses.push(chairman.response);
2743
- }
2744
- all_responses.push(...stance_repairs);
2734
+ const run_calls = runCallsFrom({
2735
+ deliberation: responses,
2736
+ peerReview: peer_review?.responses ?? null,
2737
+ consensusExtraction: consensus?.extraction_responses ?? null,
2738
+ consensusScoring: consensus?.scoring_responses ?? null,
2739
+ chairman: chairman?.response ?? null,
2740
+ stanceRepairs: stance_repairs,
2741
+ });
2742
+ const all_responses: CouncilResponse[] = run_calls.responses;
2745
2743
  // Billable-aware: a subscription-CLI seat spent nothing, so pricing it at
2746
2744
  // API rates and calling the figure "actual" is a false statement about
2747
2745
  // money. See pricing.ts § billable-aware aggregation.
@@ -2791,6 +2789,7 @@ function cmd_run(
2791
2789
  // one for a machine consumer), even when every field is `null`: the
2792
2790
  // work-order envelope for whatever executes on this verdict next.
2793
2791
  payload['handoff'] = handoff;
2792
+ payload['deliberation'] = measureDeliberation(run_calls.calls);
2794
2793
  const out_path = _validate_council_output_path(args.output as string, {
2795
2794
  kind: 'responses',
2796
2795
  subcommand: 'run',