1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! 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:
//!
//! | Story | Module |
//! |---|---|
//! | US-0701 slicer trait | [`slicer`] |
//! | US-0703 log slicer | [`log`] |
//! | US-0704 diff slicer | [`diff`] |
//! | US-0705 JSON slicer | [`json`] |
//! | US-0702 AST slicer | [`ast`] (feature `ast`) |
//!
//! [`Condensate`]: boundgraph_core::Condensate
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Re-exported so a consumer naming a slicer does not also depend on
/// `boundgraph-core` just for its identifier.
pub use ;