code-context-engine 0.4.20__tar.gz → 0.4.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. {code_context_engine-0.4.20/src/code_context_engine.egg-info → code_context_engine-0.4.22}/PKG-INFO +76 -16
  2. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/README.md +75 -15
  3. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/pyproject.toml +1 -1
  4. {code_context_engine-0.4.20 → code_context_engine-0.4.22/src/code_context_engine.egg-info}/PKG-INFO +76 -16
  5. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/code_context_engine.egg-info/SOURCES.txt +1 -0
  6. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/cli.py +326 -81
  7. code_context_engine-0.4.22/src/context_engine/compression/output_rules.py +146 -0
  8. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/editors.py +31 -4
  9. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/embedder.py +58 -8
  10. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/db.py +8 -0
  11. code_context_engine-0.4.22/src/context_engine/pricing.py +148 -0
  12. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/vector_store.py +17 -3
  13. code_context_engine-0.4.22/tests/test_cli_init_agents.py +155 -0
  14. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_savings.py +4 -4
  15. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_savings_e2e.py +5 -5
  16. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_smoke.py +41 -7
  17. code_context_engine-0.4.20/src/context_engine/compression/output_rules.py +0 -77
  18. code_context_engine-0.4.20/src/context_engine/pricing.py +0 -104
  19. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/LICENSE +0 -0
  20. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/setup.cfg +0 -0
  21. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/code_context_engine.egg-info/dependency_links.txt +0 -0
  22. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/code_context_engine.egg-info/entry_points.txt +0 -0
  23. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/code_context_engine.egg-info/requires.txt +0 -0
  24. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/code_context_engine.egg-info/top_level.txt +0 -0
  25. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/__init__.py +0 -0
  26. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/cli_style.py +0 -0
  27. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/compression/__init__.py +0 -0
  28. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/compression/compressor.py +0 -0
  29. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/compression/ollama_client.py +0 -0
  30. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/compression/prompts.py +0 -0
  31. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/compression/quality.py +0 -0
  32. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/config.py +0 -0
  33. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/dashboard/__init__.py +0 -0
  34. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/dashboard/_page.py +0 -0
  35. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/dashboard/server.py +0 -0
  36. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/event_bus.py +0 -0
  37. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/__init__.py +0 -0
  38. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/chunker.py +0 -0
  39. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/embedding_cache.py +0 -0
  40. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/git_hooks.py +0 -0
  41. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/git_indexer.py +0 -0
  42. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/ignorefile.py +0 -0
  43. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/manifest.py +0 -0
  44. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/pipeline.py +0 -0
  45. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/secrets.py +0 -0
  46. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/indexer/watcher.py +0 -0
  47. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/integration/__init__.py +0 -0
  48. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/integration/bootstrap.py +0 -0
  49. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/integration/git_context.py +0 -0
  50. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/integration/mcp_server.py +0 -0
  51. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/integration/session_capture.py +0 -0
  52. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/__init__.py +0 -0
  53. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/compressor.py +0 -0
  54. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/decision_extractor.py +0 -0
  55. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/extractive.py +0 -0
  56. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/grammar.py +0 -0
  57. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/hook_installer.py +0 -0
  58. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/hook_server.py +0 -0
  59. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/hooks.py +0 -0
  60. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/memory/migrate.py +0 -0
  61. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/models.py +0 -0
  62. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/project_commands.py +0 -0
  63. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/retrieval/__init__.py +0 -0
  64. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/retrieval/confidence.py +0 -0
  65. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/retrieval/query_parser.py +0 -0
  66. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/retrieval/retriever.py +0 -0
  67. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/serve_http.py +0 -0
  68. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/services.py +0 -0
  69. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/__init__.py +0 -0
  70. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/backend.py +0 -0
  71. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/fts_store.py +0 -0
  72. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/graph_store.py +0 -0
  73. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/local_backend.py +0 -0
  74. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/storage/remote_backend.py +0 -0
  75. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/src/context_engine/utils.py +0 -0
  76. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_init_probe.py +0 -0
  77. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_mcp_config.py +0 -0
  78. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_safe_cwd.py +0 -0
  79. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_savings_buckets.py +0 -0
  80. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_serve.py +0 -0
  81. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_sessions_export.py +0 -0
  82. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_sessions_status.py +0 -0
  83. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_cli_uninstall.py +0 -0
  84. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_config.py +0 -0
  85. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_e2e.py +0 -0
  86. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_editors_codex.py +0 -0
  87. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_editors_opencode.py +0 -0
  88. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_event_bus.py +0 -0
  89. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_models.py +0 -0
  90. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_project_commands.py +0 -0
  91. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_real_life.py +0 -0
  92. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_services.py +0 -0
  93. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_token_efficiency.py +0 -0
  94. {code_context_engine-0.4.20 → code_context_engine-0.4.22}/tests/test_token_packing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-context-engine
