agentleFS
argon-labargon-lab/argon/docs/AGENTS.md

argon

AGENTS.md180 starsChanged 9 days agoMITView on GitHub

Give the agent a real MongoDB database that is secretly a disposable branch. Review what it did as a diff. Merge the good, undo the bad, repeat runs from the same pinned document state. Four surfaces, one engine — pick by integration point: Fork + checkout + TTL, one step: By default, the URI uses the engine's MongoDB credentials. On an authenticated deployment, add --credential to create a user with read/write access only to this sandbox. Set "credential": true in…

  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every tool declares how it behaves (MCP tool annotations): argon_branch_list, argon_diff and argon_pin_list are read-only.

    line 111
  2. Very specific:

    When a project follows an external database (argon import database --online, releases after 2.5.0), an agent cannot change that database …

    line 135
  3. Very specific:

    Start argon console --no-browser in another terminal.

    line 254
  4. Very specific:

    Start argon console --no-browser, install pymongo, then run:

    line 319

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Argon for AI agents

Give the agent a real MongoDB database that is secretly a disposable branch. Review what it did as a diff. Merge the good, undo the bad, repeat runs from the same pinned document state.

pin ──▶ sandbox (TTL) ──▶ agent writes via any driver ──▶ diff
                                                           │
                              merge (data PR) ◀────────────┴──▶ undo / discard

Four surfaces, one engine — pick by integration point:

SurfaceStart itFor
CLIargon sandbox, argon pin, …humans, scripts, CI
MCP serverargon mcp (stdio, or --http for Streamable HTTP)Claude / Cursor / any MCP client
REST API + consoleargon console (or (cd api && go run .))language SDKs, browsers
Wire proxyargon proxystable per-branch connection strings

Sandboxes

Fork + checkout + TTL, one step:

argon sandbox create -p myapp --ttl 1h

By default, the URI uses the engine's MongoDB credentials. On an authenticated deployment, add --credential to create a user with read/write access only to this sandbox. Set "credential": true in the argon_sandbox_create MCP tool arguments or the REST sandbox create body for the same result. Save the URI from the create response. Argon returns the password once. See required MongoDB roles.

MCP and REST sandboxes wait for capture readiness and drain before returning URIs. Their server processes also sweep expired sandboxes every minute. With the bare CLI, add --watch --actor <run-label> to sandbox create (or keep argon watch --actor <run-label> running) and explicitly schedule argon sandbox sweep. An expired sandbox's credential stays valid until a sweep reaps it. Keeping the sandbox removes its TTL and leaves the credential valid until discard. Actor labels apply to an entire branch and are persisted; use a new sandbox for a different run label.

Collections inherited from the parent are ready for exact capture. A collection the agent creates is captured exactly as well (2.3.1 and newer): Argon reads the states of its first writes back from MongoDB, which keeps them for five minutes by default, so capture has to be running or a diff has to follow within that time. Two cases still need argon collections prepare (or changeStreamPreAndPostImages: {enabled: true} at creation): older versions, and a document that is updated and then changed again inside one transaction on a collection created moments earlier. A sandbox is a full physical copy, and its checkout builds the parent's recorded secondary indexes, so unique constraints hold as on the source; a TTL index is built without its expiry, and results list skipped indexes in index_notes (indexes in checkouts); the benchmarks measure how long one takes to be ready as sandbox_capture_ready_ms. Then:

argon diff -p myapp -b <sandbox>              # review supported document changes
argon merge preview/apply …                   # adopt it — a reviewable data PR
argon undo … --actor <agent>                  # filter the branch actor label, conflict-aware
argon undo --merge <plan-id>                  # revert exactly one applied merge
argon sandbox discard …                       # or let the managed server sweep it

Pins — reproducible evals

A pin is a named, immutable reference to a captured branch state. Its referenced history is protected from GC and resets while the pin exists:

argon pin create  -p myapp --name eval-v1 --note "golden dataset"
argon pin sandbox -p myapp --name eval-v1     # fresh sandbox per run

