Environment and configuration reference
patchmill.config.json controls the host, labels, paths, base branch, three
skill entry points, Pi agent directory and timeout, planning gates, and optional
cleanupHook. Unknown keys fail by name. See the
complete defaults.
Files and directories
Section titled “Files and directories”| Default path | Purpose |
|---|---|
patchmill.config.json |
Shared repository configuration. |
.patchmill/skills/ |
Installed skills and patchmill-skill-pack.json with sources and hashes. |
.patchmill/pi-agent/ |
Local Pi credentials, settings, and reviewer definition. |
.worktrees/ |
One worktree per issue branch. |
docs/specs/ and docs/plans/ |
Specs and plans committed on the issue branch. |
.patchmill/runs/issue-N/lock |
Permanent local OS lock with diagnostic JSON. |
.patchmill/runs/issue-N/cleanup.json |
Versioned hook-success receipt for partial cleanup retries. |
.patchmill/runs/issue-N/cleanup.log |
Hook output, exit status, and cleanup diagnostics. |
.patchmill/runs/issue-N/<run-id>/ |
Prompt, session logs, sessions, and diagnostic result. |
.patchmill/runs/triage/<run-id>/ |
Triage prompt, log, and sessions. |
init adds local Git excludes for worktrees, runs, and the agent directory.
Commit shared configuration and skills, not credentials or local run output.
Never remove or replace the permanent lock file or its parent directory.
Cleanup configuration and records
Section titled “Cleanup configuration and records”The optional cleanupHook is a string path to a Bash script. Omission means no
hook. A non-string fails with Invalid type for cleanupHook. Relative script
paths resolve from the implementation worktree, which also supplies the working
directory. The script needs no executable bit.
Every real run sweeps confirmed merged, closed issues before selection. Immediate interactive cleanup uses the same locked routine. The hook runs before removal, even for dirty worktrees. Dirty worktrees remain after the hook. Hook failure keeps every target and done status, with console and cleanup-log diagnostics.
The receipt skips an already successful hook during later partial cleanup
attempts. It never selects a phase or replaces fresh host verification. Logs and
result.json cannot authorize removal. Never remove the permanent lock file or
its parent directory. See Run-once for safe
scripts, retry rules, and inspected manual recovery.
Pi environment
Section titled “Pi environment”Patchmill sets PI_CODING_AGENT_DIR to the configured agent directory for Pi
processes. Other provider environment comes from the shell and host CLIs.
Patchmill has no host-login environment override. GitHub uses active gh
authentication. GitHub also accepts a GitHub App installation token in
GH_TOKEN. With that token, trust comes only from host.login and
host.trustedAuthors. See
Host and trust. Forgejo uses
Tea’s default profile when host.login is empty, or the explicit profile alias
when set.
patchmill auth presents standalone authentication and model pickers. Pi’s SDK
saves credentials in the configured agent directory’s auth.json. Patchmill
saves defaultProvider and defaultModel in Pi’s settings.json, then
verifies the provider with a real model call. The command returns to the shell
without opening Pi chat. There is no separate Patchmill credential store.
Run-once loads pi-subagents through runtime -e arguments. Triage supplies no
explicit extension paths. This does not guarantee global extension isolation.
Operator commands
Section titled “Operator commands”| Command | Behaviour |
|---|---|
patchmill init |
Write config when missing, install skills, provision the agent directory. Idempotent. |
patchmill auth |
Choose a subscription or API key, provider, and default model. Save them in the configured Pi agent directory, verify the provider, then return to the shell. |
patchmill doctor [--fix] |
Readiness checks: host CLI logged in, labels exist, worktree directory ignored, skills present, the managed reviewer resolves with bash, Pi answers a smoke prompt. --fix restores the managed reviewer. |
patchmill labels setup |
Create missing labels. |
patchmill triage [--dry-run] |
Run the triage skill per candidate issue. Dry run runs Pi and prints the labels and comment instead of applying them. |
patchmill run-once [--issue N] [--dry-run] [--plan-only] |
Advance one issue. Dry run prints the selected issue and derived phase without claiming or running Pi. |
patchmill release --issue N |
Clear a stale claim after a hard crash. |
patchmill skills update |
Update the managed skill pack to the installed Patchmill version. Refuses edited managed files and removes files dropped from the pack. |
patchmill version |
Print the version. |
patchmill setup-test-repo |
Development tool for the end-to-end CI (#320). Outside the kernel. |
doctor is read-only with respect to repository and host configuration, but it
writes local smoke logs and makes a model call. doctor --fix writes only the
managed agents/reviewer.md in the Pi agent directory. Triage dry run also
makes model calls and writes local output. Run-once dry run does not claim or
run Pi. Logs and sessions can contain sensitive content. Keep them local.