context-optimizer
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Gecti
- Code scan — Scanned 4 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Reduce Claude AI token consumption by 5x-27x using prompt-native workflows and structural code manifests
context-optimizer
5â27x fewer tokens. No setup required to start.
Use the skill alone â no install needed, works anywhere Claude runs.
Add Python 3.7+ to unlock auto-manifest generation.
| Tool | What it cuts | Install needed |
|---|---|---|
| 𪨠Caveman | Output tokens (~75%) | One command |
| ð¬ code-review-graph | Input tokens (8.2x²) | pip + Python 3.10+ |
| ðï¸ Context Optimizer | Input tokens (see benchmarks) | Zero to start |
² code-review-graph benchmarks
Why This Exists
Claude has a 200K token context window â but burning 20K tokens just to show a directory structure is wasteful. This toolkit teaches Claude to fetch only what it needs, compress what it sees, and reason structurally instead of reading raw files.
No API hacks. No leaked code. No reverse engineering.
Just official Claude features (Custom Instructions + Projects + Knowledge) and a lightweight local indexer.
Real-World Savings
| Scenario | Before (tokens) | After (tokens) | Reduction |
|---|---|---|---|
| Code review (3 files) | ~18,000 | ~1,200 | 15x |
| Debug a function | ~8,000 | ~400 | 20x |
| Plan a feature (5+ files) | ~35,000 | ~1,800 | 19x |
| Full monorepo analysis | ~80,000 | ~3,500 | 22x |
How it works in practice
Without Context Optimizer, Claude reads every file it thinks
might be relevant â often 10â15 files before answering.
With Context Optimizer, Claude reads the manifest first,
fetches 2â3 targeted files, then answers. Same result.
Fraction of the context.
Quick Start (30 seconds)
# 1. Clone the repo
git clone https://github.com/anshmajumdar121/context-optimizer.git
cd context-optimizer
# 2. Run the installer (idempotent, safe to re-run)
chmod +x scripts/install.sh
./scripts/install.sh /path/to/your/project
# 3. Generate a structural manifest of your project
python3 tools/context_mapper.py /path/to/your/project
# 4. Upload CONTEXT_MANIFEST.md to a Claude Project (optional but recommended)
# 5. Paste the one-click prompt into Claude Desktop/Web
cat prompt/one-click-vertical-prompt.md | pbcopy # macOS
cat prompt/one-click-vertical-prompt.md | xclip # Linux
How It Works
Your Project
â
â¼
context_mapper.py ââ⺠CONTEXT_MANIFEST.md
â
â¼
Claude Project Knowledge
â
â¼
skill/claude-custom-instructions.md
(via Custom Instructions or CLAUDE.md)
â
â¼
Token-Efficient Claude Sessions
The Three Pillars
1. CONTEXT_MANIFEST.md â A structural index of your codebase: file paths, languages, line counts, import graphs, and blast-radius data. Claude reads this instead of scanning directories.
2. Core Skill â Custom instructions that enforce structural reasoning, limit file fetches to 3/turn, and compress all output into a strict format.
3. Session Activator â A one-click prompt to paste at the start of any session when you can't use Custom Instructions.
File Structure
context-optimizer/
âââ context-optimizer-skill/
â âââ SKILL.md # Skill with YAML frontmatter (for skill registries)
â âââ LICENSE.txt
âââ skill/
â âââ claude-custom-instructions.md # Paste into Claude Custom Instructions
âââ prompt/
â âââ one-click-vertical-prompt.md # Paste at start of any session
âââ scripts/
â âââ install.sh # Full-stack installer (idempotent)
âââ tools/
â âââ context_mapper.py # Manifest + dependency graph generator
âââ .claude/
â âââ COMMON_MISTAKES.md # Project-specific bug history
â âââ QUICK_START.md # Daily commands
â âââ ARCHITECTURE_MAP.md # High-level routing & layers
âââ .claudeignore # Files excluded from Claude's context
âââ docs/
âââ learnings/ # Session insights (gitignored)
âââ archive/ # Old versions (gitignored)
Usage Guide
Option A: Claude Projects (Recommended)
- Run
python3 tools/context_mapper.py /your/project - Upload
CONTEXT_MANIFEST.mdto a Claude Project as Knowledge - Add
skill/claude-custom-instructions.mdto Project Instructions - Start chatting â Claude will reason from the manifest automatically
Option B: Custom Instructions (Global)
- Go to Claude Settings â Custom Instructions
- Paste the contents of
skill/claude-custom-instructions.md - For each project, paste
CONTEXT_MANIFEST.mdinto the chat or upload it
Option C: Per-Session Activation
- Open any Claude chat
- Paste
prompt/one-click-vertical-prompt.mdas your first message - Claude confirms:
â Context Optimizer active. - Upload or paste
CONTEXT_MANIFEST.mdand start your task
Option D: Claude Code / CLAUDE.md
Run the installer â it auto-detects .claude/ and injects the skill into CLAUDE.md:
./scripts/install.sh /your/project
Manifest Generator
# Basic usage
python3 tools/context_mapper.py /path/to/project
# Blast-radius analysis (find all files affected by a change)
python3 tools/context_mapper.py /path/to/project --blast-radius src/auth.py,src/models.py
Output files:
CONTEXT_MANIFEST.mdâ Human + AI readable manifest.claude/graph.jsonâ Machine-readable dependency graph
Overrides & Controls
| Command | Effect |
|---|---|
RELOAD CONTEXT OPTIMIZER |
Reset all rules for this session |
MAX_FILES: 5 |
Allow up to 5 files per turn |
BUDGET: 2000 |
Raise token budget to 2,000 |
COMPRESSION: lite |
Less aggressive compression |
TEMP VERBOSE |
One-turn verbose mode, then revert |
Contributing
See CONTRIBUTING.md. PRs welcome â especially for new language parsers in context_mapper.py.
License
MIT â see LICENSE.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi