Skip to content
126 changes: 71 additions & 55 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Support tiers describe operational expectations for each adapter path:
| OpenCode 1 plugin | Supported | Primary reference adapter for lifecycle events and injection behavior. |
| OpenCode 2 plugin | Experimental | The beta entrypoint loads as an inactive compatibility shell; capture and injection are not enabled. |
| Claude hooks/plugin | Supported | Hook-first queue path with CLI/runtime fallback and parity slices tracked in adapter stack PRs. |
| Codex plugin (hooks + MCP) | Experimental (early beta) | Functional capture pipeline (`plugins/codex/`, `packages/core/src/codex-hooks.ts`) dogfooded end-to-end: edge normalization → `POST /api/raw-events` → observer → memories. Prompt-time injection present and env-gated but not fully validated on strict models. Not yet promoted to a stable support tier. |
| Codex plugin (hooks + MCP) | Supported | Functional capture pipeline (`plugins/codex/`, `packages/core/src/codex-hooks.ts`) dogfooded end-to-end: edge normalization → `POST /api/raw-events` → observer → memories. Prompt-time injection is present and env-gated but not fully validated on strict models. |
| Windsurf integration | Experimental | Planned via shared adapter contract after OpenCode/Claude stabilization. |
| Cursor integration | Experimental | Planned via shared adapter contract after OpenCode/Claude stabilization. |

Expand All @@ -72,7 +72,7 @@ Rollout sequencing:
2. Reach OpenCode parity on ingest + retrieval quality.
3. Ship Claude MVP, then close parity gaps (injection/capture/lifecycle).
4. Keep Claude in Supported tier by enforcing reliability and review gates.
5. Add additional adapters (Codex/Windsurf/Cursor) behind the same contract.
5. Add additional adapters (Windsurf/Cursor) behind the same contract.

Explicit non-goals:

Expand Down
59 changes: 59 additions & 0 deletions docs/docs-screenshots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Viewer Screenshot Guide

Use the synthetic viewer to capture the current generated UI without opening a real Codemem database or configuration.

## Start the fixture

Build the UI, then start the foreground fixture. It prints JSON containing a random loopback URL; open that URL in a dedicated CMux docs surface.

```fish
pnpm --filter @codemem/ui build
pnpm exec tsx --conditions source scripts/docs-viewer.ts
```

Leave that command running. In a second terminal, use the printed URL to create a browser surface, then copy the returned surface reference:

```fish
set viewer_url "http://127.0.0.1:<printed-port>"
cmux browser open "$viewer_url" --focus false --json
set surface "<returned-surface-ref>"
cmux browser --surface "$surface" viewport 1440 1050
cmux browser --surface "$surface" wait --text "Reject duplicate watering commands" --timeout-ms 10000
cmux browser --surface "$surface" snapshot --interactive
```

The launcher starts a sanitized child with a fresh temporary database containing six invented private memories for `atlas-notes` and `garden-api`. It disables embeddings, observer work, sweeper work, sync, and update checks, and blocks non-loopback server calls through `fetch`. That block does not cover other HTTP clients or raw sockets; the viewer also loads public CDN fonts and icons in the browser, so this is not a network sandbox.

The fixture serves the current working tree, including uncommitted UI changes. It is visual evidence only—not release evidence or validation of extraction or semantic-recall quality. Stop it with `ctrl-c`; its temporary runtime remains available for inspection. After stopping the fixture, verify the printed runtime belongs to this run before removing it manually; never substitute your normal Codemem directory.

## Capture

Use a dedicated docs workspace/surface, wait for the page to render, and capture only the browser viewport. A background CMux workspace can return text while its paint is suspended, producing a blank image.

Before **every** capture—and again after navigation or reload—inject this CSS. It hides only the fixture database-path line; it does not change memory text or controls.

```fish
cmux browser --surface "$surface" addstyle '#metaLine { visibility: hidden !important; }'
```

Create an inspection directory and write captures there first:

```fish
mkdir -p .tmp/docs-screenshots
cmux browser --surface "$surface" screenshot --out ".tmp/docs-screenshots/docs-feed-dark.png" --json
```

Set the viewport to `1440x1050`, wait for rendering, then capture these states:

- Feed in dark theme: `docs-feed-dark.png`
- Feed in light theme: `docs-feed-light.png`
- Feed with a memory's **Facts** button active, dark theme: `docs-memory-facts-dark.png`
- Feed with a memory's **Facts** button active, light theme: `docs-memory-facts.png`
- Projects, dark theme: `docs-projects-dark.png`
- Projects, light theme: `docs-projects.png`

CMux screenshots capture the viewport only; do not describe them as full-page captures. Do not capture the terminal or the full desktop.

## Publish after review

Inspect each temporary image before copying it to `docs/images/`. Confirm that it contains no private data or local paths, uses the intended theme and fixture content, has the fixed viewport, and carries the expected fixture state. Keep the Projects image framed as an informational review state: it has two Sharing review findings, no recipients, and no sync activity.
Binary file added docs/images/docs-feed-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/docs-feed-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/docs-memory-facts-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/docs-memory-facts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/docs-projects-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/docs-projects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/plugin-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ For Claude hooks, project resolution precedence is:

