Early Access

Documentation

Everything you need to know about sustn — the background conductor for AI coding agents that continuously improves your codebase.

What is sustn?

sustn is a native macOS desktop application that acts as a background conductor for AI coding agents. Instead of waiting for you to open a terminal and type a prompt, sustn continuously monitors your repositories, identifies improvements, and executes them autonomously — all using your existing Claude Code subscription.

Every change lands as a branch. Nothing touches your main branch without your explicit approval. You review the work, create a pull request with one click, and merge when you're ready.

Core Philosophy

Every AI coding tool today follows the same pattern: you prompt, it responds. This reactive model means the agent only works when you're actively driving it. When you're not prompting, your subscription tokens go unused. The backlog grows.

sustn takes a different approach. It's proactive. The agent understands your codebase. It maintains a living backlog of improvements. It picks up work when budget is available and delivers results you can approve or discard. You stay in control, but you're no longer the bottleneck.

🔍
Intelligent Scanning

Two-pass scanning identifies dead code, missing tests, security gaps, tech debt, and more.

🤖
Autonomous Execution

Plan → implement → review workflow runs automatically with retry logic and error handling.

🌿
Branch-Based Safety

Every change lands on a feature branch. Main is never touched without your approval.

💰
Budget-Aware

Monitors your Claude subscription usage and works only when tokens are available.

📋
Task Backlog

Visual task board with drag-and-drop prioritization, categories, and effort estimates.

🔔
Desktop Notifications

Native macOS notifications and sound effects keep you informed without interrupting flow.


Getting Started

Get up and running with sustn in under five minutes. This guide walks you through prerequisites, installation, and your first project setup.

Prerequisites

sustn requires the following tools installed on your machine:

Git

Version control. Required for branch management and repository operations.

git --version
Claude CLI

The Claude Code command-line tool. sustn uses this to invoke the AI agent for scanning and code generation.

claude --version
GitHub CLI

Used for authentication, creating pull requests, and interacting with GitHub repositories.

gh --version
Node.js 22+

Required for building and running the application from source.

node --version
i
Preflight checks
Don't worry about verifying each tool manually. sustn runs automatic preflight checks during onboarding and will tell you exactly what's missing.

Installation

Download the latest sustn release for macOS. The app ships as a standard .dmg installer.

Or build from source
git clone https://github.com/sustn/sustn.git
cd sustn
nvm use 22
pnpm install
pnpm tauri:dev

The application supports three build environments:

CommandEnvironmentIdentifier
pnpm tauri:prodProductionapp.sustn.desktop
pnpm tauri:devDevelopmentapp.sustn.desktop.dev
pnpm tauri:qaQA / Testingapp.sustn.desktop.qa

Onboarding

When you first launch sustn, you'll be guided through a four-step onboarding flow:

1
Welcome & Authentication

Connect your GitHub account. sustn uses GitHub OAuth to authenticate and interact with your repositories. Your credentials are stored securely in the local SQLite database.

2
Preflight Checks

sustn automatically verifies that Git, Claude CLI, and GitHub CLI are installed and properly configured. If anything is missing, you'll see clear instructions to resolve it.

3
Add Your First Project

Point sustn at a local repository or clone a remote one. You can add as many repositories as you like — each one becomes a managed project in your sidebar.

4
Ready to Go

That's it. sustn will immediately offer to run your first scan. From here, the agent takes over — finding improvements and adding them to your backlog.


Core Concepts

Understanding these foundational concepts will help you get the most out of sustn.

Projects & Repositories

A project in sustn corresponds to a Git repository on your machine. Each project has its own task backlog, scan history, and configuration. Projects appear in the sidebar and can be reordered by dragging.

When you add a project, sustn tracks:

  • The local filesystem path to the repository
  • The default branch (usually main or master)
  • The base branch for creating feature branches
  • The remote origin URL
  • When the project was last scanned and worked on
Multiple projects
sustn's prioritizer automatically decides which project to work on next based on priority settings, task urgency, and how long since each project received attention. You don't need to manually switch between projects.

Tasks & the Backlog

