Skip to content

v0.1.3 — Structured Context Engine

Pre-release
Pre-release

Choose a tag to compare

@granth-agarwal granth-agarwal released this 17 Mar 04:36
· 22 commits to main since this release

This release replaces naive source concatenation with an AST-driven structured summary pipeline. Context quality is significantly higher while token usage is 4-5x lower.

What changed

Structured summaries for core modules Tier 1 files no longer dump raw source into CONTEXT.md. Each file now emits a deterministic, AST-derived summary covering purpose, internal dependencies, public types, function signatures, and behavioral notes. Entry point files (cli.py, main.py, app.py, etc.) retain full source since agents benefit from seeing execution wiring directly.

Smarter ranking Replaced static file-count caps (MAX_CORE_MODULES = 10) with budget-driven inclusion. Tier thresholds are now percentile-based rather than hardcoded score cutoffs, producing consistent tier distribution across repos of any size. Default scoring weights rebalanced — git frequency and fan-in each at 0.40, recency reduced to 0.10.

Cleaner output structure Tests, docs, and example directories are forced to Tier 3 (one-liner summaries) regardless of score. A new RANKED_FILES section in every CONTEXT.md shows each file's score, tier, and token cost — making the ranker's decisions fully transparent and auditable.

Bug fixes

  • Fixed SYMBOL_INDEX corruption caused by malformed tree-sitter byte offset extraction
  • Fixed double budget consumption where the formatter was re-charging the budget for already-compressed content
  • Fixed _auto_architecture hardcoded "python-based" string — now detects dominant language from the file set

Code quality Resolved all ruff lint errors across cli.py, compressor/tiered.py, graph/resolver.py, ranker/scorer.py, and ranker/semantic.py.


Numbers

Running codectx analyze . on the codectx repo itself:

Metric Before After
Context tokens ~40,000 ~8,000
Analysis time — 11s
Files in periphery mixed tests + docs only

Upgrade

pip install --upgrade codectx
# or
uv add codectx