`PreToolUse` is intentionally deferred in the default template. Current memory extraction uses `PostToolUse` / `PostToolUseFailure` (`tool_result`) as the shipped Claude tool signal.

## Codex integration (early beta)
## Codex integration

Codex support is early beta — functional and dogfooded end-to-end, but not yet promoted to a stable support tier. The Codex plugin uses the same shared raw-event pipeline as Claude and OpenCode. It is packaged under `plugins/codex/` with `.codex-plugin/plugin.json`, bundled `.mcp.json`, and hook scripts under `plugins/codex/scripts/`.
Codex is a supported integration. The Codex plugin uses the same shared raw-event pipeline as Claude and OpenCode. It is packaged under `plugins/codex/` with `.codex-plugin/plugin.json`, bundled `.mcp.json`, and hook scripts under `plugins/codex/scripts/`.

Codex's Node/ESM wrapper adds a timestamp and nonce when the host omitted a timestamp, normalizes exactly once, and sends the exact envelope to `POST /api/raw-events`. Healthy HTTP ingestion starts no `codemem` or `npx` child. After a retryable HTTP failure, it durably spools the normalized envelope before starting this fallback chain:

Expand Down Expand Up @@ -174,7 +174,7 @@ For Codex hooks, project resolution precedence matches the Claude hook path:

`Stop` events map the inline `last_assistant_message` when present, and fall back to the last assistant message in `transcript_path` so final responses are captured even when the inline field is omitted. This fallback uses the same backward, bounded 16 MiB JSONL scan and record-boundary rules as Claude.

The packaged Codex template registers `SessionStart`, `UserPromptSubmit`, `PostToolUse`, and `Stop` in `plugins/codex/hooks/hooks.json`. Codex support is early beta; see `docs/plans/2026-05-28-codex-first-class-integration.md` for the rollout plan and validation gates.
The packaged Codex template registers `SessionStart`, `UserPromptSubmit`, `PostToolUse`, and `Stop` in `plugins/codex/hooks/hooks.json`. See `docs/plans/2026-05-28-codex-first-class-integration.md` for the historical rollout plan and validation gates.

### Install, update, and uninstall

Expand Down
37 changes: 32 additions & 5 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# User Guide

## Explore the viewer

The Feed shows captured memories; use the theme control to switch appearance and search to narrow the list.

<picture>
<source media="(prefers-color-scheme: dark)" srcset="images/docs-feed-dark.png">
<img alt="Feed showing captured memories" src="images/docs-feed-light.png">
</picture>

Select **Facts** on a memory to review its extracted facts without leaving the Feed.

<picture>
<source media="(prefers-color-scheme: dark)" srcset="images/docs-memory-facts-dark.png">
<img alt="Extracted facts for a memory in the Feed" src="images/docs-memory-facts.png">
</picture>

Optionally, use **Projects** to review project-level information. This example uses synthetic fixture data: its two Sharing review findings are informational, show no recipients, and do not show a successful sharing or sync flow.

<picture>
<source media="(prefers-color-scheme: dark)" srcset="images/docs-projects-dark.png">
<img alt="Projects view with fixture data" src="images/docs-projects.png">
</picture>

All screenshots use invented data. Maintainers can reproduce them with the [screenshot guide](docs-screenshots.md).

## Check for updates

Use the read-only release check to compare the running CLI with the latest npm release on its
Expand Down Expand Up @@ -501,11 +526,13 @@ environment variable, which `env`/`cmd.exe`/PowerShell do not share):
npm install -g codemem
```

Rerun `codemem setup` after upgrading an existing installation. The scoped
`--opencode-only`, `--claude-only`, and `--codex-only` forms work too. Setup
replaces the old managed `npx -y codemem mcp` launcher and codemem MCP entries
detected as UV/UVX-based so both packages resolve in one runtime. Other custom
MCP commands remain unchanged.
For an existing setup-managed installation, upgrade `codemem` with the package
manager that originally installed it, then rerun its setup command. The scoped
`--opencode-only` and `--codex-only` forms work too. Setup replaces the old
managed `npx -y codemem mcp` launcher and codemem MCP entries detected as
UV/UVX-based so both packages resolve in one runtime. Other custom MCP commands
remain unchanged. Claude marketplace installs bundle MCP configuration and need
no separate setup command.

For a smaller keyword-only install, use `npm install -g codemem --omit=optional`
and set `CODEMEM_EMBEDDING_DISABLED=1` in every Codemem process. The flag is
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,15 @@ export {
buildMemoryPackWithTraceAsync,
estimateTokens,
} from "./pack.js";
export type { PiFlushSignal, PiHookAdapterEvent, PiHookRawEventEnvelope } from "./pi-hooks.js";
export {
buildIngestPayloadFromPiEvent,
buildPiFlushSignalFromEvent,
buildRawEventEnvelopeFromPiEvent,
MAPPABLE_PI_EVENTS,
mapPiEventPayload,
PI_FLUSH_ONLY_EVENTS,
} from "./pi-hooks.js";
export type {
BlockedPolicyTeamDeviceEligibilityResult,
DerivePolicyTeamDeviceEligibilityInput,
Expand Down
Loading