Mainspring

Source: docs/architecture.md.

Mainspring Architecture

Mainspring is a Bash orchestrator with Python helpers.

Boundaries

Engine Adapter Contract

Each engine module exposes ADAPTER.info, build_command, parse_usage, quota_snapshot, and detect_failure. Dispatch returns an argv plus a display mode. Bash owns pipes and signal handling; Python owns command construction and validation.

Failure Policy

The reviewer is the only gate. Missing dependencies, missing credentials, empty writer output, malformed LiteLLM provider responses, invalid review JSON, and unknown engine names all fail closed.

Backlog Source Contract

Backlog providers expose list_ready_tasks, get_details, mark_done, and mark_blocked. The Taskmaster adapter reads .taskmaster/tasks/tasks.json for scheduler decisions and uses the task-master CLI for status mutations. Failed mutations raise an explicit error instead of silently treating the backlog as updated.