feat(agent): opt-in tool-result context pruning
This commit is contained in:
committed by
Peter Steinberger
parent
937e0265a3
commit
eeaa6ea46f
@@ -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. */
|
||||
|
||||
@@ -513,6 +513,40 @@ export const ClawdbotSchema = z.object({
|
||||
skipBootstrap: z.boolean().optional(),
|
||||
userTimezone: z.string().optional(),
|
||||
contextTokens: z.number().int().positive().optional(),
|
||||
contextPruning: z
|
||||
.object({
|
||||
mode: z
|
||||
.union([
|
||||
z.literal("off"),
|
||||
z.literal("adaptive"),
|
||||
z.literal("aggressive"),
|
||||
])
|
||||
.optional(),
|
||||
keepLastAssistants: z.number().int().nonnegative().optional(),
|
||||
softTrimRatio: z.number().min(0).max(1).optional(),
|
||||
hardClearRatio: z.number().min(0).max(1).optional(),
|
||||
minPrunableToolChars: z.number().int().nonnegative().optional(),
|
||||
tools: z
|
||||
.object({
|
||||
allow: z.array(z.string()).optional(),
|
||||
deny: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
softTrim: z
|
||||
.object({
|
||||
maxChars: z.number().int().nonnegative().optional(),
|
||||
headChars: z.number().int().nonnegative().optional(),
|
||||
tailChars: z.number().int().nonnegative().optional(),
|
||||
})
|
||||
.optional(),
|
||||
hardClear: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
placeholder: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
tools: z
|
||||
.object({
|
||||
allow: z.array(z.string()).optional(),
|
||||
|
||||
Reference in New Issue
Block a user