> ## Documentation Index
> Fetch the complete documentation index at: https://docs.befailproof.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Self Reports

> Let your agents tell you when they are stuck: looping, a broken credential, missing context, or a request they cannot do.

Self Reports gives every agent one extra tool, `report`. An agent that is blocked and cannot make progress on its own calls it with a category and one factual sentence. Failproof AI records the call as a `self_report` event on the agent's session, and the tool answers `Recorded.`.

A report never unblocks the agent and never changes a decision. Afterwards the agent works around the problem or tells the user what is blocking it. No policy can block or rewrite a report: failproofai's hook allows the call before any policy, session pause, or Jev review runs.

## Where reports show up

Reports are internal to your organization. In Failproof AI Cloud a report appears on the agent's session timeline, at the point the agent made it, and on the `self_report` event itself. The Cloud audit agent always sees reports when it reads a session's transcript. There is no separate Self Reports page: what Cloud keeps for Self Reports is its settings (on or off, categories, guidance) and alerts.

## On by default

Self Reports is on as soon as failproofai is installed. `failproofai policies --install` and `failproofai config` register the `failproofai_local` MCP server in every agent they install hooks for, and write `~/.failproofai/self-report.json` with the default categories so every reader sees the same settings.

> [tab] Failproof AI Cloud
>
> On a machine connected to Failproof AI Cloud, the setting comes from your organization, and it is on unless someone turned it off.
>
> 1. Go to **settings → self reports**.
> 2. Keep it on, or switch it off. Keep the default categories or write your own, and optionally add guidance for the agents.
>
> Every connected machine picks the change up on its next policy poll. `failproofaid` writes `~/.failproofai/self-report.json` from it and adds the `failproofai_local` MCP server to every agent that has failproofai hooks, or removes it when the switch is off. Until the first poll after connecting writes that file, the machine treats Self Reports as off. The daemon updates the agents whenever what their entries depend on changes: the first time it writes the file, when the file's source changes (a machine's own file replaced by the organization's), when the switch flips, and when the port changes.
>
> The file is bound to the enrolment whose poll wrote it. After the machine switches to another organization, or reconnects with a new token, the previous file reads as missing (off) until the new enrolment's setting is written.
>
> On a Cloud-managed machine, `failproofai self-report enable` and `disable` refuse and point you to the dashboard.

> [tab] Local (open source)
>
> ```bash theme={null}
> failproofai self-report status
> failproofai self-report disable
> failproofai self-report enable
> failproofai self-report test --agent claude
> ```
>
> With no settings file and no `selfReport` block in `~/.failproofai/config.json`, Self Reports is on with the default categories.
>
> `failproofai self-report disable` turns it off. It writes `enabled: false` to the `selfReport` block of `~/.failproofai/config.json` and to `~/.failproofai/self-report.json`, and removes the MCP entries from every agent. Your categories are kept for next time. An agent that is already running keeps the tool it loaded, but from then on its calls are allowed and not recorded. An explicit `enabled: false` always wins: a later install leaves it off.
>
> `failproofai self-report enable` turns it back on and registers the MCP server again. To replace the default categories, pass `--categories-file <file>`, a JSON list of `{name, description}`. To append instructions to the tool's description, pass `--guidance "<text>"`.
>
> `test` sends one report end to end as the agent you name and shows where it landed.

A settings file that cannot be parsed counts as off, so a broken file never starts recording. Run `failproofai self-report enable` or `disable` to write it again.

## Categories

An organization's own list replaces these entirely. Names are lowercase letters, digits, and underscores; a list holds 1 to 32 categories.

