Skip to Content
CLI & Daemon

CLI Reference — @getengram/cli

Command-line interface for Engram. Store, search, and auto-capture AI conversations from your terminal.

Install

brew tap get-engram/engram brew install engram

This installs the engram binary and enables brew services for daemon management.

npm

npm install -g @getengram/cli

Or use without installing:

npx @getengram/cli search "your query"

Account & Authentication

Create an account

engram signup

Creates a free account instantly — no email, no password. Your API key is saved to ~/.engram/config.json automatically. AI agents can run this command to self-provision.

Sign in to an existing account

engram login

Prompts for email + password. Use this if you already have an account from the website.

engram link

Attach an email + password to an anonymous account. This lets you:

Manual API key entry

engram auth login engram_sk_live_YOUR_KEY

For cases where you already have a key (e.g. from the dashboard or a team admin).

Other auth commands

engram auth status # Show authentication status engram auth logout # Remove stored credentials

Environment variable

export ENGRAM_API_KEY=engram_sk_live_YOUR_KEY

This overrides the saved config — useful for CI, scripts, or per-project keys.

Commands

engram conversations list

List all conversations.

engram conversations list engram conversations list --agent my-bot --tags prod,api engram conversations list --sort message_count --order desc engram conversations list --limit 5 --json
FlagDescription
--agent IDFilter by agent ID
--tags A,BFilter by tags (comma-separated)
--sort FIELDSort by: created_at, updated_at, message_count
--order DIRSort direction: asc, desc
--limit NMax results
--jsonOutput as JSON

engram conversations create

Create a new conversation.

engram conversations create --title "Deploy Log" --tags prod,deploy --agent deploy-bot
FlagDescription
--title TEXTConversation title
--agent IDAgent identifier
--tags A,BTags (comma-separated)
--jsonOutput as JSON

engram conversations get

Retrieve a conversation with all its messages.

engram conversations get conv_abc123 engram conversations get conv_abc123 --limit 50 engram conversations get conv_abc123 --json

engram conversations delete

Delete a conversation and all its data.

engram conversations delete conv_abc123 --force

The --force flag is required to confirm deletion.

engram store

Store a message in a conversation.

# Store text engram store -c conv_abc "Deployed v2.1.0 to production" # Specify role engram store -c conv_abc --role assistant "Deploy successful" # Tool output engram store -c conv_abc --role tool --tool deploy "exit code 0" # From stdin echo "build output" | engram store -c conv_abc --file - # From file engram store -c conv_abc --file ./deploy.log
FlagDescription
-c, --conversation IDConversation ID (required)
--role ROLEMessage role: user, assistant, system, tool (default: user)
--tool NAMETool name (for tool messages)
--file PATHRead content from file (use - for stdin)
--jsonOutput as JSON

Semantic search across all stored conversations.

engram search "when did we deploy v2" engram search "error handling" --limit 5 engram search "auth issues" --tags prod --conversation conv_abc engram search "deploy" --json
FlagDescription
--limit NMax results (1–50, default: 10)
--conversation IDLimit to specific conversation
--tags A,BFilter by tags
--jsonOutput as JSON

Output shows relevance score, conversation ID, and matched text:

[80.4%] conv_Y4KAdWuDUTAobIAi3toSC seq 1–3 [system]: Building Engram Phase 2... [assistant]: Codebase analysis complete... [user]: User wants npm and brew distribution...

engram log

Show recent AI conversation activity, like git log.

engram log # Show recent auto-captured sessions engram log --all # Include manually-created conversations engram log --limit 30 # More results engram log --json # Output as JSON
FlagDescription
--allShow all conversations, not just auto-captured
--limit NMax results (default: 15)
--jsonOutput as JSON

Output shows project name, branch, timestamp, and message count:

engram main 2026-04-14 09:32 47 msgs conv_abc123 [auto] my-project feature/auth 2026-04-14 08:15 23 msgs conv_def456 [auto]

Daemon (Auto-Capture)

The Engram daemon runs in the background and automatically captures every Claude Code conversation. It watches the JSONL transcript files that Claude Code writes to ~/.claude/projects/ and syncs them to your Engram account.

Why this matters

Claude Code stores every message, tool call, and response in JSONL files on your local machine. When Claude Code hits its context window limit, it compresses older messages — but the full uncompressed transcript stays on disk. The Engram daemon captures this complete record before anything is lost.

Without the daemon, memory depends on the AI choosing to store things via MCP. With the daemon, everything is captured automatically — no AI cooperation needed.

Start the daemon

With Homebrew:

brew services start engram

With npm:

engram start # Start in background engram install # Auto-start on login (macOS launchd)

engram start

Start the background daemon.

engram start # Detached background process engram start --foreground # Run in foreground (for debugging or launchd) engram start --install # Start + enable auto-start on login
FlagDescription
--foreground, -fRun in foreground instead of detaching
--installAlso install launchd auto-start

engram stop

Stop the running daemon.

engram stop

engram status

Show daemon status and sync statistics.

engram status

Output:

Status: running (pid 12345) Sessions captured: 47 Pending sync: 0 messages Files tracked: 128 Log: /Users/you/.engram/daemon.log Auto-start: enabled (launchd)

engram install

Enable auto-start on login (macOS launchd).

engram install

This writes a LaunchAgent plist so the daemon starts automatically when you log in and restarts if it crashes.

engram uninstall

Remove auto-start.

engram uninstall

How the daemon works

  1. Watches ~/.claude/projects/ for JSONL transcript files using file system events
  2. Parses each line — extracts user messages, assistant responses, and tool calls
  3. Queues messages in a local SQLite database (~/.engram/daemon.db) for offline resilience
  4. Syncs batches to the Engram API in parallel, creating conversations automatically
  5. Tracks byte offsets per file so it only reads new content, even after restarts

Messages are never lost — if you’re offline or the API is unavailable, they queue locally and sync when connectivity returns.

Daemon files

PathDescription
~/.engram/daemon.pidProcess ID file
~/.engram/daemon.dbLocal SQLite queue and state
~/.engram/daemon.logDaemon log output
~/Library/LaunchAgents/app.getengram.daemon.plistmacOS auto-start config

engram help

Show help text with all commands and options.

engram help engram --help

engram version

engram version

Environment Variables

VariableDescriptionDefault
ENGRAM_API_KEYAPI key (overrides ~/.engram/config.json)
ENGRAM_BASE_URLCustom Engram endpointhttps://mcp.getengram.app

Configuration File

Credentials are stored in ~/.engram/config.json:

{ "apiKey": "engram_sk_live_...", "baseUrl": "https://mcp.getengram.app" }

Scripting Examples

Create and populate a session

CONV=$(engram conversations create --title "Build $(date +%F)" --json | jq -r '.conversationId') npm run build 2>&1 | engram store -c $CONV --file - npm test 2>&1 | engram store -c $CONV --role tool --tool test --file - engram store -c $CONV --role assistant "Build and tests complete"

Search and pipe to jq

engram search "deploy" --json | jq '.results[] | {score, text: .chunkText[:80]}'

Export a conversation

engram conversations get conv_abc --json > conversation-backup.json
Last updated on