StateJar docs

Codex

The StateJar plugin for Codex, the same plugin as Claude Code's, recalls the memory each prompt needs, captures your prompts with secrets removed, and adds StateJar's tools and six skills. Install it from the open-source marketplace, then trust its hooks.

What it does

It is the same plugin as the Claude Code one: Codex reads its own manifest and hooks from it. It is open source (MIT) in statejar-integrations.

Install

You need Codex CLI 0.163 or later, and Python 3.8 or later as python3. The hooks use the standard library only.

codex plugin marketplace add KING-OF-FLAME/statejar-integrations
codex plugin add statejar@statejar

Codex asks you to review a plugin's hooks before they run. Open Codex, run /hooks, and trust the five StateJar hooks: SessionStart, UserPromptSubmit, Stop, PreCompact and SessionEnd. Until you do, the tools and skills work, but nothing is recalled or captured on its own.

Tools only, without the plugin:

codex mcp add statejar --url https://statejar.com/mcp --bearer-token-env-var STATEJAR_API_KEY

Set it up

Make a developer key on the API keys page and put it in the environment Codex runs in:

export STATEJAR_API_KEY="sj_live_…"        # macOS, Linux
setx STATEJAR_API_KEY "sj_live_…"          # Windows: a new terminal picks it up

Codex reads the key from that variable when it calls the tools, and never writes it to config.toml. The other options are variables too:

VariableDefaultWhat it does
STATEJAR_SCOPEcodexThe scope in your account the plugin reads and writes. A new scope builds on your newest memory.
STATEJAR_AUTO_CAPTUREtrueQueue your prompts and send them in batches.
STATEJAR_RECALL_EACH_PROMPTtrueAdd the memory each prompt needs, as one audited query per prompt.
STATEJAR_API_URLhttps://api.statejar.com/api/v1The REST API the hooks call.

If STATEJAR_API_KEY is empty, the hooks use the key that statejar login (the statejar package on PyPI) keeps. The tools still need the variable.

Check it works

  1. codex mcp list shows statejar https://statejar.com/mcp STATEJAR_API_KEY enabled Bearer token.
  2. In a session, say "I'm Kavya, I live in Bengaluru and my laptop budget is 80000 rupees." Then end the session.
  3. In a new session, ask "what is my laptop budget?" or run $statejar:search what is my budget?. The answer uses the budget and names the handle it came from.
  4. $statejar:status shows the scope, what is queued, and the last batch's status (202 when accepted).

What it sends

Troubleshooting

This page as Markdown: /docs/codex.md