| Category | Description shown to the agent |
| - | - |
| `looping` | You keep repeating the same or circular steps without making progress. |
| `cannot_do_request` | The user asked for something you cannot do here: a missing capability, tool or permission, or it is only possible by cheating. |
| `invalid_tool_or_credential` | A tool, MCP server, plugin, API key or token you need is broken, invalid, expired or rejected. |
| `missing_context` | Information or access you need is missing and you cannot get it yourself. Not for normal clarifying questions. |
| `repeated_tool_failure` | A command or tool failed on several distinct attempts and is blocking you. A single error is not enough. |
| `task_failure` | You genuinely tried and could not complete the task, or something else blocks you that no other category describes. Not for refusals or policy blocks. |

A report is always filed under a category on the list. A missing category, a near-miss spelling such as `Invalid Tool Or Credential`, or a name that is not listed is resolved to the listed name it normalises to, else to the first listed category whose keywords appear in the category or detail (a missing token or a 401 is `invalid_tool_or_credential`, going in circles is `looping`), else to `task_failure`, or to the first category of a list without it. The detail is cut to 2,000 characters (Unicode code points, so an emoji or other character outside the Basic Multilingual Plane counts once and is never split), and never in the middle of a word: when the cut lands inside one, that whole word goes, so a long token or key running past the cut is never kept in part, where redaction could no longer recognise it. A detail that is a single word longer than that reads `[detail cut]`. An agent that calls the tool without loading its schema sometimes guesses the argument names, so when `detail` is missing or empty the first non-empty of `summary`, `sentence`, `message`, `description`, `reason`, `text` and `details` is recorded instead, and when `category` is, `type` or `kind`. Other unknown arguments are ignored; a call is never rejected.

## Agent support

failproofai registers one MCP server, named `failproofai_local`, in each agent's user-level MCP settings, except Pi, Hermes and OpenClaw, whose tool comes from failproofai's own extension or plugin (see below). Agents see the tool as `mcp__failproofai_local__report` (Claude Code, Codex, Factory, Devin, Pi), `failproofai_local_report` (OpenCode), `mcp_failproofai_local_report` (Hermes, Antigravity) or `failproofai_local__report` (OpenClaw, Goose). The name is not `failproofai`, which is the name the [Cloud MCP gateway](https://docs.befailproof.ai/reference/mcp.md) is usually added under, so the two coexist; no tool of a server named `failproofai` is ever let past your policies, in any agent's spelling. Every entry runs `failproofai mcp --agent <agent>` over stdio. Claude Code and Codex used to point at the daemon's local server, `http://127.0.0.1:4319/mcp`, while their hooks would run, but the entry is per user and a project can switch the hooks off (`disableAllHooks` in `.claude/settings.local.json`), and that endpoint records nothing for an agent whose hook records, so such a project's reports were lost. Over stdio the server records any report the hook did not (see [When the hooks do not run](#when-the-hooks-do-not-run)), and every other agent's report is recorded by the server, which needs the agent's working directory to find the session (see below). Every entry is marked as failproofai's, so removing it never touches a server you added.

The sync writes the stdio command as the `failproofai` that npm installed beside the daemon's Node, so it finds it even under the service's own `PATH`, and when it cannot update an agent the daemon's log names the agent and the reason. When the daemon starts, it re-runs `failproofai self-report sync`. An HTTP entry an earlier version wrote is moved to stdio by the next sync, and `failproofai self-report status` repairs one it finds. A running agent keeps the server it loaded at startup. The daemon's HTTP server (`FAILPROOFAI_SELF_REPORT_PORT` moves it) still serves the Hermes and OpenClaw plugins, which check that it answers as the daemon behind this account's socket (both carry the daemon's instance id) before they send it anything, and any entry written by hand.

### How the tool reaches the model

The server sends short instructions in the MCP handshake: when to report, the category names, and your guidance. Several agents load MCP tools only on demand, behind a tool search, which shows the model a name and no description. failproofai keeps the tool direct, or the instructions in front of the model, in every agent:

