/quarterdeck-goals:goal-watchesfrom Quarterdeck
Explains Quarterdeck goal watches: event-driven runs triggered by new GitHub issues, feed entries, files, web page changes, or emails. Covers watch commands, testing, common recipes, and when to use schedules or webhooks instead.
Ships in Quarterdeck. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A goal runs on a schedule. A watch also starts a run when something new appears. You set one with update_goal (watches); the person sees the whole command and confirms it.
A goal run cannot set a watch itself. When it knows what should start its next run ("tell me when a buyer replies"), it calls propose_watch (same fields as a watch spec, plus a short reason) instead of asking how to watch for it: the request waits under Needs you with the exact command, and nothing runs until the person approves.
every_minutes, default 5, at least 1) in the goal's working directory.watch_events.every_minutes, filtering with match / ignore, and spacing watch runs out.fires: "change" (default "new"), the watch compares each check only with the one before: see "Watching a state" below.So print stable identifiers, not text that changes. A line with a comment count or a "2 hours ago" in it looks new at every check.
cmd.exe on Windows and sh elsewhere. Quote with double quotes, and avoid $( ), pipes into grep/awk, and single quotes around arguments. When it needs more than one program, write it as node -e "..." (Node is always there) or put a script file in the goal's directory and run that.After update_goal, the answer says how the first check went: how many items it found, or the error.
Open issues in a GitHub repository (needs gh, signed in):
gh issue list --repo OWNER/REPO --state open --limit 100 --json number --jq ".[].number"
Open pull requests:
gh pr list --repo OWNER/REPO --state open --limit 100 --json number --jq ".[].number"
Releases:
gh release list --repo OWNER/REPO --limit 20 --json tagName --jq ".[].tagName"
An RSS or Atom feed (prints each entry's link or id):
node -e "fetch(process.argv[1]).then(r=>{if(!r.ok)process.exit(1);return r.text()}).then(t=>{for(const m of t.matchAll(/<(?:guid|id)[^>]*>([^<]+)</g))console.log(m[1].trim())}).catch(()=>process.exit(1))" https://example.com/feed.xml
Files in a folder (a new file is a new line):
node -e "for(const f of require('fs').readdirSync(process.argv[1]))console.log(f)" inbox
A web page or file that changes (one line: a hash of its content, so any change is new):
node -e "fetch(process.argv[1]).then(r=>{if(!r.ok)process.exit(1);return r.text()}).then(t=>console.log(require('crypto').createHash('sha256').update(t).digest('hex'))).catch(()=>process.exit(1))" https://example.com/status
fires: "change"A normal watch fires once per line it has never printed, so a state that flips back and forth (a working tree clean, then dirty, then clean again; a health check up, then down) fires only the first time. For a state, set fires: "change":
watch_events.(none) event.fires starts it over, like changing its command.A repository's working tree (one line: the commit, with -dirty while there are uncommitted changes):
git describe --always --dirty
Whether a service answers (one line: its status code, or down):
node -e "fetch(process.argv[1]).then(r=>console.log(r.status)).catch(()=>console.log('down'))" https://example.com/health
watches: { "working tree": { command: "git describe --always --dirty", fires: "change" } }
When a goal only reports a state (is the tree clean, is the service up), a run that reads the check and calls end_run costs a model turn for every change. Give the watch status rules instead and it sets the goal's status and tone itself:
watches: { "working tree": { command: "git status --porcelain", fires: "change", status: {
rules: [{ match: "^ ?M ", status: "uncommitted changes", tone: "attention" }],
default: { status: "clean", tone: "ok" } } } }
run: true whose match (a regular expression) matches any line wins, so a line that should start a run is never hidden by an earlier rule; then the first rule that matches any line; with none, default. The status is set from the first check on.ok, attention and problem.run: true; then its new lines are events, as usual. On a fires: "new" watch, a check that starts no run marks nothing seen, and when a run rule wins a line only a quiet rule matches is never an event or marked seen, so a run rule or default added later can still fire on those lines. A fires: "change" watch compares the whole output, so a quiet line is an event whenever a run rule wins and the output changed, and adding a run rule for a line that is already there starts no run.end_run status replaces it in turn. The pane says "set by watch ".Mail, calendars and cloud files have no command to run: only a Claude Code session can reach their connectors. For those a watch names a tool instead of a command. The session that runs goals calls it every few minutes, with no model turn and nobody asked, and Quarterdeck reads the items out of its answer.
tool: the tool's full name, as your tool list has it (mcp__claude_ai_Gmail__search_threads). It must be a connector or MCP tool that only reads. Quarterdeck's own tools are refused, and so is a tool the goal's rules put in a category that is propose or off.input: the tool's arguments. Ask for ids only and for few results: the answer is read, not kept.match (optional): a regular expression over the answer's text; each match's first group is one item. Left out, every "id": "…" in a JSON answer is an item, which suits most searches. Each match must differ per item: a fixed pattern with no group, such as [Dd]ryer, turns every item into the same line, so capture what differs, e.g. (\w[^·\n]*) · <listing title>. Setting such a watch answers with a warning.goal_detail shows the watch as failing, with the reason, if the connector isn't signed in there or the call is refused.New mail in the inbox (Gmail connector):
{ "goal": "Inbox", "watches": { "new mail": { "tool": "mcp__claude_ai_Gmail__search_threads", "input": { "query": "in:inbox newer_than:2d", "pageSize": 25, "view": "THREAD_VIEW_IDS_ONLY" }, "every_minutes": 5 } } }
Keep the search narrow and recent (newer_than:2d, a sender, a label), so a thread that scrolls off the first page and comes back isn't taken for new. The run is told thread ids; say in the goal's instructions to read each with the connector's get_thread.
Some sources need two calls, and the second needs a value from the first (Claude in Chrome: tabs_create_mcp opens a tab, get_page_text reads it by tab id). Give steps (up to 4) instead of tool, and finally for a clean-up call that always runs:
{ "steps": [
{ "tool": "mcp__claude-in-chrome__tabs_context_mcp", "input": { "createIfEmpty": true } },
{ "tool": "mcp__claude-in-chrome__tabs_create_mcp", "pick": { "tabId": { "regex": "Tab ID: ([0-9]+)" } } },
{ "tool": "mcp__claude-in-chrome__navigate", "input": { "tabId": "{{tabId}}", "url": "https://example.com/inbox" } },
{ "tool": "mcp__claude-in-chrome__get_page_text", "input": { "tabId": "{{tabId}}" }, "expect": "Dryer", "retry": 3 } ],
"finally": { "tool": "mcp__claude-in-chrome__tabs_close_mcp", "input": { "tabId": "{{tabId}}" } },
"match": "(.+)", "every_minutes": 15 }
json: a.b[0]).match pick only stable parts (a name, a message's first words), or fires: new will start runs that find nothing new. Test match against two reads a few minutes apart.expect, a regex its answer must match. Name something only the loaded content has, such as a listing title or a row label you know is there ("Dryer"), never a word in the URL, the title or the navigation ("Inbox", "Marketplace"): those are there on a blank or signed-out page too. Claude in Chrome's reading tools (get_page_text, read_page, find) start their answer with a Title: / URL: / Source element: header ended by ---; the runner strips it, so expect, picks and match see only the page content. an answer that doesn't match is a failed check naming the step and the pattern (the page text is left out of the error, since it is outside text). An empty result that matches expect is still a good check."{{name}}".read_page, not get_page_text, which gives only the frame (Inbox / More / Selling / Buying). read_page lists one row per conversation, such as generic "<buyer name><listing title>": give match one capture group per buyer row on the listing title, and expect a listing title you sell (content only, never "Inbox" or "Marketplace"). Offers made with the offer button may show only in the docked Messenger chat, not in the inbox list, so a page watch can miss them: the reliable path is a Gmail watch on Facebook's Marketplace message emails (the person turns those emails on in Facebook's notification settings).tabs_create_mcp fails with This session has no tab group of its own, and a lost group does the same. When there is none, that call can open a Chrome window.navigate returns before the page has loaded, so the step that reads it can fail on a blank tab or read the previous page. Give that step retry (tries in all, 1 to 5, such as 3) with an expect: when the call errors or can't run (Claude in Chrome's "Navigate to a web page first" comes back this way), misses expect or misses a pick, it waits about 2 s and calls the same step again with the same picks. Only that step repeats, so a retry never opens a second tab; the last failure is reported with the number of tries, e.g. (step 4, …, after 3 tries). The time limit (30 s) covers the whole sequence, retries and their waits included, not each step.navigate without a tabId reuses the first tab in the session's group, which finally would then close.finally that closes it.Every run a watch starts is a full model run, so a run that finds nothing worth doing costs as much as one that does. Cut them at the source:
every_minutes: 5 only where minutes matter (a free item that goes within the hour, a failing build someone is waiting on). New issues, feeds, replies and most mail are fine at 30 to 60 minutes, or more.--label, --search, jq's select), or give match and ignore:
match: for a command, only output lines this regular expression matches count; for a tool, it picks the items out of the answer (see below). Filtered before the 200-line cap.ignore (either kind): lines this regular expression matches are left out: never a run, never marked seen, not read by status rules. Example: "ignore": "dependabot|renovate" on a pull request watch. Removing ignore later lets those lines fire, since they were never seen.run: true (below) start a run only when a line matches a rule that says so; the rest only set the status.min_watch_gap_minutes with update_goal (20 to 30 suits most goals with several watches): after a watch-started run, news that arrives within the gap waits and shares the first run after it. Give a watch "urgent": true when its news can't wait (free items): it starts a run at once, which also carries whatever else is waiting. Scheduled runs and Run now are not held by the gap, and they pick up waiting news too.{ "goal": "Listings", "min_watch_gap_minutes": 30, "watches": { "free items": { "command": "node free.js", "every_minutes": 5, "urgent": true }, "new listings": { "command": "node listings.js", "every_minutes": 30, "ignore": "^sold " } } }
/api/goals/<id>/trigger on the Quarterdeck web app. It needs the web app running and reachable from the sender.remember the last thing it handled.A goal can have both a schedule and watches. The watch brings the run forward; the schedule still catches whatever the watch can't see.
{ "goal": "Triage issues", "watches": { "new issues": { "command": "gh issue list --repo OWNER/REPO --state open --limit 100 --json number --jq \".[].number\"", "every_minutes": 5 } } }
null removes a watch: { "watches": { "new issues": null } }.goal_detail lists a goal's watches and says when one is failing and why.gh issue view and propose a label".What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub shannonbay/quarterdeck --plugin quarterdeck-goalsOther plugins' skills for the same job