src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"triggerPercent",
"numeric",
{
min: 0.05,
max: 0.95,
displayName: "Compaction trigger",
subtitle:
"Compact once this fraction of the context window is used. Lower keeps the context short, " +
"which keeps generation fast, at the cost of compacting more often. Tool definitions are " +
"not counted by the measurement, so leave some headroom.",
slider: { min: 0.05, max: 0.95, step: 0.05 },
},
0.6,
)
.field(
"keepRecentTokens",
"numeric",
{
int: true,
min: 500,
max: 32000,
displayName: "Recent context kept verbatim",
subtitle:
"How many tokens at the end of the conversation are never summarized. Measured in tokens, " +
"not messages: one tool result can be worth forty ordinary replies, and a tail counted in " +
"messages can overflow the window on its own.",
slider: { min: 500, max: 32000, step: 500 },
},
6000,
)
.field(
"chunkTokens",
"numeric",
{
int: true,
min: 2000,
max: 32000,
displayName: "Summarize in chunks of",
subtitle:
"Tokens of history per summary. Each chunk costs one model call whatever its size, and " +
"reading is far cheaper than writing — so smaller chunks make compaction slower, not " +
"faster. Lower it only if summaries are losing detail.",
slider: { min: 2000, max: 32000, step: 1000 },
},
16000,
)
.field(
"maxToolResultTokens",
"numeric",
{
int: true,
min: 500,
max: 32000,
displayName: "Maximum size of a tool result",
subtitle:
"Tool results are truncated to this many tokens before the model sees them. Servers set no " +
"such limit of their own: reading one large file can return more than the context holds and " +
"kill the reply outright. Compaction cannot help — it runs before the reply, not during it.",
slider: { min: 500, max: 32000, step: 500 },
},
4000,
)
.field(
"vaultPath",
"string",
{
displayName: "Archive folder (optional)",
subtitle:
"Folder where the verbatim transcript and the consolidated state note are written on every " +
"compaction — an Obsidian vault works well. Leave empty to keep everything in memory and " +
"write nothing to disk.",
},
"",
)
.field(
"showStatus",
"boolean",
{
displayName: "Announce compaction in chat",
subtitle: "Show a one-line notice with the before/after token counts when compaction runs.",
},
true,
)
.build();