Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .agents/skills/project-management/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ A forge composes with `no-mistakes`, `direct-PR`, and `no-mistakes-prod-only` (`
`yolo` is inactive on a `forge=gerrit` project, so never propose `+yolo` alongside it.
`forge=external` marks a project whose review tool uploads its own snapshot, so workers never push a task branch to its shared origin: it is never detected, so register it only on the captain's confirmation, as `[direct-PR forge=external]` with no `+yolo`, and only once the home has `config/external-review.md` (`docs/configuration.md` "External review tool").
`bin/fm-project-mode.sh`'s header owns the binding and `bin/fm-dod-lib.sh` owns what it changes for a worker.
The optional `pr=manual` token marks a `no-mistakes` project whose PR title and body a person writes, so the pipeline's `pr` step must not rewrite them; register it only on the captain's confirmation, with no `forge=` token (`docs/configuration.md` "PR text selection").
The optional `pr=manual` token marks a `no-mistakes` project whose PR title and body a person writes, so the pipeline's `pr` step must not rewrite them; register it only on the captain's confirmation, with no `forge=` token (`docs/configuration.md` "PR posture selection").
The optional `pr=batch` token marks a project whose own `scripts/batch.sh` batches finished branches into one pull request at a time; register it only on the captain's confirmation that the project has that script, with no `forge=` token (same section).
The project's `batch.automerge` git setting should be enabled only on a `+yolo` project, because it merges batch PRs without firstmate's merge authority.

## Add or clone an existing project

Expand Down
7 changes: 7 additions & 0 deletions .agents/skills/ship-landing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ A no-mistakes worker re-validates it with /no-mistakes so the pipeline stays the
In no-mistakes mode the earlier `done [at=<epoch>]: {summary}` is the pipeline handoff and is not gated.
Tell the captain the PR's full `https://...` URL copied from the worker's ready line, the resolved checks-green crew-state line, or the task's `pr=` metadata, a concise outcome summary, and the no-mistakes risk level when applicable.
A captain instruction to merge is explicit authority; `yolo` is the only standing routine merge authority.

On a `pr=batch` project (`docs/configuration.md` "PR posture selection"), the ready line names the shared batch PR, so several tasks record the same `pr=` and each lands when that one PR merges; merge it once, and a second task's merge needs nothing because its poll records the merge.
`bin/fm-dod-lib.sh` owns the worker's batch steps; firstmate owns only the resumes, because the worker stops at both waits the batch cannot clear itself:
- A worker that appended `paused: queued for the next batch behind PR <url>` resumes when that PR merges or closes: steer it to continue at step 2 of its batch steps, which runs `scripts/batch.sh ship` and opens the next batch; steer queued workers one at a time, because one ship carries every ready branch and the others then find theirs already batched.
- A worker that appended `blocked: batch PR <url> failed ...` never fixes its batched branch, because batched branches are never rewritten.
Dispatch one fix-forward ship per failing batch, not one per blocked worker, with `--base-branch` set to the open batch branch (`scripts/batch.sh base` prints it as `origin/<branch>`) on the brief and the spawn, so its branch is cut from the batch and joins it; then steer each blocked worker on that PR to resume at step 4.
- A batch PR that degrades after a task recorded it wakes only through that task's merge poll; handle it as the same failing-batch case.
For any custom `state/<id>.check.sh` you write yourself, keep it an ordinary single-link mode-`0700` file, print one line only when firstmate should wake, print nothing otherwise, finish before `FM_CHECK_TIMEOUT`, then bind its current bytes with `bin/fm-check-register.sh <id>` before the watcher may execute it.
Retire a custom check only through `bin/fm-check-unregister.sh <id>` (or `bin/fm-teardown.sh` for a spawned task); never hand-compose an `rm` with `$STATE`/`$ID`.

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ Launching a supported harness inside it for your primary session instantiates yo
- **A visible crew** - every crewmate works in its own tmux window or Herdr tab, or in an experimental Zellij tab, experimental cmux workspace, experimental Tern block, experimental Orca terminal, or experimental T3 Code thread you can watch or interact with; the first mate reconciles.
- **Disposable worktrees** - each task runs in a clean [treehouse](https://github.com/kunchenguid/treehouse) git worktree, or an Orca-managed worktree when `backend=orca`, so parallel work on one repo never collides.
- **Two task shapes** - ship tasks deliver authorized changes; scout tasks leave standalone investigation reports when the intake contract warrants separate research.
- **Explicit project modes** - each project ships via `no-mistakes`, `direct-PR`, or `local-only`, with an optional `+yolo` merge-autonomy flag, an optional `branch=<prefix>` override for the default `fm/` ship-branch prefix, and an optional `forge=gerrit` binding under which the worker publishes a Gerrit change instead of opening a pull request, plus an optional `pr=manual` token under which the worker writes the PR title and body instead of the pipeline.
- **Explicit project modes** - each project ships via `no-mistakes`, `direct-PR`, or `local-only`, with an optional `+yolo` merge-autonomy flag, an optional `branch=<prefix>` override for the default `fm/` ship-branch prefix, and an optional `forge=gerrit` binding under which the worker publishes a Gerrit change instead of opening a pull request, plus an optional `pr=manual` token under which the worker writes the PR title and body instead of the pipeline, or `pr=batch` under which branches ship through the project's own batching script into one shared PR at a time.
The project's `batch.automerge` git setting should be enabled only on a `+yolo` project, because it merges batch PRs without firstmate's merge authority.
- **Self-repo boundary** - a home runs as firstmate user/operator by default, so a firstmate bug is diagnosed and patched locally but never pushed, PRed, issued, commented, or forked upstream on its own; publishing to firstmate's own repository needs the `config/firstmate-role` maintainer opt-in or a per-task captain consent ([schema](docs/configuration.md#firstmate-role-configfirstmate-role)).
- **Optional secondmates** - opt in to persistent second mates that run from isolated firstmate homes with their own `FM_HOME`, state, projects, and session lock, either locally or as a whole home on an SSH-reachable host, with guarded updates and recovery that never turns an unavailable remote route into a local replacement.
- **Event-driven, zero-token supervision** - a bash watcher sleeps on the fleet and wakes the first mate only when something needs you; verified primary harnesses also get a turn-end backstop that blocks or follows up on a blind stop when work is under way and supervision is not live.
Expand Down
22 changes: 13 additions & 9 deletions bin/fm-brief.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# charters still use a single `{TASK}` charter fill. Firstmate may adjust other
# sections when the task genuinely deviates (e.g. working an existing external
# PR instead of shipping a new one).
# Usage: fm-brief.sh <task-id> <repo-name> --mode <no-mistakes|direct-PR|local-only> [--branch-prefix <prefix>] [--base-branch <branch>] [--forge <none|gerrit|forgejo|external> [--shape squash]] [--pr <auto|manual>] [--herdr-lab]
# Usage: fm-brief.sh <task-id> <repo-name> --mode <no-mistakes|direct-PR|local-only> [--branch-prefix <prefix>] [--base-branch <branch>] [--forge <none|gerrit|forgejo|external> [--shape squash]] [--pr <auto|manual|batch>] [--herdr-lab]
# fm-brief.sh <task-id> <repo-name> --scout [--base-branch <branch>] [--herdr-lab]
# fm-brief.sh <task-id> --secondmate {<project>...|--no-projects}
# --scout writes the scout contract instead: the deliverable is a report at
Expand Down Expand Up @@ -78,14 +78,17 @@
# on `external` that rule names no forge CLI, because the home's review tool is
# the only publishing tool. A forge on --mode local-only is refused, because that
# mode publishes nothing, and `external` also refuses no-mistakes.
# --pr names who writes the pull request's title and body, defaults to auto, and
# is the explicit task-side form of the registry's `pr=manual` token exactly as
# --pr names how the pull request is made and who writes its text, defaults to auto, and
# is the explicit task-side form of the registry's `pr=` token exactly as
# --forge is of `forge=`: read from data/projects.md at intake and passed here,
# never looked up or inferred, and bin/fm-spawn.sh refuses a brief that
# disagrees with the registry. `manual` renders a no-mistakes brief whose worker
# writes the PR text itself with the pipeline's pr and ci steps skipped, and
# records " pr=manual" on the Delivery contract line. bin/fm-dod-lib.sh's
# fm_pr_text_valid owns where it is accepted: no-mistakes with no forge only.
# records " pr=manual" on the Delivery contract line. `batch` is the registry's
# `pr=batch` token the same way: a no-mistakes or direct-PR brief whose worker
# pushes its branch without a PR and ships it with the project's
# scripts/batch.sh, recorded as " pr=batch". bin/fm-dod-lib.sh's
# fm_pr_text_valid owns where each value is accepted.
# --shape names how a forge=gerrit task is published, and only `squash` - one
# change - is accepted: `stack` is refused until a stack can be watched by its
# membership pinned when its watch is armed, because the merge watch follows one
Expand All @@ -107,7 +110,8 @@
# The generated ship brief records the chosen mode as a fixed machine-readable
# "Delivery contract: mode=<mode>" line, followed by " forge=gerrit shape=squash"
# on Gerrit, " forge=forgejo" on Forgejo, or " forge=external" on an external
# review tool, then " pr=manual" when the worker owns the PR text. bin/fm-spawn.sh reads that line and
# review tool, then " pr=manual" when the worker owns the PR text or " pr=batch"
# when the project's batch opens it. bin/fm-spawn.sh reads that line and
# refuses to launch a ship task whose explicit --mode or registered forge
# disagrees, so an adjusted brief and the recorded task metadata cannot drift
# apart.
Expand Down Expand Up @@ -774,7 +778,7 @@ case "$MODE" in
2. Run \`no-mistakes doctor\`; if it reports the repo is not initialized here, run \`no-mistakes init\`."
;;
esac
RULE1=$(fm_ship_rule_one "$MODE" "$ID" "$BRANCH" "$FORGE" "$BASE_BRANCH") || exit 1
RULE1=$(fm_ship_rule_one "$MODE" "$ID" "$BRANCH" "$FORGE" "$BASE_BRANCH" "$PR_TEXT") || exit 1
DOD=$(fm_dod_block "$MODE" "$ID" "$BRANCH" "$FORGE" "$BASE_BRANCH" "$UPSTREAM_CONSENT" "$PR_TEXT") || exit 1

cat > "$BRIEF" <<EOF
Expand Down Expand Up @@ -831,8 +835,8 @@ A correction edits only the wrong text: do not run \`$FM_ROOT/bin/fm-ensure-agen
$DOD
EOF
append_brief_include
if [ "$PR_TEXT" = manual ]; then
echo "scaffolded: $BRIEF (ship, mode=$MODE pr=manual; replace {TASK} and {FIRSTMATE_SPEC})"
if [ "$PR_TEXT" != auto ]; then
echo "scaffolded: $BRIEF (ship, mode=$MODE pr=$PR_TEXT; replace {TASK} and {FIRSTMATE_SPEC})"
elif [ "$FORGE" = none ]; then
echo "scaffolded: $BRIEF (ship, mode=$MODE; replace {TASK} and {FIRSTMATE_SPEC})"
elif [ "$FORGE" = gerrit ]; then
Expand Down
Loading
Loading