@event4u/agent-config 9.24.0 → 9.26.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 (97) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +136 -0
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/analyze/conformance.md +182 -0
  5. package/dist/agent-src/commands/analyze/inbox.md +33 -2
  6. package/dist/agent-src/commands/review/changes.md +6 -5
  7. package/dist/agent-src/commands/roadmap/next.md +194 -0
  8. package/dist/agent-src/commands/roadmap.md +12 -4
  9. package/dist/agent-src/contexts/execution/subagent-routing.md +4 -1
  10. package/dist/agent-src/rules/decision-revisit-gate.md +2 -0
  11. package/dist/agent-src/rules/delegation-policy.md +3 -2
  12. package/dist/agent-src/rules/design-fidelity.md +17 -1
  13. package/dist/agent-src/rules/design-review-after-ui-write.md +116 -0
  14. package/dist/agent-src/rules/evaluator-independence.md +111 -0
  15. package/dist/agent-src/rules/session-canary.md +15 -1
  16. package/dist/agent-src/rules/settings-ask-protocol.md +176 -0
  17. package/dist/agent-src/rules/token-budget-discipline.md +6 -3
  18. package/dist/agent-src/rules/ui-audit-gate.md +3 -0
  19. package/dist/agent-src/rules/user-interaction.md +23 -0
  20. package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +1 -1
  21. package/dist/agent-src/skills/recursive-verification/SKILL.md +13 -0
  22. package/dist/agent-src/skills/rule-writing/SKILL.md +45 -0
  23. package/dist/agent-src/skills/skill-writing/SKILL.md +114 -0
  24. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  25. package/dist/cli/registry.js +1 -0
  26. package/dist/cli/registry.js.map +1 -1
  27. package/dist/cli-delegate/cmd_route_audit.js +4 -1
  28. package/dist/cli-delegate/cmd_route_explain.js +4 -1
  29. package/dist/discovery/deprecation-report.md +1 -1
  30. package/dist/discovery/discovery-manifest.json +146 -28
  31. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  32. package/dist/discovery/discovery-manifest.summary.md +5 -5
  33. package/dist/discovery/orphan-report.md +1 -1
  34. package/dist/discovery/packs.json +16 -11
  35. package/dist/discovery/trust-report.md +3 -3
  36. package/dist/discovery/workspaces.json +12 -7
  37. package/dist/hooks/dispatch.js +1501 -511
  38. package/dist/mcp/registry-manifest.json +3 -3
  39. package/dist/mcp/server.json +2 -2
  40. package/dist/router.json +1 -1
  41. package/dist/server/nicknameResolver.js +116 -0
  42. package/dist/server/nicknameResolver.js.map +1 -0
  43. package/dist/server/routes/ping.js +29 -11
  44. package/dist/server/routes/ping.js.map +1 -1
  45. package/dist/shared/interactiveContext.js +73 -0
  46. package/dist/shared/interactiveContext.js.map +1 -0
  47. package/dist/shared/nicknamePrefill.js +59 -0
  48. package/dist/shared/nicknamePrefill.js.map +1 -0
  49. package/dist/shared/settingsAsks.js +128 -0
  50. package/dist/shared/settingsAsks.js.map +1 -0
  51. package/dist/shared/settingsConsent.js +93 -0
  52. package/dist/shared/settingsConsent.js.map +1 -0
  53. package/package.json +1 -1
  54. package/src/config/agents-paths.yml +15 -0
  55. package/src/config/evaluator-budgets.json +68 -68
  56. package/src/config/gate-coverage.yml +131 -5
  57. package/src/config/gate-violation-baselines.json +11 -0
  58. package/src/scripts/_cli/cmd_route_audit.ts +4 -1
  59. package/src/scripts/_cli/cmd_route_explain.ts +9 -1
  60. package/src/scripts/_dispatch.bash +12 -0
  61. package/src/scripts/ai-video/stitch.sh +27 -9
  62. package/src/scripts/before_complete_hook.ts +146 -5
  63. package/src/scripts/bench_ab_v2_run.ts +272 -16
  64. package/src/scripts/bench_ab_v2_stats.ts +156 -3
  65. package/src/scripts/check_completion_review.ts +80 -3
  66. package/src/scripts/check_corpus_staleness.ts +692 -0
  67. package/src/scripts/check_depth_budget.ts +295 -0
  68. package/src/scripts/check_gate_coverage.ts +67 -0
  69. package/src/scripts/check_hook_bundle_freshness.ts +183 -0
  70. package/src/scripts/conformance_scan.ts +422 -0
  71. package/src/scripts/dispatch_r2_reviewer.ts +31 -2
  72. package/src/scripts/git_authorization_hook.ts +328 -0
  73. package/src/scripts/hook_manifest.yaml +69 -9
  74. package/src/scripts/hooks/block_no_verify.ts +3 -1
  75. package/src/scripts/hooks/block_unauthorized_git.ts +371 -0
  76. package/src/scripts/hooks/concern_registry.ts +8 -0
  77. package/src/scripts/hooks/design_slop_hook.ts +13 -1
  78. package/src/scripts/hooks/dispatch_hook.ts +97 -2
  79. package/src/scripts/hooks/evidence_independence.ts +368 -0
  80. package/src/scripts/language_mirror_hook.ts +456 -0
  81. package/src/scripts/lint_abstraction_thresholds.ts +41 -8
  82. package/src/scripts/lint_agents_layout.ts +2 -0
  83. package/src/scripts/lint_decision_impact.ts +246 -0
  84. package/src/scripts/lint_example_fences.ts +609 -0
  85. package/src/scripts/lint_hook_manifest.ts +29 -0
  86. package/src/scripts/lint_rule_interactions.ts +90 -0
  87. package/src/scripts/lint_rule_migration_ledger.ts +480 -0
  88. package/src/scripts/lint_skill_descriptions.ts +86 -2
  89. package/src/scripts/memory_learn_hook.ts +109 -6
  90. package/src/scripts/pr_url_reminder_hook.ts +17 -2
  91. package/src/scripts/release.ts +38 -1
  92. package/src/scripts/schemas/review-findings.schema.json +99 -0
  93. package/src/scripts/schemas/rule.schema.json +10 -0
  94. package/src/shared/interactiveContext.ts +98 -0
  95. package/src/shared/nicknamePrefill.ts +96 -0
  96. package/src/shared/settingsAsks.ts +176 -0
  97. package/src/shared/settingsConsent.ts +136 -0