3
- Version: 0.4.20
3
+ Version: 0.4.22
4
4
  Summary: Save 94% on Claude Code tokens. Index your codebase locally, AI agents search instead of reading files. Reduce Claude API costs, save tokens on Cursor, VS Code, Gemini CLI. Free, open source MCP server.
5
5
  Author-email: Fazle Elahee <felahee@gmail.com>, Raj <rajkumar.sakti@gmail.com>
6
6
  License-Expression: MIT
@@ -115,15 +115,17 @@ Dynamic: license-file
115
115
 
116
116
  ---
117
117
 
118
- ## Quick start (3 lines)
118
+ ## Quick start
119
119
 
120
120
  ```bash
121
- uv tool install code-context-engine
121
+ uv tool install "code-context-engine[local]" # or: pipx install "code-context-engine[local]"
122
122
  cd /path/to/your/project
123
- cce init
123
+ cce init # or: cce init --agent all
124
124
  ```
125
125
 
126
- That's it. Claude now searches your index instead of reading entire files. No config needed.
126
+ That's it. Your AI coding agent now searches your index instead of reading entire files.
127
+
128
+ > **Already have Ollama?** You can skip `[local]` and use `uv tool install code-context-engine` instead. CCE auto-detects Ollama at localhost:11434 and uses `nomic-embed-text`.
127
129
 
128
130
  ---
129
131
 
@@ -143,35 +145,42 @@ Tested on all three platforms in CI (macOS, Linux, Windows × Python 3.11/3.12/3
143
145
 
144
146
  ## Install and see savings in 60 seconds
145
147
 
146
- ```bash
147
- uv tool install code-context-engine # or: pipx install code-context-engine
148
- cd /path/to/your/project
149
- cce init # index, install hooks, register MCP server
150
- ```
148
+ You need an embedding backend to index code. Pick one:
149
+
150
+ | Option | Install command | Size | Requires |
151
+ |--------|----------------|------|----------|
152
+ | **Local (recommended)** | `uv tool install "code-context-engine[local]"` | +60 MB | Nothing else |
153
+ | **Ollama** | `uv tool install code-context-engine` | Core only | Ollama running + `nomic-embed-text` pulled |
151
154
 
152
- **Embedding backends:** CCE auto-detects the best available backend. If you have Ollama running, it uses `nomic-embed-text` with zero extra dependencies. For offline/local embedding without Ollama, install the `[local]` extra:
155
+ Then:
153
156
 
154
157
  ```bash
155
- uv tool install "code-context-engine[local]" # includes fastembed + ONNX Runtime
158
+ cd /path/to/your/project
159
+ cce init # index, install hooks, register MCP server
156
160
  ```
157
161
 
158
162
  Restart your editor. Done. Every question now hits the index instead of re-reading files.
159
163
 
160
- `cce init` auto-detects your editor and writes the right config:
164
+ `cce init` auto-detects your editor and writes the right config. To target a
165
+ specific agent, use `--agent claude`, `--agent codex`, `--agent copilot`, or
166
+ `--agent all`.
161
167
 
162
168
  | Editor | Config written | Instructions |
163
169
  |--------|---------------|--------------|
164
170
  | Claude Code | `.mcp.json` | `CLAUDE.md` |
165
- | VS Code / Copilot | `.vscode/mcp.json` | |
171
+ | VS Code / Copilot | `.vscode/mcp.json` | `.github/copilot-instructions.md` |
166
172
  | Cursor | `.cursor/mcp.json` | `.cursorrules` |
167
173
  | Gemini CLI | `.gemini/settings.json` | `GEMINI.md` |
168
- | OpenAI Codex | `~/.codex/config.toml` (user-global, per-project section) | |
174
+ | OpenAI Codex | `~/.codex/config.toml` (user-global, per-project section) | `AGENTS.md` |
169
175
  | OpenCode | `opencode.json` | |
170
176
  | Tabnine | `.tabnine/agent/settings.json` | `TABNINE.md` |
171
177
 
172
178
  Multiple editors in the same project? All get configured in one command.
173
179
 
174
- **Codex note:** Codex CLI reads MCP servers from `~/.codex/config.toml` only — it has no per-project config. `cce init` adds one `[mcp_servers.cce-<project>-<hash>]` section per project so multiple projects coexist; `cce uninstall` removes only the section for the current project.
180
+ **Codex note:** Codex CLI reads MCP servers from `~/.codex/config.toml` only —
181
+ it has no per-project config. `cce init` adds one `[mcp_servers.cce-<project>-<hash>]`
182
+ section per project so multiple projects coexist; `cce uninstall` removes only
183
+ the section for the current project.
175
184
 
176
185
  ```
177
186
  my-project · 38 queries
@@ -487,6 +496,57 @@ All other text files are chunked by line range. Binary files are skipped.
487
496
 
488
497
  ---
489
498
 
499
+ ## FAQ
500
+
501
+ ### Does CCE affect response quality?
502
+
503
+ No. Quality stays the same or slightly improves.
504
+
505
+ CCE replaces "dump the entire file" with "search for the relevant function." The model still gets the code it needs (0.90 Recall@10 in benchmarks). Less irrelevant context means less noise competing for attention, which can improve the model's focus on your actual question.
506
+
507
+ ### How does output token savings work?
508
+
509
+ CCE writes output compression rules directly into your agent's instruction files (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`, etc.) during `cce init`. These rules apply to the **entire session**, not just CCE tool responses, so every reply from the agent follows them.
510
+
511
+ Set the level in `cce.yaml`:
512
+
513
+ ```yaml
514
+ compression:
515
+ output: max # off | lite | standard | max
516
+ ```
517
+
518
+ Then re-run `cce init` to update instruction files. Or change at runtime:
519
+
520
+ ```
521
+ set_output_level output_level=max
522
+ ```
523
+
524
+ | Level | Savings | What it does |
525
+ |-------|---------|--------------|
526
+ | `off` | 0% | No compression |
527
+ | `lite` | ~25% | Removes filler/hedging/pleasantries + diff-only for code changes |
528
+ | `standard` | ~70% | Drops articles, fragments, short synonyms + diff-only for code |
529
+ | `max` | ~80% | Telegraphic style + diff-only for code |
530
+
531
+ Default is `standard`. All levels include **code output rules** that tell the model to show only changed lines (not full file rewrites), which is where most output tokens go in coding sessions. The `max` level produces very terse prose (similar to "caveman mode"). Code blocks, paths, and commands are never compressed regardless of level.
532
+
533
+ ### Where do the savings come from?
534
+
535
+ Most savings are **input tokens** (what goes into the model):
536
+
537
+ | Layer | Type | Typical savings |
538
+ |-------|------|-----------------|
539
+ | Retrieval | Input | 94% (full files → relevant chunks) |
540
+ | Chunk compression | Input | 89% (chunks → signatures) |
541
+ | Grammar compression | Input | 13% (article/filler removal) |
542
+ | Turn summarization | Input | varies (session history) |
543
+ | Progressive disclosure | Input | varies (tool payloads) |
544
+ | Output compression | Output | 25-80% (depends on level) |
545
+
546
+ Output tokens cost 5x more per token (e.g. Opus: $15/1M input vs $75/1M output), so even a small output reduction has outsized cost impact.
547
+
548
+ ---
549
+
490
550
  ## Roadmap
491
551
 
492
552
  - [x] Multi-repo benchmarks (FastAPI, chi, fiber)
@@ -64,15 +64,17 @@
64
64
 
65
65
  ---
66
66
 
67
- ## Quick start (3 lines)
67
+ ## Quick start
68
68
 
69
69
  ```bash
70
- uv tool install code-context-engine
70
+ uv tool install "code-context-engine[local]" # or: pipx install "code-context-engine[local]"
71
71
  cd /path/to/your/project
72
- cce init
72
+ cce init # or: cce init --agent all
73
73
  ```
74
74
 
75
- That's it. Claude now searches your index instead of reading entire files. No config needed.
75
+ That's it. Your AI coding agent now searches your index instead of reading entire files.
76
+
77
+ > **Already have Ollama?** You can skip `[local]` and use `uv tool install code-context-engine` instead. CCE auto-detects Ollama at localhost:11434 and uses `nomic-embed-text`.
76
78
 
77
79
  ---
78
80
 
@@ -92,35 +94,42 @@ Tested on all three platforms in CI (macOS, Linux, Windows × Python 3.11/3.12/3
92
94
 
93
95
  ## Install and see savings in 60 seconds
94
96
 
95
- ```bash
96
- uv tool install code-context-engine # or: pipx install code-context-engine
97
- cd /path/to/your/project
98
- cce init # index, install hooks, register MCP server
99
- ```
97
+ You need an embedding backend to index code. Pick one:
98
+
99
+ | Option | Install command | Size | Requires |
100
+ |--------|----------------|------|----------|
101
+ | **Local (recommended)** | `uv tool install "code-context-engine[local]"` | +60 MB | Nothing else |
102
+ | **Ollama** | `uv tool install code-context-engine` | Core only | Ollama running + `nomic-embed-text` pulled |
100
103
 
101
- **Embedding backends:** CCE auto-detects the best available backend. If you have Ollama running, it uses `nomic-embed-text` with zero extra dependencies. For offline/local embedding without Ollama, install the `[local]` extra:
104
+ Then:
102
105
 
103
106
  ```bash
104
- uv tool install "code-context-engine[local]" # includes fastembed + ONNX Runtime
107
+ cd /path/to/your/project
108
+ cce init # index, install hooks, register MCP server
105
109
  ```
106
110
 
107
111
  Restart your editor. Done. Every question now hits the index instead of re-reading files.
108
112
 
109
- `cce init` auto-detects your editor and writes the right config:
113
+ `cce init` auto-detects your editor and writes the right config. To target a
114
+ specific agent, use `--agent claude`, `--agent codex`, `--agent copilot`, or
115
+ `--agent all`.
110
116
 
111
117
  | Editor | Config written | Instructions |
112
118
  |--------|---------------|--------------|
113
119
  | Claude Code | `.mcp.json` | `CLAUDE.md` |
114
- | VS Code / Copilot | `.vscode/mcp.json` | |
120
+ | VS Code / Copilot | `.vscode/mcp.json` | `.github/copilot-instructions.md` |
115
121
  | Cursor | `.cursor/mcp.json` | `.cursorrules` |
116
122
  | Gemini CLI | `.gemini/settings.json` | `GEMINI.md` |
117
- | OpenAI Codex | `~/.codex/config.toml` (user-global, per-project section) | |
123
+ | OpenAI Codex | `~/.codex/config.toml` (user-global, per-project section) | `AGENTS.md` |
118
124
  | OpenCode | `opencode.json` | |
119
125
  | Tabnine | `.tabnine/agent/settings.json` | `TABNINE.md` |
120
126
 
121
127
  Multiple editors in the same project? All get configured in one command.
122
128
 
123
- **Codex note:** Codex CLI reads MCP servers from `~/.codex/config.toml` only — it has no per-project config. `cce init` adds one `[mcp_servers.cce-<project>-<hash>]` section per project so multiple projects coexist; `cce uninstall` removes only the section for the current project.
129
+ **Codex note:** Codex CLI reads MCP servers from `~/.codex/config.toml` only —
130
+ it has no per-project config. `cce init` adds one `[mcp_servers.cce-<project>-<hash>]`
131
+ section per project so multiple projects coexist; `cce uninstall` removes only
132
+ the section for the current project.
124
133
 
125
134
  ```
126
135
  my-project · 38 queries
@@ -436,6 +445,57 @@ All other text files are chunked by line range. Binary files are skipped.
436
445
 
437
446
  ---
438
447
 
448
+ ## FAQ
449
+
450
+ ### Does CCE affect response quality?
451
+
452
+ No. Quality stays the same or slightly improves.
453
+
454
+ CCE replaces "dump the entire file" with "search for the relevant function." The model still gets the code it needs (0.90 Recall@10 in benchmarks). Less irrelevant context means less noise competing for attention, which can improve the model's focus on your actual question.
455
+
456
+ ### How does output token savings work?
457
+
458
+ CCE writes output compression rules directly into your agent's instruction files (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`, etc.) during `cce init`. These rules apply to the **entire session**, not just CCE tool responses, so every reply from the agent follows them.
459
+
460
+ Set the level in `cce.yaml`:
461
+
462
+ ```yaml
463
+ compression:
464
+ output: max # off | lite | standard | max
465
+ ```
466
+
467
+ Then re-run `cce init` to update instruction files. Or change at runtime:
468
+
469
+ ```
470
+ set_output_level output_level=max
471
+ ```
472
+
473
+ | Level | Savings | What it does |
474
+ |-------|---------|--------------|
475
+ | `off` | 0% | No compression |
476
+ | `lite` | ~25% | Removes filler/hedging/pleasantries + diff-only for code changes |
477
+ | `standard` | ~70% | Drops articles, fragments, short synonyms + diff-only for code |
478
+ | `max` | ~80% | Telegraphic style + diff-only for code |
479
+
480
+ Default is `standard`. All levels include **code output rules** that tell the model to show only changed lines (not full file rewrites), which is where most output tokens go in coding sessions. The `max` level produces very terse prose (similar to "caveman mode"). Code blocks, paths, and commands are never compressed regardless of level.
481
+
482
+ ### Where do the savings come from?
483
+
484
+ Most savings are **input tokens** (what goes into the model):
485
+
486
+ | Layer | Type | Typical savings |
487
+ |-------|------|-----------------|
488
+ | Retrieval | Input | 94% (full files → relevant chunks) |
489
+ | Chunk compression | Input | 89% (chunks → signatures) |
490
+ | Grammar compression | Input | 13% (article/filler removal) |
491
+ | Turn summarization | Input | varies (session history) |
492
+ | Progressive disclosure | Input | varies (tool payloads) |
493
+ | Output compression | Output | 25-80% (depends on level) |
494
+
495
+ Output tokens cost 5x more per token (e.g. Opus: $15/1M input vs $75/1M output), so even a small output reduction has outsized cost impact.
496
+
497
+ ---
498
+
439
499
  ## Roadmap
440
500
 
441
501
  - [x] Multi-repo benchmarks (FastAPI, chi, fiber)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "code-context-engine"
3
- version = "0.4.20"
3
+ version = "0.4.22"
4
4
  description = "Save 94% on Claude Code tokens. Index your codebase locally, AI agents search instead of reading files. Reduce Claude API costs, save tokens on Cursor, VS Code, Gemini CLI. Free, open source MCP server."
5
5
  readme = {file = "README.md", content-type = "text/markdown"}
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-context-engine
3
- Version: 0.4.20
3
+ Version: 0.4.22
4
4
  Summary: Save 94% on Claude Code tokens. Index your codebase locally, AI agents search instead of reading files. Reduce Claude API costs, save tokens on Cursor, VS Code, Gemini CLI. Free, open source MCP server.
5
5
  Author-email: Fazle Elahee <felahee@gmail.com>, Raj <rajkumar.sakti@gmail.com>
6
6
  License-Expression: MIT
@@ -115,15 +115,17 @@ Dynamic: license-file
115
115
 
116
116
  ---
117
117
 
118
- ## Quick start (3 lines)
118
+ ## Quick start
119
119
 
120
120
  ```bash
121
- uv tool install code-context-engine
121
+ uv tool install "code-context-engine[local]" # or: pipx install "code-context-engine[local]"
122
122
  cd /path/to/your/project
123
- cce init
123
+ cce init # or: cce init --agent all
124
124
  ```
