Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BhavanPatel/context-sect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ ContextSect
Agent-agnostic token optimization. One framework, every AI coding client.

Website Version Agents Rules Research

Website · Architecture · Install · Research


Why ContextSect?

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.


The Solution

ContextSect installs 8 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.


Install

curl -sL https://contextsect.vercel.app/install.sh | bash

Auto-detects installed agents, selects a profile, configures everything in native format, and installs the contextsect CLI globally.

# Or explicit
./install.sh --agent kiro,claude-code,cursor --profile balanced

CLI

After 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

How It Works

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 8 rules that prevent token waste at every stage — from prompt alignment to output compression.


Documentation

Install Installation flow, CLI flags, manual selection, updating
Architecture Two-pillar design, token economics, system flow diagram
Rules All 8 rules with savings, synergies, implementation priority
Profiles 4 intensity levels, per-agent config, mid-session switching
Agents 10 supported agents, detection logic, config formats
Adaptation How rules transform per agent, adding new agents
Examples Before/after comparisons showing token savings
Research 12 papers and production measurements backing every decision
Benchmarks Real credit measurements, comparison with alternatives, how to reproduce

Supported Agents

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.


Project Structure

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

Star History

Star History Chart


Author

Bhavan Patel

License

MIT

About

ContextSect | Evidence-based token optimization engine for AI agents and LLM CLIs. Intercept bloated prompts, prune context pollution, enforce surgical code diffs, and eliminate token bleed systematically. Spend less. Ship more.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors