@chenmk/superflow 0.3.0 → 0.5.0
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/INSTALL.en.md +54 -12
- package/INSTALL.md +59 -33
- package/README.md +192 -49
- package/README.zh-CN.md +166 -46
- package/assets/brand/managed-review-loop.png +0 -0
- package/assets/manifest.json +15 -9
- package/assets/prompts/superflow-design.md +3 -0
- package/assets/prompts/superflow-docs.md +4 -1
- package/assets/scripts/superflow-coding-ready.mjs +135 -0
- package/assets/scripts/superflow-dependency-update-hook.sh +81 -8
- package/assets/scripts/superflow-document-audit.mjs +240 -0
- package/assets/scripts/superflow-environment-preflight.mjs +398 -0
- package/assets/scripts/superflow-hook-guard.sh +40 -1
- package/assets/scripts/superflow-managed-command-guard.py +309 -0
- package/assets/scripts/superflow-managed-executor-preflight.mjs +421 -0
- package/assets/scripts/superflow-managed-owner-verification.sh +117 -0
- package/assets/scripts/superflow-managed-work-check.mjs +455 -0
- package/assets/scripts/superflow-managed-work-guard.sh +17 -0
- package/assets/skills/openspec-propose/SKILL.md +11 -0
- package/assets/skills/superflow-clarify/SKILL.md +14 -0
- package/assets/skills/superflow-design/SKILL.md +46 -12
- package/assets/skills/superflow-docs/SKILL.md +109 -2
- package/assets/skills/superflow-pipeline/SKILL.md +205 -2
- package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +17 -9
- package/assets/skills/superflow-pipeline/references/document-readiness.md +157 -0
- package/assets/skills/superflow-pipeline/references/document-templates.md +17 -5
- package/assets/skills/superflow-pipeline/references/feature-gated-workflow.md +14 -0
- package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +20 -11
- package/assets/skills/superflow-pipeline/references/managed-work.md +166 -0
- package/assets/skills/superflow-pipeline/references/orchestration.md +2 -2
- package/assets/skills/superflow-pipeline/references/p0-baseline-template.md +3 -2
- package/assets/skills/superflow-pipeline/references/quality-gate.md +8 -5
- package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +7 -0
- package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +10 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-archive.sh +1 -1
- package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +282 -16
- package/assets/skills/superflow-pipeline/scripts/superflow-handoff.sh +7 -4
- package/assets/skills/superflow-requirement-review/SKILL.md +178 -0
- package/assets/skills/superflow-requirement-review/agents/openai.yaml +4 -0
- package/assets/skills-en/openspec-propose/SKILL.md +14 -0
- package/assets/skills-en/superflow-clarify/SKILL.md +17 -0
- package/assets/skills-en/superflow-design/SKILL.md +40 -11
- package/assets/skills-en/superflow-docs/SKILL.md +115 -0
- package/assets/skills-en/superflow-pipeline/SKILL.md +202 -0
- package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +4 -0
- package/assets/skills-en/superflow-pipeline/references/document-readiness.md +125 -0
- package/assets/skills-en/superflow-pipeline/references/document-templates.md +15 -0
- package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +7 -0
- package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +7 -0
- package/assets/skills-en/superflow-pipeline/references/managed-work.md +184 -0
- package/assets/skills-en/superflow-pipeline/references/quality-gate.md +20 -0
- package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +7 -0
- package/assets/skills-en/superflow-pipeline/references/superpower-technical-design-template.md +11 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-archive.sh +1 -1
- package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +279 -14
- package/assets/skills-en/superflow-pipeline/scripts/superflow-handoff.sh +7 -4
- package/assets/skills-en/superflow-requirement-review/SKILL.md +99 -0
- package/assets/skills-en/superflow-requirement-review/agents/openai.yaml +4 -0
- package/dist/app/cli.js +176 -103
- package/dist/app/cli.js.map +1 -1
- package/dist/app/commands/change-guard.js +19 -2
- package/dist/app/commands/change-guard.js.map +1 -1
- package/dist/app/commands/check.js +107 -45
- package/dist/app/commands/check.js.map +1 -1
- package/dist/app/commands/docs.js +7 -3
- package/dist/app/commands/docs.js.map +1 -1
- package/dist/app/commands/doctor.js +174 -198
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/eval.js +64 -0
- package/dist/app/commands/eval.js.map +1 -0
- package/dist/app/commands/implement.js +7 -3
- package/dist/app/commands/implement.js.map +1 -1
- package/dist/app/commands/init.js +16 -24
- package/dist/app/commands/init.js.map +1 -1
- package/dist/app/commands/managed-service.js +5 -0
- package/dist/app/commands/managed-service.js.map +1 -0
- package/dist/app/commands/mcp.js +167 -0
- package/dist/app/commands/mcp.js.map +1 -0
- package/dist/app/commands/pipeline.js +757 -3
- package/dist/app/commands/pipeline.js.map +1 -1
- package/dist/app/commands/requirement-review.js +6 -0
- package/dist/app/commands/requirement-review.js.map +1 -0
- package/dist/app/commands/status.js +262 -77
- package/dist/app/commands/status.js.map +1 -1
- package/dist/app/commands/uninstall.js +8 -5
- package/dist/app/commands/uninstall.js.map +1 -1
- package/dist/app/commands/update.js +114 -15
- package/dist/app/commands/update.js.map +1 -1
- package/dist/domains/agent.js +3 -11
- package/dist/domains/agent.js.map +1 -1
- package/dist/domains/config/cli-help.js +145 -73
- package/dist/domains/config/cli-help.js.map +1 -1
- package/dist/domains/config/i18n.js +6 -8
- package/dist/domains/config/i18n.js.map +1 -1
- package/dist/domains/config/manifest.js +0 -3
- package/dist/domains/config/manifest.js.map +1 -1
- package/dist/domains/deps.js +70 -8
- package/dist/domains/deps.js.map +1 -1
- package/dist/domains/hook.js +71 -38
- package/dist/domains/hook.js.map +1 -1
- package/dist/domains/managed-work/completion-policy.js +174 -0
- package/dist/domains/managed-work/completion-policy.js.map +1 -0
- package/dist/domains/managed-work/context-manifest.js +208 -0
- package/dist/domains/managed-work/context-manifest.js.map +1 -0
- package/dist/domains/managed-work/contract.js +349 -0
- package/dist/domains/managed-work/contract.js.map +1 -0
- package/dist/domains/managed-work/control-signals.js +34 -0
- package/dist/domains/managed-work/control-signals.js.map +1 -0
- package/dist/domains/managed-work/control.js +628 -0
- package/dist/domains/managed-work/control.js.map +1 -0
- package/dist/domains/managed-work/evaluation.js +497 -0
- package/dist/domains/managed-work/evaluation.js.map +1 -0
- package/dist/domains/managed-work/evidence-path.js +14 -0
- package/dist/domains/managed-work/evidence-path.js.map +1 -0
- package/dist/domains/managed-work/execution-contract.js +167 -0
- package/dist/domains/managed-work/execution-contract.js.map +1 -0
- package/dist/domains/managed-work/executor-policy.js +65 -0
- package/dist/domains/managed-work/executor-policy.js.map +1 -0
- package/dist/domains/managed-work/failure.js +65 -0
- package/dist/domains/managed-work/failure.js.map +1 -0
- package/dist/domains/managed-work/host-review.js +77 -0
- package/dist/domains/managed-work/host-review.js.map +1 -0
- package/dist/domains/managed-work/human-messages.js +31 -0
- package/dist/domains/managed-work/human-messages.js.map +1 -0
- package/dist/domains/managed-work/i18n.js +12 -0
- package/dist/domains/managed-work/i18n.js.map +1 -0
- package/dist/domains/managed-work/input.js +137 -0
- package/dist/domains/managed-work/input.js.map +1 -0
- package/dist/domains/managed-work/journal.js +196 -0
- package/dist/domains/managed-work/journal.js.map +1 -0
- package/dist/domains/managed-work/lock.js +106 -0
- package/dist/domains/managed-work/lock.js.map +1 -0
- package/dist/domains/managed-work/notifications.js +38 -0
- package/dist/domains/managed-work/notifications.js.map +1 -0
- package/dist/domains/managed-work/pair-admission.js +108 -0
- package/dist/domains/managed-work/pair-admission.js.map +1 -0
- package/dist/domains/managed-work/paths.js +18 -0
- package/dist/domains/managed-work/paths.js.map +1 -0
- package/dist/domains/managed-work/prompts.js +453 -0
- package/dist/domains/managed-work/prompts.js.map +1 -0
- package/dist/domains/managed-work/redaction.js +90 -0
- package/dist/domains/managed-work/redaction.js.map +1 -0
- package/dist/domains/managed-work/review-convergence.js +41 -0
- package/dist/domains/managed-work/review-convergence.js.map +1 -0
- package/dist/domains/managed-work/review-facts.js +181 -0
- package/dist/domains/managed-work/review-facts.js.map +1 -0
- package/dist/domains/managed-work/rule-selection.js +84 -0
- package/dist/domains/managed-work/rule-selection.js.map +1 -0
- package/dist/domains/managed-work/runner.js +2418 -0
- package/dist/domains/managed-work/runner.js.map +1 -0
- package/dist/domains/managed-work/schemas.js +155 -0
- package/dist/domains/managed-work/schemas.js.map +1 -0
- package/dist/domains/managed-work/service.js +190 -0
- package/dist/domains/managed-work/service.js.map +1 -0
- package/dist/domains/managed-work/state.js +280 -0
- package/dist/domains/managed-work/state.js.map +1 -0
- package/dist/domains/managed-work/storage.js +223 -0
- package/dist/domains/managed-work/storage.js.map +1 -0
- package/dist/domains/managed-work/types.js +19 -0
- package/dist/domains/managed-work/types.js.map +1 -0
- package/dist/domains/managed-work/verification-categories.js +39 -0
- package/dist/domains/managed-work/verification-categories.js.map +1 -0
- package/dist/domains/managed-work/verification-policy.js +116 -0
- package/dist/domains/managed-work/verification-policy.js.map +1 -0
- package/dist/domains/managed-work/wait.js +58 -0
- package/dist/domains/managed-work/wait.js.map +1 -0
- package/dist/domains/managed-work/workspace-binding.js +133 -0
- package/dist/domains/managed-work/workspace-binding.js.map +1 -0
- package/dist/domains/sdd-readiness.js +44 -0
- package/dist/domains/sdd-readiness.js.map +1 -0
- package/dist/domains/skill/deploy.js +0 -6
- package/dist/domains/skill/deploy.js.map +1 -1
- package/dist/domains/skill/scripts.js +0 -8
- package/dist/domains/skill/scripts.js.map +1 -1
- package/dist/domains/state.js +1 -2
- package/dist/domains/state.js.map +1 -1
- package/dist/mcp/runtime-identity.js +21 -0
- package/dist/mcp/runtime-identity.js.map +1 -0
- package/dist/mcp/server.js +369 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/platform/agent-process.js +769 -0
- package/dist/platform/agent-process.js.map +1 -0
- package/dist/platform/executable.js +28 -0
- package/dist/platform/executable.js.map +1 -0
- package/dist/platform/paths.js +1 -17
- package/dist/platform/paths.js.map +1 -1
- package/dist/platform/process-liveness.js +10 -0
- package/dist/platform/process-liveness.js.map +1 -0
- package/dist/platform/process-tree.js +44 -0
- package/dist/platform/process-tree.js.map +1 -0
- package/dist/platform/process.js +1 -1
- package/dist/platform/process.js.map +1 -1
- package/dist/platform/version-check.js +30 -9
- package/dist/platform/version-check.js.map +1 -1
- package/package.json +16 -7
- package/scripts/check-design-principles.mjs +107 -0
- package/scripts/check-managed-work-design.mjs +507 -0
- package/scripts/clean-dist.js +9 -0
- package/scripts/ensure-bin-modes.js +11 -0
- package/dist/cli/index.js +0 -193
- package/dist/cli/index.js.map +0 -1
- package/dist/commands/archive.js +0 -6
- package/dist/commands/archive.js.map +0 -1
- package/dist/commands/clarify.js +0 -6
- package/dist/commands/clarify.js.map +0 -1
- package/dist/commands/design.js +0 -28
- package/dist/commands/design.js.map +0 -1
- package/dist/commands/docs.js +0 -6
- package/dist/commands/docs.js.map +0 -1
- package/dist/commands/doctor.js +0 -494
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/implement.js +0 -6
- package/dist/commands/implement.js.map +0 -1
- package/dist/commands/init.js +0 -520
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/pipeline.js +0 -6
- package/dist/commands/pipeline.js.map +0 -1
- package/dist/commands/scan.js +0 -63
- package/dist/commands/scan.js.map +0 -1
- package/dist/commands/status.js +0 -173
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/uninstall.js +0 -214
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/update.js +0 -193
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/verify.js +0 -6
- package/dist/commands/verify.js.map +0 -1
- package/dist/core/assets.js +0 -27
- package/dist/core/assets.js.map +0 -1
- package/dist/core/cli-help.js +0 -98
- package/dist/core/cli-help.js.map +0 -1
- package/dist/core/context.js +0 -123
- package/dist/core/context.js.map +0 -1
- package/dist/core/dependencies.js +0 -146
- package/dist/core/dependencies.js.map +0 -1
- package/dist/core/detect.js +0 -64
- package/dist/core/detect.js.map +0 -1
- package/dist/core/i18n.js +0 -105
- package/dist/core/i18n.js.map +0 -1
- package/dist/core/integrity.js +0 -46
- package/dist/core/integrity.js.map +0 -1
- package/dist/core/manifest.js +0 -21
- package/dist/core/manifest.js.map +0 -1
- package/dist/core/prompts.js +0 -20
- package/dist/core/prompts.js.map +0 -1
- package/dist/core/registry.js +0 -134
- package/dist/core/registry.js.map +0 -1
- package/dist/core/rules.js +0 -17
- package/dist/core/rules.js.map +0 -1
- package/dist/core/scripts.js +0 -48
- package/dist/core/scripts.js.map +0 -1
- package/dist/core/skill-check.js +0 -32
- package/dist/core/skill-check.js.map +0 -1
- package/dist/core/skills.js +0 -62
- package/dist/core/skills.js.map +0 -1
- package/dist/core/state.js +0 -54
- package/dist/core/state.js.map +0 -1
- package/dist/utils/path.js +0 -11
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/shell.js +0 -29
- package/dist/utils/shell.js.map +0 -1
|
@@ -5,6 +5,13 @@ description: Use when a user asks for the SuperBridge Flow, SDD, OpenSpec, requi
|
|
|
5
5
|
|
|
6
6
|
# SuperBridge Flow Pipeline
|
|
7
7
|
|
|
8
|
+
When maintaining Superflow CLI itself, first read repository-root
|
|
9
|
+
`docs/superflow-cli-design-principles.en.md` and
|
|
10
|
+
`docs/superflow-cli-evaluation-framework.en.md`; managed-work changes also read
|
|
11
|
+
the managed constitution and protocol. Identify the owner layer before editing,
|
|
12
|
+
then record baseline, hypothesis, scenario, result, and rollback condition under
|
|
13
|
+
the unified evaluation framework.
|
|
14
|
+
|
|
8
15
|
## Role
|
|
9
16
|
|
|
10
17
|
This is the main router and stateful workflow orchestrator for SuperBridge Flow.
|
|
@@ -19,6 +26,96 @@ other:
|
|
|
19
26
|
- Handoff files and state files are the memory boundary. Do not rely on chat
|
|
20
27
|
memory after compaction.
|
|
21
28
|
|
|
29
|
+
## Managed Work And Dual-Agent Closure
|
|
30
|
+
|
|
31
|
+
When the Superflow MCP is installed for the host Agent, prefer
|
|
32
|
+
`superflow_managed_start/status/wait/message/submit_review` instead of manually
|
|
33
|
+
spawning `superflow pipeline` from chat. MCP tasks are always `external_host`:
|
|
34
|
+
the current host keeps the user conversation and reviews directly, while the
|
|
35
|
+
background service starts only the peer executor. Never spawn a nested
|
|
36
|
+
supervisor CLI. Wait with `superflow_managed_wait` locally instead of spending
|
|
37
|
+
model turns on periodic status checks. Use the CLI equivalent below only when
|
|
38
|
+
MCP is unavailable.
|
|
39
|
+
Call `superflow_managed_runtime` before task creation. If its fingerprint is
|
|
40
|
+
stale, require a Host restart and never start a new validation task through the
|
|
41
|
+
pre-install MCP process.
|
|
42
|
+
|
|
43
|
+
When the user says to use Superflow for managed delivery and provides an
|
|
44
|
+
implementation prompt, change directory, or direct task, use built-in managed
|
|
45
|
+
mode. Do not require the user to name `superflow-pipeline`, roles, or CLI flags:
|
|
46
|
+
|
|
47
|
+
Before start, perform one Host semantic routing step. Docs-only requests stop
|
|
48
|
+
after autonomous document review and Coding Ready without a managed Task. A
|
|
49
|
+
user-approved change/prompt is frozen from its original path. Only a bounded
|
|
50
|
+
verbal request enters minimal or standard directly. Direction-changing API,
|
|
51
|
+
data, concurrency, cross-repository, or owner choices return to
|
|
52
|
+
clarification/documents; Runner regexes and Executor improvisation do not decide them.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
superflow pipeline "<implementation prompt, change directory, or direct task>" --managed --project "<project root>" \
|
|
56
|
+
--supervisor current --executor peer --language en
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`current/peer` resolves the host automatically: a Codex host drives Claude and a
|
|
60
|
+
Claude host drives Codex. Ambiguous environments fail closed and require explicit
|
|
61
|
+
roles. The background service
|
|
62
|
+
invokes only the executor; the current host agent performs the read-only review
|
|
63
|
+
without spawning another copy of itself. After executor delivery, read
|
|
64
|
+
`host-review-N.md`, write the structured review JSON, then resume with
|
|
65
|
+
`--resume-task <task-id> --submit-host-review <json>`. Losing the follower does
|
|
66
|
+
not stop the task. Read `references/managed-work.md` before dispatch.
|
|
67
|
+
|
|
68
|
+
Managed delivery uses the lower-cost executor for implementation and validation;
|
|
69
|
+
the more expensive host only freezes the goal, supervises, and reviews delivery
|
|
70
|
+
quality. The host must not code, build, start, test, or manage executor processes.
|
|
71
|
+
When the task reaches `external_supervisor_review_required`, review, submit, and
|
|
72
|
+
resume automatically in the same turn; it must not stop and wait for manual user handoff.
|
|
73
|
+
Only an owner decision, unavailable external authority, or final Git approval may
|
|
74
|
+
interrupt the user.
|
|
75
|
+
|
|
76
|
+
Hard gates:
|
|
77
|
+
|
|
78
|
+
- Use a fresh short session for every execution and repair call. Hand off through
|
|
79
|
+
the current workspace, frozen prompt, persisted result, and findings; keep old
|
|
80
|
+
session IDs only for audit and never resume a long session indefinitely.
|
|
81
|
+
- The first invocation must receive the frozen task prompt automatically. Every
|
|
82
|
+
later invocation must first receive and read a condensed handoff containing at
|
|
83
|
+
least the prompt path/hash, task progress, local pending work, external
|
|
84
|
+
prerequisites, all current findings, diff stat, and recent report. Old and new
|
|
85
|
+
sessions both treat the handoff and current workspace as authoritative.
|
|
86
|
+
- In `external_host` mode the current agent reviews; the service must not spawn a
|
|
87
|
+
nested Codex or Claude CLI for the supervisor role.
|
|
88
|
+
- Host conversation and review do not count as background Agent invocations;
|
|
89
|
+
only real executor calls consume the execution budget.
|
|
90
|
+
- Task contract, event journal, review results, and evidence are authoritative.
|
|
91
|
+
- Maximum 5 reviews, 7 executor calls, and 12 total agent calls.
|
|
92
|
+
- Revalidate the frozen contract and hard limits on every start or resume. Engineering work cannot enter review with only one verification category.
|
|
93
|
+
- Resolve a change directory through `.sdd/state.yaml` `implementation_prompt`, reject `tasks.md` as an execution entry, and freeze one prompt snapshot plus SHA-256 for both agents.
|
|
94
|
+
- Supervisor is read-only; executor cannot edit `.superflow/tasks` or commit/push/publish.
|
|
95
|
+
- Frozen requirements, designs, prompts, handoffs, rules, and task facts are
|
|
96
|
+
immutable protected inputs. Tasks and test reports are retained progress
|
|
97
|
+
evidence that may be updated but not deleted. Executor cleans runtime and
|
|
98
|
+
workspace-temporary resources and keeps delivery artifacts and protected
|
|
99
|
+
contracts for Host review.
|
|
100
|
+
- Never use pkill, killall, a bare kill, port/name-only cleanup, or rm -rf
|
|
101
|
+
without owner-helper verification. Native hooks block before mutation and
|
|
102
|
+
preflight/final gates verify every Host.
|
|
103
|
+
- A passing run enters `environment_validation_blocked`, `local_delivery_ready`, or `release_ready`; Git always requires user approval.
|
|
104
|
+
- Default MCP waits to a 240-second Host-compatible transport window. On window
|
|
105
|
+
expiry, immediately continue only from returned `latestSequence`; do not call
|
|
106
|
+
status, read full events, or restart Executor. Hosts with longer tool limits may
|
|
107
|
+
explicitly request up to twelve hours; semantic supervision runs only for attention.
|
|
108
|
+
- When the user names a task-prompt document, pass its original path to start and verify the frozen SHA-256; never replace it with a host summary.
|
|
109
|
+
- Page/permission changes require frontend startup and real-browser E2E; cross-stack API changes require both backend and frontend contract tests.
|
|
110
|
+
- `superflow-managed-work-check.mjs` must pass before delivery-ready status.
|
|
111
|
+
- Record the single delivery-ready event only after the integrity script passes.
|
|
112
|
+
- After the managed command returns a terminal state, read the task report and summarize it to the user instead of returning only a task ID.
|
|
113
|
+
- Freeze the selected language into the task contract. Executor and reviewer prompts, resumed rounds, journals, reports, notifications, and errors must inherit that language without switching mid-run.
|
|
114
|
+
- Claude Executor long sessions use early auto-compaction by default, while
|
|
115
|
+
explicit user environment values win. Reload the frozen prompt and handoff after
|
|
116
|
+
compaction. Final `result.usage` is authoritative; a large value alone does not
|
|
117
|
+
prove Runner double counting.
|
|
118
|
+
|
|
22
119
|
## Phase Order
|
|
23
120
|
|
|
24
121
|
Always route work through this order unless the task is explicitly a tweak or
|
|
@@ -27,6 +124,10 @@ hotfix:
|
|
|
27
124
|
1. clarify: ingest requirements one feature at a time, freeze scope, and produce
|
|
28
125
|
source-ingestion, feature gates, inventory, UI/API gaps, and freeze review.
|
|
29
126
|
2. docs: generate OpenSpec/SDD contract artifacts and the first handoff package.
|
|
127
|
+
Before closing docs, run source-backed requirement review, repair blocking
|
|
128
|
+
findings, resolve all source investigations, owner decisions, and implementation-affecting
|
|
129
|
+
external contracts, then record `requirement-review.md`. Naming or assigning a blocker does
|
|
130
|
+
not close it.
|
|
30
131
|
3. design: let Superpowers produce source-level technical design from the frozen
|
|
31
132
|
contract and codebase evidence.
|
|
32
133
|
4. implement: generate implementation prompts, execution plans, worktree/port
|
|
@@ -43,6 +144,8 @@ hotfix:
|
|
|
43
144
|
use `superflow-clarify` in embedded deep-clarification mode. This is a mode
|
|
44
145
|
inside the normal clarify phase, not a separate command the user must remember.
|
|
45
146
|
- New or unclear requirement: use superflow-clarify.
|
|
147
|
+
- Requirement review, reverse review, omission search, design challenge,
|
|
148
|
+
testability review, or over-design review: use superflow-requirement-review.
|
|
46
149
|
- Confirmed requirement needing full docs: use openspec-propose, then
|
|
47
150
|
superflow-docs.
|
|
48
151
|
- Contract docs exist and code-level HOW is needed: use superflow-design.
|
|
@@ -79,6 +182,39 @@ When the router selects embedded deep clarification, follow these rules inside
|
|
|
79
182
|
|
|
80
183
|
## Required Artifacts
|
|
81
184
|
|
|
185
|
+
### Source Fact Freeze And Question Eligibility (Blocking)
|
|
186
|
+
|
|
187
|
+
- When a full workflow involves existing behavior, DB/table relationships,
|
|
188
|
+
cross-repository impact, or a real entry, docs must include
|
|
189
|
+
`source-code-audit.md` with: `Business conclusion | understand-anything
|
|
190
|
+
locator | Data model | All writers | Real user entry | Current callers |
|
|
191
|
+
Legacy conflict | DB check required | Conclusion level | owner decision`.
|
|
192
|
+
- understand-anything is a locator, not the final source of truth. Classify
|
|
193
|
+
evidence as `current`, `legacy`, `unmounted`, `data-model-only`,
|
|
194
|
+
`owner-confirmed`, or `blocked`.
|
|
195
|
+
- If `List`, `orderIds`, `batchInsert`, or a one-to-many model conflicts with a
|
|
196
|
+
single-item real entry, complete a Conflict Audit instead of inferring current
|
|
197
|
+
product behavior from the data structure.
|
|
198
|
+
- Before asking the user, search source, Mapper/SQL, frontend/mini-program/H5
|
|
199
|
+
callers, sibling repositories, and read-only DB data when needed. Do not turn
|
|
200
|
+
repository-verifiable facts into clarification questions.
|
|
201
|
+
|
|
202
|
+
### Canonical OpenSpec Change Directory (Blocking)
|
|
203
|
+
|
|
204
|
+
- Superflow must use the OpenSpec CLI single-level layout:
|
|
205
|
+
`openspec/changes/<change-name>/`.
|
|
206
|
+
- The release version belongs in the change name, not an intermediate
|
|
207
|
+
directory. Encode `v1.1.1` as `v1-1-1-<feature-slug>` and never create
|
|
208
|
+
`changes/v1.1.1/<feature-slug>/`.
|
|
209
|
+
- Keep exactly one physical directory for each change. Do not create a
|
|
210
|
+
compatibility symlink, copied directory, or second canonical document tree.
|
|
211
|
+
- Run `openspec new change <change-name>` first, then reuse that same physical
|
|
212
|
+
directory for status, instructions, strict validation, state, handoff, and
|
|
213
|
+
every Superflow guard.
|
|
214
|
+
- If a nested version directory or symlinked change is found, stop document
|
|
215
|
+
generation, migrate it to one flat physical directory, and rerun
|
|
216
|
+
`openspec validate <change-name> --strict`.
|
|
217
|
+
|
|
82
218
|
For a full change, the docs phase must create or refresh:
|
|
83
219
|
|
|
84
220
|
- proposal.md
|
|
@@ -91,6 +227,7 @@ For a full change, the docs phase must create or refresh:
|
|
|
91
227
|
- review-checklist.md
|
|
92
228
|
- sdd-quality-gate.md
|
|
93
229
|
- test-report.md
|
|
230
|
+
- source-code-audit.md when the source fact gate is triggered
|
|
94
231
|
- .sdd/state.yaml
|
|
95
232
|
- .sdd/handoff/sdd-context.md
|
|
96
233
|
- .sdd/handoff/sdd-context.json
|
|
@@ -124,6 +261,58 @@ Rules:
|
|
|
124
261
|
|
|
125
262
|
## Decision Points
|
|
126
263
|
|
|
264
|
+
## Autonomous Document Delivery Closure
|
|
265
|
+
|
|
266
|
+
A full-workflow docs Agent must not equate a successful keyword/file guard with
|
|
267
|
+
100% implementation readiness. Before developer handoff, record at least three
|
|
268
|
+
independent review lenses against the same current handoff hash in
|
|
269
|
+
`.sdd/reviews/document-review.json`:
|
|
270
|
+
|
|
271
|
+
1. `source-contract`: source, cross-repo callers, contracts, and real entries;
|
|
272
|
+
2. `architecture-minimality`: ownership, reuse, simplest design, failure owner,
|
|
273
|
+
and overdesign;
|
|
274
|
+
3. `e2e-environment`: startup order, configured environment, simulators,
|
|
275
|
+
automation, DB/log assertions, and cleanup.
|
|
276
|
+
|
|
277
|
+
The Agent resolves every source/config/log/probe-discoverable gap itself. Only
|
|
278
|
+
business-owner decisions, unavailable credentials/authority, or external
|
|
279
|
+
resources may remain in `openOwnerDecisions`, and they are asked as one final
|
|
280
|
+
batch. Open findings mean `BLOCKED_FOR_OWNER_BATCH`, never 100%.
|
|
281
|
+
|
|
282
|
+
Explore the configured environment during docs and record
|
|
283
|
+
`.sdd/readiness/environment.json`. Only fail-safe `file`, `directory`,
|
|
284
|
+
`executable`, `tcp`, and `http` probes are allowed. Never print credentials or
|
|
285
|
+
write production data. Respect the declared local/dev/test scope instead of
|
|
286
|
+
requiring a remote environment by default. Use
|
|
287
|
+
`superflow.environment-readiness.v2` to freeze the application location,
|
|
288
|
+
`local-isolated/shared-dev/shared-test/mixed` dependency policy, config sources,
|
|
289
|
+
allowed/forbidden overrides, and a `contractRef` for every probe. Reachability
|
|
290
|
+
alone is not an environment execution contract.
|
|
291
|
+
|
|
292
|
+
Cross-service, cross-repo, device, MQ, callback, scheduler, state-machine,
|
|
293
|
+
compensation, or three-plus-module logic declares `complex_logic: true` or
|
|
294
|
+
`mermaid: required` in `.openspec.yaml` and includes both a Mermaid
|
|
295
|
+
`sequenceDiagram` and a `flowchart`/`stateDiagram` showing failure exits,
|
|
296
|
+
compensation owner, and forbidden fallback.
|
|
297
|
+
|
|
298
|
+
Run `superflow check <change> --level coding-ready` after all prompts are ready.
|
|
299
|
+
It validates YAML, OpenSpec, docs/design/implement, every prompt and exact link,
|
|
300
|
+
review receipts, environment probes, and Mermaid diagrams, then writes a receipt
|
|
301
|
+
bound to the current handoff hash. Never delegate a failed implement gate to the
|
|
302
|
+
developer Agent.
|
|
303
|
+
|
|
304
|
+
## Cross-System Failure Ownership And Compensation Boundary
|
|
305
|
+
|
|
306
|
+
Record `Failure signal | Interpreter | Compensation owner | Retry allowed? |
|
|
307
|
+
Idempotency basis | Accepted race window | Extreme fallback | Owner approval`.
|
|
308
|
+
When the caller receives an explicit failure and owns refund/cancel/state
|
|
309
|
+
compensation, the downstream adapter defaults to `Fail-fast + Fail-closed +
|
|
310
|
+
At-most-once + Caller-owned compensation`: no transparent retry, reroute,
|
|
311
|
+
resend, or guessed success. Accept a bounded false-negative window when duplicate
|
|
312
|
+
side effects are more harmful. Additional fallback requires explicit owner
|
|
313
|
+
approval and a proven idempotency basis, collected with other owner-only
|
|
314
|
+
questions in one final batch.
|
|
315
|
+
|
|
127
316
|
Record irreversible or ambiguous decisions in references/decision-point.md
|
|
128
317
|
format. Do not store decisions only in chat memory.
|
|
129
318
|
|
|
@@ -139,6 +328,9 @@ Decision points include:
|
|
|
139
328
|
|
|
140
329
|
## Quality Gates
|
|
141
330
|
|
|
331
|
+
The machine-readable review, environment, Mermaid, and Coding Ready contracts
|
|
332
|
+
are defined in `references/document-readiness.md`.
|
|
333
|
+
|
|
142
334
|
The workflow must preserve these gates:
|
|
143
335
|
|
|
144
336
|
- API-first contract freeze before implementation.
|
|
@@ -160,6 +352,13 @@ The workflow must preserve these gates:
|
|
|
160
352
|
- Architecture boundary and call-direction analysis for multi-repo, service,
|
|
161
353
|
SDK, MQ, scheduler, callback, gateway, adapter, device, or third-party flows.
|
|
162
354
|
- SQL risk review before implementation for DB changes.
|
|
355
|
+
- Frozen release SQL before source design for DB changes. `release-sql.md` must
|
|
356
|
+
declare `database_change: true`, an exact placeholder-free
|
|
357
|
+
`target_sql_path`, `copy_policy: verbatim`, and the normalized SQL payload
|
|
358
|
+
`sql_sha256`, with exactly one complete executable SQL block containing the
|
|
359
|
+
required prechecks, DDL/DML, migration, and post-verification. Implementation
|
|
360
|
+
agents may only copy the block verbatim and verify the hash; any SQL design
|
|
361
|
+
omission returns to docs and requires a refreshed handoff.
|
|
163
362
|
- Real-entry acceptance for integration, device, callback, payment, client, or
|
|
164
363
|
cross-system flows. Mock-only is never real integration.
|
|
165
364
|
- Delivery completeness: runtime code changes must update the relevant task
|
|
@@ -178,6 +377,9 @@ Implementation prompts must require:
|
|
|
178
377
|
- worktree and port plan for parallel work;
|
|
179
378
|
- real-entry validation commands from tests.md;
|
|
180
379
|
- DB SELECT or SHOW CREATE checks when persisted state is touched;
|
|
380
|
+
- `release-sql.md`, its exact target path, verbatim-copy rule, and SHA-256 when
|
|
381
|
+
the change touches schema or data migration; prompts must never ask an
|
|
382
|
+
implementation agent to author or append SQL;
|
|
181
383
|
- log checks and error checks;
|
|
182
384
|
- superflow-verify-integration and superflow-delivery-check before completion;
|
|
183
385
|
- a report format that distinguishes Passed, Partially verified, and Blocked.
|
|
@@ -21,6 +21,10 @@ review-checklist.md, sdd-quality-gate.md, test-report.md, and technical design.
|
|
|
21
21
|
|
|
22
22
|
- Follow OpenSpec/SDD for WHAT and contract.
|
|
23
23
|
- Follow Superpowers technical design for source-level HOW.
|
|
24
|
+
- For database changes, read `release-sql.md`, copy its single SQL block
|
|
25
|
+
verbatim to the exact `target_sql_path`, and verify `sql_sha256`. Never
|
|
26
|
+
author, append, reorder, split, or optimize SQL during implementation. Return
|
|
27
|
+
omissions to docs and refresh the handoff.
|
|
24
28
|
- Do not change forbidden files or root aggregate docs from a worker batch.
|
|
25
29
|
- Use TDD: record RED failure before GREEN success.
|
|
26
30
|
- Do not mark mock-only or unit-only evidence as real integration.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Document Delivery Readiness Contract
|
|
2
|
+
|
|
3
|
+
## Applicability
|
|
4
|
+
|
|
5
|
+
Declare applicability in `.openspec.yaml`. Keyword scans may suggest a risk but
|
|
6
|
+
must not override an explicit, source-backed decision.
|
|
7
|
+
|
|
8
|
+
```yaml
|
|
9
|
+
schema: superflow/v1
|
|
10
|
+
applicability:
|
|
11
|
+
cross_repo: true
|
|
12
|
+
complex_logic: true
|
|
13
|
+
mermaid: required
|
|
14
|
+
environment: required
|
|
15
|
+
database: false
|
|
16
|
+
external_config: false
|
|
17
|
+
concurrency: false
|
|
18
|
+
money: false
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`money: false` means this change does not alter money calculation, rounding,
|
|
22
|
+
allocation, or financial display. It is not a bypass when source impact proves
|
|
23
|
+
that money behavior changes.
|
|
24
|
+
|
|
25
|
+
## Three-Review Receipt
|
|
26
|
+
|
|
27
|
+
Path: `.sdd/reviews/document-review.json`
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"schemaVersion": "superflow.document-review.v1",
|
|
32
|
+
"handoffHash": "<current 64-character handoff hash>",
|
|
33
|
+
"verdict": "PASS",
|
|
34
|
+
"openOwnerDecisions": [],
|
|
35
|
+
"rounds": [
|
|
36
|
+
{ "round": 1, "lens": "source-contract", "inputHash": "<same hash>", "findings": [] },
|
|
37
|
+
{ "round": 2, "lens": "architecture-minimality", "inputHash": "<same hash>", "findings": [] },
|
|
38
|
+
{ "round": 3, "lens": "e2e-environment", "inputHash": "<same hash>", "findings": [] }
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do not delete findings. After repair, retain them with `"status": "closed"`,
|
|
44
|
+
evidence, and the closure location. Every round is rechecked against the current
|
|
45
|
+
hash; a PASS for an old hash is invalid.
|
|
46
|
+
|
|
47
|
+
## Environment Preflight
|
|
48
|
+
|
|
49
|
+
Path: `.sdd/readiness/environment.json`
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"schemaVersion": "superflow.environment-readiness.v2",
|
|
54
|
+
"handoffHash": "<current hash>",
|
|
55
|
+
"scope": "local-dev",
|
|
56
|
+
"overall": "READY",
|
|
57
|
+
"ownerHelpRequired": [],
|
|
58
|
+
"executionContract": {
|
|
59
|
+
"applicationLocation": "local",
|
|
60
|
+
"dependencyPolicy": "shared-dev",
|
|
61
|
+
"allowLocalProvisioning": false,
|
|
62
|
+
"allowRemoteDevDependencies": true,
|
|
63
|
+
"allowedOverrides": ["server.port"],
|
|
64
|
+
"forbiddenOverrides": ["spring.datasource.url"],
|
|
65
|
+
"services": [
|
|
66
|
+
{
|
|
67
|
+
"id": "service-a",
|
|
68
|
+
"configSource": { "type": "bundled-profile", "ref": "application-prod.yml" },
|
|
69
|
+
"startupCommandSource": "tests.md#startup"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"dependencies": [
|
|
73
|
+
{
|
|
74
|
+
"id": "redis",
|
|
75
|
+
"kind": "redis",
|
|
76
|
+
"provisioning": "shared-dev",
|
|
77
|
+
"configSource": { "type": "bundled-profile", "ref": "application-prod.yml#spring.redis" }
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"checks": [
|
|
82
|
+
{ "id": "service-config", "type": "file", "target": "../../../service-a/application-prod.yml", "contractRef": "service:service-a", "status": "READY" },
|
|
83
|
+
{ "id": "redis", "type": "tcp", "host": "redis.dev.internal", "port": 6379, "contractRef": "dependency:redis", "status": "READY" }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Supported checks are `file`, `directory`, `executable`, `tcp`, and `http`.
|
|
89
|
+
Never embed credentials or tokens in URLs. Production writes and DB/Redis/MQ
|
|
90
|
+
mutations are not preflight operations.
|
|
91
|
+
|
|
92
|
+
`executionContract` is the single environment source of truth. Freeze the
|
|
93
|
+
application location, dependency policy, local-provisioning and shared-dev
|
|
94
|
+
permissions, allowed/forbidden overrides, and the config source for every
|
|
95
|
+
service and dependency. `configSource.type` is one of `bundled-profile`,
|
|
96
|
+
`external-file`, `environment`, `cli-override`, or `generated-fixture`.
|
|
97
|
+
Do not mix `local-isolated`, `shared-dev`, and `shared-test`; use `mixed` and
|
|
98
|
+
declare each dependency's `provisioning` when mixing is intentional. Every
|
|
99
|
+
service and dependency needs a matching `contractRef` probe. Legacy v1 reports
|
|
100
|
+
prove reachability only and cannot satisfy Coding Ready.
|
|
101
|
+
|
|
102
|
+
## Complex Diagrams
|
|
103
|
+
|
|
104
|
+
When `cross_repo` or `complex_logic` is true, include a Mermaid
|
|
105
|
+
`sequenceDiagram` for the real call and a `flowchart` or `stateDiagram` for
|
|
106
|
+
branches, compensation owner, and forbidden fallback.
|
|
107
|
+
|
|
108
|
+
## Coding Ready
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
superflow check <change> --level docs
|
|
112
|
+
superflow check <change> --level coding-ready
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The second command writes `.sdd/readiness/coding-ready.json`. Any SDD document
|
|
116
|
+
or handoff-hash change invalidates the old receipt. A developer Agent may only
|
|
117
|
+
receive a change with a current receipt.
|
|
118
|
+
|
|
119
|
+
## Cross-System Failure Ownership
|
|
120
|
+
|
|
121
|
+
Record `Failure signal | Interpreter | Compensation owner | Retry allowed? |
|
|
122
|
+
Idempotency basis | Accepted race window | Extreme fallback | Owner approval`.
|
|
123
|
+
Default to fail-fast, fail-closed, at-most-once, and caller-owned compensation.
|
|
124
|
+
Retry, reroute, resend, or distributed compensation requires explicit owner
|
|
125
|
+
approval and a proven idempotency basis.
|
|
@@ -22,11 +22,26 @@
|
|
|
22
22
|
- Source-of-truth contracts
|
|
23
23
|
- Architecture boundary
|
|
24
24
|
- Data model
|
|
25
|
+
- Minimal Design Review: reuse evidence, necessity, simplest implementation,
|
|
26
|
+
removed/rejected complexity, and blockers
|
|
27
|
+
- Count every new table, field, API, service, cache, async flow, scheduled job,
|
|
28
|
+
and compatibility layer; remove items without evidence
|
|
29
|
+
- New-item counts: tables 0; fields 0; APIs 0; services/components 0; caches 0; MQ/events 0; scheduled jobs 0; compatibility layers 0. Replace each count.
|
|
25
30
|
- Field semantics
|
|
26
31
|
- Write/read loop
|
|
27
32
|
- No-fallback decisions
|
|
28
33
|
- Superpowers technical design handoff
|
|
29
34
|
|
|
35
|
+
## release-sql.md (required for database changes)
|
|
36
|
+
|
|
37
|
+
- Front matter: `database_change: true`, exact `target_sql_path`,
|
|
38
|
+
`copy_policy: verbatim`, and normalized payload `sql_sha256`
|
|
39
|
+
- Exactly one complete executable `sql` block with required prechecks,
|
|
40
|
+
DDL/DML, migration, and post-verification
|
|
41
|
+
- No placeholder path or deferred SQL design
|
|
42
|
+
- Implementation agents only copy the block verbatim and verify the hash;
|
|
43
|
+
omissions return to docs
|
|
44
|
+
|
|
30
45
|
## tests.md
|
|
31
46
|
|
|
32
47
|
- Case ID
|
|
@@ -11,7 +11,14 @@ requests. Process one feature at a time.
|
|
|
11
11
|
- ui-contract.md: screen field to API/DTO/DB/test mapping.
|
|
12
12
|
- gap-analysis.md: unknowns, contradictions, and owner decisions.
|
|
13
13
|
- spec-freeze-review.md: final frozen scope and excluded items.
|
|
14
|
+
- source-code-audit.md: source fact freeze card, evidence classifications,
|
|
15
|
+
conflict audit, and question eligibility gate.
|
|
14
16
|
|
|
15
17
|
## Gate
|
|
16
18
|
|
|
17
19
|
Do not generate full OpenSpec docs until the target feature is frozen.
|
|
20
|
+
For existing-system work, understand-anything is locator evidence only. Confirm
|
|
21
|
+
current behavior from source, Mapper/SQL, real callers, and read-only DB data
|
|
22
|
+
when needed. Classify current versus legacy/unmounted/data-model-only paths and
|
|
23
|
+
audit any List/orderIds/batchInsert/one-to-many signal that conflicts with a
|
|
24
|
+
single-item real entry before asking an owner question.
|
|
@@ -17,6 +17,13 @@ the new hash before continuing.
|
|
|
17
17
|
OpenSpec/SDD is canonical for requirements, API, DB, SQL, tests, and acceptance.
|
|
18
18
|
Superpowers technical design is canonical for source-level HOW and execution.
|
|
19
19
|
|
|
20
|
+
For a database change, SQL is already frozen in
|
|
21
|
+
[release-sql.md](../release-sql.md). The implementation agent may only copy its
|
|
22
|
+
single SQL block verbatim to the exact `target_sql_path`, normalize line endings
|
|
23
|
+
to LF with one trailing newline, and verify `sql_sha256`. Do not add, remove,
|
|
24
|
+
reorder, split, or optimize SQL. Any omission returns to docs and requires a
|
|
25
|
+
refreshed handoff; never design SQL inside the implementation prompt.
|
|
26
|
+
|
|
20
27
|
## Required Preflight
|
|
21
28
|
|
|
22
29
|
- Real entry located.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Managed Work Rules
|
|
2
|
+
|
|
3
|
+
## Design-constitution gate
|
|
4
|
+
|
|
5
|
+
Before changing Superflow managed work itself, read
|
|
6
|
+
`docs/managed-work-design-principles.en.md` and
|
|
7
|
+
`docs/managed-agent-protocol.en.md` completely. Before delivery, walk through
|
|
8
|
+
the constitution's mandatory change-review checklist and state whether the
|
|
9
|
+
change alters any principle.
|
|
10
|
+
|
|
11
|
+
Runner and scripts decide deterministic facts. Agents decide correctness,
|
|
12
|
+
reasonableness, risk, and evidence sufficiency. Scripts must not replace
|
|
13
|
+
semantic review with regexes, and Agents must not take ownership of hashes,
|
|
14
|
+
schemas, counters, or state transitions. A new long-term rule first updates the
|
|
15
|
+
Chinese and English constitutions, protocol, and tests.
|
|
16
|
+
|
|
17
|
+
Managed orchestration owns only dual-Agent dispatch, frozen context, state,
|
|
18
|
+
waiting, evidence, and review loops. API, database, concurrency, transaction,
|
|
19
|
+
and test design belongs to `api.md`, `design.md`, `tests.md`, and source-level
|
|
20
|
+
technical design. Executor prompts inherit rather than redesign. Audit every
|
|
21
|
+
managed-prompt change against this boundary.
|
|
22
|
+
|
|
23
|
+
Managed work is built into `superflow-pipeline`. The user only says to use
|
|
24
|
+
Superflow and provides an implementation prompt, change directory, or direct
|
|
25
|
+
task. Direct tasks receive a minimal contract. SDD work freezes the generated
|
|
26
|
+
implementation prompt and never substitutes `tasks.md` for the execution prompt.
|
|
27
|
+
|
|
28
|
+
Before start, the Host routes by input maturity: docs-only work stops at Coding
|
|
29
|
+
Ready without a managed Task; a user-approved change/prompt is frozen directly;
|
|
30
|
+
a bounded verbal task uses minimal or standard. If a verbal request has a
|
|
31
|
+
direction-changing API, data, concurrency, cross-repository, or owner choice,
|
|
32
|
+
return to clarification/documents instead of letting Runner regexes or Executor
|
|
33
|
+
improvisation replace Host judgment.
|
|
34
|
+
|
|
35
|
+
When MCP is installed, the current host must prefer the `superflow_managed_*`
|
|
36
|
+
tools for submission, waiting, user guidance, and review submission. MCP is a
|
|
37
|
+
channel to the local state machine rather than a third model. Direct host review
|
|
38
|
+
is the only supported mode, preventing a nested supervisor CLI from duplicating
|
|
39
|
+
context, tokens, and review time.
|
|
40
|
+
|
|
41
|
+
When MCP is unavailable, dispatch through:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
superflow pipeline "<implementation-prompt|change-dir|task>" --managed --project "<root>" \
|
|
45
|
+
--supervisor current --executor peer --language <en|zh>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`current/peer` resolves the host and its counterpart automatically. If host
|
|
49
|
+
detection is ambiguous, pass explicit `codex/claude` roles instead of guessing.
|
|
50
|
+
Legacy contracts with missing or retired supervision settings are migrated to
|
|
51
|
+
direct host review on resume. No entry point may spawn a background supervisor
|
|
52
|
+
CLI.
|
|
53
|
+
Keep a single foreground `pipeline`/`resume` waiter so the CLI reads local state;
|
|
54
|
+
never spend host model turns periodically invoking `superflow status`.
|
|
55
|
+
In MCP mode,
|
|
56
|
+
`superflow_managed_wait(taskId, afterSequence, timeoutSeconds=240)` defaults to
|
|
57
|
+
a Host-compatible transport window below common 300-second tool limits. Hosts
|
|
58
|
+
that support longer calls may explicitly request up to 43200 seconds. An active
|
|
59
|
+
request exposes stages and healthy checkpoints through standard MCP progress
|
|
60
|
+
notifications without waking the Host model. One healthy or idle checkpoint does
|
|
61
|
+
not complete wait; two consecutive checkpoints without an effective milestone
|
|
62
|
+
return attention. Ordinary window expiry immediately continues wait from the
|
|
63
|
+
compact snapshot's `latestSequence`, without status or Executor restart. Call
|
|
64
|
+
`superflow_managed_status` for full evidence only when the state requires Host
|
|
65
|
+
attention.
|
|
66
|
+
|
|
67
|
+
After executor delivery, the task enters `external_supervisor_review_required`.
|
|
68
|
+
The current host reads `host-review-N.md`, writes the review JSON, and resumes:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
superflow pipeline --resume-task <task-id> --submit-host-review <review.json>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Hard gates:
|
|
75
|
+
|
|
76
|
+
- Claim the 5/7/12 budgets before an Agent call. The default Executor circuit
|
|
77
|
+
also stops at two million cumulative token units. Provider-dollar accounting
|
|
78
|
+
is not comparable, so the default has no USD circuit and Claude receives no
|
|
79
|
+
`--max-budget-usd`.
|
|
80
|
+
- Freeze the selected language into the contract; prompts, journals, reports, notifications, errors, and resumed rounds must use that same language.
|
|
81
|
+
- Revalidate the frozen contract hash, non-overridable permissions, and 5/7/12 hard limits on every start and resume. Fail closed if persisted contract data changed.
|
|
82
|
+
- Runner uses filesystem snapshots for non-Git workspace changes. Executors must
|
|
83
|
+
never run `git init` for diff, preflight, or delivery, and must not create or
|
|
84
|
+
replace `.git`; repository-identity changes during a task still fail closed.
|
|
85
|
+
- The context manifest marks frozen requirements, designs, prompts, handoffs,
|
|
86
|
+
rules, and task facts as `immutable`, and task/test-report progress evidence
|
|
87
|
+
as `retain`. Immutable entries are read-only; retained entries may be updated
|
|
88
|
+
but never deleted. Native hooks block before mutation and every Host is still
|
|
89
|
+
verified by preflight/final gates.
|
|
90
|
+
- Cleanup separates runtime, workspace-temporary, delivery-artifacts, and
|
|
91
|
+
protected-contracts. Executor cleans only the first two and retains source,
|
|
92
|
+
SQL, tests, reports, and frozen contracts for Host review. Never use pkill,
|
|
93
|
+
killall, a bare kill, port/name-only cleanup, or rm -rf without owner-helper verification.
|
|
94
|
+
- Resolve change directories through `.sdd/state.yaml` `implementation_prompt`; treat `tasks.md` as a checklist only. Copy the prompt into a managed snapshot and freeze its SHA-256 for both agents.
|
|
95
|
+
- The first executor invocation automatically uses the frozen prompt as its task entry.
|
|
96
|
+
- For real-runtime work, the first prompt requires a repository-owned,
|
|
97
|
+
one-command, repeatable, failure-safe, portable acceptance entry covering
|
|
98
|
+
preflight, setup, build, startup, real calls, assertions, and cleanup,
|
|
99
|
+
including the success path and one representative setup/verification failure
|
|
100
|
+
cleanup with final zero residue. The Host reviews all properties together.
|
|
101
|
+
- Call the MCP runtime handshake before start. An installed-runtime change makes
|
|
102
|
+
the stale MCP fail closed before persistence and requires a Host restart.
|
|
103
|
+
Persist verbose logs and print bounded summaries and failure tails only.
|
|
104
|
+
- Verification has three levels: repairs use change-scoped checks; engineering/SDD
|
|
105
|
+
defaults to task-level real acceptance; only an explicit frozen prompt, an owner
|
|
106
|
+
helper/managed-orchestration change, or a new custom cleanup primitive uses
|
|
107
|
+
framework certification. The frozen contract may raise but never silently lower
|
|
108
|
+
the level, and historical evidence reruns only when the diff/finding invalidates it.
|
|
109
|
+
- A normal real-runtime Host review checks task PID/start-fingerprint binding,
|
|
110
|
+
deletion gates, one representative setup/assertion failure cleanup, and final
|
|
111
|
+
zero residue. Distinct business deletion paths and affected/cross-service
|
|
112
|
+
repositories still receive their own proof. It must not rerun shared-helper PID-reuse, non-owner, forged-state,
|
|
113
|
+
and every-signal disaster suites for each business task. Reuse the helper directly
|
|
114
|
+
through a configurable path instead of copying a cleanup framework. Record Host
|
|
115
|
+
usage or an explicit unavailable reason.
|
|
116
|
+
- Pass neither `--max-turns` nor `--max-budget-usd` to a Claude Executor. Do not
|
|
117
|
+
split normal work by a fixed tool-step count or an inaccurate provider-dollar
|
|
118
|
+
estimate. The defaults stop after 60 minutes with no output or a two-hour
|
|
119
|
+
single-invocation deadline; repeated provider failures, token/invocation
|
|
120
|
+
budgets, safety boundaries, and user pause still stop execution.
|
|
121
|
+
- Claude Executor defaults to the official
|
|
122
|
+
`CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000` and
|
|
123
|
+
`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70` settings for earlier long-session
|
|
124
|
+
compaction; explicit user values win. It reloads the frozen prompt and handoff
|
|
125
|
+
after compaction, and final `result.usage` is authoritative for the invocation.
|
|
126
|
+
- Network errors, closed connections, timeouts, and provider overloads share one
|
|
127
|
+
consecutive-failure counter and must open the circuit on the third failure;
|
|
128
|
+
only a complete Agent response resets it. Transient 429/529/overloaded calls
|
|
129
|
+
and connection refused/reset/close or socket failures confirmed before an Agent
|
|
130
|
+
response may be credited; permission, token-plan, quota, and billing failures
|
|
131
|
+
are not, and none may bypass the three-failure circuit.
|
|
132
|
+
- Keep the first invocation in one continuous session. Create a new session for
|
|
133
|
+
review repair or abnormal recovery and retain old IDs for audit; never guess
|
|
134
|
+
with `--last` or `--continue`. Generate `executor-handoff-N.md` for later
|
|
135
|
+
invocations with the prompt hash, task progress, local pending work, external
|
|
136
|
+
prerequisites, all findings, diff stat, and recent report. A new session must
|
|
137
|
+
read it and verify against the current workspace.
|
|
138
|
+
- Write safely discovered Java, Maven, Node, and npm executable paths into the
|
|
139
|
+
first executor policy so the Agent does not waste tool calls rediscovering the
|
|
140
|
+
basic toolchain.
|
|
141
|
+
- Handoff includes exact applicable rule files and a deterministic delivery
|
|
142
|
+
preflight. Executor runs it before returning and fixes line width, whitespace,
|
|
143
|
+
task checkboxes, and missing reports in the same session.
|
|
144
|
+
- The current host performs review in `external_host` mode; the background
|
|
145
|
+
service must not spawn a nested supervisor CLI.
|
|
146
|
+
- Treat `progress.jsonl`, the task contract, review results, and evidence as truth.
|
|
147
|
+
- Executor cannot edit managed state or commit, push, publish, deploy, or bypass sandbox.
|
|
148
|
+
- Supervisor cannot modify target files.
|
|
149
|
+
- Invalid JSON, missing session IDs, and review-time workspace drift block pass. Absence checks use `assertion: negative` to express an expected exit 1/2 without guessing from command names or prose.
|
|
150
|
+
- Expected-failure and fault-injection checks must use a parent command that
|
|
151
|
+
asserts the child's non-zero outcome and itself exits 0. Raw non-zero outcomes
|
|
152
|
+
stay in logs. Invalid negative evidence goes directly to Host review and never
|
|
153
|
+
triggers a full Executor invocation merely to rewrite JSON.
|
|
154
|
+
- Engineering and SDD tasks need successful command evidence from at least two categories among build, test, and runtime/real invocation. Compile-only or unit-test-only delivery cannot enter formal review.
|
|
155
|
+
- Run `superflow-managed-work-check.mjs <root> <task-id>` before delivery-ready.
|
|
156
|
+
- `tasks.md` recognizes only local_required, environment_required, and release_required; untagged work is local. The Runner derives baseline evidence from the checklist, real workspace changes, test report, and successful commands. Executors add taskEvidence only for tasks that need distinct evidence.
|
|
157
|
+
- The Runner merges the complete changedFiles set and stores structured command categories. The same mechanical rejection gets one automatic repair, with at most two automatic repairs overall, then the current host reviews it. Three or more permission denials in one invocation suppress another executor retry.
|
|
158
|
+
- The Runner inherits valid startup, HTTP, test, and build commands across executor results. When the Host confirms complete historical evidence and only current structured metadata is invalid, it passes and promotes the artifact with an audit event instead of asking the Executor to rerun the environment or rewrite JSON.
|
|
159
|
+
- When successful Spring Boot evidence already covers startup, real HTTP/runtime,
|
|
160
|
+
and evidence paths, and only the `invocation` category is missing, this is
|
|
161
|
+
verification-category ambiguity. Runner escalates directly to Host; after a
|
|
162
|
+
pass it promotes with an audit event instead of launching a full Executor for
|
|
163
|
+
metadata repair.
|
|
164
|
+
- The Runner deterministically removes blank structured-array entries. A read-only
|
|
165
|
+
inspection with exit 1/2 that explicitly reports no process, listener,
|
|
166
|
+
container, or residue is a successful empty result; neither case launches the
|
|
167
|
+
Executor for metadata repair.
|
|
168
|
+
- Status separates physical calls, infrastructure credits, and effective
|
|
169
|
+
development calls. Provider switches resume through
|
|
170
|
+
`--provider-switched <reason>`, and stage changes notify the Host conversation
|
|
171
|
+
without waking it for ordinary heartbeat.
|
|
172
|
+
- Page/permission changes require frontend startup and Playwright/Cypress real-browser E2E. Cross-stack API changes require backend Controller and frontend request contracts plus an API-export snapshot.
|
|
173
|
+
- Append the single `run.delivery_ready` event only after the integrity script passes. On failure, require human attention without leaving false delivery-ready evidence.
|
|
174
|
+
- A passing run enters a three-stage source/environment/release state and still requires explicit Git approval.
|
|
175
|
+
|
|
176
|
+
## Recovery
|
|
177
|
+
|
|
178
|
+
After a background failure, recover from the task contract, event journal, run
|
|
179
|
+
state, and latest checks. Old session IDs are audit records, not recovery
|
|
180
|
+
dependencies. Plain `--resume-task` for a healthy `running` task is safe attach
|
|
181
|
+
and continued wait only: it cannot reset state or budgets or launch another
|
|
182
|
+
Executor. Only a recorded PID proven dead enters stale recovery; a missing PID
|
|
183
|
+
fails closed into attach-and-wait. An active MCP wait's progress notifications
|
|
184
|
+
are request-scoped, not autonomous callbacks after the Host turn ends.
|