@bonesofspring/ai-rules 0.2.72 → 0.2.74
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 +43 -0
- package/README.md +7 -6
- package/bin/lib/ai-local-drift.js +4 -4
- package/bin/lib/engine-scripts.js +10 -0
- package/bin/lib/seed-ai-local-team.js +9 -5
- package/docs/TEAM-DB.md +105 -9
- package/docs/openapi/team-db.v1.json +1164 -224
- package/package.json +1 -1
- package/presets/_shared/ai-local/scripts/action-signals.mjs +225 -0
- package/presets/_shared/ai-local/scripts/actions-report.mjs +210 -0
- package/presets/_shared/ai-local/scripts/manifest.mjs +19 -1
- package/presets/_shared/ai-local/scripts/processes.mjs +5 -4
- package/presets/_shared/ai-local/scripts/rr-scheduler-start.mjs +161 -0
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +347 -9
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +309 -4
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +312 -36
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +86 -1
- package/presets/_shared/ai-local/scripts/team-db.mjs +125 -40
- package/presets/_shared/ai-local/scripts/tracker-planned-drain.mjs +335 -0
- package/presets/_shared/core/agent-team/agent-artifact-contracts.md +9 -0
- package/presets/_shared/core/agent-team/agent-team-intake.md +2 -2
- package/presets/_shared/core/quality/self-review-and-context-hygiene.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +15 -1
- package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/debugger.md +1 -1
- package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/commands/README.md +4 -0
- package/presets/claude/android-kotlin/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/go/agents/build-verifier.md +1 -1
- package/presets/claude/go/agents/code-reviewer.md +1 -1
- package/presets/claude/go/agents/debugger.md +1 -1
- package/presets/claude/go/agents/feature-developer.md +1 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/commands/README.md +4 -0
- package/presets/claude/go/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/debugger.md +1 -1
- package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/commands/README.md +4 -0
- package/presets/claude/ios-swift/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/code-reviewer.md +1 -1
- package/presets/claude/java/agents/debugger.md +1 -1
- package/presets/claude/java/agents/feature-developer.md +1 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/commands/README.md +4 -0
- package/presets/claude/java/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/commands/README.md +4 -0
- package/presets/claude/mcp-ts/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/mol/agents/build-verifier.md +1 -1
- package/presets/claude/mol/agents/code-reviewer.md +1 -1
- package/presets/claude/mol/agents/debugger.md +1 -1
- package/presets/claude/mol/agents/feature-developer.md +1 -1
- package/presets/claude/mol/agents/task-analyst.md +1 -1
- package/presets/claude/mol/commands/README.md +4 -0
- package/presets/claude/mol/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/next/REPO_AGENTS.md +16 -0
- package/presets/claude/next/agents/accessibility-reviewer.md +4 -1
- package/presets/claude/next/agents/api-contract-reviewer.md +5 -2
- package/presets/claude/next/agents/build-verifier.md +6 -3
- package/presets/claude/next/agents/ci-investigator.md +1 -1
- package/presets/claude/next/agents/code-reviewer.md +7 -4
- package/presets/claude/next/agents/codebase-analyzer.md +4 -1
- package/presets/claude/next/agents/debugger.md +2 -2
- package/presets/claude/next/agents/feature-developer.md +2 -2
- package/presets/claude/next/agents/migration-specialist.md +4 -1
- package/presets/claude/next/agents/mockup-reviewer.md +4 -1
- package/presets/claude/next/agents/openspec-author.md +4 -1
- package/presets/claude/next/agents/performance-auditor.md +4 -1
- package/presets/claude/next/agents/playwright-test-generator.md +5 -2
- package/presets/claude/next/agents/playwright-test-healer.md +5 -2
- package/presets/claude/next/agents/playwright-test-planner.md +5 -2
- package/presets/claude/next/agents/qa-tester.md +5 -2
- package/presets/claude/next/agents/security-reviewer.md +4 -1
- package/presets/claude/next/agents/solution-architect.md +4 -1
- package/presets/claude/next/agents/task-analyst.md +5 -2
- package/presets/claude/next/agents/task-router.md +4 -1
- package/presets/claude/next/agents/tech-writer.md +4 -1
- package/presets/claude/next/agents/unit-test-generator.md +5 -2
- package/presets/claude/next/agents/unit-test-healer.md +5 -2
- package/presets/claude/next/agents/unit-test-planner.md +5 -2
- package/presets/claude/next/ai-local/conventions.md +26 -1
- package/presets/claude/next/commands/README.md +4 -0
- package/presets/claude/next/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/nuxt/agents/build-verifier.md +1 -1
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
- package/presets/claude/nuxt/agents/debugger.md +1 -1
- package/presets/claude/nuxt/agents/feature-developer.md +1 -1
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/commands/README.md +4 -0
- package/presets/claude/nuxt/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
- package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/commands/README.md +4 -0
- package/presets/claude/php-hexagonal/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/debugger.md +1 -1
- package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/commands/README.md +4 -0
- package/presets/claude/php-laravel/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/svelte/agents/build-verifier.md +1 -1
- package/presets/claude/svelte/agents/code-reviewer.md +1 -1
- package/presets/claude/svelte/agents/debugger.md +1 -1
- package/presets/claude/svelte/agents/feature-developer.md +1 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/commands/README.md +4 -0
- package/presets/claude/svelte/commands/rr-scheduler-start.md +32 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
- package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/commands/README.md +4 -0
- package/presets/cursor/android-kotlin/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/go/agents/build-verifier.md +1 -1
- package/presets/cursor/go/agents/code-reviewer.md +1 -1
- package/presets/cursor/go/agents/debugger.md +1 -1
- package/presets/cursor/go/agents/feature-developer.md +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/commands/README.md +4 -0
- package/presets/cursor/go/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/go/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/cursor/ios-swift/agents/debugger.md +1 -1
- package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/commands/README.md +4 -0
- package/presets/cursor/ios-swift/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/java/agents/build-verifier.md +1 -1
- package/presets/cursor/java/agents/code-reviewer.md +1 -1
- package/presets/cursor/java/agents/debugger.md +1 -1
- package/presets/cursor/java/agents/feature-developer.md +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/commands/README.md +4 -0
- package/presets/cursor/java/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/java/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/commands/README.md +4 -0
- package/presets/cursor/mcp-ts/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/mol/agents/build-verifier.md +1 -1
- package/presets/cursor/mol/agents/code-reviewer.md +1 -1
- package/presets/cursor/mol/agents/debugger.md +1 -1
- package/presets/cursor/mol/agents/feature-developer.md +1 -1
- package/presets/cursor/mol/agents/task-analyst.md +1 -1
- package/presets/cursor/mol/commands/README.md +4 -0
- package/presets/cursor/mol/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/mol/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/next/AGENTS.md +2 -1
- package/presets/cursor/next/REPO_AGENTS.md +16 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -1
- package/presets/cursor/next/agents/debugger.md +1 -1
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/ai-local/conventions.md +6 -1
- package/presets/cursor/next/commands/README.md +4 -0
- package/presets/cursor/next/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/next/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
- package/presets/cursor/nuxt/agents/debugger.md +1 -1
- package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/commands/README.md +4 -0
- package/presets/cursor/nuxt/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/nuxt/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
- package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/commands/README.md +4 -0
- package/presets/cursor/php-hexagonal/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-laravel/agents/debugger.md +1 -1
- package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/commands/README.md +4 -0
- package/presets/cursor/php-laravel/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/svelte/agents/build-verifier.md +1 -1
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
- package/presets/cursor/svelte/agents/debugger.md +1 -1
- package/presets/cursor/svelte/agents/feature-developer.md +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/commands/README.md +4 -0
- package/presets/cursor/svelte/commands/rr-scheduler-start.md +32 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/cursor/svelte/rules/agent-team-intake.mdc +2 -2
- package/presets/mavis/android-kotlin/adapter-map.json +9 -1
- package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
- package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/commands/README.md +4 -0
- package/presets/mavis/android-kotlin/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/android-kotlin/rules/agent-team-intake.md +2 -2
- package/presets/mavis/go/adapter-map.json +9 -1
- package/presets/mavis/go/agents/build-verifier.md +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -1
- package/presets/mavis/go/agents/debugger.md +1 -1
- package/presets/mavis/go/agents/feature-developer.md +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/commands/README.md +4 -0
- package/presets/mavis/go/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/go/rules/agent-team-intake.md +2 -2
- package/presets/mavis/ios-swift/adapter-map.json +9 -1
- package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/mavis/ios-swift/agents/debugger.md +1 -1
- package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/commands/README.md +4 -0
- package/presets/mavis/ios-swift/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/ios-swift/rules/agent-team-intake.md +2 -2
- package/presets/mavis/java/adapter-map.json +9 -1
- package/presets/mavis/java/agents/build-verifier.md +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -1
- package/presets/mavis/java/agents/debugger.md +1 -1
- package/presets/mavis/java/agents/feature-developer.md +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/commands/README.md +4 -0
- package/presets/mavis/java/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/java/rules/agent-team-intake.md +2 -2
- package/presets/mavis/mcp-ts/adapter-map.json +9 -1
- package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/commands/README.md +4 -0
- package/presets/mavis/mcp-ts/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/mcp-ts/rules/agent-team-intake.md +2 -2
- package/presets/mavis/mol/adapter-map.json +9 -1
- package/presets/mavis/mol/agents/build-verifier.md +1 -1
- package/presets/mavis/mol/agents/code-reviewer.md +1 -1
- package/presets/mavis/mol/agents/debugger.md +1 -1
- package/presets/mavis/mol/agents/feature-developer.md +1 -1
- package/presets/mavis/mol/agents/task-analyst.md +1 -1
- package/presets/mavis/mol/commands/README.md +4 -0
- package/presets/mavis/mol/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/mol/rules/agent-team-intake.md +2 -2
- package/presets/mavis/next/MAVIS.md +2 -1
- package/presets/mavis/next/REPO_AGENTS.md +16 -0
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/accessibility-reviewer.md +4 -1
- package/presets/mavis/next/agents/api-contract-reviewer.md +5 -2
- package/presets/mavis/next/agents/build-verifier.md +6 -3
- package/presets/mavis/next/agents/ci-investigator.md +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +7 -4
- package/presets/mavis/next/agents/codebase-analyzer.md +4 -1
- package/presets/mavis/next/agents/debugger.md +2 -2
- package/presets/mavis/next/agents/feature-developer.md +2 -2
- package/presets/mavis/next/agents/migration-specialist.md +4 -1
- package/presets/mavis/next/agents/mockup-reviewer.md +4 -1
- package/presets/mavis/next/agents/openspec-author.md +4 -1
- package/presets/mavis/next/agents/performance-auditor.md +4 -1
- package/presets/mavis/next/agents/playwright-test-generator.md +5 -2
- package/presets/mavis/next/agents/playwright-test-healer.md +5 -2
- package/presets/mavis/next/agents/playwright-test-planner.md +5 -2
- package/presets/mavis/next/agents/qa-tester.md +5 -2
- package/presets/mavis/next/agents/security-reviewer.md +4 -1
- package/presets/mavis/next/agents/solution-architect.md +4 -1
- package/presets/mavis/next/agents/task-analyst.md +5 -2
- package/presets/mavis/next/agents/task-router.md +4 -1
- package/presets/mavis/next/agents/tech-writer.md +4 -1
- package/presets/mavis/next/agents/unit-test-generator.md +5 -2
- package/presets/mavis/next/agents/unit-test-healer.md +5 -2
- package/presets/mavis/next/agents/unit-test-planner.md +5 -2
- package/presets/mavis/next/ai-local/conventions.md +6 -1
- package/presets/mavis/next/commands/README.md +4 -0
- package/presets/mavis/next/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/next/rules/agent-team-intake.md +2 -2
- package/presets/mavis/nuxt/adapter-map.json +9 -1
- package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
- package/presets/mavis/nuxt/agents/debugger.md +1 -1
- package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/commands/README.md +4 -0
- package/presets/mavis/nuxt/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/nuxt/rules/agent-team-intake.md +2 -2
- package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
- package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
- package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/commands/README.md +4 -0
- package/presets/mavis/php-hexagonal/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +2 -2
- package/presets/mavis/php-laravel/adapter-map.json +9 -1
- package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-laravel/agents/debugger.md +1 -1
- package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/commands/README.md +4 -0
- package/presets/mavis/php-laravel/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/php-laravel/rules/agent-team-intake.md +2 -2
- package/presets/mavis/svelte/adapter-map.json +9 -1
- package/presets/mavis/svelte/agents/build-verifier.md +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
- package/presets/mavis/svelte/agents/debugger.md +1 -1
- package/presets/mavis/svelte/agents/feature-developer.md +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/commands/README.md +4 -0
- package/presets/mavis/svelte/commands/rr-scheduler-start.md +27 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/mavis/svelte/rules/agent-team-intake.md +2 -2
- package/presets/opencode/android-kotlin/adapter-map.json +9 -1
- package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
- package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/commands/README.md +4 -0
- package/presets/opencode/android-kotlin/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/android-kotlin/rules/agent-team-intake.md +2 -2
- package/presets/opencode/go/adapter-map.json +9 -1
- package/presets/opencode/go/agents/build-verifier.md +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -1
- package/presets/opencode/go/agents/debugger.md +1 -1
- package/presets/opencode/go/agents/feature-developer.md +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/commands/README.md +4 -0
- package/presets/opencode/go/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/go/rules/agent-team-intake.md +2 -2
- package/presets/opencode/ios-swift/adapter-map.json +9 -1
- package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/debugger.md +1 -1
- package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/commands/README.md +4 -0
- package/presets/opencode/ios-swift/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/ios-swift/rules/agent-team-intake.md +2 -2
- package/presets/opencode/java/adapter-map.json +9 -1
- package/presets/opencode/java/agents/build-verifier.md +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -1
- package/presets/opencode/java/agents/debugger.md +1 -1
- package/presets/opencode/java/agents/feature-developer.md +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/commands/README.md +4 -0
- package/presets/opencode/java/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/java/rules/agent-team-intake.md +2 -2
- package/presets/opencode/mcp-ts/adapter-map.json +9 -1
- package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/commands/README.md +4 -0
- package/presets/opencode/mcp-ts/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/mcp-ts/rules/agent-team-intake.md +2 -2
- package/presets/opencode/mol/adapter-map.json +9 -1
- package/presets/opencode/mol/agents/build-verifier.md +1 -1
- package/presets/opencode/mol/agents/code-reviewer.md +1 -1
- package/presets/opencode/mol/agents/debugger.md +1 -1
- package/presets/opencode/mol/agents/feature-developer.md +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/commands/README.md +4 -0
- package/presets/opencode/mol/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/mol/rules/agent-team-intake.md +2 -2
- package/presets/opencode/next/OPENCODE.md +2 -1
- package/presets/opencode/next/REPO_AGENTS.md +16 -0
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/accessibility-reviewer.md +4 -1
- package/presets/opencode/next/agents/api-contract-reviewer.md +5 -2
- package/presets/opencode/next/agents/build-verifier.md +6 -3
- package/presets/opencode/next/agents/ci-investigator.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +7 -4
- package/presets/opencode/next/agents/codebase-analyzer.md +4 -1
- package/presets/opencode/next/agents/debugger.md +2 -2
- package/presets/opencode/next/agents/feature-developer.md +2 -2
- package/presets/opencode/next/agents/migration-specialist.md +4 -1
- package/presets/opencode/next/agents/mockup-reviewer.md +4 -1
- package/presets/opencode/next/agents/openspec-author.md +4 -1
- package/presets/opencode/next/agents/performance-auditor.md +4 -1
- package/presets/opencode/next/agents/playwright-test-generator.md +5 -2
- package/presets/opencode/next/agents/playwright-test-healer.md +5 -2
- package/presets/opencode/next/agents/playwright-test-planner.md +5 -2
- package/presets/opencode/next/agents/qa-tester.md +5 -2
- package/presets/opencode/next/agents/security-reviewer.md +4 -1
- package/presets/opencode/next/agents/solution-architect.md +4 -1
- package/presets/opencode/next/agents/task-analyst.md +5 -2
- package/presets/opencode/next/agents/task-router.md +4 -1
- package/presets/opencode/next/agents/tech-writer.md +4 -1
- package/presets/opencode/next/agents/unit-test-generator.md +5 -2
- package/presets/opencode/next/agents/unit-test-healer.md +5 -2
- package/presets/opencode/next/agents/unit-test-planner.md +5 -2
- package/presets/opencode/next/ai-local/conventions.md +6 -1
- package/presets/opencode/next/commands/README.md +4 -0
- package/presets/opencode/next/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/next/rules/agent-team-intake.md +2 -2
- package/presets/opencode/nuxt/adapter-map.json +9 -1
- package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/debugger.md +1 -1
- package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/commands/README.md +4 -0
- package/presets/opencode/nuxt/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/nuxt/rules/agent-team-intake.md +2 -2
- package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
- package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
- package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/commands/README.md +4 -0
- package/presets/opencode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +2 -2
- package/presets/opencode/php-laravel/adapter-map.json +9 -1
- package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/debugger.md +1 -1
- package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/commands/README.md +4 -0
- package/presets/opencode/php-laravel/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/php-laravel/rules/agent-team-intake.md +2 -2
- package/presets/opencode/plugins/output-guard/README.md +56 -9
- package/presets/opencode/plugins/output-guard/actions.ts +201 -0
- package/presets/opencode/plugins/output-guard/index.ts +147 -6
- package/presets/opencode/plugins/output-guard/rewrite.ts +15 -9
- package/presets/opencode/svelte/adapter-map.json +9 -1
- package/presets/opencode/svelte/agents/build-verifier.md +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/debugger.md +1 -1
- package/presets/opencode/svelte/agents/feature-developer.md +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/commands/README.md +4 -0
- package/presets/opencode/svelte/commands/rr-scheduler-start.md +35 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/opencode/svelte/rules/agent-team-intake.md +2 -2
- package/presets/zcode/android-kotlin/adapter-map.json +9 -1
- package/presets/zcode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/zcode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/zcode/android-kotlin/agents/debugger.md +1 -1
- package/presets/zcode/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/zcode/android-kotlin/commands/README.md +4 -0
- package/presets/zcode/android-kotlin/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/android-kotlin/rules/agent-team-intake.md +2 -2
- package/presets/zcode/go/adapter-map.json +9 -1
- package/presets/zcode/go/agents/build-verifier.md +1 -1
- package/presets/zcode/go/agents/code-reviewer.md +1 -1
- package/presets/zcode/go/agents/debugger.md +1 -1
- package/presets/zcode/go/agents/feature-developer.md +1 -1
- package/presets/zcode/go/agents/task-analyst.md +1 -1
- package/presets/zcode/go/commands/README.md +4 -0
- package/presets/zcode/go/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/go/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/go/rules/agent-team-intake.md +2 -2
- package/presets/zcode/ios-swift/adapter-map.json +9 -1
- package/presets/zcode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/zcode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/zcode/ios-swift/agents/debugger.md +1 -1
- package/presets/zcode/ios-swift/agents/feature-developer.md +1 -1
- package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/zcode/ios-swift/commands/README.md +4 -0
- package/presets/zcode/ios-swift/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/ios-swift/rules/agent-team-intake.md +2 -2
- package/presets/zcode/java/adapter-map.json +9 -1
- package/presets/zcode/java/agents/build-verifier.md +1 -1
- package/presets/zcode/java/agents/code-reviewer.md +1 -1
- package/presets/zcode/java/agents/debugger.md +1 -1
- package/presets/zcode/java/agents/feature-developer.md +1 -1
- package/presets/zcode/java/agents/task-analyst.md +1 -1
- package/presets/zcode/java/commands/README.md +4 -0
- package/presets/zcode/java/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/java/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/java/rules/agent-team-intake.md +2 -2
- package/presets/zcode/mcp-ts/adapter-map.json +9 -1
- package/presets/zcode/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/zcode/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/zcode/mcp-ts/commands/README.md +4 -0
- package/presets/zcode/mcp-ts/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/mcp-ts/rules/agent-team-intake.md +2 -2
- package/presets/zcode/mol/adapter-map.json +9 -1
- package/presets/zcode/mol/agents/build-verifier.md +1 -1
- package/presets/zcode/mol/agents/code-reviewer.md +1 -1
- package/presets/zcode/mol/agents/debugger.md +1 -1
- package/presets/zcode/mol/agents/feature-developer.md +1 -1
- package/presets/zcode/mol/agents/task-analyst.md +1 -1
- package/presets/zcode/mol/commands/README.md +4 -0
- package/presets/zcode/mol/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/mol/rules/agent-team-intake.md +2 -2
- package/presets/zcode/next/REPO_AGENTS.md +16 -0
- package/presets/zcode/next/adapter-map.json +9 -1
- package/presets/zcode/next/agents/accessibility-reviewer.md +4 -1
- package/presets/zcode/next/agents/api-contract-reviewer.md +5 -2
- package/presets/zcode/next/agents/build-verifier.md +6 -3
- package/presets/zcode/next/agents/ci-investigator.md +1 -1
- package/presets/zcode/next/agents/code-reviewer.md +7 -4
- package/presets/zcode/next/agents/codebase-analyzer.md +4 -1
- package/presets/zcode/next/agents/debugger.md +2 -2
- package/presets/zcode/next/agents/feature-developer.md +2 -2
- package/presets/zcode/next/agents/migration-specialist.md +4 -1
- package/presets/zcode/next/agents/mockup-reviewer.md +4 -1
- package/presets/zcode/next/agents/openspec-author.md +4 -1
- package/presets/zcode/next/agents/performance-auditor.md +4 -1
- package/presets/zcode/next/agents/playwright-test-generator.md +5 -2
- package/presets/zcode/next/agents/playwright-test-healer.md +5 -2
- package/presets/zcode/next/agents/playwright-test-planner.md +5 -2
- package/presets/zcode/next/agents/qa-tester.md +5 -2
- package/presets/zcode/next/agents/security-reviewer.md +4 -1
- package/presets/zcode/next/agents/solution-architect.md +4 -1
- package/presets/zcode/next/agents/task-analyst.md +5 -2
- package/presets/zcode/next/agents/task-router.md +4 -1
- package/presets/zcode/next/agents/tech-writer.md +4 -1
- package/presets/zcode/next/agents/unit-test-generator.md +5 -2
- package/presets/zcode/next/agents/unit-test-healer.md +5 -2
- package/presets/zcode/next/agents/unit-test-planner.md +5 -2
- package/presets/zcode/next/ai-local/conventions.md +6 -1
- package/presets/zcode/next/commands/README.md +4 -0
- package/presets/zcode/next/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/next/rules/agent-team-intake.md +2 -2
- package/presets/zcode/nuxt/adapter-map.json +9 -1
- package/presets/zcode/nuxt/agents/build-verifier.md +1 -1
- package/presets/zcode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/zcode/nuxt/agents/debugger.md +1 -1
- package/presets/zcode/nuxt/agents/feature-developer.md +1 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
- package/presets/zcode/nuxt/commands/README.md +4 -0
- package/presets/zcode/nuxt/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/nuxt/rules/agent-team-intake.md +2 -2
- package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
- package/presets/zcode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/zcode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/zcode/php-hexagonal/agents/debugger.md +1 -1
- package/presets/zcode/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/zcode/php-hexagonal/commands/README.md +4 -0
- package/presets/zcode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +2 -2
- package/presets/zcode/php-laravel/adapter-map.json +9 -1
- package/presets/zcode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/zcode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/zcode/php-laravel/agents/debugger.md +1 -1
- package/presets/zcode/php-laravel/agents/feature-developer.md +1 -1
- package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/zcode/php-laravel/commands/README.md +4 -0
- package/presets/zcode/php-laravel/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/php-laravel/rules/agent-team-intake.md +2 -2
- package/presets/zcode/svelte/adapter-map.json +9 -1
- package/presets/zcode/svelte/agents/build-verifier.md +1 -1
- package/presets/zcode/svelte/agents/code-reviewer.md +1 -1
- package/presets/zcode/svelte/agents/debugger.md +1 -1
- package/presets/zcode/svelte/agents/feature-developer.md +1 -1
- package/presets/zcode/svelte/agents/task-analyst.md +1 -1
- package/presets/zcode/svelte/commands/README.md +4 -0
- package/presets/zcode/svelte/commands/rr-scheduler-start.md +35 -0
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +15 -1
- package/presets/zcode/svelte/rules/agent-team-intake.md +2 -2
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure capture helpers for the action and turn telemetry (`results.jsonl`,
|
|
3
|
+
* `usage.jsonl`). No host imports: the adapter in `index.ts` supplies the
|
|
4
|
+
* observed values, and the fixture test imports this module directly.
|
|
5
|
+
*
|
|
6
|
+
* The privacy invariant lives here: a target becomes a sha256 key and never a
|
|
7
|
+
* stored string, a failure becomes one of five classes and never the host's
|
|
8
|
+
* message, and a value the plugin cannot observe stays `null`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { createHash } from "node:crypto"
|
|
12
|
+
import path from "node:path"
|
|
13
|
+
|
|
14
|
+
/** The seven intent values of `design.md` D-2; nothing else is a value. */
|
|
15
|
+
export type ActionIntent = "explore" | "mutate" | "execute" | "delegate" | "ask" | "meta" | "web"
|
|
16
|
+
|
|
17
|
+
const INTENT_BY_TOOL: ReadonlyMap<string, ActionIntent> = new Map<string, ActionIntent>([
|
|
18
|
+
["read", "explore"],
|
|
19
|
+
["grep", "explore"],
|
|
20
|
+
["glob", "explore"],
|
|
21
|
+
["list", "explore"],
|
|
22
|
+
["edit", "mutate"],
|
|
23
|
+
["write", "mutate"],
|
|
24
|
+
["patch", "mutate"],
|
|
25
|
+
["shell", "execute"],
|
|
26
|
+
["bash", "execute"],
|
|
27
|
+
["execute", "execute"],
|
|
28
|
+
["subagent", "delegate"],
|
|
29
|
+
["task", "delegate"],
|
|
30
|
+
["question", "ask"],
|
|
31
|
+
["permission", "ask"],
|
|
32
|
+
["skill", "meta"],
|
|
33
|
+
["todowrite", "meta"],
|
|
34
|
+
["todoread", "meta"],
|
|
35
|
+
["plan", "meta"],
|
|
36
|
+
["webfetch", "web"],
|
|
37
|
+
["websearch", "web"],
|
|
38
|
+
])
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The intent of one tool call. The projector recomputes this column from the
|
|
42
|
+
* tool name so the ledger copy can never become the source of truth; the P0
|
|
43
|
+
* fixture pins both tables against each other.
|
|
44
|
+
*/
|
|
45
|
+
export const intentOf = (tool: string, command = ""): ActionIntent => {
|
|
46
|
+
const name = tool.toLowerCase()
|
|
47
|
+
const known = INTENT_BY_TOOL.get(name)
|
|
48
|
+
if (known !== undefined) return known
|
|
49
|
+
if (/\b(curl|wget|http)\b/i.test(command)) return "web"
|
|
50
|
+
if (/\b(git|test|lint|type-check|tsc|vitest|jest|playwright|eslint|build|compile|bundle)\b/i.test(command)) {
|
|
51
|
+
return "execute"
|
|
52
|
+
}
|
|
53
|
+
if (/\b(grep|rg|find|search)\b/i.test(command)) return "explore"
|
|
54
|
+
return "meta"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The five failure classes; `null` means "no failure observed". */
|
|
58
|
+
export type ActionErrorClass = "validation" | "notfound" | "permission" | "timeout" | "upstream"
|
|
59
|
+
|
|
60
|
+
const ERROR_CLASSES: ReadonlyArray<{ readonly errorClass: ActionErrorClass; readonly pattern: RegExp }> = [
|
|
61
|
+
{ errorClass: "notfound", pattern: /(?:enoent|no such file|not found|does not exist)/i },
|
|
62
|
+
{ errorClass: "permission", pattern: /(?:eacces|eperm|permission|denied|forbidden|401|403)/i },
|
|
63
|
+
{ errorClass: "timeout", pattern: /(?:timed out|timeout|etimedout|deadline exceeded)/i },
|
|
64
|
+
{ errorClass: "validation", pattern: /(?:invalid|validation|must be|cannot parse|unexpected token)/i },
|
|
65
|
+
{ errorClass: "upstream", pattern: /(?:econnrefused|econnreset|enotfound|fetch failed|socket hang up|50\d)/i },
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The class of a failed tool result. The text is read once, never stored: a
|
|
70
|
+
* failure that matches no class keeps the residual `upstream`, and a call that
|
|
71
|
+
* did not fail is `null`.
|
|
72
|
+
*/
|
|
73
|
+
export const errorClassOf = (resultType: unknown, value: unknown): ActionErrorClass | null => {
|
|
74
|
+
if (resultType !== "error") return null
|
|
75
|
+
const text =
|
|
76
|
+
typeof value === "string"
|
|
77
|
+
? value
|
|
78
|
+
: (() => {
|
|
79
|
+
try {
|
|
80
|
+
return JSON.stringify(value) ?? ""
|
|
81
|
+
} catch {
|
|
82
|
+
return ""
|
|
83
|
+
}
|
|
84
|
+
})()
|
|
85
|
+
for (const entry of ERROR_CLASSES) {
|
|
86
|
+
if (entry.pattern.test(text)) return entry.errorClass
|
|
87
|
+
}
|
|
88
|
+
return "upstream"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const TARGET_KEYS = ["command", "filePath", "path", "pattern", "url", "query", "agent", "skill"] as const
|
|
92
|
+
const MAX_TARGET_CHARS = 512
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The target value of a tool input, normalised so two absolute prefixes of one
|
|
96
|
+
* file collapse to one key. The value itself is hashed and never stored.
|
|
97
|
+
*/
|
|
98
|
+
export const normalizeTarget = (input: unknown, projectRoot: string): string => {
|
|
99
|
+
if (!input || typeof input !== "object") return ""
|
|
100
|
+
const record = input as Record<string, unknown>
|
|
101
|
+
for (const key of TARGET_KEYS) {
|
|
102
|
+
const value = record[key]
|
|
103
|
+
if (typeof value !== "string" || value === "") continue
|
|
104
|
+
return normaliseValue(value, projectRoot)
|
|
105
|
+
}
|
|
106
|
+
return ""
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const normaliseValue = (value: string, projectRoot: string): string => {
|
|
110
|
+
const trimmed = value.replace(/\s+/g, " ").trim().slice(0, MAX_TARGET_CHARS)
|
|
111
|
+
if (!trimmed.startsWith("/")) return trimmed.startsWith("./") ? trimmed.slice(2) : trimmed
|
|
112
|
+
const root = path.resolve(projectRoot).replace(/\/+$/, "")
|
|
113
|
+
if (root === "" || root === "/") return trimmed
|
|
114
|
+
const relative = path.relative(root, trimmed).split(path.sep).join("/")
|
|
115
|
+
return relative.startsWith("..") ? trimmed : relative
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** `sha256(tool + "\0" + target)`; `null` when the call carries no target. */
|
|
119
|
+
export const targetKeyOf = (tool: string, target: string): string | null => {
|
|
120
|
+
if (target === "") return null
|
|
121
|
+
return createHash("sha256").update(`${tool.toLowerCase()}\u0000${target}`, "utf8").digest("hex")
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The counters of one assistant message; a value the host omits stays `null`. */
|
|
125
|
+
export type TurnCounters = {
|
|
126
|
+
reasoningParts: number | null
|
|
127
|
+
reasoningChars: number | null
|
|
128
|
+
reasoningMs: number | null
|
|
129
|
+
textChars: number | null
|
|
130
|
+
toolCalls: number | null
|
|
131
|
+
compactions: number | null
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const EMPTY_COUNTERS: TurnCounters = {
|
|
135
|
+
reasoningParts: null,
|
|
136
|
+
reasoningChars: null,
|
|
137
|
+
reasoningMs: null,
|
|
138
|
+
textChars: null,
|
|
139
|
+
toolCalls: null,
|
|
140
|
+
compactions: null,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type Part = {
|
|
144
|
+
type?: unknown
|
|
145
|
+
text?: unknown
|
|
146
|
+
time?: { start?: unknown; end?: unknown }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// VERIFY: the parts array of a `session.context` message (host v2). The shapes
|
|
150
|
+
// read here are the SDK's `Part` union; a message that carries no parts yields
|
|
151
|
+
// nulls instead of zeroes, so an unobserved turn is never reported as empty.
|
|
152
|
+
const partsOf = (message: unknown): Part[] | null => {
|
|
153
|
+
if (!message || typeof message !== "object") return null
|
|
154
|
+
const record = message as { parts?: unknown; content?: unknown }
|
|
155
|
+
const parts = Array.isArray(record.parts) ? record.parts : Array.isArray(record.content) ? record.content : null
|
|
156
|
+
return parts === null ? null : (parts as Part[])
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const durationOf = (part: Part): number | null => {
|
|
160
|
+
const start = part.time?.start
|
|
161
|
+
const end = part.time?.end
|
|
162
|
+
return typeof start === "number" && typeof end === "number" && end >= start ? end - start : null
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The reasoning, text, tool-call and compaction counters of one message. */
|
|
166
|
+
export const turnCounters = (message: unknown): TurnCounters => {
|
|
167
|
+
const parts = partsOf(message)
|
|
168
|
+
if (parts === null) return { ...EMPTY_COUNTERS }
|
|
169
|
+
const counters: TurnCounters = {
|
|
170
|
+
reasoningParts: 0,
|
|
171
|
+
reasoningChars: 0,
|
|
172
|
+
reasoningMs: 0,
|
|
173
|
+
textChars: 0,
|
|
174
|
+
toolCalls: 0,
|
|
175
|
+
compactions: 0,
|
|
176
|
+
}
|
|
177
|
+
let measuredReasoningMs = false
|
|
178
|
+
for (const part of parts) {
|
|
179
|
+
if (part?.type === "reasoning") {
|
|
180
|
+
counters.reasoningParts += 1
|
|
181
|
+
if (typeof part.text === "string") counters.reasoningChars += part.text.length
|
|
182
|
+
const duration = durationOf(part)
|
|
183
|
+
if (duration !== null) {
|
|
184
|
+
counters.reasoningMs = (counters.reasoningMs ?? 0) + duration
|
|
185
|
+
measuredReasoningMs = true
|
|
186
|
+
}
|
|
187
|
+
} else if (part?.type === "text") {
|
|
188
|
+
if (typeof part.text === "string") counters.textChars += part.text.length
|
|
189
|
+
} else if (part?.type === "tool") {
|
|
190
|
+
counters.toolCalls += 1
|
|
191
|
+
} else if (part?.type === "compaction") {
|
|
192
|
+
counters.compactions += 1
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// A reasoning part without a completion stamp leaves the duration unmeasured.
|
|
196
|
+
if (!measuredReasoningMs) counters.reasoningMs = null
|
|
197
|
+
return counters
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** The line count of a result text, or `null` when it is empty. */
|
|
201
|
+
export const lineCount = (text: string): number | null => (text === "" ? null : text.split("\n").length)
|
|
@@ -25,6 +25,14 @@ import { createHash } from "node:crypto"
|
|
|
25
25
|
import fs from "node:fs"
|
|
26
26
|
import path from "node:path"
|
|
27
27
|
import { Plugin } from "@opencode/plugin"
|
|
28
|
+
import {
|
|
29
|
+
errorClassOf,
|
|
30
|
+
intentOf,
|
|
31
|
+
lineCount,
|
|
32
|
+
normalizeTarget,
|
|
33
|
+
targetKeyOf,
|
|
34
|
+
turnCounters,
|
|
35
|
+
} from "./actions.ts"
|
|
28
36
|
import { parseRotateBytes, rotateLedger, ROTATE_BYTES_ENV } from "./ledger.ts"
|
|
29
37
|
import { rewriteMessages } from "./rewrite.ts"
|
|
30
38
|
|
|
@@ -37,6 +45,8 @@ const HEAD_LINES = 40
|
|
|
37
45
|
const TAIL_LINES = 15
|
|
38
46
|
const MAX_TRACKED_SESSIONS = 12
|
|
39
47
|
const DEFAULT_DISCOVERY_MS = 250
|
|
48
|
+
/** The bound on every timing map; a late `after` must not grow a session's heap. */
|
|
49
|
+
const MAX_TIMING_ENTRIES = 256
|
|
40
50
|
const ALLOWLIST = new Set(["shell", "bash", "read", "grep", "glob", "webfetch"])
|
|
41
51
|
|
|
42
52
|
const findTeamRoot = (start: string): string | null => {
|
|
@@ -224,8 +234,8 @@ const commandOf = (input: unknown): string => {
|
|
|
224
234
|
* the bounded replacement from a previous request.
|
|
225
235
|
*/
|
|
226
236
|
const collectToolActivity = (messages: unknown) => {
|
|
227
|
-
const calls = new Map<string, { tool: string; command: string }>()
|
|
228
|
-
const results: Array<{ id: string; tool: string; rawBytes: number; error: boolean }> = []
|
|
237
|
+
const calls = new Map<string, { tool: string; command: string; input: unknown }>()
|
|
238
|
+
const results: Array<{ id: string; tool: string; rawBytes: number; error: boolean; lines: number | null; errorValue: unknown }> = []
|
|
229
239
|
if (!Array.isArray(messages)) return { calls, results }
|
|
230
240
|
for (const message of messages as Array<{ content?: unknown }>) {
|
|
231
241
|
const content = message?.content
|
|
@@ -235,6 +245,7 @@ const collectToolActivity = (messages: unknown) => {
|
|
|
235
245
|
calls.set(item.id, {
|
|
236
246
|
tool: typeof item.name === "string" ? item.name : "",
|
|
237
247
|
command: commandOf(item.input),
|
|
248
|
+
input: item.input,
|
|
238
249
|
})
|
|
239
250
|
}
|
|
240
251
|
if (
|
|
@@ -262,6 +273,10 @@ const collectToolActivity = (messages: unknown) => {
|
|
|
262
273
|
tool: call?.tool ?? (typeof item.name === "string" ? item.name : ""),
|
|
263
274
|
rawBytes: Buffer.byteLength(text, "utf8"),
|
|
264
275
|
error: isError,
|
|
276
|
+
// A JSON-stringified error is one line of host message, not a
|
|
277
|
+
// measurement of the tool's own output.
|
|
278
|
+
lines: typeof item.result.value === "string" ? lineCount(text) : null,
|
|
279
|
+
errorValue: item.result.value,
|
|
265
280
|
})
|
|
266
281
|
}
|
|
267
282
|
}
|
|
@@ -307,6 +322,40 @@ export default Plugin.define({
|
|
|
307
322
|
const toolsetsSeen = loadToolsets(outputDir)
|
|
308
323
|
const childrenByParent = new Map<string, Set<string>>()
|
|
309
324
|
|
|
325
|
+
// `AI_RULES_ACTIONS=0` drops the action and turn rows and nothing else:
|
|
326
|
+
// the rewrite, the stats and the context snapshot keep working, so the
|
|
327
|
+
// guard is still a guard with capture off.
|
|
328
|
+
const actionsEnabled = process.env.AI_RULES_ACTIONS !== "0"
|
|
329
|
+
// Everything below is an observation of something the host actually
|
|
330
|
+
// reported. A missing entry means "not observed", never a zero.
|
|
331
|
+
const sessionAgent = new Map<string, { agent: string | null; model: string | null; variant: string | null }>()
|
|
332
|
+
const sessionParent = new Map<string, string | null>()
|
|
333
|
+
const actionStartedAt = new Map<string, number>()
|
|
334
|
+
const actionTiming = new Map<string, { durationMs: number | null; exit: number | null }>()
|
|
335
|
+
const lastActionAt = new Map<string, number>()
|
|
336
|
+
const repeatsSeen = new Map<string, { callID: string; index: number }>()
|
|
337
|
+
|
|
338
|
+
const bounded = <T>(map: Map<string, T>, key: string, value: T) => {
|
|
339
|
+
map.set(key, value)
|
|
340
|
+
while (map.size > MAX_TIMING_ENTRIES) {
|
|
341
|
+
const oldest = map.keys().next().value
|
|
342
|
+
if (oldest === undefined) break
|
|
343
|
+
map.delete(oldest)
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const actionKeyOf = (input: unknown): string | null => {
|
|
348
|
+
const record = recordOf(input)
|
|
349
|
+
const sessionID = typeof record.sessionID === "string" ? record.sessionID : ""
|
|
350
|
+
const callID = typeof record.callID === "string" ? record.callID : ""
|
|
351
|
+
return sessionID === "" || callID === "" ? null : `${sessionID}|${callID}`
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const exitCodeOf = (value: unknown): number | null => {
|
|
355
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) return null
|
|
356
|
+
return value
|
|
357
|
+
}
|
|
358
|
+
|
|
310
359
|
const rememberChild = (parentID: string, childID: string) => {
|
|
311
360
|
const known = childrenByParent.get(parentID)
|
|
312
361
|
if (known) known.add(childID)
|
|
@@ -396,6 +445,16 @@ export default Plugin.define({
|
|
|
396
445
|
finish?: unknown
|
|
397
446
|
}>) {
|
|
398
447
|
const id = typeof message?.id === "string" ? message.id : ""
|
|
448
|
+
const model = recordOf(message?.model)
|
|
449
|
+
const agent = typeof message?.agent === "string" ? message.agent : null
|
|
450
|
+
const modelId = typeof model.id === "string" ? model.id : null
|
|
451
|
+
if (agent !== null || modelId !== null) {
|
|
452
|
+
sessionAgent.set(sessionID, {
|
|
453
|
+
agent,
|
|
454
|
+
model: modelId,
|
|
455
|
+
variant: typeof model.variant === "string" ? model.variant : null,
|
|
456
|
+
})
|
|
457
|
+
}
|
|
399
458
|
const tokens = message?.tokens
|
|
400
459
|
if (id === "" || !tokens || typeof tokens.input !== "number") continue
|
|
401
460
|
const key = `${sessionID}|${id}`
|
|
@@ -415,8 +474,13 @@ export default Plugin.define({
|
|
|
415
474
|
cost: typeof message.cost === "number" ? message.cost : 0,
|
|
416
475
|
finish: typeof message.finish === "string" ? message.finish : "",
|
|
417
476
|
}
|
|
477
|
+
if (actionsEnabled) {
|
|
478
|
+
// Counts and lengths only: no reasoning, text or compaction
|
|
479
|
+
// content ever reaches the ledger.
|
|
480
|
+
Object.assign(row, turnCounters(message))
|
|
481
|
+
}
|
|
418
482
|
if (parentSessionID !== undefined) row.parentSessionID = parentSessionID
|
|
419
|
-
appendJsonl(outputDir, "usage.jsonl", row)
|
|
483
|
+
if (actionsEnabled) appendJsonl(outputDir, "usage.jsonl", row)
|
|
420
484
|
}
|
|
421
485
|
} catch {
|
|
422
486
|
/* fail open: usage is an observation, not a guard input */
|
|
@@ -427,6 +491,7 @@ export default Plugin.define({
|
|
|
427
491
|
const queue: Array<{ id: string; parentSessionID?: string }> = [
|
|
428
492
|
{ id: sessionID, parentSessionID: await parentOf(sessionID) },
|
|
429
493
|
]
|
|
494
|
+
sessionParent.set(sessionID, queue[0].parentSessionID ?? null)
|
|
430
495
|
const visited = new Set([sessionID])
|
|
431
496
|
for (let index = 0; index < queue.length && index < MAX_TRACKED_SESSIONS; index += 1) {
|
|
432
497
|
const current = queue[index]
|
|
@@ -528,8 +593,10 @@ export default Plugin.define({
|
|
|
528
593
|
if (resultsSeen.has(key)) continue
|
|
529
594
|
resultsSeen.add(key)
|
|
530
595
|
const changed = changedById.get(item.id)
|
|
531
|
-
|
|
532
|
-
|
|
596
|
+
const call = calls.get(item.id)
|
|
597
|
+
const at = Date.now()
|
|
598
|
+
const row: Record<string, unknown> = {
|
|
599
|
+
at: new Date(at).toISOString(),
|
|
533
600
|
sessionID,
|
|
534
601
|
callID: item.id,
|
|
535
602
|
tool: item.tool,
|
|
@@ -540,7 +607,51 @@ export default Plugin.define({
|
|
|
540
607
|
path: changed?.path ?? "",
|
|
541
608
|
// Absence means non-error; only the host's error variant carries the key.
|
|
542
609
|
...(item.error ? { error: true } : {}),
|
|
543
|
-
}
|
|
610
|
+
}
|
|
611
|
+
if (actionsEnabled) {
|
|
612
|
+
// Guarded on its own: a capture failure must not skip discovery.
|
|
613
|
+
try {
|
|
614
|
+
const targetKey = targetKeyOf(item.tool, normalizeTarget(call?.input, projectRoot))
|
|
615
|
+
const previousAt = lastActionAt.get(sessionID)
|
|
616
|
+
const timing = actionTiming.get(key)
|
|
617
|
+
actionTiming.delete(key)
|
|
618
|
+
actionStartedAt.delete(key)
|
|
619
|
+
const parentSessionID = sessionParent.get(sessionID)
|
|
620
|
+
row.intent = intentOf(item.tool, call?.command ?? "")
|
|
621
|
+
row.lines = item.lines
|
|
622
|
+
row.truncated = changed !== undefined
|
|
623
|
+
row.errorClass = errorClassOf(item.error ? "error" : "text", item.errorValue)
|
|
624
|
+
row.durationMs = timing?.durationMs ?? null
|
|
625
|
+
row.exit = timing?.exit ?? null
|
|
626
|
+
// The gap is the distance to the previous observed action of
|
|
627
|
+
// this session; the first one has nothing to measure from.
|
|
628
|
+
row.gapMs = previousAt === undefined ? null : at - previousAt
|
|
629
|
+
if (targetKey !== null) {
|
|
630
|
+
row.targetKey = targetKey
|
|
631
|
+
const repeatKey = `${sessionID}|${targetKey}`
|
|
632
|
+
const previous = repeatsSeen.get(repeatKey)
|
|
633
|
+
if (previous === undefined) {
|
|
634
|
+
bounded(repeatsSeen, repeatKey, { callID: item.id, index: 1 })
|
|
635
|
+
} else {
|
|
636
|
+
row.repeatOf = previous.callID
|
|
637
|
+
row.repeatIndex = previous.index + 1
|
|
638
|
+
bounded(repeatsSeen, repeatKey, { callID: previous.callID, index: previous.index + 1 })
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const meta = sessionAgent.get(sessionID)
|
|
642
|
+
if (meta !== undefined) {
|
|
643
|
+
row.agent = meta.agent
|
|
644
|
+
row.model = meta.model
|
|
645
|
+
row.variant = meta.variant
|
|
646
|
+
}
|
|
647
|
+
if (parentSessionID !== undefined && parentSessionID !== null) row.parentSessionID = parentSessionID
|
|
648
|
+
bounded(lastActionAt, sessionID, at)
|
|
649
|
+
} catch {
|
|
650
|
+
/* an unobserved action is a missing field, never a failed call */
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
// The kill switch drops the row itself, not just its fields.
|
|
654
|
+
if (actionsEnabled) appendJsonl(outputDir, "results.jsonl", row)
|
|
544
655
|
}
|
|
545
656
|
// Detached after the rewrite: the tool result must never depend on
|
|
546
657
|
// discovery, and the deadline keeps a hung host from holding a task.
|
|
@@ -561,6 +672,36 @@ export default Plugin.define({
|
|
|
561
672
|
}
|
|
562
673
|
}
|
|
563
674
|
})
|
|
675
|
+
// The installed plugin API declares `tool.execute.before` / `.after`
|
|
676
|
+
// (`@opencode-ai/plugin@1.18.31` `dist/index.d.ts:235,249`) and no other
|
|
677
|
+
// file in this repository has ever registered them, so their dispatch is
|
|
678
|
+
// unverified. They fill `durationMs` and `exit` when they fire and cost
|
|
679
|
+
// one bounded Map write when they do not; registration is separate and
|
|
680
|
+
// guarded so a host that rejects the names keeps the hook above.
|
|
681
|
+
if (actionsEnabled) {
|
|
682
|
+
try {
|
|
683
|
+
await ctx.session.hook("tool.execute.before", async (input: unknown) => {
|
|
684
|
+
const key = actionKeyOf(input)
|
|
685
|
+
if (key !== null) bounded(actionStartedAt, key, Date.now())
|
|
686
|
+
})
|
|
687
|
+
await ctx.session.hook("tool.execute.after", async (input: unknown, output: unknown) => {
|
|
688
|
+
const key = actionKeyOf(input)
|
|
689
|
+
if (key === null) return
|
|
690
|
+
const startedAt = actionStartedAt.get(key)
|
|
691
|
+
actionStartedAt.delete(key)
|
|
692
|
+
// VERIFY: the exit code of a shell call inside `metadata` (host v2).
|
|
693
|
+
// Both names are read defensively; neither is asserted to exist.
|
|
694
|
+
const metadata = recordOf(recordOf(output).metadata)
|
|
695
|
+
const exit = exitCodeOf(metadata.exit) ?? exitCodeOf(recordOf(input).exit)
|
|
696
|
+
bounded(actionTiming, key, {
|
|
697
|
+
durationMs: startedAt === undefined ? null : Date.now() - startedAt,
|
|
698
|
+
exit,
|
|
699
|
+
})
|
|
700
|
+
})
|
|
701
|
+
} catch {
|
|
702
|
+
/* a host without the timing hooks records null duration and exit */
|
|
703
|
+
}
|
|
704
|
+
}
|
|
564
705
|
} catch (error) {
|
|
565
706
|
if (process.env.AI_RULES_OUTPUT_GUARD_DEBUG === "1") {
|
|
566
707
|
appendJsonl(
|
|
@@ -117,9 +117,14 @@ const joinedSlice = (lines: string[], start: number, count: number): string =>
|
|
|
117
117
|
lines.slice(start, start + count).join("\n")
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
* The 8–20 KB band names the gap. A whole-line gap
|
|
121
|
-
*
|
|
122
|
-
*
|
|
120
|
+
* The 8–20 KB band names the gap. A whole-line gap names a `grep -n` term
|
|
121
|
+
* instead of a line range: a range invites the same file to be read again in
|
|
122
|
+
* overlapping windows. The term is taken from the elided lines, not the head —
|
|
123
|
+
* a head token greps back the content the model already holds. A whole-line gap
|
|
124
|
+
* with no usable token keeps the `elided lines A..B` marker as its only
|
|
125
|
+
* recovery path: a fabricated term would be a `grep` that matches nothing. A
|
|
126
|
+
* head or tail cut mid-line (or a one-line payload) names a byte window: a
|
|
127
|
+
* lookup would skip the rest of the cut line, and `grep` past EOF is empty.
|
|
123
128
|
* JSON keys are listed only when they sit in that gap.
|
|
124
129
|
*/
|
|
125
130
|
export const renderStructured = (
|
|
@@ -129,7 +134,6 @@ export const renderStructured = (
|
|
|
129
134
|
): string => {
|
|
130
135
|
const head = takeHead(value, options.headBytes, options.headLines)
|
|
131
136
|
const tail = takeTail(value, options.tailBytes, options.tailLines)
|
|
132
|
-
const term = searchTerm(head, "")
|
|
133
137
|
const total = bytes(value)
|
|
134
138
|
const lines = value.split("\n")
|
|
135
139
|
const headLinesUsed = head === "" ? 0 : head.split("\n").length
|
|
@@ -156,10 +160,13 @@ export const renderStructured = (
|
|
|
156
160
|
if (at < headBytes || at >= total - tailBytes) return []
|
|
157
161
|
return [line > 0 ? `"${key}" (line ${line})` : `"${key}"`]
|
|
158
162
|
}).slice(0, 12)
|
|
163
|
+
const elidedLines = lineRange ? lines.slice(firstElided - 1, lastElided) : []
|
|
164
|
+
const elidedTerm = elidedLines.length === 0 ? "" : searchTerm(elidedLines.join("\n"), "")
|
|
159
165
|
const hints = [
|
|
160
|
-
term !== "" && value.includes(term) ? `${options.marker} search: grep -n '${term}' ${file}` : "",
|
|
161
166
|
lineRange
|
|
162
|
-
?
|
|
167
|
+
? elidedTerm === ""
|
|
168
|
+
? ""
|
|
169
|
+
: `${options.marker} read more: grep -n '${elidedTerm}' ${file}`
|
|
163
170
|
: elidedBytes > 0
|
|
164
171
|
? `${options.marker} read more: tail -c +${headBytes + 1} ${file} | head -c ${elidedBytes}`
|
|
165
172
|
: "",
|
|
@@ -184,7 +191,7 @@ export const renderReplacement = (
|
|
|
184
191
|
): string => {
|
|
185
192
|
const head = takeHead(value, options.headBytes, options.headLines)
|
|
186
193
|
const tail = takeTail(value, options.tailBytes, options.tailLines)
|
|
187
|
-
const term = searchTerm(head, "
|
|
194
|
+
const term = searchTerm(head, "")
|
|
188
195
|
const total = bytes(value)
|
|
189
196
|
const json = looksJson(value) ? " [json: full document at the path]" : ""
|
|
190
197
|
return [
|
|
@@ -193,8 +200,7 @@ export const renderReplacement = (
|
|
|
193
200
|
"... (truncated)",
|
|
194
201
|
tail,
|
|
195
202
|
`${options.marker} full output: ${file} (${total} B)`,
|
|
196
|
-
`${options.marker}
|
|
197
|
-
`${options.marker} read more: sed -n '${options.headLines + 1},${options.headLines + 80}p' ${file}`,
|
|
203
|
+
...(term === "" ? [] : [`${options.marker} read more: grep -n '${term}' ${file}`]),
|
|
198
204
|
].join("\n")
|
|
199
205
|
}
|
|
200
206
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"platform": "opencode",
|
|
4
4
|
"stack": "svelte",
|
|
5
5
|
"semanticSource": "cursor/svelte",
|
|
6
|
-
"sourceRevision": "
|
|
6
|
+
"sourceRevision": "3f43fb4367fcf2ee8f0b4315822406a92437e8df96e68adb0b7f99c7bea81945",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
9
9
|
"source": "AGENTS.md",
|
|
@@ -269,6 +269,14 @@
|
|
|
269
269
|
"loadMode": "native-skill",
|
|
270
270
|
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
271
271
|
},
|
|
272
|
+
{
|
|
273
|
+
"source": "commands/rr-scheduler-start.md",
|
|
274
|
+
"target": "commands/rr-scheduler-start.md",
|
|
275
|
+
"category": "commands",
|
|
276
|
+
"disposition": "transform",
|
|
277
|
+
"loadMode": "native-skill",
|
|
278
|
+
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
279
|
+
},
|
|
272
280
|
{
|
|
273
281
|
"source": "commands/spec-start.md",
|
|
274
282
|
"target": "commands/spec-start.md",
|
|
@@ -72,7 +72,7 @@ Before you run the project gate and write the terminal validation receipt, self-
|
|
|
72
72
|
|
|
73
73
|
Record a `## Self-review` block in `validation-report.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
|
|
74
74
|
|
|
75
|
-
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing.
|
|
75
|
+
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
|
|
76
76
|
|
|
77
77
|
## Output
|
|
78
78
|
|
|
@@ -65,7 +65,7 @@ Before you emit the terminal review receipt, self-audit the review artifact: eve
|
|
|
65
65
|
|
|
66
66
|
Record a `## Self-review` block in `review.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
|
|
67
67
|
|
|
68
|
-
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Append each finding to `review-ledger.md` (`disposition: open`) before the receipt.
|
|
68
|
+
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Append each finding to `review-ledger.md` (`disposition: open`) before the receipt. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
|
|
69
69
|
|
|
70
70
|
## Review artifact
|
|
71
71
|
|
|
@@ -105,7 +105,7 @@ Before you set `fixApplied: true` and emit the terminal receipt, self-audit the
|
|
|
105
105
|
|
|
106
106
|
Record a `## Self-review` block in `debug-report.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
|
|
107
107
|
|
|
108
|
-
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing.
|
|
108
|
+
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
|
|
109
109
|
|
|
110
110
|
## MCP usage
|
|
111
111
|
|
|
@@ -112,7 +112,7 @@ Before you emit the terminal implementation receipt (per wave for multi-wave wor
|
|
|
112
112
|
|
|
113
113
|
Record a `## Self-review` block in `implementation.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
|
|
114
114
|
|
|
115
|
-
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing.
|
|
115
|
+
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
|
|
116
116
|
|
|
117
117
|
## Anti-hallucination (Svelte / SvelteKit / Svelte stores/runes)
|
|
118
118
|
|
|
@@ -76,7 +76,7 @@ Before you emit the terminal analysis receipt, self-audit the goal frame and dec
|
|
|
76
76
|
|
|
77
77
|
Record a `## Self-review` block in `brief.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
|
|
78
78
|
|
|
79
|
-
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing.
|
|
79
|
+
A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
|
|
80
80
|
|
|
81
81
|
## Clarification cycle (must)
|
|
82
82
|
|
|
@@ -49,3 +49,7 @@ Slash commands are copied to `.opencode/commands/` on `ai-rules init opencode --
|
|
|
49
49
|
- Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json`)
|
|
50
50
|
|
|
51
51
|
Create and edit commands via `/commands` in Cursor or directly in this preset folder.
|
|
52
|
+
|
|
53
|
+
## Scheduler
|
|
54
|
+
|
|
55
|
+
- **`/rr-scheduler-start`** — start the team-db scheduler, or restart it when one already holds the lease. `init` seeds `.ai.local/scripts/rr-scheduler-start.mjs`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Start the team-db scheduler, or restart it when one is already running."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Invocation arguments
|
|
6
|
+
|
|
7
|
+
$ARGUMENTS
|
|
8
|
+
|
|
9
|
+
# Start or restart the scheduler
|
|
10
|
+
|
|
11
|
+
Bring up `team-db.mjs schedule` for this repository. When a scheduler already holds the lease, stop that process and start a new one.
|
|
12
|
+
|
|
13
|
+
## What to do
|
|
14
|
+
|
|
15
|
+
1. From the repository root, run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
node .ai.local/scripts/rr-scheduler-start.mjs
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Quote the stdout verbatim. A start prints `scheduler: started pid <pid>`. A restart prints `scheduler: restarted pid <pid> (stopped <previous>)`, plus the `processes:` lines from the manager.
|
|
22
|
+
3. On a non-zero exit, quote the `error:` line verbatim and stop. Do not start `team-db.mjs schedule` by hand and do not signal a pid the script did not name.
|
|
23
|
+
|
|
24
|
+
## What the script does
|
|
25
|
+
|
|
26
|
+
- Stops a scheduler this repository recorded, via `processes.mjs stop --name scheduler`.
|
|
27
|
+
- Signals a scheduler that was started outside the manager only when `scheduler.lock` names a live pid whose command line is `team-db.mjs schedule`. `SIGTERM`, then `SIGKILL` if it is still alive after 8 seconds. An in-flight child can outlive that kill.
|
|
28
|
+
- Removes `scheduler.lock` when its pid is already dead, so a crash does not block the next start for 90 seconds.
|
|
29
|
+
- Starts the timer through `processes.mjs start --name scheduler` with `exec node .ai.local/scripts/team-db.mjs schedule`, then waits until the new lease is fresh.
|
|
30
|
+
|
|
31
|
+
## Do not
|
|
32
|
+
|
|
33
|
+
- Write `status.json`, `metrics.json`, or any task or lifecycle file.
|
|
34
|
+
- Run `pkill`, `killall`, or `kill` against a pid the script did not print.
|
|
35
|
+
- Start a second `team-db.mjs schedule` after a non-zero exit.
|
|
@@ -57,12 +57,26 @@ function readSessionLease(id) {
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
// The lease carries the window the projector attributes rows with — never one
|
|
61
|
+
// instant. `firstSeenAt` survives every later write of the same (session, slug)
|
|
62
|
+
// pair; a different slug starts a new window, and a lease older than the TTL
|
|
63
|
+
// starts over instead of claiming an ancient first sighting.
|
|
64
|
+
function firstSeenAtOf(file, value, now) {
|
|
65
|
+
try {
|
|
66
|
+
if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
|
|
67
|
+
const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
68
|
+
if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
|
|
69
|
+
} catch {}
|
|
70
|
+
return now;
|
|
71
|
+
}
|
|
60
72
|
function writeSessionLease(id, value) {
|
|
61
73
|
try {
|
|
62
74
|
fs.mkdirSync(LEASE_ROOT, { recursive: true });
|
|
63
75
|
const file = sessionLeasePath(id);
|
|
64
76
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
65
|
-
|
|
77
|
+
const now = new Date().toISOString();
|
|
78
|
+
const firstSeenAt = firstSeenAtOf(file, value, now);
|
|
79
|
+
fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
|
|
66
80
|
fs.renameSync(temporary, file);
|
|
67
81
|
for (const name of fs.readdirSync(LEASE_ROOT)) {
|
|
68
82
|
if (!name.endsWith('.json')) continue;
|