summaryrefslogtreecommitdiff
path: root/libpanto/src/config.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-02 15:00:44 -0600
committert <t@tjp.lol>2026-06-02 16:37:32 -0600
commit8b88b886346460b1ab29edb03ad85bc3bb565a45 (patch)
tree13b9ab56061a722641389b5fc8ac1113d09b66e5 /libpanto/src/config.zig
parent7268c0b8e8bcf4b325581fabe7476a394f167738 (diff)
compaction
Diffstat (limited to 'libpanto/src/config.zig')
-rw-r--r--libpanto/src/config.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/libpanto/src/config.zig b/libpanto/src/config.zig
index 6b8d9a8..114280c 100644
--- a/libpanto/src/config.zig
+++ b/libpanto/src/config.zig
@@ -69,6 +69,24 @@ pub const ProviderConfig = union(APIStyle) {
}
};
+/// Compaction settings the agent consults when summarizing old history.
+///
+/// `keep_verbatim` is the budget (in tokens) governing how much recent
+/// conversation is kept verbatim after compaction. The retention walk
+/// accumulates whole turns backward and stops once the running total
+/// exceeds this value, so `keep_verbatim` is an *upper bound* on the size
+/// of the kept suffix (the turn that crosses the threshold is summarized,
+/// not kept).
+///
+/// `model`, when set, is the provider/model used to run the compaction
+/// request itself. On failure (e.g. the compaction model rejects the
+/// transcript for context length) the agent falls back to the active chat
+/// model. When null, compaction uses the active chat model directly.
+pub const CompactionConfig = struct {
+ keep_verbatim: u32 = 20_000,
+ model: ?ProviderConfig = null,
+};
+
/// An immutable snapshot of everything the agent consults per turn: which
/// provider/model to talk to, and which tools to expose. The agent holds a
/// `*const Config` and re-reads it each turn; replacing the pointer swaps
@@ -80,6 +98,7 @@ pub const ProviderConfig = union(APIStyle) {
pub const Config = struct {
provider: ProviderConfig,
registry: *const ToolRegistry,
+ compaction: CompactionConfig = .{},
pub fn style(self: Config) APIStyle {
return self.provider.style();