Repository navigation
feat(bin): opt-in Jev skill selection written into worker briefs - #8
Conversation
Add bin/fm-skill-select.sh: it lists the skills the chosen harness discovers for a worker in the project (project and user skill directories), asks Jev one yes/no question per skill from its name and description, selects those at or above a 0.8 floor in code, and with --apply writes a # Required skills section after # Task. Firstmate can review and override with --set or --clear before spawn. Off, error, or no confident match leaves the brief unchanged. Move the key gate, brief task text, never-send check, and POST out of bin/fm-dispatch-resolve.sh into bin/fm-typesafe-lib.sh so both tools share one copy. Document the operator contract beside Typed dispatch resolution, record the live shape comparison in docs/verification/skill-select.md, and point AGENTS.md section 4 at it.
…"Pi Calm hidden-block geometry E2E did not complete the /reload viewport transition". This PR doesn't touch Pi or Calm code. It's a timing flake in the test. - Cause: `wait_for_geometry_transition` only passed if a screen capture happened to show Pi's short-lived "Reloading keybindings..." status. If Pi finished reloading between two captures, the check failed even though the reload worked. - Fix: before sending `/reload`, the test now records the pane's output with `tmux pipe-pane`. The wait passes once that recording contains the reload status and the screen shows `CALM_GEOMETRY_FINAL` with the status gone. That proof no longer depends on when the captures run. The recording is stopped afterwards. - Verification: installed real Pi into a temporary npm prefix and ran the whole test file 3 times. All passed, including the geometry E2E. A run with the poll slowed to 0.5s also passed. - The old code also passed with the slow poll on my machine, because Pi kept the status on screen longer there. So I couldn't reproduce the CI failure locally; the fix is correct by design but not shown to fail-then-pass. - shellcheck reports only the existing SC1091 info about the sourced `lib.sh`. - My cleanup of the temporary Pi install (`/tmp/pi-prefix.3V58`, `/tmp/slow.sh`) was denied, so those files are still in /tmp
How this PR works, in detailThe problem it solvesWorkers only see the skills installed for their project ( The flow at dispatch time
What the worker seesSo skill use is explicit, visible in the brief, and checkable afterwards in the PR description. Why one yes/no question per skill, and why 0.8The Jev API has no multi-label question type, so two shapes were compared live on nine real, hand-labeled briefs (
A multiple-choice answer piles its probability onto one option, so it can't name the two to six skills most tasks need. Yes/no per skill costs about 1.5x the input tokens at the same speed. The floor sweep picked 0.8: at 0.7 the wrong selections jump to 12; at 0.9 real matches drop to 9 of 24. The three "wrong" picks at 0.8 were Safety and failure behavior
Refactor: shared Jev libraryThe typesafe.ai code the dispatch resolver had inline (key lookup, never-send check, extracting the task text from the brief, the timed POST) moved into Files
Testing
Size note+1,066 / -106 across 15 files. About 430 of the added lines are tests and the verification record. |
## Conflict resolutions The trial merge listed 13 conflicted files; the actual merge also conflicts in `tests/fm-procevent.test.sh` (14 total). | File | Fork origin | Resolution | | --- | --- | --- | | `.agents/skills/agent-skill-trigger-index/SKILL.md` | 09efd59 (#6, clickup-tickets) | Fork's `clickup-tickets` trigger line re-added to upstream's list unchanged. | | `AGENTS.md` | 3843b2c (#8, skill selection); 89e1459 (#3, `feature/` prefix) | Fork's `fm-skill-select.sh --apply` line and the `feature/` default wording re-applied on upstream's new section 7 text (upstream added `--base-branch` and self-repo consent lines next to it; both kept). | | `README.md` | 89e1459 (#3), via earlier fork syncs | Default ship-branch prefix wording stays `feature/` in upstream's rewritten bullet. | | `bin/fm-captain-hold.sh` | 999f9d8 (#1, done-archive evidence) | Fork's done-archive lookup re-applied unchanged on upstream's version. | | `bin/fm-dod-lib.sh` | 89e1459 (#3), 16cc4bd | Upstream's new base-branch/forge/consent code kept; its two `fm/$id` defaults now call `fm_task_branch` and the lib sources `fm-task-branch-lib.sh`, as the fork did before. | | `bin/fm-procevent-lavish.sh` | 826e32b, 79d101b, d0ac8f4, cbfb295 (#7) | True clash, decided by the captain (option A) - see below. | | `bin/fm-spawn.sh` | 89e1459 (#3), 16cc4bd, b7edc11, 153f4e2, de04c2d | Fork's `feature/` branch naming and legacy-brief branch binding re-applied unchanged on upstream's version. | | `bin/fm-timeout-lib.sh` | 9e8b923 (bash without `BASHPID`) | Upstream fixed the same macOS bash 3.2 bug independently (5838f10, kunchenguid#6028, perl watchdog takes the pre-exec parent). Took upstream's code; the fork's regression test for it is kept and passes on upstream's fix. | | `docs/architecture.md` | 89e1459 (#3) | `feature/` default and the `fm-task-branch-lib.sh` ownership line re-applied. | | `tests/fm-brief.test.sh` | 89e1459 (#3), via earlier fork syncs | Expected branch names stay `feature/<id>` in upstream's updated cases. | | `tests/fm-calm-pi-extension.test.sh` | bc3f178 (#10), 1757302 (#8 CI fix) | Upstream fixed the `/reload` geometry flake its own way (`wait_for_geometry_reload` on a durable status row), so the fork's `pipe-pane` version is dropped. Kept the fork's lookup-counting export renderer, the report-based Chrome hang attempt check, and the `tuiMode: regular` settings pin next to upstream's `--tui-mode regular` flag. | | `tests/fm-procevent.test.sh` | #7 | Both test sets kept; see the Lavish decision. | | `tests/fm-review-diff.test.sh` | 89e1459 (#3) | Fork's two unrecorded-`feature/` branch cases re-added; case letters shifted after upstream's new cases. | | `tests/fm-timeout-lib.test.sh` | 9e8b923 | Fork's no-`BASHPID` test kept on top of upstream's tests. | ## Decision: Lavish list-form parser (captain chose option A) Both sides fixed the same bug: Lavish emits queued feedback as a TOON list (not a table) when items carry nested content, and the adapter read it as an empty, complete result. - Fork (#7): one parser that flattens and presents every nested field (table-cell `target:`, `attachments:`, other `fields:`, message uid/selector/text), adds `unpresented_items:`, and refuses `complete: yes` when nested content cannot be parsed. - Upstream (fc8972c, kunchenguid#5404): one parser that skips nested targets and attachments; its tests assert nested content is absent from `read`. It also adds stricter refusals (unrecognized header keeps its declared count and counts as malformed; `answers`/`reconciles` exit 3 when not fully accounted for), and 228b27d renames the message count to `captain_message_count`. Options: - **A (chosen):** keep the fork's presenting parser, port upstream's strictness onto it (declared count + malformed on an unrecognized header, `answers`/`reconciles` exit 3, `captain_message_count`), keep both test sets, and adapt upstream's three "absent" assertions to check nested content appears only under its own labelled section and never replaces the item's own text. Cost: this region will likely conflict again on the next upstream sync. - **B:** take upstream's parser and tests wholesale and drop the fork's nested presentation. Cost: Lavish reads lose table-cell location, text-selection range, and image attachment paths.
Intent
Workers do not pick up skills by themselves, so the skills a worker should use must be specified explicitly. Jev (typesafe.ai System One, already used by bin/fm-dispatch-resolve.sh to pick each worker's model and effort from its brief) should decide which skills fit the task, and the skills it picks are then set explicitly for the worker.
Context: today a worker only sees whatever skills its project and user installation provide (for example project .claude/skills such as shadcn-adjacent pony-tail, tanstack, vitest, playwright-e2e, orval-api in owndivision-frontend, and user skills in ~/.claude/skills such as shadcn, typescript, tdd, ui-design), and in practice it does not load them unprompted. Firstmate's own model and effort routing via Jev is already live in config/crew-dispatch.json.
What Changed
bin/fm-skill-select.sh, an opt-in tool gated onTYPESAFE_API_KEY:disable-model-invocation: trueare skipped.--apply, the selection is written into a# Required skillssection right after# Task, which tells the worker to load those skills or reportblocked.--setor--clear, and--candidateslists the available skills. None of these three needs the key or the network.bin/fm-dispatch-resolve.shand the new tool intobin/fm-typesafe-lib.sh: the key lookup, the never-send check, building the task text from the brief, and the timed POST. The resolver now uses this library.AGENTS.mdnow tells firstmate to run the tool with--applyonce the worker's harness is resolved, before spawn.docs/configuration.mdand the live comparison indocs/verification/skill-select.md.tests/fm-skill-select.test.shand wired it into thebin/fm-test-run.shfamilies and change-to-test mapping.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The fix round is minimal and correct: it resolves the Claude user root once in the main shell (claude harness only) so a die exits with status 2 exactly once before any candidate scan or network call, and the added test exercises the real CLI and would have failed before the fix.
Testing
Ran the new
fm-skill-selectsuite and thefm-dispatch-resolvesuite, which shares the extracted typesafe library; both pass. Also drove the CLI by hand against a fixture home, offline, to capture what firstmate sees. It lists candidates, showsoffwith no key, writes the explicit# Required skillssection into the brief on--set, and rejects unknown skills.--clearrestores the brief byte for byte, and an unresolvable claude-account exits 2 with a single error. No live Jev call was made, because that would send brief text to typesafe.ai; the Jev path is covered by the suite's fake curl and by the live run recorded indocs/verification/skill-select.md. This is a CLI change with no UI surface, so screenshots don't apply. The worktree is clean.Evidence: End-user CLI transcript of fm-skill-select.sh (candidates, off, --set writes the Required skills section, --clear, claude-account error)
Source: End-user CLI transcript of fm-skill-select.sh (candidates, off, --set writes the Required skills section, --clear, claude-account error)
Evidence: Script that produced the CLI transcript
Source: Script that produced the CLI transcript
Evidence: fm-skill-select test suite output
Source: fm-skill-select test suite output
Evidence: fm-dispatch-resolve test suite output
Source: fm-dispatch-resolve test suite output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
bin/fm-skill-select.sh:213-claude_user_rootcallsdiewhenconfig/claude-accountdoes not resolve, but it runs inside the$(claude_user_root)command substitution inskill_dirs. Sodieonly exits that subshell.printfstill emitsuser\t/skills,skill_dirsreturns 0, and the script carries on.Concrete case: a
config/claude-accountnaming a missing directory, with--harness claude. The error line prints twice, becauseskill_dirsruns twice (line 298 and insidecandidates_json). Every user skill then silently drops out of the candidate set.--apply/--setcan still write a selection limited to project skills, or the run falls to the 'no candidates' off outcome. Either way the script exits 0, while the header promises exit 2 for a configuration error.Fix: resolve the Claude user root once at top level, before
skill_dirsis first called, e.g.CLAUDE_USER_ROOT=$(claude_user_root) || exit 2. Then haveskill_dirsprint that variable.bin/fm-skill-select.sh:389- With--apply, anoneorerrorresult leaves any# Required skillssection from an earlier run in place, and the output saysbrief: unchanged. This is documented and tested as intended. Firstmate should still know that a rerun after editing the brief does not clear an outdated selection; that needs--clear.🔧 Fix: Exit 2 once on unresolvable Claude account root
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-skill-select.test.sh(all pass; covers the Jev path with a fake curl: one yes/no question per skill, 0.8 floor, clear/none/error outcomes, section placement and rewrite,--set/--clear, and the claude-account regression that expects exit 2 with a single error and no curl call)bash tests/fm-dispatch-resolve.test.sh(all pass; regression check for the sharedbin/fm-typesafe-lib.shextracted from the dispatch resolver)Manual offline CLI run through a fixture home with user and project skills (script and transcript in the evidence dir):--candidates,--applywith no key (off, brief untouched),--set shadcn,vitest(brief gains the Required skills section),--set nosuch(exit 2),--clear(brief restored byte for byte), and a missing claude-account target (exit 2, error printed once)Confirmedtests/fm-task-branch-lib.test.sh, newly added to thefm-test-run.shtiming table, exists✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.