I made an open-source tool that shrinks your LLM context before it hits the model — feedback and contributors wanted

I made an open-source tool that shrinks your LLM context before it hits the model — feedback and contributors wanted

I've been working on SlimToken, an open-source token compressor that minifies your LLM context before it's sent to the model, so you fit more into your context window and pay for fewer tokens. It started as a fix for hitting context limits and ballooning token costs, and it's in a state I'm happy to share. It's MIT licensed at github.com/greyok00/slimtoken, and it ships with orjson, xxhash, and tiktoken so its token counts are real (cl100k), not guesses.

Three ways to run it (same code, same wins)

- Proxy (default) — an always-on server in front of Anthropic / OpenAI / Ollama. slimtoken install wires ANTHROPIC_BASE_URL to it, so every request is minified automatically and reversibly (slimtoken uninstall restores everything).

- MCP server — exposes the pipeline as 8 tools any MCP agent can call on demand.

- Agent Skill + CLI + library — a packaged skill for Claude Code / Codex / OpenCode, a slimtoken optimize CLI, and import slimtoken as a plain Python library. The always-on minify pipeline (runs on every request by default)

- 🧰 tools — drops $comment/title/examples from schemas, keeps structure and enums, compresses descriptions to their first example.

- 📋 system — collapses repeated banner lines and whitespace outside code fences; preserves <tag> markers and fenced code byte-for-byte.

- 💬 messages — collapses blank-line runs and trailing whitespace in text; passes tool/image blocks through untouched.

- 🔄 dedup — collapses repeated tool_result contents; latest copy kept verbatim, older copies stubbed.

- 📝 distill — truncates old assistant prose beyond the last N turns (fence-aware, no model call).

- 🎯 budget — a hard token cap that drops a leading prefix pair-safely when you're over.

- 🌐 DOM prune (opt-in) — strips script/style/svg, nav/footer, and layout attrs from large HTML tool results.

- 🗜️ tool_compress — type-specific reduction of big tool results (directory listings, git output, logs, JSON, source).

Safety guarantees: fenced code blocks preserved byte-identical, pruning is pair-safe (a tool_result is never orphaned from its tool_use), unchanged content is returned zero-copy, and the grammar field is stripped.

Output filter (filler-strip on by default) — drops lead-in filler like "Sure!" / "Here is the code:" from the streamed head, plus opt-in output token cap and stop sequences, all applied to the stream so a runaway completion is cut off at the source.

Prompt reframe — when the user prompt itself is the problem: a pure-CPU (~1 ms) rewriter with no model roundtrip that turns a rambling 200-word request into a tight ~25-word instruction while preserving intent by construction. Five stages (classify_domain → reframe → shrink → minify → build_system), available as Python API, CLI, and an MCP server.

Measured savings, not marketing — slimtoken presets --measure recomputes the tables on your machine. On a bloated coding session the pipeline drops ~57–64% of tokens; on HTML dumps ~83%. The honest caveat is in the README: a clean short session gets ~0% — it removes redundancy, never invents savings.

Backends — Anthropic (identity), OpenAI, and Ollama, with bodies normalized to a canonical form so no optimization logic is duplicated. Pair-safety holds across the round trip.

One config, no profiles — the full pipeline is always on; every stage and knob is a raw SLIMTOKEN_* env switch (turn off a single lossy stage, or SLIMTOKEN_MINIFY=0 for raw passthrough).

Local-model helpers

- VRAM presets (4/8/16 GB) for common local models, each with a usable-context recommendation and live-measured reduction.

- High-context dense + MoE table — effective raw-token capacity after compression (e.g. ~898k effective on a 128k MoE row), because compression effectively multiplies your context window.

- Config optimizer — inspects your GPU VRAM and model size and recommends ready-to-paste llama-server flags (full offload, flash attention, KV-quant, ubatch, --kv-unified) that typically

give 2–4× decode speedup and ~2× context capacity.

Observability — stats.json and a /metrics endpoint with cumulative token counts and per-request latency buckets, so you can see exactly what you're saving.

What I'm asking for:

- Recommendations — which backends or integrations would make you reach for it? Better compression heuristics, a web UI, more model families?

- Contributors — it's a solo project; help with testing across backends, packaging, docs, and new compressor strategies is very welcome. Issues, PRs, and "this is over-engineered, just do X" are all gold.

Even a quick honest "here's where it breaks" is hugely useful. Thanks for reading! 🙌

u/Intelligent-Key7357 — 2 days ago
▲ 14 r/agenticAI+3 crossposts

I built a fully-local AI coding agent that runs on llama.cpp — no cloud, no API key. Looking for feedback and contributors

https://www.youtube.com/watch?v=-UbYdRgwRWE

I've been building CortexAgent as a personal project for a while, and I finally got it to a place I'm happy to share. It's a private, local AI coding agent — everything runs on your own machine via llama.cpp. No cloud, no account, no API key, and no data ever leaves your computer. It binds to 127.0.0.1 only.

It's MIT licensed at https://github.com/greyok00/cortexagent.

One terminal interface, one local stack — the only interface you talk to is a single clean TUI (cortex). A 35B MoE does the heavy lifting on your GPU (16 GB+ VRAM recommended), with a small "overseer" model for planning and routing. Nothing else to juggle.

The processing pipeline you can watch — every request animates live through its stages, with real percentages (it never fakes a determinate number):

- 🧠 preparing — organizes your request and checks the context it needs.

- 🗜️ slimtoken — minifies your context before it reaches the model, so you fit more into the window.

- 📤 sending — the request goes to the big model.

- ✨ generating — streamed output builds in place.

- 🔧 tool wait — when the model calls a tool mid-request.

Overseer routing — a dedicated small model plans and routes each request to the big model, instead of one model trying to do everything.

Memory that actually remembers — hot working memory for the current session plus curated cold knowledge, distilled automatically from what you've already said, so you don't re-explain yourself across sessions.

Domain memory — recalled context from your own notes is injected automatically when it's relevant, no prompting needed.

Talk instead of type — speech-to-text as a floating popout you control with the mouse and your voice only (no keyboard), transcribed locally with faster-whisper. Open it from the system tray under STT Controls.

Tools & integrations

- 🌐 browser control — drive Brave over Chrome DevTools Protocol, exposed as 9 brave_* tools registered directly in the tool registry.

- 🔌 MCP client + lazy proxy — talk to MCP servers, spawning the real server only on first use instead of holding every socket open.

- 🔎 Firecrawl — web research and page parsing routed through a proxy.

- 🎨 image & video generation — SD 1.5 / SDXL / LTX run in-process through HuggingFace diffusers on the GPU the daemon already manages — no separate GUI server.

- 📄 PDF & document knowledge — ingest PDFs and documents into a queryable knowledge base.

See the whole thing — a web UI with a three.js 3D cortex scene (gold neural cortex + glass chat), a system tray dashboard, a session bridge so the TUI, web UI, and overseer all agree on context, and a live status ticker.

Under the hood

- ⚙️ Daemon lifecycle — the model + proxy run as an always-on service (systemd); VRAM-aware fallback swaps models when GPU memory gets tight.

- 📅 Scheduler + worker pool + heartbeat — background jobs run and recover cleanly.

- 🛡️ Reliability layer — pre-flight gate, anti-hallucination + post-response verification, a doctor that repairs settings drift, loop guard, chain diagnostics, and observability.

- 🛤️ Pathway capture — records each run's processing chain (frame → domain check → route → generate) as replayable runs.

- 💾 Snapshot / backup scripts — easy state backup.

Privacy isn't a feature, it's the baseline — everything binds to 127.0.0.1, and there's no cloud account to leak to. The honest caveat: the processing animation shows real percentages only; if a stage is a wait, it says so instead of pretending to progress.

What I'm asking for:

- Recommendations — what would make this a daily driver for you? Better docs, packaging/installers (pip/Homebrew/AUR), more model backends, UI polish, more tools?

- Contributors — it's a solo project; help with docs, testing, packaging, and hardening is very welcome. Issues, PRs, and "your docs confused me here" all help. Even a quick honest "here's where it breaks" is hugely useful. Thanks for reading! 🙌

u/Intelligent-Key7357 — 1 day ago
▲ 1 r/ASU

Summer Financial Aid Issues. They're making me do a second MPN and credit check? Why?

My financial aid is all kinds of messed up and they won't fix it. They'll barely respond to calls or emails. They never reply to Help Desk messages. I have to wait for Live Chat Support every time I want to speak to them.

My loans were scheduled to be disbursed on the 8th.

I was approved for the loans, given a Direct Loan Notice, have a credit check on my report, etc., from over a week ago. I did the MPN through the Student Aid website months ago but they wanted me to do their special one through their financial education portal for Student Entrance Counseling

It's also done. I've emailed both files to them. They won't reply. It's been over a week.

My loans were in processing but all say approved now. Today there's another hold for the Entrance Counseling yet again. I can't do anything about it.

My graduate advisor seems almost offended when I contact them so I don't. I don't know what else to do when everything is done on the U.S. Student Aid portal but ASU is doing it twice?

I just want my damn disbursement. Before they sent me two emails saying they're mailing me a check and disbursing my funds into my account but it never happened. They told me it was an error and to ignore them last week but here we are!

reddit.com
u/Intelligent-Key7357 — 3 months ago