Pin once, fork per run: identical input state every time, no matter what happened to the branch since. Delete the pin to release its history. Pins are not independent backups, and matching input data does not make an agent's output deterministic.

MCP server

claude mcp add argon -- argon mcp

Fourteen tools: sandbox create/discard/keep/extend · branch list · connect · diff · merge preview/apply · undo · snapshot create · pin create/list/ sandbox. The server runs a capture ingester for every sandbox it hands out — no extra process.

The server starts without a database (releases after 2.3.1; up to 2.3.1 it exits at startup when MongoDB is unreachable). The handshake and tools/list need no connection, so a client or a directory can start it just to see what it offers. It reaches for MONGODB_URI in the background from the start (2.3.3; in 2.3.2 only when a tool was first called), so expired sandboxes are swept even if no tool is ever called. If MongoDB is not reachable when a tool is called, that call returns a tool error that says so, the server keeps running, and the next call tries again. Capture and the sweep of expired sandboxes begin as soon as the database answers.

A restarted server resumes capture for the branches an earlier server left checked out, as soon as it connects and without a tool call (2.4.0 and newer). Writes made while no server ran are caught up from the stored position. Up to 2.3.3 capture resumed only when a tool such as argon_diff next drained the branch; a collection the agent created and changed in between could by then be outside MongoDB's snapshot history, and that diff reported the history as incomplete.

Every tool declares how it behaves (MCP tool annotations): argon_branch_list, argon_diff and argon_pin_list are read-only; argon_merge_apply, argon_undo and argon_sandbox_discard are marked destructive, so clients that ask before destructive calls will ask before those.

By default the agent can apply a merge plan it prepared itself: a preview is a reviewable artifact, not an approval gate. To keep the decision with a person, withhold the tool and apply reviewed plans from the CLI:

claude mcp add argon -- argon mcp --disable-tools argon_merge_apply
argon merge apply <plan-id>          # after you have read the plan

--disable-tools takes a comma-separated list. argon mcp --read-only offers only the three read-only tools. A withheld tool is neither listed nor callable.

Online import, the argon source commands and CLI write-back are available by default. The experimental options --auto-resync and --enable-source-images are off by default and each requires ARGON_EXPERIMENTAL_SOURCE=1. For known issues and limits, see following a source.

When a project follows an external database (argon import database --online, releases after 2.5.0), an agent cannot change that database through the server at all. argon_merge_apply is refused for a plan whose target follows a source, and no tool takes a write-back option or a source connection string. A person reviews the plan and its approval_digest in CLI JSON preview or list output, then runs argon merge apply <plan-id> --write-back --approve <digest>. The REST endpoint POST /merge-plans/:id/apply also refuses a followed target. REST, MCP and the web console omit the approval digest.

The server speaks the handshake-based MCP revisions 2024-11-05, 2025-03-26 and 2025-06-18 and answers with the client's revision when it is one of them. The per-request protocol introduced in 2026-07-28 (server/discover, no initialize) is not supported and not currently planned; clients that support both fall back to the handshake.

Over HTTP

argon mcp --http <addr> serves the same tools over MCP's Streamable HTTP transport at http://<addr>/mcp, for a client on another machine or a hosted control plane in front of the engine:

