Skip to main content

Local-first CLI agent for generating small scripts using local LLMs

Project description

▸ scripy

Generate small, single-file scripts using locally hosted LLMs. Ideal when presented with repetitive terminal tasks. Available in the command line when you need it.

scripy -p "rename all my jpegs by date taken"

scripy runs an agentic loop: generate, validate, self-correct, and write entirely on your machine via Ollama or LM Studio.


Install

Requires Python 3.11+ and a running Ollama or LM Studio instance.

pip install scripy-cli

Or for development:

pip install -e .

Quick start

Note: This assumes you're running Ollama on the same machine with qwen2.5-coder:7b installed. See Configuration below for more detailed configuration steps.

# Generate a Python script
scripy -p "find duplicate files in a directory"

# Specify output file
scripy -p "find duplicate files in a directory" -o dedup.py

# Generate Bash
scripy -p "backup my home directory to /tmp" --lang bash

# Modify an existing script
scripy -p "add a --dry-run flag" --input dedup.py

# Skip all confirmation prompts (for scripting)
scripy -p "..." -y

Confirmation gates

scripy prompts for user input before any side-effectful action.

Before writing to disk:

  ? write to disk as dedup.py? [y/n/v] ›

Before sandboxed execution:

  ? run script to validate? [y/n/e/v/a] ›
Key Action
y Yes
n No
e Open in $EDITOR to manually edit
v Print script to terminal, then re-prompt
a Always yes - skip gate for all remaining iterations

Use -y / --yes to bypass all gates non-interactively.


Configuration

Default config works with a local Ollama instance. Override via ~/.config/scripy/config.toml:

[model]
  base_url    = "http://192.168.1.10:11434/v1"  # remote Ollama
  model       = "llama3.1:8b"
  api_key     = "ollama" # use "lm-studio" for LM Studio
  temperature = 0.2
  max_tokens  = 4096

[agent]
  force_tools      = true
  max_iterations   = 3
  default_lang     = "python"
  sandbox_timeout  = 10

CLI flags override config for a single run:

scripy --model qwen2.5-coder:7b -p "..."

Model recommendations

scripy targets models that run on small consumer hardware (~4–8GB RAM) but will obviously excel on more powerful machines. That being said, here are some recommendations for small machines.

Model Size Tool calling Code quality Notes
llama3.1:8b ~4.7GB Native Good Recommended default
llama3.2:3b ~2.0GB Native Fair Best ultra-low-resource option
qwen2.5-coder:7b ~4.4GB Inline only Excellent Best code quality; see note below
deepseek-coder:6.7b ~4.0GB Inline only Excellent Same trade-off as qwen-coder

Tool calling

scripy uses the OpenAI function-calling API to let the model invoke tools (write_file, run_script, read_file, list_directory). Models generally fall into two categories:

Native tool calling (llama3.1, llama3.2) - the model returns structured tool_calls in the API response. The agentic loop runs cleanly; run_script validation and multi-turn self-correction work as intended.

Inline tool calling (qwen2.5-coder, deepseek-coder) - these models sometimes ignore the tool-calling API and instead append a JSON blob to their text response. scripy tries to detect and strip these automatically, but the behavior is less reliable and the self-correction loop may not fire. You may see:

  ~ inline tool call detected - model is not using structured tool calling

--force-tools (tool_choice=required) is on by default. This works well with native tool-calling models and is generally the right choice. If you see errors or garbled output, which can happen with certain qwen-coder or deepseek-coder models on older Ollama versions, disable it via config:

# ~/.config/scripy/config.toml
[agent]
  force_tools = false

With force_tools off, scripy falls back to inline tool-call detection automatically. I've personally had better results using LM Studio for smaller models on small hardware (think M2 mac mini 8GB RAM). Sometimes using Ollama the model kept appending tool calls to the script output.


CLI reference

Usage: scripy [OPTIONS]

  scripy - generate scripts with local LLMs.

Options:
  -p, --prompt TEXT   What script to generate.
  -o, --output TEXT   Output file path.
  -l, --lang TEXT     Language override (python, bash, etc.).
  --model TEXT        Model name override.
  --input TEXT        Existing script to modify.
  --tui               Launch Textual TUI.
  -y, --yes           Skip all confirmation gates.
  --force-tools       Override config and set tool_choice=required for this run.
  --version           Show version and exit.
  --help              Show this message and exit.

Development

pip install -e ".[dev]"
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scripy_cli-0.2.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scripy_cli-0.2.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file scripy_cli-0.2.0.tar.gz.

File metadata

  • Download URL: scripy_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for scripy_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 008d2379e482f24c2cd3226b1591282832ed403a6ae34554c28e8f905d054727
MD5 4f91b9a6e623f0bec37a3adf293febc2
BLAKE2b-256 52d0c5fcaa37a29c4cf4d93f7bb1914e6f0f580fee831daf310680ec6aaf1ad5

See more details on using hashes here.

File details

Details for the file scripy_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: scripy_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for scripy_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4eaf19cbd628b2bd5d6995e1bad00c0723399dc91658989b004ff63b212a9b9b
MD5 7b5bf4494bf4e0267e5f4a05a6b140c8
BLAKE2b-256 c410fb0a0a0709cc8a3f0b71e0b260ac8baee6d671a7ae8052002980d6231955

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page