The orchestrating (main) session's procedure for executing one stage of the plan, from reading the stage to reporting it; use it when asked to run, start or continue a plan stage. Only for the main session — a subagent following a brief must not use it (it implements directly and never spawns further agents).
Install
npx skillscat add maxon-lang/maxon-rewrite-bootstrap/run-stage Install via the SkillsCat registry.
Running one stage of the plan
The plan is C:\Users\Eric\.gemini\antigravity\brain\de77fa0c-5fcc-4f70-b8fd-8c17e7a03ef2\plan.md. This skill is for the
session that talks to the user. A subagent never uses it: it does the brief it was given, implements directly, and
spawns no agents.
Rules of the session
- The main session plans, briefs, merges and reports. Every implementation task goes to a subagent.
- Model:
sonnetby default.opusonly for design-heavy or subtle work: the scheduled front (plan 1.2a), porting
the checker's ownership and range analysis, or debugging a failure whose cause is not obvious. - Parallel subagents that edit files get their own git worktree only when the state they need is committed. A
worktree starts from HEAD, so it lacks every uncommitted or untracked file (self/,cmd/, earlier stages' work), and
commits happen only when the user asks. Otherwise run the tasks sequentially in the main tree, or give each parallel
subagent disjoint paths in the main tree. Tightly coupled sequential edits go to one subagent in the main tree. - Workflow scripts (multi-agent) only when the user asked for a workflow; otherwise the Agent tool.
- Context control. The main session reads no large file and no dump: maxon's
Parser*.maxonfiles are ~600 KB anddocs/LANGUAGE_REFERENCE.md~420 KB; search them with Grep and read line ranges. Each subagent gets one narrow task,
file paths (never pasted contents), reads big files only by search and line ranges, passes large intermediate results
through scratch files, and returns a short summary. A fresh subagent per task; do not reuse one across tasks. - A repetitive multi-file change is made by a tool first: a command of the compiler or plain Go in
cmd/<name>/
(ascmd/convertis), run once, reviewed by its diff. Hand edits across many files are a sign the tool is missing. - Open decisions go to the user, batched in one message, the recommended option first, before delegating any work
that depends on them.
Decisions that hold (do not re-argue)
- The compiler is
self/(C:\Users\Eric\Dev\minimaxon\self), built from the seed (seed/README.md). Go is for the
generators (internal/) and the tools (cmd/) only. - Compatible with current maxon (
C:\Users\Eric\Dev\maxon:maxon-bin/,stdlib/,specs/,docs/) except deliberate
minimaxon changes, recorded in README "Where it differs from Maxon". Where maxon code is not converted it is still
the reference for behaviour, edge cases and names. - Maxon code and tests are reused through
cmd/convert; converted files are regenerated, never hand-edited. - Byte-identical output is never a goal. Gates are functional: the suites pass with 0 leaks.
- Testing is minimal (see "Before a commit"). A test is added only when a bug would otherwise come back or nothing in
the corpus covers a feature. No test-first rule.
Procedure
- Read the stage. Find its heading in the plan (
Grep "^### Stage") and read only that section, plus the sections
it names and the decisions it depends on (plan section 1 "Core Principle", the generator table). List what is
undecided and ask the user, batched, before any delegation that depends on it. - Scout cheaply. Build the work list with Grep and Glob over the paths the stage names, or one Explore subagent
that writes its findings to a scratch file. Do not read big files. - Split into narrow tasks; decide order and parallelism. A task is one goal with a path list a subagent can finish
alone. Independent tasks that touch different files run in parallel (worktrees per the rule above). Tasks that edit the
same files, or where one needs the other's output, are sequential or one subagent. Put a generator or conversion tool
task before the tasks that use its output. Choose the model per task (rules above). - Brief each task with the template below. Name the skills the brief should use:
language-change(exists) for any
grammar, syntax or diagnostic change,convert-from-maxon(exists) for pulling code or tests from maxon, andwrite-self(exists) for any code inself/orruntime/. - Run, monitor and merge. Start subagents, wait for their short reports, and monitor them (next section) after
each round, before merging. Subagents in a worktree leave their changes
uncommitted; transfer each withgit -C <worktree> add -A, thengit -C <worktree> diff --cached --binary --no-renames HEAD > <scratch>/task.patch, thengit apply --3way <scratch>/task.patchin the main tree (a plaingit diffafteradd -Nbreaks when the agent
moved a file withgit mv). Resolve conflicts by script where both sides ran a rewrite (take the main tree's side
and re-run the rewrite on those files), rungo generate ./internal/...on the
merged tree, thengit worktree remove --force. The main tree is for merging only: every agent gets a worktree.
Run git against a worktree withgit -C, nevercdinto it (the shell's working directory would stay there). Then run the checks once, on the merged tree. A failure goes to a fresh subagent with
the failing output saved to a scratch file;opuswhen the cause is not obvious. - Update the docs.
README.mdfor what the stage changed (subset, commands and flags, packages, pipeline, IR,
"Where it differs from Maxon"), and the stage's status in the plan, in its heading as the existing ones do
(for example— implemented, uncommitted). - Report to the user and stop. Say what landed, what the suites showed, what is left or was decided on the way.
Do not commit unless asked; when asked, commit directly onmain.
Monitoring subagents
A standing rule, applied after every task or workflow round and before merging.
- Check the cheap signals. Tokens, tool calls and duration (task notification or workflow journal) against what the
task should take. Read each short report for retries, failed builds and "could not". - Counting tool calls from a transcript (the session's
subagents/directory:agent-*.jsonl, with a.meta.json
naming the task): everytool_useappears twice in the JSONL (a streamed row and a final row), so count distincttool_useids. - Every subagent starts at about 44k tokens of injected context. A task that is too small is mostly overhead; do
not split below a meaningful unit of work. - For an outlier, spawn a Sonnet auditor. It reads the transcript by Grep and line ranges only (never whole:
transcripts are 400-800 KB) and returns the causes ranked by tokens wasted, each with a fix, in under ~250 words. The
main session never reads transcripts itself. - Fold each fix in before the next brief. A repo fact (a command, a path, a pattern minimaxon refuses) goes into
the skill that covers it (write-self,convert-from-maxon,language-change); a briefing lesson goes into the
brief template or the pitfalls below.
Brief pitfalls (from the first audit)
- Give exact line ranges for every plan or README section the task needs, or paste a short digest of what matters;
never "read section X" alone. - Name the specific maxon files that are reuse candidates, never "check maxon-bin", and cap exploration (how many
files, which repos). - State the working directory, the shell (PowerShell is primary; Bash is Git Bash) and that Go is at
C:\Program Files\Go\binif not onPATH, so agents do not repeatcdor rediscover. - State the standard facts: the
self/modules (re-list with Glob before briefing), the gates (.\check.ps1, and.\build.ps1then.\bin\minimaxon.exe check self, which compilesselfwithout writing an executable and exits 0
silently when clean), and that the Write tool creates missing directories. - Ask agents to prefer Read with offset/limit and Grep over
cat/sed/grepthrough the shell. An auto-mode reminder
tells them otherwise; following it works but costs more output.
Before a commit
From the repository root (Go is at C:\Program Files\Go\bin if not on PATH):
.\check.ps1It formats and vets the Go of the generators and tools, regenerates, builds the compiler from the seed, and runs
every suite (README "Tests"); it must end with all checks passed. AGENTS.md's other rules still apply.
Self compile time
The landing records how long the seed, C1 and C2 take to build self/: gate land runs go run ./cmd/gate selftime
after each push that changes self/ or runtime/ and pushes the row of docs/self-compile-times.md itself (README,
"Tests"). Do not run it after a task. Report the Landed: line's number with the task, and say so when it says WATCH: a
jump is looked into only for an algorithmic blow-up.
Brief template
Copy, fill every field, keep it under ~40 lines. Paths, not contents; apply "Brief pitfalls" above.
Goal: <one sentence>. Plan stage: <number and title in plan.md>; read only that section.
Files to change: <paths or globs>.
Read (by Grep and line ranges; the large ones are never read whole):
- minimaxon: <paths>
- maxon reference: <paths under C:\Users\Eric\Dev\maxon>
Decisions that apply: <the relevant ones, quoted short>. Do not re-argue them.
Skills to use: <language-change | write-self | convert-from-maxon | none>.
Rules: AGENTS.md applies (no workarounds, no silent unhandled cases, no magic values, comments say why). Converted
files are regenerated, never hand-edited. Repetitive changes across many files: write a tool in cmd/<name>/ first.
Checks when done: .\check.ps1 (it ends with `all checks passed`). Do not commit.
Context: implement directly; do not spawn agents and do not use the run-stage skill. Read big files only by search
and line ranges. Keep large intermediate output in <scratch path>, not in your reply.
Worktree: <path, changes left uncommitted; or "main tree" and the disjoint paths you own>.
Return: at most 8 lines: what changed (paths), check results, anything unverified or left undone. No file contents.Worktrees on this machine
The Agent tool's isolation: "worktree" is refused here (it creates .claude/worktrees/agent-<id> and then rejects
it over the drive letter's case). Make the worktree yourself and brief the agent with its path instead:
git worktree add --detach .claude/worktrees/<task> HEAD- The brief names the worktree's absolute path as the agent's tree, says every command starts with
cdinto it and
every Read/Edit/Write path lies under it, and that the main tree must not be touched. - An agent's PowerShell and Bash tools start in the main checkout every call, so
.\check.ps1or.\specs.ps1
written relative runs the main tree's script on the main tree (specs.ps1deletesspecs/*.mdfirst). The brief
gives each script by its absolute path in the worktree (pwsh -NoProfile -File <worktree>\check.ps1). - A feature task does not regenerate
specs/in its worktree: parallel regenerations conflict over hundreds of
files. It measures by converting into a scratch directory and running only the spec files its feature unskips
(the user wants no full spec run until Phase 3); the main session runsspecs.ps1after merging, which adds
the new passes tospecs/passed.txt. git stashis one stack shared by every worktree: an agent that stashes to build a "before" compiler can pop
another agent's work. The brief says never to use it; a "before" measurement is taken first, on the unchanged
tree, or from a copy of the tree in the scratch directory..claude/worktrees/is in.git/info/exclude, so the main tree'sgit statusand Grep do not see it.- After merging:
git worktree remove --force .claude/worktrees/<task>(git worktree unlockfirst for one the
harness created).
Parallel agents and the corpus
- Every checkout's
minimaxon testwrites%TEMP%\minimaxon\<test>.exe, so agents running the corpus at the same
time can fail one test with "cannot write ...exe: Access is denied". Say so in each brief (rerun once before treating
it as real) until the path is made per-process. - Two parallel tasks must not both restructure the same logic. When one task moves code (a pass, a check) and another
edits inside it, the second's brief names that code as off limits or the tasks run in sequence; a three-way apply
only merges edits on different lines. - In a Bash heredoc that feeds Python, write regex backslashes with care or use the Edit tool:
\dand\bdo not
arrive as written. - A task that renames shared declarations (generated AST field names, token names, a module's exported API) lands
before tasks that write new code against those names start. Ports started on the old names each pay a rename
merge afterwards. - A patch that deletes a file the main tree has since modified fails
git apply --3wayas a whole: apply with--exclude=<file>for each such file, thengit rmthem.