# Memory for AI Agents --- --- > How a team gives its AI agents memory: capturing every session, storing it for the whole organization, and recalling it in any agent with Glen. --- --- # How a team gives its AI agents memory URL: https://memoryforaiagents.com/ Last updated: 2026-11-07 Published by Glen (https://tryglen.com), shared memory for coding agents. > AI agents forget everything when a session closes, and the memory features built into each agent stay on one machine. To give a team's agents memory, you need three parts: capture that records sessions without the model having to choose, a store that belongs to the organization, and recall that puts the relevant part back in context. Glen does all three for Claude Code, Codex, Cursor, Pi and Grok Build, in one shared store. ## What agents already remember on their own Every major coding agent has some memory now, and for one engineer it can go a long way. The catch is scope. Each tool keeps its own, in its own format, on the machine where it ran. *Built-in memory in coding agents, November 2026* | Agent | Built-in memory | Scope | | --- | --- | --- | | Claude Code | CLAUDE.md files, plus auto memory (on by default) | Auto memory stays on one machine | | Codex | AGENTS.md, plus memories (off by default, `memories = true`) | Memories stay on one machine | | Cursor | Project, User and Team Rules, AGENTS.md. Memories was removed in 2.1.x | Rules travel with the repo or plan | | Grok Build | AGENTS.md, CLAUDE.md, `.grok/rules/`, experimental cross-session memory (off by default) | One machine | Instruction files are shared through git, which makes them the right home for rules. They only hold what somebody wrote, though. The working-out behind most changes lives in session transcripts nobody turns into docs. ## The three parts of agent memory 1. **Capture.** Record what each session did. Hooks beat save tools here, because a model that has to decide to save tends to skip it. 2. **Store.** Keep it somewhere every teammate's agent can reach, with permissions that follow the people, not the laptop. 3. **Recall.** Put the right memories in front of the model at the right moment, ideally before it reads the prompt. [How agent memory works](https://memoryforaiagents.com/how-it-works) walks through Glen's version of each step, hook by hook. ## One memory for every agent on the team [Glen](https://tryglen.com) puts sessions from every supported agent into a single store for your organization. If one engineer's Codex session learns that the search index must be rebuilt after a schema change, a colleague's Claude Code or Cursor session can recall it the next time the work goes near the index. Recall is filtered per memory, so nobody's agent surfaces what that person couldn't already open. More on this in [shared memory for agent teams](https://memoryforaiagents.com/shared-memory). > **Give your agents one memory they share** One command adds Glen to the agents on your machine. Free for up to 3 people and 15,000 memories. Install: `npx @tryglen/cli@latest install`. Start free at https://tryglen.com ## Beyond coding agents: the company brain The same organization memory also takes in public Slack channels (never DMs or private channels), GitHub, tickets, docs and call transcripts from Fireflies, Fathom and Granola. People can ask it questions in Slack, in the Glen web app, or from any MCP client. The [Claude](https://tryglen.com/docs/claude) and [ChatGPT](https://tryglen.com/docs/chatgpt) connectors search it too, though they don't record chats. ## When a team should not use Glen for this - You are building memory into your own consumer product. Glen is not an embeddable memory API; Mem0 or Supermemory fit that job (see [AI agent memory tools compared](https://aiagentmemory.app/compared)). - Policy requires self-hosting. Glen is a hosted service with no self-hosted build. - Teammates must not see each other's sessions. Recorded sessions are searchable across the organization. ## Frequently asked questions ### How do you give an AI agent memory? Store what it learns outside the model and load the relevant part back into its context later. Instruction files do this for rules; a tool such as Glen does it for everything sessions work out, using the agent's hooks. ### Do AI agents have memory? Within a session, yes, through the context window. Across sessions only what the agent's built-in memory or an external memory saves, and built-in memory usually stays on one machine. ### Can different AI agents share the same memory? With Glen, yes. Claude Code, Codex, Cursor, Pi and Grok Build all record into and recall from one organization memory. ### Is Glen a vector database for agents? No. You don't query a database or manage embeddings. Glen records sessions through plugins and returns memories or a cited answer when an agent or person asks. --- # Capture, store, recall: how memory for AI agents works URL: https://memoryforaiagents.com/how-it-works Last updated: 2026-11-07 Published by Glen (https://tryglen.com), shared memory for coding agents. > Agent memory works in three stages. Capture records each turn, ideally through the agent's hooks so nothing depends on the model choosing to save. Store keeps those records for the organization alongside other sources, and recall returns the relevant memories, either injected before the model reads a prompt or on demand through a search. ## 1. Capture: hooks, not save tools Most memory tools expose a save call and hope the model uses it. Glen's plugins attach to lifecycle hooks the agent fires anyway, and each hook runs one `glen` CLI command. The model never has to think about memory for capture to happen. *What Glen hooks into, per agent* | Agent | Hooks Glen uses | What gets recorded | | --- | --- | --- | | Claude Code | SessionStart, UserPromptSubmit, Stop, PostToolUse on Bash | Prompt, reply, tool calls and results, thinking blocks, repo, branch, commits | | Codex | The same four, in `~/.codex/hooks.json` | Prompt and final reply | | Cursor | sessionStart, beforeSubmitPrompt, afterAgentResponse, afterShellExecution | Each prompt and response | | Grok Build | Plugin installed by `glen install --agent grok` | Sessions, with recall through `glen search` | | Pi | Package installed by `pi install npm:@tryglen/pi` | Sessions, with recall each turn | The PostToolUse hook on Bash links every `git commit` to the session that made it. That link is what later lets `glen code-search` go from a line of code back to the conversation behind it. ## 2. Store: one organization memory Captured turns go to a hosted memory owned by your organization. Integrations add public Slack channels, GitHub (which can include private repos), tickets, docs and meeting transcripts. You don't manage an index or a schema; you install plugins and connect sources. Two things happen to the store over time. Decisions get reversed, and Glen aims to follow the one that stuck. And some memories turn out wrong: `glen forget` stops one being recalled, and `glen restore` reverses that. ## 3. Recall: injected or searched - **Injected.** In Claude Code and Codex, UserPromptSubmit sends the prompt with repo and branch, and matching memories join the context before the model reads it. Pi recalls at the start of every turn. - **Searched.** Cursor and Grok Build can't add context from a hook, so a rule tells the agent to run `glen search`. Any agent or person can do the same. - **Traced.** `glen code-search ""` follows git blame to the agent sessions that wrote those lines. > **Read the sources:** `glen search` returns a written answer with a citation for every claim, in about 10 seconds. A language model writes that answer, so it can be stale or wrong. Check the cited sources before acting on it. > **See capture and recall on your own sessions** Install the plugin, import the last 30 days with glen import, and ask a question. Free to 15,000 memories. Install: `npx @tryglen/cli@latest install`. Start free at https://tryglen.com ## The same pipeline over MCP Agents without a Glen plugin can reach the memory through the remote MCP server at `https://mcp.tryglen.com/mcp` (Streamable HTTP, OAuth 2.1 or a personal API key). It exposes 22 tools, among them `glen_search`, `glen_code_search`, `glen_forget` and `glen_import`, with a 60 second request limit and a 4.5 MB request size limit. Setup per client is covered on [memorymcp.dev](https://memorymcp.dev). Does the pipeline pay for its round trips? Glen's [replay of 100 merged PRs](https://tryglen.com/blog/replaying-100-prs) found 29% fewer tokens and 21% faster runs with memory, quality at parity or better. Recall in that test was injected before the first turn. ## Frequently asked questions ### How does an AI agent retrieve memories? Either the memory is injected into context before the model reads the prompt, or the agent calls a search tool when it decides it needs past context. Glen does injection where the agent's hooks allow it and search everywhere. ### Does agent memory slow every prompt down? Each hook is a network round trip. In Glen's PR replay, runs with memory were still 21% faster overall with that time counted. ### What does Glen record from Codex? The prompt and the final reply for each turn, plus repo and branch, through hooks that glen install registers in ~/.codex/hooks.json. ### Can I delete a wrong memory? Run glen forget on it and it stops being recalled. It is reversible with glen restore, so a mistaken forget can be undone. --- # Shared memory for multi-agent teams URL: https://memoryforaiagents.com/shared-memory Last updated: 2026-11-07 Published by Glen (https://tryglen.com), shared memory for coding agents. > Shared memory for AI agents is one store that every agent on a team writes to and recalls from, regardless of which person or tool ran the session. It needs access control at recall, so a shared store never shows someone what they couldn't already see. Glen gives Claude Code, Codex, Cursor, Pi and Grok Build one organization memory, filtered per memory for each user. ## Individual memory and shared memory *Comparing individual and shared agent memory* | | Individual memory | Shared organization memory | | --- | --- | --- | | Examples | Claude Code auto memory, Codex memories, claude-mem | Glen | | Who writes it | One person's agent | Every teammate's agents, plus connected tools | | Who recalls it | That same agent on that machine | Any teammate's agent, filtered by permission | | Survives a new laptop | No | Yes | | Crosses agent brands | No | Yes | | Privacy model | Private by default | Searchable across the org, with an incognito mode | Individual memory is a good fit for personal preferences: your editor habits, the way you like commit messages. It breaks down as soon as two people work in the same code, because what one person's agent learned helps nobody else. ## Multi-agent teams Few teams standardize on one agent. One engineer lives in Claude Code, another in Codex, a third tries Cursor or Grok Build for a week. Without a shared store each agent is an island, and switching tools means starting from zero. - A bug traced in a [Codex session](https://codexmemory.com) on Monday is recalled when someone opens the same file in Claude Code on Thursday. - In [Cursor](https://cursormemory.com), where hooks can't inject context, the agent runs `glen search` and gets the same memory with citations. - Mid-task, `glen takeover ` moves a live session to a different agent with its full history, so one agent can pick up where another stopped. ## Access control in a shared store A shared memory is only safe if it respects the permissions of the systems it reads from. Glen runs access checks per memory at recall time: an agent surfaces a memory only if its user is already cleared to see the source. Over MCP, organization membership is rechecked on every request. Slack ingestion is limited to public channels, and Glen never returns another organization's data. *Controls each person has over their own sessions* | Mode | Recalls team memory | Records to team memory | | --- | --- | --- | | `glen on` | Yes | Yes | | `glen incognito` | Yes | No | | `glen silent` | No | Yes | | `glen off` | No | No | Modes apply account-wide, across every agent. On macOS a menu bar indicator shows which one is on. > **Put your team's agents on one memory** Free for up to 3 people. Each teammate runs one install command and joins the same organization. Install: `npx @tryglen/cli@latest install`. Start free at https://tryglen.com ## What shared memory doesn't replace Rules that must apply on every task still belong in `AGENTS.md` or `CLAUDE.md`, because they load without anyone searching. Shared memory is for the context behind the work. When a recalled decision turns out to be a standing rule, move it into the repo file. [The setup guide](https://memoryforaiagents.com/setup) covers inviting the team. ## Frequently asked questions ### What is shared memory for AI agents? A single memory store that multiple agents, run by multiple people, write to and read from. It lets one session recall what a different person's session worked out. ### Can Claude Code and Codex share memory? Their built-in memories don't. With Glen installed in both, they record into and recall from the same organization memory. ### Will teammates see my agent sessions? Recorded sessions are searchable across your organization. Use glen incognito to keep a session out of team memory while still getting recall. ### Does shared memory include private Slack messages? No. Glen reads public Slack channels only, never DMs or private channels. --- # Set up memory your whole team's agents share URL: https://memoryforaiagents.com/setup Last updated: 2026-11-07 Published by Glen (https://tryglen.com), shared memory for coding agents. > One person runs npx @tryglen/cli@latest install and signs in, which creates the organization. They invite teammates with glen invite , and each teammate runs the same install command and joins. From then on every teammate's agents record into, and recall from, the same organization memory. Shared memory gets useful the moment a second person records into it. So the order matters: set up the organization, invite people, then let each person add Glen to whatever agents they use. 1. **Install Glen and create the organization** Needs Node.js. The installer finds your coding agents, asks which ones get the plugin, and signs you in. The organization you create is where the team's memory will live. ```bash npx @tryglen/cli@latest install ``` 2. **Invite your teammates** Send an invite to each person by email. Free covers up to 3 people, so a small team can try this without a card. ```bash glen invite teammate@example.com ``` 3. **Each teammate installs and joins** They run the same install command on their machine and sign in to your organization. Their agents start recording into the shared organization from their next session. ```bash npx @tryglen/cli@latest install ``` 4. **Everyone imports recent history** Each person backfills their own old local sessions, so the shared store starts with weeks of the team's work instead of nothing. ```bash glen import ``` 5. **Search across the team** Ask about something a teammate worked on. The cited answer can draw on any session you are cleared to see. ```bash glen search "how did we fix the duplicate webhook deliveries" ``` ## Adding Glen to each kind of agent *How each teammate's agent gets the Glen plugin* | Agent | How to add it | Docs | | --- | --- | --- | | Claude Code | Picked in the installer | [Claude Code docs](https://tryglen.com/docs/claude-code) | | Codex | Picked in the installer; hooks go in `~/.codex/hooks.json` | [Codex docs](https://tryglen.com/docs/codex) | | Cursor | Type `/add-plugin` in agent chat and add `https://github.com/Glen-Web-App/glen-cursor-plugin` | [Cursor docs](https://tryglen.com/docs/cursor) | | Grok Build | `glen install --agent grok` | [Grok docs](https://tryglen.com/docs/grok) | | Pi | `pi install npm:@tryglen/pi` | [Pi docs](https://tryglen.com/docs/pi) | | Other MCP clients | Add `https://mcp.tryglen.com/mcp` | [MCP docs](https://tryglen.com/docs/mcp) | Grok Build here means xAI's coding CLI, `grok`. Glen does not connect to the grok.com chat app; [Grok memory](https://grokmemory.dev) explains the difference. > **Start your team's shared memory** Install, invite two teammates, and import a month of sessions. Free covers 15,000 memories. Install: `npx @tryglen/cli@latest install`. Start free at https://tryglen.com ## When the team grows Free stops at 3 people and 15,000 memories. Personal raises the memory limit to 250,000 and adds integrations; Team removes the limits. Integrations are how Slack, GitHub, tickets and call transcripts join the same memory as your agents' sessions. ## Frequently asked questions ### How do I add a teammate to Glen? Run glen invite with their email address. They install the CLI with npx @tryglen/cli@latest install, sign in and join your organization. ### Do all teammates need to use the same AI agent? No. Each person adds Glen to the agents they use, and all of them share one organization memory. ### How many people can use Glen for free? Up to 3 people and 15,000 memories, with no credit card required.