export ARGON_MCP_TOKEN=$(openssl rand -hex 32)
argon mcp --http 127.0.0.1:8765 --disable-tools argon_merge_apply
claude mcp add --transport http argon http://127.0.0.1:8765/mcp \
  --header "Authorization: Bearer $ARGON_MCP_TOKEN"
  • Token. With ARGON_MCP_TOKEN set, a request without Authorization: Bearer <token> gets 401. A token must be at least 32 characters. A loopback address may run without one. Any other address, including :8765 and 0.0.0.0, needs one, and the server will not start without it. The token is read from the environment, not a flag, so it does not show in ps.
  • TLS. The server speaks plain HTTP. Off this machine, put it behind a TLS-terminating proxy; the bearer token is only as private as the connection.
  • Browsers. Requests with an Origin header are accepted only from loopback origins and those named with --allow-origin, which guards a local server against DNS rebinding. An allowed origin gets CORS headers. --allow-origin takes an http or https origin, or an extension or webview origin (chrome-extension://…, vscode-webview://…); give an internationalised host in its punycode form, as browsers send it.
  • Behaviour. The tools, restrictions (--read-only, --disable-tools) and capture supervision are the same as over stdio. Ingesters belong to the server process, not to the request that started them. Each POST is answered with one application/json body. JSON-RPC batches are accepted for 2025-03-26 clients. The server keeps no sessions (no Mcp-Session-Id) and offers no server-initiated stream, so GET gets 405. On SIGINT or SIGTERM new requests get 503, calls in flight have 10 seconds before their context is canceled and their connection closed, and capture stops after the last one returns; a second signal exits at once. Idle connections close after 10 seconds, and a request body must arrive within a minute (408 otherwise).

REST control plane

argon console serves the REST API plus a web UI locally (binds 127.0.0.1, opens your browser); (cd api && go run .) serves the API alone (default 127.0.0.1:8080, PORT/HOST to change). Control plane only — data flows through the MongoDB connection strings it returns.

POST   /api/v1/projects                                {name}
GET    /api/v1/projects
GET    /api/v1/projects/:p/branches
POST   /api/v1/projects/:p/branches                    {name, from}
GET    /api/v1/projects/:p/branches/:b
DELETE /api/v1/projects/:p/branches/:b
POST   /api/v1/projects/:p/branches/:b/checkout
POST   /api/v1/projects/:p/branches/:b/release
POST   /api/v1/projects/:p/sandboxes                   {name?, from?, ttl_minutes?, actor?, credential?}
GET    /api/v1/projects/:p/sandboxes
DELETE /api/v1/projects/:p/sandboxes/:b
POST   /api/v1/projects/:p/sandboxes/:b/extend         {ttl_minutes}
POST   /api/v1/projects/:p/sandboxes/:b/keep
GET    /api/v1/projects/:p/branches/:b/diff
POST   /api/v1/projects/:p/branches/:b/merge-preview
GET    /api/v1/merge-plans?project=:p
GET    /api/v1/merge-plans/:id
POST   /api/v1/merge-plans/:id/apply                   {strategy?}
POST   /api/v1/projects/:p/branches/:b/undo            {from_lsn, to_lsn?, actor?, dry_run?} or {merge_plan_id, dry_run?}
GET    /api/v1/projects/:p/branches/:b/entries         ?from_lsn&to_lsn&actor&collection&order&limit
GET    /api/v1/projects/:p/branches/:b/time-travel
GET    /api/v1/projects/:p/branches/:b/time-travel/query  ?lsn&collection&skip&limit
POST   /api/v1/projects/:p/branches/:b/snapshots
GET    /api/v1/projects/:p/pins
POST   /api/v1/projects/:p/pins                        {name, branch?, lsn?, note?}
DELETE /api/v1/projects/:p/pins/:name
POST   /api/v1/projects/:p/pins/:name/branches         {name}
POST   /api/v1/projects/:p/pins/:name/sandboxes        {name?, ttl_minutes?, actor?}
GET    /api/v1/meta
GET    /api/v1/status/ingesters

Sandbox-creating endpoints start a supervised ingester. Errors return {"error": "..."} with a meaningful status. Listing sandboxes omits connection_string for a sandbox created with credential: true. For other live sandboxes, the list includes the usual URI. A sandbox whose capture cannot run, for example after a collection drop, is listed with capture_error and can still be discarded. Optional switches, all off by default: ARGON_API_TOKEN (Bearer auth on every /api endpoint except /meta), ARGON_READ_ONLY=1, ARGON_CORS_ORIGINS, ARGON_ALLOWED_HOSTS (extra hostnames a token-less local server answers to; by default only localhost and loopback addresses), and ARGON_DEMO_MODE=1 — a restricted anonymous hosted playground with no native URIs/checkout: one ephemeral seeded project per visitor, requests scoped to it, writes rate-limited, everything reclaimed after ARGON_DEMO_TTL_MINUTES (default 60).

Python — argon-agents

Install SDK v0.3.0 from PyPI, with [langgraph] for the checkpointer:

python3 -m pip install 'argon-agents[langgraph]==0.3.0'

Start argon console --no-browser in another terminal. It listens on port 1818; use port 8080 instead if you started the standalone API with go run ..

from argon_agents import ArgonClient, ArgonCheckpointSaver

argon = ArgonClient("http://127.0.0.1:1818")
argon.get_or_create_project("myapp")

# LangGraph: the official MongoDB checkpointer on a sandboxed branch
saver = ArgonCheckpointSaver.from_sandbox(argon, "myapp", ttl_minutes=60)
# Compile and run your graph with checkpointer=saver.
# Optional: forked_saver = saver.fork(argon) branches its checkpoint history.
plan = argon.merge_preview("myapp", saver.sandbox.branch)
print(plan)           # inspect document changes and conflicts
# After reviewing this exact plan:
# argon.merge_apply(plan["id"])
# Or reject the run: saver.discard()

# Mem0: sandboxed agent memory
from argon_agents import sandboxed_mem0_config
config, sandbox = sandboxed_mem0_config(argon, "myapp")

# Reproducible evals
argon.create_pin("myapp", "eval-v1")
run = argon.sandbox_from_pin("myapp", "eval-v1")

LangGraph's checkpoint ids rewind steps within a thread; Argon adds fork/merge/undo/audit across the whole store. The saver.merge(), sandbox.merge() and argon.merge() convenience methods preview and apply immediately, without an approval pause. Use separate preview and apply calls for reviewed changes. The running API manages capture and TTL sweeps; materializing a sandbox copies data into a physical MongoDB database. Mem0 semantic vector retrieval also requires Atlas Search or a compatible MongoDB Search deployment and separately provisioned search indexes.

Wire proxy

Checked-out branches get machine-named physical databases. argon proxy serves stable, human-readable URIs instead:

mongodb://127.0.0.1:27018/<project>~<branch>?directConnection=true

It listens on loopback unless you pass --listen <addr> --allow-remote; the proxy does not authenticate clients, so only do that in front of a MongoDB that requires authentication.

The proxy rewrites each command's $db to the branch's physical database; mongod still evaluates every query. Constraints: directConnection=true required, compression negotiated away in both legacy and OP_MSG handshakes, authSource=admin with auth, unresolvable aliases return a clean command error. A client that still sends compressed frames has its connection closed before any command is forwarded. Capture stays asynchronous — run argon watch (or use API/MCP sandboxes) behind it.

Complete business-data example

examples/pinned_agents.py runs two deterministic agent proposals against one pin, writes through PyMongo, checks isolation, reviews both diffs, merges the approved discount and discards the rejected proposal. examples/openai_agents_sandbox.py runs an OpenAI Agents SDK agent against a sandbox the same way. Start argon console --no-browser, install pymongo, then run:

python3 examples/pinned_agents.py --api http://127.0.0.1:1818

Set ARGON_API_TOKEN in the example's environment when the local server uses a bearer token. This requires your own engine. For code that should only access its sandbox, use a URI issued by sandbox create --credential or provision a restricted MongoDB user yourself.

examples/boxd-sandbox does that for agent-written code running in a separate code sandbox: a boxd machine gets a MongoDB user that can only read and write its Argon sandbox, then the host prints the diff and discards the sandbox, or merges it with --apply.

A newly materialized collection is already prepared by checkout, and from 2.3.1 capture reads back the exact states of writes that reach a new collection before its images are enabled. Preparing a collection first, with argon collections prepare or the MongoDB driver's changeStreamPreAndPostImages: {enabled:true} option, avoids those reads and is required on older versions.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.