Skip to content

refactor: streamline firstmate operating guidance - #368

Merged
ruby-dlee merged 9 commits into
mainfrom
fm/firstmate-instruction-debloat-v4
Aug 27, 2026
Merged

refactor: streamline firstmate operating guidance#368
ruby-dlee merged 9 commits into
mainfrom
fm/firstmate-instruction-debloat-v4

Conversation

@ruby-dlee

Copy link
Copy Markdown
Owner

Intent

Comprehensively simplify Firstmate's tracked instruction and harness guidance so future sessions prioritize direct captain answers, live ownership, recursive unblocking, bounded validation, and continuous cleanup instead of accumulating passive process. Treat AGENTS.md as the always-loaded hot path: retain only unconditional identity, authority, safety, routing, and trigger rules there; move or delete conditional procedure, duplicated mechanics, stale narrative, and repeated contract text using existing authoritative skills, docs, or script headers rather than inventing another framework. Measure and report before/after lines and bytes for every instruction surface changed, and require a meaningful net reduction overall. Preserve the captain/firstmate relationship, the no-project-writes rule, merge authority, unlanded-work protection, direct-answer obligation, active unblock obligation, and the current single-operator design doctrine. Do not weaken budget, credential-custody, irreversible-data-loss, or unlanded-work safety. Do not merely rewrite grievances as more prose; convert repeated unenforceable instructions into one clear owner or remove them. Inspect generated brief scaffolds and loaded agent-only skills for contradictions that cause parked work, but change only what is necessary for the simplification. Preserve the brief emitter's executable isolation and secondmate-idle contracts. Remove source-content-only instruction assertions rather than treating wording as behavioral proof, and keep the behavior-test inventory and duration registry consistent with the authoritative test inventory. Preserve every recovered pipeline commit and the current main history without reset, stash, force, or dropped work. Do not touch .pi/extensions/fm-primary-pi-watch.ts, .pi/extensions/fm-primary-turnend-guard.ts, docs/supervision-protocols/pi.md, docs/turnend-guard.md, tests/fm-pi-primary-compaction-live-e2e.test.sh, tests/fm-pi-watch-extension.test.sh, or tests/fm-turnend-guard.test.sh because the active compaction-continuity repair owns those files. Do not modify private files under /Users/dongkeun/firstmate-home/data except this task's required completion and status artifacts. Deliver the focused reduction through review, test, document, lint, push, PR, and CI without merging the PR.

What Changed

  • Reduce AGENTS.md to Firstmate’s always-loaded identity, authority, safety, routing, and skill-trigger rules.
  • Consolidate conditional operating, crew-steering, and harness guidance under existing skills, scripts, and architecture documentation.
  • Simplify generated briefs around recursive unblocking and bounded validation, while removing wording-only contract tests and synchronizing test inventories.

Risk Assessment

✅ Low: The comprehensive instruction reduction now preserves the required authority and safety invariants, routes conditional mechanics to existing owners, maintains brief isolation and secondmate-idle contracts, and introduces no substantiated source regression.

Testing

The configured baseline, focused Agent Fleet pytest consumer, and brief-generator behavior suite passed; manual generation produced reviewer-visible ship and project-less secondmate briefs that preserve executable isolation, recursive unblocking, bounded completion, and idle contracts, with no testing residue left in the worktree.

Evidence: Generated ship brief
You are a crewmate: an autonomous worker managed by firstmate.
Own the requested outcome through implementation and proof; do not wait unless only a human decision or proven external blocker remains.

# Task
{TASK}

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable worktree of firstmate on a clean detached default base.
Before branching, run `pwd -P` and `git rev-parse --show-toplevel`; both must name this isolated task worktree, not firstmate's primary checkout.
The path check is authoritative; Git-dir paths do not prove isolation.
If isolation fails, do not branch or edit; append `blocked: launched in primary checkout, not an isolated worktree` and stop.
Run `git checkout -b fm/evidence-ship` as your first project change.
2. Run `no-mistakes doctor`; run `no-mistakes init` only when this worktree is not initialized.

# Rules
1. Never push to the default branch. Never merge a PR.
2. Write only inside this worktree plus the authorized completion-report and status paths.
3. Use gh-axi for GitHub and chrome-devtools-axi for browser operations.
4. Append only actionable status with `echo "{state}: {one short line}" >> '/Users/dongkeun/.no-mistakes/evidence/01M10EVTQSZC1FMH0N6G26HDAT/state/evidence-ship.status'`.
   States: working, needs-decision, blocked, paused, done, failed.
   Use `paused: {why}` only for a known external wait expected to clear on its own, never for active validation.
5. Treat blockers recursively: try safe in-scope alternatives while unaffected work continues, and use `blocked:` only when firstmate action is required or materially independent safe routes are exhausted with evidence.
6. Use `needs-decision:` only for a human-owned choice, then append matching `resolved: {how}` with the same optional `[key=<slug>]` when work resumes.
7. Never stop, restart, or update the shared no-mistakes daemon.
   For the exact reconciliation socket-read timeout, run `FM_HOME='/Users/dongkeun/.no-mistakes/evidence/01M10EVTQSZC1FMH0N6G26HDAT' '/Users/dongkeun/.no-mistakes/worktrees/b174997b7206/01M10EVTQSZC1FMH0N6G26HDAT/bin/fm-no-mistakes-reattach.sh' evidence-ship`; append `blocked:` only if it exhausts retries or a different daemon error remains.

# Completion report
Before the final `done:` status, write `/Users/dongkeun/.no-mistakes/evidence/01M10EVTQSZC1FMH0N6G26HDAT/data/evidence-ship/completion.md` with these six sections, each as a LEVEL-TWO markdown heading spelled exactly: `## Summary`, `## What changed`, `## Verification`, `## Visual evidence`, `## Artifacts`, `## Follow-ups`.
Publication rejects the report if any of those headings is missing, spelled differently, or written at another level - a level-one `# Summary` fails. Each section needs substantive prose directly under it; if you use sub-headings inside a section, make them `###` so they nest rather than ending the section.
When a section genuinely does not apply, say so in a sentence under the heading rather than omitting the heading.
Make it stand alone for the captain: explain the outcome, name important files or links, record the validation performed, and call out remaining risk or decisions.
Put screenshots, diagrams, or other visual artifacts under `/Users/dongkeun/.no-mistakes/evidence/01M10EVTQSZC1FMH0N6G26HDAT/data/evidence-ship/visuals/` and reference them from the report when they materially help review.
If review or the no-mistakes pipeline changes the implementation after the report is first written, refresh the report before the later final `done:` status.
These completion-report paths and the status file are the only authorized writes outside the worktree.

# Project memory
When durable project-intrinsic knowledge exists or agent-memory files already exist, run `/Users/dongkeun/.no-mistakes/worktrees/b174997b7206/01M10EVTQSZC1FMH0N6G26HDAT/bin/fm-ensure-agents-md.sh .` and update `AGENTS.md` proportionally.
Keep only knowledge useful to almost every future project session and point to authoritative code or docs instead of copying mechanics.

# Definition of done
Commit the implementation on your branch.
Before completion, exercise the real user-visible path when the change has one.
Tests and screenshots prove execution, not usability; verify the actual outcome end to end.
If the real path cannot be exercised, report that limit plainly and do not claim it verified.
Append `done: {summary}` for focused implementation review by firstmate, and do not start no-mistakes until firstmate instructs you.
Once validation starts, own every synchronous gate return through CI green, failure with evidence, or a new decision.
Use the loaded no-mistakes skill, current `axi run --help`, and response `help` for mechanics.
Do not hand-edit or commit around pipeline-owned fixes, answer your own ask-user finding, or use `--yes`.
After an ask-user decision returns, send it through `no-mistakes axi respond` and continue the same run.
At the first CI-green return, append `done: PR {url} checks green`; do not wait for merge monitoring.
Evidence: Generated secondmate idle charter
You are a secondmate: a persistent domain supervisor managed by the main firstmate.
Own routed outcomes through delivery and cleanup; do not invent work.

# Charter
Evidence-only idle charter validation

# Routing scope
Evidence-only idle charter validation

# Project clones
None. This is a project-less domain: its subject is the firstmate repo this home lives in, so it needs no separate clones under `projects/`; its crewmates take pooled worktrees of that firstmate repo.

# Operating model
Your isolated home's `AGENTS.md` is your job description, and its private state and projects are yours to operate.
This domain has no separate project clones: its subject is the firstmate repo this home lives in, and its crewmates take pooled worktrees of that repo.
Delegate project work through the normal firstmate lifecycle and keep one live owner until each routed outcome is finished.
Act only on tasks the main firstmate routes to you; never spawn a survey, audit, or any self-directed work.

# Requests and replies
A leading `[fm-from-firstmate]` marker identifies a request from the main firstmate.
Return a marked request through the status path below, using a durable home-local document plus a status pointer when the answer is detailed; a chat-only reply is lost.
An unmarked message is direct captain input: answer it conversationally and treat it as authoritative.

# Escalation to main firstmate
Append one sparse actionable line with `echo "{state}: {one short line}" >> '/Users/dongkeun/.no-mistakes/evidence/01M10EVTQSZC1FMH0N6G26HDAT/state/evidence-secondmate.status'`.
States: working, needs-decision, blocked, paused, done, failed.
Use `paused: {why}` only for a known external wait expected to clear on its own.
Before `blocked:`, recursively exhaust safe in-scope routes while unaffected work continues.
Append `resolved: {how}` with the same optional `[key=<slug>]` when a decision or blocker clears.
Routine progress, retries, supervision, and child churn stay inside this home.

# Definition of done
You are persistent and do not exit for an empty queue.
On startup, run normal firstmate bootstrap and recovery only to RECONCILE work that is already yours through `bin/fm-session-start.sh`.
With no assigned or active work, go idle and wait silently for the main firstmate.
If the charter is impossible after safe routes are exhausted, append a narrow evidence-backed `blocked:` or `failed:` line.
- Outcome: 🔧 1 issue found → auto-fixed ✅ across 2 runs (20m43s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ AGENTS.md - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Review** - 1 warning
  • 🚨 AGENTS.md:68 - The required criterion says AGENTS.md must “retain only unconditional identity, authority, safety, routing, and trigger rules,” but the changed hot path still embeds conditional procedures: execute and interpret session start (lines 68–82), classify and route each task (lines 134–149), and run wake/supervision handling (lines 159–178). These procedures remain always loaded instead of being routed to their existing script, documentation, and triggered-skill owners, so the requested boundary is still unmet.

🔧 Fix: Route conditional procedures from hot path
1 warning still open:

  • ⚠️ AGENTS.md - The fixer could not prove the semantic repair with a public/executable fail-before/pass-after regression and relevant integration or consumer compatibility evidence; primary-agent handoff is required.
🔧 **Test** - 1 issue found → auto-fixed ✅
  • 🚨 tests failed with exit code 1
  • if [ "${FM_AZURE_VALIDATION_CELL:-0}" = 1 ]; then exec "$FM_AZURE_VALIDATION_SHARD_BRIDGE" behavior --count "${FM_AZURE_VALIDATION_SHARD_COUNT:-8}"; else exec bin/fm-no-mistakes-test-command.sh; fi

🔧 Fix: Remove source-content-only AGENTS instruction assertions
✅ Re-checked - no issues remain.

  • if [ "${FM_AZURE_VALIDATION_CELL:-0}" = 1 ]; then exec "$FM_AZURE_VALIDATION_SHARD_BRIDGE" behavior --count "${FM_AZURE_VALIDATION_SHARD_COUNT:-8}"; else exec bin/fm-no-mistakes-test-command.sh; fi
  • Configured baseline: if [ &#34;${FM_AZURE_VALIDATION_CELL:-0}&#34; = 1 ]; then exec &#34;$FM_AZURE_VALIDATION_SHARD_BRIDGE&#34; behavior --count &#34;${FM_AZURE_VALIDATION_SHARD_COUNT:-8}&#34;; else exec bin/fm-no-mistakes-test-command.sh; fi (already passed)
  • uv run --project tools/agent-fleet pytest tools/agent-fleet/tests
  • tests/fm-brief.test.sh
  • Generated a ship brief with FM_GATE_REFUSE_BYPASS=1 FM_HOME=&lt;evidence-dir&gt; bin/fm-brief.sh evidence-ship firstmate
  • Generated a project-less secondmate charter with FM_GATE_REFUSE_BYPASS=1 FM_HOME=&lt;evidence-dir&gt; FM_SECONDMATE_CHARTER=&#39;Evidence-only idle charter validation&#39; bin/fm-brief.sh evidence-secondmate --secondmate --no-projects
  • Inspected the generated artifacts for isolated-worktree, recursive-unblocking, completion-report, and secondmate-idle behavior using rg
  • Verified testing left the worktree clean with git status --short
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@ruby-dlee
ruby-dlee force-pushed the fm/firstmate-instruction-debloat-v4 branch from 0ababf5 to 2b9aeb0 Compare August 27, 2026 03:10
@ruby-dlee
ruby-dlee merged commit 2d04664 into main Aug 27, 2026
13 checks passed
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.

1 participant