⚡ ContextSect
Agent-agnostic token optimization. One framework, every AI coding client.
Website · Architecture · Install · Research
Running AI coding agents = wasted tokens on filler, full-file reads, wrong-direction implementations, and runaway loops. ContextSect reduces this by 45–60% with universal rules that auto-adapt to each agent's native format.
Every AI coding tool has its own config format — CLAUDE.md, .cursorrules, .windsurf/rules/, .clinerules/, .kiro/steering/, AGENTS.md... but the optimization rules are the SAME regardless of agent.
The solution: Write rules once in plain markdown → auto-adapt to each agent's native format on install.
ContextSect installs 11 universal rules that optimize token usage across two pillars:
| Pillar | What it does | Savings |
|---|---|---|
| Input Optimization | Prevents unnecessary context loading before work begins | -40–55% input tokens |
| Output Optimization | Minimizes generated tokens after reasoning | -50–65% output tokens |
Combined with the 5x output token cost multiplier, this yields 45–60% total cost reduction.
| Metric | Before | After |
|---|---|---|
| Input tokens per task | Baseline | -40–55% |
| Output tokens per task | Baseline | -50–65% |
| Total cost per session | Baseline | -45–60% |
| First-attempt success | ~60% | ~85% |
| Runaway loops | Occasional | Near zero |
Measured: 78% output reduction, 0% filler across 9 Kiro sessions (152 turns, real credit tracking). See benchmarks for methodology, raw data, and how to reproduce.
curl -sL https://contextsect.vercel.app/install.sh | bashAuto-detects installed agents, selects a profile, configures everything in native format, and installs the contextsect CLI globally.
# Or explicit
contextsect install --agent kiro,claude-code,cursor --profile balancedAfter install, use from anywhere:
contextsect update # Pull latest rules + reinstall
contextsect profile aggressive # Switch profile
contextsect status # Show what's configured
contextsect uninstall # Remove all rules| Step | What happens |
|---|---|
| 1 | Install script auto-detects which AI agents are installed |
| 2 | You choose a profile (conservative → ultra-aggressive) |
| 3 | Rules are transformed into each agent's native config format |
| 4 | Agent loads rules at session start, optimizes automatically |
Your agents see 11 rules that prevent token waste at every stage — from prompt alignment to output compression.
ContextSect is the behavioral layer — but token optimization has 4 layers. Stack them for 85-95% total savings:
| Layer | Tool | What it does | Savings |
|---|---|---|---|
| 1. Behavioral Rules | ContextSect (this) | Teaches agents to search, plan, use compact commands | 40-75% |
| 2. CLI Compression | RTK or Token Juice | Filters shell output before it enters context | 60-90% |
| 3. API Proxy | Headroom | Compresses API payloads in transit | 60-94% |
| 4. Knowledge Graph | Graphify | Pre-indexes repo for O(1) navigation | 49-71x |
# Recommended stack (ContextSect + RTK)
curl -sL https://contextsect.vercel.app/install.sh | bash
contextsect companions # Shows install instructions for RTK, Headroom, GraphifySee docs/companion-stack.md for the full guide.
Kiro · Claude Code · Cursor · Windsurf · Cline · OpenCode · Aider · RooCode · GitHub Copilot · OpenAI Codex
All auto-detected. All configured in native format. See docs/agents.md for details.
ContextSect/
├── bin/ # CLI (contextsect command)
├── rules/ # Universal rules (agent-agnostic markdown)
├── adapters/ # Agent-specific transformations
├── docs/ # Full documentation
├── website/ # contextsect.vercel.app source
└── install.sh # Auto-detect + install for all agents
MIT