@bonesofspring/ai-rules 0.2.86 → 0.2.90
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 +60 -0
- package/README.md +9 -1
- package/bin/lib/engine-scripts.js +11 -0
- package/bin/lib/seed-ai-local-team.js +79 -2
- package/bin/opencode-install.js +14 -12
- package/docs/OPENCODE-COMPATIBILITY.md +6 -4
- package/docs/OPENCODE.md +15 -8
- package/docs/PRESET-CONTRIBUTION.md +6 -6
- package/docs/TOKEN-ECONOMY.md +20 -0
- package/docs/openapi/team-db.v1.json +2 -2
- package/package.json +1 -1
- package/presets/_shared/ai-local/env.example +54 -0
- package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +34 -5
- package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +25 -22
- package/presets/_shared/ai-local/scripts/process-lease.mjs +3 -2
- package/presets/_shared/ai-local/scripts/processes.mjs +52 -20
- package/presets/_shared/ai-local/scripts/report-step-cost.mjs +544 -0
- package/presets/_shared/ai-local/scripts/run.mjs +38 -6
- package/presets/_shared/ai-local/scripts/settings.mjs +246 -0
- package/presets/_shared/ai-local/scripts/task-worktree.mjs +364 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +2 -2
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +87 -14
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +102 -12
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +35 -0
- package/presets/_shared/ai-local/scripts/tracker-planned-drain.mjs +10 -1
- package/presets/_shared/ai-local/scripts/verification.mjs +106 -11
- package/presets/_shared/assets/model-tiers.json +6 -0
- package/presets/_shared/core/agent-team/agent-task-metrics.md +10 -2
- package/presets/_shared/core/agent-team/agent-team-intake.md +2 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -5
- package/presets/_shared/core/meta/preset-writing-style.md +8 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +541 -61
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +841 -97
- package/presets/_shared/hooks/prompt-autoroute.mjs.tmpl +153 -0
- package/presets/claude/android-kotlin/CLAUDE.md +2 -4
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/android-kotlin/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/android-kotlin/settings.json +15 -5
- package/presets/claude/go/CLAUDE.md +2 -4
- package/presets/claude/go/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/go/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/go/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/go/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/go/settings.json +15 -5
- package/presets/claude/ios-swift/CLAUDE.md +2 -4
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/ios-swift/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/ios-swift/settings.json +15 -5
- package/presets/claude/java/CLAUDE.md +2 -4
- package/presets/claude/java/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/java/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/java/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/java/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/java/settings.json +15 -5
- package/presets/claude/mcp-ts/CLAUDE.md +2 -4
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/mcp-ts/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/mcp-ts/settings.json +15 -5
- package/presets/claude/mol/CLAUDE.md +2 -4
- package/presets/claude/mol/agents/feature-developer.md +1 -1
- package/presets/claude/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/claude/mol/commands/task-evil.md +8 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/mol/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/mol/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/mol/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/mol/settings.json +15 -4
- package/presets/claude/next/CLAUDE.md +2 -4
- package/presets/claude/next/REPO_AGENTS.md +2 -0
- package/presets/claude/next/agents/feature-developer.md +1 -1
- package/presets/claude/next/agents/task-analyst.md +1 -7
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/claude/next/commands/spec-start.md +3 -4
- package/presets/claude/next/commands/task-continue.md +9 -8
- package/presets/claude/next/commands/task-evil.md +8 -0
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/next/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/next/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/next/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/next/settings.json +15 -4
- package/presets/claude/next/team/README.md +1 -1
- package/presets/claude/nuxt/CLAUDE.md +2 -4
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/nuxt/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/nuxt/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/nuxt/settings.json +15 -4
- package/presets/claude/php-hexagonal/CLAUDE.md +2 -4
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/php-hexagonal/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/php-hexagonal/settings.json +15 -5
- package/presets/claude/php-laravel/CLAUDE.md +2 -4
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/php-laravel/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/php-laravel/settings.json +15 -5
- package/presets/claude/svelte/CLAUDE.md +2 -4
- package/presets/claude/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +841 -97
- package/presets/claude/svelte/hooks/prompt-autoroute.mjs +153 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/svelte/rules/tooling-and-review/preset-writing-style.md +8 -0
- package/presets/claude/svelte/settings.json +15 -4
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/android-kotlin/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/go/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/go/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/go/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/ios-swift/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/java/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/java/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/java/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/mcp-ts/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/mol/agents/feature-developer.md +1 -1
- package/presets/cursor/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/cursor/mol/commands/task-evil.md +8 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/mol/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/mol/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/next/REPO_AGENTS.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -7
- package/presets/cursor/next/agents/task-router.md +1 -1
- package/presets/cursor/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/cursor/next/commands/spec-start.md +3 -4
- package/presets/cursor/next/commands/task-continue.md +9 -8
- package/presets/cursor/next/commands/task-evil.md +8 -0
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/next/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/next/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +5 -5
- package/presets/cursor/next/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/next/team/README.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/nuxt/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/nuxt/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/php-hexagonal/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/php-laravel/rules/preset-writing-style.mdc +8 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +841 -97
- package/presets/cursor/svelte/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/svelte/rules/preset-writing-style.mdc +8 -0
- package/presets/mavis/android-kotlin/MAVIS.md +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/android-kotlin/rules/agent-team-intake.md +2 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/android-kotlin/rules/preset-writing-style.md +8 -0
- package/presets/mavis/go/MAVIS.md +1 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/go/rules/agent-team-intake.md +2 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/go/rules/preset-writing-style.md +8 -0
- package/presets/mavis/ios-swift/MAVIS.md +1 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/ios-swift/rules/agent-team-intake.md +2 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/ios-swift/rules/preset-writing-style.md +8 -0
- package/presets/mavis/java/MAVIS.md +1 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/java/rules/agent-team-intake.md +2 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/java/rules/preset-writing-style.md +8 -0
- package/presets/mavis/mcp-ts/MAVIS.md +1 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/mcp-ts/rules/agent-team-intake.md +2 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/mcp-ts/rules/preset-writing-style.md +8 -0
- package/presets/mavis/mol/MAVIS.md +1 -1
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/feature-developer.md +1 -1
- package/presets/mavis/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/mavis/mol/commands/task-evil.md +8 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/mol/native-skills/task-evil/SKILL.md +8 -0
- package/presets/mavis/mol/rules/agent-team-intake.md +2 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/mol/rules/preset-writing-style.md +8 -0
- package/presets/mavis/next/MAVIS.md +1 -1
- package/presets/mavis/next/REPO_AGENTS.md +2 -0
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/feature-developer.md +1 -1
- package/presets/mavis/next/agents/task-analyst.md +1 -7
- package/presets/mavis/next/agents/task-router.md +1 -1
- package/presets/mavis/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/mavis/next/commands/spec-start.md +3 -4
- package/presets/mavis/next/commands/task-continue.md +9 -8
- package/presets/mavis/next/commands/task-evil.md +8 -0
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/next/native-skills/spec-start/SKILL.md +3 -4
- package/presets/mavis/next/native-skills/task/SKILL.md +1 -1
- package/presets/mavis/next/native-skills/task-continue/SKILL.md +9 -8
- package/presets/mavis/next/native-skills/task-evil/SKILL.md +8 -0
- package/presets/mavis/next/rules/agent-team-intake.md +2 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/next/rules/preset-writing-style.md +8 -0
- package/presets/mavis/next/team/README.md +1 -1
- package/presets/mavis/nuxt/MAVIS.md +1 -1
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/nuxt/rules/agent-team-intake.md +2 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/nuxt/rules/preset-writing-style.md +8 -0
- package/presets/mavis/php-hexagonal/MAVIS.md +1 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +2 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/php-hexagonal/rules/preset-writing-style.md +8 -0
- package/presets/mavis/php-laravel/MAVIS.md +1 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/php-laravel/rules/agent-team-intake.md +2 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/php-laravel/rules/preset-writing-style.md +8 -0
- package/presets/mavis/svelte/MAVIS.md +1 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/mavis/svelte/rules/agent-team-intake.md +2 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/svelte/rules/preset-writing-style.md +8 -0
- package/presets/opencode/android-kotlin/OPENCODE.md +5 -66
- package/presets/opencode/android-kotlin/adapter-map.json +42 -42
- package/presets/opencode/android-kotlin/agents/accessibility-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/opencode/android-kotlin/agents/ci-investigator.md +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/codebase-analyzer.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/instrumentation-test-generator.md +1 -1
- package/presets/opencode/android-kotlin/agents/instrumentation-test-healer.md +1 -1
- package/presets/opencode/android-kotlin/agents/instrumentation-test-planner.md +1 -1
- package/presets/opencode/android-kotlin/agents/migration-specialist.md +1 -1
- package/presets/opencode/android-kotlin/agents/mockup-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/openspec-author.md +1 -1
- package/presets/opencode/android-kotlin/agents/performance-auditor.md +1 -1
- package/presets/opencode/android-kotlin/agents/qa-tester.md +1 -1
- package/presets/opencode/android-kotlin/agents/security-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/solution-architect.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-router.md +1 -1
- package/presets/opencode/android-kotlin/agents/tech-writer.md +1 -1
- package/presets/opencode/android-kotlin/agents/unit-test-generator.md +1 -1
- package/presets/opencode/android-kotlin/agents/unit-test-healer.md +1 -1
- package/presets/opencode/android-kotlin/agents/unit-test-planner.md +1 -1
- package/presets/opencode/android-kotlin/commands/task-continue.md +1 -1
- package/presets/opencode/android-kotlin/hooks/README.md +12 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/android-kotlin/hooks/guard-shell-command.mjs +879 -0
- package/presets/opencode/android-kotlin/opencode.json +4 -4
- package/presets/opencode/android-kotlin/plugins/rule-attach/globs.json +167 -0
- package/presets/opencode/android-kotlin/rules/agent-team-intake.md +2 -0
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/android-kotlin/rules/preset-writing-style.md +8 -0
- package/presets/opencode/go/OPENCODE.md +5 -51
- package/presets/opencode/go/adapter-map.json +45 -45
- package/presets/opencode/go/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/go/agents/build-verifier.md +1 -1
- package/presets/opencode/go/agents/ci-investigator.md +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -1
- package/presets/opencode/go/agents/codebase-analyzer.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/integration-test-generator.md +1 -1
- package/presets/opencode/go/agents/integration-test-healer.md +1 -1
- package/presets/opencode/go/agents/integration-test-planner.md +1 -1
- package/presets/opencode/go/agents/migration-specialist.md +1 -1
- package/presets/opencode/go/agents/openspec-author.md +1 -1
- package/presets/opencode/go/agents/performance-auditor.md +1 -1
- package/presets/opencode/go/agents/qa-tester.md +1 -1
- package/presets/opencode/go/agents/security-reviewer.md +1 -1
- package/presets/opencode/go/agents/solution-architect.md +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/agents/task-router.md +1 -1
- package/presets/opencode/go/agents/tech-writer.md +1 -1
- package/presets/opencode/go/agents/unit-test-generator.md +1 -1
- package/presets/opencode/go/agents/unit-test-healer.md +1 -1
- package/presets/opencode/go/agents/unit-test-planner.md +1 -1
- package/presets/opencode/go/commands/task-continue.md +1 -1
- package/presets/opencode/go/hooks/README.md +12 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/go/hooks/guard-shell-command.mjs +878 -0
- package/presets/opencode/go/opencode.json +4 -4
- package/presets/opencode/go/plugins/rule-attach/globs.json +198 -0
- package/presets/opencode/go/rules/agent-team-intake.md +2 -0
- package/presets/opencode/go/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/go/rules/preset-writing-style.md +8 -0
- package/presets/opencode/ios-swift/OPENCODE.md +5 -66
- package/presets/opencode/ios-swift/adapter-map.json +41 -41
- package/presets/opencode/ios-swift/agents/accessibility-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/opencode/ios-swift/agents/ci-investigator.md +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/codebase-analyzer.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/migration-specialist.md +1 -1
- package/presets/opencode/ios-swift/agents/mockup-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/openspec-author.md +1 -1
- package/presets/opencode/ios-swift/agents/performance-auditor.md +1 -1
- package/presets/opencode/ios-swift/agents/qa-tester.md +1 -1
- package/presets/opencode/ios-swift/agents/security-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/solution-architect.md +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/agents/task-router.md +1 -1
- package/presets/opencode/ios-swift/agents/tech-writer.md +1 -1
- package/presets/opencode/ios-swift/agents/unit-test-generator.md +1 -1
- package/presets/opencode/ios-swift/agents/unit-test-healer.md +1 -1
- package/presets/opencode/ios-swift/agents/unit-test-planner.md +1 -1
- package/presets/opencode/ios-swift/agents/xcuitest-test-generator.md +1 -1
- package/presets/opencode/ios-swift/agents/xcuitest-test-healer.md +1 -1
- package/presets/opencode/ios-swift/agents/xcuitest-test-planner.md +1 -1
- package/presets/opencode/ios-swift/commands/task-continue.md +1 -1
- package/presets/opencode/ios-swift/hooks/README.md +12 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/ios-swift/hooks/guard-shell-command.mjs +878 -0
- package/presets/opencode/ios-swift/opencode.json +4 -4
- package/presets/opencode/ios-swift/plugins/rule-attach/globs.json +160 -0
- package/presets/opencode/ios-swift/rules/agent-team-intake.md +2 -0
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/ios-swift/rules/preset-writing-style.md +8 -0
- package/presets/opencode/java/OPENCODE.md +5 -58
- package/presets/opencode/java/adapter-map.json +45 -45
- package/presets/opencode/java/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/java/agents/build-verifier.md +1 -1
- package/presets/opencode/java/agents/ci-investigator.md +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -1
- package/presets/opencode/java/agents/codebase-analyzer.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/integration-test-generator.md +1 -1
- package/presets/opencode/java/agents/integration-test-healer.md +1 -1
- package/presets/opencode/java/agents/integration-test-planner.md +1 -1
- package/presets/opencode/java/agents/migration-specialist.md +1 -1
- package/presets/opencode/java/agents/openspec-author.md +1 -1
- package/presets/opencode/java/agents/performance-auditor.md +1 -1
- package/presets/opencode/java/agents/qa-tester.md +1 -1
- package/presets/opencode/java/agents/security-reviewer.md +1 -1
- package/presets/opencode/java/agents/solution-architect.md +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/agents/task-router.md +1 -1
- package/presets/opencode/java/agents/tech-writer.md +1 -1
- package/presets/opencode/java/agents/unit-test-generator.md +1 -1
- package/presets/opencode/java/agents/unit-test-healer.md +1 -1
- package/presets/opencode/java/agents/unit-test-planner.md +1 -1
- package/presets/opencode/java/commands/task-continue.md +1 -1
- package/presets/opencode/java/hooks/README.md +12 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/java/hooks/guard-shell-command.mjs +879 -0
- package/presets/opencode/java/opencode.json +4 -4
- package/presets/opencode/java/plugins/rule-attach/globs.json +230 -0
- package/presets/opencode/java/rules/agent-team-intake.md +2 -0
- package/presets/opencode/java/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/java/rules/preset-writing-style.md +8 -0
- package/presets/opencode/mcp-ts/OPENCODE.md +5 -48
- package/presets/opencode/mcp-ts/adapter-map.json +36 -36
- 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/security-reviewer.md +1 -1
- package/presets/opencode/mcp-ts/agents/solution-architect.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-router.md +1 -1
- package/presets/opencode/mcp-ts/commands/task-continue.md +1 -1
- package/presets/opencode/mcp-ts/hooks/README.md +12 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/mcp-ts/hooks/guard-shell-command.mjs +878 -0
- package/presets/opencode/mcp-ts/opencode.json +4 -4
- package/presets/opencode/mcp-ts/plugins/rule-attach/globs.json +151 -0
- package/presets/opencode/mcp-ts/rules/agent-team-intake.md +2 -0
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/mcp-ts/rules/preset-writing-style.md +8 -0
- package/presets/opencode/mol/OPENCODE.md +5 -56
- package/presets/opencode/mol/adapter-map.json +31 -31
- package/presets/opencode/mol/agents/accessibility-reviewer.md +1 -1
- package/presets/opencode/mol/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/mol/agents/build-verifier.md +1 -1
- package/presets/opencode/mol/agents/ci-investigator.md +1 -1
- package/presets/opencode/mol/agents/code-reviewer.md +1 -1
- package/presets/opencode/mol/agents/codebase-analyzer.md +1 -1
- package/presets/opencode/mol/agents/debugger.md +1 -1
- package/presets/opencode/mol/agents/feature-developer.md +2 -2
- package/presets/opencode/mol/agents/migration-specialist.md +1 -1
- package/presets/opencode/mol/agents/mockup-reviewer.md +1 -1
- package/presets/opencode/mol/agents/openspec-author.md +1 -1
- package/presets/opencode/mol/agents/performance-auditor.md +1 -1
- package/presets/opencode/mol/agents/playwright-test-generator.md +1 -1
- package/presets/opencode/mol/agents/playwright-test-healer.md +1 -1
- package/presets/opencode/mol/agents/playwright-test-planner.md +1 -1
- package/presets/opencode/mol/agents/qa-tester.md +1 -1
- package/presets/opencode/mol/agents/security-reviewer.md +1 -1
- package/presets/opencode/mol/agents/solution-architect.md +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/agents/task-router.md +1 -1
- package/presets/opencode/mol/agents/tech-writer.md +1 -1
- package/presets/opencode/mol/agents/unit-test-generator.md +1 -1
- package/presets/opencode/mol/agents/unit-test-healer.md +1 -1
- package/presets/opencode/mol/agents/unit-test-planner.md +1 -1
- package/presets/opencode/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/opencode/mol/commands/task-continue.md +1 -1
- package/presets/opencode/mol/commands/task-evil.md +8 -0
- package/presets/opencode/mol/hooks/README.md +12 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/mol/hooks/guard-shell-command.mjs +877 -0
- package/presets/opencode/mol/opencode.json +4 -4
- package/presets/opencode/mol/plugins/rule-attach/globs.json +112 -0
- package/presets/opencode/mol/rules/agent-team-intake.md +2 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/mol/rules/preset-writing-style.md +8 -0
- package/presets/opencode/next/OPENCODE.md +5 -55
- package/presets/opencode/next/REPO_AGENTS.md +2 -0
- package/presets/opencode/next/adapter-map.json +56 -56
- package/presets/opencode/next/agents/accessibility-reviewer.md +1 -1
- package/presets/opencode/next/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/ci-investigator.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -1
- package/presets/opencode/next/agents/codebase-analyzer.md +1 -1
- package/presets/opencode/next/agents/debugger.md +1 -1
- package/presets/opencode/next/agents/feature-developer.md +2 -2
- package/presets/opencode/next/agents/migration-specialist.md +1 -1
- package/presets/opencode/next/agents/mockup-reviewer.md +1 -1
- package/presets/opencode/next/agents/openspec-author.md +1 -1
- package/presets/opencode/next/agents/performance-auditor.md +1 -1
- package/presets/opencode/next/agents/playwright-test-generator.md +1 -1
- package/presets/opencode/next/agents/playwright-test-healer.md +1 -1
- package/presets/opencode/next/agents/playwright-test-planner.md +1 -1
- package/presets/opencode/next/agents/qa-tester.md +1 -1
- package/presets/opencode/next/agents/security-reviewer.md +1 -1
- package/presets/opencode/next/agents/solution-architect.md +1 -1
- package/presets/opencode/next/agents/task-analyst.md +2 -8
- package/presets/opencode/next/agents/task-router.md +2 -2
- package/presets/opencode/next/agents/tech-writer.md +1 -1
- package/presets/opencode/next/agents/unit-test-generator.md +1 -1
- package/presets/opencode/next/agents/unit-test-healer.md +1 -1
- package/presets/opencode/next/agents/unit-test-planner.md +1 -1
- package/presets/opencode/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/opencode/next/commands/spec-start.md +3 -4
- package/presets/opencode/next/commands/task-continue.md +10 -9
- package/presets/opencode/next/commands/task-evil.md +8 -0
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/hooks/README.md +12 -1
- package/presets/opencode/next/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/next/hooks/guard-shell-command.mjs +877 -0
- package/presets/opencode/next/opencode.json +4 -4
- package/presets/opencode/next/plugins/rule-attach/globs.json +276 -0
- package/presets/opencode/next/rules/agent-team-intake.md +2 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/next/rules/preset-writing-style.md +8 -0
- package/presets/opencode/next/team/README.md +1 -1
- package/presets/opencode/nuxt/OPENCODE.md +5 -54
- package/presets/opencode/nuxt/adapter-map.json +51 -51
- package/presets/opencode/nuxt/agents/accessibility-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
- package/presets/opencode/nuxt/agents/ci-investigator.md +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/codebase-analyzer.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/migration-specialist.md +1 -1
- package/presets/opencode/nuxt/agents/mockup-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/openspec-author.md +1 -1
- package/presets/opencode/nuxt/agents/performance-auditor.md +1 -1
- package/presets/opencode/nuxt/agents/playwright-test-generator.md +1 -1
- package/presets/opencode/nuxt/agents/playwright-test-healer.md +1 -1
- package/presets/opencode/nuxt/agents/playwright-test-planner.md +1 -1
- package/presets/opencode/nuxt/agents/qa-tester.md +1 -1
- package/presets/opencode/nuxt/agents/security-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/solution-architect.md +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/agents/task-router.md +1 -1
- package/presets/opencode/nuxt/agents/tech-writer.md +1 -1
- package/presets/opencode/nuxt/agents/unit-test-generator.md +1 -1
- package/presets/opencode/nuxt/agents/unit-test-healer.md +1 -1
- package/presets/opencode/nuxt/agents/unit-test-planner.md +1 -1
- package/presets/opencode/nuxt/commands/task-continue.md +1 -1
- package/presets/opencode/nuxt/hooks/README.md +12 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/nuxt/hooks/guard-shell-command.mjs +877 -0
- package/presets/opencode/nuxt/opencode.json +4 -4
- package/presets/opencode/nuxt/plugins/rule-attach/globs.json +266 -0
- package/presets/opencode/nuxt/rules/agent-team-intake.md +2 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/nuxt/rules/preset-writing-style.md +8 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +5 -60
- package/presets/opencode/php-hexagonal/adapter-map.json +45 -45
- package/presets/opencode/php-hexagonal/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/opencode/php-hexagonal/agents/ci-investigator.md +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/codebase-analyzer.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/integration-test-generator.md +1 -1
- package/presets/opencode/php-hexagonal/agents/integration-test-healer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/integration-test-planner.md +1 -1
- package/presets/opencode/php-hexagonal/agents/migration-specialist.md +1 -1
- package/presets/opencode/php-hexagonal/agents/openspec-author.md +1 -1
- package/presets/opencode/php-hexagonal/agents/performance-auditor.md +1 -1
- package/presets/opencode/php-hexagonal/agents/qa-tester.md +1 -1
- package/presets/opencode/php-hexagonal/agents/security-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/solution-architect.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-router.md +1 -1
- package/presets/opencode/php-hexagonal/agents/tech-writer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/unit-test-generator.md +1 -1
- package/presets/opencode/php-hexagonal/agents/unit-test-healer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/unit-test-planner.md +1 -1
- package/presets/opencode/php-hexagonal/commands/task-continue.md +1 -1
- package/presets/opencode/php-hexagonal/hooks/README.md +12 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/php-hexagonal/hooks/guard-shell-command.mjs +879 -0
- package/presets/opencode/php-hexagonal/opencode.json +4 -4
- package/presets/opencode/php-hexagonal/plugins/rule-attach/globs.json +242 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +2 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/php-hexagonal/rules/preset-writing-style.md +8 -0
- package/presets/opencode/php-laravel/OPENCODE.md +5 -60
- package/presets/opencode/php-laravel/adapter-map.json +45 -45
- package/presets/opencode/php-laravel/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/opencode/php-laravel/agents/ci-investigator.md +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/codebase-analyzer.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/integration-test-generator.md +1 -1
- package/presets/opencode/php-laravel/agents/integration-test-healer.md +1 -1
- package/presets/opencode/php-laravel/agents/integration-test-planner.md +1 -1
- package/presets/opencode/php-laravel/agents/migration-specialist.md +1 -1
- package/presets/opencode/php-laravel/agents/openspec-author.md +1 -1
- package/presets/opencode/php-laravel/agents/performance-auditor.md +1 -1
- package/presets/opencode/php-laravel/agents/qa-tester.md +1 -1
- package/presets/opencode/php-laravel/agents/security-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/solution-architect.md +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/agents/task-router.md +1 -1
- package/presets/opencode/php-laravel/agents/tech-writer.md +1 -1
- package/presets/opencode/php-laravel/agents/unit-test-generator.md +1 -1
- package/presets/opencode/php-laravel/agents/unit-test-healer.md +1 -1
- package/presets/opencode/php-laravel/agents/unit-test-planner.md +1 -1
- package/presets/opencode/php-laravel/commands/task-continue.md +1 -1
- package/presets/opencode/php-laravel/hooks/README.md +12 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/php-laravel/hooks/guard-shell-command.mjs +879 -0
- package/presets/opencode/php-laravel/opencode.json +4 -4
- package/presets/opencode/php-laravel/plugins/rule-attach/globs.json +232 -0
- package/presets/opencode/php-laravel/rules/agent-team-intake.md +2 -0
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/php-laravel/rules/preset-writing-style.md +8 -0
- package/presets/opencode/platform-contract.json +4 -0
- package/presets/opencode/plugins/output-guard/README.md +1 -1
- package/presets/opencode/plugins/output-guard/index.ts +8 -2
- package/presets/opencode/plugins/output-guard/rewrite.ts +37 -0
- package/presets/opencode/plugins/rule-attach/README.md +34 -0
- package/presets/opencode/plugins/rule-attach/attach.ts +224 -0
- package/presets/opencode/plugins/rule-attach/index.ts +169 -0
- package/presets/opencode/plugins/rule-attach/package.json +9 -0
- package/presets/opencode/plugins/settings-guard/README.md +25 -0
- package/presets/opencode/plugins/settings-guard/index.ts +114 -0
- package/presets/opencode/plugins/settings-guard/package.json +9 -0
- package/presets/opencode/plugins/settings-guard/policy.mjs +85 -0
- package/presets/opencode/plugins/settings-guard/prompt-face.mjs +153 -0
- package/presets/opencode/plugins/task-status/README.md +9 -4
- package/presets/opencode/plugins/task-status/eta.ts +20 -7
- package/presets/opencode/plugins/task-status/index.ts +14 -1
- package/presets/opencode/plugins/task-status/task-view.ts +160 -5
- package/presets/opencode/plugins/task-status/timing.ts +244 -0
- package/presets/opencode/plugins/task-status/types.ts +6 -0
- package/presets/opencode/svelte/OPENCODE.md +5 -54
- package/presets/opencode/svelte/adapter-map.json +51 -51
- package/presets/opencode/svelte/agents/accessibility-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/api-contract-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/build-verifier.md +1 -1
- package/presets/opencode/svelte/agents/ci-investigator.md +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/codebase-analyzer.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/migration-specialist.md +1 -1
- package/presets/opencode/svelte/agents/mockup-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/openspec-author.md +1 -1
- package/presets/opencode/svelte/agents/performance-auditor.md +1 -1
- package/presets/opencode/svelte/agents/playwright-test-generator.md +1 -1
- package/presets/opencode/svelte/agents/playwright-test-healer.md +1 -1
- package/presets/opencode/svelte/agents/playwright-test-planner.md +1 -1
- package/presets/opencode/svelte/agents/qa-tester.md +1 -1
- package/presets/opencode/svelte/agents/security-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/solution-architect.md +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/agents/task-router.md +1 -1
- package/presets/opencode/svelte/agents/tech-writer.md +1 -1
- package/presets/opencode/svelte/agents/unit-test-generator.md +1 -1
- package/presets/opencode/svelte/agents/unit-test-healer.md +1 -1
- package/presets/opencode/svelte/agents/unit-test-planner.md +1 -1
- package/presets/opencode/svelte/commands/task-continue.md +1 -1
- package/presets/opencode/svelte/hooks/README.md +12 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/opencode/svelte/hooks/guard-shell-command.mjs +877 -0
- package/presets/opencode/svelte/opencode.json +4 -4
- package/presets/opencode/svelte/plugins/rule-attach/globs.json +245 -0
- package/presets/opencode/svelte/rules/agent-team-intake.md +2 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +7 -7
- package/presets/opencode/svelte/rules/preset-writing-style.md +8 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/android-kotlin/rules/agent-team-intake.md +2 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/android-kotlin/rules/preset-writing-style.md +8 -0
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/go/rules/agent-team-intake.md +2 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/go/rules/preset-writing-style.md +8 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/ios-swift/rules/agent-team-intake.md +2 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/ios-swift/rules/preset-writing-style.md +8 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/java/rules/agent-team-intake.md +2 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/java/rules/preset-writing-style.md +8 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/mcp-ts/rules/agent-team-intake.md +2 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/mcp-ts/rules/preset-writing-style.md +8 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/feature-developer.md +1 -1
- package/presets/zcode/mol/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/zcode/mol/commands/task-evil.md +8 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/mol/rules/agent-team-intake.md +2 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/mol/rules/preset-writing-style.md +8 -0
- package/presets/zcode/next/REPO_AGENTS.md +2 -0
- package/presets/zcode/next/adapter-map.json +1 -1
- package/presets/zcode/next/agents/feature-developer.md +1 -1
- package/presets/zcode/next/agents/task-analyst.md +1 -7
- package/presets/zcode/next/agents/task-router.md +1 -1
- package/presets/zcode/next/ai-local/rules-library/commit-hygiene.md +1 -1
- package/presets/zcode/next/commands/spec-start.md +3 -4
- package/presets/zcode/next/commands/task-continue.md +9 -8
- package/presets/zcode/next/commands/task-evil.md +8 -0
- package/presets/zcode/next/commands/task.md +1 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/next/rules/agent-team-intake.md +2 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/next/rules/preset-writing-style.md +8 -0
- package/presets/zcode/next/team/README.md +1 -1
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/nuxt/rules/agent-team-intake.md +2 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/nuxt/rules/preset-writing-style.md +8 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +2 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/php-hexagonal/rules/preset-writing-style.md +8 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/php-laravel/rules/agent-team-intake.md +2 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/php-laravel/rules/preset-writing-style.md +8 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +541 -61
- package/presets/zcode/svelte/rules/agent-team-intake.md +2 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/svelte/rules/preset-writing-style.md +8 -0
- package/scripts/report-context-cost.mjs +1 -20
|
@@ -747,6 +747,70 @@ export function listTaskDirectories(teamRoot) {
|
|
|
747
747
|
.sort();
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
+
/**
|
|
751
|
+
* Terminal `status.json` states — the exact set the hook and autoroute
|
|
752
|
+
* templates pin (`prompt-autoroute.mjs.tmpl`, `chain-team-phases.sh.tmpl`).
|
|
753
|
+
* A slug whose state is in this set is closed and is not live.
|
|
754
|
+
*/
|
|
755
|
+
export const TERMINAL_STATES = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed']);
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* The live slugs in the team root: every task directory whose `status.json`
|
|
759
|
+
* parses to a non-terminal `state`. This is the canonical live-slug predicate
|
|
760
|
+
* — computed from the task store, never from `active-task.json`. A missing or
|
|
761
|
+
* unreadable status is not a live slug.
|
|
762
|
+
*
|
|
763
|
+
* @param {string} teamRoot
|
|
764
|
+
* @returns {string[]} sorted live slugs
|
|
765
|
+
*/
|
|
766
|
+
export function liveTaskSlugs(teamRoot) {
|
|
767
|
+
const live = [];
|
|
768
|
+
for (const slug of listTaskDirectories(teamRoot)) {
|
|
769
|
+
try {
|
|
770
|
+
const status = parseStatusJson(readTextFile(path.join(teamRoot, 'tasks', slug, KNOWN_FILES.status)));
|
|
771
|
+
const state = status && typeof status.state === 'string' ? status.state : null;
|
|
772
|
+
if (state !== null && !TERMINAL_STATES.has(state)) live.push(slug);
|
|
773
|
+
} catch {
|
|
774
|
+
/* an unreadable status is not a live slug */
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return live;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Rebuild `active-task.json` as the UI projection of the live slugs:
|
|
782
|
+
* `{"schemaVersion":1,"slugs":[...],"updatedAt"}` — sorted, deduped, live
|
|
783
|
+
* slugs only; an empty array means "no pointer" for every reader. `team-db
|
|
784
|
+
* sync` (both faces) and `delete` are the only writers, so the projection
|
|
785
|
+
* self-heals on every projection run; readers accept the legacy single-slot
|
|
786
|
+
* `{"slug"}` shape forever. Atomic tmp + rename, best-effort: a failure is a
|
|
787
|
+
* logged finding, never a failed sync or delete.
|
|
788
|
+
*
|
|
789
|
+
* @param {string} teamRoot
|
|
790
|
+
* @param {{ env?: Record<string, string | undefined> }} [options]
|
|
791
|
+
* @returns {boolean} whether the file was (re)written
|
|
792
|
+
*/
|
|
793
|
+
export function rebuildActiveTaskPointer(teamRoot, options = {}) {
|
|
794
|
+
try {
|
|
795
|
+
const slugs = liveTaskSlugs(teamRoot);
|
|
796
|
+
const file = path.join(teamRoot, 'active-task.json');
|
|
797
|
+
const content = `${JSON.stringify({ schemaVersion: 1, slugs, updatedAt: new Date().toISOString() })}\n`;
|
|
798
|
+
try {
|
|
799
|
+
if (fs.readFileSync(file, 'utf8') === content) return false;
|
|
800
|
+
} catch {
|
|
801
|
+
/* absent or unreadable: write it */
|
|
802
|
+
}
|
|
803
|
+
fs.mkdirSync(teamRoot, { recursive: true });
|
|
804
|
+
const temporary = `${file}.tmp`;
|
|
805
|
+
fs.writeFileSync(temporary, content, { encoding: 'utf8', mode: 0o600 });
|
|
806
|
+
fs.renameSync(temporary, file);
|
|
807
|
+
return true;
|
|
808
|
+
} catch (error) {
|
|
809
|
+
logProjectionFailure('E_POINTER_REBUILD', error.message, options.env);
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
750
814
|
const hashFile = (absolute) => {
|
|
751
815
|
const hash = crypto.createHash('sha256');
|
|
752
816
|
const fd = fs.openSync(absolute, 'r');
|
|
@@ -4963,6 +5027,10 @@ export function syncProjection(options = {}) {
|
|
|
4963
5027
|
result.error = result.errors[0] ? `${result.errors[0].path}: ${result.errors[0].reason}` : null;
|
|
4964
5028
|
updateRun(db, runId, result);
|
|
4965
5029
|
chmodDatabaseFiles(handle.dbPath);
|
|
5030
|
+
// The active-task pointer is a UI projection: rebuild it on every sync
|
|
5031
|
+
// face (slug and full) so it self-heals. Best-effort — a rebuild failure
|
|
5032
|
+
// is a logged finding, never a failed sync.
|
|
5033
|
+
rebuildActiveTaskPointer(handle.teamRoot, { env: options.env });
|
|
4966
5034
|
return result;
|
|
4967
5035
|
} catch (error) {
|
|
4968
5036
|
result.exitCode = error instanceof TeamDbError ? error.exitCode : 2;
|
|
@@ -4988,16 +5056,17 @@ export function syncProjection(options = {}) {
|
|
|
4988
5056
|
* The two legs converge prior partial states: a folder without rows loses
|
|
4989
5057
|
* only the folder; rows without a folder lose only the rows. The row leg is
|
|
4990
5058
|
* one transaction — the task row plus every child row by foreign-key cascade,
|
|
4991
|
-
* plus the task's standalone search rows. The
|
|
5059
|
+
* plus the task's standalone search rows. The live-status guard and the slug
|
|
4992
5060
|
* confinement run before any leg, and a symlink at `tasks/<slug>` is refused,
|
|
4993
5061
|
* never followed or removed.
|
|
4994
5062
|
*
|
|
4995
5063
|
* Returns the one-line result the CLI prints and the API child parses:
|
|
4996
5064
|
* `{ ok: true, slug, folderRemoved, rowsDeleted }`. Throws `TeamDbError`:
|
|
4997
5065
|
* `E_DISABLED` (kill switch, exit 1), `E_USAGE` (bad slug, exit 3),
|
|
4998
|
-
* `E_NOT_FOUND` (nothing to delete, exit 1), `E_ACTIVE_TASK` (the
|
|
4999
|
-
* exit 1), `E_INTERNAL` (the folder leg
|
|
5000
|
-
* database-level `E_DB_BUSY` (exit 4) /
|
|
5066
|
+
* `E_NOT_FOUND` (nothing to delete, exit 1), `E_ACTIVE_TASK` (the requested
|
|
5067
|
+
* slug's own `status.json` is live, exit 1), `E_INTERNAL` (the folder leg
|
|
5068
|
+
* failed, exit 1), and the database-level `E_DB_BUSY` (exit 4) /
|
|
5069
|
+
* `E_DB_CORRUPT` (exit 2).
|
|
5001
5070
|
*/
|
|
5002
5071
|
export function deleteTaskProjection(options = {}) {
|
|
5003
5072
|
const slug = typeof options.slug === 'string' ? options.slug : '';
|
|
@@ -5011,21 +5080,22 @@ export function deleteTaskProjection(options = {}) {
|
|
|
5011
5080
|
const tasksRoot = path.join(teamRoot, 'tasks');
|
|
5012
5081
|
const taskDir = path.join(tasksRoot, slug);
|
|
5013
5082
|
|
|
5014
|
-
// The guard reads the
|
|
5015
|
-
//
|
|
5016
|
-
//
|
|
5017
|
-
//
|
|
5018
|
-
|
|
5083
|
+
// The guard reads the requested slug's own `status.json` — not the pointer,
|
|
5084
|
+
// not the database — and runs before any leg. The parse stays inside the
|
|
5085
|
+
// try; the refusal lives outside it, so a live-state refusal is never
|
|
5086
|
+
// mistaken for an unreadable status. A missing or unreadable status does
|
|
5087
|
+
// not block the delete.
|
|
5088
|
+
let liveState = null;
|
|
5019
5089
|
try {
|
|
5020
|
-
const
|
|
5021
|
-
|
|
5090
|
+
const status = parseStatusJson(readTextFile(path.join(taskDir, KNOWN_FILES.status)));
|
|
5091
|
+
liveState = typeof status.state === 'string' ? status.state : null;
|
|
5022
5092
|
} catch {
|
|
5023
|
-
|
|
5093
|
+
liveState = null;
|
|
5024
5094
|
}
|
|
5025
|
-
if (
|
|
5095
|
+
if (liveState !== null && !TERMINAL_STATES.has(liveState)) {
|
|
5026
5096
|
teamDbFail(
|
|
5027
5097
|
'E_ACTIVE_TASK',
|
|
5028
|
-
`${slug} is
|
|
5098
|
+
`${slug} is live (state ${liveState}); deletion is blocked until the task reaches a terminal state`,
|
|
5029
5099
|
1,
|
|
5030
5100
|
);
|
|
5031
5101
|
}
|
|
@@ -5108,6 +5178,9 @@ export function deleteTaskProjection(options = {}) {
|
|
|
5108
5178
|
}
|
|
5109
5179
|
|
|
5110
5180
|
chmodDatabaseFiles(handle.dbPath);
|
|
5181
|
+
// The deleted slug leaves the UI projection on this delete; best-effort,
|
|
5182
|
+
// like every pointer rebuild.
|
|
5183
|
+
rebuildActiveTaskPointer(teamRoot, { env: options.env });
|
|
5111
5184
|
return { ok: true, slug, folderRemoved: dirState === 'present', rowsDeleted };
|
|
5112
5185
|
} finally {
|
|
5113
5186
|
try {
|
|
@@ -32,7 +32,22 @@ export const SEARCH_MODE_FTS5 = 'fts5';
|
|
|
32
32
|
export const SEARCH_MODE_LIKE = 'like';
|
|
33
33
|
export const INDEX_UNAVAILABLE_LINE = `team-db: node:sqlite unavailable (requires Node >= ${MIN_NODE}); file-only mode`;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Team store path. `AI_RULES_TEAM_ROOT` wins, then the legacy
|
|
37
|
+
* `AI_RULES_TEAM_DB_ROOT`, then `<cwd>/.ai.local/team`. An empty string is unset.
|
|
38
|
+
* A worktree hook sets the first name so cwd does not open a second store.
|
|
39
|
+
*/
|
|
40
|
+
export const resolveTeamRoot = (env = process.env, cwd = process.cwd()) => {
|
|
41
|
+
const named =
|
|
42
|
+
env && typeof env.AI_RULES_TEAM_ROOT === 'string' && env.AI_RULES_TEAM_ROOT !== ''
|
|
43
|
+
? env.AI_RULES_TEAM_ROOT
|
|
44
|
+
: env && typeof env.AI_RULES_TEAM_DB_ROOT === 'string' && env.AI_RULES_TEAM_DB_ROOT !== ''
|
|
45
|
+
? env.AI_RULES_TEAM_DB_ROOT
|
|
46
|
+
: '';
|
|
47
|
+
return path.resolve(named || path.join(cwd, '.ai.local', 'team'));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const DEFAULT_TEAM_ROOT = resolveTeamRoot();
|
|
36
51
|
|
|
37
52
|
/**
|
|
38
53
|
* The released FTS layouts, oldest-first. The current shape is last.
|
|
@@ -1134,14 +1149,40 @@ export const pragmaValue = (db, pragma) => {
|
|
|
1134
1149
|
return values.length > 0 ? values[0] : null;
|
|
1135
1150
|
};
|
|
1136
1151
|
|
|
1152
|
+
export const DEFAULT_BUSY_TIMEOUT_MS = 5000;
|
|
1153
|
+
|
|
1154
|
+
let busyTimeoutWarned = false;
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* `AI_RULES_TEAM_DB_BUSY_MS` is a non-negative integer millisecond busy
|
|
1158
|
+
* timeout. Absent uses the default with no warning. Anything else warns once
|
|
1159
|
+
* per process and uses the default.
|
|
1160
|
+
*/
|
|
1161
|
+
export function readBusyTimeoutMs(env = process.env) {
|
|
1162
|
+
const raw = env?.AI_RULES_TEAM_DB_BUSY_MS;
|
|
1163
|
+
if (raw === undefined) return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1164
|
+
const text = String(raw).trim();
|
|
1165
|
+
if (text === '' || !/^\d+$/.test(text) || !Number.isSafeInteger(Number(text))) {
|
|
1166
|
+
if (!busyTimeoutWarned) {
|
|
1167
|
+
busyTimeoutWarned = true;
|
|
1168
|
+
process.stderr.write(
|
|
1169
|
+
`warn: AI_RULES_TEAM_DB_BUSY_MS="${text}" is not a non-negative integer; using ${DEFAULT_BUSY_TIMEOUT_MS}\n`,
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1173
|
+
}
|
|
1174
|
+
return Number(text);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1137
1177
|
export function configureConnection(db, options = {}) {
|
|
1138
1178
|
// The busy timeout must be set before the first lock-taking pragma: two first
|
|
1139
1179
|
// projections both create the file, and a default 0 ms timeout turns the
|
|
1140
1180
|
// WAL switch on the loser into an immediate SQLITE_BUSY.
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1181
|
+
const busyTimeoutMs = options.busyTimeoutMs ?? readBusyTimeoutMs(options.env);
|
|
1182
|
+
db.exec(`PRAGMA busy_timeout=${busyTimeoutMs}`);
|
|
1183
|
+
// A fresh file switches here. An existing file is switched by `ensureWal`
|
|
1184
|
+
// after migrations, so a no-op re-issue does not take the exclusive lock
|
|
1185
|
+
// on every open.
|
|
1145
1186
|
if (options.setWal) db.exec('PRAGMA journal_mode=WAL');
|
|
1146
1187
|
db.exec('PRAGMA foreign_keys=ON');
|
|
1147
1188
|
db.exec('PRAGMA synchronous=NORMAL');
|
|
@@ -1411,13 +1452,61 @@ const sleepSync = (ms) => {
|
|
|
1411
1452
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
1412
1453
|
};
|
|
1413
1454
|
|
|
1455
|
+
const appendTeamDbError = (env, dbPath, code, message) => {
|
|
1456
|
+
try {
|
|
1457
|
+
const override = typeof env?.AI_RULES_TEAM_DB_LOG === 'string' ? env.AI_RULES_TEAM_DB_LOG.trim() : '';
|
|
1458
|
+
const target = override
|
|
1459
|
+
? path.resolve(override)
|
|
1460
|
+
: path.join(path.dirname(dbPath || DEFAULT_TEAM_ROOT), 'team-db-errors.log');
|
|
1461
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
1462
|
+
fs.appendFileSync(target, `${new Date().toISOString()} ${code} cli ${message}\n`);
|
|
1463
|
+
let lines = fs.readFileSync(target, 'utf8').split('\n').filter((entry) => entry.length > 0);
|
|
1464
|
+
if (lines.length > 200) lines = lines.slice(lines.length - 200);
|
|
1465
|
+
while (Buffer.byteLength(`${lines.join('\n')}\n`, 'utf8') > 65536 && lines.length > 1) lines.shift();
|
|
1466
|
+
fs.writeFileSync(target, lines.length > 0 ? `${lines.join('\n')}\n` : '');
|
|
1467
|
+
} catch {
|
|
1468
|
+
/* a log failure must not fail the open */
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Switch an existing database to WAL after migrations, outside any transaction
|
|
1474
|
+
* (`PRAGMA journal_mode` is a no-op inside one). Already-WAL is a no-op.
|
|
1475
|
+
* `SQLITE_BUSY` retries once, then one `E_WAL_DEFERRED` line and the open
|
|
1476
|
+
* continues; the next open retries. The pragma does not rewrite tables.
|
|
1477
|
+
*/
|
|
1478
|
+
export function ensureWal(db, { dbPath, env = process.env } = {}) {
|
|
1479
|
+
const mode = () => String(pragmaValue(db, 'journal_mode') ?? '').toLowerCase();
|
|
1480
|
+
if (mode() === 'wal') return { switched: false, deferred: false };
|
|
1481
|
+
let lastError = null;
|
|
1482
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
1483
|
+
try {
|
|
1484
|
+
db.exec('PRAGMA journal_mode=WAL');
|
|
1485
|
+
if (mode() === 'wal') return { switched: true, deferred: false };
|
|
1486
|
+
lastError = null;
|
|
1487
|
+
break;
|
|
1488
|
+
} catch (error) {
|
|
1489
|
+
lastError = error;
|
|
1490
|
+
if (!isBusyError(error) || attempt === 1) break;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
if (lastError && !isBusyError(lastError)) throw lastError;
|
|
1494
|
+
appendTeamDbError(
|
|
1495
|
+
env,
|
|
1496
|
+
dbPath,
|
|
1497
|
+
'E_WAL_DEFERRED',
|
|
1498
|
+
`journal_mode stayed ${mode() || 'unknown'}; next open retries`,
|
|
1499
|
+
);
|
|
1500
|
+
return { switched: false, deferred: true };
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1414
1503
|
/**
|
|
1415
1504
|
* Open + configure with a bounded retry for the first-creation race. Two
|
|
1416
1505
|
* processes can both create the file; the loser's WAL switch or migration can
|
|
1417
1506
|
* return SQLITE_BUSY before the in-connection busy handler applies. Retry for
|
|
1418
|
-
* five seconds, matching `busy_timeout`, then surface `E_DB_BUSY`.
|
|
1507
|
+
* five seconds, matching the default `busy_timeout`, then surface `E_DB_BUSY`.
|
|
1419
1508
|
*/
|
|
1420
|
-
const openConfiguredDatabase = (sqlite, dbPath, readOnly, setWal = false) => {
|
|
1509
|
+
const openConfiguredDatabase = (sqlite, dbPath, readOnly, setWal = false, env = process.env) => {
|
|
1421
1510
|
let lastError = null;
|
|
1422
1511
|
const deadline = Date.now() + 5000;
|
|
1423
1512
|
let attempt = 0;
|
|
@@ -1426,7 +1515,7 @@ const openConfiguredDatabase = (sqlite, dbPath, readOnly, setWal = false) => {
|
|
|
1426
1515
|
let db;
|
|
1427
1516
|
try {
|
|
1428
1517
|
db = new sqlite.DatabaseSync(dbPath, readOnly ? { readOnly: true } : {});
|
|
1429
|
-
configureConnection(db, { setWal: setWal && !readOnly });
|
|
1518
|
+
configureConnection(db, { setWal: setWal && !readOnly, env });
|
|
1430
1519
|
return db;
|
|
1431
1520
|
} catch (error) {
|
|
1432
1521
|
lastError = error;
|
|
@@ -1512,9 +1601,7 @@ export function openTeamDb(options = {}) {
|
|
|
1512
1601
|
const sqlite = loadSqlite(options.env ?? process.env);
|
|
1513
1602
|
if (!sqlite) teamDbFail('E_SQLITE_UNAVAILABLE', `node:sqlite is unavailable; requires Node >= ${MIN_NODE}`, 0);
|
|
1514
1603
|
|
|
1515
|
-
const teamRoot = path.resolve(
|
|
1516
|
-
options.teamRoot || process.env.AI_RULES_TEAM_DB_ROOT || DEFAULT_TEAM_ROOT,
|
|
1517
|
-
);
|
|
1604
|
+
const teamRoot = path.resolve(options.teamRoot || resolveTeamRoot(options.env ?? process.env));
|
|
1518
1605
|
const dbPath = path.resolve(
|
|
1519
1606
|
options.dbPath ||
|
|
1520
1607
|
process.env.AI_RULES_TEAM_DB_PATH ||
|
|
@@ -1549,7 +1636,7 @@ export function openTeamDb(options = {}) {
|
|
|
1549
1636
|
if (!readOnly) ensureDatabaseFile(dbPath);
|
|
1550
1637
|
let db;
|
|
1551
1638
|
try {
|
|
1552
|
-
db = openConfiguredDatabase(sqlite, dbPath, readOnly, freshFile);
|
|
1639
|
+
db = openConfiguredDatabase(sqlite, dbPath, readOnly, freshFile, options.env ?? process.env);
|
|
1553
1640
|
} catch (error) {
|
|
1554
1641
|
if (isCorruptError(error) || error?.code === 'EISDIR') {
|
|
1555
1642
|
// Corruption is never repaired implicitly; `--rebuild` moves the file
|
|
@@ -1589,6 +1676,7 @@ export function openTeamDb(options = {}) {
|
|
|
1589
1676
|
) {
|
|
1590
1677
|
ensureSearchIndex(db, { searchMode: forceSearch });
|
|
1591
1678
|
}
|
|
1679
|
+
ensureWal(db, { dbPath, env: options.env ?? process.env });
|
|
1592
1680
|
} else if (current < SCHEMA_VERSION) {
|
|
1593
1681
|
teamDbFail('E_SCHEMA_OUTDATED', `database schema v${current} is older than code v${SCHEMA_VERSION}`, 2);
|
|
1594
1682
|
}
|
|
@@ -1647,6 +1735,7 @@ export function openTeamDb(options = {}) {
|
|
|
1647
1735
|
fingerprint,
|
|
1648
1736
|
searchMode,
|
|
1649
1737
|
searchShape: detectFtsShapeDrift(db),
|
|
1738
|
+
journalMode: pragmaValue(db, 'journal_mode'),
|
|
1650
1739
|
};
|
|
1651
1740
|
} catch (error) {
|
|
1652
1741
|
try {
|
|
@@ -1689,6 +1778,7 @@ export function describeHandle(handle) {
|
|
|
1689
1778
|
`fingerprint ${handle.fingerprint.slice(0, 12)}`,
|
|
1690
1779
|
`search ${handle.searchMode}`,
|
|
1691
1780
|
'integrity ok',
|
|
1781
|
+
`journal ${String(handle.journalMode ?? 'unknown').toLowerCase()}`,
|
|
1692
1782
|
];
|
|
1693
1783
|
// A drifted search layout is reported, never repaired: the state names what
|
|
1694
1784
|
// is installed, and the rebuild path stays the remedy.
|
|
@@ -1587,7 +1587,42 @@ export function recoverTrackerEntries(teamRoot, options = {}) {
|
|
|
1587
1587
|
return withTrackerLock(teamRoot, () => ({ recovered: releaseStaleClaims(teamRoot, options.actor ?? 'operator') }));
|
|
1588
1588
|
}
|
|
1589
1589
|
|
|
1590
|
+
const queueDirIsEmpty = (teamRoot) => {
|
|
1591
|
+
const dir = trackerPaths(teamRoot).queue;
|
|
1592
|
+
try {
|
|
1593
|
+
return fs.readdirSync(dir).length === 0;
|
|
1594
|
+
} catch (error) {
|
|
1595
|
+
if (error && error.code === 'ENOENT') return true;
|
|
1596
|
+
throw error;
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
/** Capacity of an empty queue, read-only. No entries means no claimed count and no stale release. */
|
|
1601
|
+
const emptyQueueDrain = (teamRoot) => {
|
|
1602
|
+
const taskStates = readTaskStates(teamRoot);
|
|
1603
|
+
const config = readTrackerConfig(teamRoot);
|
|
1604
|
+
const activeCount = countActiveTasks(taskStates);
|
|
1605
|
+
return {
|
|
1606
|
+
ok: true,
|
|
1607
|
+
claim: null,
|
|
1608
|
+
reason: 'queue empty (pre-check)',
|
|
1609
|
+
claimable: activeCount < config.maxActive,
|
|
1610
|
+
maxActive: config.maxActive,
|
|
1611
|
+
activeCount,
|
|
1612
|
+
ready: [],
|
|
1613
|
+
drainOrder: [],
|
|
1614
|
+
};
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Drain the launch queue.
|
|
1619
|
+
*
|
|
1620
|
+
* An empty queue returns before the tracker lock. An entry written between
|
|
1621
|
+
* this readdir and the lock waits for the next stop-seam drain — a drain
|
|
1622
|
+
* fires on every completed stop, so skip-on-loss is unchanged.
|
|
1623
|
+
*/
|
|
1590
1624
|
export function drainTracker(teamRoot, { claim = false, actor = 'operator' } = {}) {
|
|
1625
|
+
if (queueDirIsEmpty(teamRoot)) return emptyQueueDrain(teamRoot);
|
|
1591
1626
|
return withTrackerLock(teamRoot, () => {
|
|
1592
1627
|
releaseStaleClaims(teamRoot, actor);
|
|
1593
1628
|
const snapshot = {
|
|
@@ -250,7 +250,16 @@ export async function runPlannedDrain(teamRoot, options = {}) {
|
|
|
250
250
|
if (isKillSwitchSet(options.env ?? process.env)) return idle('disabled');
|
|
251
251
|
reconcilePlannedItems(teamRoot);
|
|
252
252
|
const preview = drainTracker(teamRoot, { claim: false, actor: ACTOR });
|
|
253
|
-
if (
|
|
253
|
+
if (preview.reason === 'queue empty (pre-check)') {
|
|
254
|
+
// The pre-check did not take the lock. A full slot still refuses before
|
|
255
|
+
// enqueue; an open slot falls through to the planned head.
|
|
256
|
+
if (!preview.claimable) {
|
|
257
|
+
const reason = preview.activeCount >= preview.maxActive
|
|
258
|
+
? 'capacity: active tasks'
|
|
259
|
+
: 'capacity: claimed or active entries';
|
|
260
|
+
return idle(reason);
|
|
261
|
+
}
|
|
262
|
+
} else if (!preview.claimable) {
|
|
254
263
|
// `claim: true` while the slot is full writes nothing; the reason is the
|
|
255
264
|
// capacity string the tracker already returns.
|
|
256
265
|
const refused = drainTracker(teamRoot, { claim: true, actor: ACTOR });
|
|
@@ -133,15 +133,75 @@ const git = (root, args) => {
|
|
|
133
133
|
return String(result.stdout ?? '');
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
const TERMINAL_STATES = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed']);
|
|
137
|
+
|
|
138
|
+
/** Live slugs over the task store — the same canonical predicate the hook uses. */
|
|
139
|
+
const liveTaskSlugs = (teamRoot) => {
|
|
140
|
+
let entries;
|
|
141
|
+
try {
|
|
142
|
+
entries = fs.readdirSync(path.join(teamRoot, 'tasks'), { withFileTypes: true });
|
|
143
|
+
} catch {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
const live = [];
|
|
147
|
+
for (const entry of entries) {
|
|
148
|
+
if (!entry.isDirectory()) continue;
|
|
149
|
+
const status = readJson(path.join(teamRoot, 'tasks', entry.name, 'status.json'), null);
|
|
150
|
+
if (status && typeof status.state === 'string' && !TERMINAL_STATES.has(status.state)) live.push(entry.name);
|
|
151
|
+
}
|
|
152
|
+
return live.sort();
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Union of `Object.keys(baseline.paths)` across the slug's step baselines
|
|
157
|
+
* (tolerant reader: invalid files skipped). `null` when the slug has no
|
|
158
|
+
* readable baseline or the union is empty — the caller falls back per the
|
|
159
|
+
* basis rules, matching `check-preset-delta.mjs` `readTaskBaselines`.
|
|
160
|
+
*/
|
|
161
|
+
const writeScopeBaselinePaths = (teamRoot, slug) => {
|
|
162
|
+
if (!SLUG_RE.test(slug)) return null;
|
|
163
|
+
let entries;
|
|
164
|
+
try {
|
|
165
|
+
entries = fs.readdirSync(path.join(teamRoot, '.write-scope', slug));
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const paths = new Set();
|
|
170
|
+
for (const entry of entries) {
|
|
171
|
+
if (!entry.endsWith('.json')) continue;
|
|
172
|
+
const value = readJson(path.join(teamRoot, '.write-scope', slug, entry), null);
|
|
173
|
+
const record =
|
|
174
|
+
value && typeof value === 'object' && value.paths && typeof value.paths === 'object' && !Array.isArray(value.paths)
|
|
175
|
+
? value.paths
|
|
176
|
+
: null;
|
|
177
|
+
if (!record) continue;
|
|
178
|
+
for (const key of Object.keys(record)) {
|
|
179
|
+
if (typeof key === 'string' && key !== '') paths.add(key.split(path.sep).join('/'));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return paths.size > 0 ? [...paths].sort() : null;
|
|
183
|
+
};
|
|
184
|
+
|
|
136
185
|
/**
|
|
137
|
-
* Worktree snapshot. `head`
|
|
138
|
-
* covers
|
|
139
|
-
*
|
|
186
|
+
* Worktree snapshot. `head` plus the scope binding are the freshness keys:
|
|
187
|
+
* `scopeHash` covers the task's write-scope baseline path set (tracked
|
|
188
|
+
* modifications and the untracked-name set, not untracked file contents —
|
|
189
|
+
* which would make the check unbounded on a dirty tree), so another live
|
|
190
|
+
* slug's uncommitted work cannot stale this task's evidence. Known limit: a
|
|
191
|
+
* file created after baseline activation outside the claimed path set is
|
|
192
|
+
* invisible to `scopeHash`; the write-scope audit and `check:task` still
|
|
193
|
+
* attribute such files at gate time (content-hash delta) — the scoped hash is
|
|
194
|
+
* a change detector, not an attribution tool. `environmentHash` (renamed from
|
|
195
|
+
* `worktreeHash`) keeps the whole-tree capture as diagnostics only.
|
|
196
|
+
* Basis: `write-scope` (baselines exist), `whole-tree` (none, ≤1 live slug —
|
|
197
|
+
* solo-tree semantics preserved), `none` (none, >1 live slug — no hash,
|
|
198
|
+
* freshness reports `scope-unbound`). Must hash identically to the chain
|
|
199
|
+
* hook's `gitSnapshot()`; the parity fixture pins the formula.
|
|
140
200
|
*/
|
|
141
|
-
const captureSnapshot = (root) => {
|
|
201
|
+
const captureSnapshot = (root, teamRoot, slug) => {
|
|
142
202
|
const head = git(root, ['rev-parse', 'HEAD']);
|
|
143
203
|
if (head === null) {
|
|
144
|
-
return { head: null, branch: null, dirtyFiles: null,
|
|
204
|
+
return { head: null, branch: null, dirtyFiles: null, environmentHash: null, scopeBasis: 'none', scopePaths: 0, scopeHash: null, git: false, capturedAt: new Date().toISOString() };
|
|
145
205
|
}
|
|
146
206
|
const branch = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
147
207
|
// `.ai.local/` holds the evidence this module writes; including it would make
|
|
@@ -151,11 +211,27 @@ const captureSnapshot = (root) => {
|
|
|
151
211
|
const diffText = git(root, ['diff', '--binary', 'HEAD', ...exclude]) ?? '';
|
|
152
212
|
const untrackedText = git(root, ['ls-files', '--others', '--exclude-standard', ...exclude]) ?? '';
|
|
153
213
|
const dirtyFiles = statusText === '' ? 0 : statusText.split('\n').filter((line) => line !== '').length;
|
|
214
|
+
const baselinePaths = writeScopeBaselinePaths(teamRoot, typeof slug === 'string' ? slug : '');
|
|
215
|
+
let scopeBasis = 'none';
|
|
216
|
+
let scopeHash = null;
|
|
217
|
+
if (baselinePaths !== null) {
|
|
218
|
+
scopeBasis = 'write-scope';
|
|
219
|
+
const spec = ['--', ...baselinePaths];
|
|
220
|
+
const scopedStatus = git(root, ['status', '--porcelain=v1', ...spec]) ?? '';
|
|
221
|
+
const scopedDiff = git(root, ['diff', '--binary', 'HEAD', ...spec]) ?? '';
|
|
222
|
+
const scopedUntracked = git(root, ['ls-files', '--others', '--exclude-standard', ...spec]) ?? '';
|
|
223
|
+
scopeHash = sha256(`${scopedStatus}\u0000${scopedDiff}\u0000${scopedUntracked}`);
|
|
224
|
+
} else if (liveTaskSlugs(teamRoot).length <= 1) {
|
|
225
|
+
scopeBasis = 'whole-tree';
|
|
226
|
+
}
|
|
154
227
|
return {
|
|
155
228
|
head: head.trim(),
|
|
156
229
|
branch: branch === null ? null : branch.trim(),
|
|
157
230
|
dirtyFiles,
|
|
158
|
-
|
|
231
|
+
environmentHash: sha256(`${statusText}\u0000${diffText}\u0000${untrackedText}`),
|
|
232
|
+
scopeBasis,
|
|
233
|
+
scopePaths: baselinePaths === null ? 0 : baselinePaths.length,
|
|
234
|
+
scopeHash,
|
|
159
235
|
git: true,
|
|
160
236
|
capturedAt: new Date().toISOString(),
|
|
161
237
|
};
|
|
@@ -270,7 +346,7 @@ const actionRecord = (args) => {
|
|
|
270
346
|
};
|
|
271
347
|
verification.commands.push(entry);
|
|
272
348
|
verification.task = path.basename(taskDir);
|
|
273
|
-
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'));
|
|
349
|
+
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'), teamRoot, path.basename(taskDir));
|
|
274
350
|
verification.gate = { status: 'recorded', checkedAt: new Date().toISOString() };
|
|
275
351
|
writeJsonAtomic(file, verification);
|
|
276
352
|
} finally {
|
|
@@ -285,7 +361,7 @@ const actionRecord = (args) => {
|
|
|
285
361
|
agent: entry.agent,
|
|
286
362
|
attempt: entry.attempt,
|
|
287
363
|
head: verification.snapshot.head,
|
|
288
|
-
|
|
364
|
+
environmentHash: verification.snapshot.environmentHash,
|
|
289
365
|
});
|
|
290
366
|
|
|
291
367
|
if (args.json) {
|
|
@@ -309,7 +385,7 @@ const actionSnapshot = (args) => {
|
|
|
309
385
|
commands: [],
|
|
310
386
|
gate: { status: 'recorded', checkedAt: null },
|
|
311
387
|
};
|
|
312
|
-
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'));
|
|
388
|
+
verification.snapshot = captureSnapshot(path.resolve(teamRoot, '..', '..'), teamRoot, path.basename(taskDir));
|
|
313
389
|
writeJsonAtomic(file, verification);
|
|
314
390
|
} finally {
|
|
315
391
|
release();
|
|
@@ -330,12 +406,31 @@ const actionCheck = (args) => {
|
|
|
330
406
|
else process.stdout.write('verification: missing\n');
|
|
331
407
|
process.exit(args.strict ? 2 : 0);
|
|
332
408
|
}
|
|
333
|
-
const current = captureSnapshot(path.resolve(teamRoot, '..', '..'));
|
|
409
|
+
const current = captureSnapshot(path.resolve(teamRoot, '..', '..'), teamRoot, path.basename(taskDir));
|
|
334
410
|
const reasons = [];
|
|
335
411
|
if (!verification.snapshot) reasons.push('no-snapshot');
|
|
336
412
|
else {
|
|
337
413
|
if (verification.snapshot.head !== current.head) reasons.push('head-changed');
|
|
338
|
-
|
|
414
|
+
// The head comparison is global (HEAD is shared across live slugs); the
|
|
415
|
+
// dirty/hash dimension switches on the recorded `scopeBasis` the same way
|
|
416
|
+
// the chain hook's `verificationFreshness` does. `write-scope` binds to
|
|
417
|
+
// `scopeHash` (a scope that can no longer be recomputed reports
|
|
418
|
+
// `scope-unbound`); `none` is a loud not-fresh; legacy snapshots (no
|
|
419
|
+
// `scopeBasis`) and `whole-tree` keep the whole-tree comparison, reading
|
|
420
|
+
// the renamed field as `environmentHash ?? worktreeHash`.
|
|
421
|
+
const basis = typeof verification.snapshot.scopeBasis === 'string' ? verification.snapshot.scopeBasis : 'legacy';
|
|
422
|
+
if (basis === 'write-scope') {
|
|
423
|
+
if (current.scopeBasis !== 'write-scope') reasons.push('scope-unbound');
|
|
424
|
+
else if (current.scopeHash !== verification.snapshot.scopeHash) reasons.push('worktree-changed');
|
|
425
|
+
} else if (basis === 'none') {
|
|
426
|
+
reasons.push('scope-unbound');
|
|
427
|
+
} else {
|
|
428
|
+
const recorded =
|
|
429
|
+
typeof verification.snapshot.environmentHash === 'string'
|
|
430
|
+
? verification.snapshot.environmentHash
|
|
431
|
+
: verification.snapshot.worktreeHash;
|
|
432
|
+
if (current.environmentHash !== recorded) reasons.push('worktree-changed');
|
|
433
|
+
}
|
|
339
434
|
}
|
|
340
435
|
if (verification.commands.length === 0) reasons.push('no-command-evidence');
|
|
341
436
|
const fresh = reasons.length === 0;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"approvedBy": "",
|
|
4
|
+
"note": "Resolve a step's model tier through this map: `cheap` for the router, analyst, tech-writer, codebase-analyzer and the review roles; `standard` for implementation and the other specialists; `strong` for architecture, security, migration and performance. A value is the `providerID/modelID` (or `providerID/modelID#variant`) your provider serves — take it from the models your host reports, never a guess. While `tiers` is empty and `approvedBy` is empty, this file is the unfilled template and the session model applies. After you set `approvedBy` or any tier, a declared tier with no mapping stops the step with `model-tier-unmapped`.",
|
|
5
|
+
"tiers": {}
|
|
6
|
+
}
|
|
@@ -132,10 +132,18 @@ node .ai.local/scripts/verification.mjs check --task <slug> [--strict]
|
|
|
132
132
|
- `record` appends one command entry (`id`, `command`, `exit`, `at`, optional
|
|
133
133
|
`logRef`/`logSha256`), stores a capped, secret-redacted log tail under
|
|
134
134
|
`evidence/`, and snapshots the git state (`head`, `branch`, `dirtyFiles`,
|
|
135
|
-
`
|
|
135
|
+
`environmentHash`) plus the task-scoped binding (`scopeHash`, `scopePaths`,
|
|
136
|
+
`scopeBasis`: `write-scope` | `whole-tree` | `none`). `.ai.local/**` is
|
|
137
|
+
excluded from the whole-tree capture. Gate freshness binds to `scopeHash` —
|
|
138
|
+
computed over the task's `.write-scope` baseline path set, so another live
|
|
139
|
+
slug's uncommitted work cannot stale this task's evidence; `environmentHash`
|
|
140
|
+
keeps the whole-tree capture as diagnostics only. A `none` basis (no
|
|
141
|
+
baselines, more than one slug live) is a loud not-fresh (`scope-unbound`).
|
|
136
142
|
- `check` compares the stored snapshot with the current worktree:
|
|
137
143
|
`head-changed` / `worktree-changed` mean the evidence belongs to an older
|
|
138
|
-
tree
|
|
144
|
+
tree, `scope-unbound` means the scoped binding cannot be recomputed. Snapshots
|
|
145
|
+
recorded before the rename keep comparing via the legacy `worktreeHash` field.
|
|
146
|
+
`--strict` exits `1` when stale and `2` when missing.
|
|
139
147
|
- When a `build-verifier` attempt finishes without an explicit `record`, the
|
|
140
148
|
chain hook seeds the file once (`gate.status: snapshot-only`): the git snapshot
|
|
141
149
|
plus a SHA-256 of `validation-report.md`, with `commands: []`. An existing file
|
|
@@ -10,4 +10,6 @@ When the user message looks like a **work request** (implement, add, fix, refact
|
|
|
10
10
|
6. **Reuse the dialogue language already resolved on this turn** (always-on `ai-local-overlay` / **language-policy**). A question and a message without a slash command still resolve before you speak. When this request writes `prompt.md`, persist that tag once in the header (`language: <BCP-47>`) + a `.memlog.md` `event:` line. Development, reasoning, and artifacts stay English. The setting wins over a mid-task prompt switch (surface it once, never ask). See **language-policy**.
|
|
11
11
|
7. **Project the intake write.** After `prompt.md` is written for an inline (non-`/task`) work request, run `node .ai.local/scripts/team-db.mjs sync --slug <slug> --deadline-ms 4500` once, so the new task row and its prompt reach the database. A projection failure is reported to the user, never blocks the request; the next full sync remains the convergence path. Do not run a full sync from intake.
|
|
12
12
|
|
|
13
|
+
On Cursor, Mavis, OpenCode and ZCode — the hosts without a verified prompt hook — run a request that is not already `/task` or `/task-continue` as `/task` when `node .ai.local/scripts/settings.mjs get AI_RULES_AUTOROUTE_UNCHAINED_PROMPTS` prints `true` and the live-slug count (every `.ai.local/team/tasks/*/status.json` whose `state` is not one of `completed`, `blocked`, `changes_requested`, `validation_failed`) is below the `node .ai.local/scripts/settings.mjs get AI_RULES_MAX_PARALLEL_TASKS` cap (`4` by default; `0` = unlimited). A prompt that names an existing slug or is a resume intent (`continue` / `resume` / `продолжай` family, `.ai.local/rules/task-resume.md`) routes to `/task-continue <slug>` regardless of the cap. <!-- i18n-keep: E4 -->
|
|
14
|
+
|
|
13
15
|
Exceptions: user explicitly says “no pipeline”, “just do it”, or continues an active slug.
|
|
@@ -237,7 +237,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
237
237
|
3. One role per Task call — **except** parallel steps: multiple Task calls in one message.
|
|
238
238
|
4. **Never** skip `humanGates` without `/task-continue` or explicit user approval.
|
|
239
239
|
5. Persist handoffs to disk (`brief.md`, `decomposition.md`, `debug-report.md`, `validation-report.md`, `architecture.md`, `migration-plan.md`, `ci-report.md`, `a11y-review.md`, `perf-report.md`, `security-review.md`, `api-contract-review.md`, `unit-test-plan.md`, `documentation.md`, `review.md`, `mockup-review.md`, `ux-design.md`) and update the producer-owned terminal receipt in `artifact-manifest.json`.
|
|
240
|
-
6. On `changes_requested` from reviewers: hook sets `retryAfterFix` → developer → `build-verifier` (delta) → same reviewer when the fix touches code/tests; a docs/artifacts-only fix returns to the same reviewer without a code gate. Exception: embedded `mockup-reviewer` FAIL (`changes_requested` while the completed/current agent is `mockup-reviewer`) → `awaiting_approval` / `/task-continue` only — do **not** `retryAfterFix` to developer. A `mockup-reviewer` verdict `mockup-change-requested` (a defect whose fix belongs in the design source, not the implementation) routes the same way — `awaiting_approval`, no developer retry.
|
|
240
|
+
6. On `changes_requested` from reviewers: the first time that agent returns it, the hook sets `retryAfterFix` → developer → `build-verifier` (delta) → same reviewer when the fix touches code/tests; a docs/artifacts-only fix returns to the same reviewer without a code gate. The second `changes_requested` from the same agent is a human gate (`awaitingHumanGate`, `designEscalation`): do not dispatch the developer. Append `decision: replan rev N → N+1` to `.memlog.md` (the decision changes the model), then `/task-continue`, which the hook accepts only when that line is new. Exception: embedded `mockup-reviewer` FAIL (`changes_requested` while the completed/current agent is `mockup-reviewer`) → `awaiting_approval` / `/task-continue` only — do **not** `retryAfterFix` to developer. A `mockup-reviewer` verdict `mockup-change-requested` (a defect whose fix belongs in the design source, not the implementation) routes the same way — `awaiting_approval`, no developer retry.
|
|
241
241
|
7. On `validation_failed` from `build-verifier`: hook sets `retryAfterFix: build-verifier` → developer → build-verifier (delta).
|
|
242
242
|
8. When all steps complete, suggest `/technical-retro <slug>`.
|
|
243
243
|
9. If `autoChain: false` in pipeline, do not rely on hook — manual step only.
|
|
@@ -263,12 +263,12 @@ Use Task tool or `/agent-name`. Pass: slug, artifact paths, step `scope` if set.
|
|
|
263
263
|
### Model when invoking (Task)
|
|
264
264
|
|
|
265
265
|
1. Read `steps[i].model` if present; else use the agent’s frontmatter `model` (see `agents/README.md` matrix).
|
|
266
|
-
2. Resolve the tier through `.ai.local/team/model-tiers.json` → `tiers.<tier>` when that file
|
|
266
|
+
2. Resolve the tier through `.ai.local/team/model-tiers.json` → `tiers.<tier>` when that file is an approved map. An empty `tiers` object with an empty `approvedBy` is the unfilled template: omit the model and the session model applies. Once `approvedBy` is set or any tier value is set, the file is the map, so passing an explicit model is allowed. Pass the resolved `providerID/modelID` (or `providerID/modelID#variant`) to the Task/subagent tool.
|
|
267
267
|
- **`cheap`** → router, analyst, tech-writer, codebase-analyzer, and the review roles `code-reviewer`, `build-verifier`, `api-contract-reviewer`, `mockup-reviewer`. Resolve the provider through `.ai.local/team/model-tiers.json`. Do not write a provider id into the agent file. Pass the mapped id as written; do not append `#high`.
|
|
268
268
|
- **`standard`** → implementation and the other non-review specialists. `feature-developer` stays on this tier.
|
|
269
269
|
- **`strong`** → architecture, security, migration, performance. Never downgrade a `strong` step to the parent default, and do not put `mockup-reviewer` on `strong`.
|
|
270
|
-
- When `steps[i].model` is omitted and the agent file has no `model`, those four review roles stay `cheap` when
|
|
271
|
-
- If a tier is declared
|
|
270
|
+
- When `steps[i].model` is omitted and the agent file has no `model`, those four review roles stay `cheap` when the map has a `cheap` value. Without the file, or while the template is still empty, omit the model and the session model applies.
|
|
271
|
+
- If a tier is declared, the map is approved, and that tier has no mapping, **STOP** and report `model-tier-unmapped`; do not silently inherit the parent model.
|
|
272
272
|
3. If the tool does not accept a model (Cursor/Claude adapters), record the resolved tier in the handoff and let the platform pin apply.
|
|
273
273
|
4. Parallel steps: apply the step-level `model` to **each** agent in the array (or omit → each agent’s own frontmatter).
|
|
274
274
|
5. The tier never changes the step order, gates, receipts, or retry policy.
|
|
@@ -281,7 +281,7 @@ node .ai.local/scripts/record-usage.mjs --task <slug> --attempt <attemptId> --in
|
|
|
281
281
|
|
|
282
282
|
The chain hook also forwards a `usage` object from its input into the `attempt_finished` event. Never estimate or invent token counts; a missing usage record stays missing.
|
|
283
283
|
|
|
284
|
-
After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt.
|
|
284
|
+
After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt. **MUST: pass `TEAM_TASK_SLUG=<slug>` on every hook call** — `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` (or the host's hook path). With more than one live slug, an omitted env is a hook refusal (`active-task-pointer-ambiguous`, `ok:false`), never a silent reroute: re-run with the env set. The OpenCode task-status plugin pins each tab in `.ai.local/team/.session-leases/<session>.json` and injects `AI_RULES_SESSION_ID` on `shell.env`, so a later hook call in that tab resolves through the lease when `TEAM_TASK_SLUG` is omitted. `active-task.json` is the live-slug list, not a tab binding. Do not ask the agent to mutate shared lifecycle fields, and do not invoke the next specialist until the hook has written the handoff / updated `status.json`.
|
|
285
285
|
|
|
286
286
|
## Legacy mode
|
|
287
287
|
|