Skip to main content

Unified second brain for AI agents โ€” 5-tier memory, HRR reasoning, 9 MCP tools

Project description

๐Ÿง  Eling

Unified second brain for AI agents โ€” 5-tier memory, HRR reasoning, 9 MCP tools

"Eling" (Javanese): to remember, to be conscious, to be aware

Python 3.10+ License: MIT MCP PyPI


โœจ What is Eling?

Eling is a unified second brain for AI agents. It merges 5 memory tiers into one MCP server โ€” no external databases, no cloud services needed for local operation.

๐Ÿง  Tier 5: NOTION   โ€” online brain, human-readable (optional)
๐Ÿ“š Tier 4: KB       โ€” FTS5 knowledge corpus
๐Ÿ•ธ๏ธ Tier 3: CODE     โ€” codegraph symbol intelligence
๐Ÿ’Ž Tier 2: FACTS    โ€” SQLite + HRR + BM25 hybrid with trust scoring
๐Ÿ“Œ Tier 1: BUILTIN   โ€” Hermes MEMORY.md / USER.md

All accessible via 9 MCP tools from a single stdio server:

Tool Purpose
eling_remember Store content โ€” auto-routes to facts (short) or KB (long)
eling_recall Cross-layer search with RRF fusion (BM25 + trigram + porter)
eling_reason Compositional query tying multiple entities together
eling_probe Get all facts about an entity
eling_reflect Promote a high-trust fact to Notion as a permanent page
eling_sync Bidirectional sync between memory layers
eling_stats Show per-layer statistics
eling_think Synthesis + gap analysis across layers
eling_export Full brain export as JSON or Markdown

๐Ÿš€ Quick Start

pip install eling

# Run MCP server (stdio โ€” plug into any MCP host)
python3 -m eling.mcp_server

# Or use the CLI
python3 -m eling --help

๐Ÿ”Œ Hermes Integration

Eling plugs into Hermes Agent at 3 levels:

1. MCP Server โ€” add to ~/.hermes/config.yaml:

mcp_servers:
  eling:
    command: python3
    args: ["-m", "eling.mcp_server"]
    enabled: true

2. Memory Provider โ€” sets default brain for remember/recall:

memory:
  provider: eling

3. Plugin โ€” registers eling_remember + eling_recall as quick tools:

plugins:
  enabled:
    - eling
  eling:
    home: /root/.eling

๐Ÿ“‹ CLI Commands

python3 -m eling remember   "I learned that..."
python3 -m eling recall     "what did I learn about X"
python3 -m eling probe      "X"
python3 -m eling reason     ["X", "Y"]
python3 -m eling reflect    1                 # promote fact_id 1 to Notion
python3 -m eling stats
python3 -m eling export     --format markdown
python3 -m eling sync       --direction push   # facts โ†’ Notion

๐ŸŒ Notion Setup (Tier 5)

Optional โ€” skip this if you only need local memory.

  1. Create a Notion integration at https://www.notion.so/my-integrations

    • Give it a name (e.g. "Eling Brain")
    • Copy the Internal Integration Secret (starts with ntn_)
  2. Share a parent page with your integration

    • Open the page you want as your second brain root
    • Click Share โ†’ Invite โ†’ select your integration
    • Copy the page URL and extract the page ID (the UUID in the URL, e.g. 38f7b66e-c7e0-813f-85b0-d37cef59c1f7)
  3. Set environment variables:

export NOTION_API_KEY="ntn_..."
export NOTION_PARENT_PAGE_ID="38f7b66e-c7e0-813f-85b0-d37cef59c1f7"

Or pass them explicitly in code:

from eling.brain import Brain
b = Brain(
    notion_api_key="ntn_...",
    notion_parent_id="38f7b66e-..."
)
result = b.reflect(fact_id=1)
print(result)  # {"page_id": "...", "promoted": True}

Note: eling_reflect checks availability at call time and returns a clear error message if any config is missing โ€” no silent failures.

๐Ÿ—๏ธ Architecture

eling/
โ”œโ”€โ”€ mcp_server.py     โ€” JSON-RPC stdio server (9 tools)
โ”œโ”€โ”€ brain.py          โ€” Orchestrator: routing + RRF fusion + sync
โ”œโ”€โ”€ config.py         โ€” Layered config: env โ†’ json โ†’ defaults
โ”œโ”€โ”€ hooks.py          โ€” 15 lifecycle hooks + HookRegistry
โ”œโ”€โ”€ privacy.py        โ€” PII/secret stripping (19 patterns)
โ”œโ”€โ”€ compress.py       โ€” SHA-256 dedup + length compression
โ”œโ”€โ”€ cli.py            โ€” CLI client for all 9 operations
โ””โ”€โ”€ layers/
    โ”œโ”€โ”€ builtin.py    โ€” Tier 1: Hermes MEMORY.md / USER.md loader
    โ”œโ”€โ”€ facts.py      โ€” Tier 2: SQLite + HRR + BM25 + trust scoring
    โ”œโ”€โ”€ hrr.py        โ€” Holographic Reduced Representations (optional numpy)
    โ”œโ”€โ”€ code.py       โ€” Tier 3: CodeLayer wrapper
    โ”œโ”€โ”€ code_index.py โ€” Pure-Python AST+regex code indexer
    โ”œโ”€โ”€ kb.py         โ€” Tier 4: FTS5 + porter + trigram + RRF
    โ””โ”€โ”€ notion.py     โ€” Tier 5: httpx Notion API client (lazy import)

โšก Performance

  • Lazy imports โ€” numpy and httpx are imported only when their layer is first used, not at module load time
  • import eling takes ~1.3s (was ~4.5s with module-level imports on Alpine)
  • Pure-Python fallback when numpy unavailable (BM25-only retrieval still works)

๐Ÿ“– Documentation

๐Ÿค Credits

  • HRR phase encoding + facts layer โ€” adapted from holographic plugin by dusterbloom (Hermes PR #2351, MIT)

๐Ÿ“œ License

MIT ยฉ 2026 PatrickNoFilter

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eling-0.1.2.tar.gz (83.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eling-0.1.2-py3-none-any.whl (63.2 kB view details)

Uploaded Python 3

File details

Details for the file eling-0.1.2.tar.gz.

File metadata

  • Download URL: eling-0.1.2.tar.gz
  • Upload date:
  • Size: 83.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eling-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0c50fa3b7cc2adcf4a53a9d641a51b89ecf0f8b834acee2715a46e914e793a1e
MD5 172d4fc7ebd8ffc9c55b25d8898ca1a5
BLAKE2b-256 a6e4cb08646673533eb7a15ced2d132d0dbf7e26437c68af2a4fcfa0fde68621

See more details on using hashes here.

File details

Details for the file eling-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: eling-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eling-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c9c5b104a8c06652a1916a90a00ef0a5c09037057e94069d26bc70228a8581ad
MD5 9f6646c54f606c3e576d7e06a827ac31
BLAKE2b-256 a69dd343236cf6a55cc66b72cbeb116eea8386e8a10150a1fb585bb065652aed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page