--- name: engineering-workflow description: Required Matt Pocock workflow entry for engineering research, planning, building, debugging and review when Matt is the selected methodology. Track ordered phases, coordinate authorized workers and require evidence. Matt owns engineering in every harness. --- # Engineering workflow This is Mifal's execution contract for Matt Pocock's methodology, not an upstream Matt skill. Ask Matt supplies the route map; this adapter makes execution ordered and visible. Use it on every engineering request owned by Matt, including small fixes, research, plans and reviews. ## Select the owner Matt owns engineering in every harness. ## You are the driver Matt wrote his flow for a human who starts each skill, answers the interview, decides at each phase boundary and reads the result. In Mifal the session that takes the request does that; with a team, that session is the lead. - Settle what the request, the repository and the agreement settle, and say which. Yours without asking: reading, creating branches and worktrees, tests and builds, a sub-agent for a read, a fresh check or a scoped task, and edits inside the task's scope. Go to the human for a change of scope, a blocker you cannot clear, an irreversible choice or a reserved action. A human can answer when they are in this session and have not said they are away; when that is unknown, ask once and continue. With no one to answer, take the reversible option, record the assumption and its cost if wrong, and continue. An irreversible choice waits. - The human keeps: push, publish, deploy, release and merge; messages or posts to anyone outside the team; installs; destructive operations, spending and access; commits unless the request grants them; a cut of a workflow step; and durable changes to rules, memory or skills outside the task's repository, which you propose with evidence. - A loop of attempts at one gate stops after three tries without progress: record the blocker and move to other unblocked work, or stop. - Finish with one decision-ready brief: what was built, the evidence, each decision you took for the human, and what only they can do. A human reads the pull request before it merges. ## Required entry 1. Read repository instructions and the existing task state. Declare the deliverable, authorized actions, acceptance criteria and one route: research, plan, build, debug or review. 2. Load the `ask-matt` skill completely, as step 4 loads a skill (fallback `~/.agents/skills/ask-matt/SKILL.md`). Use its current map to select the procedure for the active phase. Ask Matt's on-ramps are yours to start (rows in the [workflow map](references/workflow-map.md)): `triage` for raw issues you did not write, `wayfinder` for work too large or unclear for one session (its human-in-the-loop tickets stay the human's), `handoff` when work moves to another agent kind, directory or a prototype detour. At each phase transition make its phase-boundary decision (continue, clear, handoff, subagent, compact) in one line. One agent is the default: a team pays only for independent slices, a large read worth isolating, or a fresh check. Before coordinating multiple workers, load the `team-lead` skill completely the same way. Use Team Lead for explicit team requests, or for independent slices with parallel writers when the request or the agreement says so. 3. Before the first edit or dispatch, create or reconcile the route's ordered phase checklist. A solo request that fits one session keeps it in the conversation (Solo form, below) and reads no record reference. A team, or work that spans sessions, keeps one record file: read the [record card](references/record-card.md), keep one tracker, and record procedures, reads, evidence and applicability decisions there; [phase-record.md](references/phase-record.md) is the reference a refusal points into. Preserve the original required outcomes as named `Done means`; acceptance must reconcile them, not only dispatched tasks. 4. Load the selected skill completely before performing its phase. Prefer the native skill tool; otherwise resolve `~/.agents/skills//SKILL.md` and read it through the filesystem tool. A provider's "call the Skill tool" means this loading, one skill per call. Never announce a skill as loaded after reading only its description. Bind its read record to the body hash; a changed body requires a reload, not reuse of an older session read. At entry and material scope/technology changes, pick the technology specialists that apply from the skill descriptions your harness lists, and load only the selected bodies; a lead narrows candidates with the [stewardship inventory](../team-lead/stewardship/README.md). Record consequential omissions in the plan or brief. 5. Show `Owner: Matt | Route: | Phase: | Next gate: ` at entry, consequential transitions and resume, and at entry a `Path:` line: the steps that will run and the Ask Matt branch that dropped any. In recorded work, run the phase-record check (`workflow --gate entry|review|accept`, and `brief --matt` for each brief) before every dispatch, every review and every acceptance, and log each pass first as `Check: start | passed | at:`, a new one as each step begins (`Check: start to-spec` included, when you run to-spec yourself after the griller closes). `` is a name from the workflow map's Required steps (scope, grilling, to-spec, to-tickets, implement, review, retro), or the route's phase word where the route has no such step; an unknown name (`start entry`) is refused. A dispatch with no passing Check above it never ran its gate, and a failed required check holds it. ## Ordered phases and completion gates | Route | Required phase order | Evidence required | |---|---|---| | Research | Scope/questions → source plan → investigate → synthesize → review claims → verify/report | Answered questions, dated primary sources, contradictions and uncertainty; every material conclusion checked against evidence. Use Matt's research procedure for delegated investigation when supported and authorized. | | Plan | Scope → inspect code/versioned docs → resolve design decisions → plan → review → verify/deliver | Acceptance criteria, affected seams, dependencies, chosen approach, relevant check commands and no unresolved blocking decisions. Use Matt's planning branch where intent or design is unsettled. | | Build | Scope → research/context → plan → implement → review/remediate → verify final revision → retro → report | Observable success before edits, behavioral slices where applicable, reviewed final diff, passing relevant checks and Matt's session retrospective. Load implement/TDD for behavioral code and code-review at completion. | | Debug | Scope → reproduce/research → hypothesis and fix plan → diagnose/fix → review → regression/final verification → retro → report | Observed original failure, tested root-cause hypothesis, fix removes that failure, regressions pass and the fix receives a session retrospective. Load diagnosing-bugs for diagnosis; every behavioural fix also loads tdd (reusing an existing failing test counts) and code-review before review, while diagnosis-only work does not need tdd. Missing reproduction stays explicit; diagnosis-only work records that no fix was made. | | Review | Fix base/scope → inspect context/spec → review → substantiate findings → verify/report | Load code-review; each finding has a location, trigger, consequence and evidence. Check for duplicates and false positives. Zero findings is valid. | Every request runs its route's phase sequence, one phase at a time, each with its procedures. You choose the path with Ask Matt's branches, show it and start. Scale depth, never the steps: a tiny fix can use a two-line plan and one relevant check. The solo form's sampled retro is the one recorded exception. Only the human cuts a step that Ask Matt's branches keep, at any time and in their own words; silence is not a cut. Brakes first: before any review the repository's deterministic checks (types, lint, tests) pass, and a done-means names its command; a repository with none gets `setup-pre-commit` proposed where it fits (it installs dependencies, so it needs authorization). Record a cut as `Cut: | | ` and Ask Matt's branch, which is not a cut, as `Route decision: multi-session: no; reason: at:` (the `yes` form is in the phase record), stamped before executing it. Field formats and what a cut lifts are in the [phase record](references/phase-record.md). Build/debug review findings return to implementation; failed verification returns to diagnosis or implementation, followed by renewed review where the changed scope warrants it. **Solo form.** With no team and one session, the conversation holds the state. Show the entry line and the `Path:` line there (its steps are your checklist; say when each closes); then start, with no further stops except real scope or safety decisions. - *Grilling* at solo depth is a written list of your design decisions, each with its source or reason. A decision that is hard to reverse (a public interface, data or a schema, removed behaviour, security, a new dependency) gets a second agent to grill it, or goes to the human. Skip the interview only when the request or an accepted plan states the behaviour concretely (Ask Matt: `tdd` on its own), and name that branch on the `Path:` line. - *Review* the work-in-progress snapshot (`review-snapshot.py`) against Standards and Spec once the deterministic checks pass. Use a fresh sub-agent that has not seen your reasoning when you have one, and call its result a fresh review; otherwise label yours self-review. Report the findings or "none" with the scope examined, and keep the name independent review for a reviewer outside the session. - *Retro* is sampled (a local override, below). Run it when the session's record, not your memory of it, shows a failed check after a claim of done, a correction from the human, a workaround, a repeated attempt, a long search, a mistake a tool could have caught, information you could not get, or a repository with no deterministic check: load `retro` and `writing-for-agents` and write the findings before the final answer. Otherwise report `Retro: skipped, smooth build`. On every route: - Complete a phase only when its evidence exists and meets the criteria; a delegate's claim or an unrelated passing command is not evidence. When evidence fails or cannot be obtained, keep the phase incomplete, repair within scope, or report the concrete blocker. - A coordinating lead loads Ask Matt, Team Lead and its own selection and acceptance procedures; it need not read every worker's technical reference. Late reading cannot establish earlier compliance. - Record exact check commands, exit status and the revision/content checked. After edits, rerun affected checks; stale results cannot close the final gate. - Pin the actual review snapshot before dispatch. For committed work, use the named commit comparison. For work in progress, use `~/.agents/mifal/tools/review-snapshot.py --repo --base ` with explicit `--path` arguments for owned untracked files; it replaces a provider's HEAD-only diff and nonempty-diff precondition. Give reviewers the snapshot identity, commands and file list, and check the same identity after review. Never commit merely to make a review diff exist. - Persist material decisions and multi-session state in the repository's existing task/document location. After compaction, reload this adapter, the active specialist and the existing state (a lead also reloads `team-lead`; reload Ask Matt when a routing decision is still ahead), and in recorded work add a new `Loaded:` line beside the original for each body you reload (never rewrite the first); validate evidence and resume at the first incomplete phase. - Before a whole-task success claim in recorded work, run the phase-record accept check against the authoritative state: named required outcomes, final evidence and completed execution phases. A worker receipt is not parent completion. Keep the final Report item open until delivery; required blockers remain incomplete. - After a recorded build or fix (the solo form samples it), load `retro` and its `writing-for-agents` dependency, inspect the actual session or logs, and record the findings before acceptance with the pinned Retro artifact the phase reference defines. A coordinated build has one parent retrospective. Its proposals follow the driver's list of what stays human. ## Workflow ownership - Explanation and research-only requests remain read-only. Review-only requests produce findings; implement remediation only when requested. - A build starts with Matt's interview unless the existing plan/ticket already supplies accepted scope and settled design decisions. In recorded work, record `Grilling` with that evidence and its digest before implementation. Calling a task concrete is insufficient: the request's own words must state the behaviour. Reuse accepted decisions rather than repeating their interview. Workers inherit the parent's evidence. - DDD is Mifal's documentation-driven validation layer. Select it when the user asks for DDD, technology is unfamiliar, a consequential API/lifecycle/security assumption lacks evidence, or observed behavior contradicts an assumption; ordinary settled work needs only its relevant documentation checks. When DDD applies, load `ddd` and the relevant phase procedure as step 4 loads a skill: `ddd-scope` during research/context, `ddd-ground` during planning, and `ddd-verify` during final review/verification, and show `Validation: DDD` at entry. DDD validates inside the current Matt phase and the one existing task state; Matt owns lifecycle progression. - For changed user journeys, visual direction or interaction, including backend changes with user-visible effects, read [UI/UX acceptance](../team-lead/references/ux-acceptance.md) during planning and before final acceptance, and select only the applicable UI, UX and motion procedures; a solo agent uses the same checks. - For a multi-ticket build, use `implement-spec` when its parallel execution is explicitly authorized for the task or by the standing project agreement and the harness supports it. Otherwise retain one writer in dependency order. Do not start `implement-spec` inside an active Pi run. Team Lead owns briefs, capacity and acceptance; `implement-spec` owns the ticket frontier and integration order. Record one scheduler and one integration owner; workers start from the integration branch and inherit the selected methodology. - Mifal's skills are model-invoked by default: none declares an invocation blocker, because the driver must be able to start every skill a human would type. That flag is Mifal's one change to Matt's skill bodies. Eligibility does not authorize external actions. - Repository setup is a prerequisite, not permission to create an external tracker. Load `setup-matt-pocock-skills` when needed and use the repository's configured tracker and document layout. - Local overrides of Matt's procedures (record any other here): under Team Lead, the grilled user is the lead, so an agent other than the lead grills the lead and only what the lead cannot settle goes to the human; distributed grilling feeds to-spec, so the lead runs `to-spec` and `to-tickets` itself, reading the round and answer files as the conversation. In the solo form the interview is the driver's written decision list, and the retro is sampled: Matt's upstream `docs/engineering/retro.md` says a smooth session has little to teach, and the shipped `retro` body has no such rule, so the sampling is Mifal's. - Installing a skill, loading its body and verifying its behavior are separate claims: report configured, observed and verified separately.