@bonesofspring/ai-rules 0.2.73 → 0.2.76
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 +88 -0
- package/README.md +2 -2
- package/bin/lib/engine-scripts.js +12 -0
- package/docs/TEAM-DB.md +96 -5
- package/docs/TOKEN-ECONOMY.md +18 -5
- package/docs/openapi/team-db.v1.json +1164 -224
- package/package.json +2 -2
- 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/check-write-scope.mjs +56 -26
- package/presets/_shared/ai-local/scripts/lock.mjs +103 -30
- 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/rule-improver.mjs +4 -0
- package/presets/_shared/ai-local/scripts/run-compact.mjs +132 -0
- package/presets/_shared/ai-local/scripts/signals.mjs +3 -1
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +354 -11
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +309 -4
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +515 -26
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +32 -2
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +185 -1
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +3 -1
- package/presets/_shared/core/agent-team/agent-task-metrics.md +29 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
- package/presets/_shared/core/meta/preset-pr-checklist.md +2 -2
- package/presets/_shared/core/quality/context-and-iteration.md +1 -1
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +18 -1
- package/presets/_shared/hooks/compact-shell-output.mjs +68 -0
- 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 +18 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/android-kotlin/team/README.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 +18 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/go/team/README.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 +18 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/ios-swift/team/README.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 +18 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/java/team/README.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 +18 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/mcp-ts/team/README.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 +18 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/mol/team/README.md +1 -1
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/code-reviewer.md +2 -0
- 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 +18 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/next/team/README.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 +18 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/nuxt/team/README.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 +18 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/php-hexagonal/team/README.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 +18 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/php-laravel/team/README.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 +18 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/svelte/team/README.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 +18 -1
- package/presets/cursor/android-kotlin/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/android-kotlin/hooks.json +7 -0
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/android-kotlin/team/README.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 +18 -1
- package/presets/cursor/go/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/go/hooks.json +7 -0
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/go/team/README.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 +18 -1
- package/presets/cursor/ios-swift/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/ios-swift/hooks.json +7 -0
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/ios-swift/team/README.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 +18 -1
- package/presets/cursor/java/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/java/hooks.json +7 -0
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/java/team/README.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 +18 -1
- package/presets/cursor/mcp-ts/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/mcp-ts/hooks.json +7 -0
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mcp-ts/team/README.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 +18 -1
- package/presets/cursor/mol/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/mol/hooks.json +7 -0
- package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mol/team/README.md +1 -1
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +2 -0
- 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 +18 -1
- package/presets/cursor/next/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/next/hooks.json +7 -0
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/next/team/README.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 +18 -1
- package/presets/cursor/nuxt/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/nuxt/hooks.json +7 -0
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/nuxt/team/README.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 +18 -1
- package/presets/cursor/php-hexagonal/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/php-hexagonal/hooks.json +7 -0
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-hexagonal/team/README.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 +18 -1
- package/presets/cursor/php-laravel/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/php-laravel/hooks.json +7 -0
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-laravel/team/README.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 +18 -1
- package/presets/cursor/svelte/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/svelte/hooks.json +7 -0
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/svelte/team/README.md +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/android-kotlin/team/README.md +1 -1
- package/presets/mavis/go/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/go/team/README.md +1 -1
- package/presets/mavis/ios-swift/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/ios-swift/team/README.md +1 -1
- package/presets/mavis/java/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/java/team/README.md +1 -1
- package/presets/mavis/mcp-ts/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mcp-ts/team/README.md +1 -1
- package/presets/mavis/mol/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mol/team/README.md +1 -1
- package/presets/mavis/next/adapter-map.json +17 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +2 -0
- 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 +18 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/next/team/README.md +1 -1
- package/presets/mavis/nuxt/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/nuxt/team/README.md +1 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-hexagonal/team/README.md +1 -1
- package/presets/mavis/php-laravel/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-laravel/team/README.md +1 -1
- package/presets/mavis/svelte/adapter-map.json +17 -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 +18 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/svelte/team/README.md +1 -1
- package/presets/opencode/android-kotlin/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/android-kotlin/team/README.md +1 -1
- package/presets/opencode/go/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/go/team/README.md +1 -1
- package/presets/opencode/ios-swift/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/ios-swift/team/README.md +1 -1
- package/presets/opencode/java/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/java/team/README.md +1 -1
- package/presets/opencode/mcp-ts/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mcp-ts/team/README.md +1 -1
- package/presets/opencode/mol/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mol/team/README.md +1 -1
- package/presets/opencode/next/adapter-map.json +17 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +2 -0
- 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 +18 -1
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/next/team/README.md +1 -1
- package/presets/opencode/nuxt/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/nuxt/team/README.md +1 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-hexagonal/team/README.md +1 -1
- package/presets/opencode/php-laravel/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-laravel/team/README.md +1 -1
- package/presets/opencode/plugins/output-guard/README.md +45 -3
- 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 +10 -1
- package/presets/opencode/svelte/adapter-map.json +17 -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 +18 -1
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/svelte/team/README.md +1 -1
- package/presets/zcode/android-kotlin/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/android-kotlin/team/README.md +1 -1
- package/presets/zcode/go/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/go/team/README.md +1 -1
- package/presets/zcode/ios-swift/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/ios-swift/team/README.md +1 -1
- package/presets/zcode/java/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/java/team/README.md +1 -1
- package/presets/zcode/mcp-ts/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mcp-ts/team/README.md +1 -1
- package/presets/zcode/mol/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mol/team/README.md +1 -1
- package/presets/zcode/next/adapter-map.json +17 -1
- package/presets/zcode/next/agents/build-verifier.md +1 -1
- package/presets/zcode/next/agents/code-reviewer.md +2 -0
- 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 +18 -1
- package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/next/team/README.md +1 -1
- package/presets/zcode/nuxt/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/nuxt/team/README.md +1 -1
- package/presets/zcode/php-hexagonal/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-hexagonal/team/README.md +1 -1
- package/presets/zcode/php-laravel/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-laravel/team/README.md +1 -1
- package/presets/zcode/svelte/adapter-map.json +17 -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 +18 -1
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/svelte/team/README.md +1 -1
- package/scripts/close-agent-task-human-gate.mjs +3 -3
- package/scripts/report-context-cost.mjs +10 -3
- package/scripts/aggregate-agent-task-metrics.mjs +0 -480
|
@@ -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.
|
|
@@ -58,12 +58,29 @@ function readSessionLease(id) {
|
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
// The lease carries the window the projector attributes rows with — never one
|
|
62
|
+
// instant. `firstSeenAt` survives every later write of the same (session, slug)
|
|
63
|
+
// pair; a different slug starts a new window, and a lease older than the TTL
|
|
64
|
+
// starts over instead of claiming an ancient first sighting.
|
|
65
|
+
function firstSeenAtOf(file, value, now) {
|
|
66
|
+
try {
|
|
67
|
+
if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
|
|
68
|
+
const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
69
|
+
if (previous && previous.slug === value) {
|
|
70
|
+
if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
|
|
71
|
+
if (typeof previous.updatedAt === 'string') return previous.updatedAt;
|
|
72
|
+
}
|
|
73
|
+
} catch {}
|
|
74
|
+
return now;
|
|
75
|
+
}
|
|
61
76
|
function writeSessionLease(id, value) {
|
|
62
77
|
try {
|
|
63
78
|
fs.mkdirSync(LEASE_ROOT, { recursive: true });
|
|
64
79
|
const file = sessionLeasePath(id);
|
|
65
80
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
66
|
-
|
|
81
|
+
const now = new Date().toISOString();
|
|
82
|
+
const firstSeenAt = firstSeenAtOf(file, value, now);
|
|
83
|
+
fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
|
|
67
84
|
fs.renameSync(temporary, file);
|
|
68
85
|
for (const name of fs.readdirSync(LEASE_ROOT)) {
|
|
69
86
|
if (!name.endsWith('.json')) continue;
|
|
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
233
233
|
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
234
234
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
235
235
|
|
|
236
|
-
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
236
|
+
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
237
237
|
|
|
238
238
|
## Rules (strict)
|
|
239
239
|
|
|
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
23
23
|
- [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
|
|
24
24
|
- [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
|
|
25
25
|
- [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
|
|
26
|
-
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-
|
|
26
|
+
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
|
|
27
27
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
28
28
|
- [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
|
|
29
29
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
40
40
|
- Budget: `preset-token-budget`
|
|
41
41
|
- Leakage: `preset-no-cross-stack-leakage`
|
|
42
42
|
- Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
|
|
43
|
-
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
|
|
43
|
+
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
|
|
44
44
|
- Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
|
|
45
45
|
- Orchestrator: when editing presets, load this checklist + twin-sync
|
|
@@ -124,5 +124,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
|
|
|
124
124
|
- **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
|
|
125
125
|
- **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
|
|
126
126
|
- Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
|
|
127
|
-
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
127
|
+
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
128
128
|
- Commit `.ai.local/team/` templates (and slugs if you want them in clones).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"platform": "opencode",
|
|
4
4
|
"stack": "mcp-ts",
|
|
5
5
|
"semanticSource": "cursor/mcp-ts",
|
|
6
|
-
"sourceRevision": "
|
|
6
|
+
"sourceRevision": "d78d43d57df29207a35e3fe9d7311ad2f269c962014c77fda5bfc4a0e79b9045",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
9
9
|
"source": "AGENTS.md",
|
|
@@ -107,6 +107,14 @@
|
|
|
107
107
|
"loadMode": "native-skill",
|
|
108
108
|
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
"source": "commands/rr-scheduler-start.md",
|
|
112
|
+
"target": "commands/rr-scheduler-start.md",
|
|
113
|
+
"category": "commands",
|
|
114
|
+
"disposition": "transform",
|
|
115
|
+
"loadMode": "native-skill",
|
|
116
|
+
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
117
|
+
},
|
|
110
118
|
{
|
|
111
119
|
"source": "commands/spec-start.md",
|
|
112
120
|
"target": "commands/spec-start.md",
|
|
@@ -172,6 +180,14 @@
|
|
|
172
180
|
"loadMode": "manual",
|
|
173
181
|
"reason": "Agent-run version check on the first reply; no native session hook on OpenCode"
|
|
174
182
|
},
|
|
183
|
+
{
|
|
184
|
+
"source": "hooks/compact-shell-output.mjs",
|
|
185
|
+
"target": null,
|
|
186
|
+
"category": "hooks",
|
|
187
|
+
"disposition": "omit",
|
|
188
|
+
"loadMode": "not-installed",
|
|
189
|
+
"reason": "omit: Cursor preToolUse rewrite; the large-output guard waits for an OpenCode plugin event"
|
|
190
|
+
},
|
|
175
191
|
{
|
|
176
192
|
"source": "hooks/examples/format-edited.example.sh",
|
|
177
193
|
"target": null,
|
|
@@ -9,3 +9,7 @@ Slash commands are copied to `.opencode/commands/` (Cursor) or `.claude/commands
|
|
|
9
9
|
| `/technical-retro` | Retro |
|
|
10
10
|
| `/update` | Reinstall each installed tool with the preset recorded at init |
|
|
11
11
|
| `/migrate-tasks` | Create or reconcile `.ai.local/team/team.db`; writes only the delta |
|
|
12
|
+
|
|
13
|
+
## Scheduler
|
|
14
|
+
|
|
15
|
+
- **`/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.
|
|
@@ -60,12 +60,29 @@ function readSessionLease(id) {
|
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
// The lease carries the window the projector attributes rows with — never one
|
|
64
|
+
// instant. `firstSeenAt` survives every later write of the same (session, slug)
|
|
65
|
+
// pair; a different slug starts a new window, and a lease older than the TTL
|
|
66
|
+
// starts over instead of claiming an ancient first sighting.
|
|
67
|
+
function firstSeenAtOf(file, value, now) {
|
|
68
|
+
try {
|
|
69
|
+
if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
|
|
70
|
+
const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
71
|
+
if (previous && previous.slug === value) {
|
|
72
|
+
if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
|
|
73
|
+
if (typeof previous.updatedAt === 'string') return previous.updatedAt;
|
|
74
|
+
}
|
|
75
|
+
} catch {}
|
|
76
|
+
return now;
|
|
77
|
+
}
|
|
63
78
|
function writeSessionLease(id, value) {
|
|
64
79
|
try {
|
|
65
80
|
fs.mkdirSync(LEASE_ROOT, { recursive: true });
|
|
66
81
|
const file = sessionLeasePath(id);
|
|
67
82
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
68
|
-
|
|
83
|
+
const now = new Date().toISOString();
|
|
84
|
+
const firstSeenAt = firstSeenAtOf(file, value, now);
|
|
85
|
+
fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
|
|
69
86
|
fs.renameSync(temporary, file);
|
|
70
87
|
for (const name of fs.readdirSync(LEASE_ROOT)) {
|
|
71
88
|
if (!name.endsWith('.json')) continue;
|
|
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
233
233
|
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
234
234
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
235
235
|
|
|
236
|
-
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
236
|
+
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
237
237
|
|
|
238
238
|
## Rules (strict)
|
|
239
239
|
|
|
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
23
23
|
- [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
|
|
24
24
|
- [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
|
|
25
25
|
- [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
|
|
26
|
-
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-
|
|
26
|
+
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
|
|
27
27
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
28
28
|
- [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
|
|
29
29
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
40
40
|
- Budget: `preset-token-budget`
|
|
41
41
|
- Leakage: `preset-no-cross-stack-leakage`
|
|
42
42
|
- Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
|
|
43
|
-
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
|
|
43
|
+
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
|
|
44
44
|
- Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
|
|
45
45
|
- Orchestrator: when editing presets, load this checklist + twin-sync
|
|
@@ -124,5 +124,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
|
|
|
124
124
|
- **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
|
|
125
125
|
- **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
|
|
126
126
|
- Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
|
|
127
|
-
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
127
|
+
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
128
128
|
- Commit `.ai.local/team/` templates (and slugs if you want them in clones).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"platform": "opencode",
|
|
4
4
|
"stack": "mol",
|
|
5
5
|
"semanticSource": "cursor/mol",
|
|
6
|
-
"sourceRevision": "
|
|
6
|
+
"sourceRevision": "c49e526c55de10076a87b3777bdf78c4df8106f2380e0ba0a2c8755d012e8e5f",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
9
9
|
"source": "AGENTS.md",
|
|
@@ -485,6 +485,14 @@
|
|
|
485
485
|
"loadMode": "native-skill",
|
|
486
486
|
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
487
487
|
},
|
|
488
|
+
{
|
|
489
|
+
"source": "commands/rr-scheduler-start.md",
|
|
490
|
+
"target": "commands/rr-scheduler-start.md",
|
|
491
|
+
"category": "commands",
|
|
492
|
+
"disposition": "transform",
|
|
493
|
+
"loadMode": "native-skill",
|
|
494
|
+
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
495
|
+
},
|
|
488
496
|
{
|
|
489
497
|
"source": "commands/spec-start.md",
|
|
490
498
|
"target": "commands/spec-start.md",
|
|
@@ -559,6 +567,14 @@
|
|
|
559
567
|
"loadMode": "manual",
|
|
560
568
|
"reason": "Agent-run version check on the first reply; no native session hook on OpenCode"
|
|
561
569
|
},
|
|
570
|
+
{
|
|
571
|
+
"source": "hooks/compact-shell-output.mjs",
|
|
572
|
+
"target": null,
|
|
573
|
+
"category": "hooks",
|
|
574
|
+
"disposition": "omit",
|
|
575
|
+
"loadMode": "not-installed",
|
|
576
|
+
"reason": "omit: Cursor preToolUse rewrite; the large-output guard waits for an OpenCode plugin event"
|
|
577
|
+
},
|
|
562
578
|
{
|
|
563
579
|
"source": "hooks/examples/format-edited.example.sh",
|
|
564
580
|
"target": null,
|
|
@@ -54,3 +54,7 @@ On OpenCode, `/task-evil` runs as the `task-evil` primary agent: the `question`
|
|
|
54
54
|
- Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json`)
|
|
55
55
|
|
|
56
56
|
Create and edit commands via `/commands` in Cursor or directly in this preset folder.
|
|
57
|
+
|
|
58
|
+
## Scheduler
|
|
59
|
+
|
|
60
|
+
- **`/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,29 @@ 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) {
|
|
69
|
+
if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
|
|
70
|
+
if (typeof previous.updatedAt === 'string') return previous.updatedAt;
|
|
71
|
+
}
|
|
72
|
+
} catch {}
|
|
73
|
+
return now;
|
|
74
|
+
}
|
|
60
75
|
function writeSessionLease(id, value) {
|
|
61
76
|
try {
|
|
62
77
|
fs.mkdirSync(LEASE_ROOT, { recursive: true });
|
|
63
78
|
const file = sessionLeasePath(id);
|
|
64
79
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
65
|
-
|
|
80
|
+
const now = new Date().toISOString();
|
|
81
|
+
const firstSeenAt = firstSeenAtOf(file, value, now);
|
|
82
|
+
fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
|
|
66
83
|
fs.renameSync(temporary, file);
|
|
67
84
|
for (const name of fs.readdirSync(LEASE_ROOT)) {
|
|
68
85
|
if (!name.endsWith('.json')) continue;
|
|
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
233
233
|
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
234
234
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
235
235
|
|
|
236
|
-
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
236
|
+
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
237
237
|
|
|
238
238
|
## Rules (strict)
|
|
239
239
|
|
|
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
23
23
|
- [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
|
|
24
24
|
- [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
|
|
25
25
|
- [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
|
|
26
|
-
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-
|
|
26
|
+
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
|
|
27
27
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
28
28
|
- [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
|
|
29
29
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
40
40
|
- Budget: `preset-token-budget`
|
|
41
41
|
- Leakage: `preset-no-cross-stack-leakage`
|
|
42
42
|
- Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
|
|
43
|
-
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
|
|
43
|
+
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
|
|
44
44
|
- Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
|
|
45
45
|
- Orchestrator: when editing presets, load this checklist + twin-sync
|
|
@@ -136,5 +136,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
|
|
|
136
136
|
- **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
|
|
137
137
|
- **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
|
|
138
138
|
- Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
|
|
139
|
-
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
139
|
+
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
140
140
|
- Commit `.ai.local/team/` templates (and slugs if you want them in clones).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"platform": "opencode",
|
|
4
4
|
"stack": "next",
|
|
5
5
|
"semanticSource": "cursor/next",
|
|
6
|
-
"sourceRevision": "
|
|
6
|
+
"sourceRevision": "adbff2daf9d6ec609b4a43565d78c28a89b426f2fa9ead622978c39ad9cf8c9a",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
9
9
|
"source": "AGENTS.md",
|
|
@@ -485,6 +485,14 @@
|
|
|
485
485
|
"loadMode": "native-skill",
|
|
486
486
|
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
487
487
|
},
|
|
488
|
+
{
|
|
489
|
+
"source": "commands/rr-scheduler-start.md",
|
|
490
|
+
"target": "commands/rr-scheduler-start.md",
|
|
491
|
+
"category": "commands",
|
|
492
|
+
"disposition": "transform",
|
|
493
|
+
"loadMode": "native-skill",
|
|
494
|
+
"reason": "Native slash commands under .opencode/commands; $ARGUMENTS kept"
|
|
495
|
+
},
|
|
488
496
|
{
|
|
489
497
|
"source": "commands/spec-start.md",
|
|
490
498
|
"target": "commands/spec-start.md",
|
|
@@ -583,6 +591,14 @@
|
|
|
583
591
|
"loadMode": "manual",
|
|
584
592
|
"reason": "Agent-run version check on the first reply; no native session hook on OpenCode"
|
|
585
593
|
},
|
|
594
|
+
{
|
|
595
|
+
"source": "hooks/compact-shell-output.mjs",
|
|
596
|
+
"target": null,
|
|
597
|
+
"category": "hooks",
|
|
598
|
+
"disposition": "omit",
|
|
599
|
+
"loadMode": "not-installed",
|
|
600
|
+
"reason": "omit: Cursor preToolUse rewrite; the large-output guard waits for an OpenCode plugin event"
|
|
601
|
+
},
|
|
586
602
|
{
|
|
587
603
|
"source": "hooks/examples/format-edited.example.sh",
|
|
588
604
|
"target": null,
|
|
@@ -98,7 +98,7 @@ git diff --stat <last-green-ref> -- app storybook
|
|
|
98
98
|
|
|
99
99
|
Before writing `validation-report.md` or claiming PASS: IDENTIFY the commands, RUN them, READ exit codes, VERIFY they match the verdict, THEN claim. Do not mark PASS from memory of a prior developer run.
|
|
100
100
|
|
|
101
|
-
**Write-scope audit.** When `.ai.local/team/tasks/<slug>/pipeline.json` exists, run `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <implementation-step> --json` before the verdict (in the package repo without a seeded engine copy, use `node packages/ai-rules/presets/_shared/ai-local/scripts/check-write-scope.mjs`). Exit `3` is a **skip, not a failure**: the pipeline predates step ids or `writeScopes`, so quote the printed reason and hint under `## Soft notes` and continue. On exit `0`/`1`, an `out-of-scope` path on an implementation step is a **FAIL**; quote the labelled report and name each path's source. A reviewer-step advisory goes under `## Soft notes`. Never substitute a hand-made path list for the labelled report.
|
|
101
|
+
**Write-scope audit.** When `.ai.local/team/tasks/<slug>/pipeline.json` exists, run `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <implementation-step> --json` before the verdict (in the package repo without a seeded engine copy, use `node packages/ai-rules/presets/_shared/ai-local/scripts/check-write-scope.mjs`). Exit `3` is a **skip, not a failure**: the pipeline predates step ids or `writeScopes`, or the step wrote without a saved baseline (`skipReason: no-baseline`), so quote the printed reason and hint under `## Soft notes` and continue. Exit `2` is a **usage error** (unknown step, unreadable `pipeline.json`, failed git ref): the audit did not run, so it is neither a pass nor a finding — quote the message, fix the invocation, and re-run. A `no-baseline` skip is an **orchestration defect, not a pass** — its paths are the whole uncommitted change-set and belong to no step, so the orchestrator saves the step baseline (`--step <id> --save-baseline`) before the step writes and the audit is re-run. On exit `0`/`1`, an `out-of-scope` path on an implementation step is a **FAIL**; quote the labelled report and name each path's source. A reviewer-step advisory goes under `## Soft notes`. Never substitute a hand-made path list for the labelled report.
|
|
102
102
|
|
|
103
103
|
## Self-review & context hygiene
|
|
104
104
|
|
|
@@ -61,6 +61,8 @@ You **issue** reviews. Implementers acting on your findings must verify each ite
|
|
|
61
61
|
## Write-scope audit
|
|
62
62
|
|
|
63
63
|
- When `.ai.local/team/tasks/<slug>/pipeline.json` exists, run `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` before the verdict (in the package repo without a seeded engine copy, use `node packages/ai-rules/presets/_shared/ai-local/scripts/check-write-scope.mjs`).
|
|
64
|
+
- Exit `3` is a skip, not a finding: a `no-baseline` skip means the step wrote without its baseline, so its paths belong to no step — report the reason under `## Warnings` and ask for the baseline, never claim a scope violation.
|
|
65
|
+
- Exit `2` is a usage error (unknown step, unreadable `pipeline.json`): the audit did not run, so quote the message and ask for the invocation to be fixed; it is neither a warning nor a scope violation.
|
|
64
66
|
- An `out-of-scope` path on a reviewer step is advisory: report it under `## Warnings` with its labelled source; it does not by itself force `REQUEST_CHANGES`.
|
|
65
67
|
- An `out-of-scope` path the verifier already hard-failed stays a finding; do not re-litigate the gate. Cite the labelled report path, never a hand-made path list.
|
|
66
68
|
|
|
@@ -60,3 +60,7 @@ On OpenCode, `/task-evil` runs as the `task-evil` primary agent: the `question`
|
|
|
60
60
|
- Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json`)
|
|
61
61
|
|
|
62
62
|
Create and edit commands via `/commands` in Cursor or directly in this preset folder.
|
|
63
|
+
|
|
64
|
+
## Scheduler
|
|
65
|
+
|
|
66
|
+
- **`/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,29 @@ 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) {
|
|
69
|
+
if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
|
|
70
|
+
if (typeof previous.updatedAt === 'string') return previous.updatedAt;
|
|
71
|
+
}
|
|
72
|
+
} catch {}
|
|
73
|
+
return now;
|
|
74
|
+
}
|
|
60
75
|
function writeSessionLease(id, value) {
|
|
61
76
|
try {
|
|
62
77
|
fs.mkdirSync(LEASE_ROOT, { recursive: true });
|
|
63
78
|
const file = sessionLeasePath(id);
|
|
64
79
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
65
|
-
|
|
80
|
+
const now = new Date().toISOString();
|
|
81
|
+
const firstSeenAt = firstSeenAtOf(file, value, now);
|
|
82
|
+
fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
|
|
66
83
|
fs.renameSync(temporary, file);
|
|
67
84
|
for (const name of fs.readdirSync(LEASE_ROOT)) {
|
|
68
85
|
if (!name.endsWith('.json')) continue;
|
|
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
233
233
|
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
234
234
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
235
235
|
|
|
236
|
-
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
236
|
+
`writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
|
|
237
237
|
|
|
238
238
|
## Rules (strict)
|
|
239
239
|
|
|
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
23
23
|
- [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
|
|
24
24
|
- [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
|
|
25
25
|
- [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
|
|
26
|
-
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-
|
|
26
|
+
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
|
|
27
27
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
28
28
|
- [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
|
|
29
29
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
40
40
|
- Budget: `preset-token-budget`
|
|
41
41
|
- Leakage: `preset-no-cross-stack-leakage`
|
|
42
42
|
- Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
|
|
43
|
-
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
|
|
43
|
+
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
|
|
44
44
|
- Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
|
|
45
45
|
- Orchestrator: when editing presets, load this checklist + twin-sync
|
|
@@ -162,5 +162,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
|
|
|
162
162
|
- **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
|
|
163
163
|
- **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
|
|
164
164
|
- Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
|
|
165
|
-
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
165
|
+
- Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
|
|
166
166
|
- Commit `.ai.local/team/` templates (and slugs if you want them in clones).
|