@mrciphersmith/keryx 0.2.9
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/LICENSE +21 -0
- package/README.md +351 -0
- package/dist/cli.js +48427 -0
- package/dist/proxy-worker.js +381 -0
- package/package.json +63 -0
- package/src/gdgraph/affected.test.ts +100 -0
- package/src/gdgraph/affected.ts +135 -0
- package/src/gdgraph/build-integrity.test.ts +193 -0
- package/src/gdgraph/build-lang.test.ts +399 -0
- package/src/gdgraph/build.test.ts +120 -0
- package/src/gdgraph/build.ts +804 -0
- package/src/gdgraph/config.test.ts +47 -0
- package/src/gdgraph/config.ts +113 -0
- package/src/gdgraph/core-sources.test.ts +99 -0
- package/src/gdgraph/core-sources.ts +20 -0
- package/src/gdgraph/enrich.ts +79 -0
- package/src/gdgraph/fallback.test.ts +153 -0
- package/src/gdgraph/find.test.ts +78 -0
- package/src/gdgraph/find.ts +107 -0
- package/src/gdgraph/pagerank.ts +129 -0
- package/src/gdgraph/path.test.ts +56 -0
- package/src/gdgraph/path.ts +112 -0
- package/src/gdgraph/query.ts +133 -0
- package/src/gdgraph/repomap.test.ts +110 -0
- package/src/gdgraph/repomap.ts +193 -0
- package/src/gdgraph/service.test.ts +59 -0
- package/src/gdgraph/service.ts +51 -0
- package/src/gdgraph/staleness.ts +20 -0
- package/src/gdgraph/symbol.test.ts +89 -0
- package/src/gdgraph/symbol.ts +123 -0
- package/src/gdgraph/symbols-capability.test.ts +41 -0
- package/src/gdgraph/symbols-capability.ts +49 -0
- package/src/gdgraph/target.ts +56 -0
- package/src/gdgraph/treesitter/adapter.test.ts +249 -0
- package/src/gdgraph/treesitter/adapter.ts +213 -0
- package/src/gdgraph/treesitter/extract.test.ts +278 -0
- package/src/gdgraph/treesitter/extract.ts +389 -0
- package/src/gdgraph/treesitter/grammars.ts +110 -0
- package/src/gdgraph/treesitter/no-treesitter-import.test.ts +51 -0
- package/src/gdgraph/treesitter/resolve-calls.test.ts +38 -0
- package/src/gdgraph/types.ts +63 -0
- package/src/gdskills/bundled/rules/core/api-contracts.mdc +148 -0
- package/src/gdskills/bundled/rules/core/async-patterns.mdc +185 -0
- package/src/gdskills/bundled/rules/core/clean-architecture.mdc +163 -0
- package/src/gdskills/bundled/rules/core/code-review-ai-assistant.mdc +49 -0
- package/src/gdskills/bundled/rules/core/code-review-b091-profile.mdc +48 -0
- package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +54 -0
- package/src/gdskills/bundled/rules/core/commit-message-formatting.mdc +25 -0
- package/src/gdskills/bundled/rules/core/database-patterns.mdc +162 -0
- package/src/gdskills/bundled/rules/core/documentation-management.mdc +106 -0
- package/src/gdskills/bundled/rules/core/error-handling.mdc +163 -0
- package/src/gdskills/bundled/rules/core/execution-metrics.md +99 -0
- package/src/gdskills/bundled/rules/core/frontend-assistant.mdc +40 -0
- package/src/gdskills/bundled/rules/core/git-rules.mdc +37 -0
- package/src/gdskills/bundled/rules/core/gproject-contracts.mdc +198 -0
- package/src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc +149 -0
- package/src/gdskills/bundled/rules/core/implementation-plans.mdc +58 -0
- package/src/gdskills/bundled/rules/core/jobs-documentation.mdc +221 -0
- package/src/gdskills/bundled/rules/core/mobx-store-template.mdc +561 -0
- package/src/gdskills/bundled/rules/core/model-selection.mdc +53 -0
- package/src/gdskills/bundled/rules/core/nestjs-dto.mdc +50 -0
- package/src/gdskills/bundled/rules/core/playwright-testing.mdc +321 -0
- package/src/gdskills/bundled/rules/core/requirements-management.mdc +35 -0
- package/src/gdskills/bundled/rules/core/requirements-package-standard.mdc +103 -0
- package/src/gdskills/bundled/rules/core/review-agent-profile.mdc +49 -0
- package/src/gdskills/bundled/rules/core/review-strict-profile.mdc +44 -0
- package/src/gdskills/bundled/rules/core/rule-management-workflow.mdc +62 -0
- package/src/gdskills/bundled/rules/core/security-baseline.mdc +155 -0
- package/src/gdskills/bundled/rules/core/shared-definitions.mdc +79 -0
- package/src/gdskills/bundled/rules/core/skill-lifecycle.mdc +55 -0
- package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +88 -0
- package/src/gdskills/bundled/rules/core/solid-principles.mdc +149 -0
- package/src/gdskills/bundled/rules/core/storybook-guidelines.mdc +36 -0
- package/src/gdskills/bundled/rules/core/subagent-context-construction.md +107 -0
- package/src/gdskills/bundled/rules/core/subagent-status-protocol.md +169 -0
- package/src/gdskills/bundled/rules/core/tdd-workflow.mdc +96 -0
- package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.codex.md +47 -0
- package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.cursor.md +55 -0
- package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.md +352 -0
- package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.opencode.md +39 -0
- package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.zed.md +29 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.codex.md +567 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.cursor.md +567 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.md +655 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.opencode.md +567 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.zed.md +567 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/input-contract.schema.json +134 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/orchestrator-prompt.md +183 -0
- package/src/gdskills/bundled/skills/orchestration/context-collector/output-contract.schema.json +208 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.codex.md +1412 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.cursor.md +1412 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.detail.md +735 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.md +468 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.opencode.md +1412 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.zed.md +1412 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/analysis-request.md +62 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/analysis-request.template.md +79 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/input-contract.schema.json +247 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/orchestrator-prompt.md +362 -0
- package/src/gdskills/bundled/skills/orchestration/feature-analyzer/output-contract.schema.json +87 -0
- package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.codex.md +105 -0
- package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.cursor.md +105 -0
- package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.md +165 -0
- package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/SKILL.md +379 -0
- package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/input-contract.schema.json +33 -0
- package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/output-contract.schema.json +41 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.codex.md +307 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.cursor.md +307 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.md +373 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.opencode.md +307 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.zed.md +307 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/input-contract.schema.json +130 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/issue-request.template.md +50 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/orchestrator-prompt.md +155 -0
- package/src/gdskills/bundled/skills/orchestration/issue-analyzer/output-contract.schema.json +61 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.codex.md +365 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.cursor.md +365 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.md +373 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.opencode.md +365 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.zed.md +365 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/input-contract.schema.json +55 -0
- package/src/gdskills/bundled/skills/orchestration/job-documenter/output-contract.schema.json +58 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.codex.md +1701 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.cursor.md +1701 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +1734 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.opencode.md +1701 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.zed.md +1701 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/input-contract.schema.json +188 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/orchestrator-prompt.md +179 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/output-contract.schema.json +103 -0
- package/src/gdskills/bundled/skills/orchestration/job-orchestrator/state.schema.json +164 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.codex.md +395 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.cursor.md +395 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +556 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.opencode.md +395 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.zed.md +395 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/input-contract.schema.json +204 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/orchestrator-prompt.md +206 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/output-contract.schema.json +51 -0
- package/src/gdskills/bundled/skills/orchestration/task-implementer/task-request.template.md +111 -0
- package/src/gdskills/bundled/skills/planning/autodoc-analyst/SKILL.md +163 -0
- package/src/gdskills/bundled/skills/planning/autodoc-architect/SKILL.md +161 -0
- package/src/gdskills/bundled/skills/planning/autodoc-assembler/SKILL.md +128 -0
- package/src/gdskills/bundled/skills/planning/autodoc-orchestrator/SKILL.md +321 -0
- package/src/gdskills/bundled/skills/planning/autodoc-scanner/SKILL.md +166 -0
- package/src/gdskills/bundled/skills/planning/autodoc-writer/SKILL.md +253 -0
- package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.claude.md +46 -0
- package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.codex.md +90 -0
- package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.cursor.md +90 -0
- package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.md +90 -0
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +33 -0
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +33 -0
- package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.md +190 -0
- package/src/gdskills/bundled/skills/planning/docpack-orchestrator/SKILL.md +142 -0
- package/src/gdskills/bundled/skills/planning/docpack-orchestrator/input-contract.schema.json +31 -0
- package/src/gdskills/bundled/skills/planning/docpack-orchestrator/output-contract.schema.json +31 -0
- package/src/gdskills/bundled/skills/planning/docpack-review/SKILL.md +80 -0
- package/src/gdskills/bundled/skills/planning/docpack-review/input-contract.schema.json +20 -0
- package/src/gdskills/bundled/skills/planning/docpack-review/output-contract.schema.json +36 -0
- package/src/gdskills/bundled/skills/planning/interview/SKILL.codex.md +181 -0
- package/src/gdskills/bundled/skills/planning/interview/SKILL.cursor.md +181 -0
- package/src/gdskills/bundled/skills/planning/interview/SKILL.md +187 -0
- package/src/gdskills/bundled/skills/planning/interviewer/SKILL.claude.md +94 -0
- package/src/gdskills/bundled/skills/planning/interviewer/SKILL.codex.md +99 -0
- package/src/gdskills/bundled/skills/planning/interviewer/SKILL.cursor.md +99 -0
- package/src/gdskills/bundled/skills/planning/interviewer/SKILL.md +105 -0
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +33 -0
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +33 -0
- package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.md +237 -0
- package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +33 -0
- package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +33 -0
- package/src/gdskills/bundled/skills/planning/planner/SKILL.md +190 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.codex.md +193 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.cursor.md +193 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.md +193 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.opencode.md +193 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.zed.md +193 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/input-contract.schema.json +63 -0
- package/src/gdskills/bundled/skills/planning/prd-creator/output-contract.schema.json +175 -0
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +31 -0
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +31 -0
- package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.md +153 -0
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +32 -0
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +32 -0
- package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.md +166 -0
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +44 -0
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +44 -0
- package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.md +243 -0
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +43 -0
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +43 -0
- package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.md +193 -0
- package/src/gdskills/bundled/skills/platform/agent-entrypoint-distiller/SKILL.md +47 -0
- package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.codex.md +87 -0
- package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.cursor.md +87 -0
- package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.md +87 -0
- package/src/gdskills/bundled/skills/platform/hookify/SKILL.codex.md +100 -0
- package/src/gdskills/bundled/skills/platform/hookify/SKILL.cursor.md +100 -0
- package/src/gdskills/bundled/skills/platform/hookify/SKILL.md +100 -0
- package/src/gdskills/bundled/skills/quality/changelog/SKILL.claude.md +45 -0
- package/src/gdskills/bundled/skills/quality/changelog/SKILL.codex.md +84 -0
- package/src/gdskills/bundled/skills/quality/changelog/SKILL.cursor.md +84 -0
- package/src/gdskills/bundled/skills/quality/changelog/SKILL.md +84 -0
- package/src/gdskills/bundled/skills/quality/commit/SKILL.codex.md +66 -0
- package/src/gdskills/bundled/skills/quality/commit/SKILL.cursor.md +66 -0
- package/src/gdskills/bundled/skills/quality/commit/SKILL.md +66 -0
- package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.claude.md +40 -0
- package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.codex.md +66 -0
- package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.cursor.md +66 -0
- package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.md +66 -0
- package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.claude.md +45 -0
- package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.codex.md +81 -0
- package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.cursor.md +81 -0
- package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.md +81 -0
- package/src/gdskills/bundled/skills/quality/deploy/SKILL.claude.md +42 -0
- package/src/gdskills/bundled/skills/quality/deploy/SKILL.codex.md +70 -0
- package/src/gdskills/bundled/skills/quality/deploy/SKILL.cursor.md +70 -0
- package/src/gdskills/bundled/skills/quality/deploy/SKILL.md +70 -0
- package/src/gdskills/bundled/skills/quality/metaproject-security/SKILL.md +103 -0
- package/src/gdskills/bundled/skills/quality/perf-check/SKILL.claude.md +48 -0
- package/src/gdskills/bundled/skills/quality/perf-check/SKILL.codex.md +83 -0
- package/src/gdskills/bundled/skills/quality/perf-check/SKILL.cursor.md +83 -0
- package/src/gdskills/bundled/skills/quality/perf-check/SKILL.md +83 -0
- package/src/gdskills/bundled/skills/quality/pr/SKILL.codex.md +75 -0
- package/src/gdskills/bundled/skills/quality/pr/SKILL.cursor.md +75 -0
- package/src/gdskills/bundled/skills/quality/pr/SKILL.md +75 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.codex.md +364 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.cursor.md +295 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.md +378 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.opencode.md +364 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.zed.md +38 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/input-contract.schema.json +53 -0
- package/src/gdskills/bundled/skills/quality/pr-issue-documenter/output-contract.schema.json +46 -0
- package/src/gdskills/bundled/skills/quality/push/SKILL.codex.md +52 -0
- package/src/gdskills/bundled/skills/quality/push/SKILL.cursor.md +52 -0
- package/src/gdskills/bundled/skills/quality/push/SKILL.md +52 -0
- package/src/gdskills/bundled/skills/quality/security-audit/SKILL.claude.md +40 -0
- package/src/gdskills/bundled/skills/quality/security-audit/SKILL.codex.md +61 -0
- package/src/gdskills/bundled/skills/quality/security-audit/SKILL.cursor.md +61 -0
- package/src/gdskills/bundled/skills/quality/security-audit/SKILL.md +61 -0
- package/src/gdskills/bundled/skills/quality/test-gen/SKILL.claude.md +30 -0
- package/src/gdskills/bundled/skills/quality/test-gen/SKILL.codex.md +75 -0
- package/src/gdskills/bundled/skills/quality/test-gen/SKILL.cursor.md +75 -0
- package/src/gdskills/bundled/skills/quality/test-gen/SKILL.md +75 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.codex.md +64 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.cursor.md +74 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.md +339 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.opencode.md +48 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.zed.md +44 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/input-contract.schema.json +121 -0
- package/src/gdskills/bundled/skills/quality/tests-creator/output-contract.schema.json +127 -0
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.codex.md +204 -0
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.cursor.md +204 -0
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.md +203 -0
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.opencode.md +204 -0
- package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.zed.md +204 -0
- package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.codex.md +209 -0
- package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.cursor.md +209 -0
- package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.md +208 -0
- package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.opencode.md +209 -0
- package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.zed.md +209 -0
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.codex.md +263 -0
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.cursor.md +263 -0
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.md +258 -0
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.opencode.md +263 -0
- package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.zed.md +263 -0
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.codex.md +175 -0
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.cursor.md +175 -0
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.md +168 -0
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.opencode.md +175 -0
- package/src/gdskills/bundled/skills/review/code-style-review/SKILL.zed.md +175 -0
- package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +360 -0
- package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +337 -0
- package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +477 -0
- package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +93 -0
- package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +119 -0
- package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +595 -0
- package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +144 -0
- package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +519 -0
- package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +323 -0
- package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +927 -0
- package/src/gdskills/bundled/skills/review/review-orchestrator/input-contract.schema.json +153 -0
- package/src/gdskills/bundled/skills/review/review-orchestrator/output-contract.schema.json +77 -0
- package/src/gdskills/bundled/skills/review/review-orchestrator/review-context.schema.json +389 -0
- package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-finding.schema.json +189 -0
- package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-input.schema.json +241 -0
- package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +344 -0
- package/src/gdskills/bundled/skills/review/review-pr-feedback/SKILL.md +327 -0
- package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +348 -0
- package/src/gdskills/bundled/skills/review/review-strict/SKILL.md +328 -0
- package/src/gdskills/bundled/skills/review/review-style/SKILL.md +343 -0
- package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +134 -0
- package/src/gdskills/bundled/skills/shared/git-merge-base.md +33 -0
- package/src/gdskills/contracts/agent-event.schema.json +32 -0
- package/src/gdskills/contracts/orchestrator-state.schema.json +58 -0
- package/src/gdskills/contracts/review-finding.schema.json +59 -0
- package/src/gdskills/contracts/subagent-dispatch.schema.json +123 -0
- package/src/gdskills/contracts/subagent-result.schema.json +136 -0
|
@@ -0,0 +1,1701 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: job-orchestrator
|
|
3
|
+
description: "Use when a GitHub issue or complex intent needs to be analyzed, planned, and implemented end-to-end with sub-agents."
|
|
4
|
+
triggers:
|
|
5
|
+
- "Implement issue"
|
|
6
|
+
- "Issue to PR"
|
|
7
|
+
- "Orchestrate"
|
|
8
|
+
- "Run pipeline"
|
|
9
|
+
- "Analyze and implement"
|
|
10
|
+
- "Full implementation"
|
|
11
|
+
- "Full review"
|
|
12
|
+
- "Полное ревью"
|
|
13
|
+
- "Review my code"
|
|
14
|
+
- "Analyze branch"
|
|
15
|
+
- "Review via orchestrator"
|
|
16
|
+
- "Orchestrated review"
|
|
17
|
+
- "Auto-implement"
|
|
18
|
+
- "Auto-implement issue"
|
|
19
|
+
- "Orchestrate issue"
|
|
20
|
+
- "Run issue pipeline"
|
|
21
|
+
- "Full issue implementation"
|
|
22
|
+
metadata:
|
|
23
|
+
author: "MrCipherSmith"
|
|
24
|
+
version: "3.2.0"
|
|
25
|
+
category: "orchestration"
|
|
26
|
+
license: "MIT"
|
|
27
|
+
compatibility: "cursor,codex,zed,opencode,claude"
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<SUBAGENT-STOP>
|
|
31
|
+
If you were dispatched as a subagent to execute a specific task, skip this skill entirely.
|
|
32
|
+
This skill is for orchestrators and interactive session-level routing only.
|
|
33
|
+
Proceed directly with your assigned task.
|
|
34
|
+
</SUBAGENT-STOP>
|
|
35
|
+
|
|
36
|
+
# Job Orchestrator
|
|
37
|
+
|
|
38
|
+
## Purpose
|
|
39
|
+
|
|
40
|
+
Dynamic orchestrator that builds execution plans based on user intent. Unlike a fixed pipeline, the orchestrator adapts its workflow to what the user actually needs — from "just analyze this issue" to "implement, review, and create a PR". It dispatches sub-agents (`issue-analyzer`, `context-collector`, `task-implementer`, review skills) and persists all work via `job-documenter`.
|
|
41
|
+
|
|
42
|
+
**Key design principle** (from Anthropic's "Building Effective Agents"):
|
|
43
|
+
> "The key difference from parallelization is its flexibility — subtasks aren't pre-defined, but determined by the orchestrator based on the specific input."
|
|
44
|
+
|
|
45
|
+
**Input:** User request (issue URL, analysis request, implementation request, etc.)
|
|
46
|
+
**Output:** Executed plan + persistent job documentation in `.metaproject/jobs/<job-name>/` + optional PR
|
|
47
|
+
|
|
48
|
+
## When to Use
|
|
49
|
+
|
|
50
|
+
- Implementing a complete GitHub issue from start to finish
|
|
51
|
+
- Analyzing an issue and proposing a solution before implementing
|
|
52
|
+
- Running any multi-step orchestrated workflow
|
|
53
|
+
- Running a comprehensive code review with persistent documentation
|
|
54
|
+
- When the AGENTS.md routing rule (Step 1.5) determines the user wants orchestrated execution and the user confirms
|
|
55
|
+
- User says "implement issue #N", "analyze issue #N", provides an issue URL, or asks for orchestrated work
|
|
56
|
+
- User says "full review", "полное ревью", or any request that implies orchestration
|
|
57
|
+
|
|
58
|
+
## Architecture: 4 Dynamic Phases
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Phase 0: CONTEXT COLLECTION → Gather info, determine intent
|
|
62
|
+
Phase 1: PLAN BUILDING → Build dynamic plan, init job docs
|
|
63
|
+
Phase 2: EXECUTION → Execute plan steps, document each result
|
|
64
|
+
Phase 3: COMPLETION → Final report, optional PR, tell user where docs are
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Phase 0: CONTEXT COLLECTION
|
|
70
|
+
|
|
71
|
+
### 0.0 State Resumption Check
|
|
72
|
+
|
|
73
|
+
Before asking any questions, check if an interrupted job exists:
|
|
74
|
+
1. Look in `$JOBS_ROOT` for any directory containing an incomplete `state.json`.
|
|
75
|
+
2. If found, ASK the user: "Found paused job '<job-name>'. Do you want to resume it or start a new orchestrated job?"
|
|
76
|
+
3. If resume → Parse `state.json`, restore `JOB_STATE`, and jump directly to the first uncompleted step in Phase 2.
|
|
77
|
+
4. If new → Proceed to 0.1.
|
|
78
|
+
|
|
79
|
+
### 0.1 Determine User Intent
|
|
80
|
+
|
|
81
|
+
Parse the user's request to identify the intent:
|
|
82
|
+
|
|
83
|
+
| User Says | Intent | Plan Type |
|
|
84
|
+
|-----------|--------|-----------|
|
|
85
|
+
| "Implement issue #N" / "Issue to PR" | `implement` | Full: analyze → branch → implement → review → fix → checks → PR |
|
|
86
|
+
| "Analyze issue #N" / "Study issue" | `analyze` | Analysis only: analyze → report. Then ask if user wants to implement. |
|
|
87
|
+
| "Review my code" / "Review branch" | `review` | Review only: review → report |
|
|
88
|
+
| "Analyze and implement" | `implement` | Same as implement |
|
|
89
|
+
| Custom request | `custom` | Run `interviewer` skill first, then build plan from output |
|
|
90
|
+
|
|
91
|
+
**Ambiguity detection:** If the request uses vague words ("improve", "fix", "refactor") with no issue number or specific file — trigger the **Interactive Approach Selection** below.
|
|
92
|
+
|
|
93
|
+
### 0.1.1 Interactive Approach Selection (for ambiguous requests)
|
|
94
|
+
|
|
95
|
+
When intent cannot be determined confidently, present options to the user:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
I see several ways to approach this. Which fits best?
|
|
99
|
+
|
|
100
|
+
A) 🔍 Analysis only — decompose into tasks, show plan, stop
|
|
101
|
+
B) 🛠 Full implementation — analyze → implement → review → PR
|
|
102
|
+
C) 📋 Analysis + brainstorm — explore approaches before committing
|
|
103
|
+
D) 🔧 Review only — review current branch changes
|
|
104
|
+
E) 📝 Custom — describe what you need, I'll build the plan
|
|
105
|
+
|
|
106
|
+
> pick a letter or describe your own approach
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Mapping:**
|
|
110
|
+
- A → `analyze` intent
|
|
111
|
+
- B → `implement` intent
|
|
112
|
+
- C → `analyze` intent + trigger `brainstorm` after analysis
|
|
113
|
+
- D → `review` intent
|
|
114
|
+
- E → `custom` intent → proceed to 0.1.5 (interviewer gate)
|
|
115
|
+
|
|
116
|
+
**Skip this step** when intent is clear (explicit issue number, "implement issue #N", "review my code").
|
|
117
|
+
|
|
118
|
+
### 0.1.5 Interviewer Gate (for `custom` and ambiguous requests)
|
|
119
|
+
|
|
120
|
+
For `custom` intent OR any ambiguous request, invoke the `interviewer` skill **before** collecting standard context. This replaces the generic "What do you need?" question with a structured critical interview.
|
|
121
|
+
|
|
122
|
+
**Invoke:**
|
|
123
|
+
```
|
|
124
|
+
Load skill: skills/interviewer/SKILL.md
|
|
125
|
+
|
|
126
|
+
INPUT:
|
|
127
|
+
topic: <user's original request>
|
|
128
|
+
goal: "job-orchestrator — build execution plan"
|
|
129
|
+
context:
|
|
130
|
+
codebase_summary: <git log --oneline -10 if available>
|
|
131
|
+
existing_analysis: <any issue content already known>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Map output:**
|
|
135
|
+
- `derived_context` → `INTENT_STATE.task_description`
|
|
136
|
+
- answers with `confidence: "certain"` → `INTENT_STATE.constraints`
|
|
137
|
+
- `blockers` → surface to user (if non-empty, do NOT proceed)
|
|
138
|
+
|
|
139
|
+
**Gate rule:**
|
|
140
|
+
- `ready_to_proceed: false` → STOP. Tell user what blockers remain.
|
|
141
|
+
- `ready_to_proceed: true` → continue to 0.2 with enriched context.
|
|
142
|
+
|
|
143
|
+
**Skip** for `implement`/`analyze` with an issue number — requirements are in the issue.
|
|
144
|
+
|
|
145
|
+
### 0.2 Collect Required Context
|
|
146
|
+
|
|
147
|
+
The orchestrator MUST collect all required context before proceeding:
|
|
148
|
+
|
|
149
|
+
**Always ask (mandatory):**
|
|
150
|
+
|
|
151
|
+
1. **What to do** — for `implement`/`analyze`: from issue. For `custom`: from interviewer output (0.1.5).
|
|
152
|
+
|
|
153
|
+
2. **Project directory** — NEVER assume. Always ask explicitly:
|
|
154
|
+
```
|
|
155
|
+
Which project directory should I use?
|
|
156
|
+
○ Type the full absolute path to your project
|
|
157
|
+
(No default — always ask, never assume.)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
3. **Base branch** — auto-detect from repo:
|
|
161
|
+
```bash
|
|
162
|
+
# Detect default branch
|
|
163
|
+
git -C <project_dir> symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
|
|
164
|
+
# Fallback: check for main, master, develop
|
|
165
|
+
```
|
|
166
|
+
Present detected branch and ask to confirm. No hardcoded default.
|
|
167
|
+
|
|
168
|
+
**Intent-specific questions:**
|
|
169
|
+
|
|
170
|
+
| Intent | Additional Questions |
|
|
171
|
+
|--------|---------------------|
|
|
172
|
+
| `implement` | Create PR? (default: yes). Skip if user already stated. |
|
|
173
|
+
| `analyze` | None — always produced. After: ask if user wants to implement. |
|
|
174
|
+
| `review` | Which branch to review? (default: current branch) |
|
|
175
|
+
| `custom` | None — covered by interviewer in 0.1.5 |
|
|
176
|
+
|
|
177
|
+
4. **Job name** — auto-generate based on context, ask user to confirm:
|
|
178
|
+
```
|
|
179
|
+
Job documentation folder:
|
|
180
|
+
○ issue-4141--pipeline-validation (auto-generated, Recommended)
|
|
181
|
+
○ Type your own name
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Naming patterns:**
|
|
185
|
+
- Issue implementation: `issue-<N>--<slug>`
|
|
186
|
+
- Issue analysis: `analysis--issue-<N>`
|
|
187
|
+
- Code review: `review--<slug>`
|
|
188
|
+
- Custom: `task--<slug>`
|
|
189
|
+
|
|
190
|
+
### 0.3 Interview for Implement Intent
|
|
191
|
+
|
|
192
|
+
For `implement` intent, dispatch `interview` skill after collecting context to clarify implementation-specific ambiguities (complements 0.1.5 which handles `custom` intent):
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Dispatch interview skill with:
|
|
196
|
+
{
|
|
197
|
+
"goal": <issue title>,
|
|
198
|
+
"context": <collected context + issue body>,
|
|
199
|
+
"domain": "implement",
|
|
200
|
+
"caller": "job-orchestrator",
|
|
201
|
+
"known_facts": [project_dir, base_branch, issue details],
|
|
202
|
+
"max_questions": null
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**When to run:** `implement` intent only (if `run_interview: true`, default).
|
|
207
|
+
**Skip for:** `analyze` (analysis reveals details), `review` (scoped by diff), `custom` (covered by 0.1.5).
|
|
208
|
+
|
|
209
|
+
**Output → Phase 1:** `INTERVIEW_RESULT` feeds into plan building — informs task decomposition and architecture.
|
|
210
|
+
|
|
211
|
+
**Brainstorm trigger:** If during interview the user answers "not sure" or the interview identifies an unresolved architectural question (high-impact decision with no clear answer), auto-trigger:
|
|
212
|
+
```
|
|
213
|
+
Dispatch brainstorm --quick with:
|
|
214
|
+
topic: <the specific architectural question>
|
|
215
|
+
context: <project stack + interview answers so far>
|
|
216
|
+
```
|
|
217
|
+
Present brainstorm result as enriched answer options, then continue interview.
|
|
218
|
+
|
|
219
|
+
**Skip if:** user says "just do it" / "skip questions", or `run_interview: false`.
|
|
220
|
+
|
|
221
|
+
### 0.3.1 Dependency Check
|
|
222
|
+
|
|
223
|
+
If the issue or interview reveals the task is primarily about updating dependencies:
|
|
224
|
+
```
|
|
225
|
+
IF issue title/body contains "update", "upgrade", "bump", "dependency", "CVE":
|
|
226
|
+
Suggest: "This looks like a dependency update task. Use /dependency-update instead?"
|
|
227
|
+
IF user confirms → delegate to dependency-update skill, skip orchestrator pipeline
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 0.4 Summarize and Confirm
|
|
231
|
+
|
|
232
|
+
Before proceeding, present a summary:
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
Ready to proceed:
|
|
236
|
+
Intent: implement
|
|
237
|
+
Issue: #4141 — Pipeline validation improvements
|
|
238
|
+
Project: /Users/.../<PROJECT>
|
|
239
|
+
Base: develop-2
|
|
240
|
+
Create PR: yes
|
|
241
|
+
Job name: issue-4141--pipeline-validation
|
|
242
|
+
|
|
243
|
+
Proceed? (yes / adjust)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Phase 1: PLAN BUILDING
|
|
249
|
+
|
|
250
|
+
### 1.1 Build Execution Plan
|
|
251
|
+
|
|
252
|
+
Based on intent, construct an ordered list of steps:
|
|
253
|
+
|
|
254
|
+
**For `implement` intent:**
|
|
255
|
+
```
|
|
256
|
+
PLAN:
|
|
257
|
+
1. { id: "analyze", type: "analyze", agent: "issue-analyzer", depends: [] }
|
|
258
|
+
2. { id: "context", type: "context", agent: "context-collector", depends: ["analyze"] }
|
|
259
|
+
3. { id: "prepare", type: "prepare", agent: "orchestrator", depends: ["context"] }
|
|
260
|
+
4. { id: "tests-creator", type: "tests", agent: "tests-creator", depends: ["prepare"] }
|
|
261
|
+
5. { id: "implement", type: "implement", agent: "task-implementer", depends: ["tests-creator"] }
|
|
262
|
+
6. { id: "sanity-check", type: "check", agent: "orchestrator", depends: ["implement"] }
|
|
263
|
+
7. { id: "verify", type: "verify", agent: "code-verifier", depends: ["sanity-check"] }
|
|
264
|
+
8. { id: "review", type: "review", agent: "code-review", depends: ["verify"] }
|
|
265
|
+
9. { id: "security", type: "security", agent: "security-audit", depends: ["implement"], conditional: true }
|
|
266
|
+
10. { id: "fix", type: "fix", agent: "task-implementer", depends: ["review"], conditional: true }
|
|
267
|
+
11. { id: "verify-post-fix", type: "verify", agent: "code-verifier", depends: ["fix"], conditional: true }
|
|
268
|
+
12. { id: "perf-check", type: "perf", agent: "perf-check", depends: ["verify"], conditional: true }
|
|
269
|
+
13. { id: "report", type: "report", agent: "orchestrator", depends: ["verify"] }
|
|
270
|
+
14. { id: "pr", type: "pr", agent: "orchestrator", depends: ["report"], conditional: true }
|
|
271
|
+
15. { id: "deploy", type: "deploy", agent: "deploy", depends: ["pr"], conditional: true }
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Conditional step triggers:**
|
|
275
|
+
- `sanity-check`: always runs — verifies ≥1 commit was made
|
|
276
|
+
- `tests-creator`: always runs — mandatory TDD step before every task-implementer wave
|
|
277
|
+
- `verify`: always runs — code-verifier is the mandatory quality gate after implementation
|
|
278
|
+
- `security`: diff touches auth/, api/, migrations, schema files, or `.env`
|
|
279
|
+
- `fix`: review or verify found CRITICAL/HIGH findings
|
|
280
|
+
- `verify-post-fix`: always runs after fix (confirms fix resolved the findings)
|
|
281
|
+
- `perf-check`: diff contains *.tsx, *.jsx, *.css, dist/, build/ files
|
|
282
|
+
- `security`: diff touches auth/, api/, migrations, schema files, or `.env`
|
|
283
|
+
- `fix`: review found CRITICAL/WARNING findings
|
|
284
|
+
- `perf-check`: diff contains *.tsx, *.jsx, *.css, dist/, build/ files
|
|
285
|
+
- `pr`: `create_pr: true`
|
|
286
|
+
- `deploy`: user answers "yes" to post-PR staging deploy prompt
|
|
287
|
+
|
|
288
|
+
Note: `security` runs in parallel with `review` (both depend on `implement` results, no overlap).
|
|
289
|
+
|
|
290
|
+
**For `analyze` intent:**
|
|
291
|
+
```
|
|
292
|
+
PLAN:
|
|
293
|
+
1. { id: "analyze", type: "analyze", agent: "issue-analyzer", depends: [] }
|
|
294
|
+
2. { id: "context", type: "context", agent: "context-collector", depends: ["analyze"] }
|
|
295
|
+
3. { id: "report", type: "report", agent: "orchestrator", depends: ["context"] }
|
|
296
|
+
4. { id: "proposal", type: "proposal", agent: "orchestrator", depends: ["report"] }
|
|
297
|
+
```
|
|
298
|
+
Step 4 (`proposal`) asks the user: "Want me to implement this? If yes, I'll extend the plan."
|
|
299
|
+
|
|
300
|
+
**For `review` intent:**
|
|
301
|
+
```
|
|
302
|
+
PLAN:
|
|
303
|
+
1. { id: "context", type: "context", agent: "context-collector", depends: [] }
|
|
304
|
+
2. { id: "review", type: "review", agent: "reviewers", depends: ["context"] }
|
|
305
|
+
3. { id: "report", type: "report", agent: "orchestrator", depends: ["review"] }
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**For `custom` intent:**
|
|
309
|
+
Build plan dynamically. Each step must have: id, type, agent, dependencies.
|
|
310
|
+
|
|
311
|
+
### 1.2 Initialize Job Documentation
|
|
312
|
+
|
|
313
|
+
Dispatch `job-documenter` with `init` action:
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
Task({
|
|
317
|
+
description: "Init job docs: <job-name>",
|
|
318
|
+
subagent_type: "general",
|
|
319
|
+
prompt: |
|
|
320
|
+
You are the job-documenter agent.
|
|
321
|
+
Load skill: skills/job-documenter/SKILL.md
|
|
322
|
+
Follow rules: rules/core/jobs-documentation.mdc
|
|
323
|
+
|
|
324
|
+
ACTION: init
|
|
325
|
+
JOB_NAME: <job-name>
|
|
326
|
+
JOBS_ROOT: <JOBS_ROOT>
|
|
327
|
+
|
|
328
|
+
DATA:
|
|
329
|
+
TITLE: <job title>
|
|
330
|
+
DESCRIPTION: <description>
|
|
331
|
+
INTENT: <intent>
|
|
332
|
+
SOURCE: <issue URL or description>
|
|
333
|
+
PROJECT: <project path>
|
|
334
|
+
BRANCH: TBD
|
|
335
|
+
BASE_BRANCH: <base branch>
|
|
336
|
+
PLAN: <plan steps>
|
|
337
|
+
|
|
338
|
+
Execute and return DOCUMENTER_RESULT.
|
|
339
|
+
})
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Validate response:** status must be `success`. If `error` → report to user, ask how to proceed.
|
|
343
|
+
|
|
344
|
+
### 1.3 Display Plan + Agent Approval
|
|
345
|
+
|
|
346
|
+
Show each step with its agent and status, then ask the user to approve or adjust:
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
Execution plan — <N> steps:
|
|
350
|
+
|
|
351
|
+
Step 1 analyze issue-analyzer → issue #<N>
|
|
352
|
+
Step 2 context context-collector → project context + test framework
|
|
353
|
+
Step 3 prepare orchestrator → feature branch
|
|
354
|
+
Step 4 tests-creator tests-creator × <tasks> → RED test stubs per task (MANDATORY)
|
|
355
|
+
Step 5 implement task-implementer × <tasks> → <N> tasks make tests GREEN (wave-parallel)
|
|
356
|
+
Step 6 sanity-check orchestrator → verify commits exist
|
|
357
|
+
Step 7 verify code-verifier → lint + type-check + tests + imports (MANDATORY)
|
|
358
|
+
Step 8 review code-review × 4 → parallel agents
|
|
359
|
+
Step 9 fix task-implementer → [conditional: CRITICAL/HIGH findings]
|
|
360
|
+
Step 10 verify-post-fix code-verifier → [conditional: after fix]
|
|
361
|
+
Step 11 report orchestrator → final summary
|
|
362
|
+
Step 12 pr orchestrator + gh CLI → [conditional: create_pr=true]
|
|
363
|
+
|
|
364
|
+
Optional (not in plan — add if needed):
|
|
365
|
+
+ security-audit auto-detect: auth/API/DB changes
|
|
366
|
+
+ perf-check auto-detect: if frontend/bundle files changed
|
|
367
|
+
+ deploy ask after PR: "Deploy to staging?"
|
|
368
|
+
|
|
369
|
+
Proceed? (yes / adjust: "skip fix", "add security-audit", "remove pr", etc.)
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**If user adjusts:**
|
|
373
|
+
- Parse natural language: "skip fix" → mark `fix` step as disabled
|
|
374
|
+
- "add security-audit" → insert `{ id: "security-audit", agent: "security-audit", depends: ["review"] }` after review
|
|
375
|
+
- "remove pr" → set `create_pr: false`
|
|
376
|
+
- Re-display updated plan and ask again
|
|
377
|
+
|
|
378
|
+
**If `plan_approval: false`** (automation setting) → skip this display and proceed directly.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Phase 2: EXECUTION
|
|
383
|
+
|
|
384
|
+
Execute each step in plan order, documenting results after each step.
|
|
385
|
+
|
|
386
|
+
### 2.1 General Execution Loop
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
FOR step in PLAN:
|
|
390
|
+
IF step.conditional AND condition_not_met:
|
|
391
|
+
SKIP step, mark as "skipped"
|
|
392
|
+
CONTINUE
|
|
393
|
+
|
|
394
|
+
2.1.1 Mark step as in-progress (update display)
|
|
395
|
+
2.1.2 Execute step (see step-specific instructions below)
|
|
396
|
+
**CRITICAL RESILIENCE**: If the sub-agent returns a malformed result or fails to follow formatting rules, run an explicit retry:
|
|
397
|
+
"The previous output was malformed. Fix these errors: [errors] and try again." (Max 2 retries before counting as critical failure).
|
|
398
|
+
2.1.3 Collect result
|
|
399
|
+
2.1.4 Document result via job-documenter (add-document)
|
|
400
|
+
(Also update job state `state.json`)
|
|
401
|
+
2.1.5 Update job README via job-documenter (update-readme)
|
|
402
|
+
2.1.6 Mark step as completed
|
|
403
|
+
|
|
404
|
+
IF step failed critically:
|
|
405
|
+
Ask user: "Step '<name>' failed. Continue with remaining steps or abort?"
|
|
406
|
+
IF abort: skip to Phase 3 (COMPLETION) with status "aborted"
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### 2.2 Step: ANALYZE
|
|
410
|
+
|
|
411
|
+
Dispatch `issue-analyzer` as a sub-agent.
|
|
412
|
+
|
|
413
|
+
**Prepare prompt:** Read `skills/issue-analyzer/orchestrator-prompt.md` (if it exists) and fill in:
|
|
414
|
+
- Issue URL or repo+number
|
|
415
|
+
- Codebase paths with roles
|
|
416
|
+
- Automation settings (skip_confirmation: true, search_depth: focused)
|
|
417
|
+
|
|
418
|
+
**Launch:**
|
|
419
|
+
```
|
|
420
|
+
Task({
|
|
421
|
+
description: "Issue analysis: #<N>",
|
|
422
|
+
subagent_type: "general",
|
|
423
|
+
prompt: <constructed prompt>
|
|
424
|
+
})
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**Parse result:** Extract JSON analysis object:
|
|
428
|
+
```
|
|
429
|
+
ANALYSIS_RESULT:
|
|
430
|
+
issue_type: from issue.type
|
|
431
|
+
total_tasks: from issue.total_tasks (= tasks.length)
|
|
432
|
+
tasks: [{task_id, task_name, task_type, complexity, dependencies,
|
|
433
|
+
description, target_files, acceptance_criteria, context,
|
|
434
|
+
existing_tests, existing_stories, module_patterns}]
|
|
435
|
+
dependency_order: from dependency_order array (already topologically sorted)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**Validate:** At least 1 task, no circular dependencies, all dependency references valid. Dependency_order array must contain all task_ids exactly once.
|
|
439
|
+
|
|
440
|
+
**Document:** Send to job-documenter:
|
|
441
|
+
```
|
|
442
|
+
ACTION: add-document
|
|
443
|
+
DATA:
|
|
444
|
+
DOC_TYPE: analysis
|
|
445
|
+
TARGET: both
|
|
446
|
+
TITLE: Issue Analysis — #<N>
|
|
447
|
+
CONTENT: <human-readable summary for man/, raw JSON for ai/>
|
|
448
|
+
AGENT: issue-analyzer
|
|
449
|
+
TASK: Analyze issue #<N>
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**For `analyze` intent:** After documenting, present analysis to user. Ask:
|
|
453
|
+
```
|
|
454
|
+
Analysis complete. Found <N> tasks.
|
|
455
|
+
Want me to implement this? I'll create a feature branch and run the full pipeline.
|
|
456
|
+
○ Yes, implement
|
|
457
|
+
○ No, analysis is enough
|
|
458
|
+
```
|
|
459
|
+
If "Yes" → extend PLAN with context → prepare → implement → review → fix → checks → pr steps. Continue execution.
|
|
460
|
+
If "No" → skip to Phase 3 (COMPLETION).
|
|
461
|
+
|
|
462
|
+
### 2.3 Step: CONTEXT
|
|
463
|
+
|
|
464
|
+
Dispatch `context-collector` to build the unified context document.
|
|
465
|
+
|
|
466
|
+
**Prepare prompt:** Use the template from `skills/context-collector/SKILL.md`:
|
|
467
|
+
|
|
468
|
+
```
|
|
469
|
+
Task({
|
|
470
|
+
description: "Collect context: <job-name>",
|
|
471
|
+
subagent_type: "general",
|
|
472
|
+
prompt: |
|
|
473
|
+
You are the context-collector agent. Your task is to research and build
|
|
474
|
+
a context document for the current job.
|
|
475
|
+
|
|
476
|
+
Load the skill from: skills/context-collector/SKILL.md
|
|
477
|
+
|
|
478
|
+
ACTION: collect
|
|
479
|
+
JOB_NAME: <job-name>
|
|
480
|
+
JOBS_ROOT: <JOBS_ROOT>
|
|
481
|
+
PROJECT_DIR: <project_dir>
|
|
482
|
+
|
|
483
|
+
DATA:
|
|
484
|
+
TASK_DESCRIPTION: <from issue or user request>
|
|
485
|
+
FOCUS_AREAS: <derived from analysis — affected areas, libraries>
|
|
486
|
+
ANALYSIS_RESULT: <output from issue-analyzer, if available>
|
|
487
|
+
KNOWN_LIBRARIES: <from package.json scan during analysis>
|
|
488
|
+
|
|
489
|
+
Execute all phases and return a CONTEXT_RESULT block.
|
|
490
|
+
})
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**Parse result:**
|
|
494
|
+
```
|
|
495
|
+
CONTEXT_RESULT:
|
|
496
|
+
status: success | error
|
|
497
|
+
version: <document version>
|
|
498
|
+
summary: <what context was collected>
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Validate:** status must be `success`. If `error` → log warning, continue (context is helpful but not blocking).
|
|
502
|
+
|
|
503
|
+
**After context is collected:** All subsequent sub-agents receive the **versioned** context path from state.json:
|
|
504
|
+
```
|
|
505
|
+
CONTEXT_LOCATION: <JOBS_ROOT>/<job-name>/ai/context_v<N>.md
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
**Context versioning:** Never overwrite `context.md` — save snapshots as `context_v1.md`, `context_v2.md`, etc.
|
|
509
|
+
- Version 1 is created during Step 2.3 (first collect)
|
|
510
|
+
- Subsequent versions increment on each update
|
|
511
|
+
- `state.json → context_doc.version` always points to the latest version
|
|
512
|
+
- Sub-agents always read the path from `state.json`, not a hardcoded filename
|
|
513
|
+
|
|
514
|
+
**Triggering context updates during execution:**
|
|
515
|
+
|
|
516
|
+
If during later steps (implement, review) a sub-agent reports missing context or a new library is discovered:
|
|
517
|
+
|
|
518
|
+
```
|
|
519
|
+
Task({
|
|
520
|
+
description: "Update context: <job-name>",
|
|
521
|
+
subagent_type: "general",
|
|
522
|
+
prompt: |
|
|
523
|
+
You are the context-collector agent. Update the existing context.
|
|
524
|
+
|
|
525
|
+
Load the skill from: skills/context-collector/SKILL.md
|
|
526
|
+
|
|
527
|
+
ACTION: update
|
|
528
|
+
JOB_NAME: <job-name>
|
|
529
|
+
JOBS_ROOT: <JOBS_ROOT>
|
|
530
|
+
PROJECT_DIR: <project_dir>
|
|
531
|
+
CONTEXT_VERSION: <current version + 1> ← write to context_v<N+1>.md
|
|
532
|
+
|
|
533
|
+
DATA:
|
|
534
|
+
TASK_DESCRIPTION: <original task description>
|
|
535
|
+
UPDATE_REASON: <why context needs updating>
|
|
536
|
+
FOCUS_AREAS: <new areas to research>
|
|
537
|
+
|
|
538
|
+
Execute update flow and return a CONTEXT_RESULT block.
|
|
539
|
+
})
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### 2.4 Step: PREPARE
|
|
543
|
+
|
|
544
|
+
Create git worktree for feature branch.
|
|
545
|
+
|
|
546
|
+
> **CRITICAL**: Feature branches MUST be created via `git worktree add`.
|
|
547
|
+
> **NEVER** use `git checkout -b` or `git switch -c` — this switches the main working directory.
|
|
548
|
+
> The worktree is a **sibling directory** to the project directory.
|
|
549
|
+
|
|
550
|
+
**Determine branch name:**
|
|
551
|
+
```
|
|
552
|
+
Format: feature/<custom-slug>
|
|
553
|
+
Slug: descriptive, lowercase, alphanumeric+hyphens, from issue title/feature
|
|
554
|
+
Examples: feature/pipeline-validation, feature/mirror-step-source-column
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**Create worktree:**
|
|
558
|
+
```bash
|
|
559
|
+
# Fetch latest base branch
|
|
560
|
+
git -C <project_dir> fetch origin <base_branch>
|
|
561
|
+
|
|
562
|
+
# Create worktree as SIBLING directory
|
|
563
|
+
git -C <project_dir> worktree add ../<branch-slug> -b feature/<branch-slug> origin/<base_branch>
|
|
564
|
+
|
|
565
|
+
# Example:
|
|
566
|
+
# Project dir: /Users/user/projects/<PROJECT>
|
|
567
|
+
# git -C ... worktree add ../pipeline-validation -b feature/pipeline-validation origin/develop-2
|
|
568
|
+
# Result worktree: /Users/user/projects/pipeline-validation
|
|
569
|
+
# Result branch: feature/pipeline-validation
|
|
570
|
+
|
|
571
|
+
# Auto-detect package manager and install dependencies
|
|
572
|
+
if [ -f <worktree_path>/bun.lockb ]; then
|
|
573
|
+
PM="bun"; RUNNER="bun run"; bun install --cwd <worktree_path>
|
|
574
|
+
elif [ -f <worktree_path>/pnpm-lock.yaml ]; then
|
|
575
|
+
PM="pnpm"; RUNNER="pnpm run"; pnpm install --prefix <worktree_path>
|
|
576
|
+
elif [ -f <worktree_path>/yarn.lock ]; then
|
|
577
|
+
PM="yarn"; RUNNER="yarn"; yarn --cwd <worktree_path>
|
|
578
|
+
elif [ -f <worktree_path>/package-lock.json ]; then
|
|
579
|
+
PM="npm"; RUNNER="npm run"; npm install --prefix <worktree_path>
|
|
580
|
+
elif [ -f <worktree_path>/requirements.txt ]; then
|
|
581
|
+
PM="python"; RUNNER=""; pip install -r <worktree_path>/requirements.txt
|
|
582
|
+
elif [ -f <worktree_path>/go.mod ]; then
|
|
583
|
+
PM="go"; RUNNER=""; (cd <worktree_path> && go mod download)
|
|
584
|
+
fi
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
> **IMPORTANT**: After creating the worktree, ALL subsequent operations (implementation, review, lint, test, git) MUST run in the **worktree directory**, NOT in the original project directory.
|
|
588
|
+
|
|
589
|
+
**Record state:**
|
|
590
|
+
```
|
|
591
|
+
BRANCH_STATE:
|
|
592
|
+
name: feature/<branch-slug>
|
|
593
|
+
base: <base_branch>
|
|
594
|
+
worktree_path: <absolute path to worktree>
|
|
595
|
+
project_dir: <original project directory — DO NOT modify>
|
|
596
|
+
created_from_commit: <commit hash>
|
|
597
|
+
package_manager: <PM>
|
|
598
|
+
run_command: <RUNNER>
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
> **Store `package_manager` and `run_command` in JOB_STATE** — all subsequent steps use these instead of hardcoded `npm`.
|
|
602
|
+
|
|
603
|
+
**Document:** Update README via job-documenter (update-readme) with branch info.
|
|
604
|
+
|
|
605
|
+
### 2.4.1 Step: TESTS-CREATOR + IMPLEMENT — Wave Isolation
|
|
606
|
+
|
|
607
|
+
**IRON LAW: tests-creator MUST run before task-implementer for every task. No exceptions.**
|
|
608
|
+
|
|
609
|
+
**CONTEXT BUDGET RULE: Each wave runs as a single isolated sub-agent. The orchestrator never dispatches task-implementers or tests-creator directly. This keeps the orchestrator context bounded to compact wave summaries regardless of job size.**
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
#### Why wave isolation
|
|
614
|
+
|
|
615
|
+
When the orchestrator dispatches task-implementers directly, each sub-agent result (STATUS text + verification output) accumulates in the orchestrator's context. After 3–4 waves this context can reach 100k+ tokens, causing the session to freeze during context reload. Wave isolation prevents this: each wave sub-agent runs in its own context and returns only a compact summary.
|
|
616
|
+
|
|
617
|
+
---
|
|
618
|
+
|
|
619
|
+
#### Execution pattern
|
|
620
|
+
|
|
621
|
+
```
|
|
622
|
+
WAVES = topological_sort_into_waves(dependency_order, task_dependencies)
|
|
623
|
+
|
|
624
|
+
FOR wave_index, wave_tasks in enumerate(WAVES):
|
|
625
|
+
Dispatch SINGLE Agent("wave-executor") with all tasks in this wave.
|
|
626
|
+
|
|
627
|
+
Receive compact WAVE_RESULT:
|
|
628
|
+
STATUS: WAVE_DONE | WAVE_PARTIAL | WAVE_FAILED
|
|
629
|
+
Wave: <index>
|
|
630
|
+
Commits: [hash msg, hash msg, ...]
|
|
631
|
+
Tests: <N passed, M failed>
|
|
632
|
+
Tasks: task-1 ✅, task-2 ✅
|
|
633
|
+
Result files: <JOBS_ROOT>/<job-name>/results/task-*.json
|
|
634
|
+
|
|
635
|
+
Decision:
|
|
636
|
+
WAVE_DONE → continue to next wave
|
|
637
|
+
WAVE_PARTIAL → log warnings, continue (read result files for details)
|
|
638
|
+
WAVE_FAILED → STOP, read result files for failed tasks, ask user
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
#### Wave executor prompt template
|
|
642
|
+
|
|
643
|
+
```
|
|
644
|
+
Task({
|
|
645
|
+
description: "Wave <N>: implement tasks <task_ids>",
|
|
646
|
+
subagent_type: "general",
|
|
647
|
+
prompt: |
|
|
648
|
+
You are a wave executor. Implement all tasks in this wave, then return a compact summary.
|
|
649
|
+
|
|
650
|
+
## Wave
|
|
651
|
+
Wave <N> of <total>
|
|
652
|
+
|
|
653
|
+
## Tasks
|
|
654
|
+
<JSON array of task objects for this wave>
|
|
655
|
+
|
|
656
|
+
## Workspace
|
|
657
|
+
- worktree_path: <absolute path>
|
|
658
|
+
- branch: <branch name>
|
|
659
|
+
- package_manager: <pm>
|
|
660
|
+
- run_command: <runner>
|
|
661
|
+
- issue_number: <N>
|
|
662
|
+
- job_name: <job-name>
|
|
663
|
+
- context_path: <path to context_vN.md>
|
|
664
|
+
|
|
665
|
+
## Instructions
|
|
666
|
+
|
|
667
|
+
**Step A — tests-creator (MANDATORY, run first):**
|
|
668
|
+
For each task in this wave, dispatch tests-creator in parallel:
|
|
669
|
+
Load skill: skills/tests-creator/SKILL.md
|
|
670
|
+
Pass: task object, workspace, context_path
|
|
671
|
+
Collect: TEST_SPECS[task_id] from each response
|
|
672
|
+
Wait for ALL tests-creator agents to finish before Step B.
|
|
673
|
+
|
|
674
|
+
**Step B — task-implementer (after all test stubs committed):**
|
|
675
|
+
For each task in this wave, dispatch task-implementer in parallel (if no file overlap; sequential otherwise):
|
|
676
|
+
Load skill: skills/task-implementer/SKILL.md
|
|
677
|
+
Pass: task object WITH test_case_specs: TEST_SPECS[task_id], workspace, job_name, context_path
|
|
678
|
+
Wait for ALL task-implementer agents to finish.
|
|
679
|
+
|
|
680
|
+
**Parallel safety check:** Before Step B, verify no two tasks share target_files.
|
|
681
|
+
If overlap → run sequentially within this wave.
|
|
682
|
+
|
|
683
|
+
## Required response format (compact — no inline JSON)
|
|
684
|
+
|
|
685
|
+
STATUS: WAVE_DONE
|
|
686
|
+
Wave: <N>
|
|
687
|
+
Commits: [abc1234 feat(x): ..., def5678 feat(y): ...]
|
|
688
|
+
Tests: <N passed, M failed>
|
|
689
|
+
Tasks: task-1 ✅, task-2 ✅
|
|
690
|
+
Result files: <JOBS_ROOT>/<job-name>/results/task-1.json, task-2.json
|
|
691
|
+
|
|
692
|
+
Use WAVE_PARTIAL if any task is DONE_WITH_CONCERNS.
|
|
693
|
+
Use WAVE_FAILED if any task is BLOCKED or failed.
|
|
694
|
+
Do NOT include full task output inline — write details to result files.
|
|
695
|
+
})
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
**After all waves, document:**
|
|
699
|
+
```
|
|
700
|
+
ACTION: add-document
|
|
701
|
+
DATA:
|
|
702
|
+
DOC_TYPE: implementation-report
|
|
703
|
+
TARGET: both
|
|
704
|
+
TITLE: Implementation Report
|
|
705
|
+
CONTENT: <summary of all waves, commits, test totals>
|
|
706
|
+
AGENT: wave-executor
|
|
707
|
+
TASK: Implementation phase
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
### 2.5.1 Post-Implementation Checkpoint
|
|
711
|
+
|
|
712
|
+
After all waves complete, check if tests were created. If not, offer `test-gen`:
|
|
713
|
+
|
|
714
|
+
```
|
|
715
|
+
# Derive all modified files from wave summaries and result files
|
|
716
|
+
ALL_FILES = collect from WAVE_RESULTS (read result files for details if needed)
|
|
717
|
+
|
|
718
|
+
IF no test files in ALL_FILES:
|
|
719
|
+
Auto-trigger test-gen for new/modified source files
|
|
720
|
+
(skip test files, config files, types-only files)
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
Then present the implementation summary to user:
|
|
724
|
+
|
|
725
|
+
```
|
|
726
|
+
Implementation complete:
|
|
727
|
+
- <N>/<M> tasks ✅
|
|
728
|
+
- <X> files modified, <Y> files created
|
|
729
|
+
- Tests: <created by implementer | auto-generated by test-gen | none>
|
|
730
|
+
|
|
731
|
+
What's next?
|
|
732
|
+
A) 🔍 Review → fix → PR (standard pipeline)
|
|
733
|
+
B) 👀 Show me the diff first — I'll review manually
|
|
734
|
+
C) 🚀 Skip review, go straight to PR
|
|
735
|
+
D) ⏹ Stop here — I'll continue manually
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
**Mapping:**
|
|
739
|
+
- A → continue to REVIEW step (default if no response in 60s)
|
|
740
|
+
- B → run `git diff <merge_base>..HEAD --stat` and `git diff <merge_base>..HEAD`, then re-ask
|
|
741
|
+
- C → skip REVIEW and FIX steps, go to CHECKS → PR
|
|
742
|
+
- D → skip to Phase 3 (COMPLETION) with status "paused"
|
|
743
|
+
|
|
744
|
+
### 2.5.5 Step: IMPLEMENT SANITY CHECK
|
|
745
|
+
|
|
746
|
+
Lightweight verification after all waves complete, **before** launching review.
|
|
747
|
+
This catches the case where a wave sub-agent claims WAVE_DONE but made no actual git changes.
|
|
748
|
+
|
|
749
|
+
```bash
|
|
750
|
+
# Run in worktree directory
|
|
751
|
+
git diff --stat <merge_base>..HEAD
|
|
752
|
+
git log <merge_base>..HEAD --oneline
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
**Gate conditions:**
|
|
756
|
+
|
|
757
|
+
| Check | Pass | Fail action |
|
|
758
|
+
|-------|------|-------------|
|
|
759
|
+
| At least 1 commit exists | ≥1 commit | `retryable` — re-dispatch the failed wave-executor with: "No commits were made. Implement the changes and commit them." |
|
|
760
|
+
| At least 1 file modified | ≥1 file changed | Same as above |
|
|
761
|
+
| Claimed files actually modified | All files in wave result match diff | Log discrepancy as WARNING, continue |
|
|
762
|
+
|
|
763
|
+
**If retry also produces no commits** → classify as `terminal`, ABORT with:
|
|
764
|
+
```
|
|
765
|
+
"wave-executor returned WAVE_DONE twice but made no git changes.
|
|
766
|
+
Please implement manually and re-run from the review step."
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
**Record:**
|
|
770
|
+
```
|
|
771
|
+
SANITY_CHECK:
|
|
772
|
+
commits: <count>
|
|
773
|
+
files_changed: <count>
|
|
774
|
+
lines_added: <N>
|
|
775
|
+
lines_removed: <N>
|
|
776
|
+
verified: true | false
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
### 2.6 Step: REVIEW
|
|
782
|
+
|
|
783
|
+
#### 2.6.0 Review Strategy Selection
|
|
784
|
+
|
|
785
|
+
If the user didn't specify a review approach, offer options:
|
|
786
|
+
|
|
787
|
+
```
|
|
788
|
+
How should I review the implementation?
|
|
789
|
+
|
|
790
|
+
A) 🚀 Quick (code-review 4-agent parallel) — ~30 sec
|
|
791
|
+
B) 📋 Thorough (individual reviewers: ai + boss + style + mobx) — ~2 min
|
|
792
|
+
C) 🔒 Security-focused (code-review + security-audit) — ~1 min
|
|
793
|
+
D) ⏭ Skip review entirely
|
|
794
|
+
|
|
795
|
+
> pick a letter (default: A)
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
Then ask which optional convention reviewers to include when local convention docs or matching
|
|
799
|
+
paths are present:
|
|
800
|
+
|
|
801
|
+
```
|
|
802
|
+
Which project-convention reviewers should I include?
|
|
803
|
+
|
|
804
|
+
A) Include all detected convention reviewers (recommended)
|
|
805
|
+
B) Choose individually
|
|
806
|
+
C) Skip convention reviewers
|
|
807
|
+
|
|
808
|
+
Detected reviewers:
|
|
809
|
+
- review-frontend-conventions: frontend files / stories / local frontend guide
|
|
810
|
+
- review-testing-practices: tests, stories, MSW, or e2e files
|
|
811
|
+
- review-core-boundaries: shared core/infrastructure files
|
|
812
|
+
- review-flow-graph: shared graph/flow abstraction files
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
Only show detected reviewers. If the user chooses B, ask for the exact skill names to include or
|
|
816
|
+
exclude, then persist the choice in job state as `convention_reviewers`.
|
|
817
|
+
|
|
818
|
+
**Auto-select** (skip this question) when:
|
|
819
|
+
- `review_mode` is explicitly set in automation settings → use that
|
|
820
|
+
- `convention_reviewers` is explicitly set in automation settings → use that for optional convention reviewers
|
|
821
|
+
- User already chose at Post-Implementation Checkpoint (2.5.1 option A) → use default (A)
|
|
822
|
+
- Time pressure (total_job_timeout close) → use A (fastest)
|
|
823
|
+
|
|
824
|
+
#### 2.6.1 Execute Review
|
|
825
|
+
|
|
826
|
+
Dispatch review skills on the whole branch. **Launch all reviewers in parallel** for speed.
|
|
827
|
+
|
|
828
|
+
**Strategy A — `code-review` (4-agent parallel):**
|
|
829
|
+
|
|
830
|
+
Dispatches 4 agents in parallel (correctness, security, performance, style) and produces a unified severity report.
|
|
831
|
+
|
|
832
|
+
```
|
|
833
|
+
Launch code-review skill with:
|
|
834
|
+
scope: git diff <merge_base>..HEAD
|
|
835
|
+
output: unified report with CRITICAL/HIGH/MEDIUM/LOW findings
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
**Fallback — individual reviewers (if code-review unavailable or user prefers):**
|
|
839
|
+
|
|
840
|
+
Determine and **dispatch all reviewers simultaneously** (not sequentially):
|
|
841
|
+
|
|
842
|
+
| Reviewer | Condition | Launch |
|
|
843
|
+
|----------|-----------|--------|
|
|
844
|
+
| `code-ai-review` | Always | Parallel |
|
|
845
|
+
| `code-boss-review` | Always | Parallel |
|
|
846
|
+
| `code-style-review` | Always | Parallel |
|
|
847
|
+
| `code-mobx-store-review` | Only if `*.store.ts` modified | Parallel |
|
|
848
|
+
| `review-frontend-conventions` | If selected and frontend files/local frontend docs match | Parallel |
|
|
849
|
+
| `review-testing-practices` | If selected and tests/stories/e2e files match | Parallel |
|
|
850
|
+
| `review-core-boundaries` | If selected and shared core files match | Parallel |
|
|
851
|
+
| `review-flow-graph` | If selected and shared graph/flow files match | Parallel |
|
|
852
|
+
|
|
853
|
+
```
|
|
854
|
+
# Launch ALL applicable reviewers in a SINGLE turn (parallel):
|
|
855
|
+
Agent 1: code-ai-review (correctness, security)
|
|
856
|
+
Agent 2: code-boss-review (architecture, logic)
|
|
857
|
+
Agent 3: code-style-review (naming, patterns)
|
|
858
|
+
Agent 4: code-mobx-store-review (if applicable)
|
|
859
|
+
Agent 5+: selected convention reviewers (if applicable)
|
|
860
|
+
|
|
861
|
+
# Wait for all to complete, then merge results
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
**Review-orchestrator mode (preferred when available):**
|
|
865
|
+
|
|
866
|
+
If `review-orchestrator` exists in the skill catalog, dispatch it with the selected review flags
|
|
867
|
+
instead of manually launching individual reviewers. Pass selected convention reviewer flags:
|
|
868
|
+
`--project-conventions`, `--frontend-conventions`, `--testing-practices`, `--core-boundaries`,
|
|
869
|
+
and/or `--flow-graph`.
|
|
870
|
+
|
|
871
|
+
Pass review orchestration controls:
|
|
872
|
+
```
|
|
873
|
+
context_mode: <review_context_mode automation setting; default "light", ask "full" for high-risk PRs>
|
|
874
|
+
token_budget: <review_token_budget automation setting or computed scope budget>
|
|
875
|
+
model_strategy: <review_model_strategy automation setting; default "current">
|
|
876
|
+
output: unified report with findings, review_context, token_policy, and model metadata
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
**Collect and merge findings:**
|
|
880
|
+
```
|
|
881
|
+
REVIEW_FINDINGS: [{
|
|
882
|
+
reviewer: "<skill-name>",
|
|
883
|
+
findings: [{ file, line, severity: CRITICAL|WARNING|INFO, message }]
|
|
884
|
+
}]
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
**Strategy C — Security-focused:**
|
|
888
|
+
|
|
889
|
+
Run `code-review` (4-agent) AND `security-audit` in parallel:
|
|
890
|
+
```
|
|
891
|
+
Agent group 1: code-review (correctness, security, performance, style)
|
|
892
|
+
Agent group 2: security-audit (dependency vulnerabilities, secrets scan, OWASP patterns)
|
|
893
|
+
```
|
|
894
|
+
Merge findings from both into unified `REVIEW_FINDINGS`.
|
|
895
|
+
|
|
896
|
+
**Deduplicate:** If multiple reviewers flag the same file:line, merge into a single finding with the highest severity.
|
|
897
|
+
|
|
898
|
+
**Classify:**
|
|
899
|
+
```
|
|
900
|
+
NEEDS_FIX = count(CRITICAL) > 0 OR count(WARNING) > 0
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
**Document:**
|
|
904
|
+
```
|
|
905
|
+
ACTION: add-document
|
|
906
|
+
DATA:
|
|
907
|
+
DOC_TYPE: review
|
|
908
|
+
TARGET: both
|
|
909
|
+
TITLE: Code Review Results
|
|
910
|
+
CONTENT: <findings summary for man/, structured findings for ai/>
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
#### 2.6.2 PR Review Report Publication
|
|
914
|
+
|
|
915
|
+
If this job is reviewing an existing GitHub PR, or if a PR number/URL was resolved before the review step, ask whether to publish the consolidated review report after review findings are documented and before fix decisions. This gives the user a chance to record the current review state before any automatic fix loop changes it.
|
|
916
|
+
|
|
917
|
+
Ask unless automation settings explicitly set `publish_pr_review_report`:
|
|
918
|
+
|
|
919
|
+
```text
|
|
920
|
+
Publish the review report to the PR?
|
|
921
|
+
|
|
922
|
+
A) Concise PR comment only
|
|
923
|
+
B) Concise PR comment + detailed AI markdown artifact (recommended for follow-up fixes)
|
|
924
|
+
C) Do not publish
|
|
925
|
+
|
|
926
|
+
> pick a letter (default: C)
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
**Rules:**
|
|
930
|
+
- The PR comment and AI artifact must be written in English only, regardless of the chat language or reviewer output language.
|
|
931
|
+
- Default is C. Never publish to a PR without explicit user confirmation or `publish_pr_review_report: comment`, `publish_pr_review_report: comment-and-ai-artifact`, or legacy `publish_pr_review_report: true`.
|
|
932
|
+
- If the job has review findings but no PR number yet, store `pending_pr_review_report_comment` and `pending_review_ai_artifact` in job state. If the later PR step creates a PR, ask the same question after PR creation.
|
|
933
|
+
- If the user chooses A, delegate concise comment formatting to `review-orchestrator`'s PR Review Report Publication contract when available.
|
|
934
|
+
- If the user chooses B, delegate concise comment formatting and generate `.metaproject/jobs/<job-name>/ai/review-ai-report.md` using `review-orchestrator`'s Detailed AI Markdown Artifact contract.
|
|
935
|
+
- If the user chooses B, the PR comment `Meta` section must include both an `AI artifact` link/path and an `AI artifact description` row explaining in human-readable language that the markdown file contains detailed findings, fix guidance, patch guidance, regression coverage, validation plan, and follow-up agent context.
|
|
936
|
+
- If using legacy reviewers, normalize findings into the same concise PR comment and AI artifact structures before posting.
|
|
937
|
+
- Record the final decision in job state as `publication_plan.mode`: `comment`, `comment-and-ai-artifact`, or `none`.
|
|
938
|
+
|
|
939
|
+
**Automation values:**
|
|
940
|
+
- `publish_pr_review_report: ask` -> ask the question above.
|
|
941
|
+
- `publish_pr_review_report: comment` or legacy `true` -> publish the concise PR comment only.
|
|
942
|
+
- `publish_pr_review_report: comment-and-ai-artifact` -> publish the concise PR comment and create/link the detailed AI markdown artifact.
|
|
943
|
+
- `publish_pr_review_report: none` or legacy `false` -> do not publish.
|
|
944
|
+
|
|
945
|
+
#### 2.6.3 Post-Review Checkpoint
|
|
946
|
+
|
|
947
|
+
After review completes, present findings and ask user:
|
|
948
|
+
|
|
949
|
+
```
|
|
950
|
+
Review complete:
|
|
951
|
+
🔴 <N> CRITICAL 🟠 <M> HIGH 🟡 <K> MEDIUM 🔵 <L> LOW
|
|
952
|
+
|
|
953
|
+
A) 🔧 Auto-fix and continue (fix CRITICAL + HIGH, skip LOW)
|
|
954
|
+
B) 📋 Show all findings — I'll decide what to fix
|
|
955
|
+
C) ⏭ Skip fixes, proceed to PR as-is
|
|
956
|
+
D) ⏹ Stop — I'll fix manually
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
**Mapping:**
|
|
960
|
+
- A → proceed to FIX step (default if CRITICAL > 0)
|
|
961
|
+
- B → display all findings grouped by file, then re-ask A/C/D
|
|
962
|
+
- C → skip FIX step, go to CHECKS (only if 0 CRITICAL — refuse if CRITICAL > 0)
|
|
963
|
+
- D → skip to Phase 3 (COMPLETION) with status "paused"
|
|
964
|
+
|
|
965
|
+
**Auto-proceed** (skip this question) when:
|
|
966
|
+
- 0 findings → skip directly to CHECKS
|
|
967
|
+
- Only INFO findings → skip FIX, go to CHECKS
|
|
968
|
+
- `auto_create_pr: true` → auto-select A
|
|
969
|
+
|
|
970
|
+
### 2.7 Step: FIX (conditional)
|
|
971
|
+
|
|
972
|
+
Only runs if NEEDS_FIX is true. Default max: **3 iterations** (`max_review_iterations`).
|
|
973
|
+
|
|
974
|
+
```
|
|
975
|
+
UNRESOLVED_FINDINGS = all CRITICAL + WARNING findings from step 2.6
|
|
976
|
+
|
|
977
|
+
FOR iteration in [1, 2, 3]:
|
|
978
|
+
IF NOT NEEDS_FIX: BREAK
|
|
979
|
+
|
|
980
|
+
1. Group UNRESOLVED_FINDINGS by file
|
|
981
|
+
2. Construct fix prompt — MUST include unresolved findings from previous attempt:
|
|
982
|
+
|
|
983
|
+
task_type: "fix"
|
|
984
|
+
findings: <UNRESOLVED_FINDINGS>
|
|
985
|
+
iteration: <N>
|
|
986
|
+
previously_unresolved: <findings that were in UNRESOLVED_FINDINGS last iteration but still present>
|
|
987
|
+
→ Prefix: "These specific findings were NOT fixed in iteration <N-1>: [list]"
|
|
988
|
+
|
|
989
|
+
3. Launch task-implementer with fix prompt
|
|
990
|
+
4. Run sanity-check (step 2.5.5 logic) — verify commits were made
|
|
991
|
+
5. Re-run reviewers (step 2.6) — parallel dispatch
|
|
992
|
+
6. Recompute NEEDS_FIX from new findings
|
|
993
|
+
7. Update UNRESOLVED_FINDINGS = remaining CRITICAL + WARNING
|
|
994
|
+
|
|
995
|
+
IF still NEEDS_FIX after max iterations:
|
|
996
|
+
Log "Unresolved after <N> iterations" with finding list → continue to checks
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
**Fix prompt escalation pattern:**
|
|
1000
|
+
- Iteration 1: "Fix these findings: [list]"
|
|
1001
|
+
- Iteration 2: "These findings were NOT fixed in iteration 1: [subset]. Fix them now."
|
|
1002
|
+
- Iteration 3: "FINAL attempt. These findings remain after 2 fix passes: [subset]. This is the last fix iteration."
|
|
1003
|
+
|
|
1004
|
+
### 2.8 Step: VERIFY (code-verifier)
|
|
1005
|
+
|
|
1006
|
+
Dispatch `code-verifier` as a sub-agent. This replaces the orchestrator-internal "checks" step.
|
|
1007
|
+
|
|
1008
|
+
```
|
|
1009
|
+
Task({
|
|
1010
|
+
description: "Quality gate: <job-name>",
|
|
1011
|
+
subagent_type: "general",
|
|
1012
|
+
prompt: |
|
|
1013
|
+
You are code-verifier. Load skill: skills/code-verifier/SKILL.md
|
|
1014
|
+
|
|
1015
|
+
codebase_path: <worktree_path>
|
|
1016
|
+
base_branch: <base_branch>
|
|
1017
|
+
scope: changed
|
|
1018
|
+
|
|
1019
|
+
Run all 4 phases and return VERIFICATION_RESULT.
|
|
1020
|
+
})
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
**Handle result:**
|
|
1024
|
+
```
|
|
1025
|
+
IF VERIFICATION_RESULT.gate == "PASS" or "PASS_WITH_WARNINGS":
|
|
1026
|
+
→ Proceed to review
|
|
1027
|
+
→ Log findings as informational in job docs
|
|
1028
|
+
|
|
1029
|
+
IF VERIFICATION_RESULT.gate == "FAIL":
|
|
1030
|
+
→ Extract CRITICAL/HIGH findings
|
|
1031
|
+
→ Check if fix step is already scheduled
|
|
1032
|
+
- If not → add fix step to plan (dispatch task-implementer in fix mode)
|
|
1033
|
+
- If fix already ran 2× → escalate to user, skip to report
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
**Document result:**
|
|
1037
|
+
```
|
|
1038
|
+
ACTION: add-document
|
|
1039
|
+
DATA:
|
|
1040
|
+
DOC_TYPE: verification-report
|
|
1041
|
+
TARGET: both
|
|
1042
|
+
TITLE: Verification Report — <gate status>
|
|
1043
|
+
CONTENT: <VERIFICATION_RESULT formatted>
|
|
1044
|
+
AGENT: code-verifier
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
### 2.8.1 Step: VERIFY-POST-FIX (code-verifier, conditional)
|
|
1048
|
+
|
|
1049
|
+
After fix iterations, dispatch `code-verifier` again with identical parameters.
|
|
1050
|
+
|
|
1051
|
+
```
|
|
1052
|
+
IF fix ran:
|
|
1053
|
+
Dispatch code-verifier (same params as step 2.8)
|
|
1054
|
+
IF gate still FAIL:
|
|
1055
|
+
Log "Verification failed after fix" → skip to report with warning
|
|
1056
|
+
IF gate PASS:
|
|
1057
|
+
Proceed to report
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
### 2.8.1 Step: PERF-CHECK (optional)
|
|
1061
|
+
|
|
1062
|
+
Auto-trigger `perf-check` when frontend/bundle files were modified:
|
|
1063
|
+
|
|
1064
|
+
```
|
|
1065
|
+
IF any modified file matches: *.tsx, *.jsx, *.css, *.scss, webpack.*, vite.*, next.config.*
|
|
1066
|
+
AND project has build output (dist/, build/, .next/)
|
|
1067
|
+
THEN:
|
|
1068
|
+
Dispatch perf-check --bundle
|
|
1069
|
+
Add findings to report (informational, not blocking)
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
Skip if no frontend files changed or no build output exists. Results are advisory — they don't block the PR.
|
|
1073
|
+
|
|
1074
|
+
### 2.9 Step: REPORT
|
|
1075
|
+
|
|
1076
|
+
Aggregate all information into a human-readable summary.
|
|
1077
|
+
|
|
1078
|
+
**Report structure:**
|
|
1079
|
+
```markdown
|
|
1080
|
+
# Job Report: <Title>
|
|
1081
|
+
|
|
1082
|
+
## Summary
|
|
1083
|
+
- **Intent:** <implement / analyze / review>
|
|
1084
|
+
- **Source:** <issue URL or description>
|
|
1085
|
+
- **Branch:** `<branch_name>`
|
|
1086
|
+
- **Tasks:** <completed>/<total> completed
|
|
1087
|
+
- **Review Iterations:** <N>
|
|
1088
|
+
- **Final Status:** <READY FOR PR | HAS WARNINGS | HAS ISSUES | ANALYSIS ONLY>
|
|
1089
|
+
|
|
1090
|
+
## Analysis
|
|
1091
|
+
<analysis summary>
|
|
1092
|
+
|
|
1093
|
+
## Tasks
|
|
1094
|
+
### task-1: <Name>
|
|
1095
|
+
- **Status:** success
|
|
1096
|
+
- **Files:** <list>
|
|
1097
|
+
- **Commits:** <hashes>
|
|
1098
|
+
|
|
1099
|
+
## Review Results
|
|
1100
|
+
### code-ai-review
|
|
1101
|
+
- CRITICAL: <N>, WARNING: <N>, INFO: <N>
|
|
1102
|
+
### code-boss-review
|
|
1103
|
+
- ...
|
|
1104
|
+
|
|
1105
|
+
## Unresolved Issues
|
|
1106
|
+
- [ ] <file>:<line> — <message> (from <reviewer>)
|
|
1107
|
+
|
|
1108
|
+
## Final Checks
|
|
1109
|
+
- Lint: PASS
|
|
1110
|
+
- Type Check: PASS
|
|
1111
|
+
- Tests: 42 passed, 0 failed
|
|
1112
|
+
|
|
1113
|
+
## Changes Summary
|
|
1114
|
+
### Files Modified (<N>)
|
|
1115
|
+
- `src/...`
|
|
1116
|
+
|
|
1117
|
+
### Files Created (<N>)
|
|
1118
|
+
- `src/...`
|
|
1119
|
+
|
|
1120
|
+
### Commits (<N>)
|
|
1121
|
+
- `abc1234` feat(pipelines): add validation
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
### 2.10 Step: PR (conditional)
|
|
1125
|
+
|
|
1126
|
+
Only runs if `create_pr` is true and intent is `implement`.
|
|
1127
|
+
|
|
1128
|
+
**Dispatch `pr-issue-documenter` to generate the PR description:**
|
|
1129
|
+
|
|
1130
|
+
Pass the following context to `pr-issue-documenter`:
|
|
1131
|
+
```
|
|
1132
|
+
ACTION: generate-pr-description
|
|
1133
|
+
JOB_NAME: <job-name>
|
|
1134
|
+
BRANCH: <feature_branch>
|
|
1135
|
+
BASE: <base_branch>
|
|
1136
|
+
ISSUE_NUMBER: <issue_number if available>
|
|
1137
|
+
CONTEXT_PATH: <JOBS_ROOT>/<job-name>/ai/context.md
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
`pr-issue-documenter` will analyze the branch diff and produce a structured PR description (Summary + Changes by area + Key Files table). Use its output as the `body` for the PR.
|
|
1141
|
+
|
|
1142
|
+
**Enrich PR with changelog entry:**
|
|
1143
|
+
|
|
1144
|
+
Dispatch `changelog` skill to generate a changelog snippet for this branch:
|
|
1145
|
+
```
|
|
1146
|
+
changelog <base_branch>..HEAD --format compact
|
|
1147
|
+
```
|
|
1148
|
+
Append the changelog snippet to the PR body under a `## Changelog` section.
|
|
1149
|
+
|
|
1150
|
+
**Present to user:**
|
|
1151
|
+
```
|
|
1152
|
+
Implementation complete. Draft PR proposal:
|
|
1153
|
+
|
|
1154
|
+
Title: <type>(#<issue>): <description>
|
|
1155
|
+
Base: <base> ← <head>
|
|
1156
|
+
|
|
1157
|
+
<pr-issue-documenter output>
|
|
1158
|
+
|
|
1159
|
+
## Changelog
|
|
1160
|
+
<changelog snippet>
|
|
1161
|
+
|
|
1162
|
+
Create this draft PR? (yes/no/edit)
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
If user says "edit" → show the full body, let them modify before creating.
|
|
1166
|
+
|
|
1167
|
+
**If confirmed:**
|
|
1168
|
+
```bash
|
|
1169
|
+
gh pr create --title "<title>" --body "$(cat <<'EOF'
|
|
1170
|
+
<body>
|
|
1171
|
+
EOF
|
|
1172
|
+
)" --base <base_branch> --head <feature_branch> --draft
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
---
|
|
1176
|
+
|
|
1177
|
+
## Phase 3: COMPLETION
|
|
1178
|
+
|
|
1179
|
+
### 3.1 Finalize Job Documentation
|
|
1180
|
+
|
|
1181
|
+
Dispatch job-documenter with `finalize` action:
|
|
1182
|
+
|
|
1183
|
+
```
|
|
1184
|
+
ACTION: finalize
|
|
1185
|
+
DATA:
|
|
1186
|
+
FINAL_CONTENT: <full report markdown>
|
|
1187
|
+
FINAL_STATUS: completed | aborted
|
|
1188
|
+
SUMMARY: <1-3 sentence summary>
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
**Validate response:** status must be `success`.
|
|
1192
|
+
|
|
1193
|
+
### 3.2 Present Results
|
|
1194
|
+
|
|
1195
|
+
Tell user:
|
|
1196
|
+
1. What was accomplished (summary)
|
|
1197
|
+
2. Where documentation is stored: `.metaproject/jobs/<job-name>/`
|
|
1198
|
+
3. PR URL (if created)
|
|
1199
|
+
4. Metrics summary (time, tokens)
|
|
1200
|
+
5. Any unresolved issues
|
|
1201
|
+
|
|
1202
|
+
```
|
|
1203
|
+
✅ Job completed successfully.
|
|
1204
|
+
|
|
1205
|
+
Documentation: <JOBS_ROOT>/<job-name>/
|
|
1206
|
+
Branch: feature/<slug> (worktree: <path>)
|
|
1207
|
+
PR: <URL or "not created">
|
|
1208
|
+
Metrics: <total time>, <total tokens>
|
|
1209
|
+
|
|
1210
|
+
See .metaproject/jobs/<job-name>/README.md for the full job index.
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
### 3.3 Post-Completion Options
|
|
1214
|
+
|
|
1215
|
+
After presenting results, offer next steps:
|
|
1216
|
+
|
|
1217
|
+
```
|
|
1218
|
+
What would you like to do next?
|
|
1219
|
+
|
|
1220
|
+
A) ✅ Done — nothing else needed
|
|
1221
|
+
B) 🚀 Deploy to staging — run /deploy staging
|
|
1222
|
+
C) 🔄 Start another job
|
|
1223
|
+
D) 📝 Update CLAUDE.md with session learnings
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
- B → dispatch `deploy` skill with `staging` environment
|
|
1227
|
+
- D → dispatch `claude-md-management` skill
|
|
1228
|
+
|
|
1229
|
+
**Auto-skip** if the job was `analyze` or `review` intent (no deploy makes sense).
|
|
1230
|
+
|
|
1231
|
+
---
|
|
1232
|
+
|
|
1233
|
+
## Plan Extension (Dynamic Planning)
|
|
1234
|
+
|
|
1235
|
+
When the orchestrator starts with an `analyze` intent and the user then says "yes, implement":
|
|
1236
|
+
|
|
1237
|
+
1. **Keep existing completed steps** (analyze, context, report are already done)
|
|
1238
|
+
2. **Extend plan** with new steps: prepare → implement → review → fix → checks → report → pr
|
|
1239
|
+
3. **Update job documentation** via job-documenter (update-readme with new plan)
|
|
1240
|
+
4. **Continue execution** from the first new step
|
|
1241
|
+
|
|
1242
|
+
This is the core of dynamic planning — the plan grows based on user decisions.
|
|
1243
|
+
|
|
1244
|
+
---
|
|
1245
|
+
|
|
1246
|
+
## State Management
|
|
1247
|
+
|
|
1248
|
+
The orchestrator maintains state throughout all phases:
|
|
1249
|
+
|
|
1250
|
+
```
|
|
1251
|
+
JOB_STATE:
|
|
1252
|
+
phase: CONTEXT | PLAN | EXECUTION | COMPLETION
|
|
1253
|
+
intent: implement | analyze | review | custom
|
|
1254
|
+
create_pr: <bool>
|
|
1255
|
+
job_name: <string>
|
|
1256
|
+
|
|
1257
|
+
context:
|
|
1258
|
+
issue: { number, title, url, type }
|
|
1259
|
+
project_dir: <path>
|
|
1260
|
+
base_branch: <string>
|
|
1261
|
+
|
|
1262
|
+
branch:
|
|
1263
|
+
name: <string>
|
|
1264
|
+
worktree_path: <path>
|
|
1265
|
+
merge_base: <commit hash>
|
|
1266
|
+
|
|
1267
|
+
plan:
|
|
1268
|
+
steps: [{ id, type, agent, depends, status: pending|in_progress|completed|skipped|failed, prompt_chars: <int>, prompt_hash: <sha256 first 8 chars> }]
|
|
1269
|
+
current_step: <step_id>
|
|
1270
|
+
|
|
1271
|
+
analysis:
|
|
1272
|
+
total_tasks: <N>
|
|
1273
|
+
tasks: [<task objects>]
|
|
1274
|
+
dependency_order: [<task_ids>]
|
|
1275
|
+
|
|
1276
|
+
context_doc:
|
|
1277
|
+
path: <JOBS_ROOT>/<job-name>/ai/context.md
|
|
1278
|
+
version: <current version>
|
|
1279
|
+
status: collected | updated | not-collected
|
|
1280
|
+
|
|
1281
|
+
implementation:
|
|
1282
|
+
task_results: {<task_id>: <result>}
|
|
1283
|
+
all_commits: [<hash>]
|
|
1284
|
+
all_files: [<path>]
|
|
1285
|
+
|
|
1286
|
+
review:
|
|
1287
|
+
iteration: <N>
|
|
1288
|
+
findings: [<findings>]
|
|
1289
|
+
needs_fix: <bool>
|
|
1290
|
+
unresolved: [<findings>]
|
|
1291
|
+
|
|
1292
|
+
final_checks:
|
|
1293
|
+
lint: <result>
|
|
1294
|
+
type_check: <result>
|
|
1295
|
+
tests: <result>
|
|
1296
|
+
|
|
1297
|
+
documentation:
|
|
1298
|
+
job_path: <JOBS_ROOT>/<job-name>
|
|
1299
|
+
documents_created: [<paths>]
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
---
|
|
1303
|
+
|
|
1304
|
+
## state.json Specification
|
|
1305
|
+
|
|
1306
|
+
The orchestrator persists JOB_STATE to `.metaproject/jobs/<job-name>/state.json` for job resumption.
|
|
1307
|
+
|
|
1308
|
+
**Location:** `.metaproject/jobs/<JOB_NAME>/state.json`
|
|
1309
|
+
|
|
1310
|
+
**Schema reference:** `skills/job-orchestrator/state.schema.json`
|
|
1311
|
+
|
|
1312
|
+
**When to create:** During Phase 1.2 (Initialize Job Documentation) — write initial state after job docs are initialized.
|
|
1313
|
+
|
|
1314
|
+
**When to update:** After every step completion in Phase 2 (EXECUTION) — update `plan.steps[i].status`, `plan.steps[i].prompt` (store the prompt used), and `plan.current_step`.
|
|
1315
|
+
|
|
1316
|
+
**How to write state.json:**
|
|
1317
|
+
```bash
|
|
1318
|
+
# Write state (orchestrator handles this directly, not via job-documenter)
|
|
1319
|
+
cat > .metaproject/jobs/<JOB_NAME>/state.json << 'EOF'
|
|
1320
|
+
{
|
|
1321
|
+
"phase": "EXECUTION",
|
|
1322
|
+
"intent": "<intent>",
|
|
1323
|
+
"job_name": "<job-name>",
|
|
1324
|
+
...
|
|
1325
|
+
}
|
|
1326
|
+
EOF
|
|
1327
|
+
```
|
|
1328
|
+
|
|
1329
|
+
**Job resumption (Phase 0.0):** If `state.json` exists and `phase` is not `COMPLETION`, offer to resume. Parse the file, restore JOB_STATE, jump to the first step with `status: "pending"` or `status: "in_progress"`.
|
|
1330
|
+
|
|
1331
|
+
---
|
|
1332
|
+
|
|
1333
|
+
## Interpreting Subagent Results
|
|
1334
|
+
|
|
1335
|
+
**Rule:** `rules/core/subagent-status-protocol.md`
|
|
1336
|
+
|
|
1337
|
+
All subagents dispatched by this orchestrator MUST begin their final response with `STATUS: <STATUS>`. The orchestrator reads this line first and routes accordingly.
|
|
1338
|
+
|
|
1339
|
+
### Iron Law
|
|
1340
|
+
|
|
1341
|
+
**IF A SUBAGENT DOES NOT START WITH `STATUS:`, TREAT IT AS `NEEDS_CONTEXT` AND REQUEST A PROPERLY FORMATTED RESPONSE**
|
|
1342
|
+
|
|
1343
|
+
Do not attempt to infer status from prose. Do not trust a response that "looks fine" but lacks the status line. Run one explicit retry: "Your response did not start with STATUS: <STATUS>. Please reformat using the subagent status protocol (rules/core/subagent-status-protocol.md) and resend your result."
|
|
1344
|
+
|
|
1345
|
+
### How to handle each status
|
|
1346
|
+
|
|
1347
|
+
**`STATUS: DONE`**
|
|
1348
|
+
- Accept result.
|
|
1349
|
+
- Extract structured payload (JSON result, files changed, commits, verification results).
|
|
1350
|
+
- Mark step as completed in JOB_STATE.
|
|
1351
|
+
- Continue to next step in the plan.
|
|
1352
|
+
|
|
1353
|
+
**`STATUS: DONE_WITH_CONCERNS`**
|
|
1354
|
+
- Accept result as complete.
|
|
1355
|
+
- Read the `## Concerns for orchestrator` section carefully.
|
|
1356
|
+
- Decide: (a) log concern and continue, (b) surface concern to user at next checkpoint, or (c) re-dispatch with adjusted scope if the concern affects correctness.
|
|
1357
|
+
- Do NOT silently discard concerns. Record them in JOB_STATE and include in the final report.
|
|
1358
|
+
- Mark step as completed.
|
|
1359
|
+
|
|
1360
|
+
**`STATUS: BLOCKED`**
|
|
1361
|
+
- Do NOT proceed to any step that depends on this task.
|
|
1362
|
+
- Read `## Reason` and `## What I need from orchestrator`.
|
|
1363
|
+
- Resolve the blocker: provide the missing file, make the decision, fix the dependency, or escalate to the user.
|
|
1364
|
+
- Re-dispatch the subagent with the resolved context.
|
|
1365
|
+
- If the blocker cannot be resolved (e.g., missing information requires user input) → surface to user: "Task <id> is blocked: <reason>. What would you like to do?"
|
|
1366
|
+
|
|
1367
|
+
**`STATUS: NEEDS_CONTEXT`**
|
|
1368
|
+
- Do NOT mark step as failed.
|
|
1369
|
+
- Read `## Missing information` and `## Where it might be found`.
|
|
1370
|
+
- Locate the missing information (check job context document, issue body, package.json, codebase).
|
|
1371
|
+
- Re-dispatch the subagent with the enriched task input.
|
|
1372
|
+
- If the information is not available anywhere → escalate to user with the specific question.
|
|
1373
|
+
|
|
1374
|
+
### Red Flag
|
|
1375
|
+
|
|
1376
|
+
**"The subagent didn't use the status protocol, but the result looks fine"**
|
|
1377
|
+
|
|
1378
|
+
Do not accept this. A subagent that ignores the status protocol is unpredictable — its next failure may not look fine. Enforce the protocol on every response. Run the retry. If the subagent still does not comply after the retry, log it as a critical failure and ask the user how to proceed.
|
|
1379
|
+
|
|
1380
|
+
---
|
|
1381
|
+
|
|
1382
|
+
## Constructing Subagent Context
|
|
1383
|
+
|
|
1384
|
+
**Rule:** `rules/core/subagent-context-construction.md`
|
|
1385
|
+
|
|
1386
|
+
Every prompt dispatched to a subagent must be **explicitly constructed** by the orchestrator. Subagents do not inherit session context, job state, or prior agent output — they only know what the orchestrator tells them.
|
|
1387
|
+
|
|
1388
|
+
### Template dispatch block
|
|
1389
|
+
|
|
1390
|
+
Use this structure for every subagent dispatch:
|
|
1391
|
+
|
|
1392
|
+
```
|
|
1393
|
+
Task({
|
|
1394
|
+
description: "<one-line summary for logs>",
|
|
1395
|
+
subagent_type: "general",
|
|
1396
|
+
prompt: |
|
|
1397
|
+
## Task
|
|
1398
|
+
<Exactly what to do — no ambiguity>
|
|
1399
|
+
|
|
1400
|
+
## Acceptance Criteria
|
|
1401
|
+
- <criterion 1>
|
|
1402
|
+
- <criterion 2>
|
|
1403
|
+
|
|
1404
|
+
## Context
|
|
1405
|
+
<Only what is relevant for THIS task — decisions, constraints, background>
|
|
1406
|
+
|
|
1407
|
+
## Files to read
|
|
1408
|
+
- <absolute/path/to/file1.ts>
|
|
1409
|
+
- <absolute/path/to/file2.ts>
|
|
1410
|
+
|
|
1411
|
+
## Constraints
|
|
1412
|
+
- Do NOT modify <file or pattern>
|
|
1413
|
+
- <other hard stops>
|
|
1414
|
+
})
|
|
1415
|
+
```
|
|
1416
|
+
|
|
1417
|
+
### Minimality principle
|
|
1418
|
+
|
|
1419
|
+
Pass only what the subagent needs for this specific task. Do not dump job state, full analysis JSON, or conversation history. Extraneous context fills the subagent's context window with noise and increases hallucination risk.
|
|
1420
|
+
|
|
1421
|
+
Each subagent type gets scoped context:
|
|
1422
|
+
- `issue-analyzer` — issue data + codebase paths only
|
|
1423
|
+
- `context-collector` — focus areas + analysis summary (not full analysis JSON)
|
|
1424
|
+
- `task-implementer` — its specific task object + `CONTEXT_PATH` (not other tasks' data)
|
|
1425
|
+
- Reviewers — diff range + file list (not implementation details)
|
|
1426
|
+
|
|
1427
|
+
### Red Flag
|
|
1428
|
+
|
|
1429
|
+
**"The subagent can read the job state.json if it needs more context"**
|
|
1430
|
+
|
|
1431
|
+
→ Iron Law: **Orchestrator constructs context. Subagents receive, not retrieve.**
|
|
1432
|
+
|
|
1433
|
+
The subagent must not fetch orchestrator state independently. If the subagent needs information, the orchestrator puts it in the dispatch prompt. A subagent reading `state.json` on its own is a sign the orchestrator dispatch was incomplete.
|
|
1434
|
+
|
|
1435
|
+
---
|
|
1436
|
+
|
|
1437
|
+
## Automation Settings
|
|
1438
|
+
|
|
1439
|
+
| Setting | Default | Options | Description |
|
|
1440
|
+
|---------|---------|---------|-------------|
|
|
1441
|
+
| `skip_confirmation` | `true` | true/false | Skip confirmation for sub-agents |
|
|
1442
|
+
| `base_branch` | auto-detect | any | Base branch (auto-detect from repo default, or ask user) |
|
|
1443
|
+
| `max_review_iterations` | `3` | 1-5 | Max review → fix iterations |
|
|
1444
|
+
| `create_pr` | `true` | true/false | Whether to propose PR at the end |
|
|
1445
|
+
| `auto_create_pr` | `false` | true/false | Auto-create PR without asking |
|
|
1446
|
+
| `review_mode` | `"code-review"` | `"code-review"` / `"individual"` | Use 4-agent parallel or individual reviewers |
|
|
1447
|
+
| `reviewers` | `["code-ai-review", "code-boss-review", "code-style-review"]` | skill names | Individual reviewers (when review_mode=individual) |
|
|
1448
|
+
| `conditional_reviewers` | `{"code-mobx-store-review": "*.store.ts"}` | skill→pattern | Conditional reviewers |
|
|
1449
|
+
| `convention_reviewers` | `"ask"` | `"ask"` / `"all"` / `"none"` / skill names | Optional convention reviewers to include in review |
|
|
1450
|
+
| `run_final_checks` | `true` | true/false | Run lint/type-check/test |
|
|
1451
|
+
| `run_interview` | `true` | true/false | Run interview skill in Phase 0 |
|
|
1452
|
+
| `dry_run` | `false` | true/false | Plan-only mode: full Phase 0+1, no agent dispatch or git ops |
|
|
1453
|
+
| `log_prompt_sizes` | `true` | true/false | Store prompt char count per step in state.json for observability |
|
|
1454
|
+
| `plan_approval` | `true` | true/false | Show agent plan and ask approve/adjust before execution (1.3) |
|
|
1455
|
+
| `run_test_gen` | `true` | true/false | Auto-run test-gen if implementer skips tests |
|
|
1456
|
+
| `run_security_audit` | `true` | true/false | Auto-run security-audit if auth/API/DB files touched |
|
|
1457
|
+
| `run_perf_check` | `true` | true/false | Auto-run perf-check if frontend/bundle files changed |
|
|
1458
|
+
| `run_changelog` | `true` | true/false | Auto-generate changelog entry and include in PR description |
|
|
1459
|
+
| `publish_pr_review_report` | `ask` | `ask`/`comment`/`comment-and-ai-artifact`/`none`/`true`/`false` | Whether to publish a concise PR review comment and optional detailed AI markdown artifact |
|
|
1460
|
+
| `run_deploy` | `ask` | `ask`/`true`/`false` | Post-PR deploy: ask user (ask), always deploy (true), never (false) |
|
|
1461
|
+
|
|
1462
|
+
## Dry-Run Mode
|
|
1463
|
+
|
|
1464
|
+
When `dry_run: true` is set (or `--dry-run` is passed):
|
|
1465
|
+
|
|
1466
|
+
1. **Phase 0** runs fully — context collection, interviewer (if applicable), summary + confirm
|
|
1467
|
+
2. **Phase 1** runs fully — plan is built and displayed with step tree
|
|
1468
|
+
3. **Phase 2 is skipped entirely** — no sub-agents dispatched, no git operations
|
|
1469
|
+
4. **Output:** Full plan tree with agent names, input data shapes, dependencies:
|
|
1470
|
+
|
|
1471
|
+
```
|
|
1472
|
+
Dry-run plan for: issue-4141--pipeline-validation
|
|
1473
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1474
|
+
Step 1: analyze [issue-analyzer] → input: issue #4141
|
|
1475
|
+
Step 2: context [context-collector] → input: analysis result, project_dir
|
|
1476
|
+
Step 3: prepare [orchestrator] → creates: feature/pipeline-validation
|
|
1477
|
+
Step 4: implement [task-implementer × 3] → sequential, 3 tasks
|
|
1478
|
+
Step 5: sanity-check [orchestrator] → verifies commits exist
|
|
1479
|
+
Step 6: review [code-review × 4] → parallel
|
|
1480
|
+
Step 7: fix [task-implementer] → conditional: if NEEDS_FIX
|
|
1481
|
+
Step 8: checks [orchestrator] → lint + type-check + test
|
|
1482
|
+
Step 9: report [orchestrator] → aggregates all results
|
|
1483
|
+
Step 10: pr [orchestrator + gh CLI] → conditional: if create_pr
|
|
1484
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1485
|
+
Estimated sub-agent calls: 11-14 (varies with tasks and review findings)
|
|
1486
|
+
No changes will be made. Use without --dry-run to execute.
|
|
1487
|
+
```
|
|
1488
|
+
|
|
1489
|
+
5. Ask user: "Execute this plan? (yes / adjust / abort)"
|
|
1490
|
+
|
|
1491
|
+
## Budget Guards & Timeouts
|
|
1492
|
+
|
|
1493
|
+
The orchestrator enforces resource limits to prevent runaway sub-agents:
|
|
1494
|
+
|
|
1495
|
+
| Guard | Default | Description |
|
|
1496
|
+
|-------|---------|-------------|
|
|
1497
|
+
| `step_timeout_ms` | `300000` (5 min) | Max time per step. Kill agent if exceeded. |
|
|
1498
|
+
| `implementation_timeout_ms` | `600000` (10 min) | Max time for full implementation phase |
|
|
1499
|
+
| `total_job_timeout_ms` | `1800000` (30 min) | Max time for entire job. Abort to Phase 3 if exceeded. |
|
|
1500
|
+
| `max_retries_per_step` | `2` | Max retries for a failed step before asking user |
|
|
1501
|
+
|
|
1502
|
+
**Timeout behavior:**
|
|
1503
|
+
- When a step times out → mark as `failed`, record partial results if any
|
|
1504
|
+
- Ask user: "Step X timed out after Y minutes. Retry / Skip / Abort?"
|
|
1505
|
+
- If total job timeout → force transition to Phase 3 (COMPLETION) with status "timeout"
|
|
1506
|
+
|
|
1507
|
+
**Context passing rules (minimal context principle):**
|
|
1508
|
+
- `issue-analyzer`: receives only issue data + codebase paths (NOT previous job state)
|
|
1509
|
+
- `context-collector`: receives focus areas + analysis summary (NOT full analysis JSON)
|
|
1510
|
+
- `task-implementer`: receives only its specific task object + context.md path (NOT other tasks' results)
|
|
1511
|
+
- Reviewers: receive only the diff range + file list (NOT implementation details)
|
|
1512
|
+
|
|
1513
|
+
---
|
|
1514
|
+
|
|
1515
|
+
## Error Handling
|
|
1516
|
+
|
|
1517
|
+
Each step failure is classified into one of three classes with different recovery paths:
|
|
1518
|
+
|
|
1519
|
+
| Class | Meaning | Action |
|
|
1520
|
+
|-------|---------|--------|
|
|
1521
|
+
| `terminal` | Unrecoverable — cannot continue | ABORT immediately, surface actionable message |
|
|
1522
|
+
| `retryable` | Transient failure (bad output, timeout) | Auto-retry up to 2× with **identical prompt**. After 2 failures → escalate to `recoverable` |
|
|
1523
|
+
| `recoverable` | Partial success or skippable failure | Ask user with specific "continue from here / skip step / abort" options |
|
|
1524
|
+
|
|
1525
|
+
### Error Table
|
|
1526
|
+
|
|
1527
|
+
| Error | Class | Action |
|
|
1528
|
+
|-------|-------|--------|
|
|
1529
|
+
| Issue not found (404) | `terminal` | ABORT — issue-analyzer reports 404 |
|
|
1530
|
+
| Analysis returns 0 tasks | `recoverable` | Try smart fallback: (1) re-read issue with broader scope, (2) ask user to clarify, (3) if still 0 → ABORT |
|
|
1531
|
+
| Branch/worktree creation fails | `terminal` | ABORT — report git error. NEVER fall back to `git checkout -b` |
|
|
1532
|
+
| Interviewer `ready_to_proceed: false` | `terminal` | STOP — tell user which blockers remain |
|
|
1533
|
+
| Sub-agent returns malformed JSON | `retryable` | Retry with: "Output was malformed. Fix: [errors]. Try again." (max 2×) |
|
|
1534
|
+
| Sub-agent timeout | `retryable` | Retry with identical prompt (max 2×) |
|
|
1535
|
+
| Task implementation fails | `recoverable` | Ask: "Step failed. Continue remaining tasks / skip this task / abort?" |
|
|
1536
|
+
| Job-documenter returns error | `recoverable` | Log warning, continue (documentation is non-blocking) |
|
|
1537
|
+
| All reviewers fail | `recoverable` | Skip review, add warning to report, continue to checks |
|
|
1538
|
+
| Fix loop exceeds max_review_iterations | `recoverable` | Log unresolved findings, continue to checks |
|
|
1539
|
+
| Final checks fail | `recoverable` | Include in report, still propose PR (user decides) |
|
|
1540
|
+
| gh CLI not available | `recoverable` | Print PR data, user creates manually |
|
|
1541
|
+
|
|
1542
|
+
### Retry Protocol (for `retryable` errors)
|
|
1543
|
+
|
|
1544
|
+
```
|
|
1545
|
+
attempt 1: run step normally
|
|
1546
|
+
→ failure: classify error
|
|
1547
|
+
→ if retryable: retry with EXACT same prompt + "Fix these errors: [list]"
|
|
1548
|
+
→ if fails again: escalate to recoverable → ask user
|
|
1549
|
+
→ if success: continue
|
|
1550
|
+
```
|
|
1551
|
+
|
|
1552
|
+
**Critical:** On retry, use the **same prompt** stored in `state.json → step.prompt`. Never re-derive it — re-derivation causes drift.
|
|
1553
|
+
|
|
1554
|
+
---
|
|
1555
|
+
|
|
1556
|
+
## Progress Notifications
|
|
1557
|
+
|
|
1558
|
+
The orchestrator must keep the user informed during long-running execution. This is especially important for non-interactive channels (Telegram, Slack, CI).
|
|
1559
|
+
|
|
1560
|
+
**At each phase transition:**
|
|
1561
|
+
```
|
|
1562
|
+
🔄 Phase 0 → Phase 1: Building execution plan...
|
|
1563
|
+
🔄 Phase 1 → Phase 2: Executing 7 steps...
|
|
1564
|
+
✅ Phase 2 → Phase 3: Execution complete, generating report...
|
|
1565
|
+
```
|
|
1566
|
+
|
|
1567
|
+
**At each step transition (Phase 2):**
|
|
1568
|
+
```
|
|
1569
|
+
📋 Job: issue-4141--pipeline-validation
|
|
1570
|
+
├─ ✅ Analyze issue — 3 tasks found
|
|
1571
|
+
├─ ✅ Collect context — context.md ready
|
|
1572
|
+
├─ ✅ Prepare branch — feature/pipeline-validation
|
|
1573
|
+
├─ 🔄 Implement (2/3 tasks done)
|
|
1574
|
+
│ ├─ ✅ task-1: Add validation schema
|
|
1575
|
+
│ ├─ ✅ task-2: Implement validator
|
|
1576
|
+
│ └─ 🔄 task-3: Add integration tests...
|
|
1577
|
+
├─ ⏳ Review
|
|
1578
|
+
├─ ⏳ Fix (if needed)
|
|
1579
|
+
├─ ⏳ Final checks
|
|
1580
|
+
└─ ⏳ PR
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1583
|
+
**Minimum notification interval:** Every 30 seconds during long steps (implementation, review). This prevents the user from thinking the process is stuck.
|
|
1584
|
+
|
|
1585
|
+
**If notification tools are unavailable** (no MCP, no Telegram): fall back to inline text output between steps.
|
|
1586
|
+
|
|
1587
|
+
---
|
|
1588
|
+
|
|
1589
|
+
## Rules of Engagement
|
|
1590
|
+
|
|
1591
|
+
1. **DO** ALWAYS collect context in Phase 0 — project directory is MANDATORY, never assume.
|
|
1592
|
+
2. **DO** build plans dynamically based on intent — not a fixed 8-phase pipeline.
|
|
1593
|
+
3. **DO** initialize job documentation before executing any step.
|
|
1594
|
+
4. **DO** document every step result via job-documenter.
|
|
1595
|
+
5. **DO** parallelize independent tasks and reviewers where safe.
|
|
1596
|
+
6. **DO** respect dependency order — use wave-based execution for implementation.
|
|
1597
|
+
7. **DO** limit review → fix loop to max_review_iterations.
|
|
1598
|
+
8. **DO** present PR proposal to user before creating (unless auto_create_pr).
|
|
1599
|
+
9. **DO** tell user where documentation is stored at completion.
|
|
1600
|
+
10. **DO** ALWAYS use `git worktree add` for feature branches — NEVER `git checkout -b`.
|
|
1601
|
+
11. **DO** run ALL commands in the **worktree directory**, never in the original project.
|
|
1602
|
+
12. **DO** ask user for confirmation before extending plan (e.g., analyze → implement).
|
|
1603
|
+
13. **DO** send progress notifications at phase/step transitions and every 30s during long steps.
|
|
1604
|
+
14. **DO** use auto-detected `package_manager` and `run_command` — never hardcode `npm`.
|
|
1605
|
+
15. **DO NOT** ask the user anything during execution (after Phase 0) — except for critical failures and plan extension decisions.
|
|
1606
|
+
16. **DO NOT** push the branch until user confirms (or auto_create_pr).
|
|
1607
|
+
17. **DO NOT** skip job documentation — it's a core feature, not optional.
|
|
1608
|
+
18. **DO NOT** create job documentation for sub-agent results directly — orchestrator formats and sends to documenter.
|
|
1609
|
+
19. **DO** store the prompt used for each sub-agent step in `state.json → step.prompt` before dispatching — required for retry and resume.
|
|
1610
|
+
20. **DO** classify every step failure as `terminal`, `retryable`, or `recoverable` — never just abort or ask without classifying first.
|
|
1611
|
+
21. **DO** show agent-explicit plan in 1.3 and ask approve/adjust — unless `plan_approval: false`.
|
|
1612
|
+
22. **DO** run `sanity-check` after every implement step before dispatching review.
|
|
1613
|
+
23. **DO** auto-trigger `test-gen` if implementer produced no test files (unless `run_test_gen: false`).
|
|
1614
|
+
24. **DO** auto-trigger `security-audit` if diff touches auth/API/DB/env files (unless `run_security_audit: false`).
|
|
1615
|
+
25. **DO** include changelog entry in PR body (unless `run_changelog: false`).
|
|
1616
|
+
26. **DO NOT** deploy without user confirmation (unless `run_deploy: true` explicitly set).
|
|
1617
|
+
|
|
1618
|
+
---
|
|
1619
|
+
|
|
1620
|
+
## Configurable Jobs Root
|
|
1621
|
+
|
|
1622
|
+
The jobs documentation root is configurable, not hardcoded:
|
|
1623
|
+
|
|
1624
|
+
**Resolution order:**
|
|
1625
|
+
1. `JOBS_ROOT` passed explicitly by the orchestrator in the sub-agent dispatch prompt
|
|
1626
|
+
2. `GDMETAPRO_JOBS_ROOT` environment variable (if set)
|
|
1627
|
+
3. Default: `.metaproject/jobs/` ← project-local (PROJECT_DIR is known by Phase 0.2)
|
|
1628
|
+
|
|
1629
|
+
```bash
|
|
1630
|
+
JOBS_ROOT="${GDMETAPRO_JOBS_ROOT:-.metaproject/jobs}"
|
|
1631
|
+
```
|
|
1632
|
+
|
|
1633
|
+
All references to job paths in sub-agent prompts must use the resolved `JOBS_ROOT`.
|
|
1634
|
+
|
|
1635
|
+
---
|
|
1636
|
+
|
|
1637
|
+
## Post-Mortem (for failed/aborted jobs)
|
|
1638
|
+
|
|
1639
|
+
When a job ends with status `aborted`, `timeout`, or has unresolved critical issues:
|
|
1640
|
+
|
|
1641
|
+
1. **Auto-generate post-mortem** document:
|
|
1642
|
+
```markdown
|
|
1643
|
+
# Post-Mortem: <job-name>
|
|
1644
|
+
|
|
1645
|
+
## Timeline
|
|
1646
|
+
- Phase 0 completed: <timestamp>
|
|
1647
|
+
- Phase 2, step "implement" started: <timestamp>
|
|
1648
|
+
- Step "task-3" failed after 2 retries: <timestamp>
|
|
1649
|
+
- Job aborted by user: <timestamp>
|
|
1650
|
+
|
|
1651
|
+
## What Went Wrong
|
|
1652
|
+
- <Step name> failed with: <error class> — <error message>
|
|
1653
|
+
- Root cause hypothesis: <analysis>
|
|
1654
|
+
|
|
1655
|
+
## What Worked
|
|
1656
|
+
- <N> tasks completed successfully
|
|
1657
|
+
- Context collection was accurate
|
|
1658
|
+
|
|
1659
|
+
## Recommendations for Retry
|
|
1660
|
+
- Fix <specific issue> before re-running
|
|
1661
|
+
- Consider splitting task-3 into smaller subtasks
|
|
1662
|
+
- Increase step_timeout_ms if timeout was the issue
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
2. Save to `.metaproject/jobs/<job-name>/post-mortem.md`
|
|
1666
|
+
3. Include in final user message: "Post-mortem saved to `.metaproject/jobs/<job-name>/post-mortem.md`"
|
|
1667
|
+
|
|
1668
|
+
---
|
|
1669
|
+
|
|
1670
|
+
## Metrics Collection
|
|
1671
|
+
|
|
1672
|
+
The orchestrator tracks timing and token usage for each step to enable optimization over time.
|
|
1673
|
+
|
|
1674
|
+
**Collected per step:**
|
|
1675
|
+
```json
|
|
1676
|
+
{
|
|
1677
|
+
"step_id": "implement",
|
|
1678
|
+
"started_at": "2024-03-15T10:30:00Z",
|
|
1679
|
+
"completed_at": "2024-03-15T10:35:22Z",
|
|
1680
|
+
"duration_ms": 322000,
|
|
1681
|
+
"total_tokens": 84500,
|
|
1682
|
+
"status": "success",
|
|
1683
|
+
"retries": 0
|
|
1684
|
+
}
|
|
1685
|
+
```
|
|
1686
|
+
|
|
1687
|
+
**Saved to:** `.metaproject/jobs/<job-name>/metrics.json`
|
|
1688
|
+
|
|
1689
|
+
**Aggregated in report:**
|
|
1690
|
+
```markdown
|
|
1691
|
+
## Metrics
|
|
1692
|
+
| Step | Duration | Tokens | Retries |
|
|
1693
|
+
|------|----------|--------|---------|
|
|
1694
|
+
| Analyze | 45s | 12K | 0 |
|
|
1695
|
+
| Context | 30s | 8K | 0 |
|
|
1696
|
+
| Implement | 5m 22s | 84K | 0 |
|
|
1697
|
+
| Review | 1m 10s | 25K | 0 |
|
|
1698
|
+
| **Total** | **7m 47s** | **129K** | **0** |
|
|
1699
|
+
```
|
|
1700
|
+
|
|
1701
|
+
This data helps identify which steps are bottlenecks and whether budget guards need adjustment.
|