@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.
- package/CHANGELOG.md +65 -0
- package/bin/lib/engine-scripts.js +9 -0
- package/docs/OPENCODE.md +4 -2
- package/docs/TEAM-DB.md +10 -7
- package/package.json +1 -1
- package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +201 -0
- package/presets/_shared/ai-local/scripts/incidents.mjs +452 -0
- package/presets/_shared/ai-local/scripts/record-usage.mjs +163 -0
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +4 -4
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +2 -0
- package/presets/_shared/ai-local/scripts/verification.mjs +374 -0
- package/presets/_shared/core/agent-team/agent-task-metrics.md +61 -1
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -4
- package/presets/_shared/core/agent-team/incident-registry.md +47 -0
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +1 -1
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +108 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/go/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/go/rules/architecture/feature-delivery.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/java/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/java/rules/architecture/feature-delivery.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/mol/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +1 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/next/agents/README.md +4 -3
- package/presets/claude/next/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/next/agents/mockup-reviewer.md +1 -1
- package/presets/claude/next/agents/task-router.md +4 -4
- package/presets/claude/next/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +2 -2
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/claude/svelte/hooks/chain-team-phases.sh +108 -1
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/agents/README.md +4 -3
- package/presets/cursor/next/agents/api-contract-reviewer.md +1 -1
- package/presets/cursor/next/agents/mockup-reviewer.md +1 -1
- package/presets/cursor/next/agents/task-router.md +4 -4
- package/presets/cursor/next/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +108 -1
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/README.md +3 -3
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/README.md +2 -2
- package/presets/mavis/go/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/go/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/README.md +3 -3
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/README.md +2 -2
- package/presets/mavis/java/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/java/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/agents/README.md +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/README.md +3 -3
- package/presets/mavis/mol/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/README.md +3 -3
- package/presets/mavis/next/agents/task-router.md +4 -4
- package/presets/mavis/next/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/next/rules/feature-delivery-workflow.md +2 -2
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/README.md +3 -3
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/README.md +2 -2
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/README.md +2 -2
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +1 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/README.md +3 -3
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +108 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -4
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/README.md +4 -4
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/README.md +3 -3
- package/presets/opencode/go/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/go/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/README.md +4 -4
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/README.md +3 -3
- package/presets/opencode/java/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/java/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/agents/README.md +2 -2
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/README.md +4 -4
- package/presets/opencode/mol/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/README.md +4 -4
- package/presets/opencode/next/agents/task-router.md +4 -4
- package/presets/opencode/next/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/next/rules/feature-delivery-workflow.md +2 -2
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/README.md +4 -4
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/README.md +3 -3
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/README.md +3 -3
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +1 -1
- package/presets/opencode/plugins/output-guard/README.md +25 -4
- package/presets/opencode/plugins/output-guard/index.ts +57 -11
- package/presets/opencode/plugins/output-guard/rewrite.ts +104 -1
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/README.md +4 -4
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +108 -1
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -4
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/agents/README.md +3 -3
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/agents/README.md +2 -2
- package/presets/zcode/go/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/go/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/agents/README.md +3 -3
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/agents/README.md +2 -2
- package/presets/zcode/java/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/java/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/agents/README.md +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/README.md +3 -3
- package/presets/zcode/mol/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/next/adapter-map.json +1 -1
- package/presets/zcode/next/agents/README.md +3 -3
- package/presets/zcode/next/agents/task-router.md +4 -4
- package/presets/zcode/next/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/next/rules/feature-delivery-workflow.md +2 -2
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/README.md +3 -3
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/agents/README.md +2 -2
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/agents/README.md +2 -2
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +1 -1
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/README.md +3 -3
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +108 -1
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -4
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +1 -1
- package/scripts/aggregate-agent-task-metrics.mjs +201 -0
- 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` +
|