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.
Prerequisites
Section titled “Prerequisites”- A LoomBrain account with episodic memory enabled
- Claude Code with plugin marketplace support
- Bun runtime installed
Installation
Section titled “Installation”Step 1 — Add the LoomBrain marketplace
Section titled “Step 1 — Add the LoomBrain marketplace”In Claude Code, run:
/plugins marketplace add amentistudio/loombrain-pluginsThis registers the LoomBrain plugin marketplace so you can install plugins from it.
Step 2 — Install the plugin
Section titled “Step 2 — Install the plugin”/plugin install loombrain-sessionsThis installs the session capture hook and registers the /lb:* commands.
Step 3 — Log in
Section titled “Step 3 — Log in”Run the login command:
/lb:loginThis 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.
Alternative: API key
Section titled “Alternative: API key”If browser-based login is not possible (SSH, CI), set an API key instead:
- Go to your API key settings and create a new key.
- Add it to your shell profile (
~/.zshrc,~/.bashrc, etc.):
export LB_TOKEN="your-api-key"Do not pass the key inline on the command line — it would be recorded in shell history.
- Restart Claude Code for the variable to take effect.
Step 4 — Verify
Section titled “Step 4 — Verify”/lb:capture-statusThis 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.
How it works
Section titled “How it works”- When a Claude Code session ends, the
SessionEndhook fires automatically. - The plugin reads the session transcript (JSONL format).
- Messages are converted to episode events: user prompts, assistant responses, tool calls, and results. Thinking blocks and internal metadata are stripped.
- Sessions with fewer than 5 meaningful events (user + assistant messages) are skipped to avoid noise.
- Large sessions are split into chunks of up to 250 events each.
- Each chunk is sent to the LoomBrain API as an episodic capture.
- 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.
Commands
Section titled “Commands”| Command | Description |
|---|---|
/lb:login | Log in to LoomBrain. Opens browser or guides API key setup. |
/lb:capture-session | Verify capture configuration and test the pipeline. |
/lb:capture-status | View auth status, captured session count, and recent errors. |
Troubleshooting
Section titled “Troubleshooting”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:
cat ~/.loombrain-sessions/capture.logCommon 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.
Retention and decay
Section titled “Retention and decay”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).
State files
Section titled “State files”The plugin stores state in ~/.loombrain-sessions/:
| File | Purpose |
|---|---|
captured-sessions | Tracks which sessions have been captured (prevents duplicates). |
capture.log | Error log, capped at 100KB. Check this if captures are not appearing. |
Source code
Section titled “Source code”The plugin source is available at github.com/amentistudio/loombrain-plugins.