MCPcopy Index your code
hub / github.com/AssafWoo/homebrew-pandafilter

github.com/AssafWoo/homebrew-pandafilter @v1.3.26

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.26 ↗ · + Follow
2,655 symbols 8,252 edges 176 files 495 documented · 19% updated 26d agov1.3.26 · 2026-06-12★ 100
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PandaFilter

PandaFilter

The context intelligence layer for AI coding agents.

The layer between your tools and your AI. PandaFilter understands what's noise and what matters — compressing, routing, and preserving the right context so your agent thinks faster, costs less, and never loses its place.

Star PandaFilter on GitHub

Discord   License: MIT   Latest Release

Claude Code   Cursor   Windsurf   Gemini CLI   Codex   Cline   VS Code Copilot   OpenClaw


Install

brew tap AssafWoo/pandafilter
brew install pandafilter

Linux / any platform:

curl -fsSL https://raw.githubusercontent.com/AssafWoo/homebrew-pandafilter/main/install.sh | bash

First run: PandaFilter downloads the BERT model (~90 MB, all-MiniLM-L6-v2) from HuggingFace and caches it at ~/.cache/huggingface/. Subsequent runs are instant.

Then wire it in — one command installs for every AI agent you have:

panda init --agent all

Auto-detects Claude Code, Cursor, Gemini CLI, Codex, Windsurf, Cline, OpenClaw, and VS Code Copilot. Skips anything that isn't installed. Or target one specifically:

panda init                          # Claude Code (default)
panda init --agent cursor           # Cursor
panda init --agent gemini           # Gemini CLI
panda init --agent codex            # Codex (CLI + VS Code extension)
panda init --agent windsurf         # Windsurf
panda init --agent cline            # Cline
panda init --agent openclaw         # OpenClaw
panda init --agent copilot          # VS Code Copilot

What PandaFilter Does

1. Intelligent Compression

Raw command output is filtered, deduplicated, and semantically compressed by a BERT-powered pipeline that understands what matters for your task — not just what matches a regex. When your AI agent runs pip install, cargo build, or npm install, PandaFilter intercepts the output and strips download progress, module graphs, and passing test lines. The agent sees a clean summary with errors, warnings, and results. Nothing useful is dropped.

2. Adaptive Routing (new in v1.3.0)

A content-aware router analyzes each output and activates only the strategies relevant to it: error-focus for test failures, dedup for log streams, structural digest for unchanged file re-reads, semantic summarization for prose. No more one-size-fits-all.

Enable with use_router = true in panda.toml.

3. Session Intelligence

PandaFilter learns your codebase's noise patterns across sessions. It tracks what you've read, what you've changed, and where the context pressure is building — adapting its compression strategy in real time.

New in v1.3.0: File re-reads now send diffs instead of full file content. Unchanged re-reads return structural digests (function/class signatures). Both happen automatically — no config needed.

4. Compaction Survival (new in v1.3.0)

When your agent's context fills up and auto-compacts, PandaFilter preserves what matters: edited files, error signatures, key decisions. The next session starts oriented, not blank.

Requires Claude Code and is installed automatically with panda init.


How it works

When your AI agent runs a command — pip install, cargo build, npm install — PandaFilter intercepts the output and removes everything the model doesn't need: download progress, module graphs, passing test lines, spinners. The agent sees a clean summary with errors, warnings, and results. Nothing useful is dropped.

No config changes. No workflow changes. Runs 100% locally.


See it in action

Run panda gain after a session to see your cumulative savings:

panda gain output


Token savings

Numbers from ccr/tests/handler_benchmarks.rs. Run panda gain to see your own live data.

Operation Without PandaFilter With PandaFilter Savings
pip install 1,787 9 −99%
uv sync 1,574 15 −99%
playwright test 1,367 19 −99%
docker build 1,801 24 −99%
swift build 1,218 9 −99%
dotnet build 438 3 −99%
cmake 850 5 −99%
gradle build 803 17 −98%
go test 4,507 148 −97%
git merge 164 5 −97%
pytest 3,818 162 −96%
terraform plan 3,926 163 −96%
npm install 648 25 −96%
ember build 3,377 139 −96%
cargo build 1,923 93 −95%
cargo test 2,782 174 −94%
git clone 139 8 −94%
bazel build 150 12 −92%
next build 549 53 −90%
cargo clippy 786 93 −88%
make 545 72 −87%
git diff 6,370 861 −86%
git push 173 24 −86%
ls 691 102 −85%
webpack 882 143 −84%
vitest 625 103 −84%
nx run-many 1,541 273 −82%
turbo run build 597 115 −81%
ruff check 2,035 435 −79%
eslint 4,393 974 −78%
grep 2,925 691 −76%
helm install 224 54 −76%
docker ps 1,057 266 −75%
golangci-lint 3,678 960 −74%
git log 1,573 431 −73%
git status 650 184 −72%
kubectl get pods 2,306 689 −70%
vite build 526 182 −65%
jest 330 114 −65%
env 1,155 399 −65%
mvn install 4,585 1,613 −65%
brew install 368 148 −60%
gh pr list 774 321 −59%
biome lint 1,503 753 −50%
tsc 2,598 1,320 −49%
mypy 2,053 1,088 −47%
stylelint 1,100 845 −23%
Total 81,882 14,347 −82%

What's new in v1.3.0

Feature Before After (PandaFilter v1.3.0)
Bash output Full output Compressed by type (error-focus, dedup, stats, etc.)
File re-reads Full file every time Delta diff or structural digest
Context compaction 60–70% conversation lost Session digest preserved and restored
Filtering strategy Fixed pipeline always Adaptive router — right expert per content type
Quality visibility Token savings only Multi-signal quality score in panda gain
Agent support 7 agents 8 agents — OpenClaw added

Commands

panda gain — see your token savings:

panda gain                    # overall summary
panda gain --breakdown        # per-command table
panda gain --history          # last 14 days
panda gain --insight          # categorized savings + top saves

panda doctor — diagnose the full installation in one command.

panda init --uninstall — remove hooks:

panda init --uninstall                  # Claude Code
panda init --agent cursor --uninstall   # Cursor

panda focus — opt-in: tells the agent which files matter for the current prompt, preventing unnecessary reads:

panda focus --enable             # enable for this repo
panda focus --disable            # disable (keeps index data)
panda focus --status             # show status + index age
panda focus --dry-run            # preview guidance without enabling

panda index — manually rebuild the file-relationship index:

panda index                      # full/incremental build for current repo

Other commands:

panda verify                            # check hook integrity
panda discover                          # scan history for unfiltered commands
panda run git status                    # run a command through PandaFilter manually
panda proxy git status                  # run raw (no filtering), record baseline
panda read-file src/main.rs --level auto  # preview read filtering
panda expand ZI_3                       # restore a collapsed block
panda noise                             # show learned noise patterns; --reset to clear
panda compress --scan-session           # compress current conversation context

Handlers (59 handlers)

59 handlers (70+ command aliases) in ccr/src/handlers/. Lookup cascade:

  1. User filters.panda/filters.toml or ~/.config/panda/filters.toml
  2. Exact match — direct command name
  3. Static alias table — versioned binaries, wrappers, common aliases
  4. BERT routing — unknown commands matched by embedding similarity
Handler Keys Key behavior
cargo cargo build/clippy: errors (capped at 15) + warning count. test: failures + summary. nextest run: FAIL lines + Summary.
git git status: counts. log: --oneline, cap 50 with total. diff: 2 context lines, 200-line cap. clone/merge/checkout/rebase: compressed success or full conflict output.
go go test: NDJSON streaming, FAIL blocks + summary. build: errors only.
ember ember build: errors + summary; drops fingerprint/asset spam. test: failures + summary. serve: serving URL only.
tsc tsc Errors grouped by file; deduplicates repeated TS codes. Build OK on clean. Injects --noEmit.
vitest vitest FAIL blocks + summary; drops lines.
jest jest, bun, deno failure blocks + summary; drops PASS lines.
pytest pytest FAILED node IDs + AssertionError + short summary. Injects --tb=short.
rspec rspec Injects --format json; example-level failures with message + location.
rubocop rubocop Injects --format json; offenses grouped by severity, capped.
rake rake, bundle Failure/error blocks + summary; drops passing test lines.
mypy mypy Errors grouped by file, capped at 10 per file. Injects --no-color.
ruff ruff Violations grouped by error code. format: summary line only.
uv uv, uvx Strips Downloading/Fetching/Preparing noise; keeps errors + summary.
pip pip, poetry, pdm, conda install: [complete — N packages] or already-satisfied short-circuit.
python python Traceback: keep block + final error. Detects and compresses tabular/CSV, pandas DataFrames, Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) output. Long output: BERT.
eslint eslint Errors grouped by file, caps at 20 + [+N more].
next next build: route table collapsed. dev: errors + ready line.
playwright playwright Failing test names + error messages; passing tests dropped. Injects --reporter=list.
prettier prettier --check: files needing formatting + count.
vite vite Asset chunk table collapsed, HMR deduplication.
webpack webpack Module resolution graph dropped; keeps assets, errors, build result.
turbo turbo Inner task output stripped; cache hit/miss per package + final summary.
nx nx, npx nx Passing tasks collapsed to [N tasks passed]; failing task output kept.
stylelint stylelint Issues grouped by file, caps at 40 + [+N more].
biome biome Code context snippets stripped; keeps file:line, rule, message.
kubectl kubectl, k get pods: aggregates to [N pods, all running] or problem-pods table with counts. Smart column selection, log anomaly scoring, describe key sections. events: warning-only, capped at 20.
terraform terraform, tofu plan: +/-/~ + summary. validate: short-circuits on success. output: compact key=value. state list: capped at 50.
aws aws, gcloud, az Resource extraction; --output json injected for read-only actions.
gh gh Compact tables for list commands; strips HTML from pr view.
helm helm list: compact table. status/diff/template: structured.
docker docker logs: ANSI strip + BERT. ps/images: formatted tables + total size

Extension points exported contracts — how you extend this code

Handler (Interface)
A specialized handler for a known command. Handlers may inject extra flags (`rewrite_args`) and compact the output (`fil [64 …
ccr/src/handlers/mod.rs
AgentInstaller (Interface)
Common interface for all agent hook installers. [6 implementers]
ccr/src/agents/mod.rs

Core symbols most depended-on inside this repo

is_empty
called by 570
ccr/src/error_signatures.rs
len
called by 383
ccr/src/error_signatures.rs
get
called by 332
ccr-core/src/embed_cache.rs
len
called by 146
ccr-core/src/embed_cache.rs
filter
called by 132
ccr/src/handlers/ls.rs
count_tokens
called by 103
ccr-core/src/tokens.rs
is_empty
called by 100
ccr-core/src/embed_cache.rs
insert
called by 50
ccr/src/pre_cache.rs

Shape

Function 2,235
Method 228
Class 168
Enum 22
Interface 2

Languages

Rust98%
TypeScript1%
Python1%
Ruby1%

Modules by API surface

ccr-core/src/summarizer.rs100 symbols
ccr/src/cmd/rewrite.rs83 symbols
ccr/src/handlers/git.rs67 symbols
ccr/tests/handler_benchmarks.rs66 symbols
ccr/src/hook.rs60 symbols
ccr/src/cmd/gain.rs55 symbols
ccr/src/handlers/util.rs54 symbols
ccr/src/session.rs53 symbols
ccr/src/handlers/cargo.rs45 symbols
ccr/src/handlers/focus_compress.rs44 symbols
ccr/src/handlers/read.rs42 symbols
ccr/src/handlers/docker.rs40 symbols

Datastores touched

(mongodb)Database · 1 repos

For agents

$ claude mcp add homebrew-pandafilter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page