Expand description
Layer 4 of BoundGraph: the slicers that make context cost linear.
A raw tool result might be ten thousand lines. What the next step receives is
a few hundred tokens of structured summary — a Condensate — while the
original stays addressable in the content store for an auditor. That single
move is what turns quadratic context growth into linear growth, and it is
the mechanism behind Law II.
§Why naive truncation is not an option
Cutting the first n bytes off a result is cheap and almost always wrong.
The interesting part of a build log is at the end; the interesting part of a
diff is spread across hunks; the interesting part of a JSON response is its
shape, not its first field. Worse, a truncated result looks complete — it
invites confidently wrong conclusions, which is precisely the failure mode
this project exists to prevent.
So slicing is per-kind and structure-aware. Each slicer knows what is worth keeping in its own format, and every one of them reports honestly whether it dropped anything.
§The contract
Slicer::condense is a provided method that preserves the original,
calls the implementation, and then checks the result against the cap. An
implementation cannot skip any of those, so “output never exceeds the cap”
is a property of the trait rather than a promise each slicer makes
separately. See slicer for the reasoning.
§Status
Feature 07, milestone M3. Built in dependency order rather than story order, because US-0702 degrades to US-0703’s slicer and so needs it first:
Re-exports§
pub use ast::AstSlicer;pub use ast::Language;pub use diff::DiffSlicer;pub use diff::FileDiff;pub use diff::FileStatus;pub use diff::Hunk;pub use json::JsonSlicer;pub use json::REDACTED;pub use log::Level;pub use log::LogLine;pub use log::LogSlicer;pub use slicer::ByteCeiling;pub use slicer::CommandOutcome;pub use slicer::Estimate;pub use slicer::MemoryStore;pub use slicer::Raw;pub use slicer::Slice;pub use slicer::SliceError;pub use slicer::Slicer;pub use slicer::Store;pub use slicer::StoreError;pub use slicer::TokenCount;
Modules§
- ast
- Condensing source code: keep the shape, elide the bodies.
- diff
- Condensing patches: whole hunks, or none of them.
- json
- Condensing JSON: keep the shape, sample the values.
- log
- Condensing command output: keep what failed, drop what scrolled past.
- slicer
- The contract every slicer meets, and the machinery that makes it hold.
Structs§
- Schema
Id - Re-exported so a consumer naming a slicer does not also depend on
boundgraph-corejust for its identifier. Names the shape of a condensate’s payload. - Slicer
Id - Re-exported so a consumer naming a slicer does not also depend on
boundgraph-corejust for its identifier. Which slicer produced a condensate, and at what version.