Tasks are the fundamental unit of work in sustn. Each task represents a specific improvement or fix that the agent has identified (or that you've manually created). Tasks have two origins:

scan

Discovered automatically by the scanner. The agent analyzed your codebase and identified this as a worthwhile improvement.

manual

Created by you. Add tasks directly when you know what needs doing but want the agent to handle the implementation.

The Agent Engine

The engine is the core runtime that coordinates all automated work. Built in Rust, it manages the lifecycle of scanning and task execution through several specialized modules:

Scanner

Analyzes your codebase to discover improvement opportunities using a two-pass system.

Prioritizer

Scores and ranks projects and tasks to determine what to work on next.

Scheduler

Controls when the agent is allowed to work based on your time and schedule preferences.

Worker

Executes tasks through the plan → implement → review workflow.

Budget

Monitors your Claude subscription usage to ensure sustn only works when tokens are available.

Git

Manages branches, commits, diffs, and pull request creation.

The engine runs as a managed state within the Tauri application, communicating with the frontend through IPC commands and event emitters.

Budget Management

sustn is designed to use your existing Claude Code subscription — specifically the tokens you're not using. It reads Claude's usage statistics and calculates how many tokens are available for background work.

Budget Calculation
Weekly token budget700,000
Max usage percent80%
Reserve percent10%

Available for sustn= budget × max% − used − reserve

The budget module reads from Claude's stats-cache.json file, which tracks daily token consumption. When tokens are exhausted, sustn gracefully pauses until more budget becomes available.

!
Budget safety
sustn will never exceed your configured budget ceiling. The reserve percentage ensures you always have tokens available for your own interactive Claude use.

Scanning & Discovery

Scanning is how sustn builds your task backlog. The scanner analyzes your entire codebase and identifies concrete improvements — from missing test coverage to security vulnerabilities.

How Scanning Works

sustn uses a sophisticated two-pass scanning system to balance speed with depth:

1
Quick Scan
  • Walks directory tree (skips node_modules, .git, etc.)
  • Pre-reads source files up to size limits
  • Invokes Claude for rapid analysis
  • Returns results immediately to UI
  • Takes seconds to minutes
2
Deep Scan
  • Runs in the background after Pass 1
  • Full Claude reasoning with tool use
  • Deeper analysis of each finding
  • Results saved directly to database
  • More thorough but budget-aware

What Gets Detected

The scanner identifies improvements across nine categories:

CategoryWeightExamples
Security5.0Input validation gaps, hardcoded secrets, dependency vulnerabilities
Tests3.0Missing unit tests, untested edge cases, low coverage areas
Tech Debt2.0Dead code, deprecated APIs, code duplication
Performance2.0N+1 queries, unnecessary re-renders, unoptimized assets
Feature1.5Missing functionality, incomplete implementations
DX1.5Poor error messages, missing type definitions, confusing APIs
General1.5Code quality, readability, best practice violations
Observability1.5Missing logging, monitoring gaps, error tracking
Docs1.0Outdated comments, missing JSDoc, stale README

Category weights are used by the prioritizer to rank tasks. Security issues are weighted 5x more heavily than documentation improvements, ensuring critical fixes surface first.

Scan Frequency

Configure how often sustn scans your repositories:

On PushScan whenever new commits are pushed to the repository.
Every 6hScan four times per day on a rolling schedule.
Every 12hScan twice per day.
DailyScan once per day, typically at the start of your work window.
ManualOnly scan when you explicitly click the scan button.

Task Management

The task system is at the heart of sustn. It's where discovered improvements are tracked, prioritized, and managed through their entire lifecycle.

Task Lifecycle

Every task moves through a defined set of states:

pendingin_progressreviewdone
faileddismissed
StateDescription
pendingWaiting in the backlog. The agent hasn't started working on this task yet.
in_progressThe agent is actively working — planning, implementing, or reviewing.
reviewWork is complete. The changes are on a branch, ready for your review.
doneYou've approved the work. The PR has been merged or the task is resolved.
failedThe agent couldn't complete the work after maximum retries.
dismissedYou've decided this task isn't worth pursuing. The branch is cleaned up.

Task Properties

Each task carries detailed metadata to help you understand and manage it:

TitleA concise description of the improvement.
DescriptionDetailed explanation of what needs to change and why.
CategoryClassification (security, tests, tech_debt, performance, etc.).
Priority1 (critical) through 5 (trivial), set by the scanner or manually.
EffortLow, medium, or high — helps plan which tasks to tackle first.
FilesList of files the agent identified as relevant to the task.
BranchThe Git branch where work will be (or has been) done.
Commit SHAThe commit hash of the completed work.
Tokens UsedHow many Claude tokens were consumed for this task.
Retry CountNumber of implementation attempts (max 2 retries).
PR URLLink to the GitHub pull request, if created.
NotesYour own notes and constraints for the agent to consider.
Task messages
Each task has a chat timeline where you can see the agent's progress, add feedback, and communicate constraints. Messages from the agent include detailed explanations of what was done and why.

Prioritization

sustn's prioritizer uses a multi-factor scoring system to decide what to work on next. Both projects and tasks are scored independently.

Project Scoring
  • User-set priority (1-5)
  • Hours since last work (staleness)
  • Number of pending tasks
  • Highest task priority in backlog
  • Tasks completed today (negative)
Task Scoring
  • Priority (1-5 from scanner)
  • Category weight (security=5x, tests=3x)
  • Days since created (age bonus)
  • Estimated effort level
  • Manual user override

You can override automatic prioritization at any time by dragging tasks to reorder them or setting manual priorities.


Automated Execution

When the scheduler and budget allow, the engine's worker module picks up tasks and executes them through a structured three-phase workflow.

Work Phases

Every task goes through three distinct phases, each with a 30-minute timeout:

1
Planning

Claude reads the task description, examines the relevant files, and develops a plan of attack. It understands the codebase context, identifies dependencies, and scopes the exact changes needed.

2
Implementation

Claude writes the code. It creates or modifies files, adds tests if appropriate, and commits the changes to the feature branch. The output includes a list of modified files, a summary of changes, and any tests added.

3
Review

Claude self-reviews the implementation. It checks for correctness, style consistency, potential issues, and whether the original task requirements were fully addressed. The review outputs a pass/fail verdict with detailed feedback.

Work output structure
// Implementation output
{
  files_modified: ["src/auth/middleware.ts", "src/auth/middleware.test.ts"],
  summary: "Added input validation to auth middleware...",
  tests_added: true
}

// Review output
{
  passed: true,
  feedback: "Implementation correctly addresses the task...",
  issues: []
}

Retry & Error Handling

If the review phase fails or an error occurs during implementation, the worker automatically retries up to 2 times. Each retry includes the error feedback from the previous attempt, giving Claude context to fix its approach.

Attempt 1 — Review passes → task moves to review
Attempt 1 fails → retry with error context
Attempt 2 fails → retry with accumulated feedback
Attempt 3 fails → task moves to failed

On failure, the branch is cleaned up and the agent returns to the original branch. The error details are stored in the task's lastError field for debugging.


Code Review & Pull Requests

Once the agent completes a task, the changes land on a feature branch. sustn provides a full code review experience right inside the app.

Diff Viewer

The built-in diff viewer shows exactly what changed, presented in a familiar side-by-side format:

  • Changed files sidebar — Browse all modified files with addition/deletion stats
  • Side-by-side diff — View old and new code next to each other with syntax highlighting
  • File content viewer — Read the full file with syntax highlighting for deeper context
  • Lines added/removed — Quick stats on the scope of changes
i
The diff viewer uses the react-diff-view library for a GitHub-quality code review experience, with unified or split-view modes.

Creating Pull Requests

When you're satisfied with the agent's work, you can create a pull request with one click. sustn uses the GitHub CLI under the hood, so the PR appears in your repository just like any other.

1
Review the diff

Examine the changes in the built-in diff viewer. Make sure everything looks correct.

2
Push the branch

Click 'Push' to push the feature branch to your remote. sustn handles the git push with upstream tracking.

3
Create the PR

Click 'Create PR' and sustn opens a pull request on GitHub with a title and description derived from the task.

Auto-create PRs
Enable the Auto-create PRs setting to have sustn automatically create pull requests when tasks are completed — no manual step required.

Configuration

sustn is highly configurable. Global settings apply to all projects by default, and individual projects can override specific settings.

General Settings

SettingDefaultDescription
NotificationsEnabledDesktop notifications for scan completions, task ready for review, errors.
Sound EffectsEnabledAudio feedback for events. Three presets: chime, ding, pop.
Auto-create PRsDisabledAutomatically open a GitHub PR when a task completes.
Delete branch on dismissEnabledClean up the feature branch when you dismiss a task.
i
Sound presets
All sound effects are synthesized in real-time using the Web Audio API — no audio files needed. Chime plays two ascending tones, Ding is a bell-like tone, and Pop is a short percussive sound.

Git & Branch Settings

SettingOptionsDescription
Branch Prefixsustn/ custom/ nonePrefix added to all feature branches created by the agent.
Branch Name Styleslug short-hash task-idHow the branch name is generated from the task title.
Default Base BranchmainThe branch from which feature branches are created.
Remote OriginoriginThe git remote used for push and PR operations.
Example branch names
# slug style (default)
sustn/add-error-handling-to-auth-middleware

# short-hash style
sustn/a3f8b2

# task-id style
sustn/task-01j8k2m4n5

Scheduling

Control exactly when the agent is allowed to work. Three scheduling modes are available:

AlwaysWork anytime

The agent can work 24/7 as long as budget is available. Best for non-critical repositories where you want maximum throughput.

ScheduledWork within time window

Set specific days and a time range. Supports overnight windows (e.g., 22:00–06:00). Ideal for working while you sleep.

Schedule: Mon-Fri, 22:00 - 06:00
Timezone: America/New_York
ManualWork on demand

The agent only works when you explicitly start a task. Full manual control over when work happens.

Budget Controls

SettingDefaultDescription
Budget Ceiling %80%Maximum percentage of your weekly Claude token budget that sustn can use.
Reserve %10%Tokens reserved for your personal interactive Claude use.
Show in SidebarYesDisplay remaining budget in the sidebar status card.

Per-Project Overrides

Any global setting can be overridden on a per-project basis. This lets you apply different strategies to different repositories:

  • Agent Preferences — Free-form text instructions that Claude considers when working on this project (e.g., "Always use TypeScript strict mode").
  • Scan Preferences — Custom instructions for how the scanner should analyze this project (e.g., "Focus on test coverage").
  • Base Branch — Override the default base branch for this project.
  • Remote Origin — Use a different git remote.
  • Budget Ceiling — Set a project-specific token limit.

Architecture

For contributors and technically curious users, here's a deep dive into how sustn is built.

Tech Stack

FRONTEND
  • React 19 + TypeScript 5
  • Vite 6 (build tool)
  • Tailwind CSS 3
  • shadcn/ui (component library)
  • TanStack Query v5 (async state)
  • Zustand v5 (client state)
  • React Router v6 (routing)
BACKEND
  • Tauri v2 (native shell)
  • Rust (backend logic)
  • SQLite (database)
  • Claude CLI (AI agent)
  • GitHub CLI (git operations)

Data Flow

Data flows through the application in a predictable pattern:

User ActionReact ComponentTanStack Query
Tauri IPCRust HandlerSQLite
↕ response
SQLiteRust ResponseQuery CacheUI Update

The Tauri IPC layer provides type-safe communication between the React frontend and Rust backend. Events flow bidirectionally — the backend emits events (like scan progress) that the frontend subscribes to through TanStack Query's event integration.

Engine Modules

The agent engine is built from six specialized Rust modules, each with a clear responsibility:

src-tauri/src/engine/
engine/
├── mod.rs          Core EngineState, Claude CLI invocation
├── scanner.rs      Two-pass codebase analysis
├── worker.rs       Task execution (plan → implement → review)
├── scheduler.rs    Time window & schedule validation
├── prioritizer.rs  Project & task scoring algorithms
├── budget.rs       Token usage tracking & budget calculations
├── git.rs          Git operations wrapper
└── db.rs           Direct database operations from Rust

The engine state is managed as a thread-safe singleton using Arc<EngineState>, shared across all Tauri command handlers. It tracks the current running status, active task, and cancellation token for the scheduler loop.

EngineState structure
pub struct EngineState {
    pub running: RwLock<bool>,
    pub current_task: Mutex<Option<CurrentTask>>,
    pub cancel_token: Mutex<Option<CancellationToken>>,
}

Claude CLI is invoked as a subprocess with the --print and --output-format json flags, enabling structured output parsing. Each invocation has a 30-minute timeout to prevent runaway processes.