| Agent | How the tool and its instructions reach the model |
| - | - |
| Claude Code | The entry sets `alwaysLoad: true`, so its tools are never deferred behind tool search. Server instructions go in the system prompt. |
| Codex | In code mode (Codex 0.172) tools run through `exec`, MCP tools are deferred, and only about the first 250 characters of the server's instructions and of the tool's description are shown, so both open with what to do: when stuck, call `failproofai_local`'s `report` tool with a `category` and a one-sentence `detail`. The same instructions, with your categories and guidance, also go in a marked block (`<!-- failproofai:self-reports:start -->` to `<!-- failproofai:self-reports:end -->`) in the global `~/.codex/AGENTS.md` (under `CODEX_HOME` when set; `AGENTS.override.md` when that file exists, since Codex then reads it instead), which Codex loads in every session, with one more line: search your tools for `failproofai_local` if `report` is not listed. Nothing outside the markers is changed; removing the block deletes the file only when nothing else is left in it. |
| Cursor | MCP tools are listed directly. |
| Copilot CLI | Tools are listed directly. Copilot passes server instructions only for its built-in allowlist (or with `--allow-all-mcp-server-instructions`), so the same instructions go in a marked `~/.copilot/instructions/failproofai-self-reports.instructions.md` (under `COPILOT_HOME` when set), written and removed with the entry. |
| OpenCode | MCP tools are listed directly. |
| Pi | failproofai's Pi extension registers the tool, with the instructions in the system prompt. |
| Hermes | failproofai's Hermes plugin registers the tool natively and adds it to Hermes' never-deferred list, so `tools.tool_search` does not hide it, with the instructions in `pre_llm_call` context. |
| OpenClaw | failproofai's OpenClaw plugin registers a `catalogMode: "direct-only"` tool, which Tool Search never defers. `before_prompt_build` returns the instructions both as system context (`appendSystemContext`) and as context for the current turn (`appendContext`): models saw the system copy alone and still did not report. |
| Factory | droid defers MCP tools behind its tool search, with no setting per server. The instructions arrive as SessionStart context, so the model knows to load `report` from the deferred list. |
| Devin | Devin can defer MCP tools behind its `tool_search`, with no setting per server, so the model may see the tool's name first and load it. |
| Antigravity | The entry sets `eager: true`, so the tools are direct rather than behind the `call_mcp_tool` wrapper. Antigravity ignores MCP server instructions, so failproofai adds a plugin in its global customization root, `~/.gemini/config/plugins/failproofai-self-reports/` (`plugin.json`, the instructions in `rules/AGENTS.md`, and a `.failproofai-managed` marker), whose rules Antigravity merges into every session. A directory of that name without the marker is never written to or removed. |
| Goose | Extensions' tools are listed directly. |

