Open Source MIT License

Autonomous agents for Claude Code

Define AI agents as markdown files. Schedule them, trigger them on events, or run them as persistent sessions. Memory, cost tracking, and MCP tools built in.

197 runs · $10.18 total cost · Zero manual interventions

Terminal
$ git clone https://github.com/wbnns/cx.git
$ cd cx && npm install && npm run build
$ sudo npm link

Claude Code is powerful but stateless

There are three gaps between "powerful CLI tool" and "autonomous agent."

Scheduling

No built-in way to run at 6 AM or when a new email arrives. You need something to manage when agents run, how long they run, and what to do when they fail.

Memory

Each session starts from zero. Your email triage agent doesn't remember what it archived yesterday. Agents that run repeatedly need persistent context.

Cost Control

No guardrails when agents run autonomously. How much did this run cost? How do you prevent a runaway agent from burning through your API budget?

cx fills all three gaps with one primitive: agents as markdown files.

cx agent: gmail-watcher · completed · 6:02 AM

Processed: 45 emails

Archived & marked read: 45

Flagged as TODO: 1

URGENT — Domain Expiration:

  • Domain expired yesterday — needs immediate renewal
  • Domain expires in 60 days

Security Alerts:

  • Google security alerts — app passwords created/used
  • Sign-up attempt using your email

Amazon:

  • 4 order enquiries from customer (seller messages)
  • 1 return request

Every morning at 6 AM, this runs automatically. By the time you pick up your phone, your inbox is clean.

Everything you need for autonomous agents

Six core capabilities, one CLI. No external dependencies.

Scheduled Agents

Cron schedules with timezone support. Daily reports, weekly digests, recurring tasks — on your terms.

Watcher Agents

Cheap check scripts poll frequently. Claude runs only when triggered. Email monitoring, price alerts, page changes.

Persistent Agents

Long-running sessions with heartbeats and checkpoints. Restart policies. Build state over time.

Persistent Memory

Markdown-based memory survives between runs. Auto-compaction keeps context focused. Persistent notes for long-term facts.

Cost Tracking

Every run logged in USD. Per-run limits, daily and monthly budgets. Alerts before limits hit.

MCP Tools

Give agents tools via Model Context Protocol. Gmail, calendars, databases — your code, your machine, your credentials.

Agents are just markdown

One file defines everything: schedule, tools, memory, cost limits, and plain-English instructions.

gmail-watcher.md
--- name: gmail-watcher type: agent execution: mode: scheduled schedule: expression: '0 6 * * *' type: cron timezone: Atlantic/Azores status: active tools: - mcp__gmail__list_unread - mcp__gmail__list_inbox - mcp__gmail__read_email - mcp__gmail__archive - mcp__gmail__mark_read - mcp__gmail__flag - mcp__gmail__trash notifications: - channel: telegram events: [completion, failure] memory: enabled: true env_ref: email mcp_config: ./cx/tools/gmail-mcp-config.json total_runs: 197 total_cost_usd: 10.18 last_run: '2026-02-13T10:31:39Z' last_status: success --- # Gmail Inbox Triage Agent You are an autonomous inbox triage agent. When triggered, you have unread emails to process. ## Workflow 1. Call `list_unread` to get all unread emails with snippets. 2. Categorize each email. 3. Execute batch actions — group UIDs by action to minimize tool calls. 4. Output a concise summary.

Cron Schedule

Runs daily at 6 AM with timezone support. The daemon checks every 30 seconds.

MCP Tools

Seven Gmail tools via Model Context Protocol. Your server, your code, your credentials.

Cost Tracking

197 runs at $10.18 total — automatically logged. Per-run and daily limits available.

Plain English

The markdown body is the agent's instructions. No DSL, no config language — just prose.

How it works

From markdown file to autonomous execution in five steps.

Define

Write an agent as markdown with YAML config

Daemon Ticks

Background loop checks schedules and watchers every 30s

Context Built

Instructions + memory + secrets assembled into prompt

Claude Executes

Spawns claude -p with MCP tools, runs the task

Results Logged

Run log, memory update, cost tracked, notification sent

What you could build

Real-world agent patterns — each defined in a single markdown file.

GitHub Issue Triage

Auto-label bugs, feature requests, and duplicates. Post helpful replies from codebase context.

mode: watcher poll_interval: 300s tools: github__list_issues, github__add_label, github__post_comment

Auto PR Opener

Monitor "auto-fix" issues, write code, open PRs with cost limits per run.

mode: watcher cooldown: 3600s max_cost: $1.00 tools: github__get_issue, github__create_branch, github__open_pr

Project Standup

Daily standup from Linear/Jira. Flag stale issues, update statuses automatically.

mode: scheduled cron: "0 9 * * 1-5" timezone: America/New_York tools: linear__list_assigned, linear__update_status

Different tools for different problems

Not confrontational — just different architectures for different goals.

OpenClaw cx
Scope General-purpose assistant Agent management for Claude Code
State Database sessions Markdown files — git-diffable
Tools Community marketplace MCP servers you write and audit
Cost No tracking Per-run limits, daily/monthly budgets
Model Multi-model Claude-native (wraps CLI directly)

Not a Swiss Army knife vs. scalpel — more like a Swiss Army knife vs. a CNC machine.

Up and running in four steps

From zero to your first autonomous agent.

1

Install from source

$ git clone https://github.com/wbnns/cx.git
$ cd cx && npm install
$ npm run build && sudo npm link
2

Initialize cx

$ cd ~/my-project
$ cx init
3

Configure secrets

$ cx secrets set global \
  ANTHROPIC_API_KEY sk-ant-...
4

Create and run

$ cx create my-agent --mode scheduled
$ cx edit my-agent
$ cx daemon start

CLI commands

18 commands, grouped by what they do.

Setup
cx initInitialize cx in current directory
cx install-depsInstall watcher dependencies
Agent Management
cx create <name>Create a new agent
cx edit <name>Open agent file in $EDITOR
cx listList all agents
cx statusQuick status overview
cx delete <name>Delete an agent (moves to .trash/)
Execution
cx start <name>Manually trigger an agent
cx stop <name>Stop a running agent
cx pause <name>Pause an agent
cx resume <name>Resume a paused agent
cx daemonManage background daemon
cx test-watcher <name>Test a watcher script
Data & Debugging
cx logs <name>View run logs
cx memory <name>View agent memory
cx compact <name>Trigger memory compaction
cx costsView cost breakdown
cx secretsManage secret groups