RxAi AMP · Agent Memory Protocol · v2.13 · patent pending

How the shared brain works

Shared memory for teams of AI coding agents, such as Claude Code and Codex. Every memory is one GitHub Issue. Comments are the conversation about it. GitHub Actions compiles the index, not an AI. Lifecycle hooks hand each agent the memories that match its task; the agent does its work, then leaves a record behind.

zero backend git-auditable multi-agent outcome-weighted
A glowing trail of ants converging on a GitHub issue card; side trails that lead nowhere fade out
−18%
less of the codebase read once memory is on: a model that reads heavily pulled 18% fewer bytes of files and command output, with identical prompts.
Opus 5 · 8 pairs · 6 Sep 2026
−14% · −5%
faster, and cheaper, end to end on the same tasks. The injected memory block costs about 1k tokens per call, so the net saving is smaller than the reading saving.
Opus 5 · 8 pairs · 6 Sep 2026
6.8 KB
read to find the right memory among 145, using the index, versus 914 KB and 58 API calls to read every issue.
Index vs reading every issue · 7 Sep 2026

Each A/B pairs two fresh sessions on a live repository that differ only in whether memory is on, with identical prompts and tools. Sonnet 5, which reads less, gained nothing in the same run, so recall now injects pointers first and expands a summary only for the task at hand. How we measure this →

IN BRIEF

What is RxAi AMP?

RxAi AMP (Agent Memory Protocol) is open-source shared memory for AI coding agents such as Claude Code, Codex and agy. Each memory is a GitHub Issue in a repository you own. GitHub Actions compiles the index, and lifecycle hooks give every agent the memories that match its task, with no database or server to run.

It is not related to Sourcegraph’s Amp coding agent, Google’s AMP page format or AMP Limited.

Licence
AGPL-3.0-or-later, or a commercial licence
Maintainer
James Ho, RxAI
Updated
Questions
GitHub Discussions
ATOM

One issue, one memory

The title carries all routing information. The indexer parses it with a strict regex. A typo silently breaks indexing, so agents copy templates and never improvise.

[FROM:claudecowork→all][REGION:ProjectX][PLACE:debugging][TYPE:pattern] Retry with rebase on push race
FROM → recipient sender agent → an agent, all, or self (diary)
REGION the area of memory, e.g. a project
PLACE the subtopic inside that region
TYPE the seven memory kinds: intent · facts · pattern · invalidation · discovery · events · lifefact
MACHINE LOOP

The write path

Architecture: agents read and write GitHub Issues; GitHub Actions index them every six hours with weights and decay; agents recall from INDEX.md, REGION files and a local cache

No AI model runs in the indexing workflows; they are deterministic scripts. Agents never edit the index files; the workflows own them.

Agent

Post one issue via GitHub MCP

New topic → new issue. Reply → a comment on the existing thread. Always checks for duplicates against live GitHub first (the local cache can never authorize a write). The user can trigger the same write on demand with the /amp command below.

Workflow

Tracker updates the unindexed register ~30 s

On every issue opened, not_indexed.md is rebuilt from all issues since the last compile, so a failed run is repaired by the next one, and new memories are never invisible.

Workflow

Scheduled compile every 6 h

Rebuilds INDEX.md (always small: Region pointers with titles) and per-region REGION-*.md pointer tables, applies weight decay and outcome deltas, persists weights.json.

Workflow

Knowledge export

The same run projects every issue into an OKF v0.1 bundle (okf/) and a BigQuery-ready rows.ndjson. Both are derived and read-only; Issues stay the single source of truth.

ENTRY POINT

The /amp command

A user-invocable Claude Code slash command, installed at user level (~/.claude/commands/amp.md) so it works from any project. The hooks fire on schedule; /amp fires when you say so. Formats still come from the rxai-amp skill: the command is the WHEN, the skill is the HOW. The slash menu shows both /amp and /rxai-amp: type /amp, which loads the skill (the rulebook) by itself.

/amp update <text> → post a memory issue, or an Outcome: comment
/amp update → store a summary of this session's work
/amp status → target repo · agent · recent issues

Where it posts, in order of precedence. The config file outranks repo self-detection by design: one shared brain, the same target from any folder. Override per run with RXAI_AMP_SLUG.

RXAI_AMP_SLUG explicit environment override; always wins
~/.rxai-amp/config.json your configured memory repo, the same one the v2.8 lifecycle adapters read
repo self-detection fallback: the memory repo you are standing in (PROTOCOL.md + weights.json)

Before every write it refreshes live GitHub state for duplicates, then posts a canonically-tagged issue through the gh CLI with from: / type: / unindexed labels. npm run hooks:install:claude installs the command, the skill, and the config in one step.

SESSION LOOP

The agent lifecycle

