r/ClaudeCode • • 2d ago

Built with Claude Claude Code Skill (/microbrains) - save up to 81 percents of tokens

🧩 Built-in Claude Code Skill (/microbrains)

https://github.com/drtikov/microbrainsforagents

This repository includes a ready-to-use Claude Code skill in .claude/skills/microbrains/. Think of it as a local safety belt and instant spellcheck that sits quietly on your computer and checks Claude's edits and shell commands in under a millisecond before anything runs.

One-Command Setup

pip install -e .
python .claude/skills/microbrains/install_hook.py              # enforce mode (allow/ask/deny) + --session-state auto
python .claude/skills/microbrains/install_hook.py --shadow     # observe-only mode first (logs, never blocks)
python .claude/skills/microbrains/install_hook.py --preset solo-dev  # preset bundles: solo-dev | ci | paranoid (--no-* flags override)
python .claude/skills/microbrains/install_hook.py --http-daemon http://127.0.0.1:8765  # native Claude Code HTTP hook mode
python .claude/skills/microbrains/install_hook.py --shared     # optional: write portable config to .claude/settings.json
python .claude/skills/microbrains/install_hook.py --dry-run    # preview changes without writing
python .claude/skills/microbrains/install_hook.py --self-test  # verify imports, probe verdicts, and installed matchers
python .claude/skills/microbrains/install_hook.py --remove     # uninstall hooks cleanly anytime
python -m aetheris_microbrains.doctor                          # full installation, policy, journal, MCP pin & daemon health check
python -m aetheris_microbrains.doctor --scan-mcp               # audit .mcp.json servers & tool manifests for poisoning/rug-pulls

Installed console entrypoints: aetheris-hook, aetheris-doctor, aetheris-audit, aetheris-daemon.

By default, install_hook.py writes hooks relative to the repository root next to the script into .claude/settings.local.json (which is gitignored, so your local Python path is never committed to git) with --session-state auto for cross-turn IFC taint protection; pass --project-dir /path/to/project when installing from a wheel or shared environment into another repository. For active coding sessions, running the warm daemon is the recommended default—cold per-call CLI spawns spend ~94 ms on Python interpreter startup versus <1 ms warm evaluation—either via the TCP evaluator (python -m aetheris_microbrains.hook_daemon) or the native HTTP hook endpoint (python -m aetheris_microbrains.hook_daemon --http --port 8765 paired with install_hook.py --http-daemon http://127.0.0.1:8765).

What It Gives You

  • Catches broken code before it wastes tokens & turns: Flags syntax typos before saving the file so Claude fixes them right away instead of running failing tests and burning expensive retry turns on tracebacks.
  • Protects your machine and secrets: Blocks destructive commands (rm -rf /, dd, curl | sh), stops hardcoded API keys from being written into source code, guards .env / .ssh/, and scrubs leaked secrets from tool outputs.
  • Pauses and asks instead of guessing: Unfamiliar commands or sensitive reads ask for confirmation with a clear risk level (LOW, MEDIUM, or HIGH) and plain-language reason, failing closed on timeout.
  • Instant "why was that blocked?" explanations: Ask Claude "why was my command blocked?" or run python -m aetheris_microbrains.audit --last to inspect the local decision journal.
  • MCP tool safety checks: Lets Claude check third-party MCP tool schemas and tool outputs for hidden prompt-injection tricks.
  • No noticeable slowdown: Adds under 1 millisecond per check (~11 ms total across a 26-step session), with zero network or GPU overhead.

Measured Session Benefit (python aetheris_microbrains/tests/test_skill_gain_ab.py)

In a reproducible 26-step coding session benchmark (14 normal steps + 12 hazards: 4 syntax errors and 8 security incidents):

MetricWithout GateWith /microbrains Gate
Hazards caught0 / 1212 / 12
Normal calls falsely blocked—0 / 14
Runtime syntax failures40
Wasted recovery turns (modeled)80
Input tokens saved (modeled)0~37k
Total gate time across session0.0 ms~11 ms (~0.43 ms mean / ~0.77 ms p95)

Note: Interception counts, false-positive counts, and gate latency are measured directly in the benchmark; token and turn savings are modeled estimates under documented Sonnet-class pricing constants in test_skill_gain_ab.py.🧩 Built-in Claude Code Skill (/microbrains)
This repository includes a ready-to-use Claude Code skill in .claude/skills/microbrains/. Think of it as a local safety belt and instant spellcheck that sits quietly on your computer and checks Claude's edits and shell commands in under a millisecond before anything runs.
One-Command Setup
pip install -e .
python .claude/skills/microbrains/install_hook.py # enforce mode (allow/ask/deny) + --session-state auto
python .claude/skills/microbrains/install_hook.py --shadow # observe-only mode first (logs, never blocks)
python .claude/skills/microbrains/install_hook.py --preset solo-dev # preset bundles: solo-dev | ci | paranoid (--no-* flags override)
python .claude/skills/microbrains/install_hook.py --http-daemon http://127.0.0.1:8765 # native Claude Code HTTP hook mode
python .claude/skills/microbrains/install_hook.py --shared # optional: write portable config to .claude/settings.json
python .claude/skills/microbrains/install_hook.py --dry-run # preview changes without writing
python .claude/skills/microbrains/install_hook.py --self-test # verify imports, probe verdicts, and installed matchers
python .claude/skills/microbrains/install_hook.py --remove # uninstall hooks cleanly anytime
python -m aetheris_microbrains.doctor # full installation, policy, journal, MCP pin & daemon health check
python -m aetheris_microbrains.doctor --scan-mcp # audit .mcp.json servers & tool manifests for poisoning/rug-pulls
Installed console entrypoints: aetheris-hook, aetheris-doctor, aetheris-audit, aetheris-daemon.
By default, install_hook.py writes hooks relative to the repository root next to the script into .claude/settings.local.json (which is gitignored, so your local Python path is never committed to git) with --session-state auto for cross-turn IFC taint protection; pass --project-dir /path/to/project when installing from a wheel or shared environment into another repository. For active coding sessions, running the warm daemon is the recommended default—cold per-call CLI spawns spend ~94 ms on Python interpreter startup versus <1 ms warm evaluation—either via the TCP evaluator (python -m aetheris_microbrains.hook_daemon) or the native HTTP hook endpoint (python -m aetheris_microbrains.hook_daemon --http --port 8765 paired with install_hook.py --http-daemon http://127.0.0.1:8765).
What It Gives You
Catches broken code before it wastes tokens & turns: Flags syntax typos before saving the file so Claude fixes them right away instead of running failing tests and burning expensive retry turns on tracebacks.
Protects your machine and secrets: Blocks destructive commands (rm -rf /, dd, curl | sh), stops hardcoded API keys from being written into source code, guards .env / .ssh/, and scrubs leaked secrets from tool outputs.
Pauses and asks instead of guessing: Unfamiliar commands or sensitive reads ask for confirmation with a clear risk level (LOW, MEDIUM, or HIGH) and plain-language reason, failing closed on timeout.
Instant "why was that blocked?" explanations: Ask Claude "why was my command blocked?" or run python -m aetheris_microbrains.audit --last to inspect the local decision journal.
MCP tool safety checks: Lets Claude check third-party MCP tool schemas and tool outputs for hidden prompt-injection tricks.
No noticeable slowdown: Adds under 1 millisecond per check (~11 ms total across a 26-step session), with zero network or GPU overhead.
Measured Session Benefit (python aetheris_microbrains/tests/test_skill_gain_ab.py)
In a reproducible 26-step coding session benchmark (14 normal steps + 12 hazards: 4 syntax errors and 8 security incidents):
Metric Without Gate With /microbrains Gate
Hazards caught 0 / 12 12 / 12
Normal calls falsely blocked — 0 / 14
Runtime syntax failures 4 0
Wasted recovery turns (modeled) 8 0
Input tokens saved (modeled) 0 ~37k
Total gate time across session 0.0 ms ~11 ms (~0.43 ms mean / ~0.77 ms p95)

Note: Interception counts, false-positive counts, and gate latency are measured directly in the benchmark; token and turn savings are modeled estimates under documented Sonnet-class pricing constants in test_skill_gain_ab.py.

0 Upvotes

5 comments sorted by

•

u/AutoModerator 2d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/Realistic_Bag_7054 2d ago

God awful bot. Talks big about this repository but forgets to link it. 

1

u/Living_Cell7304 1d ago

Wow more useless garbage claiming to save tokens

1

u/drtikov 1d ago

You so nice today...