Auto capture claude code

From NateBJones-Projects/OB1 · View interactive version

Auto capture claude code is an AI agent skill from the GitHub repository NateBJones-Projects/OB1. Claude Code adapter for the auto-capture skill. Extends auto-capture with automatic session-end hooks that capture transcripts to Open Brain without manual intervention. Use this when you want every meaningful Claude Code session to be preserved automatically — not just the ones where you remember t

How to use this skill

Skill file

Auto-Capture: Claude Code Adapter

Relationship to Upstream Skill

This adapter implements the session-end capture behavior defined by the upstream auto-capture skill by Jared Irish. The base skill is a behavioral protocol — it describes when and what to capture during interactive session closes. This adapter is the concrete Claude Code binding: a Stop-hook script that fires the same capture behavior automatically when a session ends without a verbal trigger. The upstream skill and this adapter are complementary; install both for full coverage.

Problem

The base auto-capture skill requires a verbal trigger ("wrap up", "park this")

to fire. In practice, many Claude Code sessions end without that trigger —

the user closes the terminal, hits Ctrl+C, or simply walks away. Those sessions

and their decisions are lost.

What This Adapter Adds

This adapter uses Claude Code's hook system to run a capture script automatically

at session end. It complements the base auto-capture skill:

session summaries) when the user explicitly wraps up.

explicit trigger (terminal close, timeout, Ctrl+C).

Together they ensure no valuable session falls through the cracks.

How It Works

  1. Claude Code fires a Stop hook at session end, passing the transcript path

and session metadata via stdin as JSON.

  1. The hook script (session-end-capture.mjs) reads the transcript, filters out

short or agent-only sessions, and formats the content.

  1. The formatted transcript is POSTed to the Open Brain REST ingest endpoint

(or smart-ingest edge function) for automatic thought extraction.

  1. Failed captures are saved to a local retry queue and retried on subsequent

session ends.

Skip Heuristics

Not every session is worth capturing. The hook skips:

Installation

Prerequisites

Install the base auto-capture skill first. This adapter

extends it — it does not replace it.

Steps

  1. Copy session-end-capture.mjs to your project or a shared scripts directory.
  1. Register the hook in your Claude Code settings (.claude/settings.json or

global ~/.claude/settings.json):

```json

{

"hooks": {

"Stop": [

{

"matcher": "",

"hooks": [

{

"type": "command",

"command": "node /path/to/session-end-capture.mjs"

}

]

}

]

}

}

```

  1. Set environment variables (in .env.local or your environment):

```bash

SUPABASE_URL=https://<project-ref>.supabase.co

MCP_ACCESS_KEY=your-access-key

```

  1. Restart Claude Code to pick up the hook.
  1. End a test session with at least 3 user messages and verify a capture appears

in your Open Brain thoughts.

Adapting the Script

The included session-end-capture.mjs is a reference implementation. Adapt it

to your setup:

smart-ingest function is deployed at a different path.

regex patterns for restricted content detection, or remove the check if you

don't need it.

data/capture-retry-queue/ and retries them on subsequent runs. Adjust

RETRY_MAX_ATTEMPTS and RETRY_BATCH_SIZE as needed.

Code shutdown. Adjust HARD_TIMEOUT_MS if your network is slower.

Output

When working correctly:

is automatically ingested into Open Brain for thought extraction.

Notes

the hook never prevents Claude Code from shutting down.

handles interactive captures with ACT NOW items; the adapter handles ambient

background capture of the full session transcript.

directly rather than MCP tools, so it works regardless of which MCP connector

is active.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.