What this is: A step-by-step guide for OpenClaw users who want to plug Ethos into their setup and give their agents real, persistent, decaying memory.
What you get: Agents that passively record every conversation, consolidate important facts over time, surface relevant memories automatically before each response, and naturally forget things that aren't reinforced — just like a human would.
Ethos sits alongside OpenClaw as a standalone Rust service. Two lightweight TypeScript hooks bridge them:
Your message arrives
→ ethos-ingest hook fires → records it to Ethos (fire-and-forget)
→ ethos-context hook fires → searches Ethos for relevant memories
→ writes ETHOS_CONTEXT.md to agent workspace
→ Agent responds (with memory context already in view)
Every 15 minutes (when idle):
→ Ethos consolidation engine promotes important episodes → semantic facts
→ Ebbinghaus decay sweep runs → stale memories fade, retrieved ones strengthen
No agent code changes. No tool calls required. Memory just works.
| Requirement | Version | Notes |
|---|---|---|
| OpenClaw | 2026.2.19-2+ | Hooks framework required |
| PostgreSQL | 16+ | Native install recommended (not Docker) |
| pgvector | 0.8.0+ | Vector similarity extension |
| Rust + Cargo | 1.75+ | For building Ethos |
| Node.js | 18+ | For the TypeScript hooks |
| Google AI Studio API key | — | Free tier works for embeddings |
# Ubuntu 25.10+ has pgvector in standard repos
sudo apt install postgresql-17 postgresql-17-pgvector
# Start PostgreSQL
sudo systemctl enable --now postgresqlcd ~/Projects # or wherever you keep your code
git clone https://github.com/modernmethod/ethos.git
cd ethos
# Build the server (first build takes a few minutes)
cargo build --release
# Verify it compiled
./target/release/ethos-server --help# Create DB user and database
sudo -u postgres psql << 'SQL'
CREATE USER ethos WITH PASSWORD 'your_password_here';
CREATE DATABASE ethos OWNER ethos;
GRANT ALL PRIVILEGES ON DATABASE ethos TO ethos;
SQL
# Run migrations (must be run as postgres superuser for the vector extension)
sudo -u postgres psql -d ethos -f migrations/001_initial_schema.sql
psql -U ethos -d ethos -h localhost -f migrations/002_story_004_ingest.sqlCopy the example config and fill in your values:
cp ethos.example.toml ethos.tomlKey settings to update in ethos.toml:
[database]
url = "postgresql://ethos:your_password_here@localhost:5432/ethos"
[embedding]
backend = "gemini"
gemini_dimensions = 768 # 768 = good balance of quality vs storage
[consolidation]
interval_minutes = 15 # how often to promote episodes → semantic facts
importance_threshold = 0.8 # episodes above this salience get promoted
[decay]
base_tau_days = 7.0 # memories halve in ~10 days without reinforcement
ltp_multiplier = 1.5 # each retrieval extends memory lifetime by 1.5x
prune_threshold = 0.05 # memories below this salience are soft-deletedCreate a .env file for your API key (never commit this):
echo "GOOGLE_API_KEY=your_gemini_api_key_here" > .envGet a free Gemini API key: https://aistudio.google.com/app/apikey The free tier supports ~100-250 embedding requests/day — plenty for personal use.
cd ~/Projects/ethos
cargo run --release --bin ethos-server
# Verify it's running
cargo run --release --bin ethos-server -- --health
# ✅ PostgreSQL connected: PostgreSQL 17.x ...
# ✅ pgvector version: 0.8.0Create ~/.config/systemd/user/ethos-server.service:
[Unit]
Description=Ethos Memory Engine
After=network.target postgresql.service
[Service]
Type=simple
WorkingDirectory=%h/Projects/ethos
ExecStart=%h/Projects/ethos/target/release/ethos-server
Restart=on-failure
RestartSec=5
EnvironmentFile=%h/Projects/ethos/.env
[Install]
WantedBy=default.targetsystemctl --user daemon-reload
systemctl --user enable --now ethos-server
systemctl --user status ethos-serverVerify the socket is live:
ls /tmp/ethos.sock # should exist while server is runningEthos ships with two hooks that live inside OpenClaw's hooks directory:
# Copy hooks to OpenClaw's hooks directory
cp -r hooks/ethos-ingest ~/.openclaw/hooks/
cp -r hooks/ethos-context ~/.openclaw/hooks/
# Install TypeScript dependencies for the ingest hook
cd ~/.openclaw/hooks/ethos-ingest
npm install
npm run build
# Install dependencies for the context hook
cd ~/.openclaw/hooks/ethos-context
npm install
npm run buildNote: The hooks reference the Ethos client library via an absolute path. If you cloned Ethos somewhere other than
~/Projects/ethos, update therequire()path in bothhandler.tsfiles before building.
Add the hooks to your OpenClaw configuration. Open ~/.openclaw/openclaw.json and add the hooks section (or merge with your existing hooks config):
{
"hooks": {
"internal": {
"enabled": true,
"entries": {
"ethos-ingest": {
"enabled": true
},
"ethos-context": {
"enabled": true
}
}
}
}
}Then restart OpenClaw to apply:
openclaw gateway restartSend a message to your agent, then query the database:
PGPASSWORD=your_password psql -U ethos -d ethos -h localhost \
-c "SELECT role, content, created_at FROM session_events ORDER BY created_at DESC LIMIT 5;"You should see your recent messages appearing in real time.
PGPASSWORD=your_password psql -U ethos -d ethos -h localhost \
-c "SELECT COUNT(*) FROM memory_vectors WHERE vector IS NOT NULL;"After a few messages, inspect the context file Ethos writes to your agent:
cat ~/.openclaw/<your-agent-workspace>/ETHOS_CONTEXT.mdOnce enough memories accumulate (typically after a day or two of usage), you'll see relevant context appearing here before each response.
cd ~/Projects/ethos
node integration-test.mjs
# ✅ Ping: pong
# ✅ Health: PostgreSQL + pgvector connected
# ✅ Ingest: memory stored (id: ...)
# ✅ Search: results returned (score: 0.879)For completeness, here's the exact set of changes made to wire Ethos into an existing OpenClaw installation:
| Change | Where | Why |
|---|---|---|
Added ethos-ingest hook |
~/.openclaw/hooks/ethos-ingest/ |
Records every message to Ethos (fire-and-forget, never blocks) |
Added ethos-context hook |
~/.openclaw/hooks/ethos-context/ |
Searches Ethos before each response, writes ETHOS_CONTEXT.md |
| Enabled both hooks | openclaw.json → hooks.internal.entries |
Activates them in the OpenClaw hook pipeline |
| No changes to agent prompts | — | Hooks operate at the infrastructure layer; agents are unaware |
| No changes to routing or models | — | Ethos is additive — existing config untouched |
That's it. Ethos is designed as a drop-in addition, not a replacement. Your existing setup keeps working. Ethos adds memory on top.
On every inbound message, the ethos-context hook:
- Takes the message content as a search query
- Calls Ethos search (BM25 + vector similarity + spreading activation)
- Filters results below the confidence gate (default: 0.12)
- Writes formatted results to
{agent-workspace}/ETHOS_CONTEXT.md
Your agent reads this file automatically as part of their workspace context — no tool calls, no prompting required.
Scoped recall is supported by optional /search filters:
resourceId(orresource_id)threadId(orthread_id; also matches storedsession_idmetadata for backward compatibility)agentId(oragent_id)
Search results now return:
metadata: the original ingest metadata payload (unchanged)retrieval:{ cosine_score, spread_score, structural_score }metadata_scores: backward-compatible alias ofretrieval
Agents can also search Ethos directly using the memory_search tool:
memory_search("Animus brain regions")
Note (as of Ethos v1):
memory_searchcurrently routes to QMD (OpenClaw's built-in memory backend), not Ethos. Ethos v1.1 will implement the QMD wire protocol, makingmemory_searchtransparently route to Ethos as a drop-in replacement. Until then, passive injection viaETHOS_CONTEXT.mdis the primary recall path.
Ethos runs a background consolidation + decay cycle every 15 minutes (when the system is idle):
session_events (raw turns)
↓ consolidation (high-salience episodes promoted)
episodic_traces (turn clusters with importance scores)
↓ consolidation (repeated/important episodes extracted)
semantic_facts (durable knowledge: decisions, preferences, entities)
↓ Ebbinghaus decay (salience fades without reinforcement)
↑ LTP boost (salience strengthens on each retrieval)
↓ pruning (salience < 0.05 → soft-deleted, never hard-deleted)
Decay curve (no retrievals, τ = 7 days):
- After 1 day: 87% salience remaining
- After 1 week: 37% salience
- After 2 weeks: 14% salience
- After 1 month: pruned
With LTP (5 retrievals, τ_eff ≈ 53 days):
- After 1 month: 57% — safely retained
- After 3 months: 18% — still alive
- After 6 months: pruned
Things you talk about frequently become essentially permanent. Things never revisited fade away naturally.
# Check PostgreSQL is running
sudo systemctl status postgresql
# Check the socket isn't stale from a crash
rm -f /tmp/ethos.sock
cargo run --release --bin ethos-server -- --health- Ethos server not running: Check
ls /tmp/ethos.sock - Not enough data yet: Confidence gate (0.12) filters low-quality matches. Needs a few days of usage to populate meaningfully.
- Embeddings not processed: The async embedding queue processes in batches. Wait 5–30 seconds after ingestion.
# Verify hooks are enabled in openclaw.json
openclaw config get hooks
# Check OpenClaw logs for hook errors
journalctl --user -u openclaw-gateway -f | grep -i ethos# Verify PostgreSQL is accepting connections
psql -U ethos -d ethos -h localhost -c "SELECT 1;"
# Check pg_hba.conf allows local connections
sudo grep ethos /etc/postgresql/17/main/pg_hba.confSee ethos.toml for the full annotated configuration file. Key tuning knobs:
| Setting | Default | Effect |
|---|---|---|
consolidation.interval_minutes |
15 | How often the DMN cycle runs |
consolidation.importance_threshold |
0.8 | Salience required for auto-promotion |
decay.base_tau_days |
7.0 | Base memory half-life in days |
decay.ltp_multiplier |
1.5 | How much each retrieval extends memory life |
decay.prune_threshold |
0.05 | Salience below which memories are soft-deleted |
retrieval.confidence_gate |
0.12 | Minimum score to appear in ETHOS_CONTEXT.md |
embedding.gemini_dimensions |
768 | Vector dimensions (128–3072; higher = more accurate, more storage) |
- Story 011: REST API + QMD wire protocol —
memory_searchtransparently routes to Ethos - Story 012: ONNX offline fallback — embeddings work without internet access
- Phoenix integration: Memory conflict review UI instead of inbox-file workflow
- Multi-tenant support: Isolated memory pools per user
Built by Modern Method Inc. — "Ship the future of intelligence." Ethos is open source (MIT). Contributions welcome.