coding.sh monitor
Score new sessions automatically with an LLM judge rubric, a command or an HTTP evaluator. Every option of coding.sh monitor and its subcommands, from…
coding.sh monitor <action> Score new sessions automatically with an LLM judge rubric, a command or an HTTP evaluator Commands add Add a monitor: every new session that matches gets one score from it list List monitors with their scores, today's judge spend and last error rm Remove a monitor (its scores stay) run Run monitors now on sessions that ended in the window, skipping sessions they already scored Notes Monitors run after each coding.sh ingest, in the viewer's ingest loop and in serve's writer, at most once a minute each; never in the hook or in the ingest a read command does first. Each monitor scores sessions that ended after its cursor (the past day on its first run), one score per session; a session it already scored is skipped. A monitor's failure never fails the ingest: it is recorded as the monitor's last error, which monitor list shows. A command that exits non-zero or prints no value scores nothing. --judge with no provider records 'no judge provider' and scores nothing until one is set. Pass one of --judge, --run or --http. --http prints a signing secret once (64 hex characters). Each POST carries three headers keyed with it: X-Coding-Sh-Timestamp (unix seconds), X-Coding-Sh-Signature-V2: sha256=<HMAC-SHA256 of "<timestamp>.<body>">, which covers the timestamp and the body, and X-Coding-Sh-Signature: sha256=<HMAC-SHA256 of the body alone>, which does not stop a replay. A receiver checks V2 and refuses a timestamp more than 5 minutes from its own clock. Redirects are not followed, each try has 10 s, and a 5xx, 408, 425, 429 or network error is tried 3 times, 1 s then 2 s apart. An answer over 256 KB or any other status scores nothing and is recorded as the monitor's last error. When --http can't reach the service for 2 sessions in a row, the pass stops and its cursor stays before them, so the next pass tries them again. An answer for a later session, a score or a refusal, moves the cursor past them. monitor list and its --json show the --http URL without its query string or fragment. Definitions, cursors, spend, errors and --http secrets are in monitors.json (mode 600 where the OS has file modes), next to the config file (coding.sh config path shows it).
coding.sh monitor add
Add a monitor: every new session that matches gets one score from it.
coding.sh monitor add <NAME> [options]
Add a monitor: every new session that matches gets one score from it
Arguments
name Monitor name; its scores carry this name and source monitor
Options
--judge <RUBRIC.md> Score with the LLM judge against this rubric file (a score from 0 to 1, the reason as its comment)
--run <COMMAND> Score with a shell command: it gets the session JSON (as show --json, redacted) on stdin and prints {"value": ..., "comment"?: ...}; stopped after 60 s
--http <URL> Score with an HTTP service: a signed POST of {"apiVersion": "v1", "monitor", "session"} (session as --run gets it); a 2xx answer {"value": ..., "comment"?: ...} is the score
--where <QUERY> Only sessions matching a query, e.g. 'agent:codex cost>0.5 tool:Bash -flag:compaction' (keys: coding.sh sessions --help)
--sample <0..1> Score this fraction of sessions, picked by a hash of the session id (default: all)
--max-usd-day <USD> --judge: stop for the day once the estimated judge spend reaches this (default: 1)
--provider <PROVIDER> --judge: the model provider (default: the first of ANTHROPIC_API_KEY, OPENAI_API_KEY, AI_GATEWAY_API_KEY, GEMINI_API_KEY that is set). One of: anthropic, openai, gateway, gemini, mock.
--model <MODEL> --judge: the judge model (default: the provider's)
--force Replace a monitor with the same name (its cursor starts again; its scores stay)
Examples
coding.sh monitor add tests-pass --run "node check.mjs"
coding.sh monitor add helpful --judge rubric.md --where 'agent:claude-code' --sample 0.2
coding.sh monitor add helpful --judge rubric.md --max-usd-day 5 coding.sh monitor list
List monitors with their scores, today's judge spend and last error.
coding.sh monitor list List monitors with their scores, today's judge spend and last error Examples coding.sh monitor list coding.sh monitor list --json
coding.sh monitor rm
Remove a monitor (its scores stay).
coding.sh monitor rm <NAME> Remove a monitor (its scores stay) Arguments name Monitor name Examples coding.sh monitor rm helpful
coding.sh monitor run
Run monitors now on sessions that ended in the window, skipping sessions they already scored.
coding.sh monitor run [name] [options] Run monitors now on sessions that ended in the window, skipping sessions they already scored Arguments name Only this monitor (default: all) Options --since <WHEN> Sessions that ended at or after this time: 7d, 12h, 30m, today or a date (default: 1d) --watch Keep going: ingest and score new sessions every 10 s until Ctrl-C Examples coding.sh monitor run coding.sh monitor run helpful --since 7d coding.sh monitor run --watch