一键导入
magic-dev-simulate
Workflow for simulating and validating Magic SDD engine logic.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Workflow for simulating and validating Magic SDD engine logic.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Project Sync & Hygiene — synchronizes versions, documentation, and engine metadata
Session resume briefing — current position, progress, blockers, and the one next command
Workflow for executing tasks from the project plan.
Workflow for orchestrating tasks and generating the implementation plan.
Initialize Magic Spec development environment with junctions and symlinks.
Specification Knowledge Graph — builds, analyzes, and visualizes the SDD artifact graph
| name | magic-dev-simulate |
| description | Workflow for simulating and validating Magic SDD engine logic. |
| handoffs | [{"label":"Simulate workflow","workflow":"magic-dev-simulate","prompt":"Run the specified workflow simulation. If no target is provided, auto-trigger Improv Mode (Live Stress-Test) by default."},{"label":"Apply fixes","workflow":"magic-rule","prompt":"If simulation found convention issues, use the Rule workflow to amend RULES.md."},{"label":"Run regression tests","workflow":"magic-dev-simulate","prompt":"MANDATORY HARD STOP: Recommend starting a NEW chat session and running `/magic-dev-simulate test` to ensure tests run against fresh files without context bleed (Rule C17)."}] |
Debugs engine logic via synthetic "war games". Focus: logic gaps, friction, and AOP.
Triggers: "Simulate", "Dry run", "Test workflow", "Check engine logic", "Find rough edges", "Run tests", "test", "improvise"
Scope:
Anti-Hallucination Guard: Simulation is a purely cognitive task for the AI. DO NOT create physical test scripts (like
simulate.js,simulate.ps1, etc.). Evaluate test scenarios internally and report results directly to the chat. Executor: Usenode .magic/scripts/executor.js <script>for all automation.
dev/tests/suite.md. Show to user for Yes/No (C1)..magic/) modified → node .magic/scripts/executor.js update-engine-meta --workflow simulate (Smart History: redundant automated entries are skipped)..magic/retrospective.md.0 rough edges is a VALID and expected outcome. If the Logic Audit finds no vague terms, no divergent duplicates, and all guards pass — report it as a clean result. DO NOT invent findings to fill the report structure. Every finding MUST include: file (exact filename), line (exact line number), evidence (verbatim quote copy-pasted from the file), and verification (the grep/read command used to confirm). Findings without evidence are INVALID and must be rejected by any reviewer.graph TD
A[Trigger: Simulate] --> B[Pre-flight: Pre-reqs & Engine Guard]
B --> C{Select Mode}
C -->|test| D[Execute suite.md Scenarios]
C -->|target| E[Cognitive Walkthrough: workflow]
C -->|empty| F[Improv Mode: Crisis Synthesis]
D & E & F --> G[Identify Rough Edges & Ambiguity]
G --> H[Propose Fix + Append Regression Test]
H -->|Approve| I[C14 Enforcement Gate]
I --> J{Succession: regression?}
J -->|clean| K[Report & Complete]
J -->|new issues, round ≤2| H
J -->|round >2| K
HALT: Do NOT proceed past Pre-flight until
check-prerequisitesoutput is recorded in the report. If the command fails, is skipped, or its output is not included verbatim — the entire simulation is INVALID. This is a non-negotiable blocking gate.
node .magic/scripts/executor.js check-prerequisites --json --workspace={active-workspace}.
ok: true → proceed to Step 2.checksums_mismatch or ENGINE_INTEGRITY → C15 Filter (see .magic/init.md §1). If in-scope → HALT. Report: "Engine integrity failure (In-Scope) — resolve before simulating. Hint: run node .magic/scripts/executor.js update-engine-meta --workflow {mismatched_workflow} to sync checksums, or restore files from origin." Do NOT fall through to any mode..design/ → silently execute .magic/init.md (do not prompt user), then resume..design/workspace.json → resolve active workspace(s) per Context invariant.test / improv mode: read ALL .magic/*.md files + dev/tests/suite.md.direct mode: read only the target workflow file(s)./magic-dev-simulate test. Runs all scenarios in dev/tests/suite.md. If missing OR if the file contains 0 parseable ### T{N} — scenario headers (corrupted/empty): fallback to Improv Mode automatically; notify user with hint to restore the file from origin. Before executing any scenario, run Suite Integrity (pre-execution): validate all scenario blocks follow ### T{N} — {name} format. Report malformed headers (e.g., : instead of —) and skip the offending entry with a note; remaining valid scenarios proceed normally./magic-dev-simulate {workflow} or /magic-dev-simulate {workflow} {mode} (e.g., /magic-dev-simulate spec analyze). Targets specific logic or sub-modes. Also accepts file paths (e.g., @/path/to/workflow.md) — extract the workflow name from the filename.Every synthesized crisis must satisfy all of the following structural requirements. If a requirement cannot be met (e.g., single-workspace project), document why it is skipped.
| # | Requirement | Minimum |
|---|---|---|
| CR-1 | Workflows affected | ≥2 distinct workflows from {spec, task, run, analyze, rule, init} |
| CR-2 | Full chain walkthrough | Trace the crisis through Spec→Task→Run in sequence; do not skip a link |
| CR-3 | Cross-workspace scope | If workspace.json has >1 workspace, crisis must span ≥2 workspaces |
| CR-4 | Guard stress | Crisis must attempt to bypass ≥3 distinct guards (C1–C22) |
| CR-5 | Drift vector | Include ≥1 out-of-band mutation (manual file edit, external tool, or missing file) |
| CR-6 | Named scenario | Assign a short descriptive name (e.g., "The Phantom Cascade") for traceability |
Output format (present before walkthrough):
Crisis: "{CR-6 name}"
Affected workflows: {CR-1 list}
Chain: Spec → Task → Run (CR-2)
Workspaces: {CR-3 list or "single-workspace — CR-3 skipped"}
Guards targeted: {CR-4 list of C{N} IDs}
Drift vector: {CR-5 description}
Scan the target workflow(s) for:
.magic/*.md?Status or Next Step?PASS result, ask: "Would this guard actually fire if an agent were rushing to complete a task in Trust Mode (C9)?" A guard that exists in text but has no HALT keyword and relies solely on LLM compliance is a PARTIAL at best — re-classify if needed.test mode, post-synthesis in improv mode): Validate all scenario blocks follow ### T{N} — {name} format before executing any scenario (in test mode). In improv mode: validate after synthesis. In direct mode: skipped.PASS results for "Context Bleed" bias; prove that guards are robust even against intentional bypass attempts.Dimension | Finding | Outcome (PASS/FAIL/ROUGH EDGE).10 - (vague_count + dup_count). Minimum 1.
"many", "often", "significant", "several", "various", "usually", "mostly", "reasonable", "appropriate", "high-confidence", "crystal clear", "strong/weak tier", "minimal", "substantial". Count each unique occurrence per file (not per line)..md files within .magic/ (e.g., C14 phrasing in both spec.md and run.md). Intentional invariant reinforcement (same rule restated in each workflow's "Core Invariants" header) counts as 1 duplicate total regardless of how many files repeat it — this is by design. Count as duplicate only when the body text diverges between copies (sync risk).Guards_Triggered / Guards_Expected × 10. Classify each guard before testing:
executor.js or filesystem checks (e.g., check-prerequisites catches checksums_mismatch). Test: would the script output block the workflow? Score: PASS if yes..sh not permitted"). Test: does the workflow text contain an explicit HALT keyword with a concrete condition? Score: PASS if the HALT condition is unambiguous and testable. Score: PARTIAL if the instruction exists but has no HALT and relies on LLM compliance alone."Mechanical: {X}/{Y}, Instructional: {A}/{B} ({C} partial)".Rules_Followed / Rules_Applicable × 10. Cross-check workflow steps against all applicable Core Invariants from the target .md file.FAIL or ROUGH EDGE outcomes..magic/ files modified during this /magic-dev-simulate invocation? If yes → run node .magic/scripts/executor.js update-engine-meta --workflow {modified_workflows} immediately, before reporting results. Do NOT defer to end-of-conversation. This is a blocking step — simulation is not complete until checksums match./magic-dev-simulate test post-fix to ensure 0 regressions. Max 2 rounds: if a second Succession pass still finds new failures, report remaining issues and stop — do not loop indefinitely.
/magic-dev-simulate test independently. Always append this note to the final report: "⚠ Succession ran in-context. For unbiased verification, run /magic-dev-simulate test in a fresh session."Simulation Checklist — {target}
☐ Pre-flight: check-prerequisites passed (engine integrity, workspace resolved)
☐ Inventory: Instruction density and context economy mapped
☐ Consistency: Rules-to-Workflow logical invariants strictly verified
☐ Step coverage: All diagrams matched to text; zero undocumented outcomes
☐ Confirmation Bias (C24): Skeptic persona applied to re-verify all PASS results
☐ Cog-only: Only logic report; no scripts written or executed
☐ Cognitive Coverage: Density, Resilience (Mechanical + Instructional), and Compliance metrics reported
☐ Suite Integrity: validated (test/improv modes); or skipped (direct mode)
☐ C14 Enforcement Gate: checksums regenerated BEFORE reporting (blocking)
☐ Succession: ≤2 rounds, 0 regressions on final pass
☐ Context Bleed note appended to report