Skip to content

Coding Agents ​

Coding agents run a lot of commands for you, quickly, and their transcript is gone when the session ends. Mochi gives them a better way in:

  • They use your real tasks. An agent sees the same tasks, descriptions and history you do, instead of guessing commands from a README.
  • They only run what you trust. An agent can't run tasks from a workspace you haven't trusted.
  • Every run is kept. Agent runs land in your run history, labeled with the agent and session that started them.

Connect an agent ​

mochi mcp is a Model Context Protocol server. Add it to your agent's MCP configuration:

json
{
  "mcpServers": {
    "mochi": { "command": "mochi", "args": ["mcp"] }
  }
}

That's the whole setup. Through it, the agent can list and search your tasks, read their details and past runs, and run them.

Set up a repo with your agent ​

Once an agent is connected, it can set a repo up for you: find the tasks already there, fill the gaps, and shape it around how you work. Open your agent in the repo and paste this:

text
Set up this repo in Mochi for me, using the mochi MCP server. Ask me before
changing anything, and keep it short.

1. Start with get_info. If this repo isn't a workspace yet, register it with
   `mochi workspace add <name> . --set`.
2. Ask me three things: what I run most days, what's slow or flaky, and what
   should never run without me (deploys, migrations, anything destructive).
3. Preview discovery with mochi_discover. Tell me which task files you'd import
   and which you'd skip, then apply what I agree to.
4. Look at my history with mochi_get_stats and mochi_query_runs
   ("workspace:<name> ran:30d", then "status:failed"). Use it, and my answers,
   to decide what matters.
5. Fill the gaps only. If I run something by hand that no task covers, write
   it as a flow executable with mochi_save_executable, or write_flowfile for a
   new file. Don't duplicate a task discovery already found.
6. Give every task I'll use a one-line description
   (`mochi executable set-description`), and set the workspace's name,
   description and tags with mochi_edit_workspace.
7. Star the three to five tasks I'll reach for most with mochi_set_favorite.
8. Propose trust for this workspace: `mochi trust set <name> trusted`, plus
   `mochi trust rule add <name> ask '<pattern>'` for each risky task from
   step 2. Show me the commands; run them only if I say yes.
9. Suggest one view I could build in the desktop app, such as my daily tasks
   next to their recent runs.
10. Leave a short note for future agents in the instruction file this repo
    already uses (AGENTS.md, CLAUDE.md, or a skill for Claude Code). It says:
    run tasks through the mochi MCP tools when they're available, else through
    `mochi` in the shell, never the underlying npm, make or script directly;
    which tasks to use for what; and which ones need my approval. Show it to
    me before writing it.
11. Finish with a short list of what you changed and what you skipped.

The prompt has the agent ask before each change. Discovery, favorites and trust are kept by Mochi, not in your repo. Steps 5, 6 and 10 write files in the repo, where you can read and edit the result; drop them from the prompt to keep the repo as it is.

See what your agents ran ​

Open Runs → Agent runs in the desktop app. Runs are grouped by agent session, so you can go back through what a session did, read the output of any step, and diagnose whatever failed.

Two Claude Code sessions under Agent runs, each with the runs it made and whether they passed

This works even when an agent skips MCP and types mochi commands in its own shell. Mochi recognizes Claude Code, Codex and OpenCode, and credits their runs to the right session with no setup. Any other agent that sets the AI_AGENT environment variable is credited by name.

Decide what agents may run ​

When an agent asks to run a task from a workspace you haven't trusted, Mochi refuses and tells the agent the command that trusts it. The agent passes that on, and you decide; if you say yes, it runs that command and tries again. Commands you type yourself are never blocked.

sh
mochi trust set my-project trusted

You can also trust a workspace but still require a check for risky tasks, such as anything that deploys. See Workspace trust.