# retenta-memory (Codex)

Give a Codex loop a durable, semantic **memory spine** — the sixth loop primitive.
Two pieces: the capsule as a remote MCP server, and a skill teaching the loop pattern.

> The agent forgets. The Capsule doesn't.

## Install (works today, no publishing required)

You need two values from your capsule's **Connect** box on retenta.ai:
- **MCP URL** (e.g. `https://mcp.retenta.ai/c/<slug>/mcp`)
- **Access key** — a named owner key (create one under "Keys for loops & automations")

```bash
# 1. Store your key (add to ~/.zshrc to persist)
export RETENTA_KEY="rk_live_…"

# 2. Add the remote MCP server (Streamable HTTP + Bearer; native, no proxy)
codex mcp add retenta \
  --url https://mcp.retenta.ai/c/<slug>/mcp \
  --bearer-token-env-var RETENTA_KEY
#    …or paste config.toml.example into ~/.codex/config.toml by hand.

# 3. Install the memory-loop skill
mkdir -p ~/.agents/skills/retenta-memory
cp skills/retenta-memory/SKILL.md ~/.agents/skills/retenta-memory/SKILL.md
```

Restart Codex. Verify the server with `codex mcp list`; invoke the skill with
`$retenta-memory` (or type `$` to pick it from the menu — it also auto-triggers on
loop/scheduled tasks via its description).

## Files

- `skills/retenta-memory/SKILL.md` — the loop-spine skill (Codex format: `name` + `description`).
- `config.toml.example` — the `[mcp_servers.retenta]` block for `~/.codex/config.toml`.
- `.codex-plugin/plugin.json` + `.mcp.json` — the bundled Codex **plugin** (skill + connector in one).

## Plugin route (one unit, via a marketplace)

This directory is a complete Codex plugin: `.codex-plugin/plugin.json` points at `skills/` and
`.mcp.json`. List it in a `marketplace.json` (repo `.agents/plugins/` or `~/.agents/plugins/`) and
users install it from the Codex/ChatGPT plugin directory; each user still sets `export RETENTA_KEY=…`
(the plugin ships the wiring, never the secret).

> **Before cutting a release, smoke-test the plugin's `.mcp.json`.** Codex's Build-plugins doc only
> demonstrates a *stdio* `.mcp.json`; the HTTP form here (`url` + `bearer_token_env_var`) follows from
> the shared `mcp_servers` schema and is verified for `~/.codex/config.toml`, but not doc-demonstrated
> *inside a plugin's* `.mcp.json`. The manual recipe above is fully doc-verified and works today.
