@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
|
@@ -165,6 +165,16 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
165
165
|
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
166
166
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override (see below) |
|
|
167
167
|
|
|
168
|
+
## Parallel scheduling (graph mode)
|
|
169
|
+
|
|
170
|
+
`pipeline.json` may carry an optional step graph: `steps[].id`, `steps[].taskIds[]`, `steps[].dependsOn[]`, `steps[].writeScopes[]`. While no step declares `dependsOn`, the hook keeps the legacy linear advance; any occurrence switches it to graph mode.
|
|
171
|
+
|
|
172
|
+
- The hook recomputes the **ready queue** on every stop: steps whose `dependsOn` are satisfied, not yet satisfied, not in flight, not skipped, not blocked.
|
|
173
|
+
- The **wave** is the join unit; a single `parallel: true` step is a one-step wave. `status.joinedSlots` is the persistent satisfaction ledger; `status.waveSteps`/`waveId` name the in-flight wave; `status.blockedSteps` excludes a blocked step.
|
|
174
|
+
- Set `parallel: true` only for a set proven conflict-free (disjoint `writeScopes`, distinct agents and `artifactOutputIds`); never place `mockup-reviewer` in a parallel group.
|
|
175
|
+
- **No advance before reconciliation.** Invoke exactly the handoff's agent list (a wave in one turn, multiple Task calls) and do not start a next step from your own reasoning until the hook records the join.
|
|
176
|
+
- A retry re-dispatches only unsatisfied slots: a satisfied sibling keeps its entry and terminal metric and is never re-invoked.
|
|
177
|
+
|
|
168
178
|
## Rules (strict)
|
|
169
179
|
|
|
170
180
|
1. **`/task` always starts with task-router** (except user says "skip router" with documented pipeline).
|
|
@@ -176,7 +186,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
176
186
|
7. On `validation_failed` from `build-verifier`: hook sets `retryAfterFix: build-verifier` → developer → build-verifier.
|
|
177
187
|
8. When all steps complete, suggest `/technical-retro <slug>`.
|
|
178
188
|
9. If `autoChain: false` in pipeline, do not rely on hook — manual step only.
|
|
179
|
-
10. **Persist the verbatim original prompt.** Every `/task` and every routed work request writes the user's raw prompt to `.ai.local/team/tasks/<slug>/prompt.md` during slug bootstrap (write-if-absent; never overwrite on resume). Not a manifest `artifacts[]` body — register the path on the `routing` entry. See **agent-artifact-contracts** § Prompt artifact.
|
|
189
|
+
10. **Persist the verbatim original prompt.** Every `/task` and every routed work request writes the user's raw prompt to `.ai.local/team/tasks/<slug>/prompt.md` during slug bootstrap (write-if-absent; never overwrite on resume). Not a manifest `artifacts[]` body — register the path on the `routing` entry. See **agent-artifact-contracts** § Prompt artifact. Also append every **subsequent user-authored** prompt for the same slug — a new user message while the slug is active, `/task-continue` arguments, human-gate feedback, a clarification answer — to the append-only `.ai.local/team/tasks/<slug>/prompt-log.md` (`seq` = max + 1; never rewrite or duplicate an entry; never log machine-generated hook `followup_message` or empty/argument-less invocations). Register its path on the `routing` entry. See **agent-artifact-contracts** § Prompt log.
|
|
180
190
|
11. **Answer the user in the resolved dialogue language for the whole task.** Resolve once at task start
|
|
181
191
|
(`.ai.local` `## Language` → prompt language → English) and pass it to every step; `/task-continue` keeps
|
|
182
192
|
it. Never ask the user to pick a language. Development, reasoning, and artifacts stay English. See
|
|
@@ -185,6 +195,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
185
195
|
## Team artifact I/O (Cursor Shell sandbox)
|
|
186
196
|
|
|
187
197
|
- **Persist the original prompt.** For **every** task — `/task` or a routed work request — write the user's **verbatim** prompt to `.ai.local/team/tasks/<slug>/prompt.md` during slug bootstrap (write-if-absent; never overwrite on resume). The header is additive provenance only; the fenced text block holds the user's words unchanged. Not a manifest `artifacts[]` body — the path lives on the `routing` entry. See **agent-artifact-contracts** § Prompt artifact.
|
|
198
|
+
- **Append follow-up prompts.** When a user-authored prompt arrives for an active slug (new message, `/task-continue` args, gate feedback, clarification), append it verbatim to `.ai.local/team/tasks/<slug>/prompt-log.md` — `seq` = current max + 1, create on first append, never rewrite or duplicate an entry, never touch `prompt.md`. Exclude hook `followup_message` and empty/argument-less invocations. Not a manifest `artifacts[]` body — the path lives on the `routing` entry. See **agent-artifact-contracts** § Prompt log.
|
|
188
199
|
- **Answer in the resolved dialogue language.** Resolve once at task start (`.ai.local` `## Language` →
|
|
189
200
|
prompt language → English; mixed → dominant; nearest `.ai.local` wins) and reuse it for every user-facing
|
|
190
201
|
message and `/task-continue`. Record the tag in the `prompt.md` header (`language: <BCP-47>`) + a
|
|
@@ -17,6 +17,7 @@ Shared `/task` runtime for Cursor, Claude, Mavis, and OpenCode. Seeded at **`.ai
|
|
|
17
17
|
metrics.json # hook-owned append-only ledger
|
|
18
18
|
artifact-manifest.json # producer receipts
|
|
19
19
|
prompt.md # verbatim original ask + resolved `language: <BCP-47>` header (write-if-absent; write point = /task Slug bootstrap; path on the routing entry)
|
|
20
|
+
prompt-log.md # append-only ledger of subsequent user-authored prompts (orchestrator-written; created on first follow-up; path on the routing entry)
|
|
20
21
|
brief.md, decomposition.md, implementation.md, review.md, …
|
|
21
22
|
.memlog.md # optional agent notes (hook does not parse)
|
|
22
23
|
```
|
|
@@ -53,7 +54,7 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
|
|
|
53
54
|
|
|
54
55
|
## status.json
|
|
55
56
|
|
|
56
|
-
Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`.
|
|
57
|
+
Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`, `blocked` (graph mode still dispatches independent ready steps), `awaiting_artifact_receipt`.
|
|
57
58
|
|
|
58
59
|
## Commands
|
|
59
60
|
|
|
@@ -83,6 +84,8 @@ Same JSON on Claude, Mavis, or OpenCode: `bash .<tool>/hooks/chain-team-phases.s
|
|
|
83
84
|
|
|
84
85
|
`pipeline.json` MAY carry these additive, **hook-ignored** fields (schema v1 ignores unknown fields; the hook never parses them): `epics[]` (staging + exit criteria), `planRevision` (current plan rev), `contextBudget` (budget / checkpoint note).
|
|
85
86
|
|
|
87
|
+
`pipeline.json` `steps[]` MAY also carry the optional **step graph**: `id`, `taskIds[]`, `dependsOn[]`, `writeScopes[]`. While no step declares `dependsOn`, the hook keeps the linear pass; any occurrence switches it to graph mode, where the hook computes the ready queue and dispatches each conflict-free wave (one turn, multiple Task calls). `writeScopes` is the declared write surface that proves conflict-freedom (see shared-core `agent-team/plan-graph.md` § Pipeline step graph / § Conflict model). The hook records satisfaction in `status.joinedSlots` and names the in-flight wave in `status.waveSteps` / `status.waveId`.
|
|
88
|
+
|
|
86
89
|
**Checkpoint / resume:** progress is checkpointed to `tasks/<slug>/.memlog.md` (`## <date>` + `event:` entries) and the `artifact-manifest.json` `implementation` entry (`authoritativePaths`). A resumed run reads both and continues at the first stage whose exit criteria are unmet.
|
|
87
90
|
|
|
88
91
|
**Self-review / re-anchor:** each producing agent records a `## Self-review` block in the artifact it owns (`brief.md` / `implementation.md` / `debug-report.md` / `validation-report.md` / `review.md`) and, on detected context loss / excess, a re-anchor line in `.memlog.md` — `event:` (no plan change) or `decision: replan rev N → N+1` (plan change). No hook/lifecycle field is added.
|
|
@@ -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": {
|
|
@@ -27,7 +27,7 @@ Before decomposing: state the **goal frame** (goal, user value, success criteria
|
|
|
27
27
|
|
|
28
28
|
<!-- shared-core: agent-team/plan-graph.md -->
|
|
29
29
|
|
|
30
|
-
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).
|
|
30
|
+
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).
|
|
31
31
|
|
|
32
32
|
## Context budget & iterative refinement
|
|
33
33
|
|
|
@@ -95,6 +95,16 @@ Keep top-level `profile` and emit this top-level object in every new `pipeline.j
|
|
|
95
95
|
- Add **tech-writer** when docs/changelog requested.
|
|
96
96
|
|
|
97
97
|
|
|
98
|
+
## Parallel step graph (emission rule)
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
- 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).
|
|
103
|
+
- 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.
|
|
104
|
+
- A producer → consumer artifact pair is a `dependsOn` edge, never a parallel group.
|
|
105
|
+
- **Never** put `mockup-reviewer` in a parallel group — its FAIL gate is serial.
|
|
106
|
+
- Reference fixture: `team/fixtures/feature-parallel.json` (graph + one `parallel: true` step).
|
|
107
|
+
|
|
98
108
|
## Model tiers (`steps[].model`)
|
|
99
109
|
|
|
100
110
|
Optional: `"model": "cheap" | "standard" | "strong"`. Same policy as **cursor/next** `task-router.md`:
|
|
@@ -39,7 +39,7 @@ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":tr
|
|
|
39
39
|
|
|
40
40
|
## Checkpoint & resume
|
|
41
41
|
|
|
42
|
-
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).
|
|
42
|
+
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).
|
|
43
43
|
|
|
44
44
|
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**.
|
|
45
45
|
|
|
@@ -27,7 +27,7 @@ Examples:
|
|
|
27
27
|
|
|
28
28
|
## Algorithm
|
|
29
29
|
|
|
30
|
-
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) — the 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).
|
|
30
|
+
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) — the 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).
|
|
31
31
|
2. **Router** — invoke subagent **task-router** with the task description and slug path.
|
|
32
32
|
3. **Plan** — show the user the table from `pipeline.json`: intent, steps, skipped, humanGates.
|
|
33
33
|
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
|
}
|
|
@@ -246,8 +250,8 @@ function reconcileStatusFromManifest(agent, step, resolved) {
|
|
|
246
250
|
return status.state;
|
|
247
251
|
}
|
|
248
252
|
|
|
249
|
-
function finishActiveAttempt() {
|
|
250
|
-
const resolved = resolvedAttempt(); if (!resolved) return null;
|
|
253
|
+
function finishActiveAttempt(forced) {
|
|
254
|
+
const resolved = forced || resolvedAttempt(); if (!resolved) return null;
|
|
251
255
|
const durationMs = Date.parse(now) - Date.parse(resolved.entry.startedAt);
|
|
252
256
|
const outcome = ['completed', 'blocked', 'changes_requested', 'validation_failed'].includes(status.state) ? status.state : 'unknown';
|
|
253
257
|
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 });
|
|
@@ -327,6 +331,208 @@ function findNextExecutableStep(steps, startIdx, dir) {
|
|
|
327
331
|
return null;
|
|
328
332
|
}
|
|
329
333
|
|
|
334
|
+
// --- Parallel scheduling & conflict model (mirrors _shared/core/agent-team/plan-graph.md) ---
|
|
335
|
+
function isGraphMode() { return steps.some((step) => step && Array.isArray(step.dependsOn)); }
|
|
336
|
+
function graphSlotKey(stepIndex, agent) { return `${stepIndex}:${agent}`; }
|
|
337
|
+
function readJoinedSlots() { return { ...(status.joinedSlots || {}) }; }
|
|
338
|
+
function isSlotSatisfied(stepIndex, agent) { return Boolean((status.joinedSlots || {})[graphSlotKey(stepIndex, agent)]); }
|
|
339
|
+
function resolveStepIndex(dep) {
|
|
340
|
+
for (let i = 0; i < steps.length; i += 1) if (steps[i] && steps[i].id === dep) return i;
|
|
341
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
342
|
+
const ids = Array.isArray(steps[i]?.taskIds) ? steps[i].taskIds : [];
|
|
343
|
+
if (ids.includes(dep)) return i;
|
|
344
|
+
}
|
|
345
|
+
return -1;
|
|
346
|
+
}
|
|
347
|
+
function isStepSkipped(stepIndex) {
|
|
348
|
+
if (Array.isArray(status.skippedSteps) && status.skippedSteps.includes(stepIndex)) return true;
|
|
349
|
+
return skipIfMatches(steps[stepIndex]?.skipIf, taskDir);
|
|
350
|
+
}
|
|
351
|
+
function isStepSatisfied(stepIndex) {
|
|
352
|
+
const step = steps[stepIndex];
|
|
353
|
+
if (!step) return false;
|
|
354
|
+
if (isStepSkipped(stepIndex)) return true;
|
|
355
|
+
return getStepAgents(step).every((agent) => isSlotSatisfied(stepIndex, agent));
|
|
356
|
+
}
|
|
357
|
+
function pendingStepIndexes() { return steps.map((_, index) => index).filter((index) => !isStepSatisfied(index)); }
|
|
358
|
+
function unsatisfiedAgents(stepIndex) {
|
|
359
|
+
const step = steps[stepIndex];
|
|
360
|
+
if (!step) return [];
|
|
361
|
+
return getStepAgents(step).filter((agent) => !isSlotSatisfied(stepIndex, agent));
|
|
362
|
+
}
|
|
363
|
+
function declaredScopes(step) {
|
|
364
|
+
return Array.isArray(step?.writeScopes) ? step.writeScopes.filter((scope) => typeof scope === 'string' && scope.length > 0) : [];
|
|
365
|
+
}
|
|
366
|
+
function normalizeScope(scope) { return String(scope).replace(/\/+$/, ''); }
|
|
367
|
+
function scopesOverlap(left, right) {
|
|
368
|
+
const a = normalizeScope(left); const b = normalizeScope(right);
|
|
369
|
+
return a === b || a.startsWith(`${b}/`) || b.startsWith(`${a}/`);
|
|
370
|
+
}
|
|
371
|
+
function stepsConflict(leftIndex, rightIndex) {
|
|
372
|
+
if (leftIndex === rightIndex) return true;
|
|
373
|
+
const leftStep = steps[leftIndex]; const rightStep = steps[rightIndex];
|
|
374
|
+
const leftAgents = getStepAgents(leftStep); const rightAgents = getStepAgents(rightStep);
|
|
375
|
+
if (leftAgents.some((agent) => rightAgents.includes(agent))) return true;
|
|
376
|
+
const leftOutputs = new Set(leftAgents.map((agent) => artifactOutputIdFor(leftStep, agent)));
|
|
377
|
+
if (rightAgents.some((agent) => leftOutputs.has(artifactOutputIdFor(rightStep, agent)))) return true;
|
|
378
|
+
// An undeclared scope is unknown, and an unknown unit conflicts with everything (safe default).
|
|
379
|
+
const leftScopes = declaredScopes(leftStep); const rightScopes = declaredScopes(rightStep);
|
|
380
|
+
if (leftScopes.length === 0 || rightScopes.length === 0) return true;
|
|
381
|
+
for (const a of leftScopes) for (const b of rightScopes) if (scopesOverlap(a, b)) return true;
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
function selectWave(candidates) {
|
|
385
|
+
const wave = []; const deferred = [];
|
|
386
|
+
for (const index of candidates) {
|
|
387
|
+
if (wave.every((chosen) => !stepsConflict(chosen, index))) wave.push(index);
|
|
388
|
+
else deferred.push(index);
|
|
389
|
+
}
|
|
390
|
+
return { wave, deferred };
|
|
391
|
+
}
|
|
392
|
+
function invalidateFrom(stepIndex, preserveStepIndex) {
|
|
393
|
+
const remove = new Set([stepIndex]);
|
|
394
|
+
let changed = true;
|
|
395
|
+
while (changed) {
|
|
396
|
+
changed = false;
|
|
397
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
398
|
+
if (remove.has(i)) continue;
|
|
399
|
+
const deps = Array.isArray(steps[i]?.dependsOn) ? steps[i].dependsOn : [];
|
|
400
|
+
if (deps.some((dep) => { const j = resolveStepIndex(dep); return j >= 0 && remove.has(j); })) { remove.add(i); changed = true; }
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Preserve the requesting step's satisfied slots so a sibling is never re-invoked.
|
|
404
|
+
if (Number.isInteger(preserveStepIndex)) remove.delete(preserveStepIndex);
|
|
405
|
+
const slots = readJoinedSlots();
|
|
406
|
+
const removedAgents = new Set();
|
|
407
|
+
for (const key of Object.keys(slots)) {
|
|
408
|
+
const index = Number(key.split(':')[0]);
|
|
409
|
+
if (remove.has(index)) { removedAgents.add(slots[key].agent); delete slots[key]; }
|
|
410
|
+
}
|
|
411
|
+
status.joinedSlots = slots;
|
|
412
|
+
status.parallelCompleted = (status.parallelCompleted || []).filter((agent) => !removedAgents.has(agent));
|
|
413
|
+
return remove;
|
|
414
|
+
}
|
|
415
|
+
function computeReadySteps() {
|
|
416
|
+
if (!isGraphMode()) return [];
|
|
417
|
+
const inFlight = new Set(Object.values(status.activeAttempts || {}).map((entry) => entry.stepIndex));
|
|
418
|
+
const blocked = new Set(Array.isArray(status.blockedSteps) ? status.blockedSteps : []);
|
|
419
|
+
const skipped = new Set(Array.isArray(status.skippedSteps) ? status.skippedSteps : []);
|
|
420
|
+
const ready = [];
|
|
421
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
422
|
+
if (blocked.has(i) || inFlight.has(i)) continue;
|
|
423
|
+
if (skipIfMatches(steps[i].skipIf, taskDir)) {
|
|
424
|
+
if (!skipped.has(i)) { recordSkippedStep(steps[i], i); skipped.add(i); }
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (isStepSatisfied(i)) continue;
|
|
428
|
+
const deps = Array.isArray(steps[i].dependsOn) ? steps[i].dependsOn : [];
|
|
429
|
+
if (deps.every((dep) => { const j = resolveStepIndex(dep); return j >= 0 && isStepSatisfied(j); })) ready.push(i);
|
|
430
|
+
}
|
|
431
|
+
status.skippedSteps = [...skipped];
|
|
432
|
+
return ready;
|
|
433
|
+
}
|
|
434
|
+
function handoffForWave(units, waveId) {
|
|
435
|
+
const labels = units.map((unit) => `${steps[unit.stepIndex].id || `step-${unit.stepIndex}`}=${unit.agent}`);
|
|
436
|
+
const attemptIds = Object.entries(status.activeAttempts || {})
|
|
437
|
+
.filter(([, entry]) => units.some((unit) => unit.stepIndex === entry.stepIndex && unit.agent === entry.agent))
|
|
438
|
+
.map(([attemptId, entry]) => `${entry.agent}=${attemptId}`);
|
|
439
|
+
const outputIds = units.map((unit) => `${unit.agent}=${artifactOutputIdFor(steps[unit.stepIndex], unit.agent)}`);
|
|
440
|
+
const inputIds = [...new Set(units.flatMap((unit) => (Array.isArray(steps[unit.stepIndex].artifactInputIds) ? steps[unit.stepIndex].artifactInputIds : [])))];
|
|
441
|
+
return (
|
|
442
|
+
`Invoke IN PARALLEL (one message, multiple Task calls): ${labels.join(' AND ')} for slug "${slug}"${waveId ? ` (waveId=${waveId})` : ''}. ` +
|
|
443
|
+
`Each agent writes its artifact and owned receipt; the hook records slot joins from stops. Do not mutate status.json lifecycle fields. ` +
|
|
444
|
+
`Artifact inputs: ${inputIds.length > 0 ? inputIds.join(', ') : 'manifest defaults'}; owned output IDs: ${outputIds.join('; ')}. ` +
|
|
445
|
+
`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.`
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
function blockedNotice(blockedIndex, agent) {
|
|
449
|
+
const gated = [];
|
|
450
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
451
|
+
if (i === blockedIndex || isStepSatisfied(i)) continue;
|
|
452
|
+
const deps = Array.isArray(steps[i].dependsOn) ? steps[i].dependsOn : [];
|
|
453
|
+
if (deps.some((dep) => resolveStepIndex(dep) === blockedIndex)) gated.push(steps[i].id || `step-${i}`);
|
|
454
|
+
}
|
|
455
|
+
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}.`;
|
|
456
|
+
}
|
|
457
|
+
function noProgressNotice() {
|
|
458
|
+
const pending = pendingStepIndexes().map((index) => steps[index].id || `step-${index}`);
|
|
459
|
+
return `No schedulable step remains for slug "${slug}" (unsatisfied: ${pending.join(', ')}). Resume only via /task-continue ${slug}.`;
|
|
460
|
+
}
|
|
461
|
+
function dispatchReadyWave(prefixMessage) {
|
|
462
|
+
const ready = computeReadySteps();
|
|
463
|
+
if (ready.length === 0) return false;
|
|
464
|
+
const { wave, deferred } = selectWave(ready);
|
|
465
|
+
if (deferred.length > 0) {
|
|
466
|
+
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' });
|
|
467
|
+
}
|
|
468
|
+
// Slot-filtered dispatch: only unsatisfied (stepIndex, agent) slots are invoked.
|
|
469
|
+
const units = wave.flatMap((stepIndex) => unsatisfiedAgents(stepIndex).map((agent) => ({ stepIndex, agent })));
|
|
470
|
+
if (units.length === 0) return false;
|
|
471
|
+
const first = units[0].stepIndex;
|
|
472
|
+
const waveId = `${status.metricsRunId || slug}:wave-${first}`;
|
|
473
|
+
for (const unit of units) activateAttempts(steps[unit.stepIndex], unit.stepIndex, units.length > 1 ? waveId : null, [unit.agent]);
|
|
474
|
+
writeStatus({
|
|
475
|
+
pipelineIndex: first,
|
|
476
|
+
currentAgent: units[0].agent,
|
|
477
|
+
phase: 'executing',
|
|
478
|
+
state: 'in_progress',
|
|
479
|
+
awaitingHumanGate: false,
|
|
480
|
+
parallelCompleted: [],
|
|
481
|
+
parallelOutcomes: {},
|
|
482
|
+
waveSteps: wave,
|
|
483
|
+
waveId,
|
|
484
|
+
});
|
|
485
|
+
const stepIndexes = [...new Set(units.map((unit) => unit.stepIndex))];
|
|
486
|
+
appendMetric({ type: 'parallel_wave_started', at: now, waveId, stepIndexes, agents: units.map((unit) => unit.agent), source: 'hook', attributionConfidence: 'high' });
|
|
487
|
+
let message;
|
|
488
|
+
if (units.length === 1) message = handoffForAgent(units[0].agent, steps[first]?.scope, steps[first]);
|
|
489
|
+
else if (stepIndexes.length === 1 && steps[first].parallel && units.length === getStepAgents(steps[first]).length) message = handoffForParallelStep(steps[first]);
|
|
490
|
+
else message = handoffForWave(units, waveId);
|
|
491
|
+
out(prefixMessage ? `${prefixMessage} ${message}` : message);
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
function resolveProducerStepIndex(agent, fromIndex) {
|
|
495
|
+
const seen = new Set([fromIndex]);
|
|
496
|
+
const stack = [fromIndex];
|
|
497
|
+
let best = -1;
|
|
498
|
+
while (stack.length > 0) {
|
|
499
|
+
const node = stack.pop();
|
|
500
|
+
const deps = Array.isArray(steps[node]?.dependsOn) ? steps[node].dependsOn : [];
|
|
501
|
+
for (const dep of deps) {
|
|
502
|
+
const j = resolveStepIndex(dep);
|
|
503
|
+
if (j < 0 || seen.has(j)) continue;
|
|
504
|
+
seen.add(j);
|
|
505
|
+
if (getStepAgents(steps[j]).includes(agent)) best = Math.max(best, j);
|
|
506
|
+
stack.push(j);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return best >= 0 ? best : -1;
|
|
510
|
+
}
|
|
511
|
+
function repairUnattributableStop() {
|
|
512
|
+
const entries = Object.entries(status.activeAttempts || {});
|
|
513
|
+
if (entries.length === 0) return null;
|
|
514
|
+
const bindByAgent = (agent) => {
|
|
515
|
+
if (!agent) return null;
|
|
516
|
+
const matches = entries.filter(([, entry]) => entry.agent === agent);
|
|
517
|
+
return matches.length === 1 ? { attemptId: matches[0][0], entry: matches[0][1], confidence: 'fallback', repaired: true } : null;
|
|
518
|
+
};
|
|
519
|
+
const payloadAgent = typeof hookInput.agentType === 'string' ? hookInput.agentType : (typeof hookInput.agent_type === 'string' ? hookInput.agent_type : null);
|
|
520
|
+
const byPayload = bindByAgent(payloadAgent);
|
|
521
|
+
if (byPayload) return byPayload;
|
|
522
|
+
if (Array.isArray(status.waveSteps) && status.waveSteps.length > 0) {
|
|
523
|
+
const outcomes = status.parallelOutcomes || {};
|
|
524
|
+
const unrecorded = status.waveSteps.flatMap((index) => getStepAgents(steps[index])).filter((agent) => !outcomes[agent]);
|
|
525
|
+
if (unrecorded.length === 1) { const bySole = bindByAgent(unrecorded[0]); if (bySole) return bySole; }
|
|
526
|
+
}
|
|
527
|
+
const byCurrent = bindByAgent(status.currentAgent);
|
|
528
|
+
if (byCurrent) return byCurrent;
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
function repairHandoffMessage() {
|
|
532
|
+
const listing = Object.entries(status.activeAttempts || {}).map(([attemptId, entry]) => `${entry.agent}=${attemptId}`).join('; ');
|
|
533
|
+
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.`;
|
|
534
|
+
}
|
|
535
|
+
|
|
330
536
|
const AGENT_HANDOFF = {
|
|
331
537
|
'task-analyst': (s) =>
|
|
332
538
|
`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,20 +965,38 @@ 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
|
-
const blockedProducer =
|
|
985
|
+
const blockedProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'blocked');
|
|
720
986
|
if (blockedProducer) {
|
|
987
|
+
if (isGraphMode()) {
|
|
988
|
+
const blockedStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(blockedProducer));
|
|
989
|
+
status.blockedSteps = [...new Set([...(status.blockedSteps || []), blockedStepIndex])];
|
|
990
|
+
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: blockedProducer, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
991
|
+
if (!dispatchReadyWave(`Step ${blockedStepIndex} (${blockedProducer}) is blocked; proceeding with independent ready steps.`)) out(blockedNotice(blockedStepIndex, blockedProducer));
|
|
992
|
+
process.exit(0);
|
|
993
|
+
}
|
|
721
994
|
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'blocked', phase: 'blocked', currentAgent: blockedProducer });
|
|
722
995
|
process.stdout.write('{}');
|
|
723
996
|
process.exit(0);
|
|
724
997
|
}
|
|
725
998
|
|
|
726
|
-
const retryReviewer =
|
|
999
|
+
const retryReviewer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'changes_requested');
|
|
727
1000
|
if (retryReviewer === 'mockup-reviewer') {
|
|
728
1001
|
beginHumanGate();
|
|
729
1002
|
writeStatus({
|
|
@@ -732,11 +1005,34 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
732
1005
|
currentAgent: 'mockup-reviewer',
|
|
733
1006
|
parallelCompleted: [],
|
|
734
1007
|
parallelOutcomes: {},
|
|
1008
|
+
waveSteps: [],
|
|
1009
|
+
waveId: null,
|
|
735
1010
|
});
|
|
736
1011
|
out(`Mockup review FAIL for slug "${slug}". Read mockup-review.md. Resume only via /task-continue. Do not retry feature-developer.`);
|
|
737
1012
|
process.exit(0);
|
|
738
1013
|
}
|
|
739
1014
|
if (retryReviewer) {
|
|
1015
|
+
if (isGraphMode()) {
|
|
1016
|
+
const reviewerStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(retryReviewer));
|
|
1017
|
+
const producerIndex = resolveProducerStepIndex('feature-developer', reviewerStepIndex);
|
|
1018
|
+
if (producerIndex < 0) {
|
|
1019
|
+
beginHumanGate();
|
|
1020
|
+
writeStatus({ awaitingHumanGate: true, state: 'awaiting_approval', currentAgent: retryReviewer, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1021
|
+
out(`${retryReviewer} requested changes for slug "${slug}" but no graph ancestor authors fixes. Read the review artifact. Resume only via /task-continue.`);
|
|
1022
|
+
process.exit(0);
|
|
1023
|
+
}
|
|
1024
|
+
const graphPredecessor = outcomes[retryReviewer]
|
|
1025
|
+
? { attemptId: outcomes[retryReviewer].attemptId, confidence: outcomes[retryReviewer].confidence }
|
|
1026
|
+
: finishedAttempt;
|
|
1027
|
+
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' });
|
|
1028
|
+
invalidateFrom(producerIndex, reviewerStepIndex);
|
|
1029
|
+
const siblingOutcomes = { ...(status.parallelOutcomes || {}) };
|
|
1030
|
+
delete siblingOutcomes[retryReviewer];
|
|
1031
|
+
status.parallelOutcomes = siblingOutcomes;
|
|
1032
|
+
writeStatus({ state: 'in_progress', phase: 'executing', waveSteps: [], waveId: null, retryAfterFix: null, retryAfterFixStepIndex: null });
|
|
1033
|
+
if (!dispatchReadyWave(`Step ${reviewerStepIndex} (${retryReviewer}) requested changes; re-dispatching unsatisfied steps.`)) out(noProgressNotice());
|
|
1034
|
+
process.exit(0);
|
|
1035
|
+
}
|
|
740
1036
|
const retryAfterFixStepIndex = idx;
|
|
741
1037
|
const predecessor = outcomes[retryReviewer]
|
|
742
1038
|
? {
|
|
@@ -770,10 +1066,51 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
770
1066
|
out(handoffForAgent('feature-developer', steps[developerIndex]?.scope, steps[developerIndex]) + ` After fixes, re-run ${retryReviewer}.`);
|
|
771
1067
|
process.exit(0);
|
|
772
1068
|
}
|
|
1069
|
+
if (isGraphMode()) {
|
|
1070
|
+
const validationProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'validation_failed');
|
|
1071
|
+
if (validationProducer) {
|
|
1072
|
+
const verifierStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(validationProducer));
|
|
1073
|
+
const producerIndex = resolveProducerStepIndex('feature-developer', verifierStepIndex);
|
|
1074
|
+
if (producerIndex >= 0) {
|
|
1075
|
+
appendMetric({ type: 'retry_scheduled', at: now, attemptId: outcomes[validationProducer]?.attemptId || null, nextAgent: 'feature-developer', retryAfterFix: validationProducer, source: 'hook', attributionConfidence: 'fallback' });
|
|
1076
|
+
invalidateFrom(producerIndex, verifierStepIndex);
|
|
1077
|
+
writeStatus({ state: 'in_progress', phase: 'executing', parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1078
|
+
if (dispatchReadyWave(`Step ${verifierStepIndex} (${validationProducer}) failed validation; re-dispatching unsatisfied steps.`)) process.exit(0);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
const gatedStep = waveIndexes.find((i) => hasGateAfterStep(steps[i], pipeline.humanGates));
|
|
1082
|
+
if (gatedStep !== undefined) {
|
|
1083
|
+
beginHumanGate();
|
|
1084
|
+
writeStatus({ awaitingHumanGate: true, state: 'awaiting_approval', currentAgent: completedAgent, pipelineIndex: gatedStep, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1085
|
+
process.stdout.write('{}');
|
|
1086
|
+
process.exit(0);
|
|
1087
|
+
}
|
|
1088
|
+
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null, state: 'completed' });
|
|
1089
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
1090
|
+
if (Object.keys(status.activeAttempts || {}).length > 0) {
|
|
1091
|
+
process.stdout.write('{}');
|
|
1092
|
+
process.exit(0);
|
|
1093
|
+
}
|
|
1094
|
+
if (pendingStepIndexes().length === 0) {
|
|
1095
|
+
completeTaskMetrics();
|
|
1096
|
+
writeStatus({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1097
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1098
|
+
process.exit(0);
|
|
1099
|
+
}
|
|
1100
|
+
out(noProgressNotice());
|
|
1101
|
+
process.exit(0);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
773
1104
|
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'completed' });
|
|
774
1105
|
}
|
|
775
1106
|
|
|
776
1107
|
if (status.state === 'blocked') {
|
|
1108
|
+
if (isGraphMode()) {
|
|
1109
|
+
status.blockedSteps = [...new Set([...(status.blockedSteps || []), idx])];
|
|
1110
|
+
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent, waveSteps: [], waveId: null, parallelCompleted: [], parallelOutcomes: {} });
|
|
1111
|
+
if (!dispatchReadyWave(`Step ${idx} (${completedAgent}) is blocked; proceeding with independent ready steps.`)) out(blockedNotice(idx, completedAgent));
|
|
1112
|
+
process.exit(0);
|
|
1113
|
+
}
|
|
777
1114
|
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent });
|
|
778
1115
|
process.stdout.write('{}');
|
|
779
1116
|
process.exit(0);
|
|
@@ -866,6 +1203,22 @@ if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
|
|
|
866
1203
|
process.exit(0);
|
|
867
1204
|
}
|
|
868
1205
|
|
|
1206
|
+
if (isGraphMode()) {
|
|
1207
|
+
if (Object.keys(status.activeAttempts || {}).length > 0) {
|
|
1208
|
+
process.stdout.write('{}');
|
|
1209
|
+
process.exit(0);
|
|
1210
|
+
}
|
|
1211
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
1212
|
+
if (pendingStepIndexes().length === 0) {
|
|
1213
|
+
completeTaskMetrics();
|
|
1214
|
+
writeStatus({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1215
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1216
|
+
process.exit(0);
|
|
1217
|
+
}
|
|
1218
|
+
out(noProgressNotice());
|
|
1219
|
+
process.exit(0);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
869
1222
|
const next = findNextExecutableStep(steps, idx + 1, taskDir);
|
|
870
1223
|
if (!next) {
|
|
871
1224
|
completeTaskMetrics();
|
|
@@ -13,7 +13,7 @@ When the user message looks like a **work request** (implement, add, fix, refact
|
|
|
13
13
|
2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
|
|
14
14
|
3. Pure questions (“how does X work”, “explain”) — prefer agent **`codebase-analyzer`** (explain-as-is); trivial one-liners may be answered inline. Do not open `/task`.
|
|
15
15
|
4. A work request now runs the planning workflow — **goal frame → requirements → information-sufficiency → decompose** (dependency graph / epics); see **task-framing** and **plan-graph**.
|
|
16
|
-
5. Every **work request** — with or without `/task`, and even when the user says “no pipeline” / “just do it” — persists the **verbatim** original prompt at `.ai.local/team/tasks/<slug>/prompt.md`. Prefer `/task` (its **Slug** step writes it). If handling inline without `/task`, first create the slug dir and write `prompt.md` (write-if-absent), then proceed. Pure questions and trivial one-liners are not work requests → no file.
|
|
16
|
+
5. Every **work request** — with or without `/task`, and even when the user says “no pipeline” / “just do it” — persists the **verbatim** original prompt at `.ai.local/team/tasks/<slug>/prompt.md`. Prefer `/task` (its **Slug** step writes it). If handling inline without `/task`, first create the slug dir and write `prompt.md` (write-if-absent), then proceed. Pure questions and trivial one-liners are not work requests → no file. On an inline follow-up for an existing slug (no `/task`) where the user authors new text, append it verbatim to `.ai.local/team/tasks/<slug>/prompt-log.md` (`seq` = max + 1; create on first append; exclude machine-generated and empty/argument-less invocations).
|
|
17
17
|
6. **Resolve the dialogue language before you speak to the user.** Read the `## Language` section of `.ai.local/conventions.md` (nearest `.ai.local` first); else infer from the prompt language; else English (mixed → dominant). Persist it once in the `prompt.md` header (`language: <BCP-47>`) + a `.memlog.md` `event:` line, and reuse it for the whole task. Development, reasoning, and artifacts stay English. The setting wins over a mid-task prompt switch (surface it once, never ask). See **language-policy**.
|
|
18
18
|
|
|
19
19
|
Exceptions: user explicitly says “no pipeline”, “just do it”, or continues an active slug.
|