ua-memory
Put the shape of the codebase in front of the agent before it starts looking.
A Claude Code and Codex plugin that is always on, like a memory plugin. A memory plugin
injects remembered facts. This injects code structure: at the start of every
session it adds a small architecture card saying what the project is, what its
layers are, and how fresh the map is.
It does not build the map. Understand-Anything builds the map. ua-memory
reads what UA already committed and forces it into the session — the part UA
does not do, because its graph is context-on-request behind slash commands.
Why a card, and why this size
The card supplies layer names and descriptions so the agent knows what to
ask about. File paths stay out of session context; Semble or
ua-memory layer <name> can retrieve them on demand. Layer counts include
all member node types, including schemas, tables, and documents.
The freshness line reports the map commit and how many files changed since it
was built. An unavailable diff is reported as unknown. The plugin does not
refresh the underlying Understand-Anything map.
CHAR_BUDGET in src/card.ts is a 9,500-character reference ceiling below
Claude Code's 10,000-character hook output cap. Names and descriptions are
never cut, so unusually verbose layer descriptions can still exceed it.
Install
claude
/plugin marketplace add jvsteiner/ua-memory
/plugin install ua-memory@ua-memory
Codex
codex plugin marketplace add jvsteiner/ua-memory
codex plugin add ua-memory@ua-memory
Open /hooks to review and trust ua-memory's SessionStart hook, then begin a
new Codex session. Codex receives the same bounded card as Claude Code. The
hook uses Codex's PLUGIN_ROOT variable and falls back to
CLAUDE_PLUGIN_ROOT, so one hook configuration serves both hosts.
The repo ships its own dist/, so it runs straight from a clone with no build
step. CI proves that committed output still matches src/.
You also need a map. In the repo you want mapped:
/understand
That writes .ua/knowledge-graph.json. With no map, ua-memory prints nothing
and exits cleanly — silence is the right behaviour in an unmapped repo.
Keep the map fresh
UA already does this, but it is off by default. Add to .ua/config.json:
{ "autoUpdate": true }
UA then compares the map's commit against HEAD at session start and refreshes
when source structure actually changed. It grades each changed file
NONE / COSMETIC / STRUCTURAL, so a comment edit does not trigger a rebuild.
omp / Pi
omp (@oh-my-pi/pi-coding-agent) borrows a lot from Claude Code — it loads
.claude/skills, .claude/commands, .claude/settings.json, CLAUDE.md, and
even hooks from Claude Code marketplace plugins. It does not run
SessionStart hooks: that bridge covers tool hooks only, and the string
SessionStart appears nowhere in the omp binary.
So the card reaches omp through an extension instead:
ua-memory omp install
That writes a three-line shim into ~/.omp/agent/extensions/ which re-exports
the adapter shipped in this package, by absolute path. All the real code stays
here, under test. Restart omp and the card is in its system prompt.
ua-memory omp status # where it is installed and what it loads
ua-memory omp uninstall # remove it
--dir <path> overrides the extensions directory.
The adapter hooks before_agent_start, the same seam pi-output-styles uses
to swap the personality slot. Measured behaviour: it fires once per user
message — a turn with two tool calls fires it once — and omp rebuilds the
system prompt from base each time, so nothing accumulates. The adapter still
checks for the card's heading before adding it, as cheap insurance rather than
because omp needs it.
Everything above the delivery seam — finding the map, rendering, trimming — is
the same code both agents run.
The CLI
The card says where things live. The CLI answers the follow-up questions. It
runs through Bash, so it costs nothing until it is called — which is why it is
a CLI and not an MCP server, whose tool definitions would spend tokens in every
session whether used or not.
ua-memory card the card itself
ua-memory where <text> find nodes by name, tag or summary
ua-memory file <path> what a file is, holds, and touches
ua-memory impact <path> what would feel a change to this file
ua-memory layer <name> one layer's description and its files
ua-memory stale files changed since the map was built
ua-memory tour the guided tour (~3,800 tokens)
ua-memory doctor map location, freshness, data problems
Options: --json, --depth <n> (impact, max 3), --limit <n> (where),
--root <path>.
What to trust
The card says this too, because an agent cannot tell by looking: