@event4u/agent-config 14.22.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 (111) 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 +159 -380
  5. package/README.md +1 -1
  6. package/dist/agent-src/commands/pr/merge.md +47 -38
  7. package/dist/agent-src/commands/roadmap/next.md +8 -0
  8. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +12 -0
  9. package/dist/agent-src/rules/notes-first-reasoning.md +36 -25
  10. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +106 -4
  11. package/dist/agent-src/skills/code-intelligence/SKILL.md +57 -1
  12. package/dist/agent-src/skills/git-workflow/references/push-closes-its-loop.md +9 -0
  13. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +52 -2
  14. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  15. package/dist/cli/registry.js +1 -1
  16. package/dist/cli-delegate/archive_completed_roadmaps.js +52 -4
  17. package/dist/cli-delegate/{chunk-TGIPZBCW.js → chunk-2KKXJW25.js} +22 -8
  18. package/dist/cli-delegate/{chunk-4FS4WRXP.js → chunk-IAI3XL43.js} +15 -3
  19. package/dist/cli-delegate/{chunk-BIXEDQPZ.js → chunk-KCNTUSPI.js} +1 -1
  20. package/dist/cli-delegate/cmd_export.js +2 -2
  21. package/dist/cli-delegate/cmd_handoff.js +20 -12
  22. package/dist/cli-delegate/cmd_prune.js +2 -2
  23. package/dist/cli-delegate/cmd_session_recycle.js +3 -13
  24. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  25. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  26. package/dist/cli-delegate/cmd_sync.js +2 -2
  27. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  28. package/dist/cli-delegate/cmd_validate.js +2 -2
  29. package/dist/discovery/deprecation-report.md +1 -1
  30. package/dist/discovery/discovery-manifest.json +8 -8
  31. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  32. package/dist/discovery/discovery-manifest.summary.md +1 -1
  33. package/dist/discovery/dormancy-report.md +1 -1
  34. package/dist/discovery/orphan-report.md +1 -1
  35. package/dist/discovery/packs.json +2 -2
  36. package/dist/discovery/trust-report.md +1 -1
  37. package/dist/discovery/workspaces.json +2 -2
  38. package/dist/hooks/dispatch.js +880 -289
  39. package/dist/install/install.mjs +15 -3
  40. package/dist/mcp/registry-manifest.json +2 -2
  41. package/dist/mcp/server.json +2 -2
  42. package/dist/mcp/server.mjs +5458 -2453
  43. package/dist/scripts/_lib/lean_projection_mode.js +108 -0
  44. package/dist/scripts/_lib/router_match.js +243 -0
  45. package/dist/scripts/_lib/rule_injection.js +216 -0
  46. package/dist/scripts/condense.js +20 -20
  47. package/dist/scripts/project_thin_rules.js +139 -19
  48. package/dist/server/schemas/settings.js +16 -3
  49. package/docs/MIGRATION.md +56 -0
  50. package/docs/contracts/settings-classes.md +39 -7
  51. package/docs/guidelines/agent-infra/notes-horizon-mechanics.md +90 -0
  52. package/llms.txt +1 -1
  53. package/package.json +1 -1
  54. package/src/agent-src/scripts/archive_completed_roadmaps.ts +106 -4
  55. package/src/config/agent-settings.template.yml +47 -1
  56. package/src/config/continuity-surface.json +7 -0
  57. package/src/config/evaluator-budgets.json +4 -4
  58. package/src/config/gate-violation-baselines.json +2 -2
  59. package/src/config/hook-token-budget.json +7 -6
  60. package/src/config/packed-binary-manifest.json +1 -1
  61. package/src/config/routing-coverage-seed.json +9 -2
  62. package/src/scripts/_cli/cmd_session_recycle.ts +2 -25
  63. package/src/scripts/_cli/handoff_sessions.ts +14 -44
  64. package/src/scripts/_lib/continuity_slot.ts +295 -0
  65. package/src/scripts/_lib/continuity_writer.ts +253 -0
  66. package/src/scripts/_lib/hook_settings.ts +85 -0
  67. package/src/scripts/_lib/lean_projection_mode.ts +127 -0
  68. package/src/scripts/_lib/packed_binary_predicate.ts +37 -0
  69. package/src/scripts/_lib/recycle_envelope_paths.ts +109 -21
  70. package/src/scripts/_lib/regression_neighbourhood.ts +159 -22
  71. package/src/scripts/_lib/session_eol.ts +44 -0
  72. package/src/scripts/_lib/session_index_trust.ts +346 -0
  73. package/src/scripts/_lib/standing_bound_ratchet.ts +154 -0
  74. package/src/scripts/_lib/vendored_grammar_upstream.ts +280 -0
  75. package/src/scripts/audit_mcp_tools.ts +69 -25
  76. package/src/scripts/build_mcp_catalog.ts +24 -1
  77. package/src/scripts/check_host_tree_parity.ts +291 -0
  78. package/src/scripts/check_preamble_payload_budget.ts +136 -7
  79. package/src/scripts/check_rule_projection_integrity.ts +102 -2
  80. package/src/scripts/ci_settle.ts +205 -5
  81. package/src/scripts/code_graph/build.ts +79 -0
  82. package/src/scripts/code_graph/cli.ts +258 -7
  83. package/src/scripts/code_graph/detect.ts +38 -0
  84. package/src/scripts/code_graph/query.ts +25 -2
  85. package/src/scripts/code_graph/sqlite_store.ts +16 -1
  86. package/src/scripts/code_graph/types.ts +52 -3
  87. package/src/scripts/code_graph/validate.ts +3 -1
  88. package/src/scripts/code_graph/verbs.ts +590 -0
  89. package/src/scripts/condense.ts +20 -20
  90. package/src/scripts/handoff_context_hook.ts +39 -1
  91. package/src/scripts/hook_manifest.json +1 -1
  92. package/src/scripts/hook_manifest.yaml +24 -1
  93. package/src/scripts/hooks/block_speaking_inbox_dir.ts +182 -16
  94. package/src/scripts/hooks/code_graph_context_hook.ts +7 -18
  95. package/src/scripts/hooks/push_settle_hook.ts +3 -2
  96. package/src/scripts/hooks/rule_inject_hook.ts +107 -20
  97. package/src/scripts/hooks/session_eol_hook.ts +120 -2
  98. package/src/scripts/hot_context_hook.ts +62 -7
  99. package/src/scripts/lint_roadmap_blockers.ts +164 -1
  100. package/src/scripts/mcp_server/consumer_tool_catalog.json +152 -2
  101. package/src/scripts/mcp_server/graph_tools.ts +294 -0
  102. package/src/scripts/mcp_server/path_util.ts +31 -0
  103. package/src/scripts/mcp_server/tool_catalog_source.ts +7 -1
  104. package/src/scripts/mcp_server/tools.ts +3 -13
  105. package/src/scripts/model_rule_injection.ts +61 -4
  106. package/src/scripts/project_thin_rules.ts +149 -16
  107. package/src/scripts/report_standing_payload_by_host.ts +650 -0
  108. package/src/scripts/schemas/agent-settings.schema.json +7 -1
  109. package/src/scripts/session_memory_index.ts +81 -8
  110. package/src/server/schemas/settings.ts +23 -4
  111. package/src/vendor/grammars/README.md +27 -2
