All pages
Close the loop · Lesson 1.3 · 10 min
Watch the terminal
Tab monitors and output watches that catch errors the moment they print.
After this lesson you know which kind of watcher fits which kind of output, and you've set up three of them: a tab-monitor rule that reacts when a command fails, an agent watch on a dev server that never exits, and a background job the agent checks without rereading its whole log.
Time: 10 minutes · Works on: macOS app.
Errors print where nobody is looking
Most failures in an agentic session don't happen in the agent's own tool calls. They happen in the panes around it: the dev server that crashes after the agent's edit hot-reloads, the type checker in watch mode, the test watcher two tabs over, the overnight build. Each prints its error and keeps going. Nobody reads it until something else breaks.
The fix isn't to have the agent poll every pane. Polling costs a model turn each time and still misses things between polls. Instead, have TRMNLY watch the output and call the agent, or you, only when something happens.
Two shapes of output
Before you pick a watcher, ask how the command ends.
Commands that finish. A build, a test run, a migration. The output arrives and the prompt comes back with an exit code. The right moment to check is when the command finishes, and the exit code already says most of what you need.
Commands that don't finish. A dev server, tail -f, a test watcher. They
print forever and never return a prompt. A check at command end never fires,
because there is no command end. These need a watcher that reads output as
it arrives.
Most mistakes with watchers come from mixing these up. A rule that waits for a command to finish will sit silent next to a dev server printing stack traces.
Who gets woken
Decide who hears about each event:
- You, when the event needs a decision: a deploy failed, an agent is waiting at a prompt.
- The agent, when the event has an obvious next step it can take on its own: a test failed after its edit, a build broke.
- Nobody, just a mark, when the event is worth seeing later but not worth an interruption: a warning in a log.
Sending everything to the agent is expensive and noisy. Each event it gets is a paid turn. Sending everything to you is how notifications get ignored.
A worked example
You've asked the agent to refactor an API handler. Three things are running:
npm run dev in one split, npm test that you rerun by hand in another, and
a nightly data import as a background job.
- The dev server never exits, so the agent watches that pane for changes in its output and is woken when a stack trace appears.
- The tests finish each run, so a tab-monitor rule matches
FAILlines when the command ends and sends them to the agent. - The import runs for an hour. The agent checks its log digest when you ask, reading only the lines added since its last check.
The refactor breaks a route. The dev server prints a TypeError, the agent
is woken with the new lines quoted, and it fixes the handler before you've
noticed anything.
Do it in TRMNLY
Know the passive signals. Without any setup, TRMNLY already watches for you. A pane whose command fails shows a pill with Explain and Fix at the bottom. The tab list badges each tab: an orange triangle when a command failed or a rule flagged it, a red number for the last non-zero exit code, a spinner for a command running three seconds or more. The badges cover every split in the tab, not just the focused one.
Route build failures to the agent. In the agent's gear menu, under Automation, turn on Auto-ask agent on build failures. When a pane prints a recognised build or toolchain error, the agent gets it and proposes a fix without you clicking Explain. A plain non-zero exit, Ctrl-C or a "command not found" typo doesn't trigger it.
Add a rule for finished commands. Open More ▾ → Flows, and under Tab-monitor rules click Open editor…, then +. Name it "Tests failed", set Pattern to
^FAIL, Match to Regex, and Action to Send to agent sidebar. Paste some test output into Live preview to check the match, then Save. Use Test fire in the rule's row menu to try the action without waiting for a failure. Choose Notify instead when you want to hear about it yourself, or Mark tab for attention to just light up the tab.Remember what a line-match rule can't see. It scans a command's output when the command finishes. A dev server's output isn't scanned until it exits, which is usually never. For those, use the next step.
Have the agent watch a running pane. Ask: "Watch the dev-server pane and tell me when it prints an error." The agent calls
list_panesto find the pane, thenwatch_terminalwithenable: trueand thatpane_id, so it can watch a split you aren't focused on. Theonsetting chooses when it's woken:error, the default: when a finished command printed a recognised error, such as a Go panic, a Python traceback, or a Rust, clang or TypeScript error.idle: every time a command in that pane finishes.both: either of the above.change: TRMNLY polls the pane everyinterval_seconds(10 by default) and wakes the agent when the visible output changes, with the new lines quoted. At most one wake a minute. This is the mode for a dev server or atail -f.
Ask it to stop with
enable: falsewhen you're done, because each wake is a turn.Wait on several panes at once. When the agent starts work in several panes, for example three builds, it can call
wait_for_panes_idlewith their pane IDs. It's woken once, when all of them have finished or the timeout passes. The default timeout is 30 minutes.Run long jobs in the background. Open More ▾ → Jobs to submit a command that survives quitting TRMNLY, or have the agent call
run_background_job. TRMNLY posts a notification when it finishes. While it runs, the agent checks on it withjob_output_digestand the job's label. Each call reads only what was added since the last one, with errors and warnings deduplicated and counted, so a 50,000-line build log stays small.Re-run a check when a file changes. In the gear menu, under Automation, choose Watch tasks…, then Add. Pick a file or folder with Choose…, write the Prompt to send, for example "Run the tests for the parser and report failures", and set the Debounce so a burst of saves sends it once. Each change sends the prompt to the agent again.
Check yourself
- You can say whether a given command needs a line-match rule or a
watch_terminalwatch, and why. - Your "Tests failed" rule sent a failure to the agent on Test fire.
- The agent was woken by a dev-server error in a pane you weren't focused on.
- You stopped a watch when you no longer needed it.
job_output_digestreturned only new lines on its second call.
Go further
- Tab Monitor — triggers, actions, pattern limits and tab badges
- Workflows and tab monitors — the Flows tab and the rule editor step by step
- Background jobs — schedules, logs and the job tools
- Schedules and unattended runs — put watched work on a timer