The easy way: just ask
At the end of a conversation, tell your connected agent to save it:“Save a summary of what we worked out to my brain.”The agent writes a tidy page into your brain, following the ingest skill, the same as any other thing you ask it to save. No setup, nothing to install. This is all most people need. It lands in your own work brain, so anything captured this way stays yours until you decide to promote it.
The automatic way: a session hook (advanced)
If you would rather have every session captured without asking each time, Claude Code can do it for you with a hook: a small command it runs automatically when a session ends. Setting this up means creating a short script and editing a settings file, so it is a step up in effort. If you are comfortable with a terminal it takes a few minutes; if not, it is a good one to hand to a developer, or just use the easy way above. First, the one step that is the same on every system:1
Create a service credential
In your work brain’s service credentials, create a read-and-write credential labelled “claude-code-capture” and copy its
ck_ key. This lets the hook post to Cortex without a browser.- macOS
- Linux
- Windows
The script uses 1. Save this as Make it runnable:2. Store your credential in 3. Register the hook in
curl (already on macOS) and jq, a small JSON tool. Install jq once:.claude/hooks/cortex-capture.sh:.claude/settings.local.json (kept out of shared files):.claude/settings.json:~/.claude/settings.json and use the script’s full path.
From then on, each session lands in your personal inbox through the same door as any other item, and Cortex cleans it first. A raw session log is mostly the output of the commands and tools the agent ran; the conversation itself is often under 1% of it. Cortex keeps what you typed, what the assistant said and one line for each thing it did (“ran: Show working tree status”, “edited RunnerEngine.cs”), drops the tool output, the assistant’s private reasoning and anything injected behind the scenes, and masks passwords, API keys and tokens. The original log stays on the item.
The cleaned session goes straight to the conversation skill, which reads it with a high bar: only a real decision, an idea in your own words, a durable fact about someone or something your brain tracks, or a substantial piece of work gets filed. Most sessions produce nothing, and that is the intended result. If you come back to a session and carry on, the next time it ends Cortex links the new copy to the earlier one as a new version, rather than treating it as a duplicate. Ask your next session “what did we work on last time?” and it can tell you.
If you set this hook up before 2 October 2026, replace the script with the one above. The old one sent the session id as a delivery id, so a session you resumed was turned away as a duplicate the second time it ended, and on very long sessions it could fail to send at all.
Other agents
Any tool that can run a command or call a web address when it finishes can capture the same way: post the conversation tohttps://api.oncortex.ai/api/v1/inbox with a service credential. The default-inbox address means you never name a brain; it goes to the credential’s brain. Send its own log as it is, with provider set to the tool’s name (copilot-cli, codex, gemini-cli) and providerItemId set to its session id: Cortex reads the common message formats most agents use and cleans the log the same way. A format it cannot read is flagged in your inbox for you to look at, never filed raw.
Keeping it tidy
Captured conversations are filed by the conversation skill, which pulls out the substance rather than dumping raw transcripts, and files nothing when a session held nothing durable. If two sessions capture the same thing, duplicate handling stops your brain filling up with repeats.Checking the hook is still working
A hook stops quietly when a laptop is rebuilt or a credential expires. Ask your agent to run the health check on the brain: it reports when the last transcript arrived and when theclaude-code-capture credential was last used, and says what to do if either has gone
stale. See brain health.