claudeers.

🔓 unclaimed — this page was auto-generated from GitHub. Are you the creator?

Claim this page →
// RAG & Knowledge

claude-mega-brain

OKF-powered knowledge context for Claude Code — injects your project's knowledge base at every session

Actively maintained
100/100
last commit 8 days ago
last release 9 days ago
releases 1
open issues 0
// install
git clone https://github.com/guhcostan/claude-mega-brain
claude-mega-brain logo

claude-mega-brain

Loads the knowledge. Skips the search.

100% accuracy · 0 tool calls · −66% tokens vs Obsidian+MCP

Real agentic sessions. Benchmark →


Install

/plugin marketplace add guhcostan/claude-mega-brain
/plugin install mega-brain@mega-brain

Then in any project:

/mega-brain:init

Start a new session — the knowledge base loads automatically.


The problem

Without claude-mega-brain, Claude guesses from training data:

User: What column stores the order total?

Claude (no context): Typically total_amount (DECIMAL) or amount (FLOAT)...
# Wrong — this project uses total_cents (INT64)

With claude-mega-brain, the exact schema is injected at SessionStart:

<mega-brain>
Knowledge: 4 documented concepts found in project

  docs/orders.md     [BigQuery Table] — total_cents INT64, status STRING(pending/confirmed/shipped/done)
  docs/customers.md  [BigQuery Table] — customer_id STRING, email STRING, country STRING
  docs/wau.md        [Metric]         — COUNT(DISTINCT user_id) WHERE session_date >= CURRENT_DATE-7
  docs/net_revenue.md [Metric]        — SUM(total_cents - refund_cents)/100 WHERE status='done'
</mega-brain>

User: What column stores the order total?

Claude: total_cents (INT64) — from docs/orders.md
# Correct. 0 tool calls. First turn.

Benchmark

10 questions with project-specific values unknowable from training data. Real agentic sessions — not simulated.

Benchmark chart

metricno contextObsidian+MCPCLAUDE.md (raw files)claude-mega-brain
accuracy (no tools)50%13%100%100%
accuracy (agentic)100%†100%†100%100%
tool calls avg1.10.90.10
tokens avg61,52149,18620,62416,547
latency avg ms10,26710,9865,4944,384

† 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%.

CLAUDE.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.

Full results · Reproduce


How it works

At SessionStart, a hook scans the entire project for any .md file with type: in its YAML frontmatter and injects a compact index:

<mega-brain>
Knowledge: 8 documented concepts found in project

Recent (log.md):
  2026-06-29 — added customers table

  index.md            [Index]         — Central reference for all sales data
  docs/orders.md      [BigQuery Table] — One row per completed order
  docs/customers.md   [BigQuery Table] — Customer profiles
  docs/wau.md         [Metric]         — Weekly active users
  ...
</mega-brain>

No dedicated folder needed — documents can live anywhere in the project. When Claude reads an OKF file, linked concepts surface automatically via PostToolUse.

Zero overhead when not in use — if no documented concepts are found, the hook exits in <5ms.


How it compares

toolauto-injectschema enforcementtool calls to answeraccuracy (no tools)
claude-mega-brain✓ SessionStart hookrequired (type:)0100%
CLAUDE.md + additionalDirectoriesmanual setupnone0100%*
Obsidian + MCP✗ manualnone1–313%
Notion✗ manualproprietaryN/A
Logseq✗ plugin-basednoneN/A
mem.ai✗ nonenoneN/A

* CLAUDE.md matches mega-brain accuracy but uses 25% more tokens and is 25% slower — raw file dump vs compressed structured index.


OKF Format

Any .md file in the project with type: in its YAML frontmatter is automatically picked up. No dedicated folder needed.

---
type: BigQuery Table
title: Orders
description: One row per completed customer order.
resource: https://console.cloud.google.com/bigquery?p=acme&d=sales&t=orders
tags: [sales, revenue]
timestamp: 2026-06-29T00:00:00Z
---

