A Go CLI tool to dump AI agent session histories (Claude Code and Goose) to stdout in a unified JSON format.
braindump reads conversation histories from Claude Code and Goose AI agents stored locally on your system and outputs them in a consistent, structured JSON format. This makes it easy to analyze, archive, or process agent interactions programmatically.
- Multi-Agent Support: Reads sessions from both Claude Code and Goose AI
- Unified Format: Standardized JSON schema across different agent types
- Filtering: Filter sessions by agent type, session ID, or date range
- Complete History: Includes messages, tool calls, tool results, and metadata
- Subagent Support: Captures subagent conversations from Claude Code
- No External Dependencies: Pure Go implementation with no CGo requirements
- Go 1.21 or higher
git clone https://github.com/block/braindump.git
cd braindump
go build -o braindump ./cmd/braindumphermit init
hermit install go
source bin/activate-hermit
go build -o braindump ./cmd/braindumpDump all agent sessions to stdout:
./braindumpPretty-print the JSON output:
./braindump --prettyGet a human-readable summary of sessions:
./braindump --summaryThe summary output includes:
- Session metadata (ID, agent type, creation date, model)
- Initial user prompt
- Last user prompt
- Last 2 agent messages
- Message statistics
Filter by agent type:
./braindump --agent claude
./braindump --agent gooseFilter by specific session ID:
./braindump --session-id ae52213c-04a4-49ab-b17c-01641c246f7dFilter by date range:
# Sessions since a specific date
./braindump --since 2026-01-01T00:00:00Z
# Sessions until a specific date
./braindump --until 2026-02-01T00:00:00Z
# Sessions within a date range
./braindump --since 2026-01-01T00:00:00Z --until 2026-02-01T00:00:00ZSave output to a file:
./braindump --output sessions.json
./braindump -o sessions.jsonCombine filters:
./braindump --agent claude --since 2026-01-01T00:00:00Z --pretty -o claude-sessions.json| Flag | Description | Example |
|---|---|---|
--agent |
Filter by agent type (claude, goose) | --agent claude |
--session-id |
Filter by specific session ID | --session-id abc123 |
--since |
Filter sessions since timestamp (RFC3339) | --since 2026-01-01T00:00:00Z |
--until |
Filter sessions until timestamp (RFC3339) | --until 2026-02-01T00:00:00Z |
-o, --output |
Output file (default: stdout) | -o sessions.json |
--pretty |
Pretty-print JSON output | --pretty |
--summary |
Output human-readable summary instead of JSON | --summary |
--help |
Show help message | --help |
The tool outputs a single JSON document with the following structure:
{
"version": "1.0.0",
"generated_at": "2026-02-07T00:00:00Z",
"sessions": [...]
}| Field | Type | Description |
|---|---|---|
version |
string | Schema version (currently "1.0.0") |
generated_at |
timestamp | When the dump was generated (RFC3339) |
sessions |
array | Array of session objects |
{
"agent_type": "claude",
"session_id": "ae52213c-04a4-49ab-b17c-01641c246f7d",
"created_at": "2026-02-06T21:43:52.446Z",
"updated_at": "2026-02-07T19:53:53.265Z",
"metadata": {...},
"messages": [...],
"subagents": [...]
}| Field | Type | Description |
|---|---|---|
agent_type |
string | Agent type: "claude" or "goose" |
session_id |
string | Unique session identifier |
created_at |
timestamp | Session creation time (RFC3339) |
updated_at |
timestamp | Last update time (RFC3339) |
metadata |
object | Session metadata (see below) |
messages |
array | Array of message objects |
subagents |
array | Array of subagent objects (Claude only) |
{
"working_dir": "/home/user/project",
"git_branch": "main",
"model": "claude-sonnet-4-5",
"provider": "anthropic",
"name": "Session Name",
"extra": {...}
}| Field | Type | Description |
|---|---|---|
working_dir |
string | Working directory for the session |
git_branch |
string | Git branch (Claude only) |
model |
string | Model name (e.g., "claude-sonnet-4-5") |
provider |
string | Provider name (e.g., "anthropic", "databricks") |
name |
string | Session name (Goose only) |
extra |
object | Additional metadata key-value pairs |
{
"uuid": "c84ebe8b-c27d-48de-896d-69f917d7478e",
"parent_uuid": "566fd1b2-8409-456f-92ca-a6f80ebc88d2",
"timestamp": "2026-02-06T21:43:52.499Z",
"role": "user",
"content": [...],
"metadata": {...}
}| Field | Type | Description |
|---|---|---|
uuid |
string | Unique message identifier |
parent_uuid |
string | Parent message UUID (for threading) |
timestamp |
timestamp | Message timestamp (RFC3339) |
role |
string | Message role: "user" or "assistant" |
content |
array | Array of content blocks |
metadata |
object | Message metadata |
Content blocks represent different types of message content:
Text Block:
{
"type": "text",
"text": "Hello, world!"
}Tool Use Block:
{
"type": "tool_use",
"tool_name": "Read",
"tool_use_id": "toolu_123",
"tool_input": {
"file_path": "/path/to/file"
}
}Tool Result Block:
{
"type": "tool_result",
"tool_use_id": "toolu_123",
"tool_content": "File contents here..."
}{
"is_sidechain": false,
"agent_id": "a2367c4",
"tokens": {
"input_tokens": 100,
"output_tokens": 50,
"total_tokens": 150
},
"model": "claude-sonnet-4-5",
"request_id": "req_123"
}| Field | Type | Description |
|---|---|---|
is_sidechain |
boolean | Whether this is a subagent message |
agent_id |
string | Subagent identifier |
tokens |
object | Token usage statistics |
model |
string | Model used for this message |
request_id |
string | API request ID |
{
"agent_id": "a2367c4",
"slug": "quirky-popping-kernighan",
"messages": [...]
}| Field | Type | Description |
|---|---|---|
agent_id |
string | Subagent identifier |
slug |
string | Human-readable subagent name |
messages |
array | Array of message objects |
- Location:
~/.claude/projects/*/ - Format: JSONL (newline-delimited JSON)
- Files:
- Main sessions:
{sessionId}.jsonl - Subagent sessions:
{sessionId}/subagents/agent-{agentId}.jsonl
- Main sessions:
- Location:
~/.local/share/goose/sessions/sessions.db - Format: SQLite database
- Tables:
sessions,messages
go test ./...go build -o braindump ./cmd/braindump.
├── cmd/
│ └── braindump/
│ └── main.go # CLI entry point
├── internal/
│ ├── model/
│ │ └── types.go # Unified data structures
│ ├── claude/
│ │ ├── reader.go # Claude session reader
│ │ ├── parser.go # Claude format parser
│ │ └── parser_test.go # Parser tests
│ ├── goose/
│ │ ├── reader.go # Goose SQLite reader
│ │ ├── parser.go # Goose format parser
│ │ └── parser_test.go # Parser tests
│ ├── filter/
│ │ ├── filter.go # Session filtering
│ │ └── filter_test.go # Filter tests
│ └── output/
│ └── writer.go # JSON output writer
├── go.mod
├── go.sum
└── README.md
./braindump --summary./braindump --pretty -o archive-$(date +%Y%m%d).json./braindump --agent claude --since $(date -d '7 days ago' -Iseconds) --pretty./braindump | jq '[.sessions[].messages[].metadata.tokens.total_tokens] | add'./braindump | jq -r '.sessions[].messages[].content[] | select(.type=="tool_use") | .tool_name' | sort | uniq -c./braindump --session-id ae52213c-04a4-49ab-b17c-01641c246f7d --prettyApache License, Version 2.0
See GOVERNANCE.md for contribution guidelines.