{"id":51307768,"url":"https://github.com/block/braindump","last_synced_at":"2026-07-01T01:04:34.735Z","repository":{"id":337120792,"uuid":"1151640323","full_name":"block/braindump","owner":"block","description":"A utility for dumping agent logs in a standard format","archived":false,"fork":false,"pushed_at":"2026-04-29T01:37:25.000Z","size":6006,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T07:27:59.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/block.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-06T18:04:55.000Z","updated_at":"2026-04-29T01:37:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/block/braindump","commit_stats":null,"previous_names":["block/braindump"],"tags_count":0,"template":false,"template_full_name":"block/oss-project-template","purl":"pkg:github/block/braindump","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fbraindump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fbraindump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fbraindump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fbraindump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/block","download_url":"https://codeload.github.com/block/braindump/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block%2Fbraindump/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33323359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"ssl_error","status_checked_at":"2026-05-21T12:22:11.673Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-01T01:04:33.804Z","updated_at":"2026-07-01T01:04:34.725Z","avatar_url":"https://github.com/block.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# braindump\n\nA Go CLI tool to dump AI agent session histories (Claude Code and Goose) to stdout in a unified JSON format.\n\n## Overview\n\n`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.\n\n## Features\n\n- **Multi-Agent Support**: Reads sessions from both Claude Code and Goose AI\n- **Unified Format**: Standardized JSON schema across different agent types\n- **Filtering**: Filter sessions by agent type, session ID, or date range\n- **Complete History**: Includes messages, tool calls, tool results, and metadata\n- **Subagent Support**: Captures subagent conversations from Claude Code\n- **No External Dependencies**: Pure Go implementation with no CGo requirements\n\n## Installation\n\n### Prerequisites\n\n- Go 1.21 or higher\n\n### From Source\n\n```bash\ngit clone https://github.com/block/braindump.git\ncd braindump\ngo build -o braindump ./cmd/braindump\n```\n\n### Using Hermit\n\n```bash\nhermit init\nhermit install go\nsource bin/activate-hermit\ngo build -o braindump ./cmd/braindump\n```\n\n## Usage\n\n### Basic Usage\n\nDump all agent sessions to stdout:\n\n```bash\n./braindump\n```\n\nPretty-print the JSON output:\n\n```bash\n./braindump --pretty\n```\n\nGet a human-readable summary of sessions:\n\n```bash\n./braindump --summary\n```\n\nThe summary output includes:\n- Session metadata (ID, agent type, creation date, model)\n- Initial user prompt\n- Last user prompt\n- Last 2 agent messages\n- Message statistics\n\n### Filtering Options\n\nFilter by agent type:\n\n```bash\n./braindump --agent claude\n./braindump --agent goose\n```\n\nFilter by specific session ID:\n\n```bash\n./braindump --session-id ae52213c-04a4-49ab-b17c-01641c246f7d\n```\n\nFilter by date range:\n\n```bash\n# Sessions since a specific date\n./braindump --since 2026-01-01T00:00:00Z\n\n# Sessions until a specific date\n./braindump --until 2026-02-01T00:00:00Z\n\n# Sessions within a date range\n./braindump --since 2026-01-01T00:00:00Z --until 2026-02-01T00:00:00Z\n```\n\n### Output Options\n\nSave output to a file:\n\n```bash\n./braindump --output sessions.json\n./braindump -o sessions.json\n```\n\nCombine filters:\n\n```bash\n./braindump --agent claude --since 2026-01-01T00:00:00Z --pretty -o claude-sessions.json\n```\n\n## Command-Line Flags\n\n| Flag | Description | Example |\n|------|-------------|---------|\n| `--agent` | Filter by agent type (claude, goose) | `--agent claude` |\n| `--session-id` | Filter by specific session ID | `--session-id abc123` |\n| `--since` | Filter sessions since timestamp (RFC3339) | `--since 2026-01-01T00:00:00Z` |\n| `--until` | Filter sessions until timestamp (RFC3339) | `--until 2026-02-01T00:00:00Z` |\n| `-o, --output` | Output file (default: stdout) | `-o sessions.json` |\n| `--pretty` | Pretty-print JSON output | `--pretty` |\n| `--summary` | Output human-readable summary instead of JSON | `--summary` |\n| `--help` | Show help message | `--help` |\n\n## Output Schema\n\nThe tool outputs a single JSON document with the following structure:\n\n### Root Object\n\n```json\n{\n  \"version\": \"1.0.0\",\n  \"generated_at\": \"2026-02-07T00:00:00Z\",\n  \"sessions\": [...]\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `version` | string | Schema version (currently \"1.0.0\") |\n| `generated_at` | timestamp | When the dump was generated (RFC3339) |\n| `sessions` | array | Array of session objects |\n\n### Session Object\n\n```json\n{\n  \"agent_type\": \"claude\",\n  \"session_id\": \"ae52213c-04a4-49ab-b17c-01641c246f7d\",\n  \"created_at\": \"2026-02-06T21:43:52.446Z\",\n  \"updated_at\": \"2026-02-07T19:53:53.265Z\",\n  \"metadata\": {...},\n  \"messages\": [...],\n  \"subagents\": [...]\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `agent_type` | string | Agent type: \"claude\" or \"goose\" |\n| `session_id` | string | Unique session identifier |\n| `created_at` | timestamp | Session creation time (RFC3339) |\n| `updated_at` | timestamp | Last update time (RFC3339) |\n| `metadata` | object | Session metadata (see below) |\n| `messages` | array | Array of message objects |\n| `subagents` | array | Array of subagent objects (Claude only) |\n\n### Session Metadata\n\n```json\n{\n  \"working_dir\": \"/home/user/project\",\n  \"git_branch\": \"main\",\n  \"model\": \"claude-sonnet-4-5\",\n  \"provider\": \"anthropic\",\n  \"name\": \"Session Name\",\n  \"extra\": {...}\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `working_dir` | string | Working directory for the session |\n| `git_branch` | string | Git branch (Claude only) |\n| `model` | string | Model name (e.g., \"claude-sonnet-4-5\") |\n| `provider` | string | Provider name (e.g., \"anthropic\", \"databricks\") |\n| `name` | string | Session name (Goose only) |\n| `extra` | object | Additional metadata key-value pairs |\n\n### Message Object\n\n```json\n{\n  \"uuid\": \"c84ebe8b-c27d-48de-896d-69f917d7478e\",\n  \"parent_uuid\": \"566fd1b2-8409-456f-92ca-a6f80ebc88d2\",\n  \"timestamp\": \"2026-02-06T21:43:52.499Z\",\n  \"role\": \"user\",\n  \"content\": [...],\n  \"metadata\": {...}\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `uuid` | string | Unique message identifier |\n| `parent_uuid` | string | Parent message UUID (for threading) |\n| `timestamp` | timestamp | Message timestamp (RFC3339) |\n| `role` | string | Message role: \"user\" or \"assistant\" |\n| `content` | array | Array of content blocks |\n| `metadata` | object | Message metadata |\n\n### Content Block\n\nContent blocks represent different types of message content:\n\n**Text Block:**\n```json\n{\n  \"type\": \"text\",\n  \"text\": \"Hello, world!\"\n}\n```\n\n**Tool Use Block:**\n```json\n{\n  \"type\": \"tool_use\",\n  \"tool_name\": \"Read\",\n  \"tool_use_id\": \"toolu_123\",\n  \"tool_input\": {\n    \"file_path\": \"/path/to/file\"\n  }\n}\n```\n\n**Tool Result Block:**\n```json\n{\n  \"type\": \"tool_result\",\n  \"tool_use_id\": \"toolu_123\",\n  \"tool_content\": \"File contents here...\"\n}\n```\n\n### Message Metadata\n\n```json\n{\n  \"is_sidechain\": false,\n  \"agent_id\": \"a2367c4\",\n  \"tokens\": {\n    \"input_tokens\": 100,\n    \"output_tokens\": 50,\n    \"total_tokens\": 150\n  },\n  \"model\": \"claude-sonnet-4-5\",\n  \"request_id\": \"req_123\"\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `is_sidechain` | boolean | Whether this is a subagent message |\n| `agent_id` | string | Subagent identifier |\n| `tokens` | object | Token usage statistics |\n| `model` | string | Model used for this message |\n| `request_id` | string | API request ID |\n\n### Subagent Object\n\n```json\n{\n  \"agent_id\": \"a2367c4\",\n  \"slug\": \"quirky-popping-kernighan\",\n  \"messages\": [...]\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `agent_id` | string | Subagent identifier |\n| `slug` | string | Human-readable subagent name |\n| `messages` | array | Array of message objects |\n\n## Data Sources\n\n### Claude Code\n\n- **Location**: `~/.claude/projects/*/`\n- **Format**: JSONL (newline-delimited JSON)\n- **Files**:\n  - Main sessions: `{sessionId}.jsonl`\n  - Subagent sessions: `{sessionId}/subagents/agent-{agentId}.jsonl`\n\n### Goose AI\n\n- **Location**: `~/.local/share/goose/sessions/sessions.db`\n- **Format**: SQLite database\n- **Tables**: `sessions`, `messages`\n\n## Development\n\n### Running Tests\n\n```bash\ngo test ./...\n```\n\n### Building\n\n```bash\ngo build -o braindump ./cmd/braindump\n```\n\n### Project Structure\n\n```\n.\n├── cmd/\n│   └── braindump/\n│       └── main.go              # CLI entry point\n├── internal/\n│   ├── model/\n│   │   └── types.go             # Unified data structures\n│   ├── claude/\n│   │   ├── reader.go            # Claude session reader\n│   │   ├── parser.go            # Claude format parser\n│   │   └── parser_test.go       # Parser tests\n│   ├── goose/\n│   │   ├── reader.go            # Goose SQLite reader\n│   │   ├── parser.go            # Goose format parser\n│   │   └── parser_test.go       # Parser tests\n│   ├── filter/\n│   │   ├── filter.go            # Session filtering\n│   │   └── filter_test.go       # Filter tests\n│   └── output/\n│       └── writer.go            # JSON output writer\n├── go.mod\n├── go.sum\n└── README.md\n```\n\n## Examples\n\n### Example 1: Quick Summary of Recent Sessions\n\n```bash\n./braindump --summary\n```\n\n### Example 2: Archive All Sessions\n\n```bash\n./braindump --pretty -o archive-$(date +%Y%m%d).json\n```\n\n### Example 3: Extract Claude Sessions from Last Week\n\n```bash\n./braindump --agent claude --since $(date -d '7 days ago' -Iseconds) --pretty\n```\n\n### Example 4: Analyze Token Usage\n\n```bash\n./braindump | jq '[.sessions[].messages[].metadata.tokens.total_tokens] | add'\n```\n\n### Example 5: List All Tool Calls\n\n```bash\n./braindump | jq -r '.sessions[].messages[].content[] | select(.type==\"tool_use\") | .tool_name' | sort | uniq -c\n```\n\n### Example 6: Extract Specific Session\n\n```bash\n./braindump --session-id ae52213c-04a4-49ab-b17c-01641c246f7d --pretty\n```\n\n## License\n\nApache License, Version 2.0\n\n## Contributing\n\nSee [GOVERNANCE.md](./GOVERNANCE.md) for contribution guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblock%2Fbraindump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblock%2Fbraindump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblock%2Fbraindump/lists"}