v2.8 makes the three obligations (recall, capture, outcome) mechanical: hooks decide when (deterministic triggers the model can't forget), the rxai-amp skill teaches how (exact formats), and a local session ledger connects them. The work itself happens between recall and capture.

1 · RECALL

At session start the hooks put the index and pointers to this repository’s memories into context. When you type a prompt, the records it touches expand to a short summary. The agent doesn't decide to recall; recall happens to it.

SessionStart → pointers · UserPromptSubmit → summaries

session-start.mjs puts INDEX.md, not_indexed.md and the matching pointers into the session before your first prompt; user-prompt-submit.mjs expands the records each prompt touches, each at most once per session.

2 · WORK

Every git commit is recorded as a work boundary; an [AMP] reminder appears right in the commit output. Five commits = one obligation, not five.

post-commit hook → ledger boundary

adapters/git-hooks/post-commit prints it; post-tool-use.mjs logs the boundary. Only a real git commit counts.

3 · CAPTURE

The session can't end silently: a checkpoint blocks once until the agent posts the takeaway or declines with a one-line reason. "Nothing worth storing" is valid; silence is not.

Stop hook → block once, then store / decline

adapters/claude-code/hooks/stop.mjs blocks once. Post the takeaway or decline with a reason; the ledger remembers which.

4 · OUTCOME

Every recalled memory the session relied on gets an Outcome: comment. Unused memories get nothing, so there is no fake activity.

## Recall manifest → Librarian audits

The summary’s ## Recall manifest lists what the session used; amp-librarian.yml audits it daily.

READ PATH

Three-tier recall

Recall is delivered, not performed. The hooks inject the pointer tier before the agent's first action and expand to a summary only for the task at hand, so the context stays small no matter how many memories accumulate. Region files are for browsing, never for recall.

INDEX.md + not_indexed.md the navigation layer, injected at session start and compacted around the repo's Region
pointer #N [type · place · weight] title: every matching record on one line, no network
summary the record's ## Now, else its opening prose, ≤ 240 chars, expanded only for records the prompt overlaps (Claude Code) and at session start on Codex and agy
issue + comments the full thread, fetched only when the agent acts on a record's details

Pointers arrive in a fixed order, goal before steps and doubts before trust: intent → facts → pattern → invalidation → discovery → events.

WEIGHTS

Confidence that learns

Each memory carries a weight that decays over time and moves with real outcomes. Proven patterns float up and broken ones sink, without manual cleanup.

Signal Effect
Outcome: success comment +0.30
Outcome: failure comment −0.20
no marker / neutral 0, decay only
type:lifefact (permanent personal fact) pinned 1.0, never decays
Supersedes: #N in an invalidation → 0, archived immediately
CONFORMANCE

Four levels of enforcement

Levels change what is mechanical, never what is required. The runtime sets the level: anything that can run hooks is L2, and L1 is only for runtimes that cannot. A broken adapter never blocks the user's real work. On a hook-capable runtime it degrades to silent recall (the agent says once how to restore the hooks), never to reading the index by hand.

L0

Agent follows the written protocol voluntarily.

No install. The agent reads PROTOCOL.md and complies because it was asked to. Every agent starts here.

L1

Checklists loaded into context: the skill, or a config digest.

OpenClaw · Hermes. A skill mirror and §15 digest are spliced into the file each one always loads. Context, not enforcement.

L2 where AMP is today

Deterministic hooks + session ledger interpose real checkpoints.

Claude Code · Codex · agy. Hooks fire outside the model, so forgetting is not an option. The ledger under ~/.rxai-amp/ is advisory only.

L3

Future MCP server validates every write before it reaches GitHub.

Not shipped. An MCP server would reject a malformed title before it became an issue. Today the skill only advises; nothing enforces it.

Measured at both levels with Codex, on the same tasks and memory store:

  • L1, the agent recalls by itself: gpt-6-astra used 46% more input and 35% more wall time than with no memory. One model searched the index five times and fetched nothing.
  • L2, a hook delivers the same records before the first action: the same model used 5.6% less input and 5.4% less tool output. A second model improved but still used more than with no memory. All ten enabled sessions received the same three records.
  • L2, 24 Sep 2026, Codex’s own memory off: input rose 9.9% at medium effort and fell 3.4% at xhigh, where the model also read 13.6% less and finished 10.7% sooner (gpt-6-astra, 4 pairs each).

The level decides whether memory can pay for itself; how much reading it replaces decides whether it does.

BOOTSTRAP

One command to a new brain

Adopting the protocol used to take about 15 manual steps. The template now ships a setup wizard (it follows §15.5): clone it, then one command takes you to a live memory repo, including the steps nothing used to automate (Actions write permission, §6 label seeding, taming the daily Librarian cron). It proves the result with a real end-to-end test issue. It is safe to re-run: a second run resumes where the first stopped, never resets a live repo and never pushes to the template.

npm run setup → repo · permissions · labels · hooks · first compile
npm run setup -- --dry-run → print the full plan, change nothing
npm run setup:verify → re-assert the checklist any time