125
125
 
126
- That's it. Claude now searches your index instead of reading entire files. No config needed.
126
+ That's it. Your AI coding agent now searches your index instead of reading entire files.
127
+
128
+ > **Already have Ollama?** You can skip `[local]` and use `uv tool install code-context-engine` instead. CCE auto-detects Ollama at localhost:11434 and uses `nomic-embed-text`.
127
129
 
128
130
  ---
129
131
 
@@ -143,35 +145,42 @@ Tested on all three platforms in CI (macOS, Linux, Windows × Python 3.11/3.12/3
143
145
 
144
146
  ## Install and see savings in 60 seconds
145
147
 
146
- ```bash
147
- uv tool install code-context-engine # or: pipx install code-context-engine
148
- cd /path/to/your/project
149
- cce init # index, install hooks, register MCP server
150
- ```
148
+ You need an embedding backend to index code. Pick one:
149
+
150
+ | Option | Install command | Size | Requires |
151
+ |--------|----------------|------|----------|
152
+ | **Local (recommended)** | `uv tool install "code-context-engine[local]"` | +60 MB | Nothing else |
153
+ | **Ollama** | `uv tool install code-context-engine` | Core only | Ollama running + `nomic-embed-text` pulled |
151
154
 
152
- **Embedding backends:** CCE auto-detects the best available backend. If you have Ollama running, it uses `nomic-embed-text` with zero extra dependencies. For offline/local embedding without Ollama, install the `[local]` extra:
155
+ Then:
153
156
 
154
157
  ```bash
155
- uv tool install "code-context-engine[local]" # includes fastembed + ONNX Runtime
158
+ cd /path/to/your/project
159
+ cce init # index, install hooks, register MCP server
156
160
  ```
157
161
 
158
162
  Restart your editor. Done. Every question now hits the index instead of re-reading files.
159
163
 
160
- `cce init` auto-detects your editor and writes the right config:
164
+ `cce init` auto-detects your editor and writes the right config. To target a
165
+ specific agent, use `--agent claude`, `--agent codex`, `--agent copilot`, or
166
+ `--agent all`.
161
167
 
162
168
  | Editor | Config written | Instructions |
163
169
  |--------|---------------|--------------|
164
170
  | Claude Code | `.mcp.json` | `CLAUDE.md` |
165
- | VS Code / Copilot | `.vscode/mcp.json` | |
171
+ | VS Code / Copilot | `.vscode/mcp.json` | `.github/copilot-instructions.md` |
166
172
  | Cursor | `.cursor/mcp.json` | `.cursorrules` |
167
173
  | Gemini CLI | `.gemini/settings.json` | `GEMINI.md` |
168
- | OpenAI Codex | `~/.codex/config.toml` (user-global, per-project section) | |
174
+ | OpenAI Codex | `~/.codex/config.toml` (user-global, per-project section) | `AGENTS.md` |
169
175
  | OpenCode | `opencode.json` | |
170
176
  | Tabnine | `.tabnine/agent/settings.json` | `TABNINE.md` |
171
177
 
172
178
  Multiple editors in the same project? All get configured in one command.
173
179
 
174
- **Codex note:** Codex CLI reads MCP servers from `~/.codex/config.toml` only — it has no per-project config. `cce init` adds one `[mcp_servers.cce-<project>-<hash>]` section per project so multiple projects coexist; `cce uninstall` removes only the section for the current project.
180
+ **Codex note:** Codex CLI reads MCP servers from `~/.codex/config.toml` only —
181
+ it has no per-project config. `cce init` adds one `[mcp_servers.cce-<project>-<hash>]`
182
+ section per project so multiple projects coexist; `cce uninstall` removes only
183
+ the section for the current project.
175
184
 
176
185
  ```
177
186
  my-project · 38 queries
@@ -487,6 +496,57 @@ All other text files are chunked by line range. Binary files are skipped.
487
496
 
488
497
  ---
489
498
 
499
+ ## FAQ
500
+
501
+ ### Does CCE affect response quality?
502
+
503
+ No. Quality stays the same or slightly improves.
504
+
505
+ CCE replaces "dump the entire file" with "search for the relevant function." The model still gets the code it needs (0.90 Recall@10 in benchmarks). Less irrelevant context means less noise competing for attention, which can improve the model's focus on your actual question.
506
+
507
+ ### How does output token savings work?
508
+
509
+ CCE writes output compression rules directly into your agent's instruction files (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`, etc.) during `cce init`. These rules apply to the **entire session**, not just CCE tool responses, so every reply from the agent follows them.
510
+
511
+ Set the level in `cce.yaml`:
512
+
513
+ ```yaml
514
+ compression:
515
+ output: max # off | lite | standard | max
516
+ ```
517
+
518
+ Then re-run `cce init` to update instruction files. Or change at runtime:
519
+
520
+ ```
521
+ set_output_level output_level=max
522
+ ```
523
+
524
+ | Level | Savings | What it does |
525
+ |-------|---------|--------------|
526
+ | `off` | 0% | No compression |
527
+ | `lite` | ~25% | Removes filler/hedging/pleasantries + diff-only for code changes |
528
+ | `standard` | ~70% | Drops articles, fragments, short synonyms + diff-only for code |
529
+ | `max` | ~80% | Telegraphic style + diff-only for code |
530
+
531
+ Default is `standard`. All levels include **code output rules** that tell the model to show only changed lines (not full file rewrites), which is where most output tokens go in coding sessions. The `max` level produces very terse prose (similar to "caveman mode"). Code blocks, paths, and commands are never compressed regardless of level.
532
+
533
+ ### Where do the savings come from?
534
+
535
+ Most savings are **input tokens** (what goes into the model):
536
+
537
+ | Layer | Type | Typical savings |
538
+ |-------|------|-----------------|
539
+ | Retrieval | Input | 94% (full files → relevant chunks) |
540
+ | Chunk compression | Input | 89% (chunks → signatures) |
541
+ | Grammar compression | Input | 13% (article/filler removal) |
542
+ | Turn summarization | Input | varies (session history) |
543
+ | Progressive disclosure | Input | varies (tool payloads) |
544
+ | Output compression | Output | 25-80% (depends on level) |
545
+
546
+ Output tokens cost 5x more per token (e.g. Opus: $15/1M input vs $75/1M output), so even a small output reduction has outsized cost impact.
547
+
548
+ ---
549
+
490
550
  ## Roadmap
491
551
 
492
552
  - [x] Multi-repo benchmarks (FastAPI, chi, fiber)
@@ -65,6 +65,7 @@ src/context_engine/storage/graph_store.py
65
65
  src/context_engine/storage/local_backend.py
66
66
  src/context_engine/storage/remote_backend.py
67
67
  src/context_engine/storage/vector_store.py
68
+ tests/test_cli_init_agents.py
68
69
  tests/test_cli_init_probe.py
69
70
  tests/test_cli_mcp_config.py
70
71
  tests/test_cli_safe_cwd.py