Workspace health
Know the morning something breaks: a deployed agent reads the last 24 hours of the workspace against the week before and posts to Slack only what is wrong and new: failing runs grouped by cause, a lost connector, a play that stopped, runs that succeed and write nothing, a spend spike, a stuck batch. Mondays it posts the week: still open, cleared, all clear.
Set up the workspace-health cookbook in this project.
1. If the Cargo CLI is not installed yet, follow every step in https://api.getcargo.io/INSTALL.md
2. From the Cargo project, run: cargo-ai project add cookbook/workspace-health
3. Then follow .claude/skills/workspace-health/SKILL.md. Stop for my approval before any paid call, and stop at "cargo-ai project plan" before deploying anything.$cargo-ai project add cookbook/workspace-healthSay this to your agent
Every morning, check our Cargo workspace and tell me in Slack if anything broke.
Illustrative output #
Fictional records, to show the shape of what comes back.
Workspace health: 3 new findings
1. HubSpot sync lost its connector: 212 of 230 runs failed since 06:10 with
401 unauthorized at the write step. Re-authorize the HubSpot connector.
2. Tier Accounts has not run since Oct 19 (it averaged 3 runs a day): the play
is disabled. Re-enable it if that was not on purpose.
3. Enrich new signups succeeded 140 times and wrote no company size on 131 of
them. Open run 7c1e… to see what the provider returned.
On Mondays: “Workspace health, week of Oct 26: 1 still open (Tier Accounts), 2 cleared, 0 checks skipped.”
Done when #
node --import tsx evals/contract.mjspasses: aclaudeCodeharness bound to an Anthropic connector and a model,runAsa viewer service user, no capability, exactly two connector actions (slack.postMessageandslack.getConversationHistory) locked to the same channel, a daily cron, and all three threshold env entriescargo-ai project planreports the agent, its folder, and the three connectors- the first run with a known problem in the workspace (a disabled play that used to run, or a workflow failing above the threshold) posted it once, naming the play and the cause
- every number in the post matches the same read re-run by hand
- a second run the same day, with nothing new, posted nothing
- on the first Monday it posted the weekly line, even with nothing new
- nothing in the workspace changed because of a run: no rerun, no cancel, no play enabled or disabled
What it costs #
The recurring cost is the harness run once a day, billed as LLM tokens through the bound Anthropic
connector. It scales with how much is wrong: a clean day is three list commands and five aggregate
queries; a bad day adds up to two run get reads per failing workflow. The workspace reads are API
calls, not connector actions, so they bill nothing, and the run never executes an action that
spends. Slack is one history read a day, plus a post only on days with something to say.
Every morning a Claude Code harness agent reads the last 24 hours of the workspace against the week before and posts to Slack only when something is wrong and new: failing runs grouped by cause, a lost connector, a play that stopped, runs that succeed and write nothing, a credit spike, a stuck batch. Mondays it posts the week.
cargo-ai project add cookbook/workspace-health
Why it is built this way #
- A harness agent, for the CLI. The orchestration SQL surface (
cargo-ai orchestration query execute) groups a day of failures by workflow and node in one query, and the harness is what puts that CLI in reach. It clones the project for the toolchain and never pushes. - Slack read-back is the memory. The agent reads its own earlier posts with
getConversationHistory, locked to the channel it posts in, so a finding is said once and then rolls into Monday. No state file, no pull request a day. - Silence means healthy because Monday always posts. Without the weekly line a dead watcher and a clean workspace look the same.
- Thresholds, not every error. Enrichment that finds no email for some records is provider
coverage. A finding is a rate above
HEALTH_ERROR_RATEor a spend aboveHEALTH_SPEND_MULTIPLE, both set on the agent so the prompt never invents them. - It reports and never fixes. Reruns bill, and a disabled play may be disabled on purpose.
- The deep dive belongs to
cargo-diagnostics. This agent traces at most two runs per failing workflow, enough to name the cause, and hands you the run to open.
Files #
| File | What it is |
|---|---|
infra/agents/workspace-health.ts | the agent: daily cron, harness, post and history read locked to one channel, thresholds |
infra/agents/workspace-health.prompt.ts | the contract: the five checks, dedup, the Monday line |
infra/connectors/ | Anthropic, GitHub and Slack, all bound with default: true |
infra/folders/index.ts | the agent folder, named after the cookbook |
evals/contract.mjs | the boundaries schema validation cannot express |
evals/acceptance.md | the walk-through after the first run |