Pi before 0.99 has no MCP support, and from 0.99 (checked on 1.7.0) an MCP server's tools are hidden behind Pi's `codemode` unless its entry sets `"exposure": "direct"`. Rather than an MCP entry, failproofai's Pi extension, which every Pi with failproofai hooks already loads, registers the tool itself as `mcp__failproofai_local__report` on every Pi version, with the server's instructions in Pi's system prompt. It asks `failproofai mcp --agent pi` for the tool when Pi starts, and again at most once a minute when a session starts or a prompt is sent, and hands each call to it, so the text, the categories and the recording are the same as every other agent's. A Pi started while Self Reports was off (or while it waited for FailproofAI Cloud's setting) gets the tool from its next prompt after Self Reports is turned on, without a reload, and turning it off takes the tool out of Pi's active tools. The Hermes and OpenClaw plugins do the same against the daemon's Self Reports server: they ask it for the tool when the gateway starts (and every minute after, for the instructions and the on/off switch) and send each call to it as `?agent=hermes` or `?agent=openclaw` with the gateway's working directory, so it is attributed, deduped and logged like an MCP call. Without a daemon, or while Self Reports is off, the model sees no tool. The Hermes plugin registers the tool even then, hidden, so a gateway started while Self Reports was off shows it within a minute of `self-report enable`, without a restart. On Hermes the tool's schema is fixed when it registers (a short generic one when the daemon had not answered yet), so new categories reach the schema at the gateway's next start; they reach the model at once through the instructions. `self-report sync` writes no Pi, Hermes or OpenClaw MCP entry and takes out one an earlier version wrote, in every profile. `failproofai update` (and the first `failproofai config` on a new version) takes out a Hermes or OpenClaw one before it restarts their gateways, so a restarted gateway does not load it again; OpenClaw would otherwise also start the stdio server for it.

Where an agent's hooks see MCP tool calls and the server they belong to, the hook records the report. Where they do not, failproofai's MCP server records it. It attributes the report to that agent's newest session seen by the hooks in the last 6 hours: in the server's working directory if there is one, else in a directory above or below it. With neither, it takes the agent's newest session only when all of the agent's sessions in those 6 hours are in one directory, and files the report as `unattributed` otherwise, rather than guess between projects. The lookup reads every page of hook activity written in the 6 hours, however busy other agents or projects kept the hooks, so a session that is still in the window is found. The agent the report is filed under comes from that session's own hook events.

These agents are registered over stdio for that reason: the MCP entry is per user, not per project, so an HTTP URL could carry only `?agent=`, and the server could not tell which project called. The daemon's HTTP server still answers an entry like that (one written by hand, or by an earlier version until the next sync), but it never guesses across projects: with no working directory, it files the report under that agent's newest session only when all of the agent's recent sessions are in one directory, and as `unattributed` otherwise. It records nothing while Self Reports is off.

| Agent | Where the server is registered | Recorded by |
| - | - | - |
| Claude Code | `~/.claude.json` | Hook, or the MCP server while hooks are off |
| Codex | `~/.codex/config.toml`, plus the block in `~/.codex/AGENTS.md` above | Hook, or the MCP server while Codex has not trusted the hooks |
| Cursor | `~/.cursor/mcp.json` | MCP server. Cursor's tool hook names the call `MCP:report`, without the server, so it cannot tell our `report` from another server's, and the call goes through the policies like any other. When the daemon cannot be reached, it is denied with every other call |
| Copilot CLI | `~/.copilot/mcp-config.json`, plus the instructions file above | MCP server |
| OpenCode | `~/.config/opencode/opencode.json` | MCP server |
| Pi | failproofai's Pi extension | MCP server |
| Hermes | failproofai's Hermes plugin, in each profile | The daemon's Self Reports server |
| OpenClaw | failproofai's OpenClaw plugin, in each profile | The daemon's Self Reports server |
| Factory | `~/.factory/mcp.json` | MCP server |
| Devin | `~/.config/devin/mcp_config.json` | MCP server |
| Antigravity | `~/.gemini/config/mcp_config.json`, plus the plugin above | MCP server |
| Goose | `~/.config/goose/config.yaml` | MCP server |

### When the hooks do not run

Claude Code and Codex can load the MCP server while skipping failproofai's hooks, and then no hook records a report:

* Codex 0.129 and later runs a hook from `~/.codex/hooks.json` only once a person trusted it, at its current hash. Hooks in Codex's system config (`/etc/codex/config.toml`, where `failproofai config` puts them when it has sudo) run without trust.
* Claude Code runs no hooks with `disableAllHooks: true`, and only managed ones with a managed `allowManagedHooksOnly: true`.

So the stdio server records a Claude Code or Codex report itself unless that agent's hook already recorded that same call: the agent runs its hook before it sends the MCP call, so the server looks for the hook's record of the same report, from the last two minutes and in the same working directory, and each hook record vouches for one call only. The same words in another project, or a second identical call, are recorded. A report is recorded once either way, and a person who trusts the hooks while the agent runs changes nothing. A report the server records goes on the session the agent's own files name (Codex's rollout, Claude Code's transcript for that directory). `self-report sync` registers these agents over stdio, never on the daemon's endpoint, which records nothing for them. `self-report status` says who records each one's reports and, for an untrusted Codex, how to trust the hooks: re-run `failproofai config` and allow sudo, or open `codex` once and approve them.

### Devin and Claude Code's hooks

Devin runs the hooks in `~/.claude/settings.json` as well as its own, so a Devin call to `report` reaches failproofai's hook twice, once as Devin and once as Claude Code. Devin's report is recorded by its MCP server, so the Claude Code hook leaves a call that came from Devin alone: it recognises one by a `devin` process above the hook, or by Devin's payload (a `call-…` tool call id and no transcript path). The report is recorded once, as Devin's.

### Other agents' servers

Devin also lists the MCP servers of other agents' configs: `~/.claude.json` (user and per-project servers), a project's `.mcp.json`, and `.cursor/mcp.json` in the directory it runs in. It keeps one server per name, and its own `~/.config/devin/mcp_config.json` wins over the imported ones, except that a `.cursor/mcp.json` in the working directory (so `~/.cursor/mcp.json` when Devin runs in your home directory) wins over Devin's own. Servers under other names are listed beside ours: a `failproofai` or `failproofai-local` that `devin mcp list` shows comes from one of those files (for example a Claude Code project's `mcpServers`), not from failproofai, which only ever writes `failproofai_local`.

### Cursor approval

If `cursor-agent mcp list` shows `failproofai_local` as "not loaded (needs approval)", run `cursor-agent mcp enable failproofai_local`. cursor-agent asks for approval of servers in a project's `.cursor/mcp.json`, so this happens, for example, when it runs with your home directory as the project. The approval is per project and per entry, so failproofai does not write it for you. `self-report sync` and `self-report status` say so for Cursor.

On Antigravity, an MCP call can come through its `call_mcp_tool` wrapper. The hook lets that call through ahead of the policies only when the wrapper names server `failproofai_local` and tool `report`. A wrapped call to any other server goes through the policies as usual.

`failproofai self-report status` prints everything in one place: on or off and where the setting comes from, the settings file, the categories, the daemon's endpoint (`not running (agents use stdio)` when no daemon is set up here), each agent's transport, URL or command, who records its reports and the fix for any agent with a problem, and the gateway rows from the last `update`. `--json` prints all of it as JSON.

`enable` and `disable` print one line, such as `Self Reports: on for 12 agents`, which also names any agent they could not update. `policies --install`, `policies --uninstall`, `config` and `update` print nothing about Self Reports when it all worked, and one line naming the agents they could not update when it did not. They also leave out routine gateway rows (`hermes/default  already current, gateway restarting`) and print only a gateway you have to restart yourself; `self-report status` shows the rows from the last update. `self-report sync` lists every change.

