The subconscious
that runs
beneath your
agent.

Real memory is associative. It fires on its own. Undertow watches every turn, builds a graph of what matters, and surfaces small flashes of context the moment they become relevant — without ever being asked.

What the agent sees

A flash is small,
specific, and uninvited.

When you submit a prompt, the daemons run in parallel — vector, graph traversal, temporal, contradiction, ambient research. The agent receives a single compact note before it sees your message. No tool call. No ceremony. Just resonance.

~ You're sketching an audit-trail schema. You closed this exact loop three weeks ago in a different repo with CQRS — the decision rationale is still in the graph.

~ This Postgres lock pattern bit you on another project last quarter. You fixed it then with a deferred trigger.


[decision] CQRS for audit trail · vector + graph
[episode] Postgres lock incident · temporal
[insight] Write-contention pattern · bridge node

Eight daemons

A swarm,
not a service.

Each does one thing. The graph is the lake; the daemons are the actors — reading what they need, writing what they learn, never speaking to your agent directly. They run on hooks (UserPromptSubmit, PostToolUse, Stop) and disappear. Hover/Click any of them.

i.

Wonder

Upstream · Proactive

Reads the transcript between turns, pre-warms candidate flashes for the next prompt.

Stop hook

ii.

Impulse

Upstream · Reactive

The flash-crafting pipeline — vector search, graph traversal, scoring, Haiku judgment.

UserPromptSubmit

iii.

Gobble

Input

Consumes tool events, files, URLs. Turns raw activity into typed neurons with bodies.

PostToolUse

iv.

Dreamer

Downstream

Processes the finished turn — pursuits, train-of-thought, contradiction surfacing.

Stop hook

v.

Spider

Downstream · Idle

Walks the graph at rest. Discovers edges, prunes weak ones, pre-computes GDS scores.

Session end

vi.

Prowler

Bidirectional

Brave Search for fast lookups; Perplexity for the genuinely research-worthy prompts.

Query / Stop

vii.

Janitor

Downstream · Idle

Content-quality pass. Removes thin neurons that slip past the ingestion gate.

Session end

viii.

Tapestry

Projection

Materializes the graph into a navigable Obsidian vault. One page per neuron, wikilinks for synapses, cluster pages from communities.

Manual

Under the hood

What you're
actually installing.

You smell something — old paper, garlic in a pan, a particular shampoo — and instantly remember someone you haven't thought about in fifteen years. Nothing asked your mind to do that. The memory just fires, an unsolicited associative leap from a sensory token to a person you'd otherwise need a quiet hour to summon. Undertow is that mechanism, but for the Claude Code session running on your machine right now. Here is how it does it.

01 — The graph

One Neo4j container, doing two jobs at once.

Neo4j Community Edition runs in Docker Desktop on your machine. Free, local, no SaaS — your graph never leaves the box. One database covers both retrieval modes Undertow needs.

Relational topology. Neurons (memory units) connected by typed synapses — associative, temporal, causal, contradicts. Cypher walks the graph. Bridge nodes connecting otherwise unrelated clusters are how the genuinely surprising recalls happen — the connection between two topics that share no obvious similarity, no direct link, no common tag.

Native vector index. Every neuron's flash summary is embedded by Gemini and stored on the same node. Same database, two retrieval modalities — semantic similarity and graph traversal — running in parallel against one source of truth. Neither is sufficient on its own; together they cover both "feels related" and "is structurally connected."

02 — The collection

Claude Code hooks. You don't lift a finger.

Five hook events do the work invisibly: UserPromptSubmit, PostToolUse, Stop, SessionStart, PostCompact. They fire as you work — every prompt, every tool result, every turn boundary, every session resume.

You don't run an indexer. You don't tag entries. You don't decide what's worth remembering. A Haiku-sized model judges each event against a substance threshold, writes neurons that have real content (a fact, a decision, an insight, a reasoning chain), and skips routine noise. The graph grows because you're working, not because you stopped to feed it.

03 — The recall

Memory arrives before the model reads your prompt.

This is the hinge — the thing no other memory system does. Every competitor (Mem0, Letta, Cognee, ChatGPT memory) is a tool the agent can choose to call: it decides it needs context, fires a tool, waits, integrates, continues. Deliberate. Slow. And it only happens when the agent thinks to ask.

Undertow doesn't wait. The UserPromptSubmit hook intercepts your prompt, runs vector + graph + temporal + contradiction searches in parallel, has Haiku judge the candidates, and returns flashes as additionalContext attached to your message. By the time Claude reads what you typed, the relevant memory is already in the prompt. No tool call. No round trip. The agent never decided to look — it just knows.

04 — The runtime

One small Node.js service on localhost.

A Node.js HTTP server on localhost:3030 bridges Claude Code's hooks to Neo4j and dispatches to the daemon swarm. The whole engine is small enough to read in an evening — eight daemon plugins, a thin router, a query cache. No build step. No framework. Open the source in your editor and you can see why every flash decision got made.

The only outbound traffic is the model calls that judge your memories — Haiku for retrieval, Sonnet for summarization — calling Anthropic's API via your own API key. This is billed separately from your Claude Code subscription. Since April 2026, Anthropic subscription quotas cover only the first-party surfaces (Claude Code CLI, claude.ai, Desktop, Cowork); anything else that hits the API — Undertow's daemon brain included — draws from your standard API billing. Haiku does most of the work and it's cheap; expect roughly $0.20–$0.60 of API usage per active session on top of whatever your subscription covers. Nothing besides those judgment calls phones home.

A position

Freud described
the mind with
three layers.

i.

Superego.

System prompts. RLHF. Safety training. The voice of you should and you must not.

Every model has one

ii.

The ego.

The context window. The agent's conscious attention — what it is actively thinking about right now.

Every harness has one

iii.

The id.

Ambient. Associative. Unsolicited. The part of the mind that fires without being asked, surfacing memories that have no business being relevant — until suddenly they are. Every other memory system is a filing cabinet: you put something in, you ask for it back. This is the part everyone forgot to build.

Nobody is building this.
That's Undertow.

Everyone is asking whether AI is conscious.

We ask — is it subconscious?

Get started

Three steps.
Then forget about it.

Undertow runs as a local Node service. Neo4j ships in a Docker container. Your data never leaves the machine except for the model calls that judge it. After install, the daemons take over and you stop thinking about memory.

# 1. clone the repo
git clone https://github.com/RouterBox/Undertow

# 2. start neo4j
docker start neo4j

# 3. let claude wire it up
$ claude
> read INSTALL.md and set this up