@khoavu882/doflow 0.0.0-stage → 2.0.0-beta.4
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 +132 -2
- package/bin/doflow.js +44 -0
- package/core/.antigravity-plugin/hooks.json +39 -0
- package/core/.antigravity-plugin/mcp_config.json +18 -0
- package/core/.antigravity-plugin/plugin.json +31 -0
- package/core/.claude-plugin/marketplace.json +20 -0
- package/core/.claude-plugin/plugin.json +21 -0
- package/core/.codex-plugin/marketplace.json +20 -0
- package/core/.codex-plugin/plugin.json +35 -0
- package/core/.plugin/plugin.json +19 -0
- package/core/harnesses/antigravity/hooks/pre-implementation-gate.sh +9 -0
- package/core/harnesses/antigravity/hooks/stop-check.sh +10 -0
- package/core/harnesses/claude/hooks/lib.sh +304 -0
- package/core/harnesses/claude/hooks/mcp-tool-guard.sh +20 -0
- package/core/harnesses/claude/hooks/permission-audit.sh +47 -0
- package/core/harnesses/claude/hooks/post-compact.sh +74 -0
- package/core/harnesses/claude/hooks/post-edit-lint.sh +36 -0
- package/core/harnesses/claude/hooks/post-tool-failure.sh +47 -0
- package/core/harnesses/claude/hooks/pre-bash-guard.sh +20 -0
- package/core/harnesses/claude/hooks/pre-compact.sh +43 -0
- package/core/harnesses/claude/hooks/pre-implement-gate.sh +21 -0
- package/core/harnesses/claude/hooks/session-end.sh +89 -0
- package/core/harnesses/claude/hooks/session-start.sh +5 -0
- package/core/harnesses/claude/hooks/skill-config-audit.sh +39 -0
- package/core/harnesses/claude/hooks/stop-check.sh +5 -0
- package/core/harnesses/claude/hooks/subagent-audit.sh +7 -0
- package/core/harnesses/claude/hooks/user-prompt-submit.sh +5 -0
- package/core/harnesses/claude/settings/keybindings.json +20 -0
- package/core/harnesses/claude/settings/settings.json +201 -0
- package/core/harnesses/claude/statusline/doflow-statusline.sh +49 -0
- package/core/harnesses/codex/agents/core-implementer.toml +7 -0
- package/core/harnesses/codex/agents/quality-guardian.toml +8 -0
- package/core/harnesses/codex/agents/research-writer.toml +8 -0
- package/core/harnesses/codex/agents/spec-analyst.toml +8 -0
- package/core/harnesses/codex/agents/system-architect.toml +9 -0
- package/core/harnesses/codex/config/config.toml +10 -0
- package/core/harnesses/codex/hooks/hooks.json +122 -0
- package/core/harnesses/codex/hooks/lib.sh +335 -0
- package/core/harnesses/codex/hooks/mcp-tool-guard.sh +18 -0
- package/core/harnesses/codex/hooks/post-edit-lint.impl.sh +52 -0
- package/core/harnesses/codex/hooks/post-edit-lint.sh +6 -0
- package/core/harnesses/codex/hooks/pre-bash-guard.sh +18 -0
- package/core/harnesses/codex/hooks/pre-compact.impl.sh +46 -0
- package/core/harnesses/codex/hooks/pre-compact.sh +9 -0
- package/core/harnesses/codex/hooks/pre-implement-gate.sh +19 -0
- package/core/harnesses/codex/hooks/session-end.impl.sh +92 -0
- package/core/harnesses/codex/hooks/session-end.sh +5 -0
- package/core/harnesses/codex/hooks/session-start.sh +5 -0
- package/core/harnesses/codex/hooks/stop-check.sh +8 -0
- package/core/harnesses/codex/hooks/subagent-audit.sh +8 -0
- package/core/harnesses/codex/hooks/user-prompt-submit.sh +6 -0
- package/core/harnesses/gemini/hooks/hooks.json +77 -0
- package/core/harnesses/gemini/hooks/lib.sh +302 -0
- package/core/harnesses/gemini/hooks/mcp-tool-guard.sh +21 -0
- package/core/harnesses/gemini/hooks/post-edit-lint.sh +39 -0
- package/core/harnesses/gemini/hooks/pre-bash-guard.sh +21 -0
- package/core/harnesses/gemini/hooks/pre-compact.sh +38 -0
- package/core/harnesses/gemini/hooks/pre-implement-gate.sh +22 -0
- package/core/harnesses/gemini/hooks/session-end.impl.sh +89 -0
- package/core/harnesses/gemini/hooks/session-end.sh +5 -0
- package/core/harnesses/gemini/hooks/session-start.sh +5 -0
- package/core/harnesses/gemini/settings/adapter-defaults.json +4 -0
- package/core/harnesses/kiro/agents/doflow.json +58 -0
- package/core/harnesses/kiro/hooks/doflow.json +53 -0
- package/core/harnesses/kiro/hooks/lib.sh +324 -0
- package/core/harnesses/kiro/hooks/mcp-tool-guard.sh +9 -0
- package/core/harnesses/kiro/hooks/pre-bash-guard.sh +9 -0
- package/core/harnesses/kiro/hooks/pre-implement-gate.sh +9 -0
- package/core/harnesses/kiro/hooks/session-start.sh +9 -0
- package/core/harnesses/kiro/hooks/stop-check.sh +43 -0
- package/core/harnesses/shared/hooks/ENVELOPE_MIGRATION.md +39 -0
- package/core/harnesses/shared/hooks/adapters/antigravity.js +111 -0
- package/core/harnesses/shared/hooks/adapters/arg-fields.js +19 -0
- package/core/harnesses/shared/hooks/adapters/gemini.js +114 -0
- package/core/harnesses/shared/hooks/hooks.json +47 -0
- package/core/harnesses/shared/hooks/policies/blocked-patterns.conf +91 -0
- package/core/harnesses/shared/hooks/policies/capture-failure.sh +97 -0
- package/core/harnesses/shared/hooks/policies/deny-json.sh +29 -0
- package/core/harnesses/shared/hooks/policies/lib.sh +501 -0
- package/core/harnesses/shared/hooks/policies/mcp-policy.conf +21 -0
- package/core/harnesses/shared/hooks/policies/mcp-tool-guard.sh +91 -0
- package/core/harnesses/shared/hooks/policies/pre-bash-guard.sh +328 -0
- package/core/harnesses/shared/hooks/policies/pre-implementation-gate.sh +496 -0
- package/core/harnesses/shared/hooks/policies/prompt-nudge.jq +131 -0
- package/core/harnesses/shared/hooks/policies/session-context.sh +141 -0
- package/core/harnesses/shared/hooks/policies/stop-check.sh +264 -0
- package/core/harnesses/shared/hooks/policies/subagent-audit.sh +46 -0
- package/core/harnesses/shared/hooks/policies/user-prompt-submit.sh +235 -0
- package/core/harnesses/shared/hooks/stream-hook-runner.js +590 -0
- package/core/harnesses/shared/locator/doflow-run +87 -0
- package/core/registry/advice.json +101 -0
- package/core/registry/assets.json +792 -0
- package/core/registry/capabilities.json +120 -0
- package/core/registry/contracts.json +189 -0
- package/core/registry/external-tools.json +191 -0
- package/core/registry/harnesses.json +2062 -0
- package/core/registry/lifecycle.json +231 -0
- package/core/registry/mcp.json +18 -0
- package/core/registry/models.json +79 -0
- package/core/registry/readiness-templates.json +118 -0
- package/core/registry/routes.json +47 -0
- package/core/registry/storage.json +1061 -0
- package/core/registry/verification.json +258 -0
- package/core/registry/workflows.json +790 -0
- package/core/shared/agent-specs/core-implementer.md +73 -0
- package/core/shared/agent-specs/quality-guardian.md +28 -0
- package/core/shared/agent-specs/research-writer.md +31 -0
- package/core/shared/agent-specs/spec-analyst.md +33 -0
- package/core/shared/agent-specs/system-architect.md +29 -0
- package/core/shared/guidance/DOFLOW_CORE.md +8 -0
- package/core/shared/guidance/FLAGS.md +25 -0
- package/core/shared/guidance/PRINCIPLES.md +61 -0
- package/core/shared/guidance/VERSION +1 -0
- package/core/shared/guidance/mcp/MCP_Context7.md +18 -0
- package/core/shared/guidance/mcp/MCP_Sequential.md +17 -0
- package/core/shared/guidance/modes/MODE_Brainstorming.md +46 -0
- package/core/shared/guidance/modes/MODE_DeepResearch.md +69 -0
- package/core/shared/guidance/modes/MODE_Introspection.md +33 -0
- package/core/shared/guidance/modes/MODE_Orchestration.md +57 -0
- package/core/shared/guidance/modes/MODE_Task_Management.md +74 -0
- package/core/shared/guidance/pointers/claude-gemini.md +2 -0
- package/core/shared/guidance/pointers/codex.md +6 -0
- package/core/shared/guidance/references/ARTIFACT_FORMAT.md +373 -0
- package/core/shared/guidance/references/ARTIFACT_VOICE.md +104 -0
- package/core/shared/guidance/references/CONSTITUTION_BASE.md +47 -0
- package/core/shared/guidance/references/DIAGRAM_GUIDE.md +161 -0
- package/core/shared/guidance/references/DOFLOW_CHAIN.md +87 -0
- package/core/shared/guidance/references/EVIDENCE_LEDGER.md +93 -0
- package/core/shared/guidance/references/MODEL_SELECTION.md +74 -0
- package/core/shared/guidance/references/ORCHESTRATION.md +36 -0
- package/core/shared/guidance/references/RESEARCH_CONFIG.md +21 -0
- package/core/shared/guidance/references/WORKFLOW_HANDOFF.md +81 -0
- package/core/shared/guidance/rules/RULE_01_SAFETY.md +25 -0
- package/core/shared/guidance/rules/RULE_02_WORKFLOW.md +23 -0
- package/core/shared/guidance/rules/RULE_03_QUALITY.md +14 -0
- package/core/shared/guidance/rules/RULE_04_QUESTIONS.md +46 -0
- package/core/shared/scripts/doflow/assets/mermaid-theme.json +46 -0
- package/core/shared/scripts/doflow/bash/do-exec-paths.sh +167 -0
- package/core/shared/scripts/doflow/bash/do-git-state.sh +546 -0
- package/core/shared/scripts/doflow/bash/do-parallel-check.sh +208 -0
- package/core/shared/scripts/doflow/bash/do-paths.sh +347 -0
- package/core/shared/scripts/doflow/bash/do-prereqs.sh +66 -0
- package/core/shared/scripts/doflow/bash/do-review-package.sh +127 -0
- package/core/shared/scripts/doflow/bash/do-task-brief.sh +698 -0
- package/core/shared/scripts/doflow/bash/render-audit.sh +224 -0
- package/core/shared/scripts/doflow/bash/render-diagrams.sh +177 -0
- package/core/shared/scripts/doflow/bash/render-puml.sh +223 -0
- package/core/shared/scripts/doflow/bash/sync-context.sh +66 -0
- package/core/shared/scripts/doflow/bash/validate-artifacts.sh +526 -0
- package/core/shared/scripts/doflow/bin/doflow-run +592 -0
- package/core/shared/skills/do/SKILL.md +128 -0
- package/core/shared/skills/do/references/estimation.md +13 -0
- package/core/shared/skills/do/references/pm_routing.md +25 -0
- package/core/shared/skills/do/references/tool_matrix.md +52 -0
- package/core/shared/skills/do-brainstorm/SKILL.md +252 -0
- package/core/shared/skills/do-code-review/README.md +49 -0
- package/core/shared/skills/do-code-review/SKILL.md +333 -0
- package/core/shared/skills/do-code-review/assets/sample_c_clean.c +71 -0
- package/core/shared/skills/do-code-review/assets/sample_c_smells.c +66 -0
- package/core/shared/skills/do-code-review/assets/sample_cpp_shift.cpp +19 -0
- package/core/shared/skills/do-code-review/assets/sample_csharp_clean.cs +100 -0
- package/core/shared/skills/do-code-review/assets/sample_csharp_smells.cs +78 -0
- package/core/shared/skills/do-code-review/assets/sample_java_clean.java +55 -0
- package/core/shared/skills/do-code-review/assets/sample_java_smells.java +56 -0
- package/core/shared/skills/do-code-review/assets/sample_json_clean.json +7 -0
- package/core/shared/skills/do-code-review/assets/sample_markdown_clean.md +30 -0
- package/core/shared/skills/do-code-review/assets/sample_markdown_smells.md +29 -0
- package/core/shared/skills/do-code-review/assets/sample_shell_heredoc.sh +38 -0
- package/core/shared/skills/do-code-review/assets/sample_shell_smells.sh +15 -0
- package/core/shared/skills/do-code-review/assets/sample_typescript_strings.ts +36 -0
- package/core/shared/skills/do-code-review/assets/sample_yaml_smells.yaml +6 -0
- package/core/shared/skills/do-code-review/content-types/config.md +83 -0
- package/core/shared/skills/do-code-review/content-types/markdown.md +132 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_c_clean_quality.json +79 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_c_smells_quality.json +169 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_cpp_shift_quality.json +49 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_csharp_clean_quality.json +149 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_csharp_smells_quality.json +157 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_java_clean_quality.json +67 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_java_smells_quality.json +97 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_json_clean_quality.json +33 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_markdown_clean_quality.json +1 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_markdown_smells_quality.json +16 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_shell_heredoc_quality.json +54 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_shell_smells_quality.json +91 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_typescript_strings_quality.json +60 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_yaml_smells_quality.json +46 -0
- package/core/shared/skills/do-code-review/languages/c.md +103 -0
- package/core/shared/skills/do-code-review/languages/cpp.md +103 -0
- package/core/shared/skills/do-code-review/languages/csharp.md +97 -0
- package/core/shared/skills/do-code-review/languages/dart.md +108 -0
- package/core/shared/skills/do-code-review/languages/go.md +92 -0
- package/core/shared/skills/do-code-review/languages/java.md +103 -0
- package/core/shared/skills/do-code-review/languages/kotlin.md +88 -0
- package/core/shared/skills/do-code-review/languages/php.md +109 -0
- package/core/shared/skills/do-code-review/languages/python.md +94 -0
- package/core/shared/skills/do-code-review/languages/ruby.md +105 -0
- package/core/shared/skills/do-code-review/languages/rust.md +99 -0
- package/core/shared/skills/do-code-review/languages/shell.md +90 -0
- package/core/shared/skills/do-code-review/languages/swift.md +88 -0
- package/core/shared/skills/do-code-review/languages/typescript.md +97 -0
- package/core/shared/skills/do-code-review/review-policy.json +47 -0
- package/core/shared/skills/do-code-review/rules/universal.md +49 -0
- package/core/shared/skills/do-code-review/scripts/code_quality_checker.py +1696 -0
- package/core/shared/skills/do-code-review/scripts/doc_quality_checker.py +532 -0
- package/core/shared/skills/do-code-review/scripts/pr_analyzer.py +620 -0
- package/core/shared/skills/do-code-review/scripts/review_report_generator.py +505 -0
- package/core/shared/skills/do-constitution/SKILL.md +72 -0
- package/core/shared/skills/do-design/SKILL.md +212 -0
- package/core/shared/skills/do-diagnose/SKILL.md +156 -0
- package/core/shared/skills/do-diagnose/references/code_audit.md +15 -0
- package/core/shared/skills/do-diagnose/references/refactoring.md +12 -0
- package/core/shared/skills/do-diagnose/references/root_cause.md +17 -0
- package/core/shared/skills/do-document/SKILL.md +81 -0
- package/core/shared/skills/do-document/references/api-reference.md +42 -0
- package/core/shared/skills/do-document/references/deep_research.md +18 -0
- package/core/shared/skills/do-document/references/embedded-research.md +11 -0
- package/core/shared/skills/do-document/references/implementation-flow.md +105 -0
- package/core/shared/skills/do-document/references/index_generator.md +9 -0
- package/core/shared/skills/do-document/references/user-guide.md +22 -0
- package/core/shared/skills/do-execute-plan/SKILL.md +261 -0
- package/core/shared/skills/do-execute-plan/references/handoff_record.md +57 -0
- package/core/shared/skills/do-execute-plan/references/parallel_dispatch.md +92 -0
- package/core/shared/skills/do-execute-plan/references/readiness_gate.md +155 -0
- package/core/shared/skills/do-execute-plan/references/run_position.md +63 -0
- package/core/shared/skills/do-execute-plan/references/scaffold.md +441 -0
- package/core/shared/skills/do-execute-plan/references/task_attempts.md +41 -0
- package/core/shared/skills/do-flow/SKILL.md +186 -0
- package/core/shared/skills/do-flow/references/task_classes.md +134 -0
- package/core/shared/skills/do-git/SKILL.md +115 -0
- package/core/shared/skills/do-git/references/hotfix-ritual.md +44 -0
- package/core/shared/skills/do-git/references/lifecycle-policy.md +54 -0
- package/core/shared/skills/do-git/references/release-ritual.md +64 -0
- package/core/shared/skills/do-implement/SKILL.md +222 -0
- package/core/shared/skills/do-plan/SKILL.md +219 -0
- package/core/shared/skills/do-test/SKILL.md +113 -0
- package/core/shared/templates/doflow/constitution-template.md +28 -0
- package/core/shared/templates/doflow/data-model-template.md +169 -0
- package/core/shared/templates/doflow/design-template.md +193 -0
- package/core/shared/templates/doflow/external-contract-template.md +35 -0
- package/core/shared/templates/doflow/intent-template.md +45 -0
- package/core/shared/templates/doflow/plan-template.md +151 -0
- package/core/shared/templates/doflow/question-log-template.md +51 -0
- package/core/shared/templates/doflow/requirement-template.md +126 -0
- package/core/shared/templates/doflow/specs-template.md +55 -0
- package/core/shared/templates/doflow/state-template.md +59 -0
- package/core/shared/workflows/do-flow-chain.md +17 -0
- package/package.json +48 -4
- package/src/adapters/antigravity/index.js +631 -0
- package/src/adapters/claude/index.js +548 -0
- package/src/adapters/claude/mcp.js +94 -0
- package/src/adapters/codex/agents.js +208 -0
- package/src/adapters/codex/config.js +272 -0
- package/src/adapters/codex/hooks.js +203 -0
- package/src/adapters/codex/index.js +707 -0
- package/src/adapters/codex/mcp.js +271 -0
- package/src/adapters/codex/native-projection.js +34 -0
- package/src/adapters/copilot/index.js +413 -0
- package/src/adapters/copy-tree.js +620 -0
- package/src/adapters/gemini/hooks.js +210 -0
- package/src/adapters/gemini/index.js +390 -0
- package/src/adapters/hook-commands.js +60 -0
- package/src/adapters/index.js +106 -0
- package/src/adapters/kiro/index.js +310 -0
- package/src/adapters/mcp-entries.js +331 -0
- package/src/adapters/opencode/index.js +466 -0
- package/src/adapters/pi/index.js +279 -0
- package/src/adapters/pi/json-members.js +185 -0
- package/src/adapters/pi/mcp.js +373 -0
- package/src/adapters/resolve-source.js +19 -0
- package/src/cli/commands/install.js +218 -0
- package/src/cli/commands/list-backups.js +21 -0
- package/src/cli/commands/reconcile.js +120 -0
- package/src/cli/commands/remove.js +82 -0
- package/src/cli/commands/rollback.js +172 -0
- package/src/cli/commands/self-update.js +33 -0
- package/src/cli/commands/status.js +138 -0
- package/src/cli/commands/tools.js +92 -0
- package/src/cli/commands/update.js +162 -0
- package/src/cli/index.js +568 -0
- package/src/cli/runtime-commands.js +281 -0
- package/src/cli/shared.js +218 -0
- package/src/helper/bash-helper.js +34 -0
- package/src/helper/git.js +24 -0
- package/src/helper/guardrails.js +49 -0
- package/src/helper/harness-paths.js +140 -0
- package/src/helper/marker-merge.js +116 -0
- package/src/helper/prompt.js +61 -0
- package/src/helper/repo-root.js +29 -0
- package/src/helper/settings-merge.js +151 -0
- package/src/helper/settings-scope.js +33 -0
- package/src/helper/toml.js +244 -0
- package/src/install/backup-set.js +149 -0
- package/src/install/backup.js +724 -0
- package/src/install/context.js +58 -0
- package/src/install/manifest.js +145 -0
- package/src/install/mcp.js +254 -0
- package/src/install/paths.js +84 -0
- package/src/install/targets.js +90 -0
- package/src/install/tool-lifecycle.js +151 -0
- package/src/lifecycle/bash-availability.js +25 -0
- package/src/lifecycle/index.js +812 -0
- package/src/lifecycle/mcp-index.js +28 -0
- package/src/lifecycle/policies.js +73 -0
- package/src/lifecycle/view.js +175 -0
- package/src/registry/index.js +611 -0
- package/src/release/build-package.js +91 -0
- package/src/release/changelog-section.js +70 -0
- package/src/release/sync-plugin-versions.js +66 -0
- package/src/runtime/advice/cli.js +283 -0
- package/src/runtime/advice/client.js +324 -0
- package/src/runtime/advice/config.js +189 -0
- package/src/runtime/advice/doctor.js +169 -0
- package/src/runtime/advice/endpoint-guard.js +134 -0
- package/src/runtime/advice/kinds.js +154 -0
- package/src/runtime/advice/providers/ollama-systemone.js +209 -0
- package/src/runtime/advice/record.js +166 -0
- package/src/runtime/advice/registry.js +170 -0
- package/src/runtime/advice/strength.js +66 -0
- package/src/runtime/brief-tools.js +342 -0
- package/src/runtime/c4-project.js +371 -0
- package/src/runtime/capability-router.js +484 -0
- package/src/runtime/checkouts.js +170 -0
- package/src/runtime/claims.js +468 -0
- package/src/runtime/cli-result.js +55 -0
- package/src/runtime/cli.js +678 -0
- package/src/runtime/command-detect.js +516 -0
- package/src/runtime/context-pack.js +492 -0
- package/src/runtime/decision-register.js +493 -0
- package/src/runtime/evidence-ledger.js +338 -0
- package/src/runtime/failure/capture.js +272 -0
- package/src/runtime/failure/classifier.js +68 -0
- package/src/runtime/failure/cli.js +178 -0
- package/src/runtime/failure/home.js +64 -0
- package/src/runtime/failure/store.js +226 -0
- package/src/runtime/feature-resolve.js +79 -0
- package/src/runtime/freshness.js +177 -0
- package/src/runtime/health.js +863 -0
- package/src/runtime/history-compactor.js +237 -0
- package/src/runtime/implementation-gate.js +321 -0
- package/src/runtime/inventory/coverage.js +218 -0
- package/src/runtime/inventory/identity.js +65 -0
- package/src/runtime/inventory/index.js +705 -0
- package/src/runtime/inventory/precedence.js +134 -0
- package/src/runtime/inventory/read-scopes.js +131 -0
- package/src/runtime/inventory/siblings.js +192 -0
- package/src/runtime/knowledge/chunker.js +124 -0
- package/src/runtime/knowledge/hybrid.js +149 -0
- package/src/runtime/knowledge/index-store.js +145 -0
- package/src/runtime/knowledge/retrieval.js +194 -0
- package/src/runtime/leak-scan.js +185 -0
- package/src/runtime/lifecycle/cli.js +276 -0
- package/src/runtime/lifecycle/event-store.js +340 -0
- package/src/runtime/lifecycle/fold.js +353 -0
- package/src/runtime/lifecycle/followup.js +432 -0
- package/src/runtime/lifecycle/goal.js +249 -0
- package/src/runtime/lifecycle/intent-writer.js +86 -0
- package/src/runtime/lifecycle/overview.js +292 -0
- package/src/runtime/lifecycle/release.js +241 -0
- package/src/runtime/lifecycle/report-store.js +221 -0
- package/src/runtime/lifecycle/retention.js +212 -0
- package/src/runtime/lifecycle/root.js +71 -0
- package/src/runtime/lifecycle/status.js +353 -0
- package/src/runtime/lifecycle/store-upkeep.js +393 -0
- package/src/runtime/locator-resolve.js +158 -0
- package/src/runtime/mask.js +210 -0
- package/src/runtime/mcp-consultations.js +412 -0
- package/src/runtime/mcp-reach.js +157 -0
- package/src/runtime/model-router.js +153 -0
- package/src/runtime/outcome.js +467 -0
- package/src/runtime/reach.js +148 -0
- package/src/runtime/readiness-record.js +150 -0
- package/src/runtime/readiness.js +435 -0
- package/src/runtime/recovery.js +282 -0
- package/src/runtime/research-request.js +231 -0
- package/src/runtime/retrieval-plan.js +578 -0
- package/src/runtime/scaffold/artifacts.js +217 -0
- package/src/runtime/scaffold/fingerprint.js +56 -0
- package/src/runtime/scaffold/generate.js +911 -0
- package/src/runtime/scaffold/languages.js +245 -0
- package/src/runtime/storage/cli.js +64 -0
- package/src/runtime/storage/engine.js +249 -0
- package/src/runtime/storage/registry.js +130 -0
- package/src/runtime/storage/roots.js +63 -0
- package/src/runtime/storage/rules.js +282 -0
- package/src/runtime/storage/upkeep.js +243 -0
- package/src/runtime/storage/work-status.js +326 -0
- package/src/runtime/task-attempts.js +415 -0
- package/src/runtime/task-classifier.js +550 -0
- package/src/runtime/task-scope.js +130 -0
- package/src/runtime/task-state.js +176 -0
- package/src/runtime/trace/indicators.js +235 -0
- package/src/runtime/trace/ledger.js +626 -0
- package/src/runtime/trace/render.js +76 -0
- package/src/runtime/trace/views.js +459 -0
- package/src/runtime/verification/contract-runner.js +341 -0
- package/src/runtime/verification/engine.js +1461 -0
- package/src/runtime/verification/registry.js +130 -0
- package/src/runtime/verification/scope-bound.js +418 -0
- package/src/runtime/verification/test-selection.js +172 -0
- package/src/runtime/workflow-engine.js +588 -0
- package/src/runtime/workflow-orchestrator.js +953 -0
- package/src/runtime/worktree.js +340 -0
- package/src/state/index.js +193 -0
- package/src/state/lockfile.js +136 -0
- package/src/state/run-lock.js +408 -0
- package/types/node-commonjs.d.ts +68 -0
- package/types/runtime.d.ts +91 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# {Feature Name} — Implementation Flow
|
|
2
|
+
|
|
3
|
+
> **Template version**: 1.0
|
|
4
|
+
>
|
|
5
|
+
> Reference for `/do-document --type impl`. It explains what each section of a generated
|
|
6
|
+
> `implementation-flow.md` must contain and where to pull the content from — it is not itself a
|
|
7
|
+
> filled-in implementation doc. Replace `{placeholders}` with real content when writing the actual
|
|
8
|
+
> file to `agent-docs/doflow/<slug>/implementation-flow.md` for the active feature (same
|
|
9
|
+
> slug-resolution mechanism the rest of the doflow chain already uses for
|
|
10
|
+
> `requirement.md`/`design.md`/`plan.md` — do not introduce a second one).
|
|
11
|
+
>
|
|
12
|
+
> Every section below is narrative except **Changed Surfaces**, which is a table — comparative,
|
|
13
|
+
> evidentiary data (a set of paths each paired with what changed) falls under the guidance tree's
|
|
14
|
+
> `references/ARTIFACT_FORMAT.md` §6's rule to lay that out column-wise rather than as prose or
|
|
15
|
+
> nested bullets.
|
|
16
|
+
>
|
|
17
|
+
> No section here is ID-bearing. This file — and any `implementation-flow.md` generated from it —
|
|
18
|
+
> does not participate in `validate-artifacts.sh`'s index/detail check.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Header [Required]
|
|
23
|
+
|
|
24
|
+
Mirrors the metadata-header convention `design-template.md` already uses — a single line of
|
|
25
|
+
bold-label/value pairs separated by `·`, with chain artifacts cross-referenced as plain relative
|
|
26
|
+
paths (not markdown link syntax, matching `design-template.md`'s `./requirement.md`) — extended
|
|
27
|
+
with `Branch` and links to `./design.md` and `./plan.md` in addition to `./requirement.md`, since an
|
|
28
|
+
implementation summary sits downstream of all three:
|
|
29
|
+
|
|
30
|
+
**Feature:** `[NNN-slug]` · **Branch:** `[branch-name]` · **Status:** Draft · **Created:** `[DATE]`
|
|
31
|
+
· **Requirement:** ./requirement.md · **Design:** ./design.md · **Plan:** ./plan.md
|
|
32
|
+
|
|
33
|
+
- **Feature / Branch** — resolved via the same active-feature mechanism the rest of the doflow
|
|
34
|
+
chain uses; do not hand-derive the slug from the directory name or guess it from `git branch`
|
|
35
|
+
independently.
|
|
36
|
+
- **Status** — `Draft` while the summary is being written, `In-Review` once posted for review,
|
|
37
|
+
`Done` once accepted. This is the impl doc's own status, not `plan.md`'s task-checklist status.
|
|
38
|
+
- **Created** — the date this implementation summary was generated, not when the feature started.
|
|
39
|
+
- **Requirement / Design / Plan** — relative links into the same feature directory, exactly like
|
|
40
|
+
`design-template.md`'s header links to `./requirement.md`. Every doflow feature has all three by
|
|
41
|
+
the time `--type impl` is run (implementation follows planning), so none of these three links is
|
|
42
|
+
optional.
|
|
43
|
+
|
|
44
|
+
## Summary [Required]
|
|
45
|
+
|
|
46
|
+
1–3 sentences: what was built, in plain language a reader who has not touched the chain artifacts
|
|
47
|
+
can follow. State the outcome, not the process — "added X so that Y" rather than a chronology of
|
|
48
|
+
commits.
|
|
49
|
+
|
|
50
|
+
`{one-to-three-sentence summary of what shipped}`
|
|
51
|
+
|
|
52
|
+
## Key Decisions [Required]
|
|
53
|
+
|
|
54
|
+
Narrative, not a table — decisions read as reasoning, not comparable rows. Cover the choices made
|
|
55
|
+
*during* implementation that a reader would otherwise have to reconstruct from the diff: which
|
|
56
|
+
approach was taken when more than one was viable, why a particular library/pattern/boundary was
|
|
57
|
+
used, and anywhere the build surfaced a question `design.md` left open.
|
|
58
|
+
|
|
59
|
+
Where a decision traces back to something `design.md` already recorded, reference it by section and
|
|
60
|
+
ID rather than restating it — e.g. "Followed design.md §3 C2's boundary: the adapter owns
|
|
61
|
+
serialization, per the Components & Boundaries split" or "Accepted the risk noted in design.md §7
|
|
62
|
+
R2; see below for what that cost in practice." Decisions with no design.md antecedent (something
|
|
63
|
+
that only became a decision once code was being written) still belong here, just without a
|
|
64
|
+
back-reference.
|
|
65
|
+
|
|
66
|
+
`{narrative: what was decided and why, cross-referencing design.md §3/§7 where applicable}`
|
|
67
|
+
|
|
68
|
+
## Deviations from Plan/Design [Required]
|
|
69
|
+
|
|
70
|
+
Narrative. Anywhere the actual implementation diverged from what `plan.md`'s tasks or `design.md`'s
|
|
71
|
+
shape called for — a task done differently than scoped, a component boundary that moved, a step
|
|
72
|
+
skipped or added — explain what changed and why. This is what lets a future reader trust
|
|
73
|
+
`plan.md`/`design.md` as history without re-diffing them against the code.
|
|
74
|
+
|
|
75
|
+
If nothing diverged, write exactly:
|
|
76
|
+
|
|
77
|
+
`None — implemented as designed.`
|
|
78
|
+
|
|
79
|
+
## Changed Surfaces [Required]
|
|
80
|
+
|
|
81
|
+
A table, populated from `git diff` (or the equivalent comparison against the branch's base) for the
|
|
82
|
+
feature's commits — not hand-recalled from memory. One row per changed path; "what changed" is a
|
|
83
|
+
short phrase, not a full diff.
|
|
84
|
+
|
|
85
|
+
| Path | What Changed |
|
|
86
|
+
|------|---------------|
|
|
87
|
+
| `{path/to/file}` | `{one-line description of the change}` |
|
|
88
|
+
|
|
89
|
+
## Testing & Verification [Required]
|
|
90
|
+
|
|
91
|
+
Narrative: what was run and how the change was verified — unit/integration tests executed, manual
|
|
92
|
+
checks performed, and their outcome. Reference the plan's verification bar or design's acceptance
|
|
93
|
+
criteria where the testing directly maps to one of them, but describe what actually happened, not
|
|
94
|
+
what was merely planned.
|
|
95
|
+
|
|
96
|
+
`{narrative: tests run, manual verification performed, and results}`
|
|
97
|
+
|
|
98
|
+
## Follow-ups / Known Gaps [Required]
|
|
99
|
+
|
|
100
|
+
Narrative. Anything intentionally left undone — known limitations, deferred work, follow-up tasks
|
|
101
|
+
worth tracking separately — belongs here so it isn't lost once the feature is marked complete.
|
|
102
|
+
|
|
103
|
+
If there are none, write exactly:
|
|
104
|
+
|
|
105
|
+
`None.`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Project Index & Architecture Reference
|
|
2
|
+
|
|
3
|
+
Methodology for creating whole-repository knowledge indexes:
|
|
4
|
+
|
|
5
|
+
## Index Sections
|
|
6
|
+
1. **System Overview**: High-level purpose, tech stack, and primary runtime architecture.
|
|
7
|
+
2. **Directory Map**: Key directories, responsibilities, and boundary layers.
|
|
8
|
+
3. **Core Workflows**: End-to-end trace of primary data flows and API request paths.
|
|
9
|
+
4. **Key Invariants**: Non-obvious architectural constraints and governance rules.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# User Guide Template
|
|
2
|
+
# Use this template for creating user-facing guides and tutorials.
|
|
3
|
+
|
|
4
|
+
## 🎯 Goal: [Feature Name]
|
|
5
|
+
What the user will be able to achieve after following this guide.
|
|
6
|
+
|
|
7
|
+
### 📋 Prerequisites
|
|
8
|
+
- Required tools/accounts.
|
|
9
|
+
- Necessary permissions.
|
|
10
|
+
- Prior knowledge needed.
|
|
11
|
+
|
|
12
|
+
### 🚶 Step-by-Step Instructions
|
|
13
|
+
1. **Step One**: Action $\rightarrow$ Expected Result.
|
|
14
|
+
2. **Step Two**: Action $\rightarrow$ Expected Result.
|
|
15
|
+
- *Tip*: Add a pro-tip or common pitfall here.
|
|
16
|
+
3. **Step Three**: Final validation.
|
|
17
|
+
|
|
18
|
+
### ✅ How to Verify
|
|
19
|
+
How the user knows they succeeded.
|
|
20
|
+
|
|
21
|
+
### ❓ Troubleshooting
|
|
22
|
+
Common issues and their resolutions.
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: do-execute-plan
|
|
3
|
+
description: "Execute plan.md's task checklist: subagent-driven orchestration over named specialist archetypes (system-architect, core-implementer, quality-guardian) with prerequisite gates, readiness contracts, and parallel execution. Use whenever requirement.md, design.md, and plan.md exist and the next step is building the plan's tasks through subagents, or when the user says 'execute the plan', 'run the plan', 'start building', or 'implement phase N'. Always activate this skill to orchestrate multi-task implementation plans with write-set isolation."
|
|
4
|
+
argument-hint: "[--scope next|phase:N|all|resume] [--review] [--scaffold]"
|
|
5
|
+
effort: high
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# do-execute-plan
|
|
9
|
+
|
|
10
|
+
Phase 4 of the DoFlow chain. Executes the task checklist in `plan.md` using specialist subagent archetypes with readiness validation and progressive disclosure.
|
|
11
|
+
|
|
12
|
+
## Invocation
|
|
13
|
+
```text
|
|
14
|
+
/do-execute-plan [--scope next|phase:N|all|resume] [--review] [--scaffold]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Behavioral Flow
|
|
18
|
+
|
|
19
|
+
1. **Resolve State & Prerequisite Gate**:
|
|
20
|
+
- Every DoFlow runtime call in this skill — `paths`, `prereqs`, `parallel-check`, `task-brief` —
|
|
21
|
+
goes through the runtime seam. Resolve it **once** here and reuse `$DOFLOW` for all four:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Resolve the DoFlow runtime: nearest project install wins, then the global one.
|
|
25
|
+
D=$PWD; while [ "$D" != / ] && [ ! -x "$D/.doflow/scripts/doflow/bin/doflow-run" ]; do D=$(dirname "$D"); done
|
|
26
|
+
DOFLOW="$D/.doflow/scripts/doflow/bin/doflow-run"
|
|
27
|
+
[ -x "$DOFLOW" ] || DOFLOW="$HOME/.doflow/scripts/doflow/bin/doflow-run"
|
|
28
|
+
[ -x "$DOFLOW" ] || { echo "doflow: no runtime found in any .doflow/ above $PWD, nor at $HOME/.doflow. Run: npx @khoavu882/doflow install -t <harness>" >&2; exit 2; }
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Run every command below from the project root — the walk-up starts at `$PWD`. On exit 2, print the message verbatim and stop; it names every path searched.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
"$DOFLOW" paths --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Enforce hard prerequisite gate: `"$DOFLOW" prereqs --require-plan` (requires
|
|
38
|
+
`requirement.md`, `design.md`, `plan.md`).
|
|
39
|
+
- Read `<feature_dir>/state.md` if it exists — the cross-session execution record, per
|
|
40
|
+
`MODE_Task_Management.md`'s "Session Start" sequence. A `complete` row in its Task Ledger means
|
|
41
|
+
that task is done: never re-dispatch it, resume at the first task without one. No `state.md`
|
|
42
|
+
yet is the normal first-run case, not a gap.
|
|
43
|
+
|
|
44
|
+
2. **Propose the Task Class; the Runtime Validates It**:
|
|
45
|
+
- Name exactly one class id for the work this run executes. `/do-flow` passes one when it
|
|
46
|
+
invoked this skill; a user who named one settles it; otherwise derive it from `plan.md`.
|
|
47
|
+
```bash
|
|
48
|
+
"$DOFLOW" classify --task-class "<proposed>" --calling-skill do-execute-plan --json
|
|
49
|
+
```
|
|
50
|
+
Branch on the returned `outcome` field, not the exit code.
|
|
51
|
+
- **`ACCEPTED`** — the returned `workflow` is this run's plan of record; read `stages`, `gates` and `handoff` off it rather than from memory.
|
|
52
|
+
- **`REJECTED`** — **stop.** Print `message` verbatim (it already names `validClasses` and any `suggestions`), ask the user to choose from `validClasses`, then re-validate. Never substitute `feature`.
|
|
53
|
+
A rejection may be about **you** rather than the class (`reason: caller-not-a-stage`). Then the fix is to propose one of the classes in `fit.hostingClasses`, or to hand the work to the skill this class names for the stage you meant — not to re-propose the same class.
|
|
54
|
+
- **Exit 2** — surface the message verbatim and stop.
|
|
55
|
+
|
|
56
|
+
- Take the readiness template from the returned workflow's implementation stage: the entry in
|
|
57
|
+
`stages[]` with `mutatesSource: true`, whose `readinessTemplate` names the contract step 4
|
|
58
|
+
grades against. Do not pick a template by hand.
|
|
59
|
+
- If the accepted workflow has no stage with `mutatesSource: true` — read
|
|
60
|
+
`hasImplementationStage` off the returned object rather than recalling which classes those are
|
|
61
|
+
— this skill is the wrong tool for that class. Say so and stop rather than executing tasks the
|
|
62
|
+
workflow never declared.
|
|
63
|
+
- Also derive `<expected gate id>`: among `gates[]`, the one entry whose `afterStage` equals the
|
|
64
|
+
stage immediately preceding this skill's own stage in `stageIds[]` (`gate-a` in `feature`, since
|
|
65
|
+
`gate-a`'s `afterStage` is `planning`, the stage right before `implementation`) — `null` if no
|
|
66
|
+
gate is anchored there. No shipped workflow anchors two gates to the same stage, so this is
|
|
67
|
+
always at most one entry; do not hardcode `gate-a`, derive it this way so a differently-shaped
|
|
68
|
+
workflow's own gate is found the same way. Step 3 needs this to tell "the gate that belongs to
|
|
69
|
+
this stage" apart from any other gate `catch-up` might stop on.
|
|
70
|
+
|
|
71
|
+
3. **Position the Run, and Resolve the Approval Gate Standing Before This Stage**:
|
|
72
|
+
- This stage is the one the accepted workflow anchors an `approval`-kind gate directly *before*
|
|
73
|
+
(`gate-a`, "Before implementation", in the `feature` workflow — the gate whose `afterStage` is
|
|
74
|
+
the stage preceding this skill's own). `/do-plan` deliberately leaves it open: an approval gate
|
|
75
|
+
is answered by the human who is asked, and this skill is where that question lands when nothing
|
|
76
|
+
else has already asked it. Until it is decided, the state machine refuses this stage's own
|
|
77
|
+
completion, so resolve it here rather than at step 10.
|
|
78
|
+
- One `orchestrate --action catch-up` call positions the run, stopping either on this stage or
|
|
79
|
+
on any gate in the way; **branch on its `caughtUpTo` / `reason`, not on the exit code.** That
|
|
80
|
+
call and every branch off it — the expected gate, an earlier stage's gate, a blocking mutating
|
|
81
|
+
stage, an already-recorded stage, a finished run — are in this skill's own
|
|
82
|
+
`references/run_position.md`. Read it before running this step; carry the `caughtUpTo` it
|
|
83
|
+
lands on to step 10.
|
|
84
|
+
|
|
85
|
+
4. **Readiness Evaluation (Contract State)**:
|
|
86
|
+
- Evaluate a task's contract before dispatching it, run from the project the task belongs to.
|
|
87
|
+
This skill is an orchestrated run, and says so:
|
|
88
|
+
```bash
|
|
89
|
+
"$DOFLOW" readiness --task-class "<template from step 2>" --task-id "<task id>" --mode workflow --json
|
|
90
|
+
"$DOFLOW" evidence --task-id "<task id>" --json
|
|
91
|
+
```
|
|
92
|
+
- **Both `--task-class` and `--task-id` are required.** Omitting either exits 2 and names the
|
|
93
|
+
valid set. Pass them explicitly rather than letting anything default: a verdict computed for
|
|
94
|
+
another task, or against another class's contract, is worse than no verdict.
|
|
95
|
+
- **Act on `stageEntry.decision`, not the exit code and not your own reading of `state`.** The
|
|
96
|
+
entry policy is the runtime's: `ENTER` → dispatch the task; `GATHER_FIRST` → gather the named
|
|
97
|
+
requirements before dispatching; `ASK_USER` → ask the owed decision and wait; `STOP` → stop
|
|
98
|
+
and surface the conflicted claim. The four underlying states remain the entire state
|
|
99
|
+
vocabulary — `READY`, `NEEDS_EVIDENCE`, `NEEDS_USER_DECISION`, `BLOCKED` — and none of them is
|
|
100
|
+
ever reported as a number, a percentage, or a confidence.
|
|
101
|
+
- Only `bug`, `feature`, `refactor`, `trivial-edit` and `dependency-change` have templates. On
|
|
102
|
+
any other class the verb exits 1 and lists the valid keys; that is the correct answer, not a
|
|
103
|
+
gap to route around.
|
|
104
|
+
- All four states are reachable, so a verdict is about this task rather than about the runtime.
|
|
105
|
+
Dispatch no task until the run's record, below, is `READY`. `BLOCKED` is a claim whose evidence contradicts itself, and `NEEDS_USER_DECISION`
|
|
106
|
+
is what `--user-decision-pending` returns. A first call on a task with nothing recorded grades
|
|
107
|
+
an empty ledger — that is a checklist, not a defect.
|
|
108
|
+
- **The run's record comes first.** The handoff, `verify` and the edit hook read the record
|
|
109
|
+
keyed on the feature slug (the run's task id), so before the first dispatch record the
|
|
110
|
+
`affected_components` evidence, then evaluate with the plan's stated inputs:
|
|
111
|
+
```bash
|
|
112
|
+
"$DOFLOW" evidence --task-id "<slug>" --action add --batch <batch>.json --json
|
|
113
|
+
"$DOFLOW" readiness --task-class "<template from step 2>" --task-id "<slug>" --mode workflow \
|
|
114
|
+
--verification-plan "<plan.md §7 Validation Strategy>" --scope "<comma-separated paths from plan.md §4>" --json
|
|
115
|
+
```
|
|
116
|
+
The batch holds one item: `kind` `structural` or `semantic-retrieval`, `provenance`
|
|
117
|
+
`extracted`, `locator` a file in this repository (`plan.md`), `establishes`
|
|
118
|
+
`["affected_components"]`, and `content` summarizing the components and files `plan.md` §4
|
|
119
|
+
lists (schema: the guidance tree's `references/EVIDENCE_LEDGER.md`). `scope_clear` and
|
|
120
|
+
`verification_plan` come from the two stated inputs; `--scope` as a path list is also what
|
|
121
|
+
`verify` bounds the change by. A refusal names the command to run again.
|
|
122
|
+
- `readiness` also accepts `--verification-plan`, `--scope` and `--invariants` — the verb's own
|
|
123
|
+
arguments, unrelated to this skill's `--scope`. Those are inputs
|
|
124
|
+
you **state**, not evidence the gate measured: the report lists them back as `callerAsserted`
|
|
125
|
+
in JSON and `Caller-stated:` in the human report, and a requirement satisfied that way links
|
|
126
|
+
no evidence. Pass them when they are true, and when you report the verdict say which part of
|
|
127
|
+
it rests on a statement rather than on a record. Never pass one to move a state.
|
|
128
|
+
- Do not recall the contract from memory — the templates are versioned and the command reads
|
|
129
|
+
them. This skill's own `references/readiness_gate.md` carries the per-class requirements, what each state
|
|
130
|
+
means, and exactly which input produces it. Read it before acting on a verdict, and never
|
|
131
|
+
write `READY` yourself: the gate did not say it.
|
|
132
|
+
|
|
133
|
+
5. **Scaffold Generation (`--scaffold`)**:
|
|
134
|
+
- When invoked with `--scaffold`, emit a reviewable code scaffold under `<feature_dir>/scaffold/`
|
|
135
|
+
instead of executing tasks: the source layout, signatures and test stubs that `requirement.md`,
|
|
136
|
+
`design.md` and `plan.md` imply, plus a contract frame per external `depends-on:` service.
|
|
137
|
+
Signatures only, never implementation logic, and never a write into the project's source tree.
|
|
138
|
+
- The in-scope half is deterministic and is **run**, not reasoned through — one verb through the
|
|
139
|
+
same seam as every other runtime call, `"$DOFLOW" scaffold --json`, which resolves the active
|
|
140
|
+
feature itself. The external-dependency half is an algorithm you execute. Both, with the exact
|
|
141
|
+
commands, live in this skill's own `references/scaffold.md`. Report its `status` and,
|
|
142
|
+
specifically, whatever it lists as skipped or not evaluated — a partial scaffold read as
|
|
143
|
+
complete is worse than none.
|
|
144
|
+
|
|
145
|
+
6. **Task Selection & Parallel Dispatch**:
|
|
146
|
+
- Read the guidance tree's `references/ORCHESTRATION.md` before dispatching agents;
|
|
147
|
+
it governs briefs, tools, running work, verification, and questions.
|
|
148
|
+
- `--scope` selects what this run executes, and takes exactly one value: `next` (the next
|
|
149
|
+
pending task, the default), `phase:N` (one phase), `all` (every pending task), or `resume`
|
|
150
|
+
(pick up where an interrupted run stopped). Where an interrupted run stopped is read from the
|
|
151
|
+
recorded state, never reconstructed from the transcript.
|
|
152
|
+
- Compute dispatch groups with `"$DOFLOW" parallel-check --phase=<N> --json` — it
|
|
153
|
+
groups by phase and `owner:`, and returns the cross-group write-set collisions
|
|
154
|
+
(`group_overlaps[]`, `group_serialize[]`) that decide what may run concurrently. Do not derive
|
|
155
|
+
write-set isolation by inspection; it is computed.
|
|
156
|
+
**Branch on the `parallel_safe` field, never on the exit code.** With `jq` unavailable this
|
|
157
|
+
verb exits 0 and reports `"parallel_safe": null` — a zero exit is not a grant of concurrency.
|
|
158
|
+
`null`, or a missing field, means unknown: run the tasks serially and say why.
|
|
159
|
+
Build each group's brief with
|
|
160
|
+
`"$DOFLOW" task-brief --group=<phase>:<owner> --tasks=<csv>`. Full protocol, field
|
|
161
|
+
meanings, and the serial and per-task fallbacks: this skill's own `references/parallel_dispatch.md`.
|
|
162
|
+
- Before dispatching each task, compile its prior context — the same plan task id step 4 graded:
|
|
163
|
+
```bash
|
|
164
|
+
"$DOFLOW" context-pack --task-id "<task id>" --json
|
|
165
|
+
```
|
|
166
|
+
**Exit 1 means the pack came back empty.** Unlike design and plan, this call sits right at the
|
|
167
|
+
point a subagent is about to be handed the task and told to act — so proceeding as though
|
|
168
|
+
nothing happened is exactly the failure this feature exists to remove. An empty pack here can
|
|
169
|
+
still be legitimate: step 4 lets a task reach `READY` on `callerAsserted` inputs alone, which
|
|
170
|
+
link no evidence. Do not withhold dispatch on this alone — readiness already governs whether the
|
|
171
|
+
task may be worked. Instead, carry the empty result into the group's brief itself: state in the
|
|
172
|
+
dispatch, next to the task-brief output, that no prior evidence or claims were compiled for this
|
|
173
|
+
task, so the subagent works from the plan/design text `task-brief` already supplies without
|
|
174
|
+
assuming a grounding evidence base that isn't there. A non-empty pack is included in the brief
|
|
175
|
+
as the subagent's prior context, same handoff.
|
|
176
|
+
- Claim each task before dispatch and finish it with evidence: `references/task_attempts.md`.
|
|
177
|
+
- Dispatch tasks to appropriate specialist archetypes:
|
|
178
|
+
- Architecture & Schema $\rightarrow$ `system-architect`
|
|
179
|
+
- Code Implementation & Refactoring $\rightarrow$ `core-implementer`
|
|
180
|
+
- Test Automation & Quality $\rightarrow$ `quality-guardian`
|
|
181
|
+
- Name a model tier on every dispatch — an omitted tier inherits the session's model. Pass the
|
|
182
|
+
tier from task-brief's `record.tier` as the dispatch model; for review passes and the limit
|
|
183
|
+
where a harness honors only `model: inherit`, see `references/MODEL_SELECTION.md`.
|
|
184
|
+
|
|
185
|
+
7. **Batch the Phase's Evidence**:
|
|
186
|
+
- One pass at each phase boundary, never one call per fact. Use the plan task id — the same id
|
|
187
|
+
step 4 graded — for every `evidence`, `claim` and `readiness` call about that task; a
|
|
188
|
+
different id reads a different task's record.
|
|
189
|
+
```bash
|
|
190
|
+
"$DOFLOW" evidence --task-id "<task id>" --action add --batch <batch>.json --json
|
|
191
|
+
"$DOFLOW" claim --task-id "<task id>" --action add --statement "<one conclusion>"
|
|
192
|
+
```
|
|
193
|
+
Item schema, provenance rules, and the refused-field list: the guidance tree's `references/EVIDENCE_LEDGER.md`. Read it before writing the batch.
|
|
194
|
+
- This phase's items are its completion report, and a subagent's assertion never becomes fact by
|
|
195
|
+
a subagent having made it.
|
|
196
|
+
- Add each conclusion as a claim in this same pass. Each is stored as a `hypothesis` and becomes
|
|
197
|
+
supported only through linked evidence:
|
|
198
|
+
`"$DOFLOW" claim --task-id "<task id>" --action link --claim-id <claim id> --evidence-id <evidence id> --relation supports|contradicts`.
|
|
199
|
+
An evidence id the ledger does not hold is **refused** — exit 2, naming the id — not graded,
|
|
200
|
+
so record the batch first and link afterwards. A claim carrying both fresh support and fresh
|
|
201
|
+
contradiction becomes `conflicted`, which is what makes step 4 report `BLOCKED`.
|
|
202
|
+
|
|
203
|
+
8. **Update `state.md`**:
|
|
204
|
+
- One checkpoint per phase (or per task, on a `--scope next` run), immediately after step 7's
|
|
205
|
+
evidence/claim batch for that phase — same boundary, not a separate pass to remember later.
|
|
206
|
+
- No `<feature_dir>/state.md` yet: create it from the template. The template is
|
|
207
|
+
`templates/doflow/state-template.md` in the install step 1 resolved: take `constitution_base`
|
|
208
|
+
from that JSON and swap its trailing `guidance/references/CONSTITUTION_BASE.md` for that path.
|
|
209
|
+
Fill `[PLAN_PATH]` from that same resolution's `plan` field, verbatim (repo-root-relative,
|
|
210
|
+
exactly as the resolver returns it) — `state.md` and `plan.md` both sit at the feature dir's
|
|
211
|
+
own root under both layouts, the same single shared location, and the resolver's own field is
|
|
212
|
+
what confirms it rather than a hand-computed guess.
|
|
213
|
+
- Every checkpoint: append the finished task(s) to the Task Ledger (`Commits` as the actual
|
|
214
|
+
`[base7]..[head7]` range once committed, or `uncommitted (working tree)` when this run doesn't
|
|
215
|
+
commit on its own), move them from **In Progress** to **Completed**, and rewrite **Status**,
|
|
216
|
+
**Blocked**, **Findings** and **Next Action** (the next pending task) in place, deleting a
|
|
217
|
+
blocker or finding that no longer applies, so a resumed session (or a different one) can pick up
|
|
218
|
+
from this file and `git log` alone, never from conversation memory. A `Findings` entry records
|
|
219
|
+
a review finding deliberately left unfixed (rare); write "None." otherwise, never omit it.
|
|
220
|
+
- This is bookkeeping, not a gate: a write failure here degrades resumability, not correctness —
|
|
221
|
+
report it and continue rather than treating it as a task failure.
|
|
222
|
+
|
|
223
|
+
9. **Phase Quality Review** (`--review`, opt-in):
|
|
224
|
+
- Off by default. With `--review`, review each phase on completion for spec compliance before
|
|
225
|
+
advancing. Without it no per-phase review runs: the completion summary says "per-phase review:
|
|
226
|
+
not requested"; review at `/do-code-review` after the test stage (or the caller's final review).
|
|
227
|
+
|
|
228
|
+
10. **Record the Handoff**:
|
|
229
|
+
- Before recording it, follow the decision step in the guidance tree's
|
|
230
|
+
`references/WORKFLOW_HANDOFF.md`.
|
|
231
|
+
- Once per `/do-execute-plan` invocation, at the last `state.md` checkpoint this run writes —
|
|
232
|
+
not once per phase, since the stage hands off once however many phases it executed. The stage
|
|
233
|
+
id is step 3's `caughtUpTo`, which the run is already positioned on; there is no second
|
|
234
|
+
`catch-up` call and no `status` call to make here.
|
|
235
|
+
- **First: is this run a completion or a checkpoint?** Count `plan.md`'s still-unchecked task
|
|
236
|
+
lines with `grep -cE '^- \[ \] [A-Z]+\.[0-9]+'`. The task-id prefix is load-bearing: a bare
|
|
237
|
+
`^- \[ \]` also matches the plan's own `- [ ] All tasks checked` completion-criteria line, so
|
|
238
|
+
it reports a remaining task on a finished plan and records a checkpoint where a completion
|
|
239
|
+
was owed. Any genuinely remaining task makes this handoff a checkpoint (`annotate`, never
|
|
240
|
+
`complete-stage`); zero remaining is the completion flow. Both branches, their exact
|
|
241
|
+
commands, the readiness record the handoff reads, and how to report the
|
|
242
|
+
resulting `disposition`: this skill's own `references/handoff_record.md`. Read it before
|
|
243
|
+
running this step.
|
|
244
|
+
|
|
245
|
+
**Stop when** every review finding the contract names has an answer or a stated gap, **and** the last round produced no new review finding. A round that only restates what you already have is the last round. Report the remaining gaps rather than continuing.
|
|
246
|
+
|
|
247
|
+
## Embedded feature research
|
|
248
|
+
|
|
249
|
+
For an external fact gap or explicit request, follow the conditional protocol in `../do-document/references/embedded-research.md` before stage completion.
|
|
250
|
+
|
|
251
|
+
## Boundaries
|
|
252
|
+
**Will:** Propose a task class and have the runtime validate it, put the approval gate standing
|
|
253
|
+
before this stage to the user — but only when the run still reports it open — and record their
|
|
254
|
+
answer, execute planned tasks with subagents, consult the readiness contract per task, batch each
|
|
255
|
+
phase's evidence and claims, ensure write-set isolation, and record the stage handoff through
|
|
256
|
+
`orchestrate`/`render-audit` — as a completion when every plan task is checked, as a checkpoint
|
|
257
|
+
annotation when this run finished only part of the plan.
|
|
258
|
+
**Will Not:** Bypass missing spec artifacts, modify source code while readiness reports `BLOCKED`,
|
|
259
|
+
hand this stage off while any plan task is still unchecked, re-ask a gate the run no longer reports
|
|
260
|
+
as open, execute under a class the runtime rejected or replaced with `feature`,
|
|
261
|
+
call `readiness` for a stage that declares no template; or express evidence, an estimate or readiness as a number, a percentage or a confidence.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Step 10 — recording the stage handoff
|
|
2
|
+
|
|
3
|
+
The procedural detail behind `/do-execute-plan`'s step 10. `SKILL.md` carries when the step runs
|
|
4
|
+
and the completion-vs-checkpoint decision it turns on; what follows is how each branch is carried
|
|
5
|
+
out. `readiness_gate.md`, referenced below, sits beside this file.
|
|
6
|
+
|
|
7
|
+
- **First: is this run a completion or a checkpoint?** Re-read `plan.md`'s task checklist and
|
|
8
|
+
count the task lines still unchecked. A real task line matches `^- \[ \] [A-Z]+\.[0-9]+` (a
|
|
9
|
+
phase letter, a dot, a number — `- [ ] B.2`); the pattern deliberately excludes the generic
|
|
10
|
+
`- [ ] All tasks checked` line in the plan's own "Completion criteria" section, which carries
|
|
11
|
+
no phase-letter id and is not a task.
|
|
12
|
+
```bash
|
|
13
|
+
grep -cE '^- \[ \] [A-Z]+\.[0-9]+' "<plan path>"
|
|
14
|
+
```
|
|
15
|
+
**Any such line remaining means this run's handoff is a checkpoint, not a completion** — the
|
|
16
|
+
normal outcome of a `--scope next` or `--scope phase:N` run, which finishes some of the plan by
|
|
17
|
+
design. Record the checkpoint and stop; do **not** attempt `complete-stage`, which would hand
|
|
18
|
+
the stage off while tasks nobody executed are still open:
|
|
19
|
+
```bash
|
|
20
|
+
"$DOFLOW" orchestrate --action annotate --task-id "<slug>" --node "<stage id>" --note "<checkpoint: N of M tasks done, scope was --scope next|phase:X>" --json
|
|
21
|
+
```
|
|
22
|
+
Only when zero such lines remain does the completion flow below run.
|
|
23
|
+
- **Then: confirm the readiness record before completing.** This stage is the workflow's
|
|
24
|
+
`mutatesSource` stage, so the handoff reads the record `readiness` wrote and refuses without a
|
|
25
|
+
`READY` one made before the call; it evaluates nothing itself (`readiness_gate.md`).
|
|
26
|
+
1. The `affected_components` evidence batch and the `READY` readiness call, both under the
|
|
27
|
+
feature slug, happen before Phase 1 is dispatched (`SKILL.md` step 4), not here. A refusal names the `readiness` command to run:
|
|
28
|
+
run it, gather what it lists until it reports `READY`, then repeat the handoff.
|
|
29
|
+
2. Then record the handoff. This is the genuine completion case (every task checked), the one
|
|
30
|
+
case where reaching this stage's candidate and recording it as done are the same fact, so
|
|
31
|
+
`handoff`'s always-complete-on-reach behavior is exactly right here and cannot mismark
|
|
32
|
+
unfinished work: the checkpoint branch above never reaches this call:
|
|
33
|
+
```bash
|
|
34
|
+
"$DOFLOW" orchestrate --action handoff --task-id "<slug>" --task-class "<class>" --calling-skill do-execute-plan \
|
|
35
|
+
--note "<one line, e.g. tasks A.1–E.5 complete>" --result passed --json
|
|
36
|
+
```
|
|
37
|
+
`--task-class` still matters here even though the run already carries one: a conflicting
|
|
38
|
+
value is refused, so passing it is a check, not a formality. `--result` reflects step 9's phase
|
|
39
|
+
review (when it ran) and step 6's own check runs, never asserted as `passed` when a review
|
|
40
|
+
finding was left unfixed. Without `--review` the result rests on the verification the run did,
|
|
41
|
+
and the note says the per-phase review was not requested.
|
|
42
|
+
- **Report the resulting `disposition` plainly.** `completed` means a `READY` record was
|
|
43
|
+
found and the cursor advanced to the verification stage — check
|
|
44
|
+
its `awaitingGate`; `null` means no gate follows this stage in this workflow. `deferred` means
|
|
45
|
+
a gate, an unfinished mutating stage elsewhere, or a rejected run prevented it — report
|
|
46
|
+
`reason` plainly, this stage resolves no gate. If the handoff refuses for readiness,
|
|
47
|
+
report exactly what is unmet and fix that with the `readiness` command it names — do not
|
|
48
|
+
re-run under a class that grades looser, never assert `READY` yourself, and do not swallow the
|
|
49
|
+
failure into an `annotate`. The `annotate` path above belongs to the unfinished-tasks case
|
|
50
|
+
alone; it is not a catch-all for an unexpected readiness failure here. Finish by rendering the
|
|
51
|
+
trail — the `--slug` value attaches with an `=`; a space-separated one is rejected with an
|
|
52
|
+
error rather than silently rendering the wrong feature's trail:
|
|
53
|
+
```bash
|
|
54
|
+
"$DOFLOW" render-audit --slug="<slug>" --json
|
|
55
|
+
```
|
|
56
|
+
- Same standing as step 8's `state.md` write: bookkeeping, not a gate. A failure here degrades
|
|
57
|
+
the trail, not the correctness of the work already done — report it and continue.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Parallel Subagent Orchestration Reference
|
|
2
|
+
|
|
3
|
+
Protocol for safe concurrent task execution by specialist subagents.
|
|
4
|
+
|
|
5
|
+
**Write-set isolation is decided by the `parallel-check` verb, not by judgement.** The commands
|
|
6
|
+
below compute the grouping and the overlap set deterministically from `plan.md`. Read their output;
|
|
7
|
+
do not re-derive it by eye. If a verb is unavailable, say so and run the tasks serially (one at a
|
|
8
|
+
time) rather than guessing at which tasks are safe to run together.
|
|
9
|
+
|
|
10
|
+
## Resolving the runtime
|
|
11
|
+
|
|
12
|
+
`SKILL.md` step 1 already resolved `$DOFLOW`; reuse it. Resolving is a search of the filesystem, not
|
|
13
|
+
of this file's location — a relative path would resolve against the working directory, which is the
|
|
14
|
+
project root, not the skill. If `$DOFLOW` is unset (this file read on its own), resolve it first:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Resolve the DoFlow runtime: nearest project install wins, then the global one.
|
|
18
|
+
D=$PWD; while [ "$D" != / ] && [ ! -x "$D/.doflow/scripts/doflow/bin/doflow-run" ]; do D=$(dirname "$D"); done
|
|
19
|
+
DOFLOW="$D/.doflow/scripts/doflow/bin/doflow-run"
|
|
20
|
+
[ -x "$DOFLOW" ] || DOFLOW="$HOME/.doflow/scripts/doflow/bin/doflow-run"
|
|
21
|
+
[ -x "$DOFLOW" ] || { echo "doflow: no runtime found in any .doflow/ above $PWD, nor at $HOME/.doflow. Run: npx @khoavu882/doflow install -t <harness>" >&2; exit 2; }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Run every command below from the project root — the walk-up starts at `$PWD`. On exit 2, print the message verbatim and stop; it names every path searched.
|
|
25
|
+
|
|
26
|
+
## 1. Compute the dispatch groups
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
"$DOFLOW" parallel-check --phase=<PHASE> --json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Returns, alongside the legacy per-task fields (`parallel_tasks`, `sequential_tasks`, `overlaps`,
|
|
33
|
+
`parallel_safe`, `serialize`):
|
|
34
|
+
|
|
35
|
+
| Field | Meaning |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `groups[]` | `{id, owner, tasks[], files[]}` — one dispatch per entry. `id` is `<phase>:<owner>`. |
|
|
38
|
+
| `group_overlaps[]` | `{path, groups[]}` — groups whose write sets collide on `path`. |
|
|
39
|
+
| `group_serialize[]` | Group ids that **must not** run concurrently with each other. |
|
|
40
|
+
| `unowned_tasks[]` | Tasks with no `owner:`; each forms a singleton group with `owner: null`. |
|
|
41
|
+
|
|
42
|
+
Tasks sharing an `owner:` in the same phase merge into one group — one subagent runs them in
|
|
43
|
+
sequence, which is why two tasks in the *same* group may safely touch the same file. That is the
|
|
44
|
+
distinction between `overlaps` (per-task, still reported) and `group_overlaps` (cross-group, the
|
|
45
|
+
one that governs dispatch).
|
|
46
|
+
|
|
47
|
+
## 2. Dispatch
|
|
48
|
+
|
|
49
|
+
- Launch **one subagent per group**, concurrently, except that any two groups both listed in
|
|
50
|
+
`group_serialize[]` must be run one after the other.
|
|
51
|
+
- Never split a group across subagents: its tasks are ordered and may share files.
|
|
52
|
+
- When the grouping cannot be computed, suppress fan-out entirely — every task runs serially in
|
|
53
|
+
dependency order. Say that fan-out was suppressed and why.
|
|
54
|
+
- When groups are unavailable but per-task data is not, fall back to per-task dispatch using the
|
|
55
|
+
legacy `overlaps`/`serialize` fields.
|
|
56
|
+
|
|
57
|
+
## 3. Build each group's brief
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
"$DOFLOW" task-brief --group=<PHASE>:<OWNER> --tasks=<id,id,...> --harness=<your harness id> --json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Writes the group brief and returns its path in `path`. The brief carries the shared preamble
|
|
64
|
+
once (where this fits, global constraints, component boundary), then a per-task block for each id in
|
|
65
|
+
the order given. Pass this file to the subagent — it is the whole contract for that dispatch.
|
|
66
|
+
|
|
67
|
+
For a single-task group the brief is byte-identical to `--task=<id>` output, so a one-task group and
|
|
68
|
+
an ungrouped task are the same dispatch.
|
|
69
|
+
|
|
70
|
+
Report paths come from the brief path the same call returned — the workspace is the directory
|
|
71
|
+
holding it, and each task's report is `<workspace>/task-<ID>-report.md`. Each task writes its own
|
|
72
|
+
report before the next one starts.
|
|
73
|
+
|
|
74
|
+
Both verbs reject path traversal in group and task ids with exit 2. On any non-zero exit, stop and
|
|
75
|
+
surface the error — do not proceed with a partial grouping.
|
|
76
|
+
|
|
77
|
+
## 4. Phase-level quality review
|
|
78
|
+
|
|
79
|
+
Only when `--review` was given: once every group in a phase reports complete, run an integrated
|
|
80
|
+
phase quality review before advancing. Without it, a group's completion goes straight to the
|
|
81
|
+
evidence and `state.md` steps. A finding that does not clear on the first fix goes to
|
|
82
|
+
`"$DOFLOW" recover --error "<what failed>" --failed-check "<check id>" --iteration <n> --json`.
|
|
83
|
+
Exit 0 means a bounded retry is available (`canRetry: true`); exit 1 means the loop must stop —
|
|
84
|
+
report where it stopped and why, quoting the returned `reason`. The bound is the runtime's
|
|
85
|
+
(`maxRecoveryIterations` in `verify --action contract`); you do not choose the count.
|
|
86
|
+
|
|
87
|
+
## Behavioral posture
|
|
88
|
+
|
|
89
|
+
For complex multi-step orchestration and execution checkpoints, consult the Task Management mode in
|
|
90
|
+
the installed guidance tree: `<config-dir>/guidance/modes/MODE_Task_Management.md` (for example
|
|
91
|
+
`~/.doflow/guidance/modes/MODE_Task_Management.md`). It sits under the DoFlow config directory, not
|
|
92
|
+
beside this file.
|