This document covers CLI local actions: file operations and code execution.
For API custom tool integration, see custom-tools.md.
The CLI is a proof of concept. Local actions work, but the UI is basic and it's hard to keep track of conversations and actions. Development focus is on making API custom tools more reliable, enabling third-party clients like Nanocoder that offer better local actions, richer instructions, and a cleaner interface.
-
Enable local actions in
config.yaml:cli: localActions: enabled: true
-
Start the CLI:
tamer
-
Lumo can now read files, make edits, and execute code on your machine. You can ask Lumo to give you a demo of its CLI capabilities, or see this demo chat for inspiration.
cli:
localActions:
# Enable code block detection (```bash, ```read, ```edit, etc.)
# WARNING: When enabled, Lumo can trigger actions on your machine!
enabled: truecli:
localActions:
# ```read blocks: Lumo can read local files without user confirmation
fileReads:
# Enable ```read blocks
# Note: if disabled, Lumo can still ask to read files using shell tools (e.g., cat)
enabled: true
# Max file size. Files larger than this are skipped with an error.
maxFileSize: "512kb"cli:
localActions:
# Maps language tag -> [command, ...args]. Code is appended as last arg.
executors:
bash: ["bash", "-c"]
python: ["python", "-c"]
sh: ["sh", "-c"]
# Uncomment to enable more:
# zsh: ["zsh", "-c"]
# powershell: ["powershell", "-Command"]
# node: ["node", "-e"]
# perl: ["perl", "-e"]cli:
instructions:
template: |
You are a command line assistant. Your output will be read in a terminal. Keep the formatting to a minimum and be concise.
{{#if localActions}}
{{forLocalActions}}
{{/if}}
# Injected as {{forLocalActions}} when localActions.enabled=true
forLocalActions: |
You can read, edit and create files, and you can execute {{executors}} commands on the user's machine.
To execute code, use a code block like ```python. The user will be prompted to execute it and the result will be returned to you.
To read files, use a ```read block with one file path per line. Contents will be returned automatically.
To create a new file, use a ```create block. The user will be prompted to confirm.
To edit an existing file, use a ```edit block (one file per block). Read the file first if needed.| Action | Confirmation Required |
|---|---|
read |
No - automatic |
edit |
Yes - shows diff |
create |
Yes - shows content |
| Code execution | Yes - shows command |
"Command not found" for code execution
- Check that the executor is configured in
cli.localActions.executors - Verify the command exists on your system (e.g.,
pythonvspython3)
File reads failing
- Check
fileReads.maxFileSize- large files are rejected - Verify file path is correct (relative to working directory)
Edits not applying
- Lumo must match the exact text in
<<<<<<< SEARCH - Read the file first so Lumo sees current content
Lumo outputs code blocks with specific language tags. The CLI detects these and executes them locally:
CodeBlockDetectordetects triple-backtick code blocks in Lumo's responseBlockHandler.matches()checks the language tag to find the right handler- Handler executes (with confirmation if required)
- Results are sent back to Lumo as follow-up messages
The language tag is the dispatch mechanism - no JSON parsing involved.
Lumo reads files without prompting:
```read
README.md
src/config.ts
```
File contents are returned to Lumo automatically.
Lumo proposes edits, you confirm:
```edit
=== FILE: src/config.ts
<<<<<<< SEARCH
const timeout = 5000;
=======
const timeout = 10000;
>>>>>>> REPLACE
```
You'll see a diff and be prompted to accept or reject.
Lumo proposes new files, you confirm:
```create
=== FILE: src/new-feature.ts
export function newFeature() {
return "Hello!";
}
```
Lumo runs commands, you confirm:
```bash
ls -la
```
```python
print("Hello from Python!")
```
Only languages configured in executors are allowed.
| File | Purpose |
|---|---|
src/cli/code-block-detector.ts |
Detects code blocks in streaming response |
src/cli/block-handlers.ts |
Handler registry and base class |
src/cli/handlers/file-reader.ts |
read block handler |
src/cli/handlers/edit-applier.ts |
edit block handler |
src/cli/handlers/file-creator.ts |
create block handler |
src/cli/handlers/code-executor.ts |
Code execution handler |