src / index.ts
import { type PluginContext } from "@lmstudio/sdk";
import { configSchematics } from "./config";
import { preprocess } from "./promptPreprocessor";
import { toolsProvider } from "./tools";
// This is the entry point of the plugin. It registers three things:
//
// 1. Config schematics — user-tunable settings shown in LM Studio's plugin panel.
// 2. Prompt preprocessor — runs on every message, auto-searches memory, and injects
// relevant results into context before the model sees the prompt. No tool-call
// round trip, no dependency on the model deciding to look something up.
// 3. Tools provider — explicit save/search/list/forget actions the model can call
// when it decides something is worth remembering (or needs to search on demand).
export async function main(context: PluginContext) {
context
.withConfigSchematics(configSchematics)
.withPromptPreprocessor(preprocess)
.withToolsProvider(toolsProvider);
}