Help/Documentation

Agent hooks: onecell in Claude Code and Codex, unasked

Hooks let onecell bring up relevant memory, brief a new session and suggest saving what a turn settled. Off until you turn them on; nothing you type is stored.

Normally your agent uses onecell when you ask it to. Hooks let onecell speak up on its own, at three moments in a session. Each is a separate switch, and all three are off until you turn them on.

SwitchWhenWhat happens
Bring up relevant memoryYou send a promptonecell looks for documents and facts that match it and adds a few lines to the agent's context. Only strong matches, and nothing it already showed in this session.
Brief new sessionsA session starts, or after /clear or compactionA few lines on your active cluster, open decisions and recent drafts in your Capture cell.
Suggest saving what was settledThe agent finishes a turnIf the turn looks like it decided, merged or shipped something, the agent is asked to save a short draft to your private Capture cell. At most three times a session, and not right after something was saved.

Turn them on

On Settings → Agents, under Hooks, switch on the ones you want. Then install the hook in your agent, below. The hook needs its own key: create a Drafts only key on the same page, since a hook never needs to publish or share.

Quickest: one command

Where one-command setup is on for your team (founding teams first), run this in a terminal on the computer you work on. It shows a code; approve the computer in your browser and pick the switches. It then installs the hooks for Claude Code and Codex with a Drafts only key of its own, named after the computer, so there is nothing to copy. Restart Claude Code; Codex asks you to trust the new hooks once.

npx onecell@latest hooks

To set them up by hand instead, follow the steps for your agent below.

Claude Code

  1. Add the onecell marketplace

    In Claude Code, run /plugin marketplace add 32-Boroughs/onecell-plugin.

  2. Install the hooks plugin

    Run /plugin install onecell-hooks@onecell, then restart Claude Code.

  3. Paste your key

    When it asks for an API key, paste the Drafts only key. Claude Code keeps it in your system's credential store. It works however onecell itself is connected.

Codex

Codex runs the same hook as a script. It needs curl and jq, and your key in the ONECELL_API_KEY environment variable. Fetch the script:

mkdir -p ~/.codex/hooks && curl -fsSL https://onecell.io/agent-setup/hook.sh -o ~/.codex/hooks/onecell-hook.sh && chmod +x ~/.codex/hooks/onecell-hook.sh

Then add it to ~/.codex/hooks.json for three events:

{
  "hooks": {
    "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.codex/hooks/onecell-hook.sh", "timeout": 10 }] }],
    "Stop": [{ "hooks": [{ "type": "command", "command": "~/.codex/hooks/onecell-hook.sh", "timeout": 10 }] }],
    "SessionStart": [{ "matcher": "startup|resume|clear|compact", "hooks": [{ "type": "command", "command": "~/.codex/hooks/onecell-hook.sh", "timeout": 10 }] }]
  }
}

Last, turn hooks on in Codex: add hooks = true under [features] in ~/.codex/config.toml. Codex runs no hooks without it, and asks you to trust them once when it next starts.

Check it works

With memory switched on, start a new session and ask about something you know is in onecell, in a full sentence. The agent's answer should cite the document without you asking it to search. With briefings on, a new session opens with a few lines headed onecell briefing.

Nothing happening? Check the switches are on, the key is Drafts only or full (not revoked), and that a short or routine prompt like “yes” or “go ahead” is expected to stay quiet.

Turn them off

Switch them off on Settings → Agents and onecell says nothing, even with the hook installed. To remove the hook entirely, uninstall the plugin in Claude Code, or delete the entries from ~/.codex/hooks.json.