Skip to content

docs(agents): move X-mode procedures out of AGENTS - #253

Merged
kunchenguid merged 5 commits into
mainfrom
fm/agentsmd-trim-x1
Jul 4, 2026
Merged

kunchenguid merged 5 commits into
mainfrom
fm/agentsmd-trim-x1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

AGENTS.md diet PR 1 of 3 (agentsmd-diet-s2 report, move-plan items 1-2): collapse the inert-by-default X-mode section 14 in AGENTS.md. Replaced the 'Answering'/'Completion follow-up'/'Conversations'/'Length and threads'/'Preview / dry-run' blocks (54 lines) and the 'Mechanism' narrative (6 lines) with short pointers to the fmx-respond skill (procedure) and docs/configuration.md 'X mode (.env)' (wire protocol), keeping only the one fact that must survive inline: the terminal-wake completion-follow-up trigger already in section 8. Deliberately followed a destination-first discipline: before deleting anything, re-verified fmx-respond/SKILL.md against current (post-PR#241) content and found it was NOT actually a complete superset as an earlier scout report assumed - image-attachment support (--image flag for replies and follow-ups, the image-only-for-real-artifacts rule, and the dry-run compact image marker) and the x-mode-error wake handling boundary were genuinely missing from the skill, so I added them there first. Also added one missing architectural fact ('X mode is purely additive, no edit to the watcher core scripts') to docs/configuration.md, since it was only previously stated in the AGENTS.md text being deleted. Also trimmed fmx-respond's own 'Completion follow-up' section so it is now the section's sole full owner (stating the procedure once, completely) instead of deferring back to AGENTS.md section 14 for content that no longer lives there - updated its two internal cross-references to point at AGENTS.md section 8 (the terminal-wake trigger) instead. This is intentionally scoped to section 14 only plus the two destination files; sections 1-13 are out of scope for this PR (planned as PR 3). Ran the full test suite (42 files) plus a targeted rerun of fm-x-mode.test.sh (74/74 passing) to confirm no behavior changed - only prose moved homes.

What Changed

  • Trimmed AGENTS.md section 14 so always-loaded guidance points to the X-mode procedure owner in fmx-respond and the wire-protocol docs instead of carrying the full narrative inline.
  • Expanded fmx-respond with the missing Captain-facing X-mode handling details for image attachments, dry-run previews, X-linked follow-up wakes, and x-mode-error wake handling.
  • Added the missing configuration note that X mode is additive and does not require watcher-core edits.

Risk Assessment

✅ Low: Captain, the change is a bounded instruction/docs relocation, and the X-mode trigger gaps from earlier review rounds are now covered without introducing a substantiated operational risk.

Testing

The previously successful full-suite baseline is accounted for; I reran the targeted X-mode behavior suite, manually exercised the completion follow-up dry-run path with an image to verify compact image metadata and final link cleanup, and simulated a relay auth failure to show the x-mode-error ... wake output that fmx-respond now owns. No rendered UI was involved in this docs and CLI change.

Evidence: Targeted X-mode test log
ok - fm-x-poll is a hard no-op without a token (inert default)
ok - fm-x-poll treats an explicitly empty env token as configured
ok - fm-x-poll stays silent on HTTP 204 (the common case)
ok - fm-x-poll lets an explicitly empty relay env override .env
ok - fm-x-poll surfaces auth/config errors once and clears on recovery
ok - fm-x-poll stashes the question and prints the compact marker
ok - fm-x-poll preserves in_reply_to conversation context in the inbox
ok - fm-x-poll reports inbox commit failures without emitting a mention wake
ok - fm-x-poll requires a non-empty question before waking
ok - fm-x-poll rejects an unsafe request_id (path-traversal guard)
ok - fm-x-reply posts a request-bound answer and echoes only the request_id
ok - fm-x-reply accepts the reply via --text-file and stdin (safe, unexpanded)
ok - fm-x-reply exits non-zero on a non-2xx relay response
ok - fm-x-reply cleans up auth header temp files on interrupted posts
ok - fm-x-reply rejects missing arguments with a usage error
ok - fm-x-reply --help makes image support discoverable
ok - fm-x-reply rejects whitespace-only reply text
ok - fm-x-reply dry-run records the would-be reply and never posts
ok - fm-x-reply dry-run works without a token
ok - fm-x-reply honors FMX_DRY_RUN from .env
ok - fm-x-reply lets an explicitly empty dry-run env override .env
ok - fm-x-reply dry-run fails when it cannot record the preview
ok - fmx_split_thread: word-boundary, within-limit, numbered, lossless, capped
ok - fm-x-reply keeps a concise reply as a single unnumbered tweet
ok - fm-x-reply auto-splits a long reply into a numbered thread (texts[])
ok - fm-x-reply clamps a below-floor max to 50 characters
ok - fm-x-reply posts a thread payload (texts[]) to the relay
ok - fm-x-reply --image posts an image object on answer
ok - fm-x-reply streams large image payloads outside curl argv
ok - fm-x-reply dry-run records compact image metadata for threaded replies
ok - fm-x-reply cleans image and payload temp files
ok - fm-x-reply --image rejects missing and unsupported image paths clearly
ok - fm-x-reply --followup posts to /connector/followup with the same request-bound body
ok - fm-x-reply maps a followup_unavailable follow-up 409 to exit 9
ok - fm-x-reply maps every follow-up 409 to exit 9 even without the marker
ok - fm-x-reply treats answer-endpoint 409 as a generic failure
ok - fm-x-reply --followup --image posts an image object
ok - fm-x-reply --followup is accepted in any position and leaves the answer path default
ok - fm-x-reply --followup dry-run marks the endpoint without changing the answer path
ok - fm-x-reply --followup auto-splits a long follow-up into a marked thread
ok - fm-x-reply followup dry-run keeps endpoint marker and compact image metadata
ok - fm-x-dismiss posts a request-bound dismiss and echoes only the request_id
ok - fm-x-dismiss dry-run records the would-be body and never posts
ok - fm-x-dismiss dry-run works without a token
ok - fm-x-dismiss exits non-zero on a non-2xx relay response
ok - fm-x-dismiss exits non-zero on a transport failure
ok - fm-x-dismiss rejects an unsafe request_id (path-traversal guard)
ok - fm-x-dismiss rejects missing or extra arguments with a usage error
ok - fm-x-link records and refreshes the X-request link without disturbing meta
ok - fm-x-link paired carry flags preserve a prior task's follow-up binding onto a successor
ok - fm-x-link rejects malformed or unpaired carry flags
ok - meta rewrites are independent of TMPDIR
ok - fm-x-link rejects unsafe ids, missing meta, and missing arguments
ok - fm-x-followup --check reports postable / not-linked correctly
ok - fm-x-followup --check prunes a link past the 7-day window
ok - fm-x-followup --check prunes a link that already reached the follow-up cap
ok - fm-x-followup posts a follow-up, increments the counter, and keeps the link under the cap
ok - fm-x-followup --final clears the link after one post regardless of the remaining count
ok - fm-x-followup clears the link once the third follow-up reaches the cap
ok - fm-x-followup --image forwards the attachment through fm-x-reply --followup
ok - fm-x-followup keeps the link and counter when the post fails
ok - fm-x-followup tombstones the link when a post-success counter write fails
ok - fm-x-followup treats a relay cap/window rejection as an already-exhausted link, not a retry
ok - fm-x-followup skips silently and clears the link past the 7-day window
ok - fm-x-followup is a no-op for a task with no X link
ok - fm-x-followup dry-run records the follow-up and increments the counter, keeping the link
ok - fm-x-followup dry-run --final clears the link just as a live post would
ok - fm-x-followup rejects malformed invocations
ok - bootstrap activates X mode from an .env token, idempotently
ok - bootstrap reports missing X-mode dependencies before arming
ok - bootstrap does not report X mode on when activation artifacts cannot be written
ok - bootstrap is inert without a non-empty .env token (non-X users unaffected)
ok - bootstrap cleans up X artifacts on opt-out and is silent once off
ok - bootstrap reports failed X artifact cleanup on opt-out
Evidence: Documentation routing evidence
AGENTS.md section 13/14 routing surface:
   874	
   875	- `harness-adapters` - load before spawning or recovering a crewmate or secondmate, handling a trust dialog, sending a harness-specific skill invocation, interrupting or exiting an agent, resuming an exited agent, or verifying a new harness adapter.
   876	- `stuck-crewmate-recovery` - load after a stale wake, looping pane, repeated confusion, an answered-by-brief question, an unresponsive crewmate, or a failed steer.
   877	- `secondmate-provisioning` - load before creating, seeding, validating, recovering, handing backlog to, pushing inherited config into, or retiring a secondmate home, and before editing `data/secondmates.md`.
   878	- `fmx-respond` - load on an `x-mention <request_id>` `check:` wake to handle the mention, on an `x-mode-error ...` `check:` wake to report the X-mode configuration blocker, and on any milestone or terminal wake for an X-linked task before posting its completion follow-up; relevant only when X mode is on.
   879	- `firstmate-coding-guidelines` - load before changing firstmate's shared, tracked material, as defined by section 1's list, whether editing directly or briefing a crewmate for a firstmate-repo task.
   880	
   881	## 14. X mode
   882	
   883	X mode lets a firstmate instance answer public mentions of the shared `@myfirstmate` bot on X, and act on actionable mention requests, in firstmate's own voice, from its live fleet state.
   884	It ships inside this repo for every user but is **inert until opted in**, so a user who never enables it sees zero behavior change.
   885	
   886	**Activation is `.env` presence, not a command.**
   887	Put one value, `FMX_PAIRING_TOKEN`, into a `.env` file at this home's root (`.env` is gitignored).
   888	That token is the whole consent, including standing authorization for normal reversible lifecycle actions from mention requests, and the only required config; the relay derives the tenant from it.
   889	It is not consent for destructive, irreversible, or security-sensitive actions; those still require trusted-channel confirmation first.
   890	`FMX_RELAY_URL` is optional and defaults to `https://myfirstmate.io`; only a developer pointing at a local relay sets it.
   891	
   892	**Mechanism.**
   893	Bootstrap wires the relay poll automatically and purely additively from `.env` presence; see `docs/configuration.md` "X mode (.env)" for the generated-artifact mechanism, the wire protocol, and the watcher-backbone non-interference guarantee.
   894	
   895	**Cadence.**
   896	An X instance polls every 30s instead of the default 300s.
   897	To get that, arm the watcher with the X cadence sourced, exactly as section 8 describes but prefixed:
   898	
   899	`` `sh
   900	[ -f config/x-mode.env ] && . config/x-mode.env
   901	bin/fm-watch-arm.sh        # as the harness's tracked background task
   902	`` `
   903	
   904	The sourced file exports `FM_CHECK_INTERVAL=30` into the arm, which the watcher it forks inherits, so only an X instance speeds up; a non-X instance has no such file and keeps the 300s default.
   905	Because `bin/fm-watch.sh` reads `FM_CHECK_INTERVAL` only at process start and the arm no-ops on an already-healthy watcher, a cadence **transition** (opt-in while a watcher is already running, or opt-out) is applied by restarting the home-scoped watcher with the new environment: `[ -f config/x-mode.env ] && . config/x-mode.env; bin/fm-watch-arm.sh --restart` (omit the source on opt-out so the 300s default returns), run as the harness's tracked background task.
   906	Bootstrap deliberately does not restart the watcher itself - it must never block, and `fm-watch-arm.sh --restart` is home-scoped (never a broad `pkill`).
   907	X mode is also a reason to keep the watcher armed even with no fleet work, so an X-only user is still served.
   908	Cadence under away-mode (the supervise daemon owns the watcher then) is a separate follow-up and out of scope here; while afk is active the daemon's default cadence applies.
   909	
   910	**Answering.**
   911	On an `x-mention <request_id>` or `x-mode-error ...` `check:` wake, load `fmx-respond` (section 13).
   912	It owns mention classification, acting on the request, reply composition, voice, thread-splitting, image attachments, dry-run preview, and the completion-follow-up procedure in full, including what an `x-mode-error` wake means instead.
   913	`docs/configuration.md` "X mode (.env)" has the wire-protocol reference.
   914	The one fact that must survive here because it fires on a generic terminal wake, not the mention wake itself: when an X-linked task reaches a terminal state, post its final completion follow-up per section 8's wake-handling step before tearing down.

fmx-respond ownership details:
    18	The full mention is stashed locally; this skill acts on any request it carries and turns it into one public reply, or deliberately skips it when there is nothing to answer.
    19	
    20	This runs only when X mode is on (the user dropped `FMX_PAIRING_TOKEN` into `.env`; see AGENTS.md "X mode").
    21	If you ever see an `x-mention` wake without X mode configured, do nothing.
    22	A `check:` wake can also carry `x-mode-error ...` instead of `x-mention <request_id>` - that is a poll or relay configuration problem, not a mention to answer.
    23	Report it directly to the captain as an X-mode configuration blocker and do not treat it as a mention to answer.
    24	
   106	
   107	You do not hand-format threads or add "(1/n)" numbering yourself.
   108	Compose the reply as one piece of prose; if it is genuinely too long for one tweet, `bin/fm-x-reply.sh` automatically splits it into a numbered thread on word boundaries.
   109	Conciseness is still your job - lean on the auto-split only when the answer truly needs the length, not as license to ramble.
   110	
   111	Do not attach an image for prose.
   112	Images are only for actual visual artifacts - a generated illustration, a screenshot, a diagram - never a substitute for writing the answer.
   113	
   145	      bin/fm-x-reply.sh <request_id> --text-file <path-to-reply-file>
   146	      `` `
   147	
   148	      (`bin/fm-x-reply.sh <request_id> -`, reading the reply on stdin, is equally fine.) It echoes the `request_id` and exits 0 on success; non-zero on a failed live post or failed dry-run record.
   149	      When the reply carries one real visual artifact, add `--image <path>`: the helper reads one local PNG, JPEG, GIF, WebP, BMP, or TIFF, detects the media type, base64-encodes it, and sends it in the relay's optional `image` object without ever inlining image bytes into the shell command. If the reply auto-splits into a thread, the image rides the first/opener tweet only.
   150	   e-skip. **For a skip, dismiss it at the relay instead of replying.** A pure acknowledgment gets no reply, but clearing only the local inbox file is not enough: the relay keeps re-offering that request on every poll until it times out to a polite "offline" auto-reply. So before clearing the file, tell the relay to drop the request:
   151	
   166	When `FMX_DRY_RUN` is set (truthy, in the environment or `.env`), `bin/fm-x-reply.sh` does **not** post and `bin/fm-x-dismiss.sh` does **not** call the relay.
   167	The reply client records the full would-be reply payload to `state/x-outbox/<request_id>.json` (`{request_id, text}` for one tweet, or `{request_id, text, texts}` for a thread), prints a `DRY RUN` summary to stderr, and still echoes the `request_id` and exits 0.
   168	The dismiss client records `{request_id, endpoint:"dismiss"}` to the same outbox path, prints a `DRY RUN` summary to stderr, and still echoes the `request_id` and exits 0.
   169	Truthy means anything except unset, empty, `0`, `false`, `no`, or `off`; an explicit environment value wins over `.env`.
   170	When an image was attached, the dry-run record keeps only compact `{media_type, bytes, source_path}` metadata instead of the base64 bytes, so a preview never writes a multi-MB blob.
   171	Dry-run needs `jq` to build the JSON payload, but it needs neither `FMX_PAIRING_TOKEN` nor the relay because it runs before token and network checks.
   172	Your p

... [826 bytes truncated] ...

ap; `--final`, the cap, or an expired window clears it, so the whole acknowledge -> act -> follow-up loop is testable without a public tweet.
   178	
   179	## Completion follow-up (posted on milestone and done wakes, not this turn)
   180	
   181	When an actionable request spawned a task and you linked it (step 2c), progress and the **outcome** are delivered later as follow-up replies, not in this turn.
   182	This skill is the sole owner of the completion-follow-up procedure below; AGENTS.md §13 declares the load trigger for X-linked milestone or terminal wakes, and AGENTS.md §8 reinforces the terminal final-follow-up step before teardown.
   183	This skill's own responsibility during the mention-handling turn is linking the task in step 2c; the full completion path is:
   184	
   185	- Firstmate has **up to three** follow-ups per mention, within a 7-day window, chained in the same thread - it spends them only on genuine milestones the captain would want surfaced (e.g. investigation done and a build started, work shipped or ready, or the task failing), never on routine internal churn.
   186	- If a linked task is replaced by a successor for the same relay request, carry the prior `x_followups=` value and `x_request_ts=` with `bin/fm-x-link.sh <new-task-id> <request_id> --carry-count <n> --carry-ts <epoch>` so recovery preserves the consumed budget and original window.
   187	- On each such milestone, firstmate checks whether a follow-up is still due with `bin/fm-x-followup.sh --check <task-id>` (prints the `request_id` when the link exists, the count is under the cap, and the window has not lapsed; silent otherwise, pruning an exhausted or expired link).
   188	- If due, it composes a short, public-safe update and posts it with `bin/fm-x-followup.sh <task-id> --text-file <path>` (or stdin), which posts via the relay's follow-up endpoint; a successful non-final post increments the counter and keeps the link so a later milestone can still post against it.
   189	  When the update carries one real visual artifact, add `--image <path>`; the helper forwards it to `bin/fm-x-reply.sh --followup` so the same image contract used for ordinary replies applies here too.
   190	- On a terminal wake (PR merged / scout report / local merge / failed), firstmate posts the task's **final** outcome ("done, here's the result"; for a failure, an honest "this one didn't pan out") with `bin/fm-x-followup.sh <task-id> --final --text-file <path>`, which always clears the link after that post regardless of how many follow-ups remain under the cap.

docs/configuration.md X mode wire/mechanism reference:
   148	## X mode (.env)
   149	
   150	X mode lets a firstmate instance answer public `@myfirstmate` mentions and act on normal reversible mention requests through firstmate's normal lifecycle.
   151	It is off unless the firstmate home's gitignored `.env` contains a non-empty `FMX_PAIRING_TOKEN`.
   152	The pairing token both identifies the relay tenant and records opt-in consent for autonomous public replies and eligible lifecycle actions.
   153	Destructive, irreversible, or security-sensitive asks are flagged for trusted-channel confirmation instead of being executed from a public mention.
   154	The relay uses owner-only routing: a mention delivered to a home is from that home's owner/captain, while parent-thread context may still include other public accounts.
   155	`FMX_RELAY_URL` is optional and defaults to `https://myfirstmate.io`, mainly for developers pointing at a local relay.
   156	For direct client invocations, environment values override `.env`; bootstrap activation still keys off `.env` presence so watcher artifacts are explicit local opt-in state.
   157	`FMX_ENV_FILE` can point direct poll/reply client invocations at another `.env`-style file, but it does not change bootstrap activation.
   158	
   159	The locked session-start bootstrap step turns the token into local generated state.
   160	It writes `state/x-watch.check.sh`, a check shim that runs `bin/fm-x-poll.sh`, and `config/x-mode.env`, which exports `FM_CHECK_INTERVAL=30` for watcher arms in that home.
   161	When the token is removed or empty, the next locked session-start bootstrap step removes those artifacts.
   162	Steady-state off is silent and writes nothing.
   163	X mode is purely additive: no edit is made to `bin/fm-watch.sh`, `bin/fm-watch-arm.sh`, `bin/fm-wake-lib.sh`, or the afk daemon (`bin/fm-supervise-daemon.sh` and the `afk` skill).
   164	It lives entirely in X-specific `bin/` scripts, the `fmx-respond` skill, and the generated local artifacts above.
   165	
   166	`bin/fm-x-poll.sh` calls `GET /connector/poll` with `Authorization: Bearer <FMX_PAIRING_TOKEN>`.
   167	HTTP 204 is silent.
   168	A pending mention with non-empty `text` is stored at `state/x-inbox/<request_id>.json` and wakes firstmate with `x-mention <request_id>`.
   169	The full relay object is preserved, including `in_reply_to: {author_handle, text}` when the mention is a reply in a conversation or `null` for fresh mentions.
   170	The `fmx-respond` skill decides whether the stashed mention is an actionable request, a question, or a pure acknowledgment.
   171	Actionable reversible requests are run through intake, backlog, dispatch, investigation, or ship flow as appropriate.
   172	If the work completes in that turn, the public reply reports the outcome.
   173	If the request spawns a longer-running task, firstmate posts an acknowledgement through the normal answer endpoint, links the task to the mention with `bin/fm-x-link.sh`, and posts up to three completion follow-ups on genuine milestones, always finishing with a `--final` one when the task reaches a terminal state.
   174	Fresh links start with `x_followups=0` and the current timestamp; when relinking the same relay request onto a successor task, pass paired `--carry-count <n> --carry-ts <epoch>` flags so the successor preserves the already-consumed follow-up count and original 7-day window.
   175	Pure acknowledgments or mentions with nothing to answer are dismissed through `bin/fm-x-dismiss.sh` before the local inbox file is cleared.
   176	Dismiss sends `POST /connector/dismiss` with `{request_id}`, posts no text, and tells the relay to drop the request instead of re-offering it or falling back to an offline auto-reply.
   177	Relay auth or config problems are reported once as `x-mode-error ...` until recovery.
   178	Live replies are posted by `bin/fm-x-reply.sh`, which sends `POST /connector/answer` with `{request_id,text}` for one-tweet replies.
   179	Add `--image <path>` to attach one local PNG, JPEG, GIF, WebP, BMP, or TIFF as `{media_type,data_base64}` in the relay's optional `image` object.
   180	Completion follow-ups use `bin/fm-x-followup.sh`, which checks the local `state/<id>.meta` link and sends the same payload shape through `POST /connector/followup` by calling `bin/fm-x-reply.sh --followup`, up to three times per link within the window.
   181	Add `--image <path>` there too when a completion follow-up should carry an image.
   191	Set `FMX_DRY_RUN` to preview replies and dismissals without posting.
   192	Truthy means anything except unset, empty, `0`, `false`, `no`, or `off`; an explicit environment value wins over `.env`.
   193	In dry-run, `fm-x-reply.sh` records the would-be payload to `state/x-outbox/<request_id>.json`, including `texts` for a thread and an `endpoint` marker for follow-up previews, prints a `DRY RUN` summary to stderr, echoes the `request_id`, and exits 0.
   194	When an image is attached, the dry-run record uses compact `{media_type, bytes, source_path}` metadata instead of writing the base64 bytes.
   195	In dry-run, `fm-x-dismiss.sh` records `{request_id, endpoint:"dismiss"}` to the same outbox path, prints a `DRY RUN` summary, echoes the `request_id`, and exits 0.
   196	The live answer and follow-up bodies intentionally stay the same shape, including optional `image`; the relay distinguishes them by endpoint, and dismiss stays `{request_id}`.
   197	These paths need `jq` to build the JSON payload, but they run before token and network checks, so they need neither `FMX_PAIRING_TOKEN` nor `curl`.
Evidence: Dry-run image follow-up summary

{"request_id":"req-e2e","endpoint":"followup","image":{"media_type":"image/png","bytes":30},"image_has_base64":false}

{
  "request_id": "req-e2e",
  "endpoint": "followup",
  "text": "Done, captain - the generated diagram is attached.",
  "image": {
    "media_type": "image/png",
    "bytes": 30,
    "source_path": "/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/followup-visual-artifact.png"
  },
  "image_has_base64": false
}
Evidence: X-mode config-error wake output

x-mode-error relay returned HTTP 401

x-mode-error relay returned HTTP 401
Evidence: Final follow-up cleared X link

window=fm-task-e2e

window=fm-task-e2e

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • ⚠️ AGENTS.md:914 - The always-loaded AGENTS guidance now preserves only the terminal-state X follow-up trigger and sends the rest to fmx-respond, but that skill is only loaded for x-mention wakes. Later non-terminal milestone wakes for an already X-linked task therefore no longer have an inline trigger to load the skill or run fm-x-followup.sh, so the promised in-thread progress follow-ups can be silently missed until the final terminal update. Add an explicit section 8/13 trigger to load fmx-respond for X-linked milestone or terminal wakes, or keep a short non-terminal follow-up trigger inline here.

🔧 Fix: Preserve X-linked follow-up triggers
1 warning still open:

  • ⚠️ .agents/skills/fmx-respond/SKILL.md:22 - The concrete x-mode-error handling now lives only inside fmx-respond, but this instruction says not to load the skill for that wake, and the section 13/front-matter triggers only cover x-mention plus X-linked follow-up wakes. A poll/auth failure surfaced as check: x-mode-error ... can therefore miss the explicit blocker-reporting path. Keep a one-line x-mode-error action inline in AGENTS.md, or add it as an explicit load trigger and remove the contradiction.

🔧 Fix: Fix x-mode error trigger
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"
  • Baseline already ran successfully before this validation: command -v tmux &gt;/dev/null || { echo &#34;tmux is required for e2e tests&#34; &gt;&amp;2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo &#34;== $t ==&#34;; bash &#34;$t&#34; || rc=1; done; exit &#34;$rc&#34;.
  • bash tests/fm-x-mode.test.sh > /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/fm-x-mode.test.log 2>&1
  • FM_HOME=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/followup-dryrun-home FMX_DRY_RUN=1 FMX_NOW_OVERRIDE=1700000100 bin/fm-x-followup.sh task-e2e --image /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/followup-visual-artifact.png --final --text-file /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/followup-text.txt
  • jq -e '.request_id == "req-e2e" and .endpoint == "followup" and .image.media_type == "image/png" and .image_has_base64 == false' /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/followup-dryrun-summary.json
  • PATH=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/x-mode-error-fakebin:/usr/bin:/bin:/usr/sbin:/sbin FM_HOME=/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/x-mode-error-home FMX_RELAY_URL=https://relay.test bin/fm-x-poll.sh > /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/x-mode-error.stdout 2> /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWQB22BAZMQM76EQSK9AK298/x-mode-error.stderr
  • git status --short
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

AGENTS.md diet PR 1 of 3 (agentsmd-diet-s2 report, move-plan items 1-2).
Replaces section 14's "Answering"/"Completion follow-up"/"Conversations"/
"Length and threads"/"Preview / dry-run" blocks (54 lines) and the
"Mechanism" narrative (6 lines) with two short pointers: fmx-respond
(section 13) for the procedure, docs/configuration.md "X mode (.env)"
for the wire protocol. Net -55 lines in AGENTS.md.

Destination edits landed first, deletions second (q4 discipline):
- docs/configuration.md: added the "purely additive, watcher untouched"
  guarantee that AGENTS.md's Mechanism block stated but configuration.md
  did not.
- fmx-respond/SKILL.md: added the x-mode-error wake boundary (report as
  a blocker, do not load this skill), the --image flag for replies and
  follow-ups, the "images are for real artifacts, not prose" rule, and
  the dry-run compact-image-marker behavior - none of these were
  previously in the skill even though AGENTS.md described them, so they
  were genuine gaps, not pre-existing duplication. Also made the skill's
  own "Completion follow-up" section the sole, full owner of that
  procedure instead of deferring to AGENTS.md section 14 for substance
  that no longer lives there (two internal cross-references updated to
  point at section 8's terminal-wake trigger and the skill's own section
  instead).

Mechanical line-by-line audit of every removed AGENTS.md line:

Mechanism block (6 lines removed):
- bootstrap artifact-writing description -> already owned by
  docs/configuration.md "X mode (.env)" (locked-bootstrap paragraph)
- check-shim/poll mechanism description -> already owned by
  docs/configuration.md same section
- missing-deps/x-mode-error diagnostic description -> already owned by
  docs/configuration.md ("Relay auth or config problems...") plus
  bin/fm-x-poll.sh's own header comment for the missing-curl/jq mechanics
- opt-out artifact removal description -> already owned by
  docs/configuration.md same section
- "purely additive, no edit to fm-watch.sh/fm-watch-arm.sh/fm-wake-lib.sh/
  afk daemon" guarantee -> MOVED to docs/configuration.md (added in this
  PR; this fact had no other home before)

Answering/Completion follow-up/Conversations/Length and threads/
Preview-dry-run blocks (54 lines removed):
- x-mention wake -> load fmx-respond: already owned by section 13's
  existing trigger line (unchanged) and restated in the new pointer
- x-mode-error wake -> report as blocker, don't load fmx-respond: MOVED
  to fmx-respond/SKILL.md (added in this PR)
- inbox-draining, classification, acting, reply composition, submission,
  cleanup-on-success/failure: already owned by fmx-respond/SKILL.md
  "Procedure" section (unchanged, pre-existing)
- owner-only routing / captain-as-asker framing: already owned by
  fmx-respond/SKILL.md "The asker is your own captain" section
- standing X-mode authorization / autonomous posting / dry-run as only
  non-posting path: already owned by fmx-respond/SKILL.md same section
- acknowledge-first -> act -> follow-up shape, three-case classification:
  already owned by fmx-respond/SKILL.md "A request to act on" section
- destructive/irreversible/security-sensitive escalation guardrail:
  already owned by fmx-respond/SKILL.md "Public channel..." section and
  Procedure step 2c
- dismiss-instead-of-reply for pure acknowledgments, relay re-offer
  prevention, dry-run honoring: already owned by fmx-respond/SKILL.md
  Procedure steps 2b/2c/2e-skip and docs/configuration.md
- public-safety bar (no task ids/internals/captain-private/secrets):
  already owned by fmx-respond/SKILL.md "The reply is public" section
- never-inline-into-shell-command / --text-file or stdin: already owned
  by fmx-respond/SKILL.md Procedure step 2e and Notes
- --image flag for replies (formats, base64, no-inline guarantee): MOVED
  to fmx-respond/SKILL.md Procedure step 2e (added in this PR - this was
  not previously in the skill)
- fm-x-link field names (x_request=, x_request_ts=, x_followups=):
  already owned by AGENTS.md section 2's state/<id>.meta field list
  (untouched, out of scope for this PR) and fmx-respond/SKILL.md
- carry-count/carry-ts relink behavior, three-follow-up budget, milestone
  sparingness, --check/--text-file posting, connector/followup wire
  detail, --final clearing, cap/window graceful degradation: already
  owned by fmx-respond/SKILL.md "Completion follow-up" section (now sole
  owner) and docs/configuration.md wire-protocol paragraphs
- --image flag for follow-ups: MOVED to fmx-respond/SKILL.md "Completion
  follow-up" section (added in this PR - genuine gap)
- "failed task still gets an honest final follow-up": already owned by
  fmx-respond/SKILL.md "Completion follow-up" section
- FMX_DRY_RUN whole-loop previewability: already owned by
  fmx-respond/SKILL.md "Dry-run / preview mode" section
- in_reply_to conversation continuity, untrusted-thread handling,
  follow-up worthiness judgment, relay-owned self-reply guard/cap:
  already owned by fmx-respond/SKILL.md "The direct ask is the captain's"
  section and Notes (one bullet is a verbatim match)
- concise-by-default / no hand-numbered threads: already owned by
  fmx-respond/SKILL.md "Voice" section
- auto-split behavior, char/tweet caps, premium-independence, wire shape
  ({text}/{text,texts}): behavior already owned by fmx-respond/SKILL.md
  Voice section; exact defaults and wire shape already owned by
  docs/configuration.md; "premium-independent" mechanics already owned
  by bin/fm-x-reply.sh's own header comment
- "images are for real artifacts, not prose": MOVED to fmx-respond/
  SKILL.md "Voice" section (added in this PR - genuine gap)
- image-on-thread wire behavior: already owned by docs/configuration.md;
  reinforced in fmx-respond/SKILL.md's new --image note
- dry-run POST-body shape, endpoint marker, truthy-value definition,
  jq-only dependency, end-to-end testability, x-outbox inspection:
  already owned by fmx-respond/SKILL.md "Dry-run / preview mode" section
  (several near-verbatim matches) and docs/configuration.md wire detail
- dry-run compact image marker: MOVED to fmx-respond/SKILL.md "Dry-run /
  preview mode" section (added in this PR - genuine gap)

Section 8's terminal-wake completion-follow-up trigger (the one fact
required to survive inline) is untouched and already present; the new
section 14 pointer references it instead of restating it.

Nothing outside section 14 (plus the two destination files) is touched.
Full test suite green, including all 74 fm-x-mode.test.sh checks.
@kunchenguid
kunchenguid merged commit 2db0a5d into main Jul 4, 2026
4 checks passed
@kunchenguid
kunchenguid deleted the fm/agentsmd-trim-x1 branch July 4, 2026 20:28
mielyemitchell added a commit to mielyemitchell/firstmate that referenced this pull request Jul 6, 2026