Skip to content

Session Capture

The loombrain-sessions plugin automatically saves your Claude Code coding sessions to LoomBrain when a session ends. Every meaningful conversation — debugging trails, implementation decisions, architecture discussions — is captured and searchable in your knowledge graph.

  • A LoomBrain account with episodic memory enabled
  • Claude Code with plugin marketplace support
  • Bun runtime installed

In Claude Code, run:

/plugins marketplace add amentistudio/loombrain-plugins

This registers the LoomBrain plugin marketplace so you can install plugins from it.

/plugin install loombrain-sessions

This installs the session capture hook and registers the /lb:* commands.

Run the login command:

/lb:login

This opens a browser window to app.loombrain.com where you sign in with your existing account. After authentication, credentials are saved locally to ~/.config/loombrain/config.json.

Without logging in, the plugin silently discards captured sessions. Always complete this step after installation.

If browser-based login is not possible (SSH, CI), set an API key instead:

  1. Go to your API key settings and create a new key.
  2. Add it to your shell profile (~/.zshrc, ~/.bashrc, etc.):
Terminal window
export LB_TOKEN="your-api-key"

Do not pass the key inline on the command line — it would be recorded in shell history.

  1. Restart Claude Code for the variable to take effect.
/lb:capture-status

This shows your auth status, captured session count, and any recent errors. If auth is configured correctly, you are ready to go.

Your first capture will appear after your next session ends (via /clear, logout, or exit) — not immediately after setup.

  1. When a Claude Code session ends, the SessionEnd hook fires automatically.
  2. The plugin reads the session transcript (JSONL format).
  3. Messages are converted to episode events: user prompts, assistant responses, tool calls, and results. Thinking blocks and internal metadata are stripped.
  4. Sessions with fewer than 5 meaningful events (user + assistant messages) are skipped to avoid noise.
  5. Large sessions are split into chunks of up to 250 events each.
  6. Each chunk is sent to the LoomBrain API as an episodic capture.
  7. If the session is inside a git repository, the repo name is extracted and used to auto-tag the capture with the correct PARA project.
CommandDescription
/lb:loginLog in to LoomBrain. Opens browser or guides API key setup.
/lb:capture-sessionVerify capture configuration and test the pipeline.
/lb:capture-statusView auth status, captured session count, and recent errors.

Not logged in Run /lb:login or set the LB_TOKEN environment variable. Without authentication, sessions are silently lost.

No captures appearing Check the error log for details:

Terminal window
cat ~/.loombrain-sessions/capture.log

Common causes: auth failure, network error, or the session had fewer than 5 meaningful events.

Expired or revoked token Re-run /lb:login to refresh your credentials. The plugin automatically refreshes tokens when possible, but revoked tokens require a new login.

Episodic memory not enabled Session capture requires episodic memory to be enabled on your LoomBrain account. Check your dashboard settings or contact support.

When session:quality_gate_enabled is set for your tenant, session-derived fact nodes default to status="raw". The decay worker archives raw fact nodes after 90 days if they have no inbound related edges (structural derived_from / next edges to the session episode don’t count). Episode hubs remain status="validated" and are not archived. Flip the flag off to keep the pre-change behaviour (facts persist as validated at tier 1).

The plugin stores state in ~/.loombrain-sessions/:

FilePurpose
captured-sessionsTracks which sessions have been captured (prevents duplicates).
capture.logError log, capped at 100KB. Check this if captures are not appearing.

The plugin source is available at github.com/amentistudio/loombrain-plugins.