🌳 Bonsai Code
Bonsai is a visual bug-fixing & software-engineering environment inside VS Code.
Start from the active file, then apply activities powered by an LLM to generate multiple options and explore alternative branches:
- Fix the problem (mandatory first step, with or without a short description)
- Generate tests
- Refactor
- Handle exceptions
Fill color = last activity, leaf borders = similarity (blue→red vs. the selected leaf), right-click → Trim to prune subtrees, and Export/Import sessions as JSON.
Installation
Option A — Marketplace (when available)
- VS Code ➜ Extensions view
- Search “Bonsai” ➜ Install
Option B — VSIX file
- VS Code ➜ Extensions (⋯) ➜ Install from VSIX…
- Select your
bonsai-*.vsix
Option C — From source (this repo)
# In the repo folder
npm install
npm run compile
code .
# Launch dev host
# VS Code: press F5
API key: set your LM STUDIO url before launching:
- macOS/Linux:
export BONSAI_LM_URL=your_api_key_here
- Windows (PowerShell):
$env:BONSAI_LM_URL="your_api_key_here"
Model: set your LM STUDIO model before launching:
- macOS/Linux:
export BONSAI_LM_MODEL=gpt-oss-20b
- Windows (PowerShell):
$env:BONSAI_LM_MODEL="gpt-oss-20b"
Quick Use
- Open a source file ➜ Ctrl/Cmd+Shift+P → “Start Bonsai” (the active file becomes the first node).
- Always start with Fix the problem.
- When applying an activity, use the numeric input to spawn N branches (N≥1) with different options.
- Select a leaf to see similarity borders on other leaves (cool→warm = less→more similar).
- Check the Details pane (Code, Reasoning, Similarity, Code Metrics).
- Right-click → Trim to prune a node and its children.
- Export JSON to save; Import JSON to restore.
Commands
- Start Bonsai: Opens Bonsai IDE panel.
Release Notes
0.0.4
Get model and LM Studio URL from an input in the Bonsai
0.0.3
Save logs when exporting Bonsai.
0.0.2
Model selection through environment variable (export BONSAI_LM_MODEL=gpt-oss-20b
)
0.0.1
Initial preview: fix-first workflow, numeric branching, activity colors, similarity borders (leaf), Details pane (code/reasoning/metrics), Trim, Export/Import.
Links
Privacy note: Bonsai can send selected code/prompts to your configured LLM. Don’t include secrets or proprietary data unless permitted.