Skip to content

Add autter context, memory skills install and mcp connect - #80

Merged
sagnik11 merged 1 commit into
mainfrom
autter/memory-context-commands
Nov 3, 2026
Merged

sagnik11 merged 1 commit into
mainfrom
autter/memory-context-commands

Conversation

@sagnik11

@sagnik11 sagnik11 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What this adds

Three commands so every coding agent gets Autter's codebase memory, with or without MCP.

autter context "<task>"

One call for what Autter knows that matters for a task: memory facts (rmf_… ids to cite), wiki pages and code structure, ranked and cut to a token budget. It is the CLI form of the get_context MCP tool.

  • POST /api/cli/orgs/<slug>/context with the CLI token. It uses the same org and token resolution, repository-remote resolution, local-mode and excluded-repository refusal, and error mapping as autter memory.
  • --path (repeatable; defaults to the files changed in the checkout, like autter memory for), --symbol, --budget 300..16000, --include memory,wiki,code, --since <cursor>, --repo, --org, --json.
  • Prints Markdown: # Autter context for <repo>, one line per item (- **<Store> · <title>** (<path>) \rmf_…`: ), a more:line with the read-more tool and args (plus the CLI equivalent forget_repo_memorypages), notes on omitted/unchanged items, and a finalcursor:` line.

autter memory skills install | preview

  • GET /api/cli/orgs/<slug>/repo-memory/skill?repository=<remote>. Each returned file is written relative to the checkout root, with directories created as needed.
  • Autter's own files (autter_generated: true in their frontmatter) are replaced freely. Anyone else's file is kept unless --force is given. The command refuses paths outside the checkout, .git/, symlinked escapes, and content without the marker.
  • preview (or install --print) prints the files and writes nothing. install lists what it wrote and tells you to commit the files so teammates' agents get them.

autter mcp connect | disconnect

Registers <api base>/mcp (default https://api.autter.dev/mcp) as autter in each installed agent's user-level MCP config. Only the URL is written: the server signs people in with OAuth on first use.

Agent How
Claude Code claude mcp add --transport http --scope user autter <url> when claude is on PATH; else mcpServers.autter = {"type":"http","url"} in ~/.claude.json ($CLAUDE_CONFIG_DIR/.claude.json when set)
Codex codex mcp add autter --url <url> when codex is on PATH; else [mcp_servers.autter] url in ~/.codex/config.toml. Tells you to run codex mcp login autter
Cursor mcpServers.autter = {"url"} in ~/.cursor/mcp.json
VS Code servers.autter = {"type":"http","url"} in the user mcp.json, plus each profile that already has one
Gemini CLI mcpServers.autter = {"httpUrl"} in ~/.gemini/settings.json
OpenCode mcp.autter = {"type":"remote","url","enabled":true} in ~/.config/opencode/opencode.json (or an existing opencode.jsonc)
  • Only installed agents are touched: the binary is on PATH or the config directory exists, the same checks the hook installers use.
  • --agent (repeatable) picks agents. --dry-run shows the commands and diffs without running or writing anything.
  • Every file is backed up to <file>.autter-backup-<time> before it is written.
  • JSON is edited through the jsonc CST and TOML through toml_edit, so comments, key order and indentation survive.
  • Re-running replaces the autter entry instead of adding a second one. If an agent's own CLI fails, the command falls back to editing that agent's file.
  • disconnect removes only the autter entry, using claude mcp remove / codex mcp remove where they exist.

Also

  • The shipped repo-memory skill now says: call autter context "<task>" first (or get_context when the MCP server is connected), cite fact ids (rmf_…) when a fact changes what you do, and run autter mcp connect to connect agents.
  • Help text for every new command, a README section, and changelog/agent-context-and-mcp-connect.md.
  • New dependency toml_edit 0.23, which was already in Cargo.lock transitively. The serde_json feature is now enabled on jsonc-parser. No new crates are downloaded.

Backend dependency

This PR depends on Autter-dev/autter-monorepo#636 (the /context route) and on the Phase 4 monorepo PR (the /repo-memory/skill route) being deployed. Until then, both commands print a clear message on the route's 404 instead of a generic error:

  • "This Autter deployment does not serve autter context yet (POST /context). Use autter memory for and autter memory search until it is updated."
  • "This Autter deployment does not serve repository memory skills yet (GET /repo-memory/skill). …"

A 404 that carries a message, such as an unknown repository, still shows that message, the same way autter memory handles it.

Tests

  • Unit tests:
    • argument parsing and request building for context;
    • Markdown rendering of a context response, plus empty and unindexed responses;
    • the skill overwrite rules: new, own, someone else's with and without --force, missing marker, unsafe paths, symlink escape;
    • config editing for every agent on temp dirs: detection, idempotency, backups, comment and key preservation, disconnect, dry run, the agent-CLI path with a fake runner, and fallback when the CLI fails.
  • Integration tests (tests/integration/context_command.rs) check that nothing is sent in local mode or for excluded repositories, that the connected path needs a login, and that bad usage is rejected.

Local results:

  • cargo build: passes.
  • Full cargo test in daemon mode, 8 threads: all 2050 lib tests passed, including the 28 new ones, and all 6 new integration tests passed.
    • 32 existing integration tests timed out waiting on the shared test daemon near the end of the run: utf8_filenames, worktrees, windsurf, virtual_attribution_unit, and one codex test.
    • Re-running just those modules gave 154 passed, 0 failed, so these were load timeouts, not regressions.
  • cargo clippy --all-targets -D warnings on Rust 1.93.0: clean.
    • On stable 1.99, clippy fails with 12 new-lint errors, all in files this PR doesn't touch (daemon.rs, blame.rs, config.rs, …).

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Three commands so every coding agent gets Autter's codebase memory:

- `autter context "<task>"` posts the task (and the changed files, or
  --path/--symbol) to POST /api/cli/orgs/<slug>/context and prints the
  memory facts (rmf_ ids), wiki pages and code structure that matter as
  Markdown, with read-more pointers and a cursor for --since. It is the
  CLI form of the get_context MCP tool and reuses autter memory's org,
  token, remote, sharing-policy and error handling.
- `autter memory skills install|preview` fetches
  GET /api/cli/orgs/<slug>/repo-memory/skill and writes the files into
  the checkout. It replaces only files marked autter_generated: true
  unless --force is given, and refuses paths outside the checkout.
- `autter mcp connect|disconnect` registers <api base>/mcp as `autter`
  in Claude Code (claude mcp add, else ~/.claude.json), Codex (codex mcp
  add, else config.toml), Cursor, VS Code, Gemini CLI and OpenCode. Only
  the URL is written (OAuth). Every file is backed up first, and JSON and
  TOML are edited in place so comments and key order are kept.
  Supports --agent and --dry-run.

The repo-memory skill now tells agents to call autter context first,
cite fact ids, and use autter mcp connect. A 404 from either new route
prints that the backend doesn't serve it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sagnik11
sagnik11 merged commit f3c54bd into main Nov 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant