Categories
Self-Hosted AI Agents RAG LLMOps Context Engineering Token Optimization Context Optimization Prompt CompressionStars
Forks
Watchers
Developer links
Euron Open ContextForge
Euron Open ContextForge shrinks the history, retrieved passages, and tool output an LLM app is about to send, so each call costs fewer tokens and still carries every fact the task needs. Counts use the target model's own tokenizer, exact for OpenAI families. System instructions, recent turns, pinned messages, and tool call pairs are never rewritten, and any string you name stays intact. Duplicates go first (repeated turns, repeated test logs), then bulk tool output, with JSON kept valid and file reads kept whole. No GPU, no paid model, no network: the same input always gives the same output. What remains is ranked by relevance, recency, and importance, and older history folds into a verbatim summary of goals, constraints, decisions, facts, errors, and open questions. Six workload profiles (coding, agent, research, RAG, support, chat) split the budget differently, and a missed budget escalates balanced mode to aggressive. A citation map records whether each document id was kept, compressed, merged, or dropped, so references still resolve. Use it as a library, a REST API with optimize, count, summarize, rank, and job endpoints, or a streaming proxy that any OpenAI SDK can point at. A dashboard adds a playground with before and after panes, a per-stage trace, run history, and a benchmark against plain truncation. Budgets it cannot meet are reported, never silently cut. Running on a dedicated VPS on RepoCloud with guaranteed CPU, RAM, and SSD, full root SSH access, and a browser serial console. MIT licensed.
Benefits
- Fewer tokens, same critical facts
- On the committed 12-case synthetic benchmark it removes 90.2 percent of input tokens while retaining 100 percent of gold facts and citations; truncation to the same budgets keeps only 52.8 percent of facts.
- Instructions and facts stay verbatim
- System and developer messages return byte for byte, recent turns stay untouched, and ids, paths, versions, and error names survive word for word, with fact retention reported on every request.
- Deterministic with no GPU needed
- The engine is a pure function with no network, database, or model calls, so the same input always returns the same output on a plain CPU and benchmark results are reproducible.
- Drop-in for existing LLM code
- Point an OpenAI SDK client at the proxy with a new base URL and key, and every chat completion, streaming included, is optimized before it reaches the upstream you configured.
Features
- Eight-stage optimization pipeline
- Ingest, measure, protect, clean, rank, compress, validate, and return run in a pure Python package built on pydantic, tiktoken, and orjson, with a trace of every stage.
- Exact tokenizer counts
- tiktoken o200k_base and cl100k_base count OpenAI model families exactly, aliases map your model names to them, and other models get a marked o200k_base estimate scaled by 1.15.
- FastAPI service and worker
- FastAPI with async SQLAlchemy and Alembic records runs in PostgreSQL 16, caches results in optional Redis 7, and a worker runs background jobs with payloads stored in S3.
- Next.js 15 dashboard
- A Next.js 15 and React 19 app with Tailwind CSS 4, TanStack Query, and Recharts offers a playground, runs, jobs, benchmarks, profiles, API keys, upstreams, users, and an audit log.
- BM25 ranking and summaries
- BM25 relevance blended with recency and importance weights ranks every unit, and an extractive summarizer copies goals, constraints, decisions, facts, errors, and open questions from dropped history.
- Docker Compose and Terraform
- make up starts Postgres, Redis, a mock LLM, the API, a worker, and the dashboard on Docker Compose with Floci emulating S3 and KMS; Terraform modules target AWS ECS Fargate.