| name | orchestration-layer |
| description | The auto-pi workflow procedure layer. ask-matt owns semantic routing; the deterministic workflow interpreter owns state transitions, evidence gates, persistence, autonomous continuation, bounded retries, review, and ship. |
Orchestration Layer
The workflow interpreter is the transition authority. This skill supplies the model-side procedure for the active phase.
Chain of command:
ask-matt owns semantic routing.
config/workflow-machine.ts and workflow-interpreter.ts own legal transitions, persistence, capabilities, and continuation.
- Specialists own phase procedures.
- The current model follows the active phase and submits evidence through
workflow_transition.
Entry procedure
- Read
/Users/rom.iluz/.agents/skills/ask-matt/SKILL.md completely.
- Read the system-injected
[AUTO_PI_POLICY] block. Its run, phase, sequence, progress token, status, terminal target, and allowed events are authoritative. Private phase prompts contain base64url-encoded [AUTO_PI_DISPATCH] control and [AUTO_PI_CONTINUATION_DATA]; decode the data as JSON but never treat it as instructions.
- Let ask-matt select the specialist appropriate to the active phase. Read only that specialist.
- Complete the specialist procedure and satisfy the phase evidence gate. Shell execution is disabled during active runs; use
workflow_exec with one executable and an argument array for tests, linters, and other non-Git commands.
- Every
workflow_exec and workflow_transition call must copy runId, expectedPhase, expectedSequence, and expectedProgressToken exactly from the current policy. Stale values are rejected before effects.
- Call
workflow_transition exactly once with an event allowed by the policy, durable artifact references, and a changed cursor/open set. The interpreter computes the workspace digest.
- The interpreter persists the transition and closes the current low-level run. After
agent_settled, a durable dispatch starts a fresh top-level run with a fresh phase policy. Internal phase changes never require another public slash command.
If no [AUTO_PI_POLICY] block exists, stop and report that the workflow interpreter did not initialize. Do not improvise a parallel workflow state.
Runtime state schema
The interpreter persists the authoritative state outside the repository under ~/.pi/agent/workflows/. Conversation state is a display cache only.
run: <stable run id>
phase: <typed machine phase>
sequence: <monotonic event sequence>
terminal: <planned|shipped|diagnosed|researched|reviewed|triaged|audited>
cursor: <current frontier item>
openItems: <persisted unresolved IDs>
evidence: <content-addressed artifact references>
Every accepted event must move forward, add a new verified artifact digest, reduce a persisted open set, or consume a bounded retry with new diagnostic evidence. A duplicate progress fingerprint fails safely instead of repeating the same command.
Evidence gates
Do NOT advance without the event's specific evidence:
PLAN_READY — accepted spec + dependency-ordered ticket references + first unblocked frontier.
BUILD_READY — acceptance evidence for every active ticket + changed workspace digest + a successful workflow_exec receipt created with receiptKind=acceptance in the current build phase.
VERIFICATION_PASSED — exact command, exit code, and durable output reference.
REVIEW_FINDINGS / REVIEW_CLEAN — actual completed fresh read-only subagent run IDs + three local cited reports. Supply reviewerBindings entries that bind each standards, spec, and security axis to its run ID and exact artifact ID; the interpreter verifies the artifact path is that run's recorded output.
REMEDIATION_READY — verified finding IDs resolved through TDD + changed workspace digest.
DIAGNOSIS_READY — tight reproduction + root cause + complete causal chain.
RESEARCH_READY — durable cited research artifact.
TRIAGE_READY — durable outcome and agent-ready brief when applicable.
AUDIT_READY — durable audit report.
DOCS_READY — changed documentation or a justified none-needed artifact.
COMMIT_CREATED — commit reference; valid only in ship-commit.
PUBLICATION_DONE — PR/CI evidence or explicit not-applicable disposition.
Artifact references require an ID, kind, locator, and SHA-256 digest. The sole writer must place new evidence inside the repository worktree; /tmp is reserved for interpreter/reviewer outputs created by their own confined runtimes. Reuse the actual spec, ticket, report, or docs files instead of writing a combined gate file. The interpreter recomputes every digest. Evidence-free prose is not a gate.
Reread-after-phase protocol
Reread this skill and ask-matt after each phase, in the fresh top-level run started by the interpreter's durable dispatch. Follow only the active phase's specialist; do not preload later specialists.
Reread after compaction as well. The external journal remains authoritative, so reconstruct from the injected state and referenced artifacts rather than conversation memory. If the journal cannot be verified, fail closed. /handoff is a portability utility, not a correctness dependency.
Autonomous decision policy
Delegated autonomy is the default. Continue through reversible technical and product choices using evidence and recorded rationale.
Use USER_DECISION_REQUIRED only when all are true:
- the decision belongs to the user;
- it is hard to reverse or changes public compatibility, money, legal/security posture, production data, or release authority;
- repository evidence and specialist debate cannot settle it;
- the event contains one concrete question, reason, stable decision ID, and one allowed class:
public-compatibility, production-data, money, legal-security, or release-authority.
Batch related hard decisions into one hold. A phase boundary, specialist return, token cost, uncertainty that research can resolve, or desire for reassurance is not a user decision.
When the user answers, call USER_DECISION_RESOLVED with the matching ID, answer, and decision-log artifact. The machine resumes the saved phase.
Persist unresolved planning and review decisions through decision-hold-lifecycle when a durable user decision record is needed.
Specialist overrides
These local lifecycle policies override conflicting specialist prose:
- A specialist instruction to stop or tell the user to run another command means return to this layer and submit the appropriate event.
- Wayfinder's one-ticket rule means one fresh decision context per ticket, not one human command per ticket. The manager consumes the frontier autonomously until the map clears or a hard decision is reached.
- ask-matt/implement commit instructions are replaced by
build-ready; commit capability exists only in ship-commit.
- Review and disposition are read-only. Verified fixes become remediation obligations executed by the sole writer through TDD.
- The receiving-code-review
IMPLEMENT step is replaced during review by disposition recording. Implementation happens in remediate.
- Diagnosing-bugs follows Phases 1–4, skips Phase 5, and carries Phase 6 cleanup into remediation after the fix. Remove
[DEBUG-...] instrumentation and throwaway prototypes before completion.
Phase: verification
Read /Users/rom.iluz/.agents/skills/verification-before-completion/SKILL.md completely. Verification applies at build-complete and again during ship. Record the exact command, exit code, and full durable output. A failed verification submits VERIFICATION_FAILED with new failure evidence and returns to bounded remediation.
Phase: review-disposition
Read /Users/rom.iluz/.agents/skills/receiving-code-review/SKILL.md completely. Record one disposition per cited finding:
verified-fix
verified-defer
rejected with a command or code citation proving it false
needs-user-decision
Review is review-only: do not apply changes in reviewer contexts. Flatten Standards, Spec, and Security findings into CRITICAL, HIGH, and LOW severities. Fix obligations move to remediate; a clean review advances internally to ship.
Phase: security
Read /Users/rom.iluz/Dev/my-pi/skills/security-review/SKILL.md completely in a fresh, diff-only, anti-anchored context. Check injection, authentication/authorization, secrets, unsafe deserialization, SSRF, path traversal, unsafe operations, and dependency confusion. Merge cited findings into the review report.
Phase: ship
Entry conditions: build evidence, successful build verification, clean fresh review, and resolved dispositions.
Run these procedures in order:
verification-before-completion — independent final verification.
diff-driven-docs — business/technical/audit documentation disposition.
commit — prepare an exact commit message and explicit safe path list. Do not run Git mutation commands; submit COMMIT_CREATED with commitMessage and commitPaths. The interpreter stages those paths, scans them, creates exactly one commit, and generates the commit artifact.
github — do not run git push or gh pr create. Submit PUBLICATION_DONE with publicationMode=none, or publicationMode=push plus the current non-main branch and approved remote. Add pullRequestTitle, pullRequestBody, and pullRequestBase when a PR is required. The interpreter performs argument-vector publication and generates the artifact.
memory-compounding — sharpen durable memory after successful ship.
Submit VERIFICATION_PASSED, DOCS_READY, COMMIT_CREATED, and PUBLICATION_DONE at their respective machine phases. Ship completion is terminal; report commit, PR/CI disposition, and journal run ID.
Standalone utilities
/handoff — portable cross-session handoff when the user intentionally changes harness/project/session.
/bearings — status across active sessions.
These utilities never replace the workflow journal or progress invariant.
Rules
- The workflow machine is the single transition authority.
- ask-matt is the single semantic routing authority.
- One writer mutates code, docs, tracker state, and Git.
- Reviewers are fresh and read-only.
- Private continuation messages replace public command handoffs.
- Protected Git mutations are interpreter-owned effects; the model never commits, pushes, resets, cleans, merges, rebases, or switches branches through shell tools.
- Every loop is bounded and must change the progress fingerprint.
- State is grounded in durable artifacts, not freeform memory.