EngramEngramdocs
v0.1.0
Search docs…⌘K
GitHub
Integrations

Asterisk

Asterisk is a lightweight, open-source AI agent CLI built on Bun. By default, its conversation history lives in memory and is lost on restart. Connecting Asterisk to Engram gives every session — REPL, Telegram bot, WhatsApp bot, scheduled tasks — persistent memory that survives restarts and is shared across all channels.

MCPOllama ProxyREST API
i
Make sure the Engram daemon is running (engram start or node apps/server/dist/index.js) before configuring Asterisk. Default port: 4901.

What changes with Engram

Without Engram, Asterisk starts every session from scratch. With Engram, conversations, decisions, and knowledge persist indefinitely and are recalled automatically.

Asterisk defaultWith Engram
Survives restart
Cross-session memory
Semantic search
Memory typesnone (in-memory history)episodic / semantic / procedural
Knowledge graph
Shared with Claude Code, Ollama, etc.

Option A — MCP Server (recommended)

Asterisk has full MCP client support. Adding Engram as an MCP server exposes all 18 memory tools — store, recall, search, forget, tags, contradictions, and more — as native tools inside every Asterisk session.

1. Edit ~/.asterisk/config.json

Add Engram to the mcpServers array. Adjust the path to match where you built the Engram MCP server:

{
  "mcpServers": [
    {
      "name": "engram",
      "transport": "stdio",
      "command": "node",
      "args": ["/path/to/neuralcore/packages/mcp/dist/server.js"],
      "env": {
        "ENGRAM_DB_PATH": "/path/to/engram.db"
      }
    }
  ]
}
If Engram is already configured as an MCP server for Claude Code, you can use the same server.js path and database. Both tools will share the same brain.

2. Verify the connection

# Start Asterisk and list MCP tools
asterisk
/mcp

You should see all engram__* tools listed. If the connection fails, check that the Engram daemon is running and the path to server.js is correct.

3. Use memory in conversations

Once connected, Asterisk can call Engram tools directly. The agent decides when to store and recall based on the conversation:

# In the Asterisk REPL, Engram tools are available as:
#   engram__store_memory
#   engram__recall_context
#   engram__search_memory
#   engram__add_knowledge
#   engram__memory_stats
#   engram__forget
#   ... (18 tools total)

# Example: ask Asterisk to recall context
> What do you remember about my TypeScript preferences?
# → Asterisk calls engram__recall_context automatically

# Example: store a fact
> Remember that I prefer Bun over Node for new projects
# → Asterisk calls engram__store_memory with type: semantic

Option B — Ollama Proxy (zero config)

If Asterisk uses Ollama as its provider, the simplest integration is to point it at the Engram Ollama proxy. Memory context is injected into every request automatically — no MCP, no code changes, no tool calls needed.

Change the Ollama base URL

In ~/.asterisk/config.json, change the Ollama baseUrl from port 11434 to 11435:

{
  "provider": "ollama",
  "ollama": {
    "baseUrl": "http://localhost:11435",
    "model": "qwen3:14b"
  }
}
i
The proxy intercepts /api/chat and /v1/chat/completions, injects relevant memories into the system prompt, and forwards to the real Ollama. Conversations are auto-stored as episodic memories. See the Ollama Proxy page for full details.

Option C — REST API + Soul/Hooks

For maximum control, use Engram's REST API directly via Asterisk's soul system and lifecycle hooks. This approach works regardless of provider (Ollama or Anthropic).

1. Add memory instructions to the soul

Asterisk's soul system injects markdown into the system prompt. Add memory recall/store instructions:

# ~/.asterisk/SOUL.md  (or <project>/.asterisk/SOUL.md)

You have access to a persistent memory system at http://localhost:4901.

Before answering any question, recall relevant context:
  curl -s -X POST http://localhost:4901/api/recall \
    -H 'Content-Type: application/json' \
    -d '{"query":"<user question>","maxTokens":2000}'

After completing important work, store a summary:
  curl -s -X POST http://localhost:4901/api/memory \
    -H 'Content-Type: application/json' \
    -d '{"content":"<summary>","type":"episodic","source":"asterisk"}'

2. Auto-store via hooks (optional)

Add a lifecycle hook to automatically store conversation exchanges after each turn:

{
  "hooks": [
    {
      "name": "engram-store",
      "event": "after_turn",
      "command": "curl -sf -X POST http://localhost:4901/api/memory -H 'Content-Type: application/json' -d '{"content":"Asterisk session exchange","type":"episodic","source":"asterisk","importance":0.5}'",
      "timeoutSeconds": 5,
      "enabled": true
    }
  ]
}

Choosing the right approach

You can combine approaches. For example, use MCP for explicit tool access while also running the Ollama proxy for automatic context injection.

ApproachBest forSetup
MCPFull control — explicit store/recall/search/forgetLow
Ollama ProxyAutomatic injection — no agent changes neededMinimal
REST + SoulCustom workflows — hooks, souls, scriptingMedium
The MCP + Ollama proxy combination is the most powerful: the proxy silently injects context into every turn, while MCP tools let the agent explicitly store important facts, search memory, and manage the knowledge graph.

Verify the integration

# 1. Check Engram is running
curl http://localhost:4901/api/health

# 2. Store a test memory
curl -X POST http://localhost:4901/api/memory \
  -H 'Content-Type: application/json' \
  -d '{"content":"Test from Asterisk integration","type":"semantic","source":"asterisk"}'

# 3. Recall it
curl -X POST http://localhost:4901/api/recall \
  -H 'Content-Type: application/json' \
  -d '{"query":"asterisk test","maxTokens":500}'

# 4. Check stats
curl http://localhost:4901/api/stats
!
If the health check fails, confirm the Engram daemon is running and that the port matches your configuration (default 4901).

Telegram & WhatsApp bots

When Asterisk runs in daemon mode with Telegram or WhatsApp bots enabled, each bot session uses the same provider configuration. If you configured the Ollama proxy (Option B), bot conversations automatically gain memory. If you configured MCP (Option A), the agent has explicit memory tools available in bot sessions too.

Each bot user gets a unique session ID in Asterisk. Engram stores all memories in the same brain by default — use the ENGRAM_NAMESPACE environment variable if you want to isolate memory per bot or per user.

Asterisk Integration — Engram Docs