src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
// Global plugin settings (shown in LM Studio's plugin config UI). LM Studio chats aren't bound to a
// project directory, so the user points the plugin at the project whose .wolf/ they want surfaced.
export const configSchematics = createConfigSchematics()
.field(
"projectRoot",
"string",
{
displayName: "Project root",
subtitle: "Absolute path to the project whose .wolf/ knowledge base to use (contains STATUS.md, cerebrum.md, memory.md, buglog.json).",
},
"",
)
.field(
"agentId",
"string",
{
displayName: "Local model id (write namespace)",
subtitle: "This model's own area under .wolf/local/<id>/. All writes go here — the canonical .wolf/ files are never touched. Use a distinct id per model (e.g. 'qwen', 'llama').",
},
"qwen",
)
.field(
"injectDigest",
"boolean",
{
displayName: "Auto-inject resume digest",
subtitle: "Prepend the current quest + Do-Not-Repeat + known bugs to each message.",
},
true,
)
.field(
"maxDigestChars",
"numeric",
{
displayName: "Max digest size (chars)",
subtitle: "Keep small for small local models so context stays cheap.",
min: 300,
max: 6000,
},
1500,
)
.field(
"useOpenwolfMcp",
"boolean",
{
displayName: "Sync via OpenWolf MCP (optional)",
subtitle: "Off = pure local (reads .wolf/ directly). On = route recall + resume through the OpenWolf MCP server for real BM25 recall, citations, and native Auto Memory. Requires the openwolf CLI.",
},
false,
)
.field(
"openwolfCommand",
"string",
{
displayName: "openwolf command",
subtitle: "How to invoke the OpenWolf CLI for MCP sync (e.g. 'openwolf', or an absolute path to the bin). Only used when MCP sync is on.",
},
"openwolf",
)
.build();
/**
* Resolve the project root defensively: configured value first, then env, then the chat's working
* directory. Keeps the plugin useful even before the user sets the path.
*/
export function resolveProjectRoot(configured: string | undefined, workingDir: string | undefined): string {
const candidate = (configured && configured.trim()) || process.env.OPENWOLF_PROJECT_DIR || workingDir || process.cwd();
return candidate;
}