One file · Open source

The coding agent that fits in one file

Spark is a single TypeScript file — 2 700 lines you can read, audit, and trust. Every tool an agent needs to get real coding work done is built in. No framework, no magic, no hidden runtime.

bun spark.ts --autopilot "fix the login 500 and add a test"

One file. Easy to audit.

The entire agent is spark.ts. No installed packages, no separate runtime, no build step. Read it once — you know everything the agent can do.

All the tools to get shit done

ReadFile, WriteFile, Bash, Eval, Glob, Grep, FindSymbol, Task — eight tools that cover every real-world coding task. Nothing missing, nothing extra.

Local or remote LLM

Auto-picks the best Ollama model on your machine. Or point OPENAI_BASE_URL at any OpenAI-compatible API. Your keys, your hardware.

Built-in tools

Every tool the agent needs — all inside spark.ts. No plugins to install.

ReadFile

Read files with offset + limit. Never loads more than needed.

WriteFile

Full write or surgical patch mode. Targeted string replacement inside a file.

Bash

Run any shell command with configurable timeout. Build, test, deploy.

Eval

JS/TS REPL — execute code in-process and get the result back.

Glob

Fast file pattern matching. Respects .gitignore.

Grep

Regex search across the codebase with file + line results.

FindSymbol

Jump to any function, class, or variable definition instantly.

Task

Spawn concurrent subagents. Fan out work, collect results in parallel.

How to run it

Pass a goal and walk away. Spark drives to completion — up to 50 reflection steps — and only exits when done.

# Fix a bug, end-to-end
bun spark.ts --autopilot "the login form shows a 500 on submit, investigate and fix"

Built for real engineering work

Parallel subagents

The Task tool spawns concurrent sub-agents. Fan out work across multiple files or modules, then collect results with WaitTask.

Context compaction

Long sessions automatically compact the context when it nears the model limit. Runs stay coherent without manual intervention.

Git-aware context

Spark reads your git status and recent log at session start — the model knows what branch you're on and what changed.

AGENTS.md instructions

Drop an AGENTS.md in your repo root. Spark loads it as system context — project conventions, forbidden paths, custom tool hints.

Smart model selection

Auto-discovers Ollama models, scores them by capability and parameter count, and picks the best one. Override with --model.

No install required

Clone the repo or copy the file. Run with bun spark.ts. Bun and an LLM endpoint are the only dependencies.

An agent you can actually read

One file. No magic. Every tool needed to ship real code — locally or against any OpenAI-compatible API.

Run now

Clone and run. Bun + Ollama is all you need.

git clone github.com/dzianisv/spark
bun spark.ts

View on GitHub

Source, README, and the full spark.ts in one place.

dzianisv/spark