lm-studio-toolbox

Public

1.1K Downloads

3 stars

README

LM Studio Toolbox

English | Deutsch | 简体中文 | 繁體中文

GitHub
CI
License: ISC

A feature-rich LM Studio plugin that gives your local LLM a full suite of tools for autonomous coding, research, file management, and more. It acts as a bridge between the model and your local environment.

[!IMPORTANT] This is an independent fork of Beledarian's LM Studio Toolbox, maintained at haggyroth/LM_Studio_Toolbox.

Find this project helpful? Consider giving it a ⭐ on GitHub or contributing! Encountering issues? Submit them here.


Key Features

File System Mastery

  • Full Control: Create, read, update, delete, move, and copy files and directories.
  • Safe & Secure: All operations are sandboxed to your workspace; path traversal is blocked. Configurable protectedPaths prevents the model from touching sensitive directories.
  • Smart Editing: replace_text_in_file, multi_replace_text, insert_at_line, delete_lines_in_file, and edit_file_with_diff for surgical edits without rewriting entire files.
  • Powerful Search: search_directory provides grep-style multi-file search with context lines, regex support, exclude patterns, and a configurable max_matches cap.
  • File Watching: watch_file / watch_directory for reactive workflows that respond to changes on disk.

Autonomous Sub-Agents

  • Role-Based Delegation: consult_secondary_agent dispatches to a specialised sub-agent — coder, reviewer, researcher, debugger, tester, documenter, planner, data_analyst, or general.
  • Role Chaining: Pass a chain list to run multiple roles in sequence, each receiving the previous output (e.g., coder → tester → reviewer).
  • Auto-Save: Code generated by sub-agents is automatically detected and saved to disk.
  • Execution Log: Every sub-agent response includes a compact [Execution log] of tool calls and outcomes for transparency.
  • Token Tracking: Sub-agent footers report prompt + completion token counts and elapsed time.
  • 429 Retry: Built-in rate-limit retry with Retry-After header support and exponential backoff for transient network errors.
  • Mid-Task Steering: interrupt_sub_agent injects a correction message into a running sub-agent loop without cancelling it.
  • Result Replay: get_sub_agent_result re-reads the last completed result without launching a new session.

Persistent Memory

  • CRUD tools: save_memory, list_memories, search_memories, update_memory, delete_memory.
  • Auto-injection: Top 50 memories are injected into context at the start of every conversation — no explicit lookup needed.
  • Deduplication: Exact-match (case-insensitive) dedup prevents duplicate facts from accumulating.
  • Fallback backend: Pure-JS JSON backend activates automatically if the native SQLite addon can't load (e.g. inside LM Studio's sandboxed runtime), so memory always works.
  • Auto-capture: Optional memoryAutoCapture mode distills key facts from each session automatically.

Code Execution

  • Sandboxed Python: run_python uses sys.addaudithook to block network access, subprocess spawning, and writes outside the workspace.
  • JavaScript: run_javascript runs Node.js code in a temp file.
  • Test Runner: run_test_command executes your project's test suite (npm test, pytest, etc.) from inside a sub-agent loop.
  • Linting: lint_project runs your project's linter and returns structured output.
  • Terminal: execute_command (background) and run_in_terminal (interactive) for shell access.

[!WARNING] Enabling shell or terminal execution allows the model to run arbitrary commands on your system.

Code Intelligence (TypeScript / JavaScript)

  • find_symbol: Locate where a function, class, or variable is defined using AST analysis — no grep false positives.
  • find_usages: Find all call sites for a symbol across the workspace.
  • rename_symbol: Atomically rename an identifier across the entire workspace in a single operation.

Web & RAG

  • Search: web_search (DuckDuckGo + HTML fallback), wikipedia_search.
  • Fetch: fetch_web_content, rag_web_content (with SSRF protection — private IPs blocked, redirects re-validated).
  • Browser Automation: Persistent browser_session_open / browser_session_control / browser_session_close flow for multi-step navigation, form filling, and JavaScript evaluation.
  • Screenshot: capture_screenshot — open a URL, capture a screenshot, and save it to your workspace in one call.
  • Local RAG: rag_local_files — semantic search over workspace files with embedding cache.

Git & GitHub

  • Git: git_status, git_diff (word-level mode), git_log, git_add, git_commit, git_pull, git_push, git_checkout.
  • GitHub CLI: gh_create_issue, gh_list_issues, gh_create_pr, gh_list_prs, gh_view_pr_diff, and more.

Data & Workspace

  • query_database: Read-only SQL queries against a SQLite file in your workspace.
  • query_csv: Query a CSV file with SQL-style filtering and sorting.
  • transform_json: Transform a JSON file using a JavaScript expression.
  • analyze_project: Scan the workspace and produce a structured project summary.
  • tool_usage_stats: Audit log of tool call counts and patterns for the current session.
  • save_session_note: Persist a note about the current session for future reference.
  • Workspace Profiles: save_workspace_profile, switch_workspace_profile, list_workspace_profiles for quickly switching between project contexts.

Custom Plugins

Drop a .js file into ~/.lm-studio-toolbox/plugins/ to register your own tools at startup — no forking required. See PLUGINS.md for the format.


Requirements


Installation

