How to build AI agents with persistent memory
An AI agent with persistent memory carries what it learned into the next session instead of starting empty. In BRIX, a SuperAgent keeps a curated memory, its own skills and a searchable knowledge base in a folder on your disk, and runs on the engine you pick per agent: Claude Code or ChatGPT on your subscription, or any OpenRouter model.
Why does my AI agent forget everything between sessions?
The model does not learn from your chats. Every session starts from whatever is in its prompt, and a fresh terminal has nothing in it about you, your product or the correction you made yesterday. So you explain the same things again.
Persistent memory fixes that without touching the model: what evolves is the context the agent loads (its memory) and the routines it runs (its skills). A BRIX SuperAgent is built around curating those two things, plus a knowledge base it can search.
| Plain agent session | BRIX SuperAgent | |
|---|---|---|
| Start of a session | Empty | Loads its personality, rules, what it knows about you, its memory and its skill index |
| Your corrections | Lost when the session ends | Saved to memory, used from the next session on |
| Repeated tasks | Re-explained each time | Written down as a skill it reads when needed |
| Your documents | Pasted into the chat | Imported once, searched and cited |
| Where it lives | The provider's chat history | A folder on your disk |
What does a SuperAgent remember, and how?
Each SuperAgent has its own entity: a name, a purpose and a personality preset (Direct, Teacher or Executive), plus rules for what to save and what never to save. Its memory comes in three layers:
- Memory (
MEMORY.md): facts and lessons about the work, one entry per line. It has a size cap on purpose, so the agent has to curate instead of piling up. - User (
USER.md): who you are. It is global, shared by all your agents, so you only introduce yourself once. - Past conversations: archived in a local database with full-text search, so the agent can look up what was said in earlier sessions.
The agent writes to memory when you teach it something. A background reviewer can also propose memories and skills after each turn, and with approve before saving turned on (the default) nothing lands until you accept it in the Pending tab. The Timeline tab shows everything it learned, by date.
The prompt is frozen when a conversation starts. A memory saved today takes effect from the next session, which keeps a single conversation consistent.
What are skills and the knowledge base?
Skills are procedures for tasks that repeat: how you want a release note written, the checklist for reviewing an article, the steps to set up a new client folder. Each one is a SKILL.md in the agent's folder. The agent sees the list in its prompt and reads the full skill only when the task calls for it. It can draft new skills itself; with the approval gate on, they wait in Pending.
The knowledge base holds your reference material. Import PDF, DOCX, Markdown or TXT files and the agent searches them by excerpt, citing the document, section and page it used.
medmaestri superagent create "Docs Reviewer" "reviews articles against our style guide" --preset direto
medmaestri superagent kb "Docs Reviewer" ~/guides/style-guide.pdf ~/guides/glossary.md
medmaestri superagent memory "Docs Reviewer"
medmaestri superagent pending "Docs Reviewer" approve allThere is also an Evals tab: reference prompts with snippets the answer must or must not contain. Run them after changing rules or skills to see whether anything got worse.
Which models can a SuperAgent run on?
The engine is chosen per agent, so one can run on your Claude plan and another on DeepSeek.
| Engine | How it connects | Notes |
|---|---|---|
| Claude Code (subscription) | Your installed claude CLI and its login | The agent runs inside Claude Code with its native Read, Edit and Bash tools; memory, skills and connected terminals come in over MCP. Turns count against your Claude plan. |
| ChatGPT (subscription) | Sign in with your ChatGPT account, no API key | Uses your ChatGPT plan. |
| Antigravity, OpenCode | The CLIs already on your machine | Same idea: your existing login. |
| OpenRouter | Your OpenRouter key | Opens the catalog: DeepSeek, Kimi, GLM, Claude, GPT, Gemini and more. |
| OpenAI, Anthropic, Groq | Your own API key | Direct to the provider. |
BRIX does not resell tokens. Subscriptions and keys stay yours, billed by the provider. Each agent also has an access level: read only, ask before editing or running, or full access.
Where is the agent's memory stored?
On your disk, in your Documents folder. Each agent is a plain folder you can open, back up, put in git or copy to another machine:
Documents/medmaestri/agents/
USER.md # who you are, shared by every agent
docs-reviewer/
agent.json # name, purpose, preset, engine, model
SOUL.md # personality and what it never does
AGENTS.md # what to save and what never to save
MEMORY.md # what it learned
skills/<name>/SKILL.md
knowledge/ # the documents you imported
brix.db # conversations and knowledge index (SQLite)- Memory, rules and skills are Markdown. Edit them by hand in any editor if you want.
- Before anything is saved, a scanner blocks credentials, prompt-injection text and invisible Unicode from entering memory.
- The model provider still sees the prompts you send it, as with any AI tool. What BRIX keeps local is the memory, the knowledge base and the history.
Can a SuperAgent work with my other agents?
Yes. A SuperAgent opens as a pane in the same grid or canvas as your Claude Code and Codex terminals. Connect it with an edge and the others can ask it by name, the same way terminals talk to each other. A typical setup: a Claude Code lead that asks a "Product Expert" SuperAgent, which has the specs in its knowledge base, before touching a feature. See how to orchestrate a team of AI agents.
medmaestri superagent open "Product Expert"
medmaestri ask "Product Expert" "What did we promise about refunds?"The same agent open in two workspaces has two conversations and one memory, so what it learns on one project is there on the next.
How does memory carry over to marketing?
On PRO, the marketing studios (copy, ads, carousels, video) can be served by one of your SuperAgents, with its memory, skills and knowledge base. Each product also builds its own copy memory: what worked, and what not to repeat. The agent that learned your tone while writing the docs is the one writing the sales page. More on that in from code to sales.
SuperAgents themselves are part of STARTER, the full agent environment. Both plans start with 7 days free, no card: see plans and download for macOS or Windows.
Frequently asked questions
Does the AI model actually learn from me?
No. The model stays the same; what grows is the memory, skills and knowledge base the agent loads at the start of each session.
Can I use my Claude subscription instead of an API key?
Yes. Pick the Claude Code engine and the SuperAgent runs through the claude CLI already logged in on your machine, so turns count against your Claude plan.
Can I use my ChatGPT Plus or Pro plan?
Yes. The ChatGPT engine signs in with your ChatGPT account, with no API key.
Can I see and edit what the agent remembers?
Yes. Memory, user profile, rules and skills are Markdown files in the agent's folder, also shown in tabs inside the app, and you can edit or delete any entry.
Will the agent save something I did not want it to?
With approve before saving on, which is the default, proposed memories and skills wait in Pending until you accept or reject them.
Is my data sent to a BRIX server?
No. The agent folders live on your disk and login only validates access. Prompts go to the model provider you chose, as they would in any AI tool.
Keep reading
- How to orchestrate a team of Claude Code agentsOrchestrate Claude Code and Codex agents as a team: a lead agent, canvas edges as permissions, ready-made squads, a task list and a CLI to spawn, ask and check.
- Claude Code for marketing: from code to sales in one appUse Claude Code for marketing: BRIX PRO agents read your product base in Markdown and write the copy, static ads, carousels, content and video edits.
- How does BRIX work?How BRIX works, step by step: Workspaces, Grid and Canvas, agent terminals linked by edges, the lead agent, squads, Maestro, the Scene and marketing studios.