Working with an Agent
An AI agent can run Octo for you: write the change into octo.yaml, run the lifecycle, read the
validate report with you, and work out why a run failed. What it needs is the Octo MCP server, which
gives the agent the documentation of the exact Octo version your project installed, signs it in to
Octo, and runs your project's own CLI.
Add Octo to your agent
Install the server in your project, beside the other @quadnix packages and at their version, so
the documentation it gives the agent describes the Octo your project runs:
npm install --save-dev @quadnix/octo-mcp
The server runs on your machine, and your agent starts it from your project. In Claude Code:
claude mcp add octo -- npx -y @quadnix/octo-mcp
Any agent that speaks MCP takes the same command, npx -y @quadnix/octo-mcp, in its own MCP
settings. Most read it as JSON, in the file the agent's documentation names:
{
"mcpServers": {
"octo": {
"command": "npx",
"args": ["-y", "@quadnix/octo-mcp"]
}
}
}
The agent keeps every @quadnix package in your project, the server included, at one version.
When your project is behind the server, the agent upgrades your project's @quadnix packages to
the server's version with your package manager, reads the Changelog
whole and follows the steps of every release in between. When your project does not list
@quadnix/octo-mcp, the agent installs it there at your project's @quadnix version and asks you
to restart the server in your agent. When the server is behind your project, the agent upgrades
@quadnix/octo-mcp in your project to your project's version and asks you to restart the server
in your agent, so it loads the newer documentation. Either way, it then runs generate to check
the project against the new version.
The server finds your definition file as the CLI does: the path OCTO_DEFINITION_FILE_PATH names,
else octo.yaml. If yours is named otherwise, give the server that variable in its MCP settings:
claude mcp add octo --env OCTO_DEFINITION_FILE_PATH=infra/octo.yaml -- npx -y @quadnix/octo-mcp
Sign in
Your agent signs in when it first needs remote state. It opens a page in Octo and shows you a code. There you sign in, pick one of your Personal Access Tokens, and approve the code. Then go back to your agent and tell it you are done.
The agent now acts as that token, and your project's CLI does too when the agent runs it. Approving replaces the token's session, so anything else using that token signs in again. A token made for the agent alone avoids that.
The session is kept in your operating system's keychain, under octo, until the token expires. On a
machine with no keychain, it is kept in ~/.config/octo/credentials.json instead, readable by you
alone. Ask the agent to sign out to forget it.
What the agent does
The agent asks before anything is deleted. When a validate report lists a DELETE or a REPLACE,
the agent shows it to you and waits for your answer before it passes --allowDestroy.
Everything else follows the lifecycle: the agent changes
infrastructure only through octo.yaml and the CLI. It can also open the graph of your app's
newest state in the Octo web app.
Asked to put an app on AWS, the agent designs before it builds. It reads what the app needs from its code, asks you only what the code cannot say, such as where your users are and how much the bill matters, and proposes one design: what each part is for, a monthly cost range with the traffic it assumes, and which later change would rebuild a part or lose data. It works from what each module states about its limits and costs, in the reference of the version it serves.
The agent can also start from an empty folder: it creates the project with create-app, and
scaffolds modules of your own with the CLI's create-* commands. It looks a module's inputs up in
the reference of the version it serves, rather than recalling them, and treats a module, command,
flag or input it cannot find there as missing: it never invents one, and offers to build a module
nobody has written yet.
The agent reads your own modules the same way, from their JSDoc, once it has indexed them: those
src/index.ts exports, and every library your package.json lists that depends on @quadnix/octo. Indexing reads
your code with TypeScript and TypeDoc, which npm installs with the server, and writes nothing into
your project. The agent sees when a source file or a library changed since, and indexes again.
After writing or changing a module, it writes the module's JSDoc as
Documenting a Module describes, then indexes again.
After writing or changing a rule, it runs octo check-rules before relying on it.
When a command fails, the agent reads its journal, then looks the error up in the reference and the
guides. Of your app's history it reads the current and previous state, and an older one only when
the task needs it or you ask. On remote state it can also list and read every older run the backend
holds: each one it reads is fetched once into your project's state folder, under archives/, and
each listing or fetch is a call to the backend, as the signed-in session.