@@ -19,7 +19,7 @@
19
19
  * `.augment/` projections.
20
20
  *
21
21
  * NOTE (faithful literal): the thin-entry pointer keeps the verbatim
22
- * `Body: [`{rule_id}`](../../.agent-src.uncondensed/rules/{rule_id}.md)`
22
+ * `Body: [`{rule_id}`](../../dist/agent-src/rules/{rule_id}.md)`
23
23
  * Markdown link from the retired Python implementation. The same-basename `.py` twin
24
24
  * carries that literal, so the ADR-051 legacy-path guard exempts this `.ts`
25
25
  * file by twin-parity.
@@ -35,6 +35,11 @@ import * as path from 'node:path';
35
35
  import process from 'node:process';
36
36
  import { fileURLToPath, pathToFileURL } from 'node:url';
37
37
 
38
+ import {
39
+ pathOnlyRuleIds,
40
+ triggerlessRuleIds,
41
+ type Router,
42
+ } from './_lib/rule_injection.js';
38
43
  import * as token_count from './_lib/token_count.js';
39
44
 
40
45
  const _HERE = fileURLToPath(import.meta.url);
@@ -77,19 +82,87 @@ export function kernel_ids(): Set<string> {
77
82
  * visible instead of being absorbed into the pointer count
78
83
  * (road-to-trigger-delivered-rule-bodies 1.3).
79
84
  */
85
+ /**
86
+ * Rules whose ONLY triggers are path-shaped — reachable from `pre_tool_use`
87
+ * and from no other slot (road-to-delivery-for-every-host 3.2).
88
+ *
89
+ * They must never be thinned while the delivery concern is NOT bound on
90
+ * `pre_tool_use`, because a stub plus a slot nobody listens on is a rule that
91
+ * reaches the model at no scope at all. This is the same failure the
92
+ * `no_trigger_ids` exemption prevents, one step out: there the rule has nothing
93
+ * to match on, here it has nothing to match ON.
94
+ *
95
+ * Stated as a PROPERTY rather than a list of ids. If the concern is ever bound
96
+ * on `pre_tool_use` again, this exemption is what should be reconsidered — not
97
+ * three names someone has to remember.
98
+ *
99
+ * WHAT THIS EXEMPTION DOES **NOT** COVER — recorded 2026-09-08, R2 finding 1,
100
+ * because the silence read as coverage. The predicate is `every` trigger
101
+ * path-shaped. A rule with BOTH path and non-path triggers is therefore THINNED,
102
+ * and its path-shaped half then has no carrier at all: the stub carries no
103
+ * frontmatter (`condense.ts` writes it with `_writeText`, bypassing
104
+ * `_emit_claude_rule`'s host-native `paths:` key), `pre_tool_use` lost the
105
+ * binding under owner ruling E2, and `user_prompt_submit` never populates
106
+ * `openFiles`. Measured over the current `dist/router.json`: **18 such rules**,
107
+ * all non-kernel and all thinned — augment-edit-discipline, design-fidelity,
108
+ * doc-screenshot-hygiene, domain-adoption-policy,
109
+ * framework-neutrality-in-generic-skills, image-likeness-and-rights,
110
+ * laravel-translations, lethal-trifecta-guard, linked-projects-onboarding-gate,
111
+ * low-impact-corpus-privacy-floor, markdown-safe-codeblocks, onboarding-gate,
112
+ * persona-governance, php-coding, provider-lifecycle-discipline,
113
+ * roadmap-ci-steps-policy, roadmap-progress-sync, settings-ask-protocol.
114
+ *
115
+ * They do NOT reach the model at no scope: every non-path route
116
+ * (keyword / phrase / command) still delivers the body through the concern, and
117
+ * on `claude-code` they never had a separate host-native path route to lose —
118
+ * `_claude_paths_plan` emits no `paths:` for a mixed-trigger rule on purpose, so
119
+ * under `eager-all` they loaded UNCONDITIONALLY. What is lost is the difference
120
+ * between unconditional and prompt-triggered: a session that touches a matching
121
+ * file and says nothing that matches gets nothing.
122
+ *
123
+ * The labelled corpus cannot see this and the endpoint says so rather than
124
+ * implying otherwise — `model_rule_injection --endpoints` (b) now publishes the
125
+ * shipped `user_prompt_submit` reach beside the pre-registered reading, and
126
+ * every one of these 18 has at least one prompt-matching positive, so none
127
+ * appears in its "reachable only via a path trigger" column.
128
+ *
129
+ * WHY THIS IS NOT WIDENED TO `some` HERE. Measured: exempting all 18 moves the
130
+ * thin rule layer 23,592 -> 39,921 GPT tok (+16,329, +69 %), which is a budget
131
+ * move of a magnitude no agent may take, and it would erase most of the saving
132
+ * the flip is licensed on. Restoring a path route needs either that exemption
133
+ * under a re-anchored baseline or a `pre_tool_use` binding under a raised slot
134
+ * cap — both owner-reserved, so the closure is tracked rather than taken here.
135
+ * ADR-267's Consequences section names the receiver.
136
+ */
137
+ /**
138
+ * ONE spelling of the router-derived sets, shared with the injector (R2
139
+ * finding 11).
140
+ *
141
+ * `path_only_ids` and `no_trigger_ids` were each a second, hand-rolled
142
+ * implementation of `_lib/rule_injection.ts::pathOnlyRuleIds` /
143
+ * `triggerlessRuleIds` — verified identical over the current router at the time
144
+ * (symmetric difference empty), so drift risk rather than a live defect. It is
145
+ * exactly the hazard `THIN_ENTRY_MARKER`'s own comment argues against one
146
+ * screen below ("a gate that re-spelled this string would drift from the writer
147
+ * silently"), and the two consumers here are the PROJECTOR's exemption set and
148
+ * the INJECTOR's reachability set: they must not be able to disagree about which
149
+ * rules the delivery path can reach.
150
+ *
151
+ * The finding named `path_only_ids`. The defect-pattern sweep found the SECOND
152
+ * instance one function down — `no_trigger_ids` against `triggerlessRuleIds` —
153
+ * and it is delegated in the same change. Count: 2 of 2 duplicated
154
+ * router-derived sets in this file, 0 remaining.
155
+ */
156
+ function _router(): Router {
157
+ return JSON.parse(fs.readFileSync(ROUTER, 'utf-8')) as Router;
158
+ }
159
+
160
+ export function path_only_ids(): Set<string> {
161
+ return pathOnlyRuleIds(_router());
162
+ }
163
+
80
164
  export function no_trigger_ids(): Set<string> {
81
- const data = JSON.parse(fs.readFileSync(ROUTER, 'utf-8')) as Record<string, unknown>;
82
- const out = new Set<string>();
83
- for (const tier of ['tier_1', 'tier_2']) {
84
- const entries = data[tier];
85
- if (!Array.isArray(entries)) continue;
86
- for (const e of entries) {
87
- const obj = e as Record<string, unknown>;
88
- const t = obj.triggers;
89
- if (!Array.isArray(t) || t.length === 0) out.add(String(obj.id));
90
- }
91
- }
92
- return out;
165
+ return new Set(triggerlessRuleIds(_router()));
93
166
  }
94
167
 
95
168
  /**
@@ -196,6 +269,45 @@ function _title(s: string): string {
196
269
  return s.replace(/[A-Za-z]+/g, (w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase());
197
270
  }
198
271
 
272
+ /**
273
+ * The marker that makes a projected entry recognisable as a stub.
274
+ *
275
+ * Exported so the WRITER and every DETECTOR share one definition. A gate that
276
+ * re-spelled this string would drift from the writer silently, and the failure
277
+ * would be invisible in exactly the direction that matters: a stub the gate
278
+ * fails to recognise reads as a complete rule body.
279
+ */
280
+ export const THIN_ENTRY_MARKER = '> Routed rule — load the body on trigger-match.';
281
+
282
+ /** Is this projected entry a pointer stub rather than a rule body? */
283
+ export function is_thin_entry(text: string): boolean {
284
+ return text.includes(THIN_ENTRY_MARKER);
285
+ }
286
+
287
+ /**
288
+ * Where a stub tells a reader the body actually is.
289
+ *
290
+ * FIXED 2026-09-07: this pointed into the uncondensed source tree ADR-051
291
+ * retired — the literal path is deliberately NOT reproduced here, because
292
+ * `check_no_uncondensed_refs` matches the string and cannot tell a repair
293
+ * record from a live reference; `git log -S` on this file finds the old value.
294
+ * It exists in no checkout, so EVERY stub's fallback pointer
295
+ * resolved to nothing — invisible under `delivery`, where the hook loads the
296
+ * body from `dist/agent-src/rules` and never follows this link, and total under
297
+ * `thin`, where the pointer is the only path to the body there is.
298
+ *
299
+ * KNOWN LIMIT, stated rather than discovered later: one relative prefix cannot
300
+ * be right for every tree, because they sit at different depths — `.claude/rules`
301
+ * and `.cursor/rules` are two levels below the repo root and `.clinerules` is
302
+ * one. `../../` is correct for the first two, which are the only trees the
303
+ * shipped `lean_projection.hosts` default can thin. A stub in `.clinerules`
304
+ * needs an operator to have added `cline` to that list, and its pointer is off
305
+ * by one level. That is strictly better than the previous state, where the
306
+ * pointer was dead in all three, and it is recorded here so the remaining case
307
+ * is a known limit rather than a surprise.
308
+ */
309
+ const BODY_LINK_PREFIX = '../../dist/agent-src/rules/';
310
+
199
311
  /** Build the minimal progressive-disclosure pointer for a non-kernel rule. */
200
312
  export function thin_entry(rule_id: string, text: string): string {
201
313
  const [fm] = split_frontmatter(text);
@@ -205,8 +317,8 @@ export function thin_entry(rule_id: string, text: string): string {
205
317
  const fires = hint ? ` Fires on: ${hint}.` : '';
206
318
  return (
207
319
  `## ${title}\n` +
208
- `> Routed rule — load the body on trigger-match.${fires} ${desc} ` +
209
- `Body: [\`${rule_id}\`](../../.agent-src.uncondensed/rules/${rule_id}.md)\n`
320
+ `${THIN_ENTRY_MARKER}${fires} ${desc} ` +
321
+ `Body: [\`${rule_id}\`](${BODY_LINK_PREFIX}${rule_id}.md)\n`
210
322
  );
211
323
  }
212
324
 
@@ -214,9 +326,21 @@ export function thin_entry(rule_id: string, text: string): string {
214
326
  export function build_thin(
215
327
  rules_dir: string = RULES_SOURCE,
216
328
  scope: readonly string[] | null = null,
329
+ /**
330
+ * Optional sink for the D3 diagnostic
331
+ * (road-to-delivery-for-every-host 2.2).
332
+ *
333
+ * An `auto` rule the router gives NO trigger is already kept full-bodied by
334
+ * `noTrigger` below, which is the substantive protection and predates this
335
+ * roadmap. What did not exist is any way to SEE it happen: the rule is
336
+ * silently exempted, so an author who removes a rule's last trigger gets a
337
+ * silently eager rule and no signal. The line makes the exemption audible.
338
+ */
339
+ announce: ((message: string) => void) | null = null,
217
340
  ): Map<string, string> {
218
341
  const kernel = kernel_ids();
219
342
  const noTrigger = no_trigger_ids();
343
+ const pathOnly = path_only_ids();
220
344
  const wsMap = scope !== null ? rule_workspaces_map() : new Map<string, string[]>();
221
345
  const out = new Map<string, string>();
222
346
  for (const p of _globSortedMd(rules_dir)) {
@@ -225,7 +349,16 @@ export function build_thin(
225
349
  if (!id_in_scope(stem, scope, kernel, wsMap, fm_workspaces(text))) {
226
350
  continue; // out of workspace scope — no body, no pointer line
227
351
  }
228
- const full = kernel.has(stem) || noTrigger.has(stem);
352
+ const full = kernel.has(stem) || noTrigger.has(stem) || pathOnly.has(stem);
353
+ if (announce !== null && noTrigger.has(stem) && !kernel.has(stem)) {
354
+ announce(`D3: trigger-less auto rule ${path.basename(p)} — kept full-bodied, never thinned`);
355
+ }
356
+ if (announce !== null && pathOnly.has(stem) && !kernel.has(stem) && !noTrigger.has(stem)) {
357
+ announce(
358
+ `E2: path-only auto rule ${path.basename(p)} — kept full-bodied; its only triggers ` +
359
+ `are path-shaped and the delivery concern is not bound on pre_tool_use`,
360
+ );
361
+ }
229
362
  out.set(path.basename(p), full ? text : thin_entry(stem, text));
230
363
  }
231
364
  return out;