@bonesofspring/ai-rules 0.2.74 → 0.2.77
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 +119 -0
- package/README.md +2 -2
- package/bin/lib/engine-scripts.js +4 -0
- package/docs/PRESET-CONTRIBUTION.md +6 -3
- package/docs/TEAM-DB.md +10 -0
- package/docs/TOKEN-ECONOMY.md +18 -5
- package/docs/ZCODE.md +1 -1
- package/package.json +6 -2
- package/presets/_shared/ai-local/scripts/check-write-scope.mjs +126 -34
- package/presets/_shared/ai-local/scripts/lock.mjs +103 -30
- 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 +7 -2
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +276 -1
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +32 -2
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +99 -0
- 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/architecture/feature-delivery-workflow.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 +4 -1
- package/presets/_shared/hooks/compact-shell-output.mjs +68 -0
- package/presets/claude/android-kotlin/CLAUDE.md +1 -1
- package/presets/claude/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/claude/android-kotlin/agents/README.md +4 -0
- package/presets/claude/android-kotlin/agents/accessibility-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/claude/android-kotlin/agents/ci-investigator.md +0 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/codebase-analyzer.md +1 -1
- package/presets/claude/android-kotlin/agents/debugger.md +0 -1
- package/presets/claude/android-kotlin/agents/feature-developer.md +0 -1
- package/presets/claude/android-kotlin/agents/migration-specialist.md +1 -1
- package/presets/claude/android-kotlin/agents/mockup-reviewer.md +1 -0
- package/presets/claude/android-kotlin/agents/openspec-author.md +2 -1
- package/presets/claude/android-kotlin/agents/performance-auditor.md +1 -1
- package/presets/claude/android-kotlin/agents/qa-tester.md +0 -1
- package/presets/claude/android-kotlin/agents/security-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/solution-architect.md +1 -1
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/agents/task-router.md +1 -1
- package/presets/claude/android-kotlin/agents/tech-writer.md +1 -1
- package/presets/claude/android-kotlin/agents/unit-test-generator.md +0 -1
- package/presets/claude/android-kotlin/agents/unit-test-healer.md +0 -1
- package/presets/claude/android-kotlin/agents/unit-test-planner.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/android-kotlin/rules/architecture/feature-delivery.md +66 -8
- package/presets/claude/android-kotlin/rules/architecture/reference-features.md +48 -2
- 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/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/android-kotlin/team/README.md +1 -1
- package/presets/claude/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/go/CLAUDE.md +1 -1
- package/presets/claude/go/REPO_AGENTS.md +8 -0
- package/presets/claude/go/agents/README.md +4 -0
- package/presets/claude/go/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/go/agents/build-verifier.md +1 -1
- package/presets/claude/go/agents/ci-investigator.md +0 -1
- package/presets/claude/go/agents/code-reviewer.md +3 -3
- package/presets/claude/go/agents/codebase-analyzer.md +1 -1
- package/presets/claude/go/agents/debugger.md +0 -1
- package/presets/claude/go/agents/feature-developer.md +2 -3
- package/presets/claude/go/agents/integration-test-generator.md +1 -2
- package/presets/claude/go/agents/integration-test-healer.md +1 -2
- package/presets/claude/go/agents/integration-test-planner.md +1 -2
- package/presets/claude/go/agents/migration-specialist.md +1 -1
- package/presets/claude/go/agents/openspec-author.md +2 -1
- package/presets/claude/go/agents/performance-auditor.md +1 -1
- package/presets/claude/go/agents/qa-tester.md +0 -1
- package/presets/claude/go/agents/security-reviewer.md +2 -2
- package/presets/claude/go/agents/solution-architect.md +1 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/agents/task-router.md +1 -1
- package/presets/claude/go/agents/tech-writer.md +1 -1
- package/presets/claude/go/agents/unit-test-generator.md +1 -2
- package/presets/claude/go/agents/unit-test-healer.md +1 -2
- package/presets/claude/go/agents/unit-test-planner.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/go/rules/architecture/feature-delivery.md +50 -1
- package/presets/claude/go/rules/architecture/reference-features.md +22 -0
- 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/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/go/team/README.md +1 -1
- package/presets/claude/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/ios-swift/CLAUDE.md +1 -1
- package/presets/claude/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/claude/ios-swift/agents/README.md +4 -0
- package/presets/claude/ios-swift/agents/accessibility-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/ci-investigator.md +0 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/codebase-analyzer.md +1 -1
- package/presets/claude/ios-swift/agents/debugger.md +0 -1
- package/presets/claude/ios-swift/agents/feature-developer.md +0 -1
- package/presets/claude/ios-swift/agents/migration-specialist.md +1 -1
- package/presets/claude/ios-swift/agents/mockup-reviewer.md +1 -0
- package/presets/claude/ios-swift/agents/openspec-author.md +2 -1
- package/presets/claude/ios-swift/agents/performance-auditor.md +1 -1
- package/presets/claude/ios-swift/agents/qa-tester.md +0 -1
- package/presets/claude/ios-swift/agents/security-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/solution-architect.md +1 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/agents/task-router.md +1 -1
- package/presets/claude/ios-swift/agents/tech-writer.md +1 -1
- package/presets/claude/ios-swift/agents/unit-test-generator.md +0 -1
- package/presets/claude/ios-swift/agents/unit-test-healer.md +0 -1
- package/presets/claude/ios-swift/agents/unit-test-planner.md +1 -1
- package/presets/claude/ios-swift/agents/xcuitest-test-generator.md +0 -1
- package/presets/claude/ios-swift/agents/xcuitest-test-healer.md +0 -1
- package/presets/claude/ios-swift/agents/xcuitest-test-planner.md +0 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +8 -8
- package/presets/claude/ios-swift/rules/architecture/reference-features.md +2 -21
- 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/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/ios-swift/team/README.md +1 -1
- package/presets/claude/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/java/CLAUDE.md +2 -2
- package/presets/claude/java/REPO_AGENTS.md +8 -0
- package/presets/claude/java/agents/README.md +4 -0
- package/presets/claude/java/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/ci-investigator.md +0 -1
- package/presets/claude/java/agents/code-reviewer.md +3 -3
- package/presets/claude/java/agents/codebase-analyzer.md +1 -1
- package/presets/claude/java/agents/debugger.md +0 -1
- package/presets/claude/java/agents/feature-developer.md +2 -3
- package/presets/claude/java/agents/integration-test-generator.md +1 -2
- package/presets/claude/java/agents/integration-test-healer.md +1 -2
- package/presets/claude/java/agents/integration-test-planner.md +1 -2
- package/presets/claude/java/agents/migration-specialist.md +1 -1
- package/presets/claude/java/agents/openspec-author.md +2 -1
- package/presets/claude/java/agents/performance-auditor.md +1 -1
- package/presets/claude/java/agents/qa-tester.md +0 -1
- package/presets/claude/java/agents/security-reviewer.md +2 -2
- package/presets/claude/java/agents/solution-architect.md +1 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/agents/task-router.md +1 -1
- package/presets/claude/java/agents/tech-writer.md +1 -1
- package/presets/claude/java/agents/unit-test-generator.md +1 -2
- package/presets/claude/java/agents/unit-test-healer.md +1 -2
- package/presets/claude/java/agents/unit-test-planner.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/java/rules/architecture/feature-delivery.md +51 -1
- package/presets/claude/java/rules/architecture/reference-features.md +22 -0
- 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/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/java/team/README.md +1 -1
- package/presets/claude/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/mcp-ts/CLAUDE.md +1 -1
- package/presets/claude/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/claude/mcp-ts/agents/README.md +4 -0
- package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/claude/mcp-ts/agents/feature-developer.md +2 -3
- package/presets/claude/mcp-ts/agents/security-reviewer.md +2 -2
- package/presets/claude/mcp-ts/agents/solution-architect.md +1 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/agents/task-router.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +47 -1
- package/presets/claude/mcp-ts/rules/architecture/reference-features.md +22 -0
- 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/skills/code-review/SKILL.md +1 -1
- package/presets/claude/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/mcp-ts/team/README.md +1 -1
- package/presets/claude/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/mol/CLAUDE.md +1 -1
- package/presets/claude/mol/REPO_AGENTS.md +8 -0
- package/presets/claude/mol/agents/README.md +2 -4
- package/presets/claude/mol/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/mol/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/mol/agents/build-verifier.md +1 -0
- package/presets/claude/mol/agents/code-reviewer.md +1 -0
- package/presets/claude/mol/agents/codebase-analyzer.md +1 -0
- package/presets/claude/mol/agents/migration-specialist.md +1 -0
- package/presets/claude/mol/agents/mockup-reviewer.md +1 -0
- package/presets/claude/mol/agents/openspec-author.md +1 -0
- package/presets/claude/mol/agents/performance-auditor.md +1 -0
- package/presets/claude/mol/agents/security-reviewer.md +1 -0
- package/presets/claude/mol/agents/solution-architect.md +1 -0
- package/presets/claude/mol/agents/task-analyst.md +1 -0
- package/presets/claude/mol/agents/task-router.md +1 -0
- package/presets/claude/mol/agents/tech-writer.md +1 -0
- package/presets/claude/mol/agents/unit-test-planner.md +1 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +10 -10
- package/presets/claude/mol/rules/architecture/reference-features.md +0 -19
- 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/CLAUDE.md +3 -3
- package/presets/claude/next/REPO_AGENTS.md +8 -0
- package/presets/claude/next/agents/README.md +4 -0
- package/presets/claude/next/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/next/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/next/agents/build-verifier.md +2 -1
- package/presets/claude/next/agents/code-reviewer.md +3 -0
- package/presets/claude/next/agents/codebase-analyzer.md +1 -1
- package/presets/claude/next/agents/migration-specialist.md +1 -0
- package/presets/claude/next/agents/mockup-reviewer.md +1 -0
- package/presets/claude/next/agents/openspec-author.md +1 -0
- package/presets/claude/next/agents/performance-auditor.md +1 -0
- package/presets/claude/next/agents/security-reviewer.md +1 -0
- package/presets/claude/next/agents/solution-architect.md +1 -0
- package/presets/claude/next/agents/task-analyst.md +1 -0
- package/presets/claude/next/agents/task-router.md +12 -0
- package/presets/claude/next/agents/tech-writer.md +1 -0
- package/presets/claude/next/agents/unit-test-planner.md +1 -0
- package/presets/claude/next/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/claude/next/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/claude/next/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/claude/next/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/claude/next/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/claude/next/ai-local/rules-library/code-style.md +68 -0
- package/presets/claude/next/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/claude/next/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/claude/next/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/claude/next/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/claude/next/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/claude/next/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/claude/next/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/claude/next/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/claude/next/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/claude/next/ai-local/rules-library/router-pages.md +25 -0
- package/presets/claude/next/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/claude/next/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/claude/next/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/claude/next/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/claude/next/ai-local/rules-library/storybook-dev-compare-figma.md +72 -0
- package/presets/claude/next/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/claude/next/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/claude/next/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/claude/next/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/claude/next/ai-local/rules-library/ui-change-review-gate.md +16 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +13 -13
- package/presets/claude/next/rules/architecture/reference-features.md +0 -19
- package/presets/claude/next/rules/stack/next-app-core.md +1 -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/next/team/fixtures/feature-l2-lite.json +27 -0
- package/presets/claude/nuxt/CLAUDE.md +3 -3
- package/presets/claude/nuxt/REPO_AGENTS.md +8 -0
- package/presets/claude/nuxt/agents/README.md +2 -4
- package/presets/claude/nuxt/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/build-verifier.md +1 -0
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/codebase-analyzer.md +1 -1
- package/presets/claude/nuxt/agents/migration-specialist.md +1 -0
- package/presets/claude/nuxt/agents/mockup-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/openspec-author.md +2 -1
- package/presets/claude/nuxt/agents/performance-auditor.md +1 -0
- package/presets/claude/nuxt/agents/playwright-test-generator.md +24 -68
- package/presets/claude/nuxt/agents/playwright-test-healer.md +28 -54
- package/presets/claude/nuxt/agents/playwright-test-planner.md +18 -51
- package/presets/claude/nuxt/agents/security-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/solution-architect.md +1 -0
- package/presets/claude/nuxt/agents/task-analyst.md +12 -0
- package/presets/claude/nuxt/agents/task-router.md +1 -0
- package/presets/claude/nuxt/agents/tech-writer.md +1 -0
- package/presets/claude/nuxt/agents/unit-test-planner.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +9 -9
- package/presets/claude/nuxt/rules/architecture/reference-features.md +1 -20
- 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/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/php-hexagonal/CLAUDE.md +2 -2
- package/presets/claude/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/claude/php-hexagonal/agents/README.md +4 -0
- package/presets/claude/php-hexagonal/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/claude/php-hexagonal/agents/ci-investigator.md +0 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +3 -3
- package/presets/claude/php-hexagonal/agents/codebase-analyzer.md +1 -1
- package/presets/claude/php-hexagonal/agents/debugger.md +0 -1
- package/presets/claude/php-hexagonal/agents/feature-developer.md +2 -3
- package/presets/claude/php-hexagonal/agents/integration-test-generator.md +1 -2
- package/presets/claude/php-hexagonal/agents/integration-test-healer.md +1 -2
- package/presets/claude/php-hexagonal/agents/integration-test-planner.md +1 -2
- package/presets/claude/php-hexagonal/agents/migration-specialist.md +1 -1
- package/presets/claude/php-hexagonal/agents/openspec-author.md +2 -1
- package/presets/claude/php-hexagonal/agents/performance-auditor.md +1 -1
- package/presets/claude/php-hexagonal/agents/qa-tester.md +0 -1
- package/presets/claude/php-hexagonal/agents/security-reviewer.md +2 -2
- package/presets/claude/php-hexagonal/agents/solution-architect.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-router.md +1 -1
- package/presets/claude/php-hexagonal/agents/tech-writer.md +1 -1
- package/presets/claude/php-hexagonal/agents/unit-test-generator.md +1 -2
- package/presets/claude/php-hexagonal/agents/unit-test-healer.md +1 -2
- package/presets/claude/php-hexagonal/agents/unit-test-planner.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +51 -1
- package/presets/claude/php-hexagonal/rules/architecture/reference-features.md +25 -0
- 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/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/php-hexagonal/team/README.md +1 -1
- package/presets/claude/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/php-laravel/CLAUDE.md +1 -1
- package/presets/claude/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/claude/php-laravel/agents/README.md +4 -0
- package/presets/claude/php-laravel/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
- package/presets/claude/php-laravel/agents/ci-investigator.md +0 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/codebase-analyzer.md +1 -1
- package/presets/claude/php-laravel/agents/debugger.md +0 -1
- package/presets/claude/php-laravel/agents/feature-developer.md +2 -3
- package/presets/claude/php-laravel/agents/integration-test-generator.md +1 -2
- package/presets/claude/php-laravel/agents/integration-test-healer.md +1 -2
- package/presets/claude/php-laravel/agents/integration-test-planner.md +1 -2
- package/presets/claude/php-laravel/agents/migration-specialist.md +1 -1
- package/presets/claude/php-laravel/agents/openspec-author.md +2 -1
- package/presets/claude/php-laravel/agents/performance-auditor.md +1 -1
- package/presets/claude/php-laravel/agents/qa-tester.md +0 -1
- package/presets/claude/php-laravel/agents/security-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/solution-architect.md +1 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/agents/task-router.md +1 -1
- package/presets/claude/php-laravel/agents/tech-writer.md +1 -1
- package/presets/claude/php-laravel/agents/unit-test-generator.md +1 -2
- package/presets/claude/php-laravel/agents/unit-test-healer.md +1 -2
- package/presets/claude/php-laravel/agents/unit-test-planner.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +54 -1
- package/presets/claude/php-laravel/rules/architecture/reference-features.md +27 -0
- 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/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/php-laravel/team/README.md +1 -1
- package/presets/claude/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/svelte/CLAUDE.md +3 -3
- package/presets/claude/svelte/REPO_AGENTS.md +8 -0
- package/presets/claude/svelte/agents/README.md +2 -4
- package/presets/claude/svelte/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/svelte/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/svelte/agents/build-verifier.md +1 -0
- package/presets/claude/svelte/agents/code-reviewer.md +1 -0
- package/presets/claude/svelte/agents/codebase-analyzer.md +1 -1
- package/presets/claude/svelte/agents/migration-specialist.md +1 -0
- package/presets/claude/svelte/agents/mockup-reviewer.md +1 -0
- package/presets/claude/svelte/agents/openspec-author.md +2 -1
- package/presets/claude/svelte/agents/performance-auditor.md +1 -0
- package/presets/claude/svelte/agents/playwright-test-generator.md +24 -68
- package/presets/claude/svelte/agents/playwright-test-healer.md +28 -54
- package/presets/claude/svelte/agents/playwright-test-planner.md +18 -51
- package/presets/claude/svelte/agents/security-reviewer.md +1 -0
- package/presets/claude/svelte/agents/solution-architect.md +1 -0
- package/presets/claude/svelte/agents/task-analyst.md +12 -0
- package/presets/claude/svelte/agents/task-router.md +1 -1
- package/presets/claude/svelte/agents/tech-writer.md +1 -0
- package/presets/claude/svelte/agents/unit-test-planner.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +7 -7
- package/presets/claude/svelte/rules/architecture/reference-features.md +1 -20
- 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/claude/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +17 -5
- package/presets/cursor/android-kotlin/rules/feature-delivery-workflow.mdc +66 -8
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/android-kotlin/rules/reference-features.mdc +48 -2
- package/presets/cursor/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/android-kotlin/team/README.md +1 -1
- package/presets/cursor/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/go/REPO_AGENTS.md +8 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/go/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/go/rules/reference-features.mdc +46 -6
- package/presets/cursor/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/go/team/README.md +1 -1
- package/presets/cursor/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +17 -5
- package/presets/cursor/ios-swift/rules/feature-delivery-workflow.mdc +64 -8
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/ios-swift/rules/reference-features.mdc +44 -21
- package/presets/cursor/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/ios-swift/team/README.md +1 -1
- package/presets/cursor/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/java/AGENTS.md +1 -1
- package/presets/cursor/java/REPO_AGENTS.md +8 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/java/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/java/rules/reference-features.mdc +46 -6
- package/presets/cursor/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/java/team/README.md +1 -1
- package/presets/cursor/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +17 -6
- package/presets/cursor/mcp-ts/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mcp-ts/rules/reference-features.mdc +46 -6
- package/presets/cursor/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/cursor/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/mcp-ts/team/README.md +1 -1
- package/presets/cursor/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/mol/REPO_AGENTS.md +8 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/mol/rules/feature-delivery-workflow.mdc +65 -9
- package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mol/rules/reference-features.mdc +43 -20
- package/presets/cursor/mol/team/README.md +1 -1
- package/presets/cursor/next/README.md +2 -2
- package/presets/cursor/next/REPO_AGENTS.md +8 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +2 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +4 -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/README.md +2 -2
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +68 -12
- package/presets/cursor/next/rules/next-app-core.mdc +1 -1
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/next/rules/reference-features.mdc +42 -19
- package/presets/cursor/next/team/README.md +1 -1
- package/presets/cursor/nuxt/REPO_AGENTS.md +8 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +4 -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/README.md +2 -2
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/nuxt/rules/feature-delivery-workflow.mdc +64 -8
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/nuxt/rules/reference-features.mdc +37 -14
- package/presets/cursor/nuxt/team/README.md +1 -1
- package/presets/cursor/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/php-hexagonal/AGENTS.md +1 -1
- package/presets/cursor/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/php-hexagonal/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-hexagonal/rules/reference-features.mdc +46 -6
- package/presets/cursor/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/php-hexagonal/team/README.md +1 -1
- package/presets/cursor/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/php-laravel/AGENTS.md +1 -1
- package/presets/cursor/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +4 -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/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/php-laravel/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-laravel/rules/reference-features.mdc +46 -6
- package/presets/cursor/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/php-laravel/team/README.md +1 -1
- package/presets/cursor/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/svelte/REPO_AGENTS.md +8 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +4 -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/README.md +1 -1
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/svelte/rules/feature-delivery-workflow.mdc +62 -6
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/svelte/rules/reference-features.mdc +40 -17
- package/presets/cursor/svelte/team/README.md +1 -1
- package/presets/cursor/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/mavis/android-kotlin/adapter-map.json +19 -2
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/android-kotlin/rules/feature-delivery-workflow.md +66 -8
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/android-kotlin/rules/reference-features.md +48 -2
- package/presets/mavis/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/android-kotlin/team/README.md +1 -1
- package/presets/mavis/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/go/REPO_AGENTS.md +8 -0
- package/presets/mavis/go/adapter-map.json +17 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/go/rules/feature-delivery-workflow.md +50 -1
- package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/go/rules/reference-features.md +22 -0
- package/presets/mavis/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/go/team/README.md +1 -1
- package/presets/mavis/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/mavis/ios-swift/adapter-map.json +17 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +8 -8
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/ios-swift/rules/reference-features.md +2 -21
- package/presets/mavis/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/ios-swift/team/README.md +1 -1
- package/presets/mavis/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/java/MAVIS.md +1 -1
- package/presets/mavis/java/REPO_AGENTS.md +8 -0
- package/presets/mavis/java/adapter-map.json +17 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/java/rules/feature-delivery-workflow.md +51 -1
- package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/java/rules/reference-features.md +22 -0
- package/presets/mavis/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/java/team/README.md +1 -1
- package/presets/mavis/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/mavis/mcp-ts/adapter-map.json +17 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +47 -1
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mcp-ts/rules/reference-features.md +22 -0
- package/presets/mavis/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/mavis/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/mcp-ts/team/README.md +1 -1
- package/presets/mavis/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/mol/REPO_AGENTS.md +8 -0
- package/presets/mavis/mol/adapter-map.json +9 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +10 -10
- package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mol/rules/reference-features.md +0 -19
- package/presets/mavis/mol/team/README.md +1 -1
- package/presets/mavis/next/REPO_AGENTS.md +8 -0
- package/presets/mavis/next/adapter-map.json +9 -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/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/next/rules/feature-delivery-workflow.md +13 -13
- package/presets/mavis/next/rules/next-app-core.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/next/rules/reference-features.md +0 -19
- package/presets/mavis/next/team/README.md +1 -1
- package/presets/mavis/nuxt/REPO_AGENTS.md +8 -0
- package/presets/mavis/nuxt/adapter-map.json +17 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +9 -9
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/nuxt/rules/reference-features.md +1 -20
- package/presets/mavis/nuxt/team/README.md +1 -1
- package/presets/mavis/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/php-hexagonal/MAVIS.md +1 -1
- package/presets/mavis/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +17 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +51 -1
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-hexagonal/rules/reference-features.md +25 -0
- package/presets/mavis/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/php-hexagonal/team/README.md +1 -1
- package/presets/mavis/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/php-laravel/MAVIS.md +1 -1
- package/presets/mavis/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/mavis/php-laravel/adapter-map.json +17 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +54 -1
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-laravel/rules/reference-features.md +27 -0
- package/presets/mavis/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/php-laravel/team/README.md +1 -1
- package/presets/mavis/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/svelte/REPO_AGENTS.md +8 -0
- package/presets/mavis/svelte/adapter-map.json +17 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +7 -7
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/svelte/rules/reference-features.md +1 -20
- package/presets/mavis/svelte/team/README.md +1 -1
- package/presets/mavis/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/opencode/android-kotlin/adapter-map.json +19 -2
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/android-kotlin/rules/feature-delivery-workflow.md +66 -8
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/android-kotlin/rules/reference-features.md +48 -2
- package/presets/opencode/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/android-kotlin/team/README.md +1 -1
- package/presets/opencode/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/go/REPO_AGENTS.md +8 -0
- package/presets/opencode/go/adapter-map.json +17 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/go/rules/feature-delivery-workflow.md +50 -1
- package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/go/rules/reference-features.md +22 -0
- package/presets/opencode/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/go/team/README.md +1 -1
- package/presets/opencode/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/opencode/ios-swift/adapter-map.json +17 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +8 -8
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/ios-swift/rules/reference-features.md +2 -21
- package/presets/opencode/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/ios-swift/team/README.md +1 -1
- package/presets/opencode/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/java/OPENCODE.md +1 -1
- package/presets/opencode/java/REPO_AGENTS.md +8 -0
- package/presets/opencode/java/adapter-map.json +17 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/java/rules/feature-delivery-workflow.md +51 -1
- package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/java/rules/reference-features.md +22 -0
- package/presets/opencode/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/java/team/README.md +1 -1
- package/presets/opencode/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/opencode/mcp-ts/adapter-map.json +17 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +47 -1
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mcp-ts/rules/reference-features.md +22 -0
- package/presets/opencode/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/opencode/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/mcp-ts/team/README.md +1 -1
- package/presets/opencode/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/mol/REPO_AGENTS.md +8 -0
- package/presets/opencode/mol/adapter-map.json +9 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +10 -10
- package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mol/rules/reference-features.md +0 -19
- package/presets/opencode/mol/team/README.md +1 -1
- package/presets/opencode/next/REPO_AGENTS.md +8 -0
- package/presets/opencode/next/adapter-map.json +9 -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/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/next/rules/feature-delivery-workflow.md +13 -13
- package/presets/opencode/next/rules/next-app-core.md +1 -1
- package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/next/rules/reference-features.md +0 -19
- package/presets/opencode/next/team/README.md +1 -1
- package/presets/opencode/nuxt/REPO_AGENTS.md +8 -0
- package/presets/opencode/nuxt/adapter-map.json +17 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +9 -9
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/nuxt/rules/reference-features.md +1 -20
- package/presets/opencode/nuxt/team/README.md +1 -1
- package/presets/opencode/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
- package/presets/opencode/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +17 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +51 -1
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-hexagonal/rules/reference-features.md +25 -0
- package/presets/opencode/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/php-hexagonal/team/README.md +1 -1
- package/presets/opencode/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/php-laravel/OPENCODE.md +1 -1
- package/presets/opencode/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/opencode/php-laravel/adapter-map.json +17 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +54 -1
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-laravel/rules/reference-features.md +27 -0
- package/presets/opencode/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/php-laravel/team/README.md +1 -1
- package/presets/opencode/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/plugins/output-guard/README.md +3 -2
- package/presets/opencode/plugins/output-guard/rewrite.ts +10 -1
- package/presets/opencode/svelte/REPO_AGENTS.md +8 -0
- package/presets/opencode/svelte/adapter-map.json +17 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +7 -7
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/svelte/rules/reference-features.md +1 -20
- package/presets/opencode/svelte/team/README.md +1 -1
- package/presets/opencode/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/zcode/android-kotlin/adapter-map.json +19 -2
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/android-kotlin/rules/README.md +3 -3
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/android-kotlin/rules/feature-delivery-workflow.md +66 -8
- package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/android-kotlin/rules/reference-features.md +48 -2
- package/presets/zcode/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/android-kotlin/team/README.md +1 -1
- package/presets/zcode/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/go/REPO_AGENTS.md +8 -0
- package/presets/zcode/go/adapter-map.json +17 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/go/rules/README.md +3 -3
- package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/go/rules/feature-delivery-workflow.md +50 -1
- package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/go/rules/reference-features.md +22 -0
- package/presets/zcode/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/go/team/README.md +1 -1
- package/presets/zcode/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/zcode/ios-swift/adapter-map.json +17 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/ios-swift/rules/README.md +3 -3
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +8 -8
- package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/ios-swift/rules/reference-features.md +2 -21
- package/presets/zcode/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/ios-swift/team/README.md +1 -1
- package/presets/zcode/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/java/REPO_AGENTS.md +8 -0
- package/presets/zcode/java/adapter-map.json +17 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/java/rules/README.md +3 -3
- package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/java/rules/feature-delivery-workflow.md +51 -1
- package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/java/rules/reference-features.md +22 -0
- package/presets/zcode/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/java/team/README.md +1 -1
- package/presets/zcode/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/zcode/mcp-ts/adapter-map.json +17 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/mcp-ts/rules/README.md +3 -3
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +47 -1
- package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mcp-ts/rules/reference-features.md +22 -0
- package/presets/zcode/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/zcode/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/mcp-ts/team/README.md +1 -1
- package/presets/zcode/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/mol/REPO_AGENTS.md +8 -0
- package/presets/zcode/mol/adapter-map.json +9 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/mol/rules/README.md +3 -3
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +10 -10
- package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mol/rules/reference-features.md +0 -19
- package/presets/zcode/mol/team/README.md +1 -1
- package/presets/zcode/next/REPO_AGENTS.md +8 -0
- package/presets/zcode/next/adapter-map.json +9 -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/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/next/rules/README.md +3 -3
- package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/next/rules/feature-delivery-workflow.md +13 -13
- package/presets/zcode/next/rules/next-app-core.md +1 -1
- package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/next/rules/reference-features.md +0 -19
- package/presets/zcode/next/team/README.md +1 -1
- package/presets/zcode/nuxt/REPO_AGENTS.md +8 -0
- package/presets/zcode/nuxt/adapter-map.json +17 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/nuxt/rules/README.md +3 -3
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +9 -9
- package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/nuxt/rules/reference-features.md +1 -20
- package/presets/zcode/nuxt/team/README.md +1 -1
- package/presets/zcode/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +17 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/php-hexagonal/rules/README.md +3 -3
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +51 -1
- package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-hexagonal/rules/reference-features.md +25 -0
- package/presets/zcode/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/php-hexagonal/team/README.md +1 -1
- package/presets/zcode/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/zcode/php-laravel/adapter-map.json +17 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/php-laravel/rules/README.md +3 -3
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +54 -1
- package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-laravel/rules/reference-features.md +27 -0
- package/presets/zcode/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/php-laravel/team/README.md +1 -1
- package/presets/zcode/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/svelte/REPO_AGENTS.md +8 -0
- package/presets/zcode/svelte/adapter-map.json +17 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/svelte/rules/README.md +3 -3
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +7 -7
- package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/svelte/rules/reference-features.md +1 -20
- package/presets/zcode/svelte/team/README.md +1 -1
- package/presets/zcode/svelte/team/fixtures/feature-parallel.json +84 -0
- 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
|
@@ -750,7 +750,12 @@ const normalizeEvent = (event, index, slug) => {
|
|
|
750
750
|
attemptId: typeof event.attemptId === 'string' ? event.attemptId : null,
|
|
751
751
|
stepIndex: integerOrNull(event.stepIndex),
|
|
752
752
|
stepLabel: typeof event.stepLabel === 'string' ? event.stepLabel : null,
|
|
753
|
-
agent:
|
|
753
|
+
agent:
|
|
754
|
+
typeof event.agent === 'string' && event.agent !== ''
|
|
755
|
+
? event.agent
|
|
756
|
+
: typeof event.nextAgent === 'string' && event.nextAgent !== ''
|
|
757
|
+
? event.nextAgent
|
|
758
|
+
: null,
|
|
754
759
|
role: typeof event.role === 'string' ? event.role : null,
|
|
755
760
|
attemptNo: integerOrNull(event.attempt),
|
|
756
761
|
outcome: typeof event.outcome === 'string' ? event.outcome : null,
|
|
@@ -2370,6 +2375,47 @@ const projectSessionLeases = (db, teamRoot) => {
|
|
|
2370
2375
|
return projected;
|
|
2371
2376
|
};
|
|
2372
2377
|
|
|
2378
|
+
const INSTANT_LEASE_MS = 1000;
|
|
2379
|
+
const LEASE_ATTEMPT_SPAN_MS = 7 * 24 * 60 * 60 * 1000;
|
|
2380
|
+
|
|
2381
|
+
/**
|
|
2382
|
+
* An instant lease (the file still has no grown `firstSeenAt`) covers the
|
|
2383
|
+
* attempt span of its slug, at most a week either side of that instant. A
|
|
2384
|
+
* lease that already has a window is left alone. The next-lease clip runs
|
|
2385
|
+
* after this, so a later slug of the same session still owns the overlap.
|
|
2386
|
+
*/
|
|
2387
|
+
const expandInstantLeases = (db, bySession) => {
|
|
2388
|
+
let attempts;
|
|
2389
|
+
try {
|
|
2390
|
+
attempts = db
|
|
2391
|
+
.prepare('SELECT task_slug, started_at, finished_at FROM attempts WHERE started_at IS NOT NULL')
|
|
2392
|
+
.all();
|
|
2393
|
+
} catch {
|
|
2394
|
+
return;
|
|
2395
|
+
}
|
|
2396
|
+
const bySlug = new Map();
|
|
2397
|
+
for (const row of attempts) {
|
|
2398
|
+
const list = bySlug.get(row.task_slug) ?? [];
|
|
2399
|
+
list.push(row);
|
|
2400
|
+
bySlug.set(row.task_slug, list);
|
|
2401
|
+
}
|
|
2402
|
+
for (const sessions of bySession.values()) {
|
|
2403
|
+
for (const window of sessions) {
|
|
2404
|
+
if (window.last - window.first > INSTANT_LEASE_MS) continue;
|
|
2405
|
+
for (const row of bySlug.get(window.slug) ?? []) {
|
|
2406
|
+
const start = Date.parse(row.started_at);
|
|
2407
|
+
const end = row.finished_at ? Date.parse(row.finished_at) : start;
|
|
2408
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) continue;
|
|
2409
|
+
if (start > window.last + LEASE_ATTEMPT_SPAN_MS) continue;
|
|
2410
|
+
if (end < window.first - LEASE_ATTEMPT_SPAN_MS) continue;
|
|
2411
|
+
if (start < window.first) window.first = start;
|
|
2412
|
+
if (end > window.last) window.last = end;
|
|
2413
|
+
}
|
|
2414
|
+
window.end = window.last + LEASE_TTL_MS;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
};
|
|
2418
|
+
|
|
2373
2419
|
/**
|
|
2374
2420
|
* The attribution context: the lease windows of every session, the same
|
|
2375
2421
|
* windows indexed by task, and the mtime of every task directory.
|
|
@@ -2393,6 +2439,7 @@ const leaseWindows = (db) => {
|
|
|
2393
2439
|
tasks.push(window);
|
|
2394
2440
|
byTask.set(row.task_slug, tasks);
|
|
2395
2441
|
}
|
|
2442
|
+
expandInstantLeases(db, bySession);
|
|
2396
2443
|
for (const sessions of bySession.values()) {
|
|
2397
2444
|
sessions.sort((left, right) => left.first - right.first || (left.slug < right.slug ? -1 : left.slug > right.slug ? 1 : 0));
|
|
2398
2445
|
for (let index = 0; index < sessions.length - 1; index += 1) {
|
|
@@ -2604,6 +2651,227 @@ const ingestLedgerFile = ({ db, file, kind, keyOf, ingestedAt, deadlineAt, conte
|
|
|
2604
2651
|
return { rows, invalid, refused, ingested: true };
|
|
2605
2652
|
};
|
|
2606
2653
|
|
|
2654
|
+
const RUNG_RANK = { unmapped: 0, 'dir-mtime': 1, window: 2, lease: 3 };
|
|
2655
|
+
const BOUND_RUNGS = new Set(['lease', 'window']);
|
|
2656
|
+
const EPISODE_CAP = 40;
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* The attempt whose window contains the call. A matching agent outranks a
|
|
2660
|
+
* shorter window; otherwise the narrowest window wins, then the later start.
|
|
2661
|
+
* Returns null when the call has no task or no attempt covers it.
|
|
2662
|
+
*/
|
|
2663
|
+
export function matchAttemptId(call, attempts) {
|
|
2664
|
+
const at = Date.parse(call.observedAt ?? '');
|
|
2665
|
+
if (!Number.isFinite(at) || !call.taskSlug) return null;
|
|
2666
|
+
let best = null;
|
|
2667
|
+
for (const attempt of attempts) {
|
|
2668
|
+
if (attempt.taskSlug !== call.taskSlug || !attempt.attemptId) continue;
|
|
2669
|
+
const start = Date.parse(attempt.startedAt ?? '');
|
|
2670
|
+
if (!Number.isFinite(start) || start > at) continue;
|
|
2671
|
+
const finished = attempt.finishedAt ? Date.parse(attempt.finishedAt) : Number.POSITIVE_INFINITY;
|
|
2672
|
+
if (!Number.isFinite(finished) || at > finished) continue;
|
|
2673
|
+
const agentMatch = Boolean(call.agent && attempt.agent && call.agent === attempt.agent);
|
|
2674
|
+
const span = finished === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : finished - start;
|
|
2675
|
+
const rank = { agentMatch, span, start, attemptId: attempt.attemptId, agent: attempt.agent ?? null };
|
|
2676
|
+
if (
|
|
2677
|
+
best === null
|
|
2678
|
+
|| rank.agentMatch > best.agentMatch
|
|
2679
|
+
|| (rank.agentMatch === best.agentMatch && rank.span < best.span)
|
|
2680
|
+
|| (rank.agentMatch === best.agentMatch && rank.span === best.span && rank.start > best.start)
|
|
2681
|
+
) {
|
|
2682
|
+
best = rank;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
return best;
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
const reattributeRows = (db, teamRoot) => {
|
|
2689
|
+
const context = { ...leaseWindows(db), dirs: taskDirectoryWindows(teamRoot) };
|
|
2690
|
+
const updateCall = db.prepare('UPDATE tool_calls SET task_slug = ?, attribution = ? WHERE call_key = ?');
|
|
2691
|
+
const updateTurn = db.prepare('UPDATE usage_turns SET task_slug = ?, attribution = ? WHERE turn_key = ?');
|
|
2692
|
+
let upgraded = 0;
|
|
2693
|
+
for (const row of db.prepare('SELECT call_key, session_id, observed_at, attribution FROM tool_calls').all()) {
|
|
2694
|
+
const next = resolveAttribution(context, row.session_id, row.observed_at);
|
|
2695
|
+
if ((RUNG_RANK[next.attribution] ?? 0) <= (RUNG_RANK[row.attribution] ?? 0)) continue;
|
|
2696
|
+
updateCall.run(next.taskSlug, next.attribution, row.call_key);
|
|
2697
|
+
upgraded += 1;
|
|
2698
|
+
}
|
|
2699
|
+
for (const row of db.prepare('SELECT turn_key, session_id, observed_at, attribution FROM usage_turns').all()) {
|
|
2700
|
+
const next = resolveAttribution(context, row.session_id, row.observed_at);
|
|
2701
|
+
if ((RUNG_RANK[next.attribution] ?? 0) <= (RUNG_RANK[row.attribution] ?? 0)) continue;
|
|
2702
|
+
updateTurn.run(next.taskSlug, next.attribution, row.turn_key);
|
|
2703
|
+
upgraded += 1;
|
|
2704
|
+
}
|
|
2705
|
+
return upgraded;
|
|
2706
|
+
};
|
|
2707
|
+
|
|
2708
|
+
const bindAttemptIds = (db) => {
|
|
2709
|
+
const attempts = db
|
|
2710
|
+
.prepare(
|
|
2711
|
+
`SELECT attempt_id AS attemptId, task_slug AS taskSlug, agent, started_at AS startedAt, finished_at AS finishedAt
|
|
2712
|
+
FROM attempts WHERE started_at IS NOT NULL`,
|
|
2713
|
+
)
|
|
2714
|
+
.all();
|
|
2715
|
+
const update = db.prepare('UPDATE tool_calls SET attempt_id = ?, agent = COALESCE(agent, ?) WHERE call_key = ?');
|
|
2716
|
+
const clear = db.prepare('UPDATE tool_calls SET attempt_id = NULL WHERE call_key = ?');
|
|
2717
|
+
let bound = 0;
|
|
2718
|
+
for (const call of db.prepare('SELECT call_key, task_slug, observed_at, agent, attribution FROM tool_calls').all()) {
|
|
2719
|
+
if (!BOUND_RUNGS.has(call.attribution)) {
|
|
2720
|
+
clear.run(call.call_key);
|
|
2721
|
+
continue;
|
|
2722
|
+
}
|
|
2723
|
+
const match = matchAttemptId(
|
|
2724
|
+
{ taskSlug: call.task_slug, observedAt: call.observed_at, agent: call.agent },
|
|
2725
|
+
attempts,
|
|
2726
|
+
);
|
|
2727
|
+
if (!match) {
|
|
2728
|
+
clear.run(call.call_key);
|
|
2729
|
+
continue;
|
|
2730
|
+
}
|
|
2731
|
+
update.run(match.attemptId, match.agent, call.call_key);
|
|
2732
|
+
bound += 1;
|
|
2733
|
+
}
|
|
2734
|
+
return bound;
|
|
2735
|
+
};
|
|
2736
|
+
|
|
2737
|
+
const rebuildEpisodes = (db) => {
|
|
2738
|
+
db.exec('DELETE FROM attempt_episodes');
|
|
2739
|
+
const insert = db.prepare(
|
|
2740
|
+
`INSERT INTO attempt_episodes (attempt_id, ordinal, intent, target_key, error_class, observed_at)
|
|
2741
|
+
VALUES (?, ?, ?, ?, ?, ?)`,
|
|
2742
|
+
);
|
|
2743
|
+
const counts = new Map();
|
|
2744
|
+
let episodes = 0;
|
|
2745
|
+
for (const call of db
|
|
2746
|
+
.prepare(
|
|
2747
|
+
`SELECT attempt_id, intent, target_key, error_class, observed_at
|
|
2748
|
+
FROM tool_calls WHERE attempt_id IS NOT NULL
|
|
2749
|
+
ORDER BY attempt_id, observed_at, call_key`,
|
|
2750
|
+
)
|
|
2751
|
+
.all()) {
|
|
2752
|
+
const ordinal = counts.get(call.attempt_id) ?? 0;
|
|
2753
|
+
if (ordinal >= EPISODE_CAP) continue;
|
|
2754
|
+
counts.set(call.attempt_id, ordinal + 1);
|
|
2755
|
+
insert.run(call.attempt_id, ordinal, call.intent, call.target_key, call.error_class, call.observed_at);
|
|
2756
|
+
episodes += 1;
|
|
2757
|
+
}
|
|
2758
|
+
return episodes;
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
const fillGaps = (db) => {
|
|
2762
|
+
const update = db.prepare('UPDATE tool_calls SET gap_ms = ? WHERE call_key = ? AND gap_ms IS NULL');
|
|
2763
|
+
let filled = 0;
|
|
2764
|
+
let previous = null;
|
|
2765
|
+
for (const row of db
|
|
2766
|
+
.prepare('SELECT call_key, session_id, observed_at, gap_ms FROM tool_calls ORDER BY session_id, observed_at, call_key')
|
|
2767
|
+
.all()) {
|
|
2768
|
+
if (previous && previous.session_id === row.session_id && row.gap_ms === null) {
|
|
2769
|
+
const gap = Date.parse(row.observed_at) - Date.parse(previous.observed_at);
|
|
2770
|
+
if (Number.isFinite(gap) && gap >= 0 && gap <= LEASE_TTL_MS) {
|
|
2771
|
+
update.run(gap, row.call_key);
|
|
2772
|
+
filled += 1;
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
previous = row;
|
|
2776
|
+
}
|
|
2777
|
+
return filled;
|
|
2778
|
+
};
|
|
2779
|
+
|
|
2780
|
+
const foldSessionUsage = (db) => {
|
|
2781
|
+
const attempts = db
|
|
2782
|
+
.prepare(
|
|
2783
|
+
`SELECT attempt_id, task_slug, started_at, finished_at, usage_source FROM attempts
|
|
2784
|
+
WHERE (usage_source IS NULL OR usage_source = 'session') AND started_at IS NOT NULL`,
|
|
2785
|
+
)
|
|
2786
|
+
.all();
|
|
2787
|
+
const byTask = new Map();
|
|
2788
|
+
for (const turn of db
|
|
2789
|
+
.prepare(
|
|
2790
|
+
`SELECT task_slug, observed_at, input_tokens, output_tokens, reasoning_tokens,
|
|
2791
|
+
cache_read_tokens, cache_write_tokens, cost_usd, provider_id, model_id
|
|
2792
|
+
FROM usage_turns WHERE attribution IN ('lease', 'window') AND task_slug IS NOT NULL`,
|
|
2793
|
+
)
|
|
2794
|
+
.all()) {
|
|
2795
|
+
const list = byTask.get(turn.task_slug) ?? [];
|
|
2796
|
+
list.push(turn);
|
|
2797
|
+
byTask.set(turn.task_slug, list);
|
|
2798
|
+
}
|
|
2799
|
+
const update = db.prepare(
|
|
2800
|
+
`UPDATE attempts SET
|
|
2801
|
+
input_tokens = ?, output_tokens = ?, reasoning_tokens = ?,
|
|
2802
|
+
cache_read_tokens = ?, cache_write_tokens = ?, cost_usd = ?,
|
|
2803
|
+
usage_origin = 'measured', usage_source = 'session', usage_turn_count = ?,
|
|
2804
|
+
model_provider = ?, model_id = ?
|
|
2805
|
+
WHERE attempt_id = ? AND (usage_source IS NULL OR usage_source = 'session')`,
|
|
2806
|
+
);
|
|
2807
|
+
const clear = db.prepare(
|
|
2808
|
+
`UPDATE attempts SET
|
|
2809
|
+
input_tokens = NULL, output_tokens = NULL, reasoning_tokens = NULL,
|
|
2810
|
+
cache_read_tokens = NULL, cache_write_tokens = NULL, cost_usd = NULL,
|
|
2811
|
+
usage_origin = NULL, usage_source = NULL, usage_turn_count = NULL,
|
|
2812
|
+
model_provider = NULL, model_id = NULL
|
|
2813
|
+
WHERE attempt_id = ? AND usage_source = 'session'`,
|
|
2814
|
+
);
|
|
2815
|
+
let usage = 0;
|
|
2816
|
+
for (const attempt of attempts) {
|
|
2817
|
+
const start = Date.parse(attempt.started_at);
|
|
2818
|
+
const end = attempt.finished_at ? Date.parse(attempt.finished_at) : Number.POSITIVE_INFINITY;
|
|
2819
|
+
const matched = (byTask.get(attempt.task_slug) ?? []).filter((turn) => {
|
|
2820
|
+
const at = Date.parse(turn.observed_at);
|
|
2821
|
+
return Number.isFinite(at) && at >= start && at <= end;
|
|
2822
|
+
});
|
|
2823
|
+
if (matched.length === 0) {
|
|
2824
|
+
if (attempt.usage_source === 'session') clear.run(attempt.attempt_id);
|
|
2825
|
+
continue;
|
|
2826
|
+
}
|
|
2827
|
+
const sum = (key) => matched.reduce((total, turn) => total + Number(turn[key] ?? 0), 0);
|
|
2828
|
+
let model = matched[0];
|
|
2829
|
+
for (const turn of matched) {
|
|
2830
|
+
if (Number(turn.input_tokens) > Number(model.input_tokens)) model = turn;
|
|
2831
|
+
}
|
|
2832
|
+
update.run(
|
|
2833
|
+
sum('input_tokens'),
|
|
2834
|
+
sum('output_tokens'),
|
|
2835
|
+
sum('reasoning_tokens'),
|
|
2836
|
+
sum('cache_read_tokens'),
|
|
2837
|
+
sum('cache_write_tokens'),
|
|
2838
|
+
sum('cost_usd'),
|
|
2839
|
+
matched.length,
|
|
2840
|
+
model.provider_id,
|
|
2841
|
+
model.model_id,
|
|
2842
|
+
attempt.attempt_id,
|
|
2843
|
+
);
|
|
2844
|
+
usage += 1;
|
|
2845
|
+
}
|
|
2846
|
+
return usage;
|
|
2847
|
+
};
|
|
2848
|
+
|
|
2849
|
+
/**
|
|
2850
|
+
* Join already-projected calls to attempts. Stronger attribution replaces a
|
|
2851
|
+
* weaker one; host and CLI usage are never overwritten. Safe to re-run.
|
|
2852
|
+
*/
|
|
2853
|
+
export function bindBehaviorResearch(db, teamRoot) {
|
|
2854
|
+
const columns = db.prepare('PRAGMA table_info(tool_calls)').all().map((row) => row.name);
|
|
2855
|
+
if (!columns.includes('attempt_id')) return { upgraded: 0, bound: 0, episodes: 0, gaps: 0, usage: 0 };
|
|
2856
|
+
db.exec('BEGIN IMMEDIATE');
|
|
2857
|
+
try {
|
|
2858
|
+
const upgraded = teamRoot ? reattributeRows(db, teamRoot) : 0;
|
|
2859
|
+
const bound = bindAttemptIds(db);
|
|
2860
|
+
const episodes = rebuildEpisodes(db);
|
|
2861
|
+
const gaps = fillGaps(db);
|
|
2862
|
+
const usage = foldSessionUsage(db);
|
|
2863
|
+
db.exec('COMMIT');
|
|
2864
|
+
return { upgraded, bound, episodes, gaps, usage };
|
|
2865
|
+
} catch (error) {
|
|
2866
|
+
try {
|
|
2867
|
+
db.exec('ROLLBACK');
|
|
2868
|
+
} catch {
|
|
2869
|
+
/* the original error is the finding */
|
|
2870
|
+
}
|
|
2871
|
+
throw error;
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2607
2875
|
/**
|
|
2608
2876
|
* Ingest the OpenCode ledgers into `tool_calls` / `usage_turns` and the
|
|
2609
2877
|
* session leases into `session_tasks`. Full sync only; a per-file watermark
|
|
@@ -2884,6 +3152,13 @@ export function syncProjection(options = {}) {
|
|
|
2884
3152
|
logProjectionFailure('E_TELEMETRY_FAILED', error.message, options.env);
|
|
2885
3153
|
}
|
|
2886
3154
|
}
|
|
3155
|
+
if (!slug) {
|
|
3156
|
+
try {
|
|
3157
|
+
bindBehaviorResearch(db, handle.teamRoot);
|
|
3158
|
+
} catch (error) {
|
|
3159
|
+
logProjectionFailure('E_TELEMETRY_FAILED', error.message, options.env);
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
2887
3162
|
if (maintain) {
|
|
2888
3163
|
result.retained += maintainDatabase(db, startedAt).retained;
|
|
2889
3164
|
retainRuns(db);
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
isKillSwitchSet,
|
|
33
33
|
isSqliteAvailable,
|
|
34
34
|
openTeamDb,
|
|
35
|
+
readNewerSchemaModule,
|
|
35
36
|
teamDbFail,
|
|
36
37
|
} from './team-db-schema.mjs';
|
|
37
38
|
|
|
@@ -2223,8 +2224,9 @@ export async function runScheduler(options = {}) {
|
|
|
2223
2224
|
}
|
|
2224
2225
|
fs.mkdirSync(schedulerPaths(teamRoot).runs, { recursive: true, mode: 0o700 });
|
|
2225
2226
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2227
|
+
let handle = openTeamDb({ teamRoot });
|
|
2228
|
+
let db = handle.db;
|
|
2229
|
+
let loadedSchemaMtime = 0;
|
|
2228
2230
|
let draining = false;
|
|
2229
2231
|
const inFlight = new Set();
|
|
2230
2232
|
|
|
@@ -2258,7 +2260,35 @@ export async function runScheduler(options = {}) {
|
|
|
2258
2260
|
process.once('SIGINT', shutdown);
|
|
2259
2261
|
process.once('SIGTERM', shutdown);
|
|
2260
2262
|
|
|
2263
|
+
const reloadSchema = async () => {
|
|
2264
|
+
if (inFlight.size > 0) return;
|
|
2265
|
+
let fresh = null;
|
|
2266
|
+
try {
|
|
2267
|
+
fresh = await readNewerSchemaModule();
|
|
2268
|
+
} catch (error) {
|
|
2269
|
+
err(`schedule: schema reload failed: ${error.message}\n`);
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
if (!fresh || fresh.mtimeMs === loadedSchemaMtime) return;
|
|
2273
|
+
try {
|
|
2274
|
+
const next = fresh.openTeamDb({ teamRoot });
|
|
2275
|
+
try {
|
|
2276
|
+
handle.db.close();
|
|
2277
|
+
} catch {
|
|
2278
|
+
/* the replacement connection is the one the next tick uses */
|
|
2279
|
+
}
|
|
2280
|
+
handle = next;
|
|
2281
|
+
db = next.db;
|
|
2282
|
+
loadedSchemaMtime = fresh.mtimeMs;
|
|
2283
|
+
if (!options.quiet) out(`schedule: reloaded schema v${fresh.SCHEMA_VERSION}\n`);
|
|
2284
|
+
} catch (error) {
|
|
2285
|
+
loadedSchemaMtime = fresh.mtimeMs;
|
|
2286
|
+
err(`schedule: schema reload failed: ${error.message}\n`);
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2261
2290
|
const tick = async () => {
|
|
2291
|
+
await reloadSchema();
|
|
2262
2292
|
const now = Date.now();
|
|
2263
2293
|
const nowIso = new Date(now).toISOString();
|
|
2264
2294
|
let file;
|
|
@@ -18,6 +18,7 @@ import crypto from 'node:crypto';
|
|
|
18
18
|
import fs from 'node:fs';
|
|
19
19
|
import { createRequire } from 'node:module';
|
|
20
20
|
import path from 'node:path';
|
|
21
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
21
22
|
|
|
22
23
|
/** Node floor for the unflagged `node:sqlite` module. */
|
|
23
24
|
export const MIN_NODE = '22.13.0';
|
|
@@ -791,6 +792,59 @@ SELECT task_slug, signal, value FROM (
|
|
|
791
792
|
) WHERE value > 0;
|
|
792
793
|
`;
|
|
793
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Migration 7: the research join. `attempt_id` on a call, one capped episode
|
|
797
|
+
* per attempt, and a closed task-quality label. Every new column is nullable
|
|
798
|
+
* and the episode table starts empty, so a version-6 file migrates in place.
|
|
799
|
+
*/
|
|
800
|
+
export const BEHAVIOR_RESEARCH_SQL = SQL`-- The call belongs to the attempt whose window contains it. Nullable:
|
|
801
|
+
-- a dir-mtime or unmapped row stays unbound.
|
|
802
|
+
ALTER TABLE tool_calls ADD COLUMN attempt_id TEXT;
|
|
803
|
+
|
|
804
|
+
CREATE INDEX idx_tool_calls_attempt ON tool_calls(attempt_id, observed_at);
|
|
805
|
+
|
|
806
|
+
-- Ordered (intent, target hash, error class) for one attempt. No command
|
|
807
|
+
-- text and no path. Rebuilt by the projector; ordinal is the only order.
|
|
808
|
+
CREATE TABLE attempt_episodes (
|
|
809
|
+
attempt_id TEXT NOT NULL,
|
|
810
|
+
ordinal INTEGER NOT NULL,
|
|
811
|
+
intent TEXT,
|
|
812
|
+
target_key TEXT,
|
|
813
|
+
error_class TEXT,
|
|
814
|
+
observed_at TEXT NOT NULL,
|
|
815
|
+
PRIMARY KEY (attempt_id, ordinal)
|
|
816
|
+
) STRICT;
|
|
817
|
+
|
|
818
|
+
-- One closed label per task. Step outcome stays on attempts; this is the
|
|
819
|
+
-- research cohort key. A task still in progress stays NULL.
|
|
820
|
+
CREATE VIEW task_quality AS
|
|
821
|
+
SELECT
|
|
822
|
+
t.slug AS task_slug,
|
|
823
|
+
CASE
|
|
824
|
+
WHEN NOT EXISTS (
|
|
825
|
+
SELECT 1 FROM events e WHERE e.task_slug = t.slug AND e.type = 'task_completed'
|
|
826
|
+
) AND EXISTS (
|
|
827
|
+
SELECT 1 FROM attempts a
|
|
828
|
+
WHERE a.task_slug = t.slug AND a.outcome IN ('blocked', 'validation_failed')
|
|
829
|
+
) THEN 'failed'
|
|
830
|
+
WHEN EXISTS (
|
|
831
|
+
SELECT 1 FROM attempts a WHERE a.task_slug = t.slug AND a.outcome = 'changes_requested'
|
|
832
|
+
) THEN 'rework'
|
|
833
|
+
WHEN EXISTS (
|
|
834
|
+
SELECT 1 FROM events e WHERE e.task_slug = t.slug AND e.type = 'task_completed'
|
|
835
|
+
) AND EXISTS (
|
|
836
|
+
SELECT 1 FROM events e WHERE e.task_slug = t.slug AND e.type = 'verification_recorded'
|
|
837
|
+
) AND NOT EXISTS (
|
|
838
|
+
SELECT 1 FROM events e WHERE e.task_slug = t.slug AND e.type = 'verification_stale'
|
|
839
|
+
) THEN 'met'
|
|
840
|
+
WHEN EXISTS (
|
|
841
|
+
SELECT 1 FROM events e WHERE e.task_slug = t.slug AND e.type = 'task_completed'
|
|
842
|
+
) THEN 'unverified'
|
|
843
|
+
ELSE NULL
|
|
844
|
+
END AS quality
|
|
845
|
+
FROM tasks t;
|
|
846
|
+
`;
|
|
847
|
+
|
|
794
848
|
const sha256 = (value) => crypto.createHash('sha256').update(value).digest('hex');
|
|
795
849
|
/**
|
|
796
850
|
* Ordered, immutable migrations. The literal checksum is verified before any
|
|
@@ -833,6 +887,12 @@ export const MIGRATIONS = [
|
|
|
833
887
|
sql: ACTION_TELEMETRY_SQL,
|
|
834
888
|
checksum: 'f250814d462f1d6085ff56a1cc233179002dd5b5d97c200ed28104e4e42fbbfe',
|
|
835
889
|
},
|
|
890
|
+
{
|
|
891
|
+
version: 7,
|
|
892
|
+
name: '0007-behavior-research',
|
|
893
|
+
sql: BEHAVIOR_RESEARCH_SQL,
|
|
894
|
+
checksum: '5a64fd028118ef7b3831006a13e5ca9ac6bd17ee5ce3dfa5441d7946cf4694e0',
|
|
895
|
+
},
|
|
836
896
|
];
|
|
837
897
|
|
|
838
898
|
/** Highest migration version shipped by this module. */
|
|
@@ -1247,6 +1307,45 @@ export function moveDatabaseAside(dbPath, reason) {
|
|
|
1247
1307
|
return suffix;
|
|
1248
1308
|
}
|
|
1249
1309
|
|
|
1310
|
+
const schemaModuleUrl = new URL(import.meta.url);
|
|
1311
|
+
schemaModuleUrl.search = '';
|
|
1312
|
+
schemaModuleUrl.hash = '';
|
|
1313
|
+
const schemaModulePath = fileURLToPath(schemaModuleUrl);
|
|
1314
|
+
const schemaModuleMtimeMs = fs.statSync(schemaModulePath).mtimeMs;
|
|
1315
|
+
let newerSchemaLoad = null;
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* The schema module a long-lived process loaded at startup.
|
|
1319
|
+
*
|
|
1320
|
+
* `serve` and `schedule` keep this module in memory. A later edit that raises
|
|
1321
|
+
* `SCHEMA_VERSION`, applied by another process, makes every cached open fail
|
|
1322
|
+
* with `E_SCHEMA_NEWER`. Re-importing the file picks up that version. A
|
|
1323
|
+
* database newer than the file on disk still fails closed: the result is
|
|
1324
|
+
* `null` when the file is unchanged or its version is not higher.
|
|
1325
|
+
*
|
|
1326
|
+
* @returns {Promise<{ mtimeMs: number, SCHEMA_VERSION: number, openTeamDb: typeof openTeamDb } | null>}
|
|
1327
|
+
*/
|
|
1328
|
+
export async function readNewerSchemaModule() {
|
|
1329
|
+
let mtimeMs;
|
|
1330
|
+
try {
|
|
1331
|
+
mtimeMs = fs.statSync(schemaModulePath).mtimeMs;
|
|
1332
|
+
} catch {
|
|
1333
|
+
return null;
|
|
1334
|
+
}
|
|
1335
|
+
if (!(mtimeMs > schemaModuleMtimeMs)) return null;
|
|
1336
|
+
if (!newerSchemaLoad || newerSchemaLoad.mtimeMs !== mtimeMs) {
|
|
1337
|
+
const stamp = mtimeMs;
|
|
1338
|
+
newerSchemaLoad = {
|
|
1339
|
+
mtimeMs: stamp,
|
|
1340
|
+
promise: import(`${pathToFileURL(schemaModulePath).href}?mtime=${stamp}`).then((fresh) => {
|
|
1341
|
+
if (!(fresh.SCHEMA_VERSION > SCHEMA_VERSION)) return null;
|
|
1342
|
+
return { mtimeMs: stamp, SCHEMA_VERSION: fresh.SCHEMA_VERSION, openTeamDb: fresh.openTeamDb };
|
|
1343
|
+
}),
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
return newerSchemaLoad.promise;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1250
1349
|
/**
|
|
1251
1350
|
* Open, migrate, verify and return a connection handle.
|
|
1252
1351
|
*
|
|
@@ -158,7 +158,9 @@ const repoRootOf = (teamRoot) => path.resolve(teamRoot, '..', '..');
|
|
|
158
158
|
|
|
159
159
|
const resolveConfigCwd = (teamRoot, config) => {
|
|
160
160
|
const root = repoRootOf(teamRoot);
|
|
161
|
-
|
|
161
|
+
// A relative cwd belongs to the file that declares it, so it resolves
|
|
162
|
+
// against the team root and the seeded "../.." is the repository root.
|
|
163
|
+
const resolved = path.isAbsolute(config.cwd) ? config.cwd : path.resolve(teamRoot, config.cwd);
|
|
162
164
|
const relative = path.relative(root, resolved);
|
|
163
165
|
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
164
166
|
reject('E_VALIDATION', 'runner.json: cwd must stay inside the repository root');
|
|
@@ -88,6 +88,35 @@ Two write paths exist, in precedence order:
|
|
|
88
88
|
level with an explicit coverage ratio (`reportedAttempts / attempts`). Read a
|
|
89
89
|
partial coverage as "some turns were observable", never as a cost baseline.
|
|
90
90
|
|
|
91
|
+
A third source, `usage_source: session`, is filled by the projector when neither
|
|
92
|
+
path above wrote a count: it sums `usage_turns` that the lease or window rung
|
|
93
|
+
already mapped onto that attempt. It never adds to a host or CLI rollup. A
|
|
94
|
+
missing session match stays `null`.
|
|
95
|
+
|
|
96
|
+
## Research projection
|
|
97
|
+
|
|
98
|
+
The projector, not the agent, writes the research join. None of it goes into
|
|
99
|
+
`metrics.json`.
|
|
100
|
+
|
|
101
|
+
- `tool_calls.attempt_id` is set only for `lease` and `window` rows whose time
|
|
102
|
+
falls inside an attempt of that task. `dir-mtime` and `unmapped` stay unbound.
|
|
103
|
+
- `attempt_episodes` keeps at most 40 ordered `(intent, target_key, error_class)`
|
|
104
|
+
steps for that attempt. The target is the existing hash, never a path.
|
|
105
|
+
- `task_quality` is `failed`, `rework`, `met`, or `unverified`. `met` requires
|
|
106
|
+
`task_completed` plus `verification_recorded` and no `verification_stale`.
|
|
107
|
+
`rework` is any `changes_requested`. A task with no terminal event stays null.
|
|
108
|
+
- An instant session lease (no `firstSeenAt` yet) is stretched to the attempt
|
|
109
|
+
span of its slug, at most seven days either side, then clipped by the next
|
|
110
|
+
lease of that session. A stored row is re-attributed only when the new rung
|
|
111
|
+
is stronger.
|
|
112
|
+
- `gap_ms`, when the capture left it empty, is the gap to the previous call in
|
|
113
|
+
the same session, and only when that gap is under 30 minutes. `duration_ms`
|
|
114
|
+
stays null unless the host measured it.
|
|
115
|
+
- `retry_scheduled` with `nextAgent` and no `agent` projects `nextAgent` as the
|
|
116
|
+
agent. The hook does not grow a second id.
|
|
117
|
+
- A learning-ledger kind `exemplar` names a clean path. The rule improver does
|
|
118
|
+
not turn it into a rule.
|
|
119
|
+
|
|
91
120
|
## Verification evidence
|
|
92
121
|
|
|
93
122
|
`validation-report.md` stays the human-readable narrative. The machine-checkable
|
|
@@ -227,7 +227,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
227
227
|
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
228
228
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
229
229
|
|
|
230
|
-
`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.
|
|
230
|
+
`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.
|
|
231
231
|
|
|
232
232
|
## Rules (strict)
|
|
233
233
|
|
|
@@ -21,7 +21,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
21
21
|
- [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
|
|
22
22
|
- [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
|
|
23
23
|
- [ ] **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`.
|
|
24
|
-
- [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-
|
|
24
|
+
- [ ] **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
|
|
25
25
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
26
26
|
- [ ] **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
|
|
27
27
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
@@ -38,6 +38,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
38
38
|
- Budget: `preset-token-budget`
|
|
39
39
|
- Leakage: `preset-no-cross-stack-leakage`
|
|
40
40
|
- Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
|
|
41
|
-
- Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
|
|
41
|
+
- 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`
|
|
42
42
|
- Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
|
|
43
43
|
- Orchestrator: when editing presets, load this checklist + twin-sync
|
|
@@ -6,7 +6,7 @@ Stack-agnostic. Keep each run inside a bounded context, checkpoint progress to d
|
|
|
6
6
|
|
|
7
7
|
- Work in **bounded waves** (one artifact class across the target surface) rather than one target across all classes; a wave must fit comfortably in context.
|
|
8
8
|
- **Mechanical waves** (generation, embed sync, drift re-checks) are delegated to **repo scripts** — spend tokens reading the gate output, not re-deriving the transformation.
|
|
9
|
-
- A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`.
|
|
9
|
+
- A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. On Cursor, an eligible simple `test`, `lint`, `git log`, or `git diff` is rewritten into `run-compact.mjs` when `TEAM_TASK_SLUG` is set: the full output is that `outputs/` file, and the model reads the printed failure lines.
|
|
10
10
|
- Split work before the context overflows; do not carry state in the chat that belongs on disk.
|
|
11
11
|
|
|
12
12
|
## Checkpoint & resume
|
|
@@ -67,7 +67,10 @@ function firstSeenAtOf(file, value, now) {
|
|
|
67
67
|
try {
|
|
68
68
|
if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
|
|
69
69
|
const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
70
|
-
if (previous && previous.slug === value
|
|
70
|
+
if (previous && previous.slug === value) {
|
|
71
|
+
if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
|
|
72
|
+
if (typeof previous.updatedAt === 'string') return previous.updatedAt;
|
|
73
|
+
}
|
|
71
74
|
} catch {}
|
|
72
75
|
return now;
|
|
73
76
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Cursor preToolUse: rewrite an eligible simple command so its output is stored
|
|
3
|
+
// and only the short view reaches the model. Fail open. Edit this shared source;
|
|
4
|
+
// the generator copies it into each Cursor stack.
|
|
5
|
+
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const SLUG_MAX = 48;
|
|
10
|
+
const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
11
|
+
const ELIGIBLE =
|
|
12
|
+
/^(?:(?:yarn|pnpm|npm|npx|bun)\s+(?:run\s+)?(?:test|lint)(?::\S+)?|git\s+(?:log|diff)|go\s+test|cargo\s+test|pytest|phpunit)\b/;
|
|
13
|
+
const META = /[|&;<>()\n`]|\$\(/;
|
|
14
|
+
|
|
15
|
+
const slugOf = (env) => {
|
|
16
|
+
const value = typeof env?.TEAM_TASK_SLUG === 'string' ? env.TEAM_TASK_SLUG : '';
|
|
17
|
+
if (value.length === 0 || value.length > SLUG_MAX || !SLUG_RE.test(value)) return '';
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Return the rewritten shell string, or null to leave the command unchanged. */
|
|
22
|
+
export const rewriteCommand = (command, env) => {
|
|
23
|
+
const slug = slugOf(env);
|
|
24
|
+
if (slug === '') return null;
|
|
25
|
+
const text = typeof command === 'string' ? command.trim() : '';
|
|
26
|
+
if (text === '' || META.test(text)) return null;
|
|
27
|
+
if (text.split(/\s+/).some((token) => token.includes("'") || token.includes('"'))) return null;
|
|
28
|
+
if (text.includes('dump-output.mjs') || text.includes('run-compact.mjs')) return null;
|
|
29
|
+
if (!ELIGIBLE.test(text)) return null;
|
|
30
|
+
return `node .ai.local/scripts/run-compact.mjs --task ${slug} -- ${text}`;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const allow = () => {
|
|
34
|
+
process.stdout.write('{"permission":"allow"}');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const commandOf = (event) => {
|
|
38
|
+
if (typeof event.command === 'string') return event.command;
|
|
39
|
+
if (typeof event.input?.command === 'string') return event.input.command;
|
|
40
|
+
if (typeof event.tool_input?.command === 'string') return event.tool_input.command;
|
|
41
|
+
return '';
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const invokedDirectly = (() => {
|
|
45
|
+
if (!process.argv[1]) return false;
|
|
46
|
+
try {
|
|
47
|
+
return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
})();
|
|
52
|
+
|
|
53
|
+
if (invokedDirectly) {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(fs.readFileSync(0, 'utf8'));
|
|
56
|
+
const event = parsed && typeof parsed === 'object' ? parsed : null;
|
|
57
|
+
const rewritten = event ? rewriteCommand(commandOf(event), process.env) : null;
|
|
58
|
+
if (rewritten === null) {
|
|
59
|
+
allow();
|
|
60
|
+
} else {
|
|
61
|
+
process.stdout.write(
|
|
62
|
+
JSON.stringify({ permission: 'allow', updated_input: { command: rewritten } }),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
} catch {
|
|
66
|
+
allow();
|
|
67
|
+
}
|
|
68
|
+
}
|