altra's profile picture
altra

high-perf-tools

Public

607 Downloads

6 stars

1 fork

README

High-Perf Tools for LM Studio — Full Developer Toolbelt for Local AI Agents

Keywords: lm studio plugin, ai developer tools, local code execution, python ai agent, cpp compilation ai, git ai tools, file system ai, agent zero, autonomous ai, no cloud

A high-performance LM Studio plugin for Python and C++ development, filesystem operations, git, web research, and autonomous Agent Zero capabilities.

Who This Is For

  • Developers building autonomous AI agents that need to actually run code, not just talk about it
  • Engineers wanting a local AI with filesystem, git, and shell access from LM Studio
  • Power users who need Python execution, C++ compilation, and persistent memory in their LLM workflow
  • Anyone replacing cloud-based coding assistants with a fully local, zero-telemetry alternative

Features

Filesystem (11 tools)

ToolDescription
read_fileRead files with optional line range selection
write_fileWrite or append to files, creating parent dirs
replace_in_fileSurgical find-and-replace (literal or regex)
diff_previewPreview a write or replace as a unified diff without modifying anything
delete_pathDelete files or directories
move_pathMove or rename files/directories
copy_pathCopy files within the workspace
list_directoryList files with metadata, filtering, recursive walk
create_directoryCreate directories (with parents)
file_infoFile metadata: size, line count, permissions
search_in_filesgrep-like search across workspace files

Execution (4 tools)

ToolDescription
run_commandExecute arbitrary shell commands
run_python_codeRun a Python snippet (temp file)
run_python_fileRun an existing Python script
get_environmentReport Python version, PATH, installed tools

Python Dev (7 tools)

ToolDescription
analyze_pythonAST analysis: imports, classes, functions, globals
format_pythonFormat with ruff or black
lint_pythonLint with ruff or pylint, optional auto-fix
run_testsRun pytest with filtering and verbosity control
pip_installInstall Python packages
pip_listList installed packages (supports --outdated)
type_check_pythonRun mypy, optional --strict mode

C++ Dev (7 tools)

ToolDescription
compile_cppCompile with clang++/g++, sanitizers, custom flags
run_binaryExecute a compiled binary
compile_and_runCompile and immediately run a snippet or file
format_cppFormat with clang-format
analyze_cppStatic analysis with clang-tidy
cmake_buildCMake configure + build
get_cpp_infoCompiler and tool version report

Research (2 tools)

ToolDescription
fetch_urlFetch a URL and return plain text (HTML stripped)
search_webDuckDuckGo search, returns titles + snippets

Git (8 tools)

ToolDescription
git_statusWorking-tree status
git_diffWorking-tree or staged diff
git_logCommit history with filtering
git_showShow a specific commit
git_branchesList local and remote branches
git_stageStage files (git add)
git_commitCreate a commit (optionally stages files first)
git_initInitialise a new repository

Agent Zero (10 tools)

ToolDescription
memory_savePersist a fact or solution across conversations
memory_recallKeyword-search persistent memory
memory_listList all saved memories
memory_deleteDelete a memory by id or key
list_modelsList models loaded in LM Studio
spawn_agentDelegate a task to an autonomous sub-agent
create_toolCreate a reusable Python tool saved to the workspace
call_toolCall a previously created tool by name
list_custom_toolsList all dynamically created tools
delete_toolDelete a dynamic tool

Installation

cd high-perf-tools
npm install
npx tsc

Or during development:

npm run dev

Configuration

Open Settings → Plugins → high-perf-tools in LM Studio.

SettingDefaultDescription
Workspace Path(cwd)All file operations are sandboxed here
Python Interpreter(system python3)Conda env name (e.g. misc) or full binary path
Allow Shell CommandsoffEnables run_command
Allow Python ExecutionoffEnables run_python_code, run_python_file, run_tests
Allow C++ CompilationoffEnables compile_cpp, run_binary, compile_and_run, cmake_build
Allow pip installoffEnables pip_install
Allow Git Write OperationsonEnables git_stage, git_commit
Prefer Clang over GCConUse clang++ when both compilers are available
Command Timeout (seconds)60Hard kill timeout for all subprocess execution
Sub-Agent Model ID(reuse current)Model for spawn_agent (blank = no extra RAM)
LM Studio API Endpointhttp://localhost:1234OpenAI-compatible API used by sub-agents
Sub-Agent Max Iterations6Tool-call loop limit per spawn_agent call

Python / Conda Environment

Set Python Interpreter to:

  • Blank — uses system python3
  • A conda env name (e.g. ml) — the plugin searches common conda prefix directories (~/miniconda3/envs, ~/anaconda3/envs, etc.) and falls back to conda run -n <name> if not found
  • A full binary path (e.g. /opt/homebrew/envs/ml/bin/python)

All Python tools, pip, pytest, and dynamic tools share this single interpreter.


Agent Zero

Persistent Memory

The plugin stores memories as JSON at .agent_memory/memory.json inside the workspace. Memories survive across conversations. The model can tag and query them with memory_save / memory_recall.

Sub-agents (spawn_agent)

Sub-agents run an autonomous tool-call loop against LM Studio's OpenAI-compatible API.

RAM-aware model selection:

  • One model loaded (low-RAM devices) → the same model is reused with a different system prompt. Zero extra RAM.
  • Sub-Agent Model ID set and loaded → uses the dedicated sub-agent model.

The sub-agent has access to: read_file, write_file, list_directory, run_python_code, run_command, memory_save, memory_recall.

Set allow_tools=false for pure generation tasks (faster, no tool-call loop).

Dynamic Tools (create_tool / call_tool)

The model can write Python functions and register them as persistent tools:

create_tool(
  name="add_numbers",
  description="Add two numbers",
  args_schema='{"x": number, "y": number}',
  python_code='return str(args["x"] + args["y"])'
)

Tools are saved as Python scripts in .agent_tools/ inside the workspace and can be called by name in future conversations. Arguments are passed as JSON via stdin; the function returns a string or JSON-serialisable value.


Error Handling

Every tool is wrapped in safe_impl(). When a tool throws, the model receives a structured JSON response it can parse and retry:

{
  "tool_error": true,
  "tool": "write_file",
  "error": "Path escapes the workspace",
  "hint": "Read the error above, fix the parameter causing the issue, and retry the tool call."
}

The prompt preprocessor injects tool-call rules on the first turn, reminding the model to output valid JSON and handle tool_error responses.


Security

  • Workspace sandbox: all file paths are resolved and validated against the configured workspace root. Paths that escape (e.g. ../../etc/passwd) are rejected.
  • Private IP blocking: fetch_url blocks requests to localhost, RFC 1918, and link-local addresses.
  • Execution opt-in: shell, Python, C++, and pip tools are disabled by default and must be explicitly enabled in settings.
  • run_command warning: shell execution is not sandboxed beyond setting the working directory. Only enable it if you trust the model.

If the altra/web-search plugin is also installed and loaded, fetch_url and search_web are automatically omitted from this plugin's tool list at startup. The web-search plugin's fetch_and_read and search tools handle those instead.

This avoids duplicate web-fetching tools in the LLM's context when both plugins are active.


Requirements

  • LM Studio with plugin support
  • Node.js 18+
  • lms CLI (npm install -g @lmstudio/lms)
  • Optional: Python / conda, gcc/clang++, cmake, ruff, black, mypy, pytest