Skip to main content

Fastest path — paste one prompt into your agent

If you have a coding agent (Claude Desktop, Cursor, Claude Code, Codex, Windsurf), skip the manual steps entirely. Paste this prompt:
Install Mengram for me. Fetch the canonical install
guide at https://mengram.io/agent-install.txt and
follow it precisely. My email is YOUR_EMAIL_HERE.
The agent reads our install guide, runs pip install, signs you up, configures the MCP server in its host, and verifies the install end-to-end with mengram doctor. Walk away — it tells you when it’s done. Want to do it manually? Continue below.

1. Get an API key

Sign up at mengram.io to get your free API key. It starts with om-. You can also do it from the terminal — mengram signup --email you@example.com sends a 6-digit code; mengram signup --email you@example.com --code 123456 exchanges it for a key and saves it to ~/.mengram/config.json.

2. Install the SDK

pip install mengram-ai

3. Add your first memory

from mengram import Mengram

m = Mengram(api_key="om-your-key")

# Add memories from a conversation
result = m.add([
    {"role": "user", "content": "I deployed the app on Railway. Using PostgreSQL."},
    {"role": "assistant", "content": "Got it, noted the Railway + PostgreSQL stack."},
])

# result contains a job_id for background processing
print(result)  # {"status": "accepted", "job_id": "job-..."}

4. Search your memories

# Semantic search
results = m.search("deployment stack")
for r in results:
    print(f"{r['entity']} (score={r['score']:.2f})")
    for fact in r.get("facts", []):
        print(f"  - {fact}")

# Unified search — all 3 memory types at once
all_results = m.search_all("deployment issues")
print(all_results["semantic"])    # knowledge graph results
print(all_results["episodic"])    # events and experiences
print(all_results["procedural"]) # learned workflows

5. Get a Cognitive Profile

Generate a ready-to-use system prompt that captures who a user is:
profile = m.get_profile()
system_prompt = profile["system_prompt"]

# Use in any LLM call
response = openai.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": "What should I work on next?"},
    ]
)

6. Claude Code — Full Memory Loop

If you use Claude Code, set up automatic memory in one command:
mengram setup
This creates your account (if needed), saves your API key, and installs hooks — all from the terminal. Or manually: export MENGRAM_API_KEY=om-your-keymengram hook install. This installs 3 hooks:
  • Session context — loads your profile when Claude Code starts
  • Auto-recall — searches relevant memories on every prompt
  • Auto-save — captures conversations in the background
Claude Code remembers you across sessions automatically. See Claude Code Integration for details.

7. Verify the install end-to-end

mengram doctor
Runs an auth + add + search round-trip against the cloud API. Final line is OK: round-trip succeeded. on success, or FAIL: <reason> with a fix-it hint.
Use the environment variable MENGRAM_API_KEY so you don’t have to pass the key every time: m = Mengram()