@@ -79,6 +79,34 @@ export interface Marker {
79
79
  /** Branch-head sha at review time. Provenance only, NEVER compared. */
80
80
  diffSha: string;
81
81
  reviewer: string;
82
+ /**
83
+ * OPTIONAL — the implementing session, so `author ≠ reviewer` becomes
84
+ * checkable instead of merely stated.
85
+ *
86
+ * The contract already says `reviewer:` is "never the implementing session"
87
+ * (§ 2.1), but with no `author` field there was nothing to compare it to, so
88
+ * the sentence was a convention with no enforcement behind it. Optional on
89
+ * purpose: every committed artefact under `agents/evidence/reviews/` carries
90
+ * the four-field v1 shape and § 2.7 forbids editing round records in place,
91
+ * so a REQUIRED field would have been a migration event for the whole
92
+ * evidence corpus. Absent → nothing to check, exactly as before.
93
+ */
94
+ author?: string;
95
+ /**
96
+ * OPTIONAL — sha256 of the reviewer prompt the dispatcher built.
97
+ *
98
+ * Addresses the contract's own most dangerous residual (§ 5, "the prompt
99
+ * channel"): the dispatcher fixes the reviewer's *inputs* but not the
100
+ * *instructions* wrapped around them, so "a hash-verified artefact is not
101
+ * evidence of an unbiased review". Recording the prompt's hash makes the
102
+ * channel auditable — a steered prompt no longer leaves the artefact
103
+ * indistinguishable from an unsteered one.
104
+ *
105
+ * It does NOT close the residual, and this file does not claim it does: the
106
+ * hash is written by the same host that authors the prompt. What it buys is
107
+ * an attributable record instead of an absent one.
108
+ */
109
+ promptHash?: string;
82
110
  }
83
111
 
84
112
  export interface HonestNull {
@@ -288,20 +316,52 @@ export function isCodePath(p: string): boolean {
288
316
  return CODE_EXTENSIONS.has(base.slice(dot + 1));
289
317
  }
290
318
 
319
+ /**
320
+ * The header grammar, with two OPTIONAL trailing fields.
321
+ *
322
+ * Field order stays fixed and the four v1 fields stay required, so every
323
+ * committed artefact parses unchanged — the extension is additive, not a version
324
+ * bump. `reviewer`'s capture already excludes `|`, which is what lets a further
325
+ * `| author: …` follow it without being swallowed.
326
+ */
291
327
  const MARKER_RE =
292
- /^<!--\s*completion-review:\s*v1\s*\|\s*reviewed:\s*(\d{4}-\d{2}-\d{2})\s*\|\s*scope:\s*([0-9a-fA-F]{64})\s*\|\s*diff:\s*([0-9a-fA-F]{7,40})\s*\|\s*reviewer:\s*(\S(?:[^|>]*[^|>\s])?)\s*-->$/;
328
+ /^<!--\s*completion-review:\s*v1\s*\|\s*reviewed:\s*(\d{4}-\d{2}-\d{2})\s*\|\s*scope:\s*([0-9a-fA-F]{64})\s*\|\s*diff:\s*([0-9a-fA-F]{7,40})\s*\|\s*reviewer:\s*(\S(?:[^|>]*[^|>\s])?)(?:\s*\|\s*author:\s*(\S(?:[^|>]*[^|>\s])?))?(?:\s*\|\s*prompt_hash:\s*([0-9a-fA-F]{64}))?\s*-->$/;
293
329
 
294
330
  export function parseMarkerLine(line: string): Marker | null {
295
331
  const m = MARKER_RE.exec(line.trim());
296
332
  if (!m) {
297
333
  return null;
298
334
  }
299
- return {
335
+ const marker: Marker = {
300
336
  reviewed: m[1] as string,
301
337
  scope: (m[2] as string).toLowerCase(),
302
338
  diffSha: (m[3] as string).toLowerCase(),
303
339
  reviewer: (m[4] as string).trim(),
304
340
  };
341
+ if (m[5] !== undefined) {
342
+ marker.author = m[5].trim();
343
+ }
344
+ if (m[6] !== undefined) {
345
+ marker.promptHash = m[6].toLowerCase();
346
+ }
347
+ return marker;
348
+ }
349
+
350
+ /**
351
+ * `author ≠ reviewer` — the check the field exists to make possible.
352
+ *
353
+ * Comparison is case-insensitive and whitespace-trimmed, because the ids are
354
+ * free-form strings a human or a dispatcher types, and `claude/host` vs
355
+ * `Claude/Host` is the same session by any reading. Deliberately NOT normalised
356
+ * further (no stripping of suffixes, no fuzzy match): a gate that guesses two
357
+ * different ids are "really" the same principal would start failing legitimate
358
+ * reviews, which is the failure direction that gets a gate ignored.
359
+ */
360
+ export function authorIsReviewer(marker: Marker): boolean {
361
+ if (marker.author === undefined) {
362
+ return false;
363
+ }
364
+ return marker.author.trim().toLowerCase() === marker.reviewer.trim().toLowerCase();
305
365
  }
306
366
 
307
367
  const HONEST_NULL_RE = /^\*\*Honest-null:\*\* 0 findings, scope ([0-9a-fA-F]{64}), reviewed (\d{4}-\d{2}-\d{2})$/;
@@ -785,7 +845,24 @@ function evaluate(input: EvalInput): Violation[] {
785
845
  detail:
786
846
  'completion-review header marker malformed — expected ' +
787
847
  '`<!-- completion-review: v1 | reviewed: YYYY-MM-DD | scope: <64-hex scope hash> | ' +
788
- 'diff: <sha> | reviewer: <id> -->`',
848
+ 'diff: <sha> | reviewer: <id> -->`, optionally followed by ' +
849
+ '`| author: <id>` and `| prompt_hash: <64-hex>`',
850
+ });
851
+ }
852
+ // §2.1: `reviewer:` is "never the implementing session". With an
853
+ // `author:` present that sentence becomes checkable — a review the
854
+ // author performed on their own change is the self-review the whole
855
+ // two-gate design exists to prevent. Only fires when the field is
856
+ // there, so no committed v1 artefact is retroactively broken.
857
+ if (art.marker !== null && authorIsReviewer(art.marker)) {
858
+ violations.push({
859
+ kind: 'author-is-reviewer',
860
+ file,
861
+ detail:
862
+ `author: ${art.marker.author ?? ''} equals reviewer: ${art.marker.reviewer} — ` +
863
+ 'the contract requires a fresh reviewer context, never the implementing ' +
864
+ 'session (§ 2.1). Dispatch a reviewer, or drop the author field if it was ' +
865
+ 'filled in by mistake.',
789
866
  });
790
867
  }
791
868
  for (const detail of art.malformedLines) {