Skip to content

v2.10.0 — Structural slicing: read the slice, not the file

Choose a tag to compare

@sravan27 sravan27 released this 26 May 16:46

The compounding cost nobody attacks

auto_context kills first-turn exploration. v2.10 attacks the bigger, compounding cost: every file Claude reads is re-sent on every later turn until compaction. An 800-line file read at turn 3 is paid for ~40 more times — when Claude needed one 40-line function.

The assembly — one repo graph, now used for compression, not just retrieval

When Claude issues a whole-file Read of a big indexed file, smart_read.py (PreToolUse) intercepts it and hands back the file's outline — every symbol with its exact line range and signature, rendered straight from the graph with zero file content:

[context-os] `payment.py` is 847 lines. Read the slice you need:
  L12-45    class PaymentProcessor
  L47-89      def charge(self, amount, method)
  L340-410  def validate_card(number, cvv)
  … +28 symbols
  e.g. Read("payment.py", offset=47, limit=43) for the block at L47.

Claude re-reads offset=47, limit=43 — 43 lines, not 847. The body never enters context, so it's never re-sent. Unlike the first-turn saving, this one compounds across every remaining turn.

  • Fires once per file per session (no loop, no nag), only above a line threshold, only when the graph has structure to slice — otherwise falls through to the size guard.
  • /outline <file> renders the same map on demand.
  • CONTEXT_OS_SMART_READ=0 to disable; CONTEXT_OS_SMART_READ_MIN to tune.

Measured, and folded into Receipts

build_repo_graph.py now stores each symbol's line range + signature. Every interception is logged; /savings now shows two measured sources:

  Searches avoided   412   (auto_context → straight to file)
  Big reads sliced    96   (smart_read → outline, not whole file)

  Where it came from
  Avoided searches    1,402,000 tok
  Sliced big reads      938,000 tok

Per-slice credit is conservative — whole-file tokens minus outline tokens — and ignores the larger avoided per-turn re-sends, so it under-claims.

Why it's novel

A repo graph used not for retrieval but for structural compression of reads. Retrieval (skip exploration) + slicing (read less) + causal measurement of both, on one graph — an assembly no other Claude Code tool ships.

Rigor

savings_test.py39 assertions incl. outline rendering, line-range slicing, once-per-session dedupe, sliced-read pass-through, disable flag, slice→receipts crediting, two-source receipts. ranker_floor green. All 5 setup.sh-embedded hook copies byte-identical to canonical.

8 Python hooks · 13 slash commands · 30 techniques.

curl -fsSL https://raw.githubusercontent.com/sravan27/context-os/main/setup.sh | bash