Skip to main content
Engram can be configured using environment variables and follows XDG conventions for storing data.

Environment Variables

ENGRAM_DATA_DIR

Override the default data directory where Engram stores the SQLite database and related files.
string
default:"~/.engram"
Path to data directory. Will be created if it doesn’t exist.
Usage:
Directory Structure:

ENGRAM_PORT

Override the default HTTP server port.
number
default:"7437"
Port number for HTTP API server (1024-65535)
Usage:
Port Precedence:
  1. Command-line argument: engram serve 8080
  2. Environment variable: ENGRAM_PORT=8080
  3. Default: 7437

Database Configuration

Engram uses SQLite with the following built-in configuration:

SQLite Settings

string
default:"WAL"
Write-Ahead Logging for concurrent reads during writes
number
default:"5000"
Milliseconds to wait before timing out on locked database (5 seconds)
string
default:"NORMAL"
Balance between safety and performance
boolean
default:"ON"
Enforce referential integrity constraints
boolean
default:"enabled"
Full-text search enabled on observations and prompts
Schema Details:

MCP Server Configuration

Tool Profiles

Control which MCP tools are exposed to agents:
profile
11 tools for AI coding agents:
  • mem_save - Save observations
  • mem_search - Search memories
  • mem_context - Recent context
  • mem_session_summary - Session summaries
  • mem_session_start - Start sessions
  • mem_session_end - End sessions
  • mem_get_observation - Get full content
  • mem_suggest_topic_key - Topic key suggestions
  • mem_capture_passive - Passive learning extraction
  • mem_save_prompt - Save user prompts
  • mem_update - Update observations
profile
3 tools for manual curation:
  • mem_delete - Delete observations
  • mem_stats - System statistics
  • mem_timeline - Timeline view
profile
All 14 tools (agent + admin)
Usage:

Agent Configuration Files

Engram integrates with various AI coding agents through their configuration files.

OpenCode

Plugin Location: ~/.config/opencode/plugins/engram.ts MCP Config: ~/.config/opencode/opencode.json
Install:

Claude Code

Plugin Location: ~/.claude/plugins/engram/ MCP Config: ~/.claude/mcp.json
Permissions: ~/.claude/settings.json
Install:
The installer offers to automatically add Engram tools to the permissions allowlist to prevent repeated permission prompts.

Gemini CLI

Config Location: ~/.gemini/settings.json
System Prompt: ~/.gemini/system.md Compaction Recovery: ~/.gemini/.env Install:

Codex

Config Location: ~/.codex/config.toml
Install:

Git Sync Configuration

Sync Directory Structure

.gitignore

Add to your project’s .gitignore:

Sync Workflow

Export:
Import:
Auto-Import: The OpenCode plugin automatically runs engram sync --import at startup if .engram/manifest.json exists.

HTTP API Configuration

The HTTP server binds to 127.0.0.1 (localhost only) for security.

Server Details

string
default:"127.0.0.1"
Server only accepts local connections
number
default:"7437"
Configurable via ENGRAM_PORT or command-line argument
boolean
default:"false"
Not enabled - local access only

Health Check

Response:

Privacy Configuration

Private Tag Stripping

Engram strips <private> tags at two levels:
  1. Plugin layer (TypeScript) - Before sending to HTTP API
  2. Store layer (Go) - Inside AddObservation() and AddPrompt()
Example:
Usage in MCP:

Performance Tuning

Database Optimization

Engram uses SQLite’s WAL mode for optimal performance:
  • Concurrent reads during writes
  • Checkpoint automatic background
  • Page size 4096 bytes (default)

Search Performance

FTS5 query optimization:
  • Queries are sanitized and quoted automatically
  • Search limited to 20 results max
  • Indexes on session_id, project, scope, created_at

Memory Usage

Typical memory footprint:
  • Binary size: ~15MB (includes SQLite)
  • Runtime memory: ~10-20MB (idle)
  • Database size: ~1KB per observation (compressed)

Troubleshooting

Database Locked

If you see “database is locked” errors:

Port Already in Use

Data Directory Permissions

Sync Conflicts

Chunks are content-hashed and never conflict. If manifest conflicts:

Default Values Reference


Configuration Files Location Summary

Install any agent: