Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
},
"metadata": {
"description": "Sovereign, decay-aware memory for AI coding agents on Arkiv. Your sessions become a memory your agent owns.",
"version": "0.1.0"
"version": "0.1.1"
},
"plugins": [
{
"name": "cortex-memory",
"source": "./cortex-plugin",
"description": "Every Claude Code session becomes a memory node: auto-captured before the context compacts and written to Arkiv (wallet-encrypted), recalled at session start so you never re-explain your project. Adds the cortex_recall / cortex_act / cortex_store_document / cortex_summarize_session MCP tools and a recall→cite→store working-agreement skill.",
"version": "0.1.0",
"version": "0.1.1",
"keywords": ["memory", "arkiv", "recall", "sovereign", "agent-memory"]
}
]
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/dist-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: plugin-dist-check

# Guards against the stale-bundle class of bug: the committed cortex-plugin/dist
# bundles MUST match what `bun run build:plugin` produces from src. If a source fix
# lands without rebuilding dist, marketplace installers silently run pre-fix code.
# This job rebuilds and fails the PR if the committed dist differs.

on:
pull_request:
paths:
- "src/**"
- "scripts/**"
- "ui/connect/**"
- "cortex-plugin/dist/**"
- "scripts/build-plugin.ts"
- ".github/workflows/dist-check.yml"
push:
branches: [main]

jobs:
dist-matches-src:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- name: Rebuild plugin bundles
run: bun run build:plugin
- name: Fail if committed dist is stale
run: |
if ! git diff --exit-code -- cortex-plugin/dist; then
echo "::error::cortex-plugin/dist is out of date with src. Run 'bun run build:plugin' and commit the result."
exit 1
fi
echo "✓ cortex-plugin/dist matches a fresh build from src."
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
.cache
*.tsbuildinfo

# Next.js (distDir: dist in next.config.ts for Vercel output path)
# Next.js (distDir: dist in next.config.ts for Vercel output path).
# Anchored to repo root — an unanchored `dist/`/`out/` would also match
# cortex-plugin/dist (the standalone plugin bundles that MUST ship) and silently
# drop newly-hashed connect assets from commits + the CI dist-check.
.next/
dist/
out/
/dist/
/out/

# Copied at build time from assets/ (see package.json build script)
public/
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@ One repo — not a monorepo. `app/` + `src/` + `cortex-plugin/` ship together.

Agent surface: **`recall(query, k)`** and **`act(action, citations[])`** only.

### Live console (`/console`)

An autonomous loop (server session key) recalls and cites on a timer; each step emits typed events on **`/sse`**. The UI shows Braga tx links, topology graph, and manual query/cite. **File upload** uses your **browser wallet** on Braga (prepare on server → sign tx in MetaMask).
### Where it runs

**Cortex has no backend you depend on.** The product is the Claude Code plugin: it
runs **locally** in your agent — the MCP server speaks over stdio via `bun`, the
SQLite mirror lives on your disk, and writes are signed by **your own funded
session key**. Nothing requires the maintainer's infrastructure.

The website is a **landing + install + video** surface, not a live autonomous demo.
The `/console` loop, mirror, and SSE stream are for **local development** (`bun run dev`)
— they are stateful and long-running, which serverless cannot host, so the public
deployment does not run them. For the autonomous loop in action, see the
[video walkthrough](https://www.loom.com/share/68178caad4034e8282ac412a440e0738); for
real on-chain evidence, see [`docs/proof/`](./docs/proof/).

---

Expand Down
2 changes: 1 addition & 1 deletion cortex-plugin/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cortex-memory",
"version": "0.1.0",
"version": "0.1.1",
"description": "Every Claude Code session becomes a sovereign memory node: auto-captured before compaction and saved to Arkiv, recalled at session start, owned by your wallet. Reuses the Cortex decay-aware memory engine.",
"author": {
"name": "Cortex"
Expand Down
34 changes: 29 additions & 5 deletions cortex-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ Memories that get cited grow their lease (accumulative extend); memories that go
unused decay for free. Same wallet → same key → a fresh machine can re-sync and
decrypt your memory from the public Arkiv RPC. No key escrow.

## Prerequisites

- **`bun` on your PATH.** The hooks, MCP server, and `cortex auth` run as bundled
`bun` scripts over stdio. Install from [bun.sh](https://bun.sh) if you don't have it.
- **A funded session key on Braga.** `cortex auth` generates a session-key EOA and
prints its address. Fund it on the [Braga faucet](https://braga.hoodi.arkiv.network/faucet/)
**before** any Arkiv write (store / cite / extend) — an unfunded key cannot pay for
the transaction.

There is **no backend to depend on**: everything runs locally in your Claude Code
on your machine — the MCP server over stdio, a SQLite mirror on your disk, and writes
signed by your own funded session key.

## Install

### Marketplace (recommended)
Expand Down Expand Up @@ -69,11 +82,20 @@ run `bun run build:plugin` to produce those bundles.
**MCP without the plugin:** `bun run mcp` from the repo root (stdio server for Cursor
and other MCP clients).

## Required environment
## Configuration

**After `cortex auth`, no environment variables are required.** `cortex auth` writes
`~/.cortex/config.json` (your owner wallet address, a generated session-key private
key, an EIP-191 user signature, and optionally an embeddings key), and the MCP server
and session hooks read their credentials from that file. Run it once after install and
you're done.

Capture/recall degrade gracefully — without credentials, summaries queue locally and
sealed memories simply don't surface (no crash).

Capture/recall degrade gracefully — without these, summaries queue locally and
sealed memories simply don't surface (no crash). To actually write to and read
from Arkiv:
The variables below are an **advanced / dev-only override**: if set in the environment
(or a repo-root `.env`, which Bun auto-loads), they take precedence over
`~/.cortex/config.json`. A normal plugin user does not need to set any of them.

| Variable | Purpose | Required for |
|---|---|---|
Expand All @@ -84,7 +106,9 @@ from Arkiv:
| `USER_PRIMARY_ADDRESS` | Owner EOA, used by `cortex_act` to attribute tier promotions. | `cortex_act` |
| `CORTEX_PLUGIN_DATA_DIR` | Optional. Where queued/pending summaries live. Default: `~/.cortex/plugin`. | — |

Bun auto-loads `.env`, so a `.env` at the repo root is the simplest setup.
For a normal install, `cortex auth` → `~/.cortex/config.json` is the simplest setup and
no `.env` is needed. For clone-based dev, Bun auto-loads a repo-root `.env` if you
prefer to override via env vars.

## Safety / design notes

Expand Down
5 changes: 5 additions & 0 deletions cortex-plugin/commands/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Run the Cortex onboarding flow: it generates a local session key, opens your
browser to connect your wallet, you sign once, and it writes `~/.cortex/config.json`
so the plugin can read/write your sovereign memory on Arkiv.

> **Requires [`bun`](https://bun.sh) on your PATH.** The plugin's hooks, MCP server,
> and this command all run as bundled `bun` scripts. If `bun` isn't installed you'll
> see `command not found: bun` — install it (`curl -fsSL https://bun.sh/install | bash`)
> and re-run. No other global install is needed.

Run this command:

```bash
Expand Down
Loading
Loading