Repository navigation
feat(self-fix): worktree-based self-fix flow for firstmate's own tracked code - #2
Merged
Merged
Conversation
…s own fixes through the gate Add bin/fm-self-fix.sh, which creates an isolated git worktree of this repo on a fix branch (rooted outside any FM_HOME) and dispatches a crewmate into it via a new fm-spawn --worktree mode - so firstmate can fix its own tracked code through the no-mistakes gate without treehouse pooling and without moving the primary checkout off its default branch. - fm-spawn.sh: --worktree <path> skips treehouse get, uses the pre-created isolated worktree (same isolation assertion), starts the tmux window in it, and records selffix=1 in meta. All paths are byte-unchanged when the flag is absent. - fm-teardown.sh: selffix=1 tasks are cleaned with git worktree remove (after the unchanged landed-work safety check), not a treehouse return. Scoped to the tmux backend; other backends are a later follow-up.
…n selffix teardown
…ts, AGENTS, architecture docs
chanjdaniel
added a commit
that referenced
this pull request
Jul 11, 2026
…ked code (#2) * feat(self-fix): worktree-based self-fix flow so firstmate can ship its own fixes through the gate Add bin/fm-self-fix.sh, which creates an isolated git worktree of this repo on a fix branch (rooted outside any FM_HOME) and dispatches a crewmate into it via a new fm-spawn --worktree mode - so firstmate can fix its own tracked code through the no-mistakes gate without treehouse pooling and without moving the primary checkout off its default branch. - fm-spawn.sh: --worktree <path> skips treehouse get, uses the pre-created isolated worktree (same isolation assertion), starts the tmux window in it, and records selffix=1 in meta. All paths are byte-unchanged when the flag is absent. - fm-teardown.sh: selffix=1 tasks are cleaned with git worktree remove (after the unchanged landed-work safety check), not a treehouse return. Scoped to the tmux backend; other backends are a later follow-up. * no-mistakes(review): enforce tmux-only self-fix and skip fleet-sync on selffix teardown * no-mistakes(document): document worktree-based self-fix flow in scripts, AGENTS, architecture docs
chanjdaniel
added a commit
that referenced
this pull request
Jul 11, 2026
…ked code (#2) * feat(self-fix): worktree-based self-fix flow so firstmate can ship its own fixes through the gate Add bin/fm-self-fix.sh, which creates an isolated git worktree of this repo on a fix branch (rooted outside any FM_HOME) and dispatches a crewmate into it via a new fm-spawn --worktree mode - so firstmate can fix its own tracked code through the no-mistakes gate without treehouse pooling and without moving the primary checkout off its default branch. - fm-spawn.sh: --worktree <path> skips treehouse get, uses the pre-created isolated worktree (same isolation assertion), starts the tmux window in it, and records selffix=1 in meta. All paths are byte-unchanged when the flag is absent. - fm-teardown.sh: selffix=1 tasks are cleaned with git worktree remove (after the unchanged landed-work safety check), not a treehouse return. Scoped to the tmux backend; other backends are a later follow-up. * no-mistakes(review): enforce tmux-only self-fix and skip fleet-sync on selffix teardown * no-mistakes(document): document worktree-based self-fix flow in scripts, AGENTS, architecture docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Bootstrap firstmate's self-fix capability. firstmate could not ship fixes to its own tracked code (
bin/,AGENTS.md,.agents/skills/,docs/) because this repo is not treehouse-pooled (sofm-spawncannot get an isolated worktree for it) and the primary checkout must stay on its default branch (the tangle guard alarms otherwise). This change adds a worktree-based self-fix flow so it can: newbin/fm-self-fix.shcreates an isolated plaingit worktreeof this repo on afix/<id>branch rooted outside anyFM_HOME, then dispatches a crewmate into it via a newfm-spawn --worktreemode. The primary checkout never leaves its default branch. This is the one-time human-bootstrap commit for keystone taskfm-self-fixable-k1; thereafter every self-fix ships through this flow.What changed
bin/fm-self-fix.sh- creates the isolated worktree and dispatches the crewmate.bin/fm-spawn.shwith a flag-gated--worktreemode (selffix=1meta marker); it reuses the existing isolation assertion to reject a bad worktree path.bin/fm-teardown.shwith aselffix=1cleanup branch that reuses the existing landed-work safety check unchanged and only swaps the cleanup verb togit worktree remove.AGENTS.md,docs/architecture.md,docs/scripts.md.Deliberate decisions
git worktreerather than treehouse-pooling this repo - intentionally lighter, no pool setup.--worktreeflag /selffix=1marker, so all existing spawn and teardown paths are byte-identical when the flag is absent - zero behavior change for normal tasks.--forcein the selffix branch is safe by construction because it runs only after the landed-work safety check has already passed; it never bypasses unlanded-work protection.Validation
Passed the full gate: code review (two findings applied and approved - enforce tmux-only, skip fleet-sync on selffix teardown), test suite passed clean, docs written, lint clean.