# X post by @danikkk\_wqs

> Brucky's summary of Anthropic's approach of letting the model write code that calls tools, which the post says cut a task from about 150,000 tokens to 2,000.

Canonical: https://propel.earth/resources/x-2125562246738608337
Last updated: 2026-11-30

Resource · Article

Originally posted by Brucky @danikkk\_wqs · 2026-11-25

> This is f\*cking brutal, Anthropic's own engineers cut Claude's token use by 98\.7% and you're still paying full price
> 
> they published exactly how they did it\:
> 
> 150,000 tokens → 2,000
> same tools, same task, same model
> 
> the trick\: Claude stops calling tools one by one and writes code that calls them, so only the answer comes back
> 
> browse → load → filter → loop → mask → save
> 
> 1\. tools become files
> every MCP tool \(the apps Claude plugs into\) gets its own file\. Claude browses the folder and opens only what it needs
> 
> 2\. load on demand
> no more reading every tool's instructions upfront, it pulls in just the ones it'll use
> 
> 3\. filter before reading
> a 10,000\-row spreadsheet? the code cuts it down and Claude sees 5 rows
> 
> 4\. loops run in code
> waiting for "deploy done" in Slack? a loop keeps checking without waking the model every time
> 
> 5\. private data stays private
> emails and phone numbers turn into \[EMAIL\_1\] and \[PHONE\_1\]\. the real data goes to Salesforce, the model never sees it
> 
> 6\. it keeps what works
> working code gets saved to \./skills with a SKILL\.md, so next time it reuses its own toolkit
> 
> the catch\: the code has to run in a sandbox, so set that up first
> 
> same Claude, 75x less context burned
> 
> I packed all 6 into one prompt for Claude Code
> 
> save it, prompt below ↓

[Video in the post](https://x.com/danikkk%5Fwqs/status/2125562246738608337)

## Quoted post by Brucky @danikkk\_wqs

https\://x\.com/i/article/2112980660566851585

### The Second Brain Guide\: How to Stop Re\-Explaining Yourself to Claude \(Full Build\)

![Article cover image](https://pbs.twimg.com/media/HVLj5UaWIAAg1-w.jpg)

Every Claude session starts cold\.

  
The project\. The decisions\. The people\. What you tried last week\. You explain it all again, and by evening you've lost most of it\.

  
A second brain ends that\. Claude reads a folder of plain text files that it also writes and maintains\. The next session starts where the last one stopped\.

  
Andrej Karpathy described the pattern in April 2026\. His gist has 5,000\+ stars and 5,000\+ forks\. The post that launched it was reported at 16 million views within days, and R&#38;D World put it past 21 million by June\. All of that for three folders\.

  
Then I did what almost no copy of it does\. I tested it\.

  
I planted one false sentence in the wiki\: "Bush invented hypertext in 1941\." The source file says nothing like it\. A model asked to "check the wiki for errors" would have let it through, because it sounds right\.

  
A 95 line script with no AI inside printed this\:

```
wiki/memex.md: QUOTE NOT IN SOURCE -> "Bush invented hypertext in 1941" (raw/memex.md)

```

![Image from the article](https://pbs.twimg.com/media/HVLUj%5FyXgAAHV0W.jpg)

That script is in this guide, with everything around it\: the folders, the prompts, the ready\-made repos, one vault for all your projects, hooks, a nightly run, and where the whole idea breaks\.

### What the idea actually is

Normal AI over your files works like RAG\. Every question, the model hunts for fragments and rediscovers your knowledge from scratch\. Nothing accumulates\.

Karpathy's pattern flips it\. The model builds and maintains a wiki of linked markdown pages between you and your sources\. His split of the work\: **Obsidian is the IDE, the LLM is the programmer, the wiki is the codebase\.**

Why a model has to do it\: humans abandon wikis because maintenance grows faster than value\. An LLM doesn't get bored, doesn't forget a cross\-reference, and can touch fifteen files in one pass\.

Three layers\:

- **raw/**\: your sources\. The model reads, never edits\.

- **wiki/**\: pages the model writes and maintains\.

- **CLAUDE\.md**\: the rules\: conventions and workflows\.

Three operations\: **ingest** \(add a source, the model integrates it into 10 to 15 pages\), **query** \(ask, and file good answers back\), **lint** \(find contradictions, stale claims, orphans\)\.

![Image from the article](https://pbs.twimg.com/media/HVLUwHWXMAA0dUz.jpg)

He published it as an idea file, on purpose\. His reasoning\: sharing an idea is worth more than sharing code, because your agent builds it for your needs\. So the gist doesn't tell you what to type\. This guide does\.

### Step 1\: Build it in ten minutes

```bash
mkdir -p brain/{raw,wiki,output,.brain}
cd brain && git init
claude

```

Open the folder as an Obsidian vault if you want the graph view\. Claude Code, started inside that folder, reads and writes the files directly\. Several guides send you through the Local REST API plugin and an MCP server first\. You only need that to talk to a running Obsidian\.

**Let Claude write CLAUDE\.md by interviewing you\:**

```
You are setting up my second brain. Interview me one question at a time.
Ask about: who I am and what I do, my goals for this year, how I want
you to communicate with me, my strengths and weaknesses, and my current
projects. Wait for each answer. When finished, write everything into
CLAUDE.md at the root, with clear headers.

```

**Ingest\:**

```
I just added [filename] to raw. Read it, write a page for each major
concept into wiki, link it to related pages, flag contradictions with
existing pages. Summarize what changed in three sentences.

```

**Query\:**

```
Read wiki/index.md first. Open only the pages you need. Answer with the
page names you used. If the answer is worth keeping, save it as a new
page in wiki and link it to its sources.

```

**Lint \(report only\)\:**

```
Check the wiki for contradictions, claims a newer source has superseded,
orphan pages, and concepts mentioned in several places with no page of
their own. Report only. Fix nothing yet.

```

Naming rules that decide whether it survives\: one file, one topic\. Name the file for what it contains \(tax\-policy\.md, never note\-12\.md\)\. Lowercase with hyphens\.

For a project, make a folder with Inputs, Process, Outputs and Feedback, plus its own CLAUDE\.md\: what it is, its one goal, what done looks like\.

### Step 2\: Skip the scaffolding with a ready\-made repo

I checked each on GitHub while writing\.

- **claude\-obsidian** \(AgriciDaniel\)\: 15\.0k stars, MIT\. Commands /claude\-obsidian\:wiki, \:wiki\-ingest, \:wiki\-query, \:wiki\-lint, \:save\. Install\: clone, run the preview\-then\-apply init, then claude \-\-plugin\-dir /absolute/path/to/claude\-obsidian\.

- **obsidian\-second\-brain** \(eugeniughelbur\)\: 4\.8k stars, MIT, 48 commands, works across Claude Code, Codex, Gemini and more\. In Claude Code\: /plugin marketplace add eugeniughelbur/obsidian\-second\-brain, then /plugin install obsidian\-second\-brain@obsidian\-second\-brain\.

- **obsidian\-skills** \(kepano, the Obsidian creator\)\: 49\.8k stars, MIT\. Teaches agents Obsidian's native formats\. /plugin marketplace add kepano/obsidian\-skills, then /plugin install obsidian@obsidian\-skills\.

- **second\-brain\-starter** \(coleam00\)\: 795 stars\. Not a vault\. A skill that interviews you and generates a nine\-phase build plan\.

Some popular guides still quote 6,800 stars for claude\-obsidian, 35,000 for obsidian\-skills, and an install script that no longer exists\. Those numbers are out of date\.

### Step 3\: One brain for every project

The best idea in the whole stack\: don't build a second brain per project\. Point every Claude Code project at the same vault\. In each project's CLAUDE\.md\:

```
## Wiki Knowledge Base
Path: ~/path/to/vault

When you need context not already in this project:
1. Read wiki/hot.md first (recent context cache)
2. If not enough, read wiki/index.md
3. If you need domain details, read the relevant domain sub-index
4. Only then drill into specific wiki pages

Do NOT read the wiki for general coding questions.

```

Code, content and research all drink from one knowledge base\. The last line is the cost control\. Without it the agent wanders into the vault on every task\.

![Image from the article](https://pbs.twimg.com/media/HVLU5KZWIAART9L.jpg)

hot\.md is a dozen lines\: what you're working on, what changed last, open questions\. Don't import a big index with [@index](https://x.com/index)\.md\. Imports load at launch and cost as much context as pasting the file in\.

### Step 4\: Give the brain a test suite

Here's the weak point of everything above\. The model writes the wiki, and the same model checks it\. A model reviewing its own work agrees with itself\.

So move the checking out of the model\. This script has no LLM inside\. It tracks ingested files by hash and refuses pages that break the rules\. The full code is in the appendix at the end\.

What it enforces\:

- every page has title, sources, updated

- every listed source exists

- every \[\[link\]\] resolves

- no orphans, no leftover TODO

- raw files changed after ingest are flagged, with the stale pages listed

- **every quoted claim exists word for word in the raw file it cites**

The ingest rule that makes the last one work\: each hard claim ships with a line like

```
> "The essential feature is the association of ideas" - raw/memex.md

```

I broke the vault on purpose\: a fake quote, a broken link, a page with a missing source and a TODO, and a raw file edited after ingest\. Output\:

```
wiki/lonely.md: frontmatter lacks 'updated'
wiki/lonely.md: source raw/gone.md does not exist
wiki/lonely.md: unresolved TODO
wiki/memex.md: broken link [[nonexistent-page]]
wiki/memex.md: QUOTE NOT IN SOURCE -> "Bush invented hypertext in 1941" (raw/memex.md)
wiki/lonely.md: orphan (no inbound links)
raw/memex.md: changed since ingest, pages stale: wiki/memex.md, wiki/associative-trails.md
lint: 7 problem(s) in 4 pages

```

Seven problems\. Milliseconds\. Zero tokens\.

![Image from the article](https://pbs.twimg.com/media/HVLVAnjXIAAKVKy.jpg)

The manifest also makes ingest incremental\. python3 [brain\.py](https://brain.py/) status lists only NEW, CHANGED and DELETED raw files, so cost follows what changed, not the size of the vault\.

### Step 5\: Wire it into Claude Code so you can't forget it

\.claude/settings\.json\:

```json
{
  "permissions": {
    "deny": ["Edit(/raw/**)", "Read(./.env)"]
  },
  "hooks": {
    "SessionStart": [{"matcher": "startup|resume|clear|compact",
      "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/session-start.sh"}]}],
    "PostToolUse": [{"matcher": "Edit|Write",
      "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post-wiki-edit.sh"}]}]
  }
}

```

Two facts from the permissions docs\. Path rules are consulted only for Edit\(\.\.\.\) and Read\(\.\.\.\)\: a Write\(raw/\*\*\) rule is accepted and never used\. And Edit\(/raw/\*\*\) is relative to the project root\. That makes raw/ read\-only by configuration\. One of the four guides says it right\: keys, not prompts\. "Please don't delete this" is a suggestion, and CLAUDE\.md is context, not enforcement\.

The limit\: deny rules cover Claude's file tools and recognized commands like cat and sed, not a Python script that opens files itself\. For a hard wall, turn on the sandbox\.

After every edit under wiki/, the linter runs\:

```bash
#!/bin/bash
f=$(jq -r '.tool_input.file_path // empty')
case "$f" in */wiki/*) cd "$CLAUDE_PROJECT_DIR" && python3 brain.py lint >&2 || exit 2;; esac
exit 0

```

Exit code 2 from a PostToolUse hook can't undo the edit, since the tool already ran, but the error text reaches Claude\. The model writes a page, the linter answers in the same turn, the model fixes it\.

![Image from the article](https://pbs.twimg.com/media/HVLVKTyXsAEy3wm.jpg)

At session start, state goes into context before your first prompt\:

```bash
#!/bin/bash
cd "$CLAUDE_PROJECT_DIR" || exit 0
echo "Second brain state."
[ -f wiki/hot.md ] && { echo "--- wiki/hot.md ---"; cat wiki/hot.md; }
echo "--- pending ingest ---"
python3 brain.py status 2>&1
exit 0

```

Matcher values are startup, resume, clear and compact, so the briefing survives a /clear\.

**Make ingest a command\.** Skills live in \.claude/skills/&#60;name&#62;/SKILL\.md\:

```
---
name: ingest
description: Compile new or changed files from raw/ into wiki pages.
disable-model-invocation: true
---

1. Run `python3 brain.py status`. Work only on files it lists.
2. Read each raw file fully, then create or update wiki pages.
3. Frontmatter on every page: title, sources, updated.
4. Every concrete claim gets a quote line: > "exact text" - raw/<file>
5. Link related pages with [[page-name]]. No orphans.
6. Run `python3 brain.py lint` until it exits 0.
7. Run `python3 brain.py done <raw file> <pages...>`, then `python3 brain.py index`.

```

Type /ingest\. disable\-model\-invocation\: true keeps it on a human trigger, which is right for something that rewrites files\.

**Commit after every ingest\:** git add \-A &#38;&#38; git commit \-m "ingest &#60;source&#62;"\. The diff shows exactly what the model changed in your knowledge\. A bad ingest is one git revert away\.

### Step 6\: Put it on autopilot

Claude Desktop has a Schedule tab for a daily task\. In the terminal, claude \-p runs a prompt non\-interactively and exits non\-zero on failure, so cron and CI can use it\:

```bash
cd ~/brain && claude -p "/ingest" \
  --allowedTools "Read,Edit,Bash(python3 brain.py *),Bash(git add *),Bash(git commit *)"

```

The space before the star makes it a prefix match\. The docs recommend \-\-bare for scripted runs, but bare mode does not load your hooks, skills or CLAUDE\.md unless you pass them as flags, and it needs an API key instead of your subscription login\. For a personal vault the plain form is simpler today\. The docs also say bare mode will become the default for \-p in a future release, so after an update check that your nightly run still loads /ingest\.

Dumping 40 sources at once? Run one subagent per source on a cheaper model\. Subagents return only a summary, so forty documents never flood your main context\. Then check the results with a separate verifier in a fresh context and one question\: does every statement follow from this source?

Web clippings are text from strangers, read by an agent that can edit files\. Your three defenses are the deny rule on raw/, the quote check, and the git diff\. Install the Obsidian Web Clipper so everything you read lands in raw/ in one click, and run /ingest on Sunday night\.

### Where it breaks

- **The dead zone\.** Below roughly 50 to 100 sources a wiki behaves like a good search engine\. You pay the setup and get search back\. This is where most people quit\.

- **Bad sources spread\.** One wrong note in a notes app is one wrong note\. One wrong source in a compiled wiki has already touched 10 to 15 pages\. The manifest, the quote check and the diff exist for this\.

- **Scale\.** One critic of the pattern says it works while the index fits in one context window, around 50,000 to 100,000 tokens of compiled content\. That critic sells a competing product, so weigh it\. A one\-month review at R&#38;D World reached about 760 pages, called it moderately helpful for narrow cases, and said maintenance time and time saved were roughly a wash at month one\.

- **No lifecycle\.** The pattern has no signal for whether a month\-one page is still current\. Lint has to run on purpose\.

- **My test\.** A small sample vault, not a thousand files\. The linter checks structure and quotes, not truth\. A wrong source makes a faithfully wrong wiki\.

- **Memory limit\.** Claude Code's auto memory loads only the first 200 lines or 25KB of MEMORY\.md\. Keep the hot cache short\.

### What month three looks like

Week one\: five seeded pages and a tiny graph\. Past the density threshold, searches start returning connections you didn't make, because the wiki was linking while you were doing something else\. By month six, every session starts where the last one stopped, and the gap to someone opening a blank chat each morning is structural\.

Tonight\: make the folders, run the interview prompt, put five sources in raw/\. Add the linter before you add the fiftieth\.

### Appendix\: [brain\.py](https://brain.py/)

Save as [brain\.py](https://brain.py/) in the vault root\. Python 3, standard library only\. Commands\: status, done &#60;raw&#62; &#60;wiki\.\.\.&#62;, lint, index\. Quote lines may use a hyphen or a long dash before the source path\.

```python
#!/usr/bin/env python3
"""brain.py - deterministic build tools for a markdown second brain.
status | done <raw> <wiki...> | lint | index
Standard library only."""
import sys, re, json, hashlib, pathlib

ROOT = pathlib.Path(__file__).resolve().parent
RAW, WIKI = ROOT / "raw", ROOT / "wiki"
MANIFEST = ROOT / ".brain" / "manifest.json"
LINK = re.compile(r"\[\[([^\]|#]+)(?:[#|][^\]]*)?\]\]")
QUOTE = re.compile(r'^>\s*"(.+?)"\s*[\u2014\u2013-]+\s*(raw/\S+)\s*$', re.M)

def sha(p): return hashlib.sha256(p.read_bytes()).hexdigest()[:16]
def load():
    return json.loads(MANIFEST.read_text()) if MANIFEST.exists() else {}
def raws(): return sorted(p for p in RAW.rglob("*") if p.is_file())
def pages(): return sorted(WIKI.rglob("*.md"))
def rel(p): return str(p.relative_to(ROOT))

def status():
    m, todo = load(), []
    for p in raws():
        k = rel(p)
        if k not in m: todo.append(("NEW", k))
        elif m[k]["sha"] != sha(p): todo.append(("CHANGED", k))
    for k in m:
        if not (ROOT / k).exists(): todo.append(("DELETED", k))
    for s, k in todo: print(s, k)
    print(f"pending: {len(todo)}", file=sys.stderr)
    return 0

def done(raw, wiki):
    p = ROOT / raw
    if not p.exists(): print("no such raw file:", raw); return 1
    for w in wiki:
        if not (ROOT / w).exists(): print("no such page:", w); return 1
    m = load(); m[raw] = {"sha": sha(p), "pages": wiki}
    MANIFEST.write_text(json.dumps(m, indent=2, sort_keys=True)); return 0

def frontmatter(text):
    if not text.startswith("---\n"): return None
    end = text.find("\n---", 4)
    if end < 0: return None
    fm = {}
    for line in text[4:end].splitlines():
        if ":" in line:
            a, b = line.split(":", 1); fm[a.strip()] = b.strip()
    return fm

def lint():
    errs, names, text = [], {}, {}
    for p in pages():
        names[p.stem] = p; text[p] = p.read_text()
    inbound = {n: 0 for n in names}
    m = load()
    for p, t in text.items():
        fm = frontmatter(t)
        if p.name in ("index.md", "hot.md", "log.md"): continue
        if fm is None: errs.append(f"{rel(p)}: missing frontmatter"); continue
        for need in ("title", "sources", "updated"):
            if need not in fm: errs.append(f"{rel(p)}: frontmatter lacks '{need}'")
        for src in re.findall(r"raw/[^\s,\]\[]+", fm.get("sources", "")):
            if not (ROOT / src).exists(): errs.append(f"{rel(p)}: source {src} does not exist")
        for l in LINK.findall(t):
            if l in names: 
                if names[l] != p: inbound[l] += 1
            else: errs.append(f"{rel(p)}: broken link [[{l}]]")
        for q, src in QUOTE.findall(t):
            f = ROOT / src
            if not f.exists(): errs.append(f"{rel(p)}: quote cites missing {src}")
            elif " ".join(q.split()) not in " ".join(f.read_text().split()):
                errs.append(f"{rel(p)}: QUOTE NOT IN SOURCE -> \"{q[:50]}\" ({src})")
        if "TODO" in t: errs.append(f"{rel(p)}: unresolved TODO")
    for n, c in inbound.items():
        if c == 0 and n not in ("index", "hot", "log"): errs.append(f"{rel(names[n])}: orphan (no inbound links)")
    for k, v in m.items():
        if (ROOT / k).exists() and sha(ROOT / k) != v["sha"]:
            errs.append(f"{k}: changed since ingest, pages stale: {', '.join(v['pages'])}")
    for e in errs: print(e, file=sys.stderr)
    print(f"lint: {len(errs)} problem(s) in {len(text)} pages", file=sys.stderr)
    return 2 if errs else 0

def index():
    rows = []
    for p in pages():
        if p.name in ("index.md", "hot.md", "log.md"): continue
        fm = frontmatter(p.read_text()) or {}
        rows.append(f"- [[{p.stem}]] - {fm.get('title', p.stem)} ({fm.get('updated', '?')})")
    (WIKI / "index.md").write_text("# Index\n\n" + "\n".join(rows) + "\n")
    print(f"index: {len(rows)} pages"); return 0

if __name__ == "__main__":
    c, a = (sys.argv[1] if len(sys.argv) > 1 else ""), sys.argv[2:]
    sys.exit({"status": lambda: status(), "lint": lambda: lint(), "index": lambda: index(),
              "done": lambda: done(a[0], a[1:])}.get(c, lambda: print(__doc__) or 1)())

```

[Quoted post on X](https://x.com/danikkk%5Fwqs/status/2113001913662734619)

## Editor’s note

> What it is\: Brucky's summary of Anthropic's approach of letting the model write code that calls tools, which the post says cut a task from about 150,000 tokens to 2,000\.
> 
> How to use it\: Read the steps, then try the same idea on one workflow of yours\: let the agent filter data in code and only show it the rows it needs\. The token figures are the author's claim\.

[Original post on X](https://x.com/danikkk_wqs/status/2125562246738608337)

## Related

- [All resources](https://propel.earth/resources)
