{"id":51405186,"url":"https://github.com/guhcostan/claude-mega-brain","last_synced_at":"2026-07-04T10:30:48.489Z","repository":{"id":368249084,"uuid":"1284088776","full_name":"guhcostan/claude-mega-brain","owner":"guhcostan","description":"OKF-powered knowledge context for Claude Code — injects your project's knowledge base at every session","archived":false,"fork":false,"pushed_at":"2026-06-29T18:49:20.000Z","size":1605,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-29T19:05:54.684Z","etag":null,"topics":["ai-agents","claude-code","claude-code-plugin","knowledge-base","mega-brain","okf","second-brain"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guhcostan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"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-06-29T14:10:41.000Z","updated_at":"2026-06-29T18:49:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/guhcostan/claude-mega-brain","commit_stats":null,"previous_names":["guhcostan/claude-mega-brain"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/guhcostan/claude-mega-brain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guhcostan%2Fclaude-mega-brain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guhcostan%2Fclaude-mega-brain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guhcostan%2Fclaude-mega-brain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guhcostan%2Fclaude-mega-brain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guhcostan","download_url":"https://codeload.github.com/guhcostan/claude-mega-brain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guhcostan%2Fclaude-mega-brain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35118970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-04T02:00:05.987Z","response_time":113,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ai-agents","claude-code","claude-code-plugin","knowledge-base","mega-brain","okf","second-brain"],"created_at":"2026-07-04T10:30:47.946Z","updated_at":"2026-07-04T10:30:48.484Z","avatar_url":"https://github.com/guhcostan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/logo.png\" width=\"280\" alt=\"claude-mega-brain logo\" /\u003e\n\n# claude-mega-brain\n\n*Loads the knowledge. Skips the search.*\n\n[![CI](https://img.shields.io/github/actions/workflow/status/guhcostan/claude-mega-brain/test.yml?style=flat-square\u0026color=111111\u0026label=CI)](https://github.com/guhcostan/claude-mega-brain/actions)\n[![Stars](https://img.shields.io/github/stars/guhcostan/claude-mega-brain?style=flat-square\u0026color=111111\u0026label=stars)](https://github.com/guhcostan/claude-mega-brain)\n[![Release](https://img.shields.io/github/v/release/guhcostan/claude-mega-brain?style=flat-square\u0026color=111111\u0026label=release)](https://github.com/guhcostan/claude-mega-brain/releases)\n[![License](https://img.shields.io/badge/license-MIT-111111?style=flat-square)](LICENSE)\n[![Claude Code](https://img.shields.io/badge/works%20with-Claude%20Code-111111?style=flat-square)](https://github.com/anthropics/claude-code)\n\n**100% accuracy · 0 tool calls · −66% tokens vs Obsidian+MCP**\n\nReal agentic sessions. [Benchmark →](benchmarks/results/agentic-obsidian-vs-mega-brain.md)\n\n\u003c/div\u003e\n\n---\n\n## Install\n\n```\n/plugin marketplace add guhcostan/claude-mega-brain\n/plugin install mega-brain@mega-brain\n```\n\nThen in any project:\n\n```\n/mega-brain:init\n```\n\nStart a new session — the knowledge base loads automatically.\n\n---\n\n## The problem\n\nWithout claude-mega-brain, Claude guesses from training data:\n\n```\nUser: What column stores the order total?\n\nClaude (no context): Typically total_amount (DECIMAL) or amount (FLOAT)...\n# Wrong — this project uses total_cents (INT64)\n```\n\nWith claude-mega-brain, the exact schema is injected at `SessionStart`:\n\n```\n\u003cmega-brain\u003e\nKnowledge: 4 documented concepts found in project\n\n  docs/orders.md     [BigQuery Table] — total_cents INT64, status STRING(pending/confirmed/shipped/done)\n  docs/customers.md  [BigQuery Table] — customer_id STRING, email STRING, country STRING\n  docs/wau.md        [Metric]         — COUNT(DISTINCT user_id) WHERE session_date \u003e= CURRENT_DATE-7\n  docs/net_revenue.md [Metric]        — SUM(total_cents - refund_cents)/100 WHERE status='done'\n\u003c/mega-brain\u003e\n\nUser: What column stores the order total?\n\nClaude: total_cents (INT64) — from docs/orders.md\n# Correct. 0 tool calls. First turn.\n```\n\n---\n\n## Benchmark\n\n10 questions with project-specific values unknowable from training data.\nReal agentic sessions — not simulated.\n\n![Benchmark chart](assets/benchmark.svg)\n\n| metric | no context | Obsidian+MCP | CLAUDE.md (raw files) | **claude-mega-brain** |\n|---|--:|--:|--:|--:|\n| accuracy (no tools) | 50% | 13% | 100% | **100%** |\n| accuracy (agentic) | 100%† | 100%† | 100% | **100%** |\n| tool calls avg | 1.1 | 0.9 | 0.1 | **0** |\n| tokens avg | 61,521 | 49,186 | 20,624 | **16,547** |\n| latency avg ms | 10,267 | 10,986 | 5,494 | **4,384** |\n\n† raw and Obsidian+MCP reach 100% agentic accuracy by using tool calls to explore the project — spending 3–4× more tokens and time. Without tools, they drop to 50% and 13%.\n\nCLAUDE.md (raw files) matches mega-brain on accuracy but uses 25% more tokens and is 25% slower. mega-brain's compressed OKF index is smaller and faster — the gap widens as knowledge bases grow.\n\n[Full results](benchmarks/results/agentic-obsidian-vs-mega-brain.md) · [Reproduce](benchmarks/)\n\n---\n\n## How it works\n\nAt `SessionStart`, a hook scans the entire project for any `.md` file with `type:` in its YAML frontmatter and injects a compact index:\n\n```\n\u003cmega-brain\u003e\nKnowledge: 8 documented concepts found in project\n\nRecent (log.md):\n  2026-06-29 — added customers table\n\n  index.md            [Index]         — Central reference for all sales data\n  docs/orders.md      [BigQuery Table] — One row per completed order\n  docs/customers.md   [BigQuery Table] — Customer profiles\n  docs/wau.md         [Metric]         — Weekly active users\n  ...\n\u003c/mega-brain\u003e\n```\n\nNo dedicated folder needed — documents can live anywhere in the project. When Claude reads an OKF file, linked concepts surface automatically via `PostToolUse`.\n\n**Zero overhead when not in use** — if no documented concepts are found, the hook exits in \u003c5ms.\n\n---\n\n## How it compares\n\n| tool | auto-inject | schema enforcement | tool calls to answer | accuracy (no tools) |\n|------|-------------|-------------------|---------------------|---------------------|\n| **claude-mega-brain** | ✓ SessionStart hook | required (`type:`) | **0** | **100%** |\n| CLAUDE.md + additionalDirectories | manual setup | none | 0 | 100%* |\n| Obsidian + MCP | ✗ manual | none | 1–3 | 13% |\n| Notion | ✗ manual | proprietary | N/A | — |\n| Logseq | ✗ plugin-based | none | N/A | — |\n| mem.ai | ✗ none | none | N/A | — |\n\n\\* CLAUDE.md matches mega-brain accuracy but uses 25% more tokens and is 25% slower — raw file dump vs compressed structured index.\n\n---\n\n## OKF Format\n\nAny `.md` file in the project with `type:` in its YAML frontmatter is automatically picked up. No dedicated folder needed.\n\n```markdown\n---\ntype: BigQuery Table\ntitle: Orders\ndescription: One row per completed customer order.\nresource: https://console.cloud.google.com/bigquery?p=acme\u0026d=sales\u0026t=orders\ntags: [sales, revenue]\ntimestamp: 2026-06-29T00:00:00Z\n---\n\n# Schema\n| Column      | Type      | Description              |\n|-------------|-----------|--------------------------|\n| order_id    | STRING    | Globally unique order ID |\n| customer_id | STRING    | FK → customers           |\n| total_cents | INT64     | Order total in cents     |\n| status      | STRING    | pending/confirmed/shipped/done |\n\n# Joins\nJoined with [customers](customers.md) on `customer_id`.\n```\n\n### Reserved files\n\n| File | Purpose |\n|------|---------|\n| `index.md` (with `type: Index`) | Knowledge map — Claude reads this first |\n| `log.md` (with `type: Log`) | Append-only changelog — last 3 entries injected at session start |\n\n### Common types\n\n`BigQuery Table` · `BigQuery Dataset` · `Table` · `Metric` · `API` · `Runbook` · `Concept` · `Service` · `Pipeline`\n\nTypes are freeform — add your own.\n\n---\n\n## Usage\n\n### Start from scratch\n\n```\n/mega-brain:init\n```\n\nCreates `index.md` and `log.md` anywhere you want. Start a new session — context injects automatically.\n\n### Migrate existing docs\n\n```\n/mega-brain:migrate\n```\n\nScans `openapi.yaml`, `schema.prisma`, `schema.sql`, `docs/`, `README` sections and adds `type:` frontmatter to generate OKF concepts.\n\n### Add a single concept\n\n```\n/mega-brain:ingest\n```\n\nDocument a specific table, metric, API, or service. Saves the file wherever makes sense for your project structure.\n\n---\n\n## Installation\n\n### Claude Code\n\n```\n/plugin marketplace add guhcostan/claude-mega-brain\n/plugin install mega-brain@mega-brain\n```\n\n### Local development\n\n```bash\nclaude plugin install /path/to/claude-mega-brain\n```\n\n---\n\n## Config (`.mega-brain.json`)\n\nOptional per-project overrides:\n\n```json\n{\n  \"dir\": \"knowledge\",\n  \"maxConcepts\": 100,\n  \"priorityTypes\": [\"Metric\", \"BigQuery Table\"]\n}\n```\n\n| Field | Default | Description |\n|-------|---------|-------------|\n| `dir` | *(none)* | Limit scanning to this subdirectory (relative to project root). When unset, the entire project is scanned. |\n| `maxConcepts` | `60` | Max concepts in injected index |\n| `priorityTypes` | `[]` | Types shown at top of index |\n| `exclude` | `[]` | Additional dirs to skip when scanning |\n\n---\n\n## FAQ\n\n**Does it slow down every session?**\nNo. If no OKF directory exists, the hook exits in \u003c5ms with no context injected.\n\n**Can I use it with an existing wiki or docs folder?**\nAdd `type:` YAML frontmatter to any Markdown file and drop it in your OKF dir. Done.\n\n**What if I have 500 concepts?**\nSet `maxConcepts` in `.mega-brain.json`. The index stays compact; `index.md` holds the full map.\n\n---\n\n## References\n\n- [Open Knowledge Format — Google Cloud](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing)\n- [LLM Wiki pattern — Andrej Karpathy](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)\n- [Mega Brain — Thiago Finch](https://www.instagram.com/reel/DZI-ys4h29A/) — the meme this plugin is named after\n\n---\n\n## Star History\n\n\u003ca href=\"https://www.star-history.com/?type=date\u0026repos=guhcostan%2Fclaude-mega-brain\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/chart?repos=guhcostan/claude-mega-brain\u0026type=date\u0026theme=dark\u0026legend=top-left\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/chart?repos=guhcostan/claude-mega-brain\u0026type=date\u0026legend=top-left\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/chart?repos=guhcostan/claude-mega-brain\u0026type=date\u0026legend=top-left\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n\n---\n\n## License\n\n[MIT](LICENSE) — The shortest license that works.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguhcostan%2Fclaude-mega-brain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguhcostan%2Fclaude-mega-brain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguhcostan%2Fclaude-mega-brain/lists"}