English | 中文
Make the browser an execution surface. Put every step in a ledger you can roll back.
Spark is not a chat box bolted onto an editor. It folds the browser, terminal, desktop, IDE, phone and API into one agent loop — plans you can see, writes you can stop, and steps you can take back.
Most agents look limitless in a demo and fragile in a real repository. Spark is built for the second act: writes pass approval and a sandbox, tests are executed by the runner itself, and every turn leaves a checkpoint behind. Code, keys and context stay in the workspace you choose.
Quickstart
# Linux / macOS — SHA256-verified installer
curl -fsSL https://raw.githubusercontent.com/badhope/spark/main/scripts/install.sh | sh
# Windows (PowerShell)
irm https://raw.githubusercontent.com/badhope/spark/main/scripts/install.ps1 | iex
spark init # connect any OpenAI-compatible endpoint
spark web # open the browser UI
No API key? Spark still starts, but reports the real configuration error instead of inventing an answer. Settings has an explicit Mock demo mode so you can inspect the interface first; live-mode errors (missing key, model not downloaded, unreachable endpoint) are shown as they are.
One loop, six surfaces
Web, desktop, CLI/TUI, IDE/ACP, phone and HTTP API share the same AgentLoop, approvals, sandbox, rollback and ledger. They are not six drifting implementations. Switch surfaces and your rules and context do not start over.
The browser is not an attachment
Browser automation runs on Playwright with Chromium / Chrome / Edge / Firefox / WebKit engines, persistent profiles for logged-in sessions, and CDP attachment to an already-running browser.
Its 24 browser_* tools cover snapshots, interaction, tabs, downloads, PDF, console, network, traces and Chromium metrics. Per-domain allow/read/prompt/deny rules gate writes, with a second confirmation on sensitive sites. Reusing a signed-in tab goes through the official Playwright MCP --extension preset; see docs/BROWSER_EXTENSION_BRIDGE.md.
Nothing writes without a gate
Approval, sandbox and rules narrow in order. Wildcard rules are scoped to user, project and local config; deny always wins. Protected credential paths and shell token checks stay on. A cloned repository can tighten permissions, never grant itself more.
Every turn has a way back
Each turn snapshots the workspace. Files and conversation restore together, even outside git. Tasks move as branches: start, commit each verified step, finish on green tests; a failed run abandons its branch instead of leaking changes into the main workspace.
Models, tools and UI are yours
MIT licensed. Providers, tools, MCP servers, Skills, slash commands, plugins, themes and workflows are replaceable, and the whole stack can be self-hosted. Use any OpenAI-compatible endpoint, fallback model chain and credential pool, plus a separate small model for auxiliary calls.
When the task calls for real files, the enterprise control plane turns documents, meeting recordings and spreadsheets into cited minutes, action items, reports and exports; local OCR and transcription keep the source on your machine.
The real interface: read a file → explain the root cause → change the code → run the tests. Reasoning, tool results and checkpoints live on one timeline.
A real look
Dark · the star field and orbit; light · the default skin for daylight coding.
Settings does not hide safety in a config file; audit keeps remote writes visible only on the host. The UI is bilingual; screenshots show the Chinese locale.
Unattended, not unwatched
spark autopilot "add rate limiting to the auth module, with regression tests" --workdir .
spark autopilot --resume .spark/autopilot/<run-id>.json --workdir . # continue after a stop
spark autopilot "refactor the parser" --workdir . --json # NDJSON for CI/queues
Autopilot runs the same AgentLoop, approvals and sandbox as every other entry point. It adds a state machine around them:
- build — read the repository, classify the task, plan, implement;
- repair — feed the independent test failure back, classify the root cause, fix it;
- audit — after tests are green, re-check requirement coverage and boundaries;
- done — only when tests pass, a real diff exists, and the audit turn finished.
Each turn is persisted to .spark/autopilot/<run-id>.json; an in-flight turn is marked with turn_in_progress, active_prompt, pid and retried on --resume instead of being skipped.
--heartbeat-interval touches the state file during long model calls, and no-progress uses three fingerprints (diff, test output, tool calls). --max-turns, --turn-timeout, --task-timeout, --max-cost-usd and consecutive no-progress limits stop a runaway run. The default is full-auto + workspace sandbox + no tool network; unrestricted requires --allow-unrestricted. Tests are executed by the runner itself, never accepted from the model's "done" claim. See docs/AUTOPILOT.md for the state machine, prompt contract and honest limits.
This image was rendered from the actual NDJSON log of the run, not a mockup.
Your desktop is the host, your phone is the remote
Open Settings → System → Remote control and generate a one-time link and QR code. The phone joins the same workspace; files, commands, model calls and approvals still run on the desktop. Same Wi-Fi works with spark web --host 0.0.0.0; public access uses spark web --public-url https://your-domain behind your own HTTPS reverse proxy.
The phone can chat, approve, cancel, switch sessions and read files and diffs. Settings, plugins and direct shell/PTY stay local. Pairing codes expire after 5 minutes; each device gets its own 7-day token that can be revoked independently. Paired pages show live presence and a local-only audit trail of remote writes; an HTTPS or localhost page can enable Web Push so a locked phone still receives approval alerts.
The phone gets its own home instead of a shrunken desktop: at 390×844 the first screen shows pending approvals, the current session and a new task, with a fixed four-item tab bar. Approvals take two taps — review on the home card, then allow or deny. It is installable as a PWA; the composer microphone uses browser SpeechRecognition and falls back to the keyboard when unsupported or denied.
Pairing, presence, audit and two-tap approvals all live inside the same permission model.
Safety model
Three layers, each narrower than the last:
- Approval — from plan-only to full-auto. The default asks before writes and commands.
- Sandbox — workspace isolation by default; escapes and protected paths are refused.
- Rules — tool and resource matching across user, project and local scopes. A cloned repository can tighten permissions, never grant itself more.
OS-level isolation is used where available: bwrap on Linux, Job Objects on Windows, sandbox-exec on macOS. When a platform cannot enforce a control, the tool result says so instead of pretending.
Interfaces and commands
| Interface | Command | Use it for |
|---|---|---|
| Web UI | spark web |
Chat, files, terminal, execution graph |
| Enterprise API | spark enterprise |
/api/v1 control plane and /office |
| Desktop | spark desktop |
Native window, loopback only |
| TUI / CLI | spark · spark exec --json |
Terminal work and automation |
| IDE / ACP | spark acp · spark ide install |
Zed, JetBrains, Neovim |
| MCP / A2A | spark mcp-serve · spark a2a-serve |
Tool and agent-to-agent integration |
spark # terminal TUI
spark web # browser UI on loopback
spark web --host 0.0.0.0 # LAN; Settings → Remote generates a QR link
spark web --public-url https://spark.example.com # behind your HTTPS reverse proxy
spark desktop # native window, loopback only
spark exec "task" --json # NDJSON events for scripts and CI
spark review # inspect the uncommitted diff
spark doctor # check config, credentials and runtime
spark browser-doctor # launch the configured engine and render a test page
spark exec emits one JSON object per line and ends with {"type":"final","text":"…"}, so it pipes directly into jq. The enterprise control plane also provides document and meeting workflows:
spark enterprise --host 127.0.0.1 --port 18800
# http://127.0.0.1:18800/office
OpenCode compatibility
spark opencode --workdir . # inspect config, agents, commands, MCP and parse errors
spark opencode --workdir . --json # machine-readable
Spark reads opencode.json(c), .opencode/agents/**/*.md, .opencode/commands/*.md and inline command entries; permission / permissions deny maps to tool denylists. It does not implement the OpenCode plugin runtime, provider registry, automatic MCP import, or !`command` shell injection; those are not silently faked. See docs/OPENCODE_COMPAT.md.
Documentation
More: docs index · English docs · VS Code extension · audit notes · brand guide.
Verify locally
pytest -q
ruff check src tests scripts
mypy src/spark --ignore-missing-imports
CI also runs a Windows checkout check, frontend build drift, packaging checks, a secret scan, an OpenAPI snapshot check and a mock-mode agent eval.
Requirements
Python 3.11.5+ (or the bundled executable), Node.js 18+ only for frontend development, Windows / macOS / Linux.
If Spark saves you a context switch, leave a star so the next person who needs it can find it.
License: MIT · Author: badhope
Metadata
Release files for spark-agent 0.15.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spark_agent-0.15.9.tar.gz | 1.7 MB | Without provenance | Details for spark_agent-0.15.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spark_agent-0.15.9-py3-none-any.whl | Python 3 | none | any | Details for spark_agent-0.15.9-py3-none-any.whl |
Total release size: 3.2 MB
Release files / spark_agent-0.15.9.tar.gz
| Download URL | spark_agent-0.15.9.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
227b562d8989caef29ec0c1bf894ae26c6fe8b9538c6a09a23489aa5bdb7ce6e
|
|
BLAKE2b-256 checksum How to use checksums |
dad8259314f78d0a77cb18e5f590751875f25e6c87f42071e68c4f0fd1d3ca5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / spark_agent-0.15.9-py3-none-any.whl
| Download URL | spark_agent-0.15.9-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d626e39e33e95f276a662d21926289282e602451089829331efe241fa11a50f7
|
|
BLAKE2b-256 checksum How to use checksums |
708eab2eab75cbe2c12492929e5e7899482b95e22112734938040221de8c8e0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for spark-agent 0.15.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.