@bonesofspring/ai-rules 0.2.33 → 0.2.34
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/docs/PRESET-CONTRIBUTION.md +2 -2
- package/package.json +4 -1
- package/presets/_shared/README.md +1 -1
- package/presets/_shared/core/agent-team/agent-artifact-contracts.md +22 -0
- package/presets/_shared/core/agent-team/agent-task-metrics.md +12 -1
- package/presets/_shared/core/agent-team/agent-team-intake.md +1 -1
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +18 -4
- package/presets/_shared/core/agent-team/plan-graph.md +28 -0
- package/presets/_shared/core/agent-team/task-classification.md +2 -0
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/agents/task-router.md +10 -0
- package/presets/claude/android-kotlin/commands/task-continue.md +1 -1
- package/presets/claude/android-kotlin/commands/task.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +369 -16
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/android-kotlin/team/README.md +4 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/agents/task-router.md +10 -0
- package/presets/claude/go/commands/task-continue.md +1 -1
- package/presets/claude/go/commands/task.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +367 -16
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/go/team/README.md +4 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/agents/task-router.md +10 -0
- package/presets/claude/ios-swift/commands/task-continue.md +1 -1
- package/presets/claude/ios-swift/commands/task.md +1 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +369 -16
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/ios-swift/team/README.md +4 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/agents/task-router.md +10 -0
- package/presets/claude/java/commands/task-continue.md +1 -1
- package/presets/claude/java/commands/task.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +367 -16
- package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/java/team/README.md +4 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/agents/task-router.md +10 -0
- package/presets/claude/mcp-ts/commands/task-continue.md +1 -1
- package/presets/claude/mcp-ts/commands/task.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +367 -16
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/mcp-ts/team/README.md +4 -1
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/agents/task-router.md +10 -0
- package/presets/claude/next/commands/task-continue.md +1 -1
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +369 -16
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/next/team/README.md +4 -1
- package/presets/claude/next/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/claude/next/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/agents/task-router.md +10 -0
- package/presets/claude/nuxt/commands/task-continue.md +1 -1
- package/presets/claude/nuxt/commands/task.md +1 -1
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +369 -16
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/nuxt/team/README.md +4 -1
- package/presets/claude/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-router.md +10 -0
- package/presets/claude/php-hexagonal/commands/task-continue.md +1 -1
- package/presets/claude/php-hexagonal/commands/task.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +367 -16
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/php-hexagonal/team/README.md +4 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/agents/task-router.md +10 -0
- package/presets/claude/php-laravel/commands/task-continue.md +1 -1
- package/presets/claude/php-laravel/commands/task.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +367 -16
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/php-laravel/team/README.md +4 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/agents/task-router.md +10 -0
- package/presets/claude/svelte/commands/task-continue.md +1 -1
- package/presets/claude/svelte/commands/task.md +1 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +369 -16
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
- package/presets/claude/svelte/team/README.md +4 -1
- package/presets/claude/svelte/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/agents/task-router.md +10 -0
- package/presets/cursor/android-kotlin/commands/task-continue.md +1 -1
- package/presets/cursor/android-kotlin/commands/task.md +1 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +369 -16
- package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/android-kotlin/team/README.md +4 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/agents/task-router.md +10 -0
- package/presets/cursor/go/commands/task-continue.md +1 -1
- package/presets/cursor/go/commands/task.md +1 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +367 -16
- package/presets/cursor/go/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/go/team/README.md +4 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/agents/task-router.md +10 -0
- package/presets/cursor/ios-swift/commands/task-continue.md +1 -1
- package/presets/cursor/ios-swift/commands/task.md +1 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +369 -16
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/ios-swift/team/README.md +4 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/agents/task-router.md +10 -0
- package/presets/cursor/java/commands/task-continue.md +1 -1
- package/presets/cursor/java/commands/task.md +1 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +367 -16
- package/presets/cursor/java/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/java/team/README.md +4 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/agents/task-router.md +10 -0
- package/presets/cursor/mcp-ts/commands/task-continue.md +1 -1
- package/presets/cursor/mcp-ts/commands/task.md +1 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +367 -16
- package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/mcp-ts/team/README.md +4 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/agents/task-router.md +10 -0
- package/presets/cursor/next/commands/task-continue.md +1 -1
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +369 -16
- package/presets/cursor/next/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/next/team/README.md +4 -1
- package/presets/cursor/next/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/cursor/next/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/agents/task-router.md +10 -0
- package/presets/cursor/nuxt/commands/task-continue.md +1 -1
- package/presets/cursor/nuxt/commands/task.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +369 -16
- package/presets/cursor/nuxt/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/nuxt/team/README.md +4 -1
- package/presets/cursor/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/agents/task-router.md +10 -0
- package/presets/cursor/php-hexagonal/commands/task-continue.md +1 -1
- package/presets/cursor/php-hexagonal/commands/task.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +367 -16
- package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/php-hexagonal/team/README.md +4 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/agents/task-router.md +10 -0
- package/presets/cursor/php-laravel/commands/task-continue.md +1 -1
- package/presets/cursor/php-laravel/commands/task.md +1 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +367 -16
- package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/php-laravel/team/README.md +4 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/agents/task-router.md +10 -0
- package/presets/cursor/svelte/commands/task-continue.md +1 -1
- package/presets/cursor/svelte/commands/task.md +1 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +369 -16
- package/presets/cursor/svelte/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +12 -1
- package/presets/cursor/svelte/team/README.md +4 -1
- package/presets/cursor/svelte/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/agents/task-router.md +10 -0
- package/presets/mavis/android-kotlin/commands/task-continue.md +1 -1
- package/presets/mavis/android-kotlin/commands/task.md +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +369 -16
- package/presets/mavis/android-kotlin/rules/agent-team-intake.md +1 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/android-kotlin/team/README.md +4 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/agents/task-router.md +10 -0
- package/presets/mavis/go/commands/task-continue.md +1 -1
- package/presets/mavis/go/commands/task.md +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +367 -16
- package/presets/mavis/go/rules/agent-team-intake.md +1 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/go/team/README.md +4 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/agents/task-router.md +10 -0
- package/presets/mavis/ios-swift/commands/task-continue.md +1 -1
- package/presets/mavis/ios-swift/commands/task.md +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +369 -16
- package/presets/mavis/ios-swift/rules/agent-team-intake.md +1 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/ios-swift/team/README.md +4 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/agents/task-router.md +10 -0
- package/presets/mavis/java/commands/task-continue.md +1 -1
- package/presets/mavis/java/commands/task.md +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +367 -16
- package/presets/mavis/java/rules/agent-team-intake.md +1 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/java/team/README.md +4 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/agents/task-router.md +10 -0
- package/presets/mavis/mcp-ts/commands/task-continue.md +1 -1
- package/presets/mavis/mcp-ts/commands/task.md +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +367 -16
- package/presets/mavis/mcp-ts/rules/agent-team-intake.md +1 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/mcp-ts/team/README.md +4 -1
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/agents/task-router.md +10 -0
- package/presets/mavis/next/commands/task-continue.md +1 -1
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +369 -16
- package/presets/mavis/next/rules/agent-team-intake.md +1 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/next/team/README.md +4 -1
- package/presets/mavis/next/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/mavis/next/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/agents/task-router.md +10 -0
- package/presets/mavis/nuxt/commands/task-continue.md +1 -1
- package/presets/mavis/nuxt/commands/task.md +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +369 -16
- package/presets/mavis/nuxt/rules/agent-team-intake.md +1 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/nuxt/team/README.md +4 -1
- package/presets/mavis/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/agents/task-router.md +10 -0
- package/presets/mavis/php-hexagonal/commands/task-continue.md +1 -1
- package/presets/mavis/php-hexagonal/commands/task.md +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +367 -16
- package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +1 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/php-hexagonal/team/README.md +4 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/agents/task-router.md +10 -0
- package/presets/mavis/php-laravel/commands/task-continue.md +1 -1
- package/presets/mavis/php-laravel/commands/task.md +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +367 -16
- package/presets/mavis/php-laravel/rules/agent-team-intake.md +1 -1
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/php-laravel/team/README.md +4 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/agents/task-router.md +10 -0
- package/presets/mavis/svelte/commands/task-continue.md +1 -1
- package/presets/mavis/svelte/commands/task.md +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +369 -16
- package/presets/mavis/svelte/rules/agent-team-intake.md +1 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +18 -4
- package/presets/mavis/svelte/team/README.md +4 -1
- package/presets/mavis/svelte/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-router.md +10 -0
- package/presets/opencode/android-kotlin/commands/task-continue.md +1 -1
- package/presets/opencode/android-kotlin/commands/task.md +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +369 -16
- package/presets/opencode/android-kotlin/rules/agent-team-intake.md +1 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/android-kotlin/team/README.md +4 -1
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/agents/task-router.md +10 -0
- package/presets/opencode/go/commands/task-continue.md +1 -1
- package/presets/opencode/go/commands/task.md +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +367 -16
- package/presets/opencode/go/rules/agent-team-intake.md +1 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/go/team/README.md +4 -1
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/agents/task-router.md +10 -0
- package/presets/opencode/ios-swift/commands/task-continue.md +1 -1
- package/presets/opencode/ios-swift/commands/task.md +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +369 -16
- package/presets/opencode/ios-swift/rules/agent-team-intake.md +1 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/ios-swift/team/README.md +4 -1
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/agents/task-router.md +10 -0
- package/presets/opencode/java/commands/task-continue.md +1 -1
- package/presets/opencode/java/commands/task.md +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +367 -16
- package/presets/opencode/java/rules/agent-team-intake.md +1 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/java/team/README.md +4 -1
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-router.md +10 -0
- package/presets/opencode/mcp-ts/commands/task-continue.md +1 -1
- package/presets/opencode/mcp-ts/commands/task.md +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +367 -16
- package/presets/opencode/mcp-ts/rules/agent-team-intake.md +1 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/mcp-ts/team/README.md +4 -1
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/agents/task-router.md +10 -0
- package/presets/opencode/next/commands/task-continue.md +1 -1
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/hooks/chain-team-phases.sh +369 -16
- package/presets/opencode/next/rules/agent-team-intake.md +1 -1
- package/presets/opencode/next/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/next/team/README.md +4 -1
- package/presets/opencode/next/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/opencode/next/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/agents/task-router.md +10 -0
- package/presets/opencode/nuxt/commands/task-continue.md +1 -1
- package/presets/opencode/nuxt/commands/task.md +1 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +369 -16
- package/presets/opencode/nuxt/rules/agent-team-intake.md +1 -1
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/nuxt/team/README.md +4 -1
- package/presets/opencode/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-router.md +10 -0
- package/presets/opencode/php-hexagonal/commands/task-continue.md +1 -1
- package/presets/opencode/php-hexagonal/commands/task.md +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +367 -16
- package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +1 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/php-hexagonal/team/README.md +4 -1
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/agents/task-router.md +10 -0
- package/presets/opencode/php-laravel/commands/task-continue.md +1 -1
- package/presets/opencode/php-laravel/commands/task.md +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +367 -16
- package/presets/opencode/php-laravel/rules/agent-team-intake.md +1 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/php-laravel/team/README.md +4 -1
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/agents/task-router.md +10 -0
- package/presets/opencode/svelte/commands/task-continue.md +1 -1
- package/presets/opencode/svelte/commands/task.md +1 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +369 -16
- package/presets/opencode/svelte/rules/agent-team-intake.md +1 -1
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +18 -4
- package/presets/opencode/svelte/team/README.md +4 -1
- package/presets/opencode/svelte/team/fixtures/artifact-manifest.example.json +1 -1
- package/scripts/_lib/agent-write-scopes.json +27 -0
- package/scripts/check-parallel-plan.sh +353 -0
- package/scripts/check-preset-prompt-persistence.sh +51 -24
- package/scripts/check-preset-structure.sh +2 -0
- package/scripts/check-step-graph-contract.sh +123 -0
- package/scripts/fixtures/cli-golden/claude/next.json +10 -9
- package/scripts/fixtures/cli-golden/cursor/next.json +10 -9
- package/scripts/fixtures/cli-golden/mavis/android-kotlin.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/go.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/ios-swift.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/java.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/mcp-ts.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/next.json +10 -9
- package/scripts/fixtures/cli-golden/mavis/nuxt.json +9 -9
- package/scripts/fixtures/cli-golden/mavis/php-hexagonal.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/php-laravel.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/svelte.json +9 -9
- package/scripts/fixtures/cli-golden/opencode/android-kotlin.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/go.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/ios-swift.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/java.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/mcp-ts.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/next.json +10 -9
- package/scripts/fixtures/cli-golden/opencode/nuxt.json +9 -9
- package/scripts/fixtures/cli-golden/opencode/php-hexagonal.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/php-laravel.json +8 -8
- package/scripts/fixtures/cli-golden/opencode/svelte.json +9 -9
- package/scripts/test-agent-task-metrics-hooks.mjs +167 -0
- package/scripts/test-chain-team-phases-coverage.mjs +129 -0
- package/scripts/test-parallel-plan-fixtures.mjs +173 -0
- package/scripts/test-preset-prompt-persistence-fixtures.mjs +58 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"id": "routing",
|
|
8
8
|
"producer": "task-router",
|
|
9
9
|
"status": "completed",
|
|
10
|
-
"authoritativePaths": ["pipeline.json", "prompt.md"],
|
|
10
|
+
"authoritativePaths": ["pipeline.json", "prompt.md", "prompt-log.md"],
|
|
11
11
|
"acceptanceCriteriaIds": [],
|
|
12
12
|
"taskIds": [],
|
|
13
13
|
"timestamps": {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slug": "example-feature-parallel",
|
|
3
|
+
"intent": "feature",
|
|
4
|
+
"specMode": "none",
|
|
5
|
+
"profile": "full",
|
|
6
|
+
"routingDecision": {
|
|
7
|
+
"complexity": "high",
|
|
8
|
+
"riskFlags": ["cross-layer", "concurrency-state", "broad-test-surface"],
|
|
9
|
+
"routingReasons": [
|
|
10
|
+
"Two independent review surfaces (code + security) sit on the same dependency level, so the pipeline may schedule them as one parallel wave.",
|
|
11
|
+
"The step graph carries declared write scopes so the conflict model can prove the wave conflict-free before any step is marked parallel."
|
|
12
|
+
],
|
|
13
|
+
"estimatedWorkPackages": 2,
|
|
14
|
+
"openDecisionCount": 0
|
|
15
|
+
},
|
|
16
|
+
"summary": "Step-graph feature pipeline with one parallel review wave",
|
|
17
|
+
"steps": [
|
|
18
|
+
{
|
|
19
|
+
"id": "T1",
|
|
20
|
+
"taskIds": ["T1"],
|
|
21
|
+
"agent": "task-analyst",
|
|
22
|
+
"label": "Clarify and decompose",
|
|
23
|
+
"writeScopes": [".ai.local/team/tasks/<slug>/brief.md", ".ai.local/team/tasks/<slug>/decomposition.md"],
|
|
24
|
+
"artifactOutputId": "analysis"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "T2",
|
|
28
|
+
"taskIds": ["T2"],
|
|
29
|
+
"agent": "solution-architect",
|
|
30
|
+
"label": "Design boundaries",
|
|
31
|
+
"model": "strong",
|
|
32
|
+
"dependsOn": ["T1"],
|
|
33
|
+
"writeScopes": [".ai.local/team/tasks/<slug>/architecture.md"],
|
|
34
|
+
"artifactOutputId": "architecture"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "T3",
|
|
38
|
+
"taskIds": ["T3"],
|
|
39
|
+
"agent": "feature-developer",
|
|
40
|
+
"label": "Implement + unit tests",
|
|
41
|
+
"scope": "unit-in-dev",
|
|
42
|
+
"dependsOn": ["T2"],
|
|
43
|
+
"writeScopes": ["app/src/feature", ".ai.local/team/tasks/<slug>/implementation.md"],
|
|
44
|
+
"artifactOutputId": "implementation"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "T4",
|
|
48
|
+
"taskIds": ["T4"],
|
|
49
|
+
"agent": ["code-reviewer", "security-reviewer"],
|
|
50
|
+
"label": "Review (code + security)",
|
|
51
|
+
"parallel": true,
|
|
52
|
+
"dependsOn": ["T3"],
|
|
53
|
+
"writeScopes": [".ai.local/team/tasks/<slug>/review.md", ".ai.local/team/tasks/<slug>/security-review.md"],
|
|
54
|
+
"artifactInputIds": ["implementation"],
|
|
55
|
+
"artifactOutputIds": {
|
|
56
|
+
"code-reviewer": "review",
|
|
57
|
+
"security-reviewer": "security-review"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "T5",
|
|
62
|
+
"taskIds": ["T5"],
|
|
63
|
+
"agent": "tech-writer",
|
|
64
|
+
"label": "Documentation",
|
|
65
|
+
"dependsOn": ["T3"],
|
|
66
|
+
"writeScopes": [".ai.local/team/tasks/<slug>/documentation.md"],
|
|
67
|
+
"artifactOutputId": "documentation"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "T6",
|
|
71
|
+
"taskIds": ["T6"],
|
|
72
|
+
"agent": "build-verifier",
|
|
73
|
+
"label": "Validation gate",
|
|
74
|
+
"model": "cheap",
|
|
75
|
+
"dependsOn": ["T4", "T5"],
|
|
76
|
+
"writeScopes": [".ai.local/team/tasks/<slug>/validation-report.md"],
|
|
77
|
+
"artifactInputIds": ["implementation", "review", "security-review"],
|
|
78
|
+
"artifactOutputId": "validation"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"humanGates": ["after:task-analyst"],
|
|
82
|
+
"autoChain": true,
|
|
83
|
+
"skipped": []
|
|
84
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"platform": "opencode",
|
|
4
4
|
"stack": "nuxt",
|
|
5
5
|
"semanticSource": "cursor/nuxt",
|
|
6
|
-
"sourceRevision": "
|
|
6
|
+
"sourceRevision": "08c424d61962892ad139bf77203303f46e9888e5bb16add132e24b28a7dd2ca7",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
9
9
|
"source": "AGENTS.md",
|
|
@@ -51,7 +51,7 @@ Before decomposing: state the **goal frame** (goal, user value, success criteria
|
|
|
51
51
|
|
|
52
52
|
<!-- shared-core: agent-team/plan-graph.md -->
|
|
53
53
|
|
|
54
|
-
Decompose as a **dependency graph**: each task carries `dependsOn[]`, the edges form a **DAG** with a critical path and parallelizable groups. Large flows are staged into **Epics / stages** with **exit criteria** (ratchet: bounded tasks stay flat). Plan revision is a named, auditable operation (`decision: replan rev N → N+1` in `.memlog.md`, then re-gate).
|
|
54
|
+
Decompose as a **dependency graph**: each task carries `dependsOn[]`, the edges form a **DAG** with a critical path and parallelizable groups. Large flows are staged into **Epics / stages** with **exit criteria** (ratchet: bounded tasks stay flat). Plan revision is a named, auditable operation (`decision: replan rev N → N+1` in `.memlog.md`, then re-gate). Parallelizable groups are **proven conflict-free** before the router may mark them `parallel: true` — disjoint declared `writeScopes`, distinct agents and `artifactOutputIds`, and no producer→consumer edge. Keep task IDs stable so `steps[].taskIds` / `steps[].dependsOn[]` reuse this vocabulary (see **plan-graph** § Conflict model).
|
|
55
55
|
|
|
56
56
|
## Context budget & iterative refinement
|
|
57
57
|
|
|
@@ -139,6 +139,16 @@ Keep top-level `profile` and emit this top-level object in every new `pipeline.j
|
|
|
139
139
|
- **Always build-verifier** after developer (or after ci-investigator/debugger if they changed code) for `feature`, `bugfix`, `refactor`, `migration`, `a11y`.
|
|
140
140
|
- **skipIf:** `debugger.fixed` on developer (bugfix); `ci-investigator.resolved` (ci-fix).
|
|
141
141
|
|
|
142
|
+
## Parallel step graph (emission rule)
|
|
143
|
+
|
|
144
|
+
A pipeline may carry a step graph. Emit it only for the **architectural** class with more than one independent work package; bounded/spike pipelines stay linear.
|
|
145
|
+
|
|
146
|
+
- Give steps `id` (the decomposition task ID when 1:1), `taskIds` (the analyst's decomposition task IDs), `dependsOn` (step IDs or `taskIds` that must finish first), and `writeScopes` (repo-relative paths the step may write, `<slug>` the only placeholder).
|
|
147
|
+
- Set `parallel: true` (with an `agent` array) **only** for a set proven conflict-free: disjoint declared `writeScopes`, distinct agents, distinct `artifactOutputIds`, none of `status.json` / `metrics.json` / `artifact-manifest.json` / `.metrics-receipts.json` in any scope.
|
|
148
|
+
- A producer → consumer artifact pair is a `dependsOn` edge, never a parallel group.
|
|
149
|
+
- **Never** put `mockup-reviewer` in a parallel group — its FAIL gate is serial.
|
|
150
|
+
- Reference fixture: `team/fixtures/feature-parallel.json` (graph + one `parallel: true` step).
|
|
151
|
+
|
|
142
152
|
## Model tiers (`steps[].model`)
|
|
143
153
|
|
|
144
154
|
Optional per-step field: `"model": "cheap" | "standard" | "strong"`. Omit → agent frontmatter default (see **Model matrix** in `agents/README.md`).
|
|
@@ -42,7 +42,7 @@ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":tr
|
|
|
42
42
|
|
|
43
43
|
## Checkpoint & resume
|
|
44
44
|
|
|
45
|
-
Resume from the on-disk checkpoint, not from chat: read `.ai.local/team/tasks/<slug>/artifact-manifest.json` (authoritative paths per producer) and `.memlog.md` (`## <date>` + `event:` entries), skip completed waves, and continue at the first stage whose exit criteria are unmet. Record produced paths on the `implementation` manifest entry as you go. Do **not** overwrite or duplicate `.ai.local/team/tasks/<slug>/prompt.md` — it records the original ask (write-if-absent).
|
|
45
|
+
Resume from the on-disk checkpoint, not from chat: read `.ai.local/team/tasks/<slug>/artifact-manifest.json` (authoritative paths per producer) and `.memlog.md` (`## <date>` + `event:` entries), skip completed waves, and continue at the first stage whose exit criteria are unmet. Record produced paths on the `implementation` manifest entry as you go. Do **not** overwrite or duplicate `.ai.local/team/tasks/<slug>/prompt.md` — it records the original ask (write-if-absent). Append the `/task-continue` arguments (when present) and any gate feedback verbatim to `.ai.local/team/tasks/<slug>/prompt-log.md` (`seq` = max + 1; skip when the invocation carries no new user words).
|
|
46
46
|
|
|
47
47
|
Plan revision during execution is a named, auditable operation: an evaluation oracle failing twice, a scope/requirement change, or a newly discovered dependency triggers `decision: replan rev N → N+1` in `.memlog.md`, an edit to `decomposition.md` (+ optional `planRevision`), and a **re-run of the affected gate**.
|
|
48
48
|
|
|
@@ -30,7 +30,7 @@ Examples:
|
|
|
30
30
|
|
|
31
31
|
## Algorithm
|
|
32
32
|
|
|
33
|
-
1. **Slug** — kebab-case from the description (≤48 characters). Create `.ai.local/team/tasks/<slug>/` via **Write** (e.g. placeholder `pipeline.json` or empty marker) — runtime/hook owns `status.json` — **not** via Shell `mkdir` (sandbox → `Operation not permitted`). Also write the user's **verbatim** prompt to `.ai.local/team/tasks/<slug>/prompt.md` (write-if-absent; never overwrite on resume; not a manifest `artifacts[]` body).
|
|
33
|
+
1. **Slug** — kebab-case from the description (≤48 characters). Create `.ai.local/team/tasks/<slug>/` via **Write** (e.g. placeholder `pipeline.json` or empty marker) — runtime/hook owns `status.json` — **not** via Shell `mkdir` (sandbox → `Operation not permitted`). Also write the user's **verbatim** prompt to `.ai.local/team/tasks/<slug>/prompt.md` (write-if-absent; never overwrite on resume; not a manifest `artifacts[]` body). Do **not** create the follow-up ledger `prompt-log.md` here; it is created on the first subsequent user-authored prompt (see **agent-artifact-contracts** § Prompt log).
|
|
34
34
|
2. **Router** — invoke subagent **task-router** with the task description and slug path.
|
|
35
35
|
3. **Plan** — show the user the table from `pipeline.json`: intent, steps, skipped, humanGates.
|
|
36
36
|
4. **Intent retro** — if `intent === "retro"`, run `/technical-retro` and **stop**.
|
|
@@ -55,6 +55,9 @@ const statusPath = path.join(taskDir, 'status.json');
|
|
|
55
55
|
const pipelinePath = path.join(taskDir, 'pipeline.json');
|
|
56
56
|
const METRICS_PATH = path.join(taskDir, 'metrics.json');
|
|
57
57
|
const METRICS_LOCK = `${METRICS_PATH}.lock`;
|
|
58
|
+
// Pipeline step graph is assigned once pipeline.json is parsed; declared early so the
|
|
59
|
+
// gate-resume branch can schedule from the graph before the main parse point.
|
|
60
|
+
let steps = [];
|
|
58
61
|
|
|
59
62
|
if (!fs.existsSync(statusPath)) {
|
|
60
63
|
process.stdout.write('{}');
|
|
@@ -175,15 +178,16 @@ function artifactOutputIdFor(step, agent) {
|
|
|
175
178
|
if (step?.artifactOutputIds && typeof step.artifactOutputIds[agent] === 'string') return step.artifactOutputIds[agent];
|
|
176
179
|
return DEFAULT_ARTIFACT_OUTPUT_IDS[agent] || agent;
|
|
177
180
|
}
|
|
178
|
-
function activateAttempts(step, stepIndex) {
|
|
179
|
-
const active = { ...(status.activeAttempts || {}) };
|
|
180
|
-
const
|
|
181
|
+
function activateAttempts(step, stepIndex, waveId = null, agentsOverride = null) {
|
|
182
|
+
const active = { ...(status.activeAttempts || {}) };
|
|
183
|
+
const agents = Array.isArray(agentsOverride) && agentsOverride.length > 0 ? agentsOverride : getStepAgents(step);
|
|
184
|
+
const parallelGroupId = step.parallel && getStepAgents(step).length > 1 ? `${status.metricsRunId || slug}:step-${stepIndex}` : null;
|
|
181
185
|
for (const agent of agents) {
|
|
182
186
|
const attempt = nextAttemptOrdinal(stepIndex, agent); const runId = status.metricsRunId || `${slug}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
183
187
|
status.metricsRunId = runId; const attemptId = `${runId}:step-${stepIndex}:${agent}:attempt-${attempt}`;
|
|
184
188
|
if (active[attemptId]) continue;
|
|
185
|
-
active[attemptId] = { agent, stepIndex, attempt, startedAt: now, parallelGroupId };
|
|
186
|
-
appendMetric({ type: 'attempt_started', at: now, attemptId, stepIndex, stepLabel: step.label || null, agent, role: roleFor(agent), attempt, parallelGroupId, source: 'hook', attributionConfidence: 'high' });
|
|
189
|
+
active[attemptId] = { agent, stepIndex, attempt, startedAt: now, parallelGroupId, waveId: waveId || null };
|
|
190
|
+
appendMetric({ type: 'attempt_started', at: now, attemptId, stepIndex, stepLabel: step.label || null, agent, role: roleFor(agent), attempt, parallelGroupId, waveId: waveId || null, source: 'hook', attributionConfidence: 'high' });
|
|
187
191
|
}
|
|
188
192
|
status.activeAttempts = active;
|
|
189
193
|
}
|
|
@@ -248,8 +252,8 @@ function reconcileStatusFromManifest(agent, step, resolved) {
|
|
|
248
252
|
return status.state;
|
|
249
253
|
}
|
|
250
254
|
|
|
251
|
-
function finishActiveAttempt() {
|
|
252
|
-
const resolved = resolvedAttempt(); if (!resolved) return null;
|
|
255
|
+
function finishActiveAttempt(forced) {
|
|
256
|
+
const resolved = forced || resolvedAttempt(); if (!resolved) return null;
|
|
253
257
|
const durationMs = Date.parse(now) - Date.parse(resolved.entry.startedAt);
|
|
254
258
|
const outcome = ['completed', 'blocked', 'changes_requested', 'validation_failed'].includes(status.state) ? status.state : 'unknown';
|
|
255
259
|
appendMetric({ type: 'attempt_finished', at: now, attemptId: resolved.attemptId, outcome, durationMs: Number.isFinite(durationMs) && durationMs >= 0 ? durationMs : null, retryAfterFix: status.retryAfterFix || null, source: resolved.source || 'hook', attributionConfidence: resolved.confidence });
|
|
@@ -329,6 +333,208 @@ function findNextExecutableStep(steps, startIdx, dir) {
|
|
|
329
333
|
return null;
|
|
330
334
|
}
|
|
331
335
|
|
|
336
|
+
// --- Parallel scheduling & conflict model (mirrors _shared/core/agent-team/plan-graph.md) ---
|
|
337
|
+
function isGraphMode() { return steps.some((step) => step && Array.isArray(step.dependsOn)); }
|
|
338
|
+
function graphSlotKey(stepIndex, agent) { return `${stepIndex}:${agent}`; }
|
|
339
|
+
function readJoinedSlots() { return { ...(status.joinedSlots || {}) }; }
|
|
340
|
+
function isSlotSatisfied(stepIndex, agent) { return Boolean((status.joinedSlots || {})[graphSlotKey(stepIndex, agent)]); }
|
|
341
|
+
function resolveStepIndex(dep) {
|
|
342
|
+
for (let i = 0; i < steps.length; i += 1) if (steps[i] && steps[i].id === dep) return i;
|
|
343
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
344
|
+
const ids = Array.isArray(steps[i]?.taskIds) ? steps[i].taskIds : [];
|
|
345
|
+
if (ids.includes(dep)) return i;
|
|
346
|
+
}
|
|
347
|
+
return -1;
|
|
348
|
+
}
|
|
349
|
+
function isStepSkipped(stepIndex) {
|
|
350
|
+
if (Array.isArray(status.skippedSteps) && status.skippedSteps.includes(stepIndex)) return true;
|
|
351
|
+
return skipIfMatches(steps[stepIndex]?.skipIf, taskDir);
|
|
352
|
+
}
|
|
353
|
+
function isStepSatisfied(stepIndex) {
|
|
354
|
+
const step = steps[stepIndex];
|
|
355
|
+
if (!step) return false;
|
|
356
|
+
if (isStepSkipped(stepIndex)) return true;
|
|
357
|
+
return getStepAgents(step).every((agent) => isSlotSatisfied(stepIndex, agent));
|
|
358
|
+
}
|
|
359
|
+
function pendingStepIndexes() { return steps.map((_, index) => index).filter((index) => !isStepSatisfied(index)); }
|
|
360
|
+
function unsatisfiedAgents(stepIndex) {
|
|
361
|
+
const step = steps[stepIndex];
|
|
362
|
+
if (!step) return [];
|
|
363
|
+
return getStepAgents(step).filter((agent) => !isSlotSatisfied(stepIndex, agent));
|
|
364
|
+
}
|
|
365
|
+
function declaredScopes(step) {
|
|
366
|
+
return Array.isArray(step?.writeScopes) ? step.writeScopes.filter((scope) => typeof scope === 'string' && scope.length > 0) : [];
|
|
367
|
+
}
|
|
368
|
+
function normalizeScope(scope) { return String(scope).replace(/\/+$/, ''); }
|
|
369
|
+
function scopesOverlap(left, right) {
|
|
370
|
+
const a = normalizeScope(left); const b = normalizeScope(right);
|
|
371
|
+
return a === b || a.startsWith(`${b}/`) || b.startsWith(`${a}/`);
|
|
372
|
+
}
|
|
373
|
+
function stepsConflict(leftIndex, rightIndex) {
|
|
374
|
+
if (leftIndex === rightIndex) return true;
|
|
375
|
+
const leftStep = steps[leftIndex]; const rightStep = steps[rightIndex];
|
|
376
|
+
const leftAgents = getStepAgents(leftStep); const rightAgents = getStepAgents(rightStep);
|
|
377
|
+
if (leftAgents.some((agent) => rightAgents.includes(agent))) return true;
|
|
378
|
+
const leftOutputs = new Set(leftAgents.map((agent) => artifactOutputIdFor(leftStep, agent)));
|
|
379
|
+
if (rightAgents.some((agent) => leftOutputs.has(artifactOutputIdFor(rightStep, agent)))) return true;
|
|
380
|
+
// An undeclared scope is unknown, and an unknown unit conflicts with everything (safe default).
|
|
381
|
+
const leftScopes = declaredScopes(leftStep); const rightScopes = declaredScopes(rightStep);
|
|
382
|
+
if (leftScopes.length === 0 || rightScopes.length === 0) return true;
|
|
383
|
+
for (const a of leftScopes) for (const b of rightScopes) if (scopesOverlap(a, b)) return true;
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
function selectWave(candidates) {
|
|
387
|
+
const wave = []; const deferred = [];
|
|
388
|
+
for (const index of candidates) {
|
|
389
|
+
if (wave.every((chosen) => !stepsConflict(chosen, index))) wave.push(index);
|
|
390
|
+
else deferred.push(index);
|
|
391
|
+
}
|
|
392
|
+
return { wave, deferred };
|
|
393
|
+
}
|
|
394
|
+
function invalidateFrom(stepIndex, preserveStepIndex) {
|
|
395
|
+
const remove = new Set([stepIndex]);
|
|
396
|
+
let changed = true;
|
|
397
|
+
while (changed) {
|
|
398
|
+
changed = false;
|
|
399
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
400
|
+
if (remove.has(i)) continue;
|
|
401
|
+
const deps = Array.isArray(steps[i]?.dependsOn) ? steps[i].dependsOn : [];
|
|
402
|
+
if (deps.some((dep) => { const j = resolveStepIndex(dep); return j >= 0 && remove.has(j); })) { remove.add(i); changed = true; }
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
// Preserve the requesting step's satisfied slots so a sibling is never re-invoked.
|
|
406
|
+
if (Number.isInteger(preserveStepIndex)) remove.delete(preserveStepIndex);
|
|
407
|
+
const slots = readJoinedSlots();
|
|
408
|
+
const removedAgents = new Set();
|
|
409
|
+
for (const key of Object.keys(slots)) {
|
|
410
|
+
const index = Number(key.split(':')[0]);
|
|
411
|
+
if (remove.has(index)) { removedAgents.add(slots[key].agent); delete slots[key]; }
|
|
412
|
+
}
|
|
413
|
+
status.joinedSlots = slots;
|
|
414
|
+
status.parallelCompleted = (status.parallelCompleted || []).filter((agent) => !removedAgents.has(agent));
|
|
415
|
+
return remove;
|
|
416
|
+
}
|
|
417
|
+
function computeReadySteps() {
|
|
418
|
+
if (!isGraphMode()) return [];
|
|
419
|
+
const inFlight = new Set(Object.values(status.activeAttempts || {}).map((entry) => entry.stepIndex));
|
|
420
|
+
const blocked = new Set(Array.isArray(status.blockedSteps) ? status.blockedSteps : []);
|
|
421
|
+
const skipped = new Set(Array.isArray(status.skippedSteps) ? status.skippedSteps : []);
|
|
422
|
+
const ready = [];
|
|
423
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
424
|
+
if (blocked.has(i) || inFlight.has(i)) continue;
|
|
425
|
+
if (skipIfMatches(steps[i].skipIf, taskDir)) {
|
|
426
|
+
if (!skipped.has(i)) { recordSkippedStep(steps[i], i); skipped.add(i); }
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
if (isStepSatisfied(i)) continue;
|
|
430
|
+
const deps = Array.isArray(steps[i].dependsOn) ? steps[i].dependsOn : [];
|
|
431
|
+
if (deps.every((dep) => { const j = resolveStepIndex(dep); return j >= 0 && isStepSatisfied(j); })) ready.push(i);
|
|
432
|
+
}
|
|
433
|
+
status.skippedSteps = [...skipped];
|
|
434
|
+
return ready;
|
|
435
|
+
}
|
|
436
|
+
function handoffForWave(units, waveId) {
|
|
437
|
+
const labels = units.map((unit) => `${steps[unit.stepIndex].id || `step-${unit.stepIndex}`}=${unit.agent}`);
|
|
438
|
+
const attemptIds = Object.entries(status.activeAttempts || {})
|
|
439
|
+
.filter(([, entry]) => units.some((unit) => unit.stepIndex === entry.stepIndex && unit.agent === entry.agent))
|
|
440
|
+
.map(([attemptId, entry]) => `${entry.agent}=${attemptId}`);
|
|
441
|
+
const outputIds = units.map((unit) => `${unit.agent}=${artifactOutputIdFor(steps[unit.stepIndex], unit.agent)}`);
|
|
442
|
+
const inputIds = [...new Set(units.flatMap((unit) => (Array.isArray(steps[unit.stepIndex].artifactInputIds) ? steps[unit.stepIndex].artifactInputIds : [])))];
|
|
443
|
+
return (
|
|
444
|
+
`Invoke IN PARALLEL (one message, multiple Task calls): ${labels.join(' AND ')} for slug "${slug}"${waveId ? ` (waveId=${waveId})` : ''}. ` +
|
|
445
|
+
`Each agent writes its artifact and owned receipt; the hook records slot joins from stops. Do not mutate status.json lifecycle fields. ` +
|
|
446
|
+
`Artifact inputs: ${inputIds.length > 0 ? inputIds.join(', ') : 'manifest defaults'}; owned output IDs: ${outputIds.join('; ')}. ` +
|
|
447
|
+
`Metrics attemptIds: ${attemptIds.join('; ')}. If the hook cannot identify a parallel stop, append a minimal { attemptId, outcome } receipt to .metrics-receipts.json; do not calculate duration.`
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
function blockedNotice(blockedIndex, agent) {
|
|
451
|
+
const gated = [];
|
|
452
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
453
|
+
if (i === blockedIndex || isStepSatisfied(i)) continue;
|
|
454
|
+
const deps = Array.isArray(steps[i].dependsOn) ? steps[i].dependsOn : [];
|
|
455
|
+
if (deps.some((dep) => resolveStepIndex(dep) === blockedIndex)) gated.push(steps[i].id || `step-${i}`);
|
|
456
|
+
}
|
|
457
|
+
return `Step ${blockedIndex} (${agent}) is blocked for slug "${slug}"${gated.length > 0 ? ` and gates: ${gated.join(', ')}` : ''}. No independent ready step remains. Resume only via /task-continue ${slug}.`;
|
|
458
|
+
}
|
|
459
|
+
function noProgressNotice() {
|
|
460
|
+
const pending = pendingStepIndexes().map((index) => steps[index].id || `step-${index}`);
|
|
461
|
+
return `No schedulable step remains for slug "${slug}" (unsatisfied: ${pending.join(', ')}). Resume only via /task-continue ${slug}.`;
|
|
462
|
+
}
|
|
463
|
+
function dispatchReadyWave(prefixMessage) {
|
|
464
|
+
const ready = computeReadySteps();
|
|
465
|
+
if (ready.length === 0) return false;
|
|
466
|
+
const { wave, deferred } = selectWave(ready);
|
|
467
|
+
if (deferred.length > 0) {
|
|
468
|
+
appendMetric({ type: 'parallel_conflict_deferred', at: now, stepIndex: wave[0], deferredStepIndexes: deferred, reason: 'ready set not conflict-free or writeScopes undeclared', source: 'hook', attributionConfidence: 'fallback' });
|
|
469
|
+
}
|
|
470
|
+
// Slot-filtered dispatch: only unsatisfied (stepIndex, agent) slots are invoked.
|
|
471
|
+
const units = wave.flatMap((stepIndex) => unsatisfiedAgents(stepIndex).map((agent) => ({ stepIndex, agent })));
|
|
472
|
+
if (units.length === 0) return false;
|
|
473
|
+
const first = units[0].stepIndex;
|
|
474
|
+
const waveId = `${status.metricsRunId || slug}:wave-${first}`;
|
|
475
|
+
for (const unit of units) activateAttempts(steps[unit.stepIndex], unit.stepIndex, units.length > 1 ? waveId : null, [unit.agent]);
|
|
476
|
+
writeStatus({
|
|
477
|
+
pipelineIndex: first,
|
|
478
|
+
currentAgent: units[0].agent,
|
|
479
|
+
phase: 'executing',
|
|
480
|
+
state: 'in_progress',
|
|
481
|
+
awaitingHumanGate: false,
|
|
482
|
+
parallelCompleted: [],
|
|
483
|
+
parallelOutcomes: {},
|
|
484
|
+
waveSteps: wave,
|
|
485
|
+
waveId,
|
|
486
|
+
});
|
|
487
|
+
const stepIndexes = [...new Set(units.map((unit) => unit.stepIndex))];
|
|
488
|
+
appendMetric({ type: 'parallel_wave_started', at: now, waveId, stepIndexes, agents: units.map((unit) => unit.agent), source: 'hook', attributionConfidence: 'high' });
|
|
489
|
+
let message;
|
|
490
|
+
if (units.length === 1) message = handoffForAgent(units[0].agent, steps[first]?.scope, steps[first]);
|
|
491
|
+
else if (stepIndexes.length === 1 && steps[first].parallel && units.length === getStepAgents(steps[first]).length) message = handoffForParallelStep(steps[first]);
|
|
492
|
+
else message = handoffForWave(units, waveId);
|
|
493
|
+
out(prefixMessage ? `${prefixMessage} ${message}` : message);
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
function resolveProducerStepIndex(agent, fromIndex) {
|
|
497
|
+
const seen = new Set([fromIndex]);
|
|
498
|
+
const stack = [fromIndex];
|
|
499
|
+
let best = -1;
|
|
500
|
+
while (stack.length > 0) {
|
|
501
|
+
const node = stack.pop();
|
|
502
|
+
const deps = Array.isArray(steps[node]?.dependsOn) ? steps[node].dependsOn : [];
|
|
503
|
+
for (const dep of deps) {
|
|
504
|
+
const j = resolveStepIndex(dep);
|
|
505
|
+
if (j < 0 || seen.has(j)) continue;
|
|
506
|
+
seen.add(j);
|
|
507
|
+
if (getStepAgents(steps[j]).includes(agent)) best = Math.max(best, j);
|
|
508
|
+
stack.push(j);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return best >= 0 ? best : -1;
|
|
512
|
+
}
|
|
513
|
+
function repairUnattributableStop() {
|
|
514
|
+
const entries = Object.entries(status.activeAttempts || {});
|
|
515
|
+
if (entries.length === 0) return null;
|
|
516
|
+
const bindByAgent = (agent) => {
|
|
517
|
+
if (!agent) return null;
|
|
518
|
+
const matches = entries.filter(([, entry]) => entry.agent === agent);
|
|
519
|
+
return matches.length === 1 ? { attemptId: matches[0][0], entry: matches[0][1], confidence: 'fallback', repaired: true } : null;
|
|
520
|
+
};
|
|
521
|
+
const payloadAgent = typeof hookInput.agentType === 'string' ? hookInput.agentType : (typeof hookInput.agent_type === 'string' ? hookInput.agent_type : null);
|
|
522
|
+
const byPayload = bindByAgent(payloadAgent);
|
|
523
|
+
if (byPayload) return byPayload;
|
|
524
|
+
if (Array.isArray(status.waveSteps) && status.waveSteps.length > 0) {
|
|
525
|
+
const outcomes = status.parallelOutcomes || {};
|
|
526
|
+
const unrecorded = status.waveSteps.flatMap((index) => getStepAgents(steps[index])).filter((agent) => !outcomes[agent]);
|
|
527
|
+
if (unrecorded.length === 1) { const bySole = bindByAgent(unrecorded[0]); if (bySole) return bySole; }
|
|
528
|
+
}
|
|
529
|
+
const byCurrent = bindByAgent(status.currentAgent);
|
|
530
|
+
if (byCurrent) return byCurrent;
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
function repairHandoffMessage() {
|
|
534
|
+
const listing = Object.entries(status.activeAttempts || {}).map(([attemptId, entry]) => `${entry.agent}=${attemptId}`).join('; ');
|
|
535
|
+
return `Parallel stop could not be attributed for slug "${slug}": in-flight attempts ${listing}; no payload attemptId and no bound receipt for the finished agent. Resume deterministically: append a minimal { attemptId, outcome } receipt for the agent that just finished to .ai.local/team/tasks/${slug}/.metrics-receipts.json, then re-run the installed hooks/chain-team-phases.sh with that attemptId. Do not edit status.json manually.`;
|
|
536
|
+
}
|
|
537
|
+
|
|
332
538
|
const AGENT_HANDOFF = {
|
|
333
539
|
'task-analyst': (s) =>
|
|
334
540
|
`Invoke task-analyst for slug "${s}". Write brief.md and decomposition.md under .ai.local/team/tasks/${s}/. ` +
|
|
@@ -543,6 +749,24 @@ if (hookInput.action === 'end_human_gate') {
|
|
|
543
749
|
try { resumePipeline = JSON.parse(fs.readFileSync(pipelinePath, 'utf8')); } catch {}
|
|
544
750
|
if (resumePipeline) {
|
|
545
751
|
const resumeSteps = resumePipeline.steps || [];
|
|
752
|
+
if (resumeSteps.some((step) => step && Array.isArray(step.dependsOn))) {
|
|
753
|
+
steps = resumeSteps;
|
|
754
|
+
status.blockedSteps = [];
|
|
755
|
+
status.parallelCompleted = [];
|
|
756
|
+
status.parallelOutcomes = {};
|
|
757
|
+
status.waveSteps = [];
|
|
758
|
+
status.waveId = null;
|
|
759
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
760
|
+
if (pendingStepIndexes().length === 0) {
|
|
761
|
+
status.state = 'completed';
|
|
762
|
+
completeTaskMetrics();
|
|
763
|
+
writeStatus({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
764
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
765
|
+
process.exit(0);
|
|
766
|
+
}
|
|
767
|
+
out(noProgressNotice());
|
|
768
|
+
process.exit(0);
|
|
769
|
+
}
|
|
546
770
|
const resumeStart = (typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0) + 1;
|
|
547
771
|
const resumeNext = findNextExecutableStep(resumeSteps, resumeStart, taskDir);
|
|
548
772
|
if (resumeNext) {
|
|
@@ -641,7 +865,7 @@ if (pipelineParseError) {
|
|
|
641
865
|
legacyFlow();
|
|
642
866
|
}
|
|
643
867
|
|
|
644
|
-
|
|
868
|
+
steps = pipeline.steps || [];
|
|
645
869
|
const initialIdx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
|
|
646
870
|
const initialStep = steps[initialIdx];
|
|
647
871
|
const activeAttemptCountBeforeFinish = Object.keys(status.activeAttempts || {}).length;
|
|
@@ -658,10 +882,23 @@ if (status.state === 'awaiting_artifact_receipt') {
|
|
|
658
882
|
process.stdout.write('{}');
|
|
659
883
|
process.exit(0);
|
|
660
884
|
}
|
|
661
|
-
|
|
662
|
-
if (!finishedAttempt &&
|
|
663
|
-
|
|
664
|
-
|
|
885
|
+
let finishedAttempt = finishActiveAttempt();
|
|
886
|
+
if (!finishedAttempt && activeAttemptCountBeforeFinish > 0) {
|
|
887
|
+
if (!hookInput.attemptId) {
|
|
888
|
+
const repaired = repairUnattributableStop();
|
|
889
|
+
if (repaired) {
|
|
890
|
+
appendMetric({ type: 'parallel_attribution_repair', at: now, attemptIds: [repaired.attemptId], source: 'hook', attributionConfidence: 'fallback' });
|
|
891
|
+
reconcileStatusFromManifest(repaired.entry.agent, steps[repaired.entry.stepIndex], repaired);
|
|
892
|
+
finishedAttempt = finishActiveAttempt(repaired);
|
|
893
|
+
} else {
|
|
894
|
+
writeStatus({});
|
|
895
|
+
out(repairHandoffMessage());
|
|
896
|
+
process.exit(0);
|
|
897
|
+
}
|
|
898
|
+
} else {
|
|
899
|
+
process.stdout.write('{}');
|
|
900
|
+
process.exit(0);
|
|
901
|
+
}
|
|
665
902
|
}
|
|
666
903
|
endHumanGateIfResumed();
|
|
667
904
|
if (steps.length === 0 || pipeline.autoChain === false) {
|
|
@@ -697,10 +934,28 @@ function scheduleRetry(agent, retryAfterFix, predecessor, explicitStepIndex = nu
|
|
|
697
934
|
const idx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
|
|
698
935
|
const currentStep = steps[idx];
|
|
699
936
|
const completedAgent = finishedAttempt?.entry?.agent || status.currentAgent || getStepAgents(currentStep)[0];
|
|
937
|
+
const completedStepIndex = Number.isInteger(finishedAttempt?.entry?.stepIndex) ? finishedAttempt.entry.stepIndex : idx;
|
|
700
938
|
const stepAgents = getStepAgents(currentStep);
|
|
939
|
+
const activeWave = isGraphMode() && Array.isArray(status.waveSteps) && status.waveSteps.filter((i) => Number.isInteger(i) && steps[i]).length > 0
|
|
940
|
+
? status.waveSteps.filter((i) => Number.isInteger(i) && steps[i])
|
|
941
|
+
: null;
|
|
942
|
+
const waveIndexes = activeWave
|
|
943
|
+
? activeWave
|
|
944
|
+
: (currentStep?.parallel && stepAgents.length > 1
|
|
945
|
+
? [idx]
|
|
946
|
+
: (isGraphMode() && finishedAttempt ? [completedStepIndex] : null));
|
|
701
947
|
|
|
702
|
-
|
|
948
|
+
|
|
949
|
+
if (waveIndexes) {
|
|
950
|
+
const waveAgents = waveIndexes.flatMap((i) => getStepAgents(steps[i]));
|
|
703
951
|
const done = [...(status.parallelCompleted || [])];
|
|
952
|
+
if (isGraphMode()) {
|
|
953
|
+
for (const waveStep of waveIndexes) {
|
|
954
|
+
for (const waveAgent of getStepAgents(steps[waveStep])) {
|
|
955
|
+
if (isSlotSatisfied(waveStep, waveAgent) && !done.includes(waveAgent)) done.push(waveAgent);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
704
959
|
const outcomes = { ...(status.parallelOutcomes || {}) };
|
|
705
960
|
if (finishedAttempt && completedAgent) {
|
|
706
961
|
if (!done.includes(completedAgent)) done.push(completedAgent);
|
|
@@ -710,21 +965,39 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
710
965
|
confidence: finishedAttempt.confidence,
|
|
711
966
|
};
|
|
712
967
|
}
|
|
968
|
+
if (finishedAttempt && completedAgent && isGraphMode() && (finishedAttempt.outcome || status.state) === 'completed') {
|
|
969
|
+
const completedSlots = readJoinedSlots();
|
|
970
|
+
completedSlots[graphSlotKey(completedStepIndex, completedAgent)] = {
|
|
971
|
+
agent: completedAgent,
|
|
972
|
+
stepIndex: completedStepIndex,
|
|
973
|
+
attemptId: finishedAttempt.attemptId,
|
|
974
|
+
outcome: 'completed',
|
|
975
|
+
};
|
|
976
|
+
status.joinedSlots = completedSlots;
|
|
977
|
+
appendMetric({ type: 'step_joined', at: now, stepIndex: completedStepIndex, slotKeys: [graphSlotKey(completedStepIndex, completedAgent)], attemptIds: [finishedAttempt.attemptId], source: 'hook', attributionConfidence: 'high' });
|
|
978
|
+
}
|
|
713
979
|
writeStatus({ parallelCompleted: done, parallelOutcomes: outcomes });
|
|
714
|
-
const remaining =
|
|
980
|
+
const remaining = waveAgents.filter((agent) => !done.includes(agent));
|
|
715
981
|
if (remaining.length > 0) {
|
|
716
982
|
process.stdout.write('{}');
|
|
717
983
|
process.exit(0);
|
|
718
984
|
}
|
|
719
985
|
|
|
720
|
-
const blockedProducer =
|
|
986
|
+
const blockedProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'blocked');
|
|
721
987
|
if (blockedProducer) {
|
|
988
|
+
if (isGraphMode()) {
|
|
989
|
+
const blockedStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(blockedProducer));
|
|
990
|
+
status.blockedSteps = [...new Set([...(status.blockedSteps || []), blockedStepIndex])];
|
|
991
|
+
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: blockedProducer, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
992
|
+
if (!dispatchReadyWave(`Step ${blockedStepIndex} (${blockedProducer}) is blocked; proceeding with independent ready steps.`)) out(blockedNotice(blockedStepIndex, blockedProducer));
|
|
993
|
+
process.exit(0);
|
|
994
|
+
}
|
|
722
995
|
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'blocked', phase: 'blocked', currentAgent: blockedProducer });
|
|
723
996
|
process.stdout.write('{}');
|
|
724
997
|
process.exit(0);
|
|
725
998
|
}
|
|
726
999
|
|
|
727
|
-
const retryReviewer =
|
|
1000
|
+
const retryReviewer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'changes_requested');
|
|
728
1001
|
if (retryReviewer === 'mockup-reviewer') {
|
|
729
1002
|
beginHumanGate();
|
|
730
1003
|
writeStatus({
|
|
@@ -733,11 +1006,34 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
733
1006
|
currentAgent: 'mockup-reviewer',
|
|
734
1007
|
parallelCompleted: [],
|
|
735
1008
|
parallelOutcomes: {},
|
|
1009
|
+
waveSteps: [],
|
|
1010
|
+
waveId: null,
|
|
736
1011
|
});
|
|
737
1012
|
out(`Mockup review FAIL for slug "${slug}". Read mockup-review.md. Resume only via /task-continue. Do not retry feature-developer.`);
|
|
738
1013
|
process.exit(0);
|
|
739
1014
|
}
|
|
740
1015
|
if (retryReviewer) {
|
|
1016
|
+
if (isGraphMode()) {
|
|
1017
|
+
const reviewerStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(retryReviewer));
|
|
1018
|
+
const producerIndex = resolveProducerStepIndex('feature-developer', reviewerStepIndex);
|
|
1019
|
+
if (producerIndex < 0) {
|
|
1020
|
+
beginHumanGate();
|
|
1021
|
+
writeStatus({ awaitingHumanGate: true, state: 'awaiting_approval', currentAgent: retryReviewer, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1022
|
+
out(`${retryReviewer} requested changes for slug "${slug}" but no graph ancestor authors fixes. Read the review artifact. Resume only via /task-continue.`);
|
|
1023
|
+
process.exit(0);
|
|
1024
|
+
}
|
|
1025
|
+
const graphPredecessor = outcomes[retryReviewer]
|
|
1026
|
+
? { attemptId: outcomes[retryReviewer].attemptId, confidence: outcomes[retryReviewer].confidence }
|
|
1027
|
+
: finishedAttempt;
|
|
1028
|
+
appendMetric({ type: 'retry_scheduled', at: now, attemptId: graphPredecessor?.attemptId || status.lastCompletedAttempt?.attemptId || null, nextAgent: 'feature-developer', retryAfterFix: retryReviewer, source: 'hook', attributionConfidence: graphPredecessor ? graphPredecessor.confidence : 'unknown' });
|
|
1029
|
+
invalidateFrom(producerIndex, reviewerStepIndex);
|
|
1030
|
+
const siblingOutcomes = { ...(status.parallelOutcomes || {}) };
|
|
1031
|
+
delete siblingOutcomes[retryReviewer];
|
|
1032
|
+
status.parallelOutcomes = siblingOutcomes;
|
|
1033
|
+
writeStatus({ state: 'in_progress', phase: 'executing', waveSteps: [], waveId: null, retryAfterFix: null, retryAfterFixStepIndex: null });
|
|
1034
|
+
if (!dispatchReadyWave(`Step ${reviewerStepIndex} (${retryReviewer}) requested changes; re-dispatching unsatisfied steps.`)) out(noProgressNotice());
|
|
1035
|
+
process.exit(0);
|
|
1036
|
+
}
|
|
741
1037
|
const retryAfterFixStepIndex = idx;
|
|
742
1038
|
const predecessor = outcomes[retryReviewer]
|
|
743
1039
|
? {
|
|
@@ -772,10 +1068,51 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
772
1068
|
process.exit(0);
|
|
773
1069
|
}
|
|
774
1070
|
|
|
1071
|
+
if (isGraphMode()) {
|
|
1072
|
+
const validationProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'validation_failed');
|
|
1073
|
+
if (validationProducer) {
|
|
1074
|
+
const verifierStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(validationProducer));
|
|
1075
|
+
const producerIndex = resolveProducerStepIndex('feature-developer', verifierStepIndex);
|
|
1076
|
+
if (producerIndex >= 0) {
|
|
1077
|
+
appendMetric({ type: 'retry_scheduled', at: now, attemptId: outcomes[validationProducer]?.attemptId || null, nextAgent: 'feature-developer', retryAfterFix: validationProducer, source: 'hook', attributionConfidence: 'fallback' });
|
|
1078
|
+
invalidateFrom(producerIndex, verifierStepIndex);
|
|
1079
|
+
writeStatus({ state: 'in_progress', phase: 'executing', parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1080
|
+
if (dispatchReadyWave(`Step ${verifierStepIndex} (${validationProducer}) failed validation; re-dispatching unsatisfied steps.`)) process.exit(0);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
const gatedStep = waveIndexes.find((i) => hasGateAfterStep(steps[i], pipeline.humanGates));
|
|
1084
|
+
if (gatedStep !== undefined) {
|
|
1085
|
+
beginHumanGate();
|
|
1086
|
+
writeStatus({ awaitingHumanGate: true, state: 'awaiting_approval', currentAgent: completedAgent, pipelineIndex: gatedStep, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1087
|
+
process.stdout.write('{}');
|
|
1088
|
+
process.exit(0);
|
|
1089
|
+
}
|
|
1090
|
+
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null, state: 'completed' });
|
|
1091
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
1092
|
+
if (Object.keys(status.activeAttempts || {}).length > 0) {
|
|
1093
|
+
process.stdout.write('{}');
|
|
1094
|
+
process.exit(0);
|
|
1095
|
+
}
|
|
1096
|
+
if (pendingStepIndexes().length === 0) {
|
|
1097
|
+
completeTaskMetrics();
|
|
1098
|
+
writeStatus({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1099
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1100
|
+
process.exit(0);
|
|
1101
|
+
}
|
|
1102
|
+
out(noProgressNotice());
|
|
1103
|
+
process.exit(0);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
775
1106
|
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'completed' });
|
|
776
1107
|
}
|
|
777
1108
|
|
|
778
1109
|
if (status.state === 'blocked') {
|
|
1110
|
+
if (isGraphMode()) {
|
|
1111
|
+
status.blockedSteps = [...new Set([...(status.blockedSteps || []), idx])];
|
|
1112
|
+
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent, waveSteps: [], waveId: null, parallelCompleted: [], parallelOutcomes: {} });
|
|
1113
|
+
if (!dispatchReadyWave(`Step ${idx} (${completedAgent}) is blocked; proceeding with independent ready steps.`)) out(blockedNotice(idx, completedAgent));
|
|
1114
|
+
process.exit(0);
|
|
1115
|
+
}
|
|
779
1116
|
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent });
|
|
780
1117
|
process.stdout.write('{}');
|
|
781
1118
|
process.exit(0);
|
|
@@ -868,6 +1205,22 @@ if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
|
|
|
868
1205
|
process.exit(0);
|
|
869
1206
|
}
|
|
870
1207
|
|
|
1208
|
+
if (isGraphMode()) {
|
|
1209
|
+
if (Object.keys(status.activeAttempts || {}).length > 0) {
|
|
1210
|
+
process.stdout.write('{}');
|
|
1211
|
+
process.exit(0);
|
|
1212
|
+
}
|
|
1213
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
1214
|
+
if (pendingStepIndexes().length === 0) {
|
|
1215
|
+
completeTaskMetrics();
|
|
1216
|
+
writeStatus({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1217
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1218
|
+
process.exit(0);
|
|
1219
|
+
}
|
|
1220
|
+
out(noProgressNotice());
|
|
1221
|
+
process.exit(0);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
871
1224
|
const next = findNextExecutableStep(steps, idx + 1, taskDir);
|
|
872
1225
|
if (!next) {
|
|
873
1226
|
completeTaskMetrics();
|