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.
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 default | With Engram | |
|---|---|---|
| Survives restart | ✗ | ✓ |
| Cross-session memory | ✗ | ✓ |
| Semantic search | ✗ | ✓ |
| Memory types | none (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"
}
}
]
}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"
}
}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.
| Approach | Best for | Setup |
|---|---|---|
| MCP | Full control — explicit store/recall/search/forget | Low |
| Ollama Proxy | Automatic injection — no agent changes needed | Minimal |
| REST + Soul | Custom workflows — hooks, souls, scripting | Medium |
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/statsTelegram & 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.