@bonesofspring/ai-rules 0.2.70 → 0.2.72

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 (249) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/bin/lib/engine-scripts.js +9 -0
  3. package/docs/OPENCODE.md +4 -2
  4. package/docs/TEAM-DB.md +10 -7
  5. package/package.json +1 -1
  6. package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +201 -0
  7. package/presets/_shared/ai-local/scripts/incidents.mjs +452 -0
  8. package/presets/_shared/ai-local/scripts/record-usage.mjs +163 -0
  9. package/presets/_shared/ai-local/scripts/team-db-api.mjs +4 -4
  10. package/presets/_shared/ai-local/scripts/team-db-project.mjs +2 -0
  11. package/presets/_shared/ai-local/scripts/verification.mjs +374 -0
  12. package/presets/_shared/core/agent-team/agent-task-metrics.md +61 -1
  13. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -4
  14. package/presets/_shared/core/agent-team/incident-registry.md +47 -0
  15. package/presets/_shared/core/architecture/feature-delivery-workflow.md +1 -1
  16. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +108 -1
  17. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +108 -1
  18. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  19. package/presets/claude/go/hooks/chain-team-phases.sh +108 -1
  20. package/presets/claude/go/rules/architecture/feature-delivery.md +1 -1
  21. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  22. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +108 -1
  23. package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +1 -1
  24. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  25. package/presets/claude/java/hooks/chain-team-phases.sh +108 -1
  26. package/presets/claude/java/rules/architecture/feature-delivery.md +1 -1
  27. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  28. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +108 -1
  29. package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +1 -1
  30. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  31. package/presets/claude/mol/hooks/chain-team-phases.sh +108 -1
  32. package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +1 -1
  33. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  34. package/presets/claude/next/agents/README.md +4 -3
  35. package/presets/claude/next/agents/api-contract-reviewer.md +1 -1
  36. package/presets/claude/next/agents/mockup-reviewer.md +1 -1
  37. package/presets/claude/next/agents/task-router.md +4 -4
  38. package/presets/claude/next/hooks/chain-team-phases.sh +108 -1
  39. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +2 -2
  40. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  41. package/presets/claude/nuxt/hooks/chain-team-phases.sh +108 -1
  42. package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +1 -1
  43. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  44. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  45. package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +1 -1
  46. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  47. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +108 -1
  48. package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +1 -1
  49. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  50. package/presets/claude/svelte/hooks/chain-team-phases.sh +108 -1
  51. package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +1 -1
  52. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  53. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +108 -1
  54. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  55. package/presets/cursor/go/hooks/chain-team-phases.sh +108 -1
  56. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  57. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +108 -1
  58. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  59. package/presets/cursor/java/hooks/chain-team-phases.sh +108 -1
  60. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  61. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +108 -1
  62. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  63. package/presets/cursor/mol/hooks/chain-team-phases.sh +108 -1
  64. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
  65. package/presets/cursor/next/agents/README.md +4 -3
  66. package/presets/cursor/next/agents/api-contract-reviewer.md +1 -1
  67. package/presets/cursor/next/agents/mockup-reviewer.md +1 -1
  68. package/presets/cursor/next/agents/task-router.md +4 -4
  69. package/presets/cursor/next/hooks/chain-team-phases.sh +108 -1
  70. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  71. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +1 -1
  72. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +108 -1
  73. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  74. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  75. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  76. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +108 -1
  77. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  78. package/presets/cursor/svelte/hooks/chain-team-phases.sh +108 -1
  79. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  80. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  81. package/presets/mavis/android-kotlin/agents/README.md +3 -3
  82. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +108 -1
  83. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -4
  84. package/presets/mavis/go/adapter-map.json +1 -1
  85. package/presets/mavis/go/agents/README.md +2 -2
  86. package/presets/mavis/go/hooks/chain-team-phases.sh +108 -1
  87. package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -4
  88. package/presets/mavis/go/rules/feature-delivery-workflow.md +1 -1
  89. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  90. package/presets/mavis/ios-swift/agents/README.md +3 -3
  91. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +108 -1
  92. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -4
  93. package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +1 -1
  94. package/presets/mavis/java/adapter-map.json +1 -1
  95. package/presets/mavis/java/agents/README.md +2 -2
  96. package/presets/mavis/java/hooks/chain-team-phases.sh +108 -1
  97. package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -4
  98. package/presets/mavis/java/rules/feature-delivery-workflow.md +1 -1
  99. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  100. package/presets/mavis/mcp-ts/agents/README.md +1 -1
  101. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +108 -1
  102. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -4
  103. package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +1 -1
  104. package/presets/mavis/mol/adapter-map.json +1 -1
  105. package/presets/mavis/mol/agents/README.md +3 -3
  106. package/presets/mavis/mol/hooks/chain-team-phases.sh +108 -1
  107. package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -4
  108. package/presets/mavis/mol/rules/feature-delivery-workflow.md +1 -1
  109. package/presets/mavis/next/adapter-map.json +1 -1
  110. package/presets/mavis/next/agents/README.md +3 -3
  111. package/presets/mavis/next/agents/task-router.md +4 -4
  112. package/presets/mavis/next/hooks/chain-team-phases.sh +108 -1
  113. package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -4
  114. package/presets/mavis/next/rules/feature-delivery-workflow.md +2 -2
  115. package/presets/mavis/nuxt/adapter-map.json +1 -1
  116. package/presets/mavis/nuxt/agents/README.md +3 -3
  117. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +108 -1
  118. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -4
  119. package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +1 -1
  120. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  121. package/presets/mavis/php-hexagonal/agents/README.md +2 -2
  122. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  123. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
  124. package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
  125. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  126. package/presets/mavis/php-laravel/agents/README.md +2 -2
  127. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +108 -1
  128. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -4
  129. package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +1 -1
  130. package/presets/mavis/svelte/adapter-map.json +1 -1
  131. package/presets/mavis/svelte/agents/README.md +3 -3
  132. package/presets/mavis/svelte/hooks/chain-team-phases.sh +108 -1
  133. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -4
  134. package/presets/mavis/svelte/rules/feature-delivery-workflow.md +1 -1
  135. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  136. package/presets/opencode/android-kotlin/agents/README.md +4 -4
  137. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +108 -1
  138. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -4
  139. package/presets/opencode/go/adapter-map.json +1 -1
  140. package/presets/opencode/go/agents/README.md +3 -3
  141. package/presets/opencode/go/hooks/chain-team-phases.sh +108 -1
  142. package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -4
  143. package/presets/opencode/go/rules/feature-delivery-workflow.md +1 -1
  144. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  145. package/presets/opencode/ios-swift/agents/README.md +4 -4
  146. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +108 -1
  147. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -4
  148. package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +1 -1
  149. package/presets/opencode/java/adapter-map.json +1 -1
  150. package/presets/opencode/java/agents/README.md +3 -3
  151. package/presets/opencode/java/hooks/chain-team-phases.sh +108 -1
  152. package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -4
  153. package/presets/opencode/java/rules/feature-delivery-workflow.md +1 -1
  154. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  155. package/presets/opencode/mcp-ts/agents/README.md +2 -2
  156. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +108 -1
  157. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -4
  158. package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +1 -1
  159. package/presets/opencode/mol/adapter-map.json +1 -1
  160. package/presets/opencode/mol/agents/README.md +4 -4
  161. package/presets/opencode/mol/hooks/chain-team-phases.sh +108 -1
  162. package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -4
  163. package/presets/opencode/mol/rules/feature-delivery-workflow.md +1 -1
  164. package/presets/opencode/next/adapter-map.json +1 -1
  165. package/presets/opencode/next/agents/README.md +4 -4
  166. package/presets/opencode/next/agents/task-router.md +4 -4
  167. package/presets/opencode/next/hooks/chain-team-phases.sh +108 -1
  168. package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -4
  169. package/presets/opencode/next/rules/feature-delivery-workflow.md +2 -2
  170. package/presets/opencode/nuxt/adapter-map.json +1 -1
  171. package/presets/opencode/nuxt/agents/README.md +4 -4
  172. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +108 -1
  173. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -4
  174. package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +1 -1
  175. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  176. package/presets/opencode/php-hexagonal/agents/README.md +3 -3
  177. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  178. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
  179. package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
  180. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  181. package/presets/opencode/php-laravel/agents/README.md +3 -3
  182. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +108 -1
  183. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -4
  184. package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +1 -1
  185. package/presets/opencode/plugins/output-guard/README.md +25 -4
  186. package/presets/opencode/plugins/output-guard/index.ts +57 -11
  187. package/presets/opencode/plugins/output-guard/rewrite.ts +104 -1
  188. package/presets/opencode/svelte/adapter-map.json +1 -1
  189. package/presets/opencode/svelte/agents/README.md +4 -4
  190. package/presets/opencode/svelte/hooks/chain-team-phases.sh +108 -1
  191. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -4
  192. package/presets/opencode/svelte/rules/feature-delivery-workflow.md +1 -1
  193. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  194. package/presets/zcode/android-kotlin/agents/README.md +3 -3
  195. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +108 -1
  196. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -4
  197. package/presets/zcode/go/adapter-map.json +1 -1
  198. package/presets/zcode/go/agents/README.md +2 -2
  199. package/presets/zcode/go/hooks/chain-team-phases.sh +108 -1
  200. package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -4
  201. package/presets/zcode/go/rules/feature-delivery-workflow.md +1 -1
  202. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  203. package/presets/zcode/ios-swift/agents/README.md +3 -3
  204. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +108 -1
  205. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -4
  206. package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +1 -1
  207. package/presets/zcode/java/adapter-map.json +1 -1
  208. package/presets/zcode/java/agents/README.md +2 -2
  209. package/presets/zcode/java/hooks/chain-team-phases.sh +108 -1
  210. package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -4
  211. package/presets/zcode/java/rules/feature-delivery-workflow.md +1 -1
  212. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  213. package/presets/zcode/mcp-ts/agents/README.md +1 -1
  214. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +108 -1
  215. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -4
  216. package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +1 -1
  217. package/presets/zcode/mol/adapter-map.json +1 -1
  218. package/presets/zcode/mol/agents/README.md +3 -3
  219. package/presets/zcode/mol/hooks/chain-team-phases.sh +108 -1
  220. package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -4
  221. package/presets/zcode/mol/rules/feature-delivery-workflow.md +1 -1
  222. package/presets/zcode/next/adapter-map.json +1 -1
  223. package/presets/zcode/next/agents/README.md +3 -3
  224. package/presets/zcode/next/agents/task-router.md +4 -4
  225. package/presets/zcode/next/hooks/chain-team-phases.sh +108 -1
  226. package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -4
  227. package/presets/zcode/next/rules/feature-delivery-workflow.md +2 -2
  228. package/presets/zcode/nuxt/adapter-map.json +1 -1
  229. package/presets/zcode/nuxt/agents/README.md +3 -3
  230. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +108 -1
  231. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -4
  232. package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +1 -1
  233. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  234. package/presets/zcode/php-hexagonal/agents/README.md +2 -2
  235. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  236. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
  237. package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
  238. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  239. package/presets/zcode/php-laravel/agents/README.md +2 -2
  240. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +108 -1
  241. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -4
  242. package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +1 -1
  243. package/presets/zcode/svelte/adapter-map.json +1 -1
  244. package/presets/zcode/svelte/agents/README.md +3 -3
  245. package/presets/zcode/svelte/hooks/chain-team-phases.sh +108 -1
  246. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -4
  247. package/presets/zcode/svelte/rules/feature-delivery-workflow.md +1 -1
  248. package/scripts/aggregate-agent-task-metrics.mjs +201 -0
  249. package/scripts/report-context-cost.mjs +126 -0
