Summary
v2.0.6's spec promised cold-start would drop from ~13s to ~3s via the ONNX swap, closing F0. Post-release validation shows the actual cold-start is ~11s, not ~3s. F0 closes only partially in environments with generous probe budgets; strict-timeout hosts still drop the 8 mcp__code-context__* tools.
Empirical attribution
Fresh venv install of code-context-mcp==2.0.6.1 on Windows 11 / Python 3.13 / warm HF cache:
| Phase |
Cost |
from transformers import AutoTokenizer |
5.69s (and triggers import torch transitively) |
onnxruntime.InferenceSession(...) |
~0.8s |
| HF cache lookups + tokenizer.from_pretrained |
~1s |
| MCP server boot + stdio handshake |
~2-3s |
| Total |
~11s |
code-context doctor mcp reports:
initialize (open stdio + handshake) ok (11.64s)
list_tools ok (0.00s)
Tools advertised: 8/8 expected
The dominant cost is transformers.AutoTokenizer import. It was assumed to be a thin Python wrapper around the Rust tokenizers library; in reality it pulls in import torch at module init time, which alone is ~5s cold. The ONNX swap saved only the SentenceTransformer ctor (~3.7s), not the transformers/torch chain.
Proposed fix (v2.0.7)
Replace transformers.AutoTokenizer with the tokenizers library directly (HuggingFace's underlying Rust tokenizer, no torch dependency, no Python wrapper). Same tokenizer.json produces byte-identical token IDs — embedding outputs unchanged.
Expected impact: cold-start ~11s → ~3s. Closes F0 strictly.
Design spec: docs/superpowers/specs/2026-05-20-v207-drop-transformers-onnx-path-design.md
Validation already done for v2.0.6.1
✅ Server-side correctness: code-context doctor 28/28 pass, doctor mcp 8/8 tools advertised.
✅ ONNX path produces correct embeddings (smoke run on python fixture: NDCG@10 0.7587).
✅ Tree-sitter chunker works on all 5 supported Python versions (after 1.6.3 pin-out).
⚠️ Cold-start does NOT meet the ~3s spec target.
Workaround for users on v2.0.6.1
If F0 reproduces on your host (Claude Code shows 0 tools after claude mcp list cycles between Connected / Failed), set CC_EMBEDDINGS_BACKEND=torch to fall back to the v2.0.5 behaviour. You lose the partial speedup but get back to a known state.
Acceptance criteria for v2.0.7
import torch is NOT in sys.modules after a fresh LocalONNX(...).embed(['x']).
code-context doctor mcp reports initialize ok (≤3.0s) on warm HF cache.
- Existing baseline NDCG@10 matches v2.0.6 within 0.001 (token IDs identical).
- All existing tests pass after the test-mock rewrite.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Summary
v2.0.6's spec promised cold-start would drop from ~13s to ~3s via the ONNX swap, closing F0. Post-release validation shows the actual cold-start is ~11s, not ~3s. F0 closes only partially in environments with generous probe budgets; strict-timeout hosts still drop the 8
mcp__code-context__*tools.Empirical attribution
Fresh venv install of
code-context-mcp==2.0.6.1on Windows 11 / Python 3.13 / warm HF cache:from transformers import AutoTokenizerimport torchtransitively)onnxruntime.InferenceSession(...)code-context doctor mcpreports:The dominant cost is
transformers.AutoTokenizerimport. It was assumed to be a thin Python wrapper around the Rusttokenizerslibrary; in reality it pulls inimport torchat module init time, which alone is ~5s cold. The ONNX swap saved only theSentenceTransformerctor (~3.7s), not the transformers/torch chain.Proposed fix (v2.0.7)
Replace
transformers.AutoTokenizerwith thetokenizerslibrary directly (HuggingFace's underlying Rust tokenizer, notorchdependency, no Python wrapper). Sametokenizer.jsonproduces byte-identical token IDs — embedding outputs unchanged.Expected impact: cold-start ~11s → ~3s. Closes F0 strictly.
Design spec: docs/superpowers/specs/2026-05-20-v207-drop-transformers-onnx-path-design.md
Validation already done for v2.0.6.1
✅ Server-side correctness:
⚠️ Cold-start does NOT meet the ~3s spec target.
code-context doctor28/28 pass,doctor mcp8/8 tools advertised.✅ ONNX path produces correct embeddings (smoke run on python fixture: NDCG@10 0.7587).
✅ Tree-sitter chunker works on all 5 supported Python versions (after 1.6.3 pin-out).
Workaround for users on v2.0.6.1
If F0 reproduces on your host (Claude Code shows 0 tools after
claude mcp listcycles between Connected / Failed), setCC_EMBEDDINGS_BACKEND=torchto fall back to the v2.0.5 behaviour. You lose the partial speedup but get back to a known state.Acceptance criteria for v2.0.7
import torchis NOT insys.modulesafter a freshLocalONNX(...).embed(['x']).code-context doctor mcpreportsinitialize ok (≤3.0s)on warm HF cache.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com