tap1x's profile picture
tap1x

agent-toolkit

Public

335 Downloads

1 star

1 fork

README

agent-toolkit

A tools provider plugin for LM Studio that gives models real filesystem access, a command executor, a JavaScript sandbox, and macOS system controls — all gated by a persistent local permission system you manage through a Python control panel.

Tools

ToolDescription
get_current_timeCurrent local date and time
get_model_infoLoaded model name, size, params, context length, capabilities
open_control_panelOpen the permissions GUI (macOS)
read_fileRead an entire file
read_file_linesRead a line range — efficient for large files
write_fileCreate or overwrite a file (creates parent dirs)
edit_fileExact substring find-and-replace — preferred for code edits
edit_file_linesReplace a line range — returns a unified diff
list_directoryList a folder, optionally recursive
create_directoryCreate a directory
delete_pathDelete a file or directory
move_pathMove or rename
run_commandExecute a shell command (permission-gated)
run_javascriptRun JS/TS in a sandboxed Deno runtime (no network, no subprocess)
media_controlPlay/pause/next/previous/volume/mute/status via Now Playing
get_permissionsShow the current permission policy at runtime

Permission system

All access control lives in a single file:

~/.lmstudio-toolkit/permissions.json

The plugin only reads it — never writes it. Your paths, rules, and custom system prompt never leave your machine and are never included in lms push.

Permission tiers

The same tier applies to both files and run_command:

TierFilesCommands
read_writeFull accessAny non-denied command; write-impact args path-checked
readRead/list onlyRead-only commands: ls, cat, grep, find, …
denyInvisibleNo commands at all

More specific path rules take priority over less specific ones:

/projects        → read
/projects/myapp  → read_write   ← wins for everything inside myapp

Control panel

python3 control_panel.py          # GUI (requires Tkinter)

Tabs:

  • File Manager — full filesystem tree with green/yellow/red colour coding; right-click or use the button bar to set rules
  • System Prompt — custom instructions injected at the top of every new conversation
  • Command Executor — enable/disable run_command, allow/deny lists with * wildcard support, system launcher commands (macOS)
  • Active Rules — view and delete all configured rules

CLI helpers:

python3 control_panel.py show
python3 control_panel.py set-rule  /abs/path  read_write|read|deny
python3 control_panel.py del-rule  /abs/path
python3 control_panel.py set-default  read_write|read|deny
python3 control_panel.py enable-commands | disable-commands

Prompt injection

On the first message of each conversation the plugin injects:

  • Your custom system prompt (if set)
  • Current time and loaded model info (name · size · params)
  • A short tool reference and your current permission scope

On every subsequent message it injects only the current time and model name — keeping context overhead minimal.

Command executor

Disabled by default. Enable in the control panel.

  • Deny list supports * wildcards: sudo*, shutdown*, passwd*, mkfs* — 50+ dangerous patterns blocked by default
  • Allow list (optional): restrict run_command to specific binaries only
  • System commands toggle: allows launcher commands (open, say, osascript, pbcopy, afplay, …) without requiring a working directory
  • Write-impact commands (rm, mv, cp, chmod, …) additionally verify that every path argument is inside a read_write-permitted location

Security note: run_command with an interpreter (python3, node, bash) gives the model the same power as that interpreter. The deny list prevents accidental damage but is not a sandbox. Use the allow list if you want strict control over what can run.

Media control

Requires nowplaying-cli (macOS only):

brew install nowplaying-cli

Works system-wide with any Now Playing source: browsers, Spotify, Apple Music, etc. No Accessibility permissions required.

JavaScript sandbox

Uses the bundled Deno runtime from LM Studio. Runs with:

  • --deny-net --deny-env --deny-sys --deny-run --deny-ffi
  • Read/write limited to an isolated sandbox directory (~/.lmstudio-toolkit/sandbox/)

Good for maths, data transformation, JSON parsing, and algorithms. Not for network requests.

Install

cd agent-toolkit
lms dev       # development with hot-reload
# or
lms push      # publish to LM Studio Hub

After installing, configure your permissions:

python3 control_panel.py

The plugin fails closed by default — everything is denied until you grant access.