@@ -341,6 +341,82 @@ export function summarizeOutputGuard(rows) {
341
341
  };
342
342
  }
343
343
 
344
+ /**
345
+ * Summarize tool activity over the output-guard `results.jsonl` rows: the
346
+ * read-slice norm's measurement (`readCountPerPath`) and the tool-error split
347
+ * (`mcpErrors`). Read calls are `tool === 'read'` rows keyed by their exact
348
+ * `command` — the read tool's `command` is the file path it read. A plugin
349
+ * reload can repeat a `(sessionID, callID)` pair, so the first row wins.
350
+ *
351
+ * `error: true` rows are tool results the host delivered as its error variant;
352
+ * rows written before the field existed carry no key and stay non-errors. MCP
353
+ * attribution prefers the server names the context snapshot recorded
354
+ * (`mcpServers[].name` prefixes, `serverNames`); only when no snapshot names
355
+ * any server does the `<server>_<tool>` naming convention stay as the
356
+ * documented fallback (`mcpAttribution` names which basis was used).
357
+ */
358
+ export function summarizeToolActivity(rows, serverNames = []) {
359
+ const servers = Array.isArray(serverNames)
360
+ ? serverNames.filter((name) => typeof name === 'string' && name !== '')
361
+ : [];
362
+ const isMcp =
363
+ servers.length > 0
364
+ ? (tool) => servers.some((name) => tool.startsWith(`${name}_`))
365
+ : (tool) => tool.includes('_');
366
+ const seen = new Set();
367
+ const readCounts = new Map();
368
+ const errorCounts = new Map();
369
+ let reads = 0;
370
+ let unattributedReads = 0;
371
+ let errors = 0;
372
+ let mcpErrors = 0;
373
+ let invalid = 0;
374
+ for (const row of Array.isArray(rows) ? rows : []) {
375
+ if (!row || typeof row !== 'object') {
376
+ invalid += 1;
377
+ continue;
378
+ }
379
+ const sessionID = typeof row.sessionID === 'string' ? row.sessionID : '';
380
+ const callID = typeof row.callID === 'string' ? row.callID : '';
381
+ const tool = typeof row.tool === 'string' ? row.tool : '';
382
+ if (sessionID === '' || callID === '' || tool === '') {
383
+ invalid += 1;
384
+ continue;
385
+ }
386
+ const key = `${sessionID}|${callID}`;
387
+ if (seen.has(key)) continue;
388
+ seen.add(key);
389
+ if (tool === 'read') {
390
+ reads += 1;
391
+ if (typeof row.command === 'string' && row.command !== '') {
392
+ readCounts.set(row.command, (readCounts.get(row.command) ?? 0) + 1);
393
+ } else {
394
+ unattributedReads += 1;
395
+ }
396
+ }
397
+ if (row.error === true) {
398
+ errors += 1;
399
+ if (isMcp(tool)) mcpErrors += 1;
400
+ errorCounts.set(tool, (errorCounts.get(tool) ?? 0) + 1);
401
+ }
402
+ }
403
+ return {
404
+ reads,
405
+ unattributedReads,
406
+ distinctPaths: readCounts.size,
407
+ readCountPerPath: [...readCounts.entries()]
408
+ .map(([path, count]) => ({ path, count }))
409
+ .sort((a, b) => b.count - a.count || a.path.localeCompare(b.path)),
410
+ errors,
411
+ mcpErrors,
412
+ mcpAttribution: servers.length > 0 ? 'servers' : 'naming-convention',
413
+ errorsByTool: [...errorCounts.entries()]
414
+ .map(([tool, count]) => ({ tool, count }))
415
+ .sort((a, b) => b.count - a.count || a.tool.localeCompare(b.tool)),
416
+ invalid,
417
+ };
418
+ }
419
+
344
420
  /**
345
421
  * Attribute the hook-time schema snapshot. The plugin writes one row per
346
422
  * `(sessionID, toolset)`; a reload can repeat a key, so the first row wins.
@@ -490,6 +566,30 @@ function outputGuardReport() {
490
566
  return { present: true, file: toRepoPath(file), ...summarizeOutputGuard(rows) };
491
567
  }
492
568
 
569
+ function toolActivityReport() {
570
+ const file = path.join(repoRoot, '.ai.local', 'team', 'output-guard', 'results.jsonl');
571
+ const ledger = readJsonlRows(file);
572
+ const contextLedger = readJsonlRows(
573
+ path.join(repoRoot, '.ai.local', 'team', 'output-guard', 'context.jsonl'),
574
+ );
575
+ const serverNames = [];
576
+ for (const row of contextLedger.rows) {
577
+ if (!Array.isArray(row?.mcpServers)) continue;
578
+ for (const server of row.mcpServers) {
579
+ if (server && typeof server === 'object' && typeof server.name === 'string') {
580
+ serverNames.push(server.name);
581
+ }
582
+ }
583
+ }
584
+ const summary = summarizeToolActivity(ledger.rows, [...new Set(serverNames)]);
585
+ return {
586
+ file: toRepoPath(file),
587
+ present: ledger.present,
588
+ ...summary,
589
+ invalid: summary.invalid + ledger.invalid,
590
+ };
591
+ }
592
+
493
593
  function buildReport() {
494
594
  const slugs = listTaskSlugs();
495
595
  return {
@@ -506,6 +606,7 @@ function buildReport() {
506
606
  tasks: taskReport(slugs),
507
607
  usage: usageReport(slugs),
508
608
  outputGuard: outputGuardReport(),
609
+ toolActivity: toolActivityReport(),
509
610
  mcpSchemas: mcpSchemasReport(),
510
611
  };
511
612
  }
@@ -611,6 +712,31 @@ function humanReport(report) {
611
712
  lines.push(` ${formatInt(report.outputGuard.invalid)} invalid row(s) ignored`);
612
713
  }
613
714
  lines.push('');
715
+ const activity = report.toolActivity;
716
+ lines.push('TOOL ACTIVITY — artifact reads and tool errors (results.jsonl, deduped by sessionID+callID)');
717
+ if (!activity.present) {
718
+ lines.push('no results.jsonl yet (nothing measured)');
719
+ } else {
720
+ lines.push(
721
+ `${padStart(formatInt(activity.reads), 7)} reads` +
722
+ `${padStart(formatInt(activity.distinctPaths), 12)} distinct paths` +
723
+ `${padStart(formatInt(activity.unattributedReads), 12)} no-target` +
724
+ ` ${formatInt(activity.errors)} errored tool result(s), ${formatInt(activity.mcpErrors)} on MCP tools`,
725
+ );
726
+ for (const entry of activity.readCountPerPath.slice(0, 5)) {
727
+ lines.push(` ${padStart(formatInt(entry.count), 5)} ${entry.path}`);
728
+ }
729
+ if (activity.readCountPerPath.length > 5) {
730
+ lines.push(` … and ${formatInt(activity.readCountPerPath.length - 5)} more paths (--json carries the full map)`);
731
+ }
732
+ for (const entry of activity.errorsByTool.slice(0, 5)) {
733
+ lines.push(` ${padStart(formatInt(entry.count), 5)}x errored ${entry.tool}`);
734
+ }
735
+ if (activity.invalid > 0) {
736
+ lines.push(` ${formatInt(activity.invalid)} invalid row(s) ignored`);
737
+ }
738
+ }
739
+ lines.push('');
614
740
  lines.push('USAGE — usage_recorded events across task metrics.json (a missing record stays missing)');
615
741
  lines.push(
616
742
  `${padStart(formatInt(report.usage.events), 7)} events${padStart(formatInt(report.usage.input), 10)} input` +