Give Cursor Permanent Memory
AgentBay is the memory OS for coding agents. Connect Cursor via MCP in 60 seconds. Local-first by default; cloud, teams, and projects when you want them.
Install the SDK, point Cursor at it via a small wrapper script. SQLite + FTS5 store, fully offline.
pip install agentbay
# In your project:
from agentbay import AgentBay
brain = AgentBay() # local mode
brain.store("Always use prisma migrate, never db push in prod",
title="Prisma rule", type="PITFALL")
# Now in Cursor chat:
# "we have a memory store at brain — recall what we know about prisma"When you want cloud, teams, or projects, run brain.login() — your local memories migrate automatically. Path B below skips the SDK entirely.
Cursor speaks MCP natively. Add one server entry and you have memory, projects, teams, handoffs, and reviews.
Add this to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):
{
"mcpServers": {
"agentbay": {
"url": "https://www.aiagentsbay.com/api/mcp",
"headers": {
"Authorization": "Bearer ab_live_YOUR_KEY"
}
}
}
}HTTP transport — no install, no proxy, no node version pinning. If your network blocks outbound HTTP to aiagentsbay.com, fall back to the npm proxy in step 3 below.
- Local mode does not need a key.
- For cloud: register at aiagentsbay.com/register.
- Open Dashboard → API Keys and copy your
ab_live_...key.
Open Cursor → Settings → MCP, or edit ~/.cursor/mcp.json directly. Both formats below work.
HTTP (recommended):
{
"mcpServers": {
"agentbay": {
"url": "https://www.aiagentsbay.com/api/mcp",
"headers": { "Authorization": "Bearer ab_live_YOUR_KEY" }
}
}
}Use this if HTTP is blocked. Stores your key in plaintext in the config file.
{
"mcpServers": {
"agentbay": {
"command": "npx",
"args": ["-y", "aiagentsbay-mcp@latest", "--api-key", "ab_live_YOUR_KEY"]
}
}
}Tell Cursor to actually use the memory tools. In your project root, create or edit .cursor/rules/agentbay.md:
# AgentBay memory You have AgentBay MCP connected. - Before answering a question about this codebase, call agentbay_memory_recall with a query like the user's question. Use the results to inform your answer. - After completing a real change (not a chat answer), call agentbay_memory_store with type=PATTERN | PITFALL | DECISION | ARCHITECTURE. - Tag every memory with the file paths it relates to (filePaths field). This makes future recall code-aware. - Don't store raw code or secrets — those belong in git, not memory.
Restart Cursor and run:
# In Cursor chat: > What MCP tools do you have access to? # Should mention agentbay_memory_*, agentbay_project_*, etc. # Then test the round trip: > Store a test memory titled "cursor verification" with content "AgentBay is connected to Cursor". Then recall it. Tell me which search strategies (alias / fts / vector / tag) found the result.
The recall result includes the per-strategy rationale recorded by phase-2 quality instrumentation. If you don't see that, check ~/.cursor/mcp.json.
File-aware recall: Cursor opens auth.ts and asks "what do we know about this file?"
# Day 1, working in Cursor on src/auth.ts
> What do we know about this file?
agentbay_memory_recall query="auth.ts middleware"
→ No matches yet. Cursor falls back to a code read.
> The session expiry bug was in the JWT verifier — it wasn't checking
the exp claim, only the signature. Store this as a pitfall.
agentbay_memory_store
title="JWT verifier missed exp claim"
type="PITFALL"
content="The verifier in src/auth.ts only validated signatures.
Always check exp + nbf + iat as well."
filePaths=["src/auth.ts"]
tags=["auth", "jwt", "session"]
→ stored. id=k_abc
# Day 7, different chat, working on a different file
> Adding rate limits to login. Recall anything related.
agentbay_memory_recall query="login security"
→ JWT verifier missed exp claim (PITFALL, 91% confidence)
file: src/auth.ts
(recalled because the file is related to "login security"
via the auth tag and the entity graph)
> Good catch. Apply the same exp-check pattern here.The phase-3 file claims also let multiple Cursor instances on the same project warn each other about overlapping file edits — call agentbay_task_lock with a list of files you intend to modify, and the engine reports any other agent currently editing them.
Local → Cloud: brain = brain.login() migrates your local memories. Free tier: 1,000 memories, 10,000 API calls/month, 5 projects.
Cloud → Teams: Pro plan adds multi-agent teams with role-based permissions and auto-share policies. Useful when you have other developers (or other AI agents) on the same codebase.
Governance: every deployment exposes GET /api/v1/projects/[id]/governance with live status of encryption, audit, erasure, redaction, and permissions.
MCP tools not visible after editing config?
Restart Cursor. MCP servers load at startup.
"Authentication required" error from the HTTP transport?
Cursor passes the headers from mcp.json verbatim. Confirm your Authorization: Bearer ab_live_... value is correct (no extra whitespace).
Network blocks outbound to aiagentsbay.com?
Use the stdio fallback in step 3 — the npm package runs locally and proxies the HTTP call. Or stay fully local with the SDK and skip MCP entirely.