@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
|
@@ -41,7 +41,7 @@ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":tr
|
|
|
41
41
|
|
|
42
42
|
## Checkpoint & resume
|
|
43
43
|
|
|
44
|
-
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).
|
|
44
|
+
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).
|
|
45
45
|
|
|
46
46
|
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**.
|
|
47
47
|
|
|
@@ -27,7 +27,7 @@ Examples:
|
|
|
27
27
|
|
|
28
28
|
## Procedure
|
|
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) — 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) — 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**.
|
|
@@ -57,6 +57,9 @@ const statusPath = path.join(taskDir, 'status.json');
|
|
|
57
57
|
const pipelinePath = path.join(taskDir, 'pipeline.json');
|
|
58
58
|
const METRICS_PATH = path.join(taskDir, 'metrics.json');
|
|
59
59
|
const METRICS_LOCK = `${METRICS_PATH}.lock`;
|
|
60
|
+
// Pipeline step graph is assigned once pipeline.json is parsed; declared early so the
|
|
61
|
+
// gate-resume branch can schedule from the graph before the main parse point.
|
|
62
|
+
let steps = [];
|
|
60
63
|
|
|
61
64
|
if (!fs.existsSync(statusPath)) {
|
|
62
65
|
process.stdout.write('{}');
|
|
@@ -161,15 +164,16 @@ function artifactOutputIdFor(step, agent) {
|
|
|
161
164
|
if (step?.artifactOutputIds && typeof step.artifactOutputIds[agent] === 'string') return step.artifactOutputIds[agent];
|
|
162
165
|
return DEFAULT_ARTIFACT_OUTPUT_IDS[agent] || agent;
|
|
163
166
|
}
|
|
164
|
-
function activateAttempts(step, stepIndex) {
|
|
165
|
-
const active = { ...(status.activeAttempts || {}) };
|
|
166
|
-
const
|
|
167
|
+
function activateAttempts(step, stepIndex, waveId = null, agentsOverride = null) {
|
|
168
|
+
const active = { ...(status.activeAttempts || {}) };
|
|
169
|
+
const agents = Array.isArray(agentsOverride) && agentsOverride.length > 0 ? agentsOverride : getStepAgents(step);
|
|
170
|
+
const parallelGroupId = step.parallel && getStepAgents(step).length > 1 ? `${status.metricsRunId || slug}:step-${stepIndex}` : null;
|
|
167
171
|
for (const agent of agents) {
|
|
168
172
|
const attempt = nextAttemptOrdinal(stepIndex, agent); const runId = status.metricsRunId || `${slug}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
169
173
|
status.metricsRunId = runId; const attemptId = `${runId}:step-${stepIndex}:${agent}:attempt-${attempt}`;
|
|
170
174
|
if (active[attemptId]) continue;
|
|
171
|
-
active[attemptId] = { agent, stepIndex, attempt, startedAt: now, parallelGroupId };
|
|
172
|
-
appendMetric({ type: 'attempt_started', at: now, attemptId, stepIndex, stepLabel: step.label || null, agent, role: roleFor(agent), attempt, parallelGroupId, source: 'hook', attributionConfidence: 'high' });
|
|
175
|
+
active[attemptId] = { agent, stepIndex, attempt, startedAt: now, parallelGroupId, waveId: waveId || null };
|
|
176
|
+
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' });
|
|
173
177
|
}
|
|
174
178
|
status.activeAttempts = active;
|
|
175
179
|
}
|
|
@@ -232,8 +236,8 @@ function reconcileStatusFromManifest(agent, step, resolved) {
|
|
|
232
236
|
return status.state;
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
function finishActiveAttempt() {
|
|
236
|
-
const resolved = resolvedAttempt(); if (!resolved) return null;
|
|
239
|
+
function finishActiveAttempt(forced) {
|
|
240
|
+
const resolved = forced || resolvedAttempt(); if (!resolved) return null;
|
|
237
241
|
const durationMs = Date.parse(now) - Date.parse(resolved.entry.startedAt);
|
|
238
242
|
const outcome = ['completed', 'blocked', 'changes_requested', 'validation_failed'].includes(status.state) ? status.state : 'unknown';
|
|
239
243
|
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 });
|
|
@@ -314,6 +318,208 @@ function findNextExecutableStep(steps, startIdx, dir) {
|
|
|
314
318
|
return null;
|
|
315
319
|
}
|
|
316
320
|
|
|
321
|
+
// --- Parallel scheduling & conflict model (mirrors _shared/core/agent-team/plan-graph.md) ---
|
|
322
|
+
function isGraphMode() { return steps.some((step) => step && Array.isArray(step.dependsOn)); }
|
|
323
|
+
function graphSlotKey(stepIndex, agent) { return `${stepIndex}:${agent}`; }
|
|
324
|
+
function readJoinedSlots() { return { ...(status.joinedSlots || {}) }; }
|
|
325
|
+
function isSlotSatisfied(stepIndex, agent) { return Boolean((status.joinedSlots || {})[graphSlotKey(stepIndex, agent)]); }
|
|
326
|
+
function resolveStepIndex(dep) {
|
|
327
|
+
for (let i = 0; i < steps.length; i += 1) if (steps[i] && steps[i].id === dep) return i;
|
|
328
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
329
|
+
const ids = Array.isArray(steps[i]?.taskIds) ? steps[i].taskIds : [];
|
|
330
|
+
if (ids.includes(dep)) return i;
|
|
331
|
+
}
|
|
332
|
+
return -1;
|
|
333
|
+
}
|
|
334
|
+
function isStepSkipped(stepIndex) {
|
|
335
|
+
if (Array.isArray(status.skippedSteps) && status.skippedSteps.includes(stepIndex)) return true;
|
|
336
|
+
return skipIfMatches(steps[stepIndex]?.skipIf, taskDir);
|
|
337
|
+
}
|
|
338
|
+
function isStepSatisfied(stepIndex) {
|
|
339
|
+
const step = steps[stepIndex];
|
|
340
|
+
if (!step) return false;
|
|
341
|
+
if (isStepSkipped(stepIndex)) return true;
|
|
342
|
+
return getStepAgents(step).every((agent) => isSlotSatisfied(stepIndex, agent));
|
|
343
|
+
}
|
|
344
|
+
function pendingStepIndexes() { return steps.map((_, index) => index).filter((index) => !isStepSatisfied(index)); }
|
|
345
|
+
function unsatisfiedAgents(stepIndex) {
|
|
346
|
+
const step = steps[stepIndex];
|
|
347
|
+
if (!step) return [];
|
|
348
|
+
return getStepAgents(step).filter((agent) => !isSlotSatisfied(stepIndex, agent));
|
|
349
|
+
}
|
|
350
|
+
function declaredScopes(step) {
|
|
351
|
+
return Array.isArray(step?.writeScopes) ? step.writeScopes.filter((scope) => typeof scope === 'string' && scope.length > 0) : [];
|
|
352
|
+
}
|
|
353
|
+
function normalizeScope(scope) { return String(scope).replace(/\/+$/, ''); }
|
|
354
|
+
function scopesOverlap(left, right) {
|
|
355
|
+
const a = normalizeScope(left); const b = normalizeScope(right);
|
|
356
|
+
return a === b || a.startsWith(`${b}/`) || b.startsWith(`${a}/`);
|
|
357
|
+
}
|
|
358
|
+
function stepsConflict(leftIndex, rightIndex) {
|
|
359
|
+
if (leftIndex === rightIndex) return true;
|
|
360
|
+
const leftStep = steps[leftIndex]; const rightStep = steps[rightIndex];
|
|
361
|
+
const leftAgents = getStepAgents(leftStep); const rightAgents = getStepAgents(rightStep);
|
|
362
|
+
if (leftAgents.some((agent) => rightAgents.includes(agent))) return true;
|
|
363
|
+
const leftOutputs = new Set(leftAgents.map((agent) => artifactOutputIdFor(leftStep, agent)));
|
|
364
|
+
if (rightAgents.some((agent) => leftOutputs.has(artifactOutputIdFor(rightStep, agent)))) return true;
|
|
365
|
+
// An undeclared scope is unknown, and an unknown unit conflicts with everything (safe default).
|
|
366
|
+
const leftScopes = declaredScopes(leftStep); const rightScopes = declaredScopes(rightStep);
|
|
367
|
+
if (leftScopes.length === 0 || rightScopes.length === 0) return true;
|
|
368
|
+
for (const a of leftScopes) for (const b of rightScopes) if (scopesOverlap(a, b)) return true;
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
function selectWave(candidates) {
|
|
372
|
+
const wave = []; const deferred = [];
|
|
373
|
+
for (const index of candidates) {
|
|
374
|
+
if (wave.every((chosen) => !stepsConflict(chosen, index))) wave.push(index);
|
|
375
|
+
else deferred.push(index);
|
|
376
|
+
}
|
|
377
|
+
return { wave, deferred };
|
|
378
|
+
}
|
|
379
|
+
function invalidateFrom(stepIndex, preserveStepIndex) {
|
|
380
|
+
const remove = new Set([stepIndex]);
|
|
381
|
+
let changed = true;
|
|
382
|
+
while (changed) {
|
|
383
|
+
changed = false;
|
|
384
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
385
|
+
if (remove.has(i)) continue;
|
|
386
|
+
const deps = Array.isArray(steps[i]?.dependsOn) ? steps[i].dependsOn : [];
|
|
387
|
+
if (deps.some((dep) => { const j = resolveStepIndex(dep); return j >= 0 && remove.has(j); })) { remove.add(i); changed = true; }
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// Preserve the requesting step's satisfied slots so a sibling is never re-invoked.
|
|
391
|
+
if (Number.isInteger(preserveStepIndex)) remove.delete(preserveStepIndex);
|
|
392
|
+
const slots = readJoinedSlots();
|
|
393
|
+
const removedAgents = new Set();
|
|
394
|
+
for (const key of Object.keys(slots)) {
|
|
395
|
+
const index = Number(key.split(':')[0]);
|
|
396
|
+
if (remove.has(index)) { removedAgents.add(slots[key].agent); delete slots[key]; }
|
|
397
|
+
}
|
|
398
|
+
status.joinedSlots = slots;
|
|
399
|
+
status.parallelCompleted = (status.parallelCompleted || []).filter((agent) => !removedAgents.has(agent));
|
|
400
|
+
return remove;
|
|
401
|
+
}
|
|
402
|
+
function computeReadySteps() {
|
|
403
|
+
if (!isGraphMode()) return [];
|
|
404
|
+
const inFlight = new Set(Object.values(status.activeAttempts || {}).map((entry) => entry.stepIndex));
|
|
405
|
+
const blocked = new Set(Array.isArray(status.blockedSteps) ? status.blockedSteps : []);
|
|
406
|
+
const skipped = new Set(Array.isArray(status.skippedSteps) ? status.skippedSteps : []);
|
|
407
|
+
const ready = [];
|
|
408
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
409
|
+
if (blocked.has(i) || inFlight.has(i)) continue;
|
|
410
|
+
if (skipIfMatches(steps[i].skipIf, taskDir)) {
|
|
411
|
+
if (!skipped.has(i)) { recordSkippedStep(steps[i], i); skipped.add(i); }
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
if (isStepSatisfied(i)) continue;
|
|
415
|
+
const deps = Array.isArray(steps[i].dependsOn) ? steps[i].dependsOn : [];
|
|
416
|
+
if (deps.every((dep) => { const j = resolveStepIndex(dep); return j >= 0 && isStepSatisfied(j); })) ready.push(i);
|
|
417
|
+
}
|
|
418
|
+
status.skippedSteps = [...skipped];
|
|
419
|
+
return ready;
|
|
420
|
+
}
|
|
421
|
+
function handoffForWave(units, waveId) {
|
|
422
|
+
const labels = units.map((unit) => `${steps[unit.stepIndex].id || `step-${unit.stepIndex}`}=${unit.agent}`);
|
|
423
|
+
const attemptIds = Object.entries(status.activeAttempts || {})
|
|
424
|
+
.filter(([, entry]) => units.some((unit) => unit.stepIndex === entry.stepIndex && unit.agent === entry.agent))
|
|
425
|
+
.map(([attemptId, entry]) => `${entry.agent}=${attemptId}`);
|
|
426
|
+
const outputIds = units.map((unit) => `${unit.agent}=${artifactOutputIdFor(steps[unit.stepIndex], unit.agent)}`);
|
|
427
|
+
const inputIds = [...new Set(units.flatMap((unit) => (Array.isArray(steps[unit.stepIndex].artifactInputIds) ? steps[unit.stepIndex].artifactInputIds : [])))];
|
|
428
|
+
return (
|
|
429
|
+
`Invoke IN PARALLEL (one message, multiple Task calls): ${labels.join(' AND ')} for slug "${slug}"${waveId ? ` (waveId=${waveId})` : ''}. ` +
|
|
430
|
+
`Each agent writes its artifact and owned receipt; the hook records slot joins from stops. Do not mutate status.json lifecycle fields. ` +
|
|
431
|
+
`Artifact inputs: ${inputIds.length > 0 ? inputIds.join(', ') : 'manifest defaults'}; owned output IDs: ${outputIds.join('; ')}. ` +
|
|
432
|
+
`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.`
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
function blockedNotice(blockedIndex, agent) {
|
|
436
|
+
const gated = [];
|
|
437
|
+
for (let i = 0; i < steps.length; i += 1) {
|
|
438
|
+
if (i === blockedIndex || isStepSatisfied(i)) continue;
|
|
439
|
+
const deps = Array.isArray(steps[i].dependsOn) ? steps[i].dependsOn : [];
|
|
440
|
+
if (deps.some((dep) => resolveStepIndex(dep) === blockedIndex)) gated.push(steps[i].id || `step-${i}`);
|
|
441
|
+
}
|
|
442
|
+
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}.`;
|
|
443
|
+
}
|
|
444
|
+
function noProgressNotice() {
|
|
445
|
+
const pending = pendingStepIndexes().map((index) => steps[index].id || `step-${index}`);
|
|
446
|
+
return `No schedulable step remains for slug "${slug}" (unsatisfied: ${pending.join(', ')}). Resume only via /task-continue ${slug}.`;
|
|
447
|
+
}
|
|
448
|
+
function dispatchReadyWave(prefixMessage) {
|
|
449
|
+
const ready = computeReadySteps();
|
|
450
|
+
if (ready.length === 0) return false;
|
|
451
|
+
const { wave, deferred } = selectWave(ready);
|
|
452
|
+
if (deferred.length > 0) {
|
|
453
|
+
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' });
|
|
454
|
+
}
|
|
455
|
+
// Slot-filtered dispatch: only unsatisfied (stepIndex, agent) slots are invoked.
|
|
456
|
+
const units = wave.flatMap((stepIndex) => unsatisfiedAgents(stepIndex).map((agent) => ({ stepIndex, agent })));
|
|
457
|
+
if (units.length === 0) return false;
|
|
458
|
+
const first = units[0].stepIndex;
|
|
459
|
+
const waveId = `${status.metricsRunId || slug}:wave-${first}`;
|
|
460
|
+
for (const unit of units) activateAttempts(steps[unit.stepIndex], unit.stepIndex, units.length > 1 ? waveId : null, [unit.agent]);
|
|
461
|
+
writeStatus({
|
|
462
|
+
pipelineIndex: first,
|
|
463
|
+
currentAgent: units[0].agent,
|
|
464
|
+
phase: 'executing',
|
|
465
|
+
state: 'in_progress',
|
|
466
|
+
awaitingHumanGate: false,
|
|
467
|
+
parallelCompleted: [],
|
|
468
|
+
parallelOutcomes: {},
|
|
469
|
+
waveSteps: wave,
|
|
470
|
+
waveId,
|
|
471
|
+
});
|
|
472
|
+
const stepIndexes = [...new Set(units.map((unit) => unit.stepIndex))];
|
|
473
|
+
appendMetric({ type: 'parallel_wave_started', at: now, waveId, stepIndexes, agents: units.map((unit) => unit.agent), source: 'hook', attributionConfidence: 'high' });
|
|
474
|
+
let message;
|
|
475
|
+
if (units.length === 1) message = handoffForAgent(units[0].agent, steps[first]?.scope, steps[first]);
|
|
476
|
+
else if (stepIndexes.length === 1 && steps[first].parallel && units.length === getStepAgents(steps[first]).length) message = handoffForParallelStep(steps[first]);
|
|
477
|
+
else message = handoffForWave(units, waveId);
|
|
478
|
+
out(prefixMessage ? `${prefixMessage} ${message}` : message);
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
function resolveProducerStepIndex(agent, fromIndex) {
|
|
482
|
+
const seen = new Set([fromIndex]);
|
|
483
|
+
const stack = [fromIndex];
|
|
484
|
+
let best = -1;
|
|
485
|
+
while (stack.length > 0) {
|
|
486
|
+
const node = stack.pop();
|
|
487
|
+
const deps = Array.isArray(steps[node]?.dependsOn) ? steps[node].dependsOn : [];
|
|
488
|
+
for (const dep of deps) {
|
|
489
|
+
const j = resolveStepIndex(dep);
|
|
490
|
+
if (j < 0 || seen.has(j)) continue;
|
|
491
|
+
seen.add(j);
|
|
492
|
+
if (getStepAgents(steps[j]).includes(agent)) best = Math.max(best, j);
|
|
493
|
+
stack.push(j);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return best >= 0 ? best : -1;
|
|
497
|
+
}
|
|
498
|
+
function repairUnattributableStop() {
|
|
499
|
+
const entries = Object.entries(status.activeAttempts || {});
|
|
500
|
+
if (entries.length === 0) return null;
|
|
501
|
+
const bindByAgent = (agent) => {
|
|
502
|
+
if (!agent) return null;
|
|
503
|
+
const matches = entries.filter(([, entry]) => entry.agent === agent);
|
|
504
|
+
return matches.length === 1 ? { attemptId: matches[0][0], entry: matches[0][1], confidence: 'fallback', repaired: true } : null;
|
|
505
|
+
};
|
|
506
|
+
const payloadAgent = typeof hookInput.agentType === 'string' ? hookInput.agentType : (typeof hookInput.agent_type === 'string' ? hookInput.agent_type : null);
|
|
507
|
+
const byPayload = bindByAgent(payloadAgent);
|
|
508
|
+
if (byPayload) return byPayload;
|
|
509
|
+
if (Array.isArray(status.waveSteps) && status.waveSteps.length > 0) {
|
|
510
|
+
const outcomes = status.parallelOutcomes || {};
|
|
511
|
+
const unrecorded = status.waveSteps.flatMap((index) => getStepAgents(steps[index])).filter((agent) => !outcomes[agent]);
|
|
512
|
+
if (unrecorded.length === 1) { const bySole = bindByAgent(unrecorded[0]); if (bySole) return bySole; }
|
|
513
|
+
}
|
|
514
|
+
const byCurrent = bindByAgent(status.currentAgent);
|
|
515
|
+
if (byCurrent) return byCurrent;
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
function repairHandoffMessage() {
|
|
519
|
+
const listing = Object.entries(status.activeAttempts || {}).map(([attemptId, entry]) => `${entry.agent}=${attemptId}`).join('; ');
|
|
520
|
+
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.`;
|
|
521
|
+
}
|
|
522
|
+
|
|
317
523
|
const AGENT_HANDOFF = {
|
|
318
524
|
'task-analyst': (s) =>
|
|
319
525
|
`Invoke task-analyst for slug "${s}". Write brief.md and decomposition.md under .ai.local/team/tasks/${s}/. ` +
|
|
@@ -483,6 +689,24 @@ if (hookInput.action === 'end_human_gate') {
|
|
|
483
689
|
try { resumePipeline = JSON.parse(fs.readFileSync(pipelinePath, 'utf8')); } catch {}
|
|
484
690
|
if (resumePipeline) {
|
|
485
691
|
const resumeSteps = resumePipeline.steps || [];
|
|
692
|
+
if (resumeSteps.some((step) => step && Array.isArray(step.dependsOn))) {
|
|
693
|
+
steps = resumeSteps;
|
|
694
|
+
status.blockedSteps = [];
|
|
695
|
+
status.parallelCompleted = [];
|
|
696
|
+
status.parallelOutcomes = {};
|
|
697
|
+
status.waveSteps = [];
|
|
698
|
+
status.waveId = null;
|
|
699
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
700
|
+
if (pendingStepIndexes().length === 0) {
|
|
701
|
+
status.state = 'completed';
|
|
702
|
+
completeTaskMetrics();
|
|
703
|
+
writeStatus({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
704
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
705
|
+
process.exit(0);
|
|
706
|
+
}
|
|
707
|
+
out(noProgressNotice());
|
|
708
|
+
process.exit(0);
|
|
709
|
+
}
|
|
486
710
|
const resumeStart = (typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0) + 1;
|
|
487
711
|
const resumeNext = findNextExecutableStep(resumeSteps, resumeStart, taskDir);
|
|
488
712
|
if (resumeNext) {
|
|
@@ -581,7 +805,7 @@ if (pipelineParseError) {
|
|
|
581
805
|
legacyFlow();
|
|
582
806
|
}
|
|
583
807
|
|
|
584
|
-
|
|
808
|
+
steps = pipeline.steps || [];
|
|
585
809
|
const initialIdx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
|
|
586
810
|
const initialStep = steps[initialIdx];
|
|
587
811
|
const activeAttemptCountBeforeFinish = Object.keys(status.activeAttempts || {}).length;
|
|
@@ -598,10 +822,23 @@ if (status.state === 'awaiting_artifact_receipt') {
|
|
|
598
822
|
process.stdout.write('{}');
|
|
599
823
|
process.exit(0);
|
|
600
824
|
}
|
|
601
|
-
|
|
602
|
-
if (!finishedAttempt &&
|
|
603
|
-
|
|
604
|
-
|
|
825
|
+
let finishedAttempt = finishActiveAttempt();
|
|
826
|
+
if (!finishedAttempt && activeAttemptCountBeforeFinish > 0) {
|
|
827
|
+
if (!hookInput.attemptId) {
|
|
828
|
+
const repaired = repairUnattributableStop();
|
|
829
|
+
if (repaired) {
|
|
830
|
+
appendMetric({ type: 'parallel_attribution_repair', at: now, attemptIds: [repaired.attemptId], source: 'hook', attributionConfidence: 'fallback' });
|
|
831
|
+
reconcileStatusFromManifest(repaired.entry.agent, steps[repaired.entry.stepIndex], repaired);
|
|
832
|
+
finishedAttempt = finishActiveAttempt(repaired);
|
|
833
|
+
} else {
|
|
834
|
+
writeStatus({});
|
|
835
|
+
out(repairHandoffMessage());
|
|
836
|
+
process.exit(0);
|
|
837
|
+
}
|
|
838
|
+
} else {
|
|
839
|
+
process.stdout.write('{}');
|
|
840
|
+
process.exit(0);
|
|
841
|
+
}
|
|
605
842
|
}
|
|
606
843
|
endHumanGateIfResumed();
|
|
607
844
|
if (steps.length === 0 || pipeline.autoChain === false) {
|
|
@@ -637,9 +874,27 @@ function scheduleRetry(agent, retryAfterFix, predecessor, explicitStepIndex = nu
|
|
|
637
874
|
const idx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
|
|
638
875
|
const currentStep = steps[idx];
|
|
639
876
|
const completedAgent = finishedAttempt?.entry?.agent || status.currentAgent || getStepAgents(currentStep)[0];
|
|
877
|
+
const completedStepIndex = Number.isInteger(finishedAttempt?.entry?.stepIndex) ? finishedAttempt.entry.stepIndex : idx;
|
|
640
878
|
const stepAgents = getStepAgents(currentStep);
|
|
641
|
-
|
|
879
|
+
const activeWave = isGraphMode() && Array.isArray(status.waveSteps) && status.waveSteps.filter((i) => Number.isInteger(i) && steps[i]).length > 0
|
|
880
|
+
? status.waveSteps.filter((i) => Number.isInteger(i) && steps[i])
|
|
881
|
+
: null;
|
|
882
|
+
const waveIndexes = activeWave
|
|
883
|
+
? activeWave
|
|
884
|
+
: (currentStep?.parallel && stepAgents.length > 1
|
|
885
|
+
? [idx]
|
|
886
|
+
: (isGraphMode() && finishedAttempt ? [completedStepIndex] : null));
|
|
887
|
+
|
|
888
|
+
if (waveIndexes) {
|
|
889
|
+
const waveAgents = waveIndexes.flatMap((i) => getStepAgents(steps[i]));
|
|
642
890
|
const done = [...(status.parallelCompleted || [])];
|
|
891
|
+
if (isGraphMode()) {
|
|
892
|
+
for (const waveStep of waveIndexes) {
|
|
893
|
+
for (const waveAgent of getStepAgents(steps[waveStep])) {
|
|
894
|
+
if (isSlotSatisfied(waveStep, waveAgent) && !done.includes(waveAgent)) done.push(waveAgent);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
643
898
|
const outcomes = { ...(status.parallelOutcomes || {}) };
|
|
644
899
|
if (finishedAttempt && completedAgent) {
|
|
645
900
|
if (!done.includes(completedAgent)) done.push(completedAgent);
|
|
@@ -649,22 +904,61 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
649
904
|
confidence: finishedAttempt.confidence,
|
|
650
905
|
};
|
|
651
906
|
}
|
|
907
|
+
if (finishedAttempt && completedAgent && isGraphMode() && (finishedAttempt.outcome || status.state) === 'completed') {
|
|
908
|
+
const completedSlots = readJoinedSlots();
|
|
909
|
+
completedSlots[graphSlotKey(completedStepIndex, completedAgent)] = {
|
|
910
|
+
agent: completedAgent,
|
|
911
|
+
stepIndex: completedStepIndex,
|
|
912
|
+
attemptId: finishedAttempt.attemptId,
|
|
913
|
+
outcome: 'completed',
|
|
914
|
+
};
|
|
915
|
+
status.joinedSlots = completedSlots;
|
|
916
|
+
appendMetric({ type: 'step_joined', at: now, stepIndex: completedStepIndex, slotKeys: [graphSlotKey(completedStepIndex, completedAgent)], attemptIds: [finishedAttempt.attemptId], source: 'hook', attributionConfidence: 'high' });
|
|
917
|
+
}
|
|
652
918
|
writeStatus({ parallelCompleted: done, parallelOutcomes: outcomes });
|
|
653
|
-
const remaining =
|
|
919
|
+
const remaining = waveAgents.filter((agent) => !done.includes(agent));
|
|
654
920
|
if (remaining.length > 0) {
|
|
655
921
|
process.stdout.write('{}');
|
|
656
922
|
process.exit(0);
|
|
657
923
|
}
|
|
658
924
|
|
|
659
|
-
const blockedProducer =
|
|
925
|
+
const blockedProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'blocked');
|
|
660
926
|
if (blockedProducer) {
|
|
927
|
+
if (isGraphMode()) {
|
|
928
|
+
const blockedStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(blockedProducer));
|
|
929
|
+
status.blockedSteps = [...new Set([...(status.blockedSteps || []), blockedStepIndex])];
|
|
930
|
+
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: blockedProducer, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
931
|
+
if (!dispatchReadyWave(`Step ${blockedStepIndex} (${blockedProducer}) is blocked; proceeding with independent ready steps.`)) out(blockedNotice(blockedStepIndex, blockedProducer));
|
|
932
|
+
process.exit(0);
|
|
933
|
+
}
|
|
661
934
|
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'blocked', phase: 'blocked', currentAgent: blockedProducer });
|
|
662
935
|
process.stdout.write('{}');
|
|
663
936
|
process.exit(0);
|
|
664
937
|
}
|
|
665
938
|
|
|
666
|
-
const retryReviewer =
|
|
939
|
+
const retryReviewer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'changes_requested');
|
|
667
940
|
if (retryReviewer) {
|
|
941
|
+
if (isGraphMode()) {
|
|
942
|
+
const reviewerStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(retryReviewer));
|
|
943
|
+
const producerIndex = resolveProducerStepIndex('feature-developer', reviewerStepIndex);
|
|
944
|
+
if (producerIndex < 0) {
|
|
945
|
+
beginHumanGate();
|
|
946
|
+
writeStatus({ awaitingHumanGate: true, state: 'awaiting_approval', currentAgent: retryReviewer, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
947
|
+
out(`${retryReviewer} requested changes for slug "${slug}" but no graph ancestor authors fixes. Read the review artifact. Resume only via /task-continue.`);
|
|
948
|
+
process.exit(0);
|
|
949
|
+
}
|
|
950
|
+
const graphPredecessor = outcomes[retryReviewer]
|
|
951
|
+
? { attemptId: outcomes[retryReviewer].attemptId, confidence: outcomes[retryReviewer].confidence }
|
|
952
|
+
: finishedAttempt;
|
|
953
|
+
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' });
|
|
954
|
+
invalidateFrom(producerIndex, reviewerStepIndex);
|
|
955
|
+
const siblingOutcomes = { ...(status.parallelOutcomes || {}) };
|
|
956
|
+
delete siblingOutcomes[retryReviewer];
|
|
957
|
+
status.parallelOutcomes = siblingOutcomes;
|
|
958
|
+
writeStatus({ state: 'in_progress', phase: 'executing', waveSteps: [], waveId: null, retryAfterFix: null, retryAfterFixStepIndex: null });
|
|
959
|
+
if (!dispatchReadyWave(`Step ${reviewerStepIndex} (${retryReviewer}) requested changes; re-dispatching unsatisfied steps.`)) out(noProgressNotice());
|
|
960
|
+
process.exit(0);
|
|
961
|
+
}
|
|
668
962
|
const retryAfterFixStepIndex = idx;
|
|
669
963
|
const predecessor = outcomes[retryReviewer]
|
|
670
964
|
? {
|
|
@@ -699,10 +993,51 @@ if (currentStep?.parallel && stepAgents.length > 1) {
|
|
|
699
993
|
process.exit(0);
|
|
700
994
|
}
|
|
701
995
|
|
|
996
|
+
if (isGraphMode()) {
|
|
997
|
+
const validationProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'validation_failed');
|
|
998
|
+
if (validationProducer) {
|
|
999
|
+
const verifierStepIndex = waveIndexes.find((i) => getStepAgents(steps[i]).includes(validationProducer));
|
|
1000
|
+
const producerIndex = resolveProducerStepIndex('feature-developer', verifierStepIndex);
|
|
1001
|
+
if (producerIndex >= 0) {
|
|
1002
|
+
appendMetric({ type: 'retry_scheduled', at: now, attemptId: outcomes[validationProducer]?.attemptId || null, nextAgent: 'feature-developer', retryAfterFix: validationProducer, source: 'hook', attributionConfidence: 'fallback' });
|
|
1003
|
+
invalidateFrom(producerIndex, verifierStepIndex);
|
|
1004
|
+
writeStatus({ state: 'in_progress', phase: 'executing', parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1005
|
+
if (dispatchReadyWave(`Step ${verifierStepIndex} (${validationProducer}) failed validation; re-dispatching unsatisfied steps.`)) process.exit(0);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
const gatedStep = waveIndexes.find((i) => hasGateAfterStep(steps[i], pipeline.humanGates));
|
|
1009
|
+
if (gatedStep !== undefined) {
|
|
1010
|
+
beginHumanGate();
|
|
1011
|
+
writeStatus({ awaitingHumanGate: true, state: 'awaiting_approval', currentAgent: completedAgent, pipelineIndex: gatedStep, parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null });
|
|
1012
|
+
process.stdout.write('{}');
|
|
1013
|
+
process.exit(0);
|
|
1014
|
+
}
|
|
1015
|
+
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, waveSteps: [], waveId: null, state: 'completed' });
|
|
1016
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
1017
|
+
if (Object.keys(status.activeAttempts || {}).length > 0) {
|
|
1018
|
+
process.stdout.write('{}');
|
|
1019
|
+
process.exit(0);
|
|
1020
|
+
}
|
|
1021
|
+
if (pendingStepIndexes().length === 0) {
|
|
1022
|
+
completeTaskMetrics();
|
|
1023
|
+
writeStatus({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1024
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1025
|
+
process.exit(0);
|
|
1026
|
+
}
|
|
1027
|
+
out(noProgressNotice());
|
|
1028
|
+
process.exit(0);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
702
1031
|
writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'completed' });
|
|
703
1032
|
}
|
|
704
1033
|
|
|
705
1034
|
if (status.state === 'blocked') {
|
|
1035
|
+
if (isGraphMode()) {
|
|
1036
|
+
status.blockedSteps = [...new Set([...(status.blockedSteps || []), idx])];
|
|
1037
|
+
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent, waveSteps: [], waveId: null, parallelCompleted: [], parallelOutcomes: {} });
|
|
1038
|
+
if (!dispatchReadyWave(`Step ${idx} (${completedAgent}) is blocked; proceeding with independent ready steps.`)) out(blockedNotice(idx, completedAgent));
|
|
1039
|
+
process.exit(0);
|
|
1040
|
+
}
|
|
706
1041
|
writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent });
|
|
707
1042
|
process.stdout.write('{}');
|
|
708
1043
|
process.exit(0);
|
|
@@ -784,6 +1119,22 @@ if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
|
|
|
784
1119
|
process.exit(0);
|
|
785
1120
|
}
|
|
786
1121
|
|
|
1122
|
+
if (isGraphMode()) {
|
|
1123
|
+
if (Object.keys(status.activeAttempts || {}).length > 0) {
|
|
1124
|
+
process.stdout.write('{}');
|
|
1125
|
+
process.exit(0);
|
|
1126
|
+
}
|
|
1127
|
+
if (dispatchReadyWave()) process.exit(0);
|
|
1128
|
+
if (pendingStepIndexes().length === 0) {
|
|
1129
|
+
completeTaskMetrics();
|
|
1130
|
+
writeStatus({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1131
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1132
|
+
process.exit(0);
|
|
1133
|
+
}
|
|
1134
|
+
out(noProgressNotice());
|
|
1135
|
+
process.exit(0);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
787
1138
|
const next = findNextExecutableStep(steps, idx + 1, taskDir);
|
|
788
1139
|
if (!next) {
|
|
789
1140
|
completeTaskMetrics();
|
|
@@ -8,7 +8,7 @@ When the user message looks like a **work request** (implement, add, fix, refact
|
|
|
8
8
|
2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
|
|
9
9
|
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`.
|
|
10
10
|
4. A work request now runs the planning workflow — **goal frame → requirements → information-sufficiency → decompose** (dependency graph / epics); see **task-framing** and **plan-graph**.
|
|
11
|
-
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.
|
|
11
|
+
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).
|
|
12
12
|
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**.
|
|
13
13
|
|
|
14
14
|
Exceptions: user explicitly says “no pipeline”, “just do it”, or continues an active slug.
|
|
@@ -101,7 +101,7 @@ Existing pipelines without `routingDecision` remain valid; routers emit it for n
|
|
|
101
101
|
|
|
102
102
|
For local metrics policy and the `metrics.json` ledger, see **agent-task-metrics**. The orchestration runtime records `task_started` and one `attempt_started` before each invocation; the hook records host-clock terminal and human-gate events. Keep active attempt identities in `status.json.activeAttempts` so parallel completions can be bound safely.
|
|
103
103
|
|
|
104
|
-
Do not calculate durations in agents. For parallel steps, never attribute a stop using `currentAgent` alone: use a stable runtime identity, the sole active attempt, or an explicit receipt marked with fallback confidence.
|
|
104
|
+
Do not calculate durations in agents. For parallel steps, never attribute a stop using `currentAgent` alone: use a stable runtime identity, the sole active attempt, or an explicit receipt marked with fallback confidence. An unattributable stop with in-flight attempts never returns bare `{}` — the hook repairs the binding (payload agent → sole unrecorded slot → `currentAgent`) with `attributionConfidence: "fallback"`, or emits a deterministic resume handoff. See **agent-task-metrics** § Parallel waves.
|
|
105
105
|
|
|
106
106
|
## Artifact context index and receipts
|
|
107
107
|
|
|
@@ -152,7 +152,14 @@ Each producing agent runs a **pre-receipt self-review** of its own output — go
|
|
|
152
152
|
| `activeAttempts` | Transient timing bridge keyed by `attemptId` |
|
|
153
153
|
| `lastCompletedAttempt` | Diagnostic pointer to the latest finished attempt |
|
|
154
154
|
| `parallelCompleted` | Agents that have stopped in the current parallel step |
|
|
155
|
-
| `parallelOutcomes` | Per-agent `{ outcome, attemptId, confidence }` for the current parallel join; cleared when the step advances
|
|
155
|
+
| `parallelOutcomes` | Per-agent `{ outcome, attemptId, confidence }` for the current parallel join; cleared when the step/wave advances, retained across a retry of the same step |
|
|
156
|
+
| `joinedSlots` | Persistent satisfaction ledger `"<stepIndex>:<agent>" → { agent, stepIndex, attemptId, outcome }`; the ready-queue history (graph mode) |
|
|
157
|
+
| `waveSteps` | Step indexes of the in-flight wave; cleared on wave completion |
|
|
158
|
+
| `waveId` | `<runId>:wave-<firstStepIndex>` for the in-flight wave |
|
|
159
|
+
| `graphMode` | Cached `steps.some(s => Array.isArray(s.dependsOn))` |
|
|
160
|
+
| `blockedSteps` | Steps that ended `blocked`, excluded from the ready set until a human-approved retry |
|
|
161
|
+
|
|
162
|
+
Additional states: `blocked` — a step (or a parallel producer) cannot proceed; in graph mode independent ready steps still dispatch, and a fully-gated run emits a deterministic notice (no stall).
|
|
156
163
|
|
|
157
164
|
| state | Meaning |
|
|
158
165
|
|-------|---------|
|
|
@@ -172,7 +179,11 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
172
179
|
|-------|-----|
|
|
173
180
|
| `skipIf` | `debugger.fixed` / `ci-investigator.resolved` — hook skips step when artifact says fix applied |
|
|
174
181
|
| `parallel: true` | `agent` is array — invoke **all** agents in one parent turn; each appends to `parallelCompleted` |
|
|
175
|
-
| `
|
|
182
|
+
| `id` | Stable step handle; the recommended value is the decomposition task ID when 1:1. Unique vs other ids and `taskIds`. |
|
|
183
|
+
| `dependsOn` | Step `id`s / `taskIds` that must be satisfied before dispatch. Optional; **any** occurrence switches the hook to graph mode. |
|
|
184
|
+
| `taskIds` | Decomposition task IDs the step realizes — the shared vocabulary with `decomposition.md` and a `dependsOn` alias. |
|
|
185
|
+
| `writeScopes` | Declared write surface for conflict analysis (see **plan-graph** § Conflict model). |
|
|
186
|
+
| `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
|
|
176
187
|
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
177
188
|
|
|
178
189
|
## Rules (strict)
|
|
@@ -186,12 +197,15 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
|
|
|
186
197
|
7. On `validation_failed` from `build-verifier`: hook sets `retryAfterFix: build-verifier` → developer → build-verifier.
|
|
187
198
|
8. When all steps complete, suggest `/technical-retro <slug>`.
|
|
188
199
|
9. If `autoChain: false` in pipeline, do not rely on hook — manual step only.
|
|
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). It is not a manifest `artifacts[]` body — register the path on the `routing` entry. See **agent-artifact-contracts** § Prompt artifact.
|
|
200
|
+
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). It is 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.
|
|
190
201
|
11. **Answer the user in the resolved dialogue language for the whole task.** Resolve once at task start (`.ai.local` `## Language` → prompt language → English) and pass it to every step; `/task-continue` keeps it. Never ask the user to pick a language. Development, reasoning, and artifacts stay English. See **language-policy**.
|
|
202
|
+
12. **Invoke the ready set, and never advance before reconciliation.** In graph mode the hook computes the ready queue; invoke exactly the handoff's agent list (a wave in one assistant turn, multiple Task calls) and do not start any next step from your own reasoning until the hook records the join and emits the next handoff. The wave is the join unit; `status.joinedSlots` is the satisfaction ledger.
|
|
203
|
+
13. **Only a proven conflict-free set is `parallel: true`.** Disjoint declared `writeScopes`, distinct agents, distinct `artifactOutputIds`, no shared lifecycle file; `mockup-reviewer` is never parallel (its FAIL gate is serial). See **plan-graph** § Conflict model.
|
|
191
204
|
|
|
192
205
|
## Team artifact I/O
|
|
193
206
|
|
|
194
207
|
- **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. It is not a manifest `artifacts[]` body — the path lives on the `routing` entry. See **agent-artifact-contracts** § Prompt artifact.
|
|
208
|
+
- **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.
|
|
195
209
|
- **Answer in the resolved dialogue language.** Resolve once at task start (`.ai.local` `## Language` → prompt language → English; mixed → dominant; nearest `.ai.local` wins) and reuse it for every user-facing message and `/task-continue`. Record the tag in the `prompt.md` header (`language: <BCP-47>`) + a `.memlog.md` `event:` line; a later correction is an append-only memlog event. Development, reasoning, and artifacts stay **English**. See **language-policy**.
|
|
196
210
|
- Create/update team task dirs with the **Write** tool (parents are created automatically). Do **not** bootstrap slug dirs with Shell `mkdir -p` — default sandbox returns `Operation not permitted` (worse on macOS Desktop/Documents with TCC).
|
|
197
211
|
- If Shell must touch team paths and fails with EPERM, retry with `required_permissions: ["all"]`. Prefer Write for artifacts.
|
|
@@ -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
|
|
|
@@ -77,6 +78,8 @@ Same JSON on Claude, Mavis, or OpenCode: `bash .<tool>/hooks/chain-team-phases.s
|
|
|
77
78
|
|
|
78
79
|
`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).
|
|
79
80
|
|
|
81
|
+
`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`.
|
|
82
|
+
|
|
80
83
|
**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.
|
|
81
84
|
|
|
82
85
|
**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.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"platform": "opencode",
|
|
4
4
|
"stack": "next",
|
|
5
5
|
"semanticSource": "cursor/next",
|
|
6
|
-
"sourceRevision": "
|
|
6
|
+
"sourceRevision": "8a3cc44760b08001eaa86b01a1c9f7892305c3ca7a2de377e189e05fd70a90cd",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
9
9
|
"source": "AGENTS.md",
|
|
@@ -1134,6 +1134,14 @@
|
|
|
1134
1134
|
"loadMode": "manual",
|
|
1135
1135
|
"reason": "File pipeline templates; runtime artifacts seed to .ai.local/team"
|
|
1136
1136
|
},
|
|
1137
|
+
{
|
|
1138
|
+
"source": "team/fixtures/feature-parallel.json",
|
|
1139
|
+
"target": "team/fixtures/feature-parallel.json",
|
|
1140
|
+
"category": "team",
|
|
1141
|
+
"disposition": "copy",
|
|
1142
|
+
"loadMode": "manual",
|
|
1143
|
+
"reason": "File pipeline templates; runtime artifacts seed to .ai.local/team"
|
|
1144
|
+
},
|
|
1137
1145
|
{
|
|
1138
1146
|
"source": "team/fixtures/feature-with-figma-url.json",
|
|
1139
1147
|
"target": "team/fixtures/feature-with-figma-url.json",
|
|
@@ -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
|
|