MCPcopy Index your code
hub / github.com/eric-tramel/moraine

github.com/eric-tramel/moraine @v0.6.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.4 ↗ · + Follow
3,097 symbols 9,434 edges 158 files 102 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Moraine

Moraine Banner

Docs

Moraine is a local trace stack for agent work. It indexes sessions from agent harnesses such as Codex, Claude Code, Kimi CLI, OpenCode, Hermes, and Pi Coding Agent into ClickHouse, serves a monitor UI, and exposes MCP retrieval over the indexed history.

Agents get searchable long-term memory through MCP. You get a unified local record of what happened across providers, including tools, tokens, and conversation history.

Moraine is under active development. Config keys, schemas, and MCP tools can change across minor releases.

Screenshots

Moraine monitor session overview

Moraine monitor trace details

Documentation

Supported Agent Harnesses

Moraine ships session trace ingestion adapters for these agent harnesses:

Harness Config value Session traces ingested
Codex codex JSONL session files under ~/.codex/sessions
Claude Code claude-code JSONL project session files under ~/.claude/projects
Kimi CLI kimi-cli wire.jsonl session traces under ~/.kimi/sessions
OpenCode opencode SQLite session history from ~/.local/share/opencode/opencode*.db (default on; opencode_sqlite format)
Cursor cursor Agent transcript JSONL under ~/.cursor/projects (default on); Cursor IDE chat history from state.vscdb SQLite databases (default on; cursor_sqlite format)
Hermes hermes Live session JSON and trajectory JSONL traces
Pi Coding Agent pi-coding-agent JSONL session trees under ~/.pi/agent/sessions

Quickstart

uv tool install moraine-cli
moraine setup
moraine up

moraine setup creates or repairs ~/.moraine/config.toml and guides plugin or MCP registration for detected agent harnesses.

The monitor UI runs at http://127.0.0.1:8080 by default.

For release bundles, upgrades, project-scoped setup, and other harnesses, see the Quickstart and Installation.

Connect Agent Harnesses

Use moraine setup to install or update the Moraine plugins for Claude Code, Codex, and Hermes, or to register Moraine MCP for supported harnesses such as OpenCode, Cursor, Kimi CLI, and Pi Coding Agent. The integrations use the moraine CLI on your PATH and the running local stack.

Start a new agent session after installing an integration. Claude Code, Codex, and Hermes sessions get moraine:session-search, moraine:realtime-peek, and moraine:bug-report guidance, and Moraine MCP tools are exposed with each harness's MCP naming scheme. Then ask:

What are my agents doing right now?

The user-scoped plugins can search the host-wide Moraine history visible to your user. For project-scoped setup, duplicate MCP cleanup, and other clients, see Agent MCP Search.

Agent Harness Guidance

The Claude Code, Codex, and Hermes plugins already bundle Moraine search guidance. If you use manual MCP registration or another harness, add the following guidance to your global harness instructions, such as ~/.codex/AGENTS.md for Codex or ~/.claude/CLAUDE.md for Claude Code:

- You have access to all past agent sessions (whether codex, claude, hermes, etc., anything) via moraine search tools.
- Any time the user asks about information not located within your context, that you can't see or don't know, but implies that you *should* know, it is because it was a past conversation. You can reference and search for this conversation with moraine search tools or session listing.
- Moraine search tooling is built around BM25 keyword search, so target your queries to keywords rather than questions. There is no semantic search.
- Successful keyword searches often go from broad to narrow. Sometimes this narrowing isn't successful, in which case, you can always back up and try a different path.
- Moraine has a *real-time* view of agent sessions. You can use it to peek on active AI agent sessions, including your own, sessions running in different harnesses, sessions that are sub-agents of your current conversation, or even their subagents. All agent work, in realtime, is visible to you.

With this you can do operations like the following:

claude -p "What are my agents doing right now?"
codex exec "What are my agents doing right now?"
hermes -z "What are my agents doing right now?"

Development

cargo build --workspace --locked
cargo test --workspace --locked
cargo fmt --all -- --check

The repository-managed pre-commit hook can be installed with:

make hooks-install

To put the current checkout (tip-of-branch, no tagged release needed) onto your host for testing, build and install it over the active moraine on your PATH:

make install

This release-builds the host target and installs through the same scripts/install.sh path end users get. ClickHouse is skipped by default (make install INSTALL_ARGS="--with-clickhouse" to include it). See scripts/dev/install-host.sh --help for the full set of options.

Extension points exported contracts — how you extend this code

IngestSource (Interface)
(no doc) [7 implementers]
crates/moraine-ingest-core/src/sources/mod.rs
CommandRunner (Interface)
(no doc) [2 implementers]
apps/moraine/src/commands/setup.rs
ConversationRepository (Interface)
(no doc) [1 implementers]
crates/moraine-conversations/src/repo.rs
RangeOption (Interface)
(no doc)
web/monitor/src/lib/types/ui.ts
Harness (Interface)
(no doc)
web/monitor/src/lib/types/sessions.ts
UserStep (Interface)
(no doc)
web/monitor/src/lib/types/sessions.ts
AssistantStep (Interface)
(no doc)
web/monitor/src/lib/types/sessions.ts
ThinkingStep (Interface)
(no doc)
web/monitor/src/lib/types/sessions.ts

Core symbols most depended-on inside this repo

get
called by 1094
crates/moraine-ingest-core/src/sources/mod.rs
is_empty
called by 509
crates/moraine-ingest-core/src/sources/record_view.rs
to_str
called by 174
crates/moraine-ingest-core/src/sources/shared.rs
ok
called by 111
apps/moraine/src/commands/setup.rs
append
called by 110
crates/moraine-ingest-core/src/sources/mod.rs
lock
called by 91
crates/moraine-ingest-core/src/sqlite_poll.rs
push_event
called by 64
crates/moraine-ingest-core/src/sources/mod.rs
to_str
called by 60
rust/ingestor/src/normalize.rs

Shape

Function 1,981
Method 683
Class 338
Enum 59
Interface 36

Languages

Rust89%
Python9%
TypeScript3%

Modules by API surface

apps/moraine/src/commands/setup.rs190 symbols
crates/moraine-config/src/lib.rs141 symbols
crates/moraine-ingest-core/src/sources/shared.rs106 symbols
crates/moraine-mcp-core/src/contract.rs97 symbols
crates/moraine-clickhouse/src/lib.rs89 symbols
crates/moraine-monitor-core/src/lib.rs79 symbols
crates/moraine-ingest-core/src/sources/emitter.rs76 symbols
crates/moraine-ingest-core/src/sqlite_poll.rs73 symbols
crates/moraine-ingest-core/src/tee.rs65 symbols
crates/moraine-ingest-core/src/sink.rs64 symbols
apps/moraine/src/commands/export.rs63 symbols
crates/moraine-ingest-core/src/dispatch.rs61 symbols

For agents

$ claude mcp add moraine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact