memcode

The coding agent that remembers your repo.

memcode.ai Latest release License: MIT

## Memcode Most coding agents start every session from zero. memcode keeps a persistent model of your repo in `.memcode`: the subsystems, what you worked on last week, which approaches failed and why, and the preferences you have corrected it on. The longer you use it, the less you have to explain. One Go binary, two ways to run it. **Code** is the interactive agent in your terminal. **Agents** is the same binary as a self-hosted gateway, answering on the chat surfaces you already use — and running agents you have given a standing objective and permission to work on it unattended. Both run against whatever models you have: your own API keys, a local endpoint like Ollama, or a hosted memcode account. ## Screenshots

memcode terminal UI: the matrix splash and the model picker, from Automatic to any specific model

memcode editing code while tracking a live task plan in the terminal

## Code Run `memcode` in a repo and you get a full terminal coding agent. **It remembers.** Ask it to pick up where you left off last week and it can. It knows your repo's layout, what has been tried before, and the preferences you have corrected it on. Memory lives in `.memcode`, so it travels with the repo and your whole team benefits. **One model, and it stays put.** You pick the model your session runs on and nothing swaps it out mid-task. Change it any time with `/model`. Sub-agents and scouts can run on a cheaper model of your choosing, so the expensive one is spent where you decided it should be. **Reads the room.** When you are correcting it, it slows down, asks before acting, and stops cutting corners. When things are calm it stays out of your way. **Plan first when it matters.** `/plan` researches your codebase and drafts an approach for you to approve, and execution then sticks to what you approved. Send the draft to a second model for review first when the stakes are worth it. **Work in parallel.** Hand off side quests to sub-agents and background jobs, keep working, and check on them with `/jobs` and `/tail`. **A terminal UI that keeps up.** Multiline editing, slash-command autocomplete, streaming output, interrupt and redirect mid-turn, themes, and a live context meter. **Everything you'd expect.** MCP servers, Agent Skills, hooks, code navigation and diagnostics, vision and PDF input, instructions from `MEMCODE.md`, `AGENTS.md`, or `CLAUDE.md`, and automatic updates. ## Agents Message your agent from wherever you already are. It runs your task and replies in the same conversation. Fix a bug from Telegram on the train, ask for a status update over SMS, forward an email and get it handled. **Twelve channels.** Telegram, Discord, Slack, GitHub, WhatsApp, Email, Signal, Matrix, Mattermost, Microsoft Teams, Google Chat, and SMS. `memcode gateway setup` walks you through connecting each one. **Voice.** Send a voice note instead of typing. Replies can come back as voice too, per channel and off by default. **You decide who gets in.** Unknown senders have to pair first: they get a code, you approve it. Allow-lists per channel on top of that. **Coming from Hermes or OpenClaw?** `memcode hermes migrate` or `memcode claw migrate` brings over your channels, API keys, skills, and long-term memory in one command. ## Agents that run on their own An agent can be given a durable **objective** and permission to run **autonomously** — then it works on that objective on a schedule, with nobody watching. It is the same agent either way; autonomy is a setting, not a separate kind. You set it up by talking to `memcode admin`. Objective and autonomy are separate grants on purpose: an agent may hold a goal you only ever work on together, and an agent may run unattended on a schedule with no standing objective at all. The second case is why this matters — an unattended run is policy-gated (authority approved in advance, by hash), journals every consequential action, confines file access to explicit grants, and can suspend durably to ask you something rather than guessing. Plain scheduled agents never had any of that. It can also delegate real work to a scoped worker with browser, MCP, shell and filesystem access, and drive your own signed-in Chrome rather than a logged-out profile. See `docs/autonomous-agents.md`. ## Work that keeps itself done Some things you ask for are jobs. Others are standing responsibilities: keep dependencies current, keep security advisories triaged, keep the docs matching the code. Memcode notices the difference, does the work now, and offers to keep doing it. Say yes and it validates the automation against your repo first, then shows you what you are agreeing to: what it will do, how it knows it worked, what it may change, and what it just proved. One signoff, no configuration form. If the work was already done in that conversation, that counts as the proof rather than doing it twice. **It adapts.** Every run works out the current state instead of replaying the steps that worked the day it was created. Files move, packages get renamed, build commands change; the goal is what's durable. **It works somewhere else.** Each run gets its own checkout, never your working tree, and opens a pull request for you to review. **It stops rather than guessing.** If carrying on would mean inventing intent it does not have, taking authority you did not give it, or picking between two migration paths on your behalf, it suspends itself and tells you what it needs. It does not fail the same way every week. **One responsibility can span repos.** If the work genuinely lives in two projects, the automation covers both as one job, and it never grows into a third without asking. `memcode task list`, `show`, `run`, `history`, `inbox`, `paused`, `resume`. Project tasks live in `.memcode/tasks/*.yaml` and are meant to be reviewed and committed. ## Install ```bash curl -fsSL https://memcode.ai/install.sh | sh ``` Or with Go: ```bash go install github.com/memcode-ai/memcode@latest ``` Or build from source: ```bash git clone https://github.com/memcode-ai/memcode cd memcode && go build -o memcode . ``` Then run `memcode` in a repo. ## Use any model ```bash MEMCODE_ENDPOINT_URL=http://localhost:11434/v1 memcode # Ollama, local MEMCODE_ENDPOINT_URL=https://api.openai.com/v1 memcode # your OpenAI key (OPENAI_API_KEY) MEMCODE_ENDPOINT_URL=https://api.anthropic.com memcode # your Anthropic key (ANTHROPIC_API_KEY) ``` Your provider API keys are picked up automatically from the standard environment variables. If your server has a small context window or output limit, tell memcode and every request is sized to fit: ```bash MEMCODE_ENDPOINT_CONTEXT_WINDOW=32768 MEMCODE_ENDPOINT_MAX_OUTPUT=8192 memcode ``` For a saved endpoint, set `context_window` and `max_output_tokens` on its entry in `config.json`, or per model under `model_limits`. With a memcode account you get one balance across every vendor, a key vault for BYOK, and hosted web search: ```bash memcode login ``` ## Documentation The user manual lives at [memcode.ai/docs](https://memcode.ai/docs): - [Code](https://memcode.ai/docs): commands, model routing, memory, plan mode, MCP, skills, custom instructions, configuration. - [Agents](https://memcode.ai/docs/agents): per-channel setup guides for every gateway channel, pairing, and voice. Internals and reference docs live in this repo: - [ROUTING.md](ROUTING.md): how the session model is chosen, and what happens when a provider fails. - [HOOKS.md](HOOKS.md): the hook surface. - [COMPACTION.md](COMPACTION.md): context compaction. - [docs/gateway/README.md](docs/gateway/README.md): gateway operations and channel secrets. - [docs/autonomous-tasks.md](docs/autonomous-tasks.md): the task file format, authority levels, and how runs are recorded. - [protocol/PROTOCOL.md](protocol/PROTOCOL.md): the wire protocol every backend speaks. ## Architecture The CLI is the agent: all model selection, escalation, and recovery run client-side; every backend is a plain serving surface speaking one OpenAI-compatible wire. Point memcode at your own API keys, a local endpoint like Ollama, or a hosted [memcode.ai](https://memcode.ai) account. ## License MIT. See [LICENSE](LICENSE).