feat: add multi-phase workflow enforcement rules for skill generation (#236)
* feat: add multi-phase workflow enforcement rules for skill generation The agent-instructions format and author-agent-instructions template had no guidance for multi-phase interactive workflows with explicit gating. Skills generated from complex pipelines (e.g., a 7-pass PCB design workflow) would describe the pipeline architecturally but not behaviorally constrain the agent, causing it to skip intermediate steps and jump directly to final output generation. Add 'Multi-phase workflow rules' to the agent-instructions format covering four required enforcement mechanisms: - Critical constraints block (prohibited output types, self-correction) - Phase gate directives (explicit stop at each phase boundary) - Pass tracking block (observable state announcement) - Anti-shortcut warning (failure mode rationale) Update the author-agent-instructions template to: - Detect multi-phase source templates and apply the new rules - Preserve phase gating logic instead of condensing it away - Add Critical Rule blocks at each phase boundary Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * feat: add IR consumption rule for generated scripts in multi-phase workflows Scripts produced by post-binding tool steps (e.g., schematic renderers, PCB layout generators) were hardcoding design data as Python dicts instead of reading from the IR files that earlier passes produced. This defeats the purpose of the IR architecture — the IRs exist but are ignored. Add rule 5 (IR consumption rule) to the multi-phase workflow rules: - Generated code MUST read component lists, net names, values, and library mappings from IR files at runtime - Only format-specific syntax constants are permitted as hardcoded values - Self-check: if deleting the IR files would not change the script's output, the script is hardcoding data — rewrite it Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * feat: propagate IR consumption rule to author-agent-instructions template The template's Step 2 (skill planning) and Step 3 (condense) referenced the multi-phase workflow rules but didn't mention the IR consumption rule added in the previous commit. Both locations now include the directive: generated code must read from artifacts at runtime, never hardcode data, with the self-check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * feat: add fail-stop backstop to IR consumption rule If generated code cannot read or parse a required artifact (file missing, malformed YAML, missing fields), it MUST raise an error and halt. It MUST NOT fall back to generating data from memory, prior context, or hardcoded defaults. A missing artifact means an earlier pass needs re-execution, not a workaround. This closes the last loophole: without this rule, an agent hitting a friction point reading an IR file could silently fall back to inlining the data from conversation context, which is how hardcoding starts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * feat: add field-level mapping and gate-driven iteration rules Two additions to the IR consumption rule: 1. Field-level mapping: Tool steps that produce scripts must enumerate which specific artifact fields the script reads (e.g., connector positions from connector_placement[].position.x_mm), not just generic references like 'read from IR-3'. Generic references produce scripts that ignore detailed fields. 2. Gate-driven iteration: When a tool step has a validation gate (e.g., DRC zero violations) and the gate fails, the agent must iterate on the script to fix violations — not ask the user whether to proceed. The agent only presents output for user approval after gate criteria are satisfied. Asking the user to accept a failing gate is itself a gate violation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * fix: address PR review comments — consistency and formatting - Convert 'Multi-phase workflow rules' from bold text to ### heading for stable anchor linking - Align multi-phase trigger criteria between format and template: '3+ sequential phases' or 'interactive with explicit gates/passes' - Fix fenced code block indentation in list items 2 and 3 for correct GitHub Markdown rendering (4-space indent + blank line separation) - Align Critical Constraints placement wording: 'immediately after the opening task description, before architecture/methodology content' Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * fix: align Critical Constraints heading with format spec Use the full heading text 'Critical Constraints — Read Before Doing Anything' as recommended by the format spec to maximize salience and reduce variability in generated skills. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * fix: address round 4 review comments - Demote Multi-phase workflow rules from ### to #### so it nests under section 4 (CLI Skill) and preserves the document outline - Expand the IR consumption rule checklist in the template's Step 2 to include all sub-requirements: fail-stop, field-level mapping, self-check, and gate-driven iteration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> --------- Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> Co-authored-by: Alan Jowett <alan.jowett@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A
Alan Jowett committed
3cd55726cbb22f3a67b2e2571d6cb45eb5601990
Parent: c9e3e73
Committed by GitHub <noreply@github.com>
on 4/8/2026, 11:28:19 PM