atheneum 0.3.1

Agent coordination graph database - episodic and semantic memory for multi-agent workflows
Documentation

Atheneum

Embedded graph database for agent coordination — episodic memory, knowledge persistence, and session accountability across coding sessions.

Part of the grounded-coding ecosystem. Used as the storage layer inside envoy.

Ecosystem

grounded-coding ── install + Claude Code plugin (skills, hooks, MCP)
       │
       ├── magellan   ── code graph indexer (symbols, call graph, CFG)
       ├── llmgrep    ── semantic code search over magellan graphs
       ├── mirage     ── CFG analysis (paths, loops, dominance)
       ├── splice     ── span-safe refactoring
       │
       ├── envoy      ── HTTP coordination server (messaging, agent registry)
       │     └── atheneum  ◀── YOU ARE HERE
       │           └── sqlitegraph  ── SQLite graph engine
       │
       └── envoy-hook ── Claude Code hook binary (session + tool call logging)

Atheneum is the persistence layer. It stores what agents discovered, what sessions did, what tasks exist, and what knowledge is worth keeping — so the next agent doesn't start from scratch.

Install

cargo add atheneum

Atheneum is a library. Production use is via agent-envoy which exposes all endpoints over HTTP (envoy binary). Direct embedding is for custom runtimes.

Quickstart

use atheneum::AtheneumGraph;
use std::path::Path;

let graph = AtheneumGraph::open(Path::new("atheneum.db"))?;

// Record a session
graph.record_session(atheneum::graph::SessionParams {
    session_id: "abc-123".into(),
    agent_name: "claude-main".into(),
    project: "my-project".into(),
    tool: "claude-code".into(),
    trigger: "cli".into(),
    model: Some("claude-sonnet-4".into()),
    git_branch: Some("feat/auth".into()),
    git_head: None,
    parent_session_id: None,
})?;

// Store a discovery
use serde_json::json;
graph.store_discovery("claude", "Bug", "query_sessions", json!({
    "file": "src/graph/evidence.rs",
    "line": 547,
    "why": "anonymous ? params required when project is None and parent_id is Some",
    "project_id": "my-project"
}))?;

// Query recent sessions for a project
let sessions = graph.query_sessions("my-project", 3, None)?;
for s in &sessions {
    println!("{} {} {}tc", s.started_at, s.git_branch.as_deref().unwrap_or("?"), s.tool_call_count);
}

// Ingest a wiki article
let content = "---\ntitle: My Note\n---\n# My Note\nSee also [[Related Concept]].\n";
graph.ingest_wiki_page("my-note.md", content, None)?;

What It Stores

Domain Types
Sessions start, end, tool calls, file writes, commits, test runs, cost
Discoveries facts, decisions, bugs, invariants — scoped by project
Knowledge wiki pages, journal sections, wikilinks
Planning tasks, requirements, blockers, kanban state
Handoffs inter-agent state transfers with manifests
Ontology class/property schemas for typed entity reasoning
Search index FTS5 full-text + HNSW lexical index (hash-projected tokens, not neural)

HTTP Access

When embedded in envoy, all atheneum operations are accessible over HTTP:

# Query recent sessions
curl "http://127.0.0.1:9876/atheneum/sessions?project=my-project&last=3"

# Store a discovery
curl -X POST http://127.0.0.1:9876/atheneum/discoveries \
  -H "X-Agent-Id: $GROUNDED_AGENT_ID" \
  -H "content-type: application/json" \
  -d '{"agent":"claude","discovery_type":"Decision","target":"auth","metadata":{"why":"..."}}'

# Get recent project context (for session bootstrap hooks)
curl "http://127.0.0.1:9876/atheneum/context?project=my-project&limit=6"

See envoy's API.md for the full HTTP reference.

HopGraph

HopGraph is atheneum's retrieval model: embeddings find the door, graph walk retrieves the room.

  1. A text query is embedded and matched against the lexical index to find entry-point entities.
  2. From each hit, a BFS walk expands the subgraph — following only allowed edge types (e.g., Explains, Wikilink).
  3. The result is truncated to a token budget so it fits in a context window.
use atheneum::graph::{AtheneumGraph, hopgraph_query, EdgeType};
use std::path::Path;

let graph = AtheneumGraph::open(Path::new("atheneum.db"))?;

// Token-budgeted HopGraph query — walk only Explains + Wikilink edges
let views = graph.hopgraph_query(
    "session accountability",
    3,        // k: max entry points
    2,        // depth: BFS depth
    Some(&[EdgeType::Explains, EdgeType::Wikilink]),
    2000,     // max_tokens per view
    None,     // project_id
)?;

for view in &views {
    println!("entry: {} ({} entities, {} edges)",
        view.entry_id, view.entities.len(), view.edges.len());
}

// Switch to neural embeddings (requires ollama + nomic-embed-text)
#[cfg(feature = "neural-embed")]
{
    use atheneum::graph::OllamaEmbedder;
    graph.set_embedder(Box::new(OllamaEmbedder::nomic_embed_text()));
    graph.build_search_index()?; // rebuild with new dimension
}

Discovery Consolidation

// Merge all Discovery entities for a target into a single Knowledge entity
let knowledge_id = graph.consolidate_discoveries("query_sessions", Some("my-project"))?;

// Consolidate all targets at once
let results = graph.consolidation_pass(Some("my-project"))?;
for (target, kid) in &results {
    println!("{} → knowledge {}", target, kid);
}

Bridge Wiki to Code Symbols

// Link wiki [[wikilinks]] to magellan-indexed code symbols
graph.link_wiki_to_symbols(
    "/path/to/magellan.db",
    "claude",
    Some("my-project"),
)?;

Features

Feature Default Description
default Core graph, wiki, sessions, planning, search
neural-embed Ollama neural embeddings (requires ureq, ollama + nomic-embed-text)
web Web dashboard (axum + askama templates)
cli atheneum CLI binary
async Async runtime support

CLI

atheneum sync-wiki    <db> <dir> [project]
atheneum sync-journal <db> <dir> [project]
atheneum sync-logseq  <db> <wiki-root> [project]
atheneum sync-claude-transcript <db> <transcript.jsonl> [project] [agent]
atheneum query-wiki   <db> <path>
atheneum query-journal <db> <path>
atheneum graph-stats  <db>
atheneum entity       <db> <entity-id>
atheneum edge         <db> <edge-id>
atheneum neighbors    <db> <entity-id> [--depth N]
atheneum navigate     <db> "<query>" [--k N] [--depth N] [--project P]

sync-logseq recursively ingests <wiki-root>/pages/**/*.md as wiki pages and <wiki-root>/journals/**/*.md as journal sections. Wiki [[links]] become first-class wikilink graph edges so navigate and neighbors can traverse article relationships.

sync-claude-transcript imports a local Claude Code transcript JSONL into Atheneum's session graph. It records prompt/chat summaries, observed tool calls, accessed file edges for Read/Edit/Write, and session token/cache totals. Re-running the command on the same append-only transcript imports only new lines.

Requirements

  • Rust 1.75+
  • SQLite 3.35+ with JSON1 (bundled via rusqlite)

Related

License

GPL-3.0-only — see LICENSE.