If an MCP server named `failproofai_local` that failproofai did not write is already there, it is left alone and reported as a conflict. A server named `failproofai`, such as the [Cloud MCP gateway](https://docs.befailproof.ai/reference/mcp.md), is never touched or reported: it sits next to `failproofai_local`, and its tools go through your policies like any other server's.

## When a tool call fails

Once per session, after a tool call failure that clearly blocks the agent, failproofai adds one line the model reads: "If this blocks you and you can't fix it, call failproofai\_local's `report` tool once." A failure clearly blocks when:

* it is an auth or credential error: its error output or a short result says 401 or 403, unauthorized, forbidden, authentication failed, an invalid or expired key, token or credentials, or names a `*_TOKEN`, `*_KEY` or `*_SECRET` that is not set, or
* the same tool, or for a shell call the same program, already failed earlier in the session.

One non-zero exit is ordinary work and gets no line. Neither does read-only exploration failing, however often: `ls`, `cat`, `grep`, `find`, `test` and similar commands, `git status` or `git log`, and tools such as Read, Glob and Grep, unless the failure is an auth error. There is no line after a successful call, after the report call itself, after a failure a failproofai deny caused (that is already recorded as a block), or while Self Reports is off. It is part of Self Reports, not a policy, and it never replaces a policy's answer.

| Agent | Where the line goes |
| - | - |
| Claude Code | `additionalContext` on PostToolUse and PostToolUseFailure |
| Codex | `additionalContext` on PostToolUse |
| Cursor | `additional_context` on postToolUse |
| Copilot CLI | `additionalContext` on postToolUseFailure (its postToolUse reads only a block) |
| Factory | PostToolUse feedback, which droid adds as a message only the model sees |
| OpenCode, Pi, Hermes, OpenClaw, Devin, Antigravity, Goose | None: these agents have no channel that adds context after a tool runs (OpenCode's only route is a new prompt) |

## The daemon's log

The daemon's log (`~/.failproofai/logs/daemon.log`, which machine logs upload) has a line for every Self Reports MCP event: each `initialize` and `tools/list`, each `tools/call` with the agent, the category, the session it was filed under, and whether it was recorded or skipped and why, and each sync's result. A write failure, a report whose category was inferred (the line says `inferred_category=true` and gives the `raw_category` the agent sent, which may be empty; a category not shaped like a name, such as a token, is shown only as `(N characters, not shown)`), and an unreadable settings file are warnings. A line carries at most the first 40 characters of the report's detail, after secrets are scrubbed from the whole of it, cut on a character boundary and followed by `...` when there was more. The stdio server, which runs as a child of each agent, sends its events to the daemon over its socket and never waits for it: with no daemon, or a version that predates this, they are dropped.

## Containers

In a container, run `failproofaid` in the foreground as the container's main process, with the agent started beside it. Reports, like every other hook event, reach Failproof AI Cloud only through the daemon: without it, the agent still gets the tool over stdio, but reports stay on disk in the container.

A daemon you start by hand has no service unit, so it has none of the commands the unit would give it:

* **The startup sync** runs the CLI named by `FAILPROOFAI_CLI_CMD`. Without it, the daemon looks for `failproofai` on `PATH`, then in npm's global bin (`$NPM_CONFIG_PREFIX/bin`, `~/.npm-global/bin`, `/usr/local/bin`) and `~/.bun/bin`. After an `npm install -g failproofai`, agents therefore move to HTTP when the daemon starts. If the CLI is somewhere else, set `FAILPROOFAI_CLI_CMD` to the command that runs it, or run `failproofai self-report sync` once the daemon is up.
* **The policy worker** evaluates every hook the daemon receives, from every agent, Claude Code included. Without `FAILPROOFAI_WORKER_CMD`, the daemon looks for `dist/worker.mjs` relative to its working directory. If it is not there, every hook routed through the daemon fails closed: Claude Code's tool calls, for example, are denied. `policies --install --cli hermes` (or `openclaw`) refuses outright. Set it to the worker in the installed package:

  ```bash theme={null}
  export FAILPROOFAI_WORKER_CMD="node $(npm root -g)/failproofai/dist/worker.mjs"
  failproofaid &
  ```

## Your own agents

The Python and TypeScript SDKs offer the same tool, named `failproofai_report`, as ready-made tools for LangChain, LangGraph, CrewAI, LlamaIndex, Pydantic AI, the Vercel AI SDK and Mastra, and as raw OpenAI and Anthropic tool definitions. See [Python custom agents](https://docs.befailproof.ai/start/integrations/custom-agents.md#self-reports) and [TypeScript custom agents](https://docs.befailproof.ai/reference/custom-agents-typescript.md#self-reports). SDK reports carry `source: "sdk"`; reports from coding agents carry `source: "mcp"`.

## Privacy

The tool's description tells the agent there is no need to mention the report to the user. Terminal agents still show the tool call on screen; in your own UI, hide it with `is_self_report_tool(name)` (Python) or `isSelfReportTool(name)` (TypeScript).

A report holds the category, the agent's one-sentence detail, and the session, agent, and environment it came from. It is uploaded with the session's other events.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.