feat(agent): opt-in tool-result context pruning

This commit is contained in:
Max Sumrall
2026-01-07 12:02:46 +01:00
committed by Peter Steinberger
parent 937e0265a3
commit eeaa6ea46f
9 changed files with 779 additions and 26 deletions

View File

@@ -850,6 +850,27 @@ export type AgentModelListConfig = {
fallbacks?: string[];
};
export type AgentContextPruningConfig = {
mode?: "off" | "adaptive" | "aggressive";
keepLastAssistants?: number;
softTrimRatio?: number;
hardClearRatio?: number;
minPrunableToolChars?: number;
tools?: {
allow?: string[];
deny?: string[];
};
softTrim?: {
maxChars?: number;
headChars?: number;
tailChars?: number;
};
hardClear?: {
enabled?: boolean;
placeholder?: string;
};
};
export type ClawdbotConfig = {
auth?: AuthConfig;
env?: {
@@ -895,6 +916,8 @@ export type ClawdbotConfig = {
userTimezone?: string;
/** Optional display-only context window override (used for % in status UIs). */
contextTokens?: number;
/** Opt-in: prune old tool results from the LLM context to reduce token usage. */
contextPruning?: AgentContextPruningConfig;
/** Default thinking level when no /think directive is present. */
thinkingDefault?: "off" | "minimal" | "low" | "medium" | "high";
/** Default verbose level when no /verbose directive is present. */