# Schema
| Column      | Type      | Description              |
|-------------|-----------|--------------------------|
| order_id    | STRING    | Globally unique order ID |
| customer_id | STRING    | FK → customers           |
| total_cents | INT64     | Order total in cents     |
| status      | STRING    | pending/confirmed/shipped/done |

# Joins
Joined with [customers](https://github.com/guhcostan/claude-mega-brain/blob/HEAD/customers.md) on `customer_id`.

Reserved files

FilePurpose
index.md (with type: Index)Knowledge map — Claude reads this first
log.md (with type: Log)Append-only changelog — last 3 entries injected at session start

Common types

BigQuery Table · BigQuery Dataset · Table · Metric · API · Runbook · Concept · Service · Pipeline

Types are freeform — add your own.


Usage

Start from scratch

/mega-brain:init

Creates index.md and log.md anywhere you want. Start a new session — context injects automatically.

Migrate existing docs

/mega-brain:migrate

Scans openapi.yaml, schema.prisma, schema.sql, docs/, README sections and adds type: frontmatter to generate OKF concepts.

Add a single concept

/mega-brain:ingest

Document a specific table, metric, API, or service. Saves the file wherever makes sense for your project structure.


Installation

Claude Code

/plugin marketplace add guhcostan/claude-mega-brain
/plugin install mega-brain@mega-brain

Local development

claude plugin install /path/to/claude-mega-brain

Config (.mega-brain.json)

Optional per-project overrides:

{
  "dir": "knowledge",
  "maxConcepts": 100,
  "priorityTypes": ["Metric", "BigQuery Table"]
}
FieldDefaultDescription
dir(none)Limit scanning to this subdirectory (relative to project root). When unset, the entire project is scanned.
maxConcepts60Max concepts in injected index
priorityTypes[]Types shown at top of index
exclude[]Additional dirs to skip when scanning

FAQ

Does it slow down every session? No. If no OKF directory exists, the hook exits in <5ms with no context injected.

Can I use it with an existing wiki or docs folder? Add type: YAML frontmatter to any Markdown file and drop it in your OKF dir. Done.

What if I have 500 concepts? Set maxConcepts in .mega-brain.json. The index stays compact; index.md holds the full map.


References


Star History

Star History Chart

License

MIT — The shortest license that works.

// compatibility

Platformsapi
Operating systems
AI compatibilityclaude
LicenseMIT
Pricingopen-source
LanguagePython

// faq

What is claude-mega-brain?

OKF-powered knowledge context for Claude Code — injects your project's knowledge base at every session. It is open-source on GitHub.

Is claude-mega-brain free to use?

claude-mega-brain is open-source under the MIT license, so it is free to use.

What category does claude-mega-brain belong to?

claude-mega-brain is listed under rag in the Claudeers registry of Claude-compatible tools.

7 views
110 stars
unclaimed
updated 8 days ago

// embed badge

claude-mega-brain on Claudeers
[![Claudeers](https://claudeers.com/api/badge/claude-mega-brain.svg)](https://claudeers.com/claude-mega-brain)

// retro hit counter

claude-mega-brain hit counter
[![Hits](https://claudeers.com/api/counter/claude-mega-brain.svg)](https://claudeers.com/claude-mega-brain)

// reviews

// guestbook

0/500

// related in RAG & Knowledge

🔓

✨ Light and Fast AI Assistant. Support: Web | iOS | MacOS | Android | Linux | Windows

// ragChatGPTNextWeb/TypeScript88,374MIT[ claude ]
🔓

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant contex…

// ragthedotmack/JavaScript85,701Apache-2.0[ claude ]
🔓

A light-weight and powerful meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.

// raggsd-build/JavaScript64,654MIT[ claude ]
🔓

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 60-95% fewer tokens, same answers. Library, proxy, MCP server.

// ragheadroomlabs-ai/Python56,255Apache-2.0[ claude ]
Connectorlinks several projects together across the ecosystem · 9 connections
→ see how claude-mega-brain connects across the ecosystem