tmux-observer
Attach a tmux window to an already-running fir session — observe its transcript and drive its input via tmux send-keys. Use when you need to watch or steer another fir agent.
- License 许可
- MIT
- 所属仓库
- kfet/fir
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- tmux-observer
- builtin
- true
- override
- true
- description
- Attach a tmux window to an already-running fir session — observe its transcript and drive its input via tmux send-keys. Use when you need to watch or steer another fir agent.
02 资源文件 4
- 参考文档evals/evals.json6.5 KB
- 参考文档references/copy-guidelines.md2.3 KB
- 参考文档references/email-types.md13.9 KB
- 参考文档references/sequence-templates.md3.8 KB
03 SKILL.md 正文
Attach a tmux window to an already-running fir session so you can both observe its transcript and drive its input. The fir session must already exist (started by someone else, or by you in a previous step) — this skill does not start sessions.
The whole skill is three tmux commands plus one fir command. There is no script.
First: you may not need a window at all
fir observe and fir send work one-shot, without a TTY, and over ssh.
For an agent (rather than a human) that is strictly better than reading a
pane:
fir observe <id> --status [--json] # idle | running | error | no-model | observe-lost | ended | crashed,
# model, current tool, last error, startup notice
fir observe <id> -n 40 # status + last 40 transcript entries; exits
fir observe <id> --wait --timeout 10m # block until the current run ends, then snapshot
fir send <id> --wait --timeout 10m 'do X' # send, block for the turn, print the final reply
fir send <id> '!stop, read foo.go' # steer; fir send <id> --abort cancels the turn
Another host: run exactly the same commands there over ssh — e.g.
rexec(host, "fir observe <id> --status"). The observe_session /
send_session tools are local-only. Do not scrape the remote tmux pane to
learn whether the agent works; --status shows things like
no-model: No models available… or an auth error that the transcript
alone does not.
Use the observer window below when a human wants a live view, or you
want a persistent --interact pane.
When to use
- You started or know about another fir session (ACP, interactive, or
-p) and want to watch what it's doing. - You want to send prompts, steer mid-turn, or queue follow-ups into that session from your own process.
- You want a persistent observation window the human (or you) can re-check anytime.
The model
One tmux window per fir session you want to drive. The window runs fir observe <id> --interact, which both tails the transcript and accepts stdin as messages back into the session. You read state with tmux capture-pane and send input with tmux send-keys.
Step 1 — discover the session id
fir observe # table of running sessions: ID PID NAME CWD STATUS AGE
Pick the 8-char id prefix from the ID column. Or resolve by cwd:
fir observe --cwd /path/to/project # errors if 0 or >1 matches
You can also read sidecars directly: ~/.local/state/fir/agents/<id>.json contains session_id, session_name, cwd, status, mode, etc.
Step 2 — spawn the observer window
tmux new-window -n fir-<short> "fir observe <id> --interact"
- Formatted transcript with full message text — no truncation. Best for capture-pane reading.
--interact= stdin lines are sent as messages. Required if you want to usetmux send-keysto drive the session.- Use
--jsonif you need raw JSONL events for programmatic parsing (more tokens, less readable). - Window name
fir-<short>is just a convention — pick whatever helps you find it later. Usetmux list-windowsto see your windows.
If you want the observer in a fresh tmux session instead of the current one, use tmux new-session -d -s <name> ... — that's your call. This skill does not prescribe layout, naming, or session strategy.
Step 3 — read the transcript
tmux capture-pane -p -t <window> # currently visible content
tmux capture-pane -p -S - -t <window> # full scrollback from the start
tmux capture-pane -p -S -200 -t <window> # last 200 lines
-p prints to stdout. -t accepts window names (fir-<short>) or indices.
Step 4 — send input
Each tmux send-keys ... Enter sends one message because --interact is line-oriented (Enter sends immediately).
# Plain prompt — fresh turn (queues if mid-turn).
tmux send-keys -t <window> 'what is your current plan?' Enter
# Steer — interrupt the current turn.
tmux send-keys -t <window> '!stop, read foo.go first' Enter
# FollowUp — queue for after the current turn.
tmux send-keys -t <window> '+also update the changelog' Enter
# Literal leading ! or + — escape with backslash.
tmux send-keys -t <window> '\!literal bang' Enter
Sigil rules (first char of the line):
!→deliver_as=steer(interrupt)+→deliver_as=followUp(queue)\!/\+→ escape, send literal- anything else → fresh prompt
Empty / whitespace-only lines are silently skipped.
Step 5 — close the window
tmux kill-window -t <window>
The fir session itself keeps running; you only close your observer.
Caveats
--interactagainst amode: interactivesession races with the human's TTY input. Check the sidecar'smodefield before driving an interactive session. ACP and print-mode sessions are the natural targets.- Quoting in
tmux send-keys. Single-quote your message and the shell takes care of it. For messages containing single quotes, prefer a heredoc piped tofir send:
(fir send <id> <<'EOF' message with 'quotes' and special chars EOFfir sendis the alternative input path — same socket, no observer pane needed. Use it when send-keys quoting gets ugly.) - Multi-line messages via send-keys. Each Enter sends a separate message. For multi-line content, pipe via
fir sendinstead — piped stdin is delivered as one message. - Post-mortem. If the session has ended, the sidecar still points at its transcript;
fir observe <id> -n 100prints it. The window will not accept input.
04 同仓库更多 Skills
wt
Spawn a fresh fir agent in its own tmux session on its own git worktree. Use whenever the user wants the work — or the conversation about the work — to happen over there, not here. If the user points at this skill, or has directly loaded it in the context, that alone is the cue — spawn, don't inline.
wrap-up
Wrap up work on a project branch — review, fix, and simplify in a loop until clean, then ff-merge to main.
tmux-driver
Drive interactive CLIs (python, gdb, etc.) via named tmux sessions with multi-window support. Falls back to fir's built-in PTY driver when tmux is unavailable.
telegram-bot-setup
Set up a new Telegram bot channel for a fir project — install the telegram MCP, create a per-project state dir, drop in the bot token, wire .fir/mcp.json with TELEGRAM_STATE_DIR, pair the user, and verify. Use when the user asks to add, configure, or onboard a Telegram bot for a fir worktree/project.
sync
Sync with an upstream source repo — detect changed files, apply equivalent downstream edits, update the baseline, and report any new features or non-trivial changes picked up.
skill-creator
Create, write, add, edit, update, or review a fir skill — author SKILL.md with frontmatter and agent-facing instructions, run the quality checklist, and tell the user to /reload.