git clone https://github.com/haggyroth/LM_Studio_Toolbox.git
cd LM_Studio_Toolbox
npm install
lms push   # install into LM Studio permanently
# or
lms dev    # development mode with hot reload

Development

git clone https://github.com/haggyroth/LM_Studio_Toolbox.git
cd LM_Studio_Toolbox
npm install
lms dev    # hot-reloads on every source change

Run the full quality pipeline before submitting a PR:

npm run ci   # typecheck → lint → build → test

See CONTRIBUTING.md for the full contribution guide.


Configuration

All settings are accessible in the LM Studio Plugins tab. Key options:

SettingDescriptionDefault
Enable Secondary AgentEnables the consult_secondary_agent tooloff
Secondary Agent EndpointOpenAI-compatible endpoint for sub-agentshttp://localhost:1234
Secondary Model IDModel to use for sub-agents(blank = same as main)
Sub-Agent Loop LimitMax LLM turns per sub-agent run8
Sub-Agent Time LimitWall-clock deadline in seconds600
Sub-Agent: Show Execution LogAppend a compact tool-call log to each responseon
Sub-Agent ProfilesJSON map of role → system prompt overrides(built-in defaults)
Enable MemoryActivates persistent memory toolsoff
Memory Auto-CaptureAuto-distill key facts from each sessionoff
Default Workspace PathStartup working directory(LM Studio home)
Allow Code ExecutionEnables Python, JS, shell, terminal toolsoff
Allow Browser ControlEnables browser automation toolsoff
Allow GitHub ToolsEnables gh_* CLI toolsoff
Protected PathsComma-separated paths the model cannot access(empty)

Available Tools

File System (18 tools)
ToolDescription
list_directoryList files and directories with metadata
change_directoryChange the active workspace directory
make_directoryCreate a new directory
read_fileRead a file (with token estimate and truncation notice)
read_file_rangeRead a specific line range
save_fileCreate or overwrite a file (supports batch)
append_fileAppend content to an existing file
insert_at_lineInsert lines at a specific position
replace_text_in_fileReplace the first occurrence of a string
multi_replace_textApply multiple replacements in one call
delete_lines_in_fileDelete a range of lines
edit_file_with_diffApply a unified diff
delete_pathDelete a file or directory
delete_files_by_patternRegex-based bulk delete
move_fileMove or rename a file
copy_fileCopy a file
get_file_metadataStat a file (size, mtime, type)
apply_patchApply a patch file
Search (3 tools)
ToolDescription
search_directoryGrep-style multi-file search with context, regex, exclude patterns, and max_matches
search_in_fileSearch within a single file
find_filesFind files by name pattern
fuzzy_find_local_filesFuzzy filename search (Levenshtein)
Sub-Agent (3 tools)
ToolDescription
consult_secondary_agentDelegate a task to a specialised sub-agent
get_sub_agent_resultRe-read the last completed sub-agent result
interrupt_sub_agentInject a steering message into a running sub-agent
Memory (5 tools)
ToolDescription
save_memoryStore a persistent fact
list_memoriesList stored memories (optionally filtered by tag)
search_memoriesFull-text search over stored facts
update_memoryEdit a stored memory by ID
delete_memoryRemove a memory by ID
Web & Browser (7 tools)
ToolDescription
web_searchDuckDuckGo search
wikipedia_searchWikipedia article search and summary
fetch_web_contentFetch and parse a URL
rag_web_contentSemantic search over a URL's content
browser_session_openOpen a persistent browser session
browser_session_controlNavigate, click, type, evaluate JS
browser_session_closeClose a browser session
browser_open_pageStateless one-shot page read
capture_screenshotScreenshot a URL and save to workspace
Code Execution (7 tools)
ToolDescription
run_pythonSandboxed Python execution
run_javascriptNode.js script execution
run_test_commandRun the project's test suite
lint_projectRun the project's linter
execute_commandBackground shell command
run_in_terminalInteractive terminal
run_background_commandSpawn a long-running background process
check_background_commandPoll a background command for output
cancel_background_commandCancel a background command
Code Intelligence (3 tools)
ToolDescription
find_symbolFind where a TypeScript/JS symbol is defined (AST)
find_usagesFind all usages of a symbol
rename_symbolAtomically rename across the workspace
Git & GitHub

Git: git_status, git_diff, git_log, git_add, git_commit, git_pull, git_push, git_checkout

GitHub CLI: gh_create_issue, gh_list_issues, gh_view_comments, gh_create_pr, gh_list_prs, gh_view_pr_diff

Data & Workspace (10 tools)
ToolDescription
query_databaseRead-only SQL against a SQLite file
query_csvSQL-style queries over a CSV file
transform_jsonTransform JSON with a JS expression
rag_local_filesSemantic search over workspace files
analyze_projectStructured project summary
tool_usage_statsSession tool-call audit log
save_session_notePersist a note for future sessions
save_workspace_profileSave a named workspace configuration
switch_workspace_profileActivate a saved workspace profile
list_workspace_profilesList saved profiles
Utilities

get_system_info, read_clipboard, write_clipboard, open_file, preview_html, read_document, send_notification, watch_file, watch_directory, stop_watch, list_watches


Changelog

See CHANGELOG.md for the full version history.

Developer Guide

See CODE_OVERVIEW.md for architectural details and SUB_AGENT.md for a deep-dive on the sub-agent pipeline.