21 Downloads
21 Downloads
A context-light coding toolkit for LM Studio chat agents: eight focused tools, a mandatory user-defined working folder, and sub-agents that do smaller tasks in the background so the main chat stays light on context.
set_workspace pins a project folder (the one you define). All paths resolve inside it; traversal outside is blocked.subagent, which returns only a short summary.lms dev compiles src/index.ts, registers the plugin with LM Studio, and hot-reloads on changes. Enable code-agent for your chat agent in LM Studio's plugin settings. Stop it again with Ctrl+C when done.
D:\AI stuff\myapp, work there." The agent calls set_workspace first; all file tools error until that succeeds. The workspace persists across chats for the lifetime of the LM Studio process (re-set it after a restart or plugin reload).| Tool | Parameters | What it does |
|---|---|---|
set_workspace | path | Set the project working folder (must exist). Must be called before any other tool. |
list_dir | path? (default .) | List a directory; lines start with D= (folder) or F= (file), folders first. |
read_file | path, start?, lines? (≤ 400) | Read part of a text file, line-numbered. Defaults to 100 lines; pass start to continue. |
write_file | path, content | Create or overwrite a file; missing parent folders are created. |
edit_file | path, find, replace? | Replace an exact, unique text match (error if it matches 0 or >1 times). Omit replace to delete the matched text. |
list_dir, read_file, search, write_file, ... escapes are rejected (case-insensitively on Windows).run command you approve.run executes arbitrary shell commands inside the workspace; that is the only unconfined surface and exists because builds/tests need it.dist/: npm run build (tsc). Not needed for normal use — LM Studio compiles src/index.ts itself via esbuild when you run lms dev or install from the Hub.tsconfig.json targets CommonJS/ES2021 into dist/.Set "owner" in manifest.json to your LM Studio username (the one shown by lms whoami).
.gitignore keeps node_modules/, dist/ and .lmstudio/ out of the upload — that's intentional; installers compile src/ on their own machine at install time.
A context-light coding toolkit for LM Studio chat agents: eight focused tools, a mandatory user-defined working folder, and sub-agents that do smaller tasks in the background so the main chat stays light on context.
set_workspace pins a project folder (the one you define). All paths resolve inside it; traversal outside is blocked.subagent, which returns only a short summary.lms dev compiles src/index.ts, registers the plugin with LM Studio, and hot-reloads on changes. Enable code-agent for your chat agent in LM Studio's plugin settings. Stop it again with Ctrl+C when done.
D:\AI stuff\myapp, work there." The agent calls set_workspace first; all file tools error until that succeeds. The workspace persists across chats for the lifetime of the LM Studio process (re-set it after a restart or plugin reload).| Tool | Parameters | What it does |
|---|---|---|
set_workspace | path | Set the project working folder (must exist). Must be called before any other tool. |
list_dir | path? (default .) | List a directory; lines start with D= (folder) or F= (file), folders first. |
read_file | path, start?, lines? (≤ 400) | Read part of a text file, line-numbered. Defaults to 100 lines; pass start to continue. |
write_file | path, content | Create or overwrite a file; missing parent folders are created. |
edit_file | path, find, replace? | Replace an exact, unique text match (error if it matches 0 or >1 times). Omit replace to delete the matched text. |
list_dir, read_file, search, write_file, ... escapes are rejected (case-insensitively on Windows).run command you approve.run executes arbitrary shell commands inside the workspace; that is the only unconfined surface and exists because builds/tests need it.dist/: npm run build (tsc). Not needed for normal use — LM Studio compiles src/index.ts itself via esbuild when you run lms dev or install from the Hub.tsconfig.json targets CommonJS/ES2021 into dist/.Set "owner" in manifest.json to your LM Studio username (the one shown by lms whoami).
.gitignore keeps node_modules/, dist/ and .lmstudio/ out of the upload — that's intentional; installers compile src/ on their own machine at install time.
run.subagent with the task description and receives a compact summary instead of the full working transcript — that's what keeps your main chat's context small.search | pattern, path? | Case-insensitive content search; returns path:line matches. Skips .git, node_modules, dist, .next, build, coverage, binary files and files > 2 MB. |
run | cmd | Run a shell command in the working folder (builds, tests, installs). 120 s timeout; long output is truncated to the last ~6 KB. |
subagent | task | Delegate a self-contained task to a background agent. Returns [subagent: N rounds, Xs] plus its summary (capped at 2000 chars). |
edit_filerun) and no deletes, so a sub-agent can never run code or remove anything.lms login, then:
Bump "revision" in manifest.json for each update you push.
cd code-agent
npm install
lms dev # or: npm run dev
lms get <owner>/code-agent -y
src/
index.ts # entry point: registers tools provider + prompt preprocessor (loaded by LM Studio)
workspace.ts # working-folder state + path containment checks
fsops.ts # list/read/write/edit/search implementations with output caps
subagent.ts # the subagent tool (SDK .act() on a filtered tool subset)
tools.ts # the 7 core tools + provider wiring (8 total)
preprocess.ts # prompt preprocessor: workspace reminder / one-time delegation briefing
run.subagent with the task description and receives a compact summary instead of the full working transcript — that's what keeps your main chat's context small.search | pattern, path? | Case-insensitive content search; returns path:line matches. Skips .git, node_modules, dist, .next, build, coverage, binary files and files > 2 MB. |
run | cmd | Run a shell command in the working folder (builds, tests, installs). 120 s timeout; long output is truncated to the last ~6 KB. |
subagent | task | Delegate a self-contained task to a background agent. Returns [subagent: N rounds, Xs] plus its summary (capped at 2000 chars). |
edit_filerun) and no deletes, so a sub-agent can never run code or remove anything.lms login, then:
Bump "revision" in manifest.json for each update you push.
cd code-agent
npm install
lms dev # or: npm run dev
lms get <owner>/code-agent -y
src/
index.ts # entry point: registers tools provider + prompt preprocessor (loaded by LM Studio)
workspace.ts # working-folder state + path containment checks
fsops.ts # list/read/write/edit/search implementations with output caps
subagent.ts # the subagent tool (SDK .act() on a filtered tool subset)
tools.ts # the 7 core tools + provider wiring (8 total)
preprocess.ts # prompt preprocessor: workspace reminder / one-time delegation briefing
npm run push # = lms push
npm run push # = lms push