Skip to content

feat: add firstmate self-update skill - #61

Merged
kunchenguid merged 4 commits into
mainfrom
fm/updatefirstmate-skill
Jun 23, 2026
Merged

kunchenguid merged 4 commits into
mainfrom
fm/updatefirstmate-skill

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Add a project-level, user-invocable skill /updatefirstmate plus a helper bin/fm-update.sh that self-updates a running firstmate and its secondmates to the latest from origin.

Goal: firstmate is its own repo behind the no-mistakes gate, so improvements to AGENTS.md, bin/, and skills land on main and then wait for each running firstmate to pull them. This skill performs that in-place pull for the running main firstmate and every secondmate, so the whole tree converges on the latest bin/ + instructions without restarting anything.

Key deliberate design decisions a reviewer reading only the diff would not know:

  • fm-update.sh is FAST-FORWARD ONLY, mirroring bin/fm-fleet-sync.sh exactly: never force, never create a merge commit, never stash; it skips with a reported reason any target that is dirty, diverged, offline, or on a non-default branch. This upholds prime directive docs: align tmux and harness guidance #3 (never discard unlanded work) and is the same sanctioned self-write as the fleet sync - it touches only the firstmate repo and its own worktrees, never anything under projects/.
  • The real fleet shape: the main firstmate repo is checked out on its default branch (main), while secondmate homes are treehouse worktrees leased at a DETACHED HEAD on the default branch. ff_target deliberately handles both: a branch checkout must equal the default branch, while a detached HEAD is allowed (that is the expected secondmate-home state). A FF on a detached worktree advances only that worktree's HEAD and never touches another worktree's checkout or the shared main branch.
  • The script is intentionally pure-mechanical (git only). It does NOT re-read AGENTS.md or send fm-send nudges itself, because those are LLM/tmux actions the script cannot perform. Instead it prints a per-target summary plus two machine-parseable action lines: 'reread-firstmate: yes|no' and 'nudge-secondmates: <fm-windows...>|none'. The skill markdown performs the re-read and the nudges.
  • reread-firstmate gates on whether the instruction surface (AGENTS.md, bin/, .agents/skills) changed in the FF, so the running firstmate avoids a pointless self re-read when only e.g. README changed. nudge-secondmates lists every secondmate that ADVANCED (per the task's stated design 'for each updated secondmate, send a re-read nudge'); skipped or already-current secondmates are not nudged.
  • fm-guard.sh is located via SCRIPT_DIR (where the sibling actually lives), not FM_ROOT, matching fm-send.sh - this keeps it correct under FM_ROOT_OVERRIDE and when a secondmate runs its own copy of the script.
  • A single fetch refreshes every worktree sharing one object store, so fetch is deduped per git-common-dir; a standalone-clone home is fetched on its own. Secondmate homes are resolved from BOTH state/*.meta (kind=secondmate, home=) and the data/secondmates.md registry as a backstop, deduped by resolved home path, and the firstmate repo is never re-processed as one of its own secondmates.
  • The skill SKILL.md matches the existing afk skill format (frontmatter name/description/user-invocable: true) and is discoverable through the .claude/skills -> .agents/skills symlink.
  • AGENTS.md documentation was APPENDED as a new section 12 at the end of the file, deliberately NOT editing sections 3 or 10, because other tasks are concurrently editing those sections and this minimizes merge conflict.

Tests: tests/fm-update.test.sh adds 9 cases (FF success + reread/nudge signalling, single-parent non-merge verification, instruction-only reread gate, dirty-skip with edit preserved, diverged-skip with local commit preserved, idempotency, registry backstop, dedup + firstmate self-exclusion, off-default-branch skip). shellcheck is clean across bin/.sh and tests/.sh and the full suite is green.

What Changed

  • Added a user-invocable /updatefirstmate skill and bin/fm-update.sh helper that fast-forwards the running firstmate repo and seeded secondmate homes from origin when safe.
  • Hardened update safety around dirty, diverged, off-default, detached, duplicate, registry-only, and unsafe secondmate home cases, with machine-readable reread and nudge output for live agents.
  • Documented the self-update flow in AGENTS.md and README.md, and added focused coverage in tests/fm-update.test.sh for the update and skip behavior.

Risk Assessment

✅ Low: Captain, the change is narrowly scoped to a fast-forward-only helper plus its skill/docs, with the previously identified safety gaps addressed and no material remaining issues found.

Testing

Captain, I confirmed the change scope, ran the focused fm-update automated suite, captured an end-to-end CLI transcript showing a real fast-forward of main plus a detached secondmate with correct reread-firstmate and nudge-secondmates lines, verified a dirty secondmate is skipped without losing its edit, checked skill discoverability through .claude/skills, removed the temporary fixture, and ended with a clean worktree.

Evidence: fm-update end-to-end CLI transcript
# fm-update.sh end-to-end CLI evidence

Scenario 1: running firstmate on main and live secondmate sm1 as a detached worktree are both behind origin/main after AGENTS.md, bin/, and .agents/skills changed.

$ FM_ROOT_OVERRIDE=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KVVA4AMEJ7VNSGXAZCSKJH6E/.tmp-fm-update-e2e-27573/success/main FM_HOME=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KVVA4AMEJ7VNSGXAZCSKJH6E/.tmp-fm-update-e2e-27573/success/home bin/fm-update.sh
firstmate: updated 7a40511..acb5c34 (instructions changed: AGENTS.md, bin, .agents/skills)
secondmate sm1: updated 7a40511..acb5c34 (instructions changed: AGENTS.md, bin, .agents/skills)
reread-firstmate: yes
nudge-secondmates: main:fm-sm1

$ git state after update
firstmate_branch=main
firstmate_HEAD_equals_origin_main=yes
secondmate_sm1_detached=yes
secondmate_sm1_HEAD_equals_origin_main=yes
firstmate_parent_count=1
secondmate_sm1_parent_count=1

Scenario 2: a live secondmate with an uncommitted AGENTS.md edit is skipped and not nudged while the edit remains.

$ FM_ROOT_OVERRIDE=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KVVA4AMEJ7VNSGXAZCSKJH6E/.tmp-fm-update-e2e-27573/dirty/main FM_HOME=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KVVA4AMEJ7VNSGXAZCSKJH6E/.tmp-fm-update-e2e-27573/dirty/home bin/fm-update.sh
firstmate: updated 02a2c98..779e543 (instructions changed: AGENTS.md, bin, .agents/skills)
secondmate smdirty: skipped: dirty working tree
reread-firstmate: yes
nudge-secondmates: none

$ verify dirty secondmate state
dirty_edit_preserved=yes
dirty_secondmate_HEAD_still_old=02a2c98
origin_main_now=779e543

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 4 issues found → auto-fixed ✅
  • 🚨 bin/fm-update.sh:149 - Real seeded secondmate homes contain the untracked .fm-secondmate-home marker written by fm-home-seed.sh, and this repo does not ignore that path. This dirty check runs before any fast-forward, so real secondmate homes will be reported as skipped: dirty working tree and never update. Filter that marker out of the dirty check, and add a fixture that includes it.
  • 🚨 bin/fm-update.sh:215 - home= values from state and the registry are passed directly into ff_target without the seeded-secondmate validation used by fm-spawn.sh and fm-backlog-handoff.sh. A stale or bad entry pointing at projects/... or any other clean git repo could be fetched and fast-forwarded, violating the helper's safety promise. Validate the resolved home, marker id, firstmate files, and path boundaries before merging.
  • ⚠️ bin/fm-update.sh:217 - Registry-only secondmates have no state/&lt;id&gt;.meta, but the script still appends fm-$id to nudge-secondmates. The documented follow-up command bin/fm-send.sh fm-$id ... refuses bare fm-* targets without metadata, so /updatefirstmate can fail immediately after updating a registry-only home. Only list live windows known from metadata, or output an explicit no-live-window status for registry-only updates.
  • ⚠️ bin/fm-update.sh:143 - The detached-HEAD allowance applies to every target, including the primary firstmate repo. If the running firstmate checkout is detached, this can move that checkout even though the docs say the primary repo must be on its default branch, and it leaves the local default branch ref unchanged. Require the default branch for the firstmate target and allow detached HEAD only for secondmate homes.

🔧 Fix: Captain: harden firstmate update safety
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • git status --short, git rev-parse HEAD, and git merge-base HEAD 3718fd0cd010a0a2668493d8c11eeb6331904d7d to confirm the isolated worktree state and target commit.
  • git diff --stat 3718fd0cd010a0a2668493d8c11eeb6331904d7d...HEAD and git diff --name-only 3718fd0cd010a0a2668493d8c11eeb6331904d7d...HEAD to scope the changed files before testing.
  • bash tests/fm-update.test.sh for the focused automated coverage of fast-forward success, no-merge behavior, reread/nudge signalling, dirty/diverged preservation, idempotency, registry backstop, dedup/self-exclusion, off-branch skip, detached firstmate skip, and unsafe-home skip.
  • Manual evidence fixture: FM_ROOT_OVERRIDE=&lt;fixture&gt;/main FM_HOME=&lt;fixture&gt;/home bin/fm-update.sh with a clean main firstmate plus detached live secondmate behind origin/main, captured in the transcript artifact.
  • Manual evidence fixture: FM_ROOT_OVERRIDE=&lt;fixture&gt;/main FM_HOME=&lt;fixture&gt;/home bin/fm-update.sh with a dirty live secondmate, captured in the transcript artifact to show skip/no-nudge behavior and preserved local edit.
  • test -f .claude/skills/updatefirstmate/SKILL.md &amp;&amp; sed -n &#39;1,8p&#39; .claude/skills/updatefirstmate/SKILL.md to verify the user-invocable skill is discoverable through the existing .claude/skills symlink.
  • Final git status --short to confirm the working tree stayed clean after testing.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Fast-forward-only self-update for a running firstmate and its secondmates:
fm-update.sh FFs this repo's default branch from origin, then FFs each
registered secondmate home (worktrees at detached HEAD) the same way,
mirroring fm-fleet-sync's safety (never force/merge-commit/stash; skip
dirty/diverged/offline/wrong-branch). It emits reread-firstmate and
nudge-secondmates action lines; the skill re-reads AGENTS.md and nudges
each updated secondmate so the whole tree converges on the latest bin/
and instructions. Touches only the firstmate repo and its worktrees.
@kunchenguid
kunchenguid merged commit e2e730f into main Jun 23, 2026
4 checks passed
@kunchenguid
kunchenguid deleted the fm/updatefirstmate-skill branch June 23, 2026 23:07
augustomklee added a commit to augustomklee/firstmate that referenced this pull request Jun 24, 2026
Rework kunchenguid#61 into a fork-aware upstream porter (report-only)
leo1oel added a commit to leo1oel/nemo that referenced this pull request Jun 24, 2026
… to herdr (#1)

Port two upstream changes onto the herdr backend:

- kunchenguid#61 self-update: bin/fm-update.sh fast-forwards the firstmate repo and every
  secondmate home from origin, fast-forward-only with fm-fleet-sync safety
  (never force/merge-commit/stash; skip dirty/diverged/offline/wrong-branch).
  Secondmate homes are herdr worktrees on lease branch secondmate-<id> rather
  than detached-HEAD treehouse leases, and nudges target fm-<id> (herdr pane).
  Adds the /updatefirstmate skill, AGENTS.md section 12, README entries, and
  tests/fm-update.test.sh.

- kunchenguid#59 ghost text: launch claude with CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false
  and make fm-herdr-lib.sh capture `herdr pane read --format ansi` then strip
  dim/faint (SGR 2) runs before border-aware classification, so Claude's
  predicted-prompt ghost text never reads as pending input. The styled capture
  stays internal; fm-peek stays plain. Adds tests/fm-composer-ghost.test.sh.
@liacontinuum

Copy link
Copy Markdown

Hero headlines that moved

With the panel gone, the open How We Help links end 164px down on desktop at the default 16px text size, and about 6.13vw + 3.15rem on tablet. Any headline that started higher sat under them. These hero headlines now start lower, at the widths below. Positions are the h1's top edge at a 16px root; at larger text sizes the same floors scale in rem. Every width not listed is unchanged, including 1440 on every route except /who-we-serve.

Route Widths Before → after Why
/who-we-serve every width phone 156 → 102px (up 54); tablet within 1px; desktop ~119 → 216px (down ~97, band 767 → 863px) Note 21: matches /clinical-support at every width
/clinical-support 1025–1203 154 → 216px (down 62; band 767 → 829px) Dropdown clearance; one desktop value so /who-we-serve can match it exactly
/clinical-support 768–781 down 1px or less Tablet dropdown clearance
/ (home) 1025–1189 144 → 176px (down up to 32) Dropdown clearance
/ (home) 768–781 down about 1px Tablet dropdown clearance
/practice-solutions 1025–1189 116–142 → 176px (down 34–60) Dropdown clearance
/practice-solutions 768–883 down up to 7px (most at 768) Tablet dropdown clearance
/about-us 1025–~1130 ~151 → 176px (down up to 25; centred band grows up to 50px) Dropdown clearance
/knowledge-base-articles 1025–1531 138 → 168px at 1025, 162.5 → 168px at 1440 Dropdown clearance
/knowledge-base-articles 768–~790 down up to 4px Tablet dropdown clearance

/resources, /contact-us, the article pages and the legal pages do not move.

This section was meant for the PR description; the author account cannot edit the description, so it is posted here. One correction to the Risk Assessment above: the physician-pixel test that could pass without checking anything was fixed in review (e4df407). It now waits for each width's backdrop to load and decode, and fails on a zero natural width.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
* feat(docs): add Herdr layout convergence preview with real lab captures

Stage the approved convergence direction - upstream's one-worker-per-container
execution unit under our human-readable project labels - and capture what it
actually looks like at eight workers across three projects before anything
changes on the live fleet.

Two candidates were staged against today's layout. A project header row with
its workers indented beneath it reproduces today's reading order, but Herdr
appends every new workspace to the end of the list and exposes no reorder,
so a worker that starts out of project order lands under the wrong header
while the header still counts it. Carrying the project name on each worker
row is order-independent and keeps outcome, state, runtime and branch, at the
cost of the per-project count line.

Also record the underlying Herdr fact in the backend verification doc:
workspace ordering is creation order and cannot be changed, so any layout
that encodes a relationship in adjacency separates when work arrives out of
order. That applies to upstream's own child rows too.

bin/fm-visible-format-lib.sh extracts the captain-facing state vocabulary from
bin/fm-visible-status.sh so the preview reuses it instead of copying it.
fm-visible-status.sh behaves identically; its tests are unchanged and pass.

Nothing here changes live fleet behavior. Every Herdr operation, cleanup
included, went through bin/fm-herdr-lab.sh in generated non-default lab
sessions, and the default-session tripwire verified clean after each run.

* no-mistakes(review): address review: drop dead rank helper, harden preview e2e, correct doc claims

* no-mistakes(review): correct capture attribution and record summary-row width limit

* no-mistakes(review): qualify count-line recovery heading to match section

* no-mistakes(document): Fix broken preview provenance link

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes
@petrhromadka

Copy link
Copy Markdown

Head of / and /cenik/ before and after (built dist, stylesheet link omitted; the JSON-LD line is cut for length, full graphs are in the test evidence above).

before: /
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Socionet · nový web pro vaši firmu</title>
<meta name="description" content="Nový web pro vaši firmu za pevnou cenu od 9 900 Kč. Ukázku vašeho webu dostanete zdarma do 48 hodin, bez schůzek a bez závazků.">
<link rel="canonical" href="https://socionet.cz/">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="sitemap" href="/sitemap-index.xml">
<meta name="theme-color" content="#0f5c4d">
<meta property="og:type" content="website">
<meta property="og:locale" content="cs_CZ">
<meta property="og:site_name" content="Socionet">
<meta property="og:title" content="Socionet · nový web pro vaši firmu">
<meta property="og:description" content="Nový web pro vaši firmu za pevnou cenu od 9 900 Kč. Ukázku vašeho webu dostanete zdarma do 48 hodin, bez schůzek a bez závazků.">
<meta property="og:url" content="https://socionet.cz/">
after: /
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Socionet · nový web pro vaši firmu</title>
<meta name="description" content="Nový web pro vaši firmu za pevnou cenu od 9 900 Kč. Ukázku vašeho webu dostanete zdarma do 48 hodin, bez schůzek a bez závazků.">
<link rel="canonical" href="https://socionet.cz/">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="sitemap" href="/sitemap-index.xml">
<meta name="theme-color" content="#0f5c4d">
<meta property="og:type" content="website">
<meta property="og:locale" content="cs_CZ">
<meta property="og:site_name" content="Socionet">
<meta property="og:title" content="Socionet · nový web pro vaši firmu">
<meta property="og:description" content="Nový web pro vaši firmu za pevnou cenu od 9 900 Kč. Ukázku vašeho webu dostanete zdarma do 48 hodin, bez schůzek a bez závazků.">
<meta property="og:url" content="https://socionet.cz/">
<meta property="og:image" content="https://socionet.cz/og-image.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Socionet: Nový web pro vaši firmu. Ukázku dostanete zdarma, než cokoli zaplatíte.">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Socionet · nový web pro vaši firmu">
<meta name="twitter:description" content="Nový web pro vaši firmu za pevnou cenu od 9 900 Kč. Ukázku vašeho webu dostanete zdarma do 48 hodin, bez schůzek a bez závazků.">
<meta name="twitter:image" content="https://socionet.cz/og-image.png">
<meta name="twitter:image:alt" content="Socionet: Nový web pro vaši firmu. Ukázku dostanete zdarma, než cokoli zaplatíte.">
<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://socionet.cz/#organization","name":"Socionet","url":"https://socionet.cz/","description":"Nový web pro vaši firmu. Ukázku do ...
before: /cenik/
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ceník · Socionet</title>
<meta name="description" content="Balíčky Start 9 900 Kč, Firma 19 900 Kč a Růst 29 900 Kč. Péče od 390 Kč měsíčně, předplatné bez vstupní platby od 890 Kč měsíčně. Pevné ceny doplňků.">
<link rel="canonical" href="https://socionet.cz/cenik/">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="sitemap" href="/sitemap-index.xml">
<meta name="theme-color" content="#0f5c4d">
<meta property="og:type" content="website">
<meta property="og:locale" content="cs_CZ">
<meta property="og:site_name" content="Socionet">
<meta property="og:title" content="Ceník · Socionet">
<meta property="og:description" content="Balíčky Start 9 900 Kč, Firma 19 900 Kč a Růst 29 900 Kč. Péče od 390 Kč měsíčně, předplatné bez vstupní platby od 890 Kč měsíčně. Pevné ceny doplňků.">
<meta property="og:url" content="https://socionet.cz/cenik/">
after: /cenik/
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ceník · Socionet</title>
<meta name="description" content="Balíčky Start 9 900 Kč, Firma 19 900 Kč a Růst 29 900 Kč. Péče od 390 Kč měsíčně, předplatné bez vstupní platby od 890 Kč měsíčně. Pevné ceny doplňků.">
<link rel="canonical" href="https://socionet.cz/cenik/">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="sitemap" href="/sitemap-index.xml">
<meta name="theme-color" content="#0f5c4d">
<meta property="og:type" content="website">
<meta property="og:locale" content="cs_CZ">
<meta property="og:site_name" content="Socionet">
<meta property="og:title" content="Ceník · Socionet">
<meta property="og:description" content="Balíčky Start 9 900 Kč, Firma 19 900 Kč a Růst 29 900 Kč. Péče od 390 Kč měsíčně, předplatné bez vstupní platby od 890 Kč měsíčně. Pevné ceny doplňků.">
<meta property="og:url" content="https://socionet.cz/cenik/">
<meta property="og:image" content="https://socionet.cz/og-image.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Socionet: Nový web pro vaši firmu. Ukázku dostanete zdarma, než cokoli zaplatíte.">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Ceník · Socionet">
<meta name="twitter:description" content="Balíčky Start 9 900 Kč, Firma 19 900 Kč a Růst 29 900 Kč. Péče od 390 Kč měsíčně, předplatné bez vstupní platby od 890 Kč měsíčně. Pevné ceny doplňků.">
<meta name="twitter:image" content="https://socionet.cz/og-image.png">
<meta name="twitter:image:alt" content="Socionet: Nový web pro vaši firmu. Ukázku dostanete zdarma, než cokoli zaplatíte.">
<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://socionet.cz/#organization","name":"Socionet","url":"https://socionet.cz/","description":"Nový web pro vaši firmu. Ukázku do ...

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 18, 2026
…ry pane (kunchenguid#61)

* feat(bin): fold a factory's routine runs into one line on the Factory pane

A factory's registry entry may mark its work, or kinds of its jobs, as
routine with a routine: line. On the overview each routine kind becomes one
line with its runs today and the last one, a pass that runs or waits folds
into it, and a finished, landed or closed pass stays out of the since you
last looked list. A failed, stuck or owner-facing pass shows as before, and
without the line the pane is unchanged.

* no-mistakes(review): Leave folded routine passes out of running counts

* no-mistakes(review): Keep other cards visible beside a folded pass

* no-mistakes(review): Draw a folded-only factory as idle, cards kept

* no-mistakes(document): Correct idle routine factory overview wording
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants