$ show TransformerOptimus/SuperCoder
SuperCoder is a local-first, open-source AI coding agent with a desktop application (Tauri + Rust + React) and a suite of backend services. The core agent (Rust crate) provides an LLM-driven loop with tool execution (file editing, bash, git, code search), subagent spawning, and an 'Auto' mode where an orchestrator LLM generates plans executed by worker agents. The desktop app offers a rich UI for agent interaction, diff review, file exploration, and permission management. A separate Go-based 'Context Engine' service indexes codebases into vector (Qdrant), graph (FalkorDB), and text stores, enabling semantic code search, dependency analysis, and automated PR review with risk scoring. The repository also includes a legacy v1 backend (Go) with workflow executors for Django/Flask/Next.js code generation and a workspace service for managing isolated development environments. While primarily an application, the context engine introduces data/research elements through its indexing pipelines, retrieval strategies, and code review analytics.
The LLM identified 7 files worth highlighting for reuse:
Defines the `Tool` trait with `name`, `description`, `parameters_schema`, and `execute` methods. All agent tools (read, write, edit, bash, git, codebase_search, etc.) implement this trait, enabling uniform registration, schema generation, and execution. The trait is isolated and could be extracted into a new project for building extensible tool-based agents.
Implements `SseLineReader` and `parse_sse_stream` for parsing Server-Sent Events from LLM providers (OpenAI, Anthropic). Handles idle timeout, buffer overflow, and cancellation. The parser is generic and reusable for any SSE-based streaming API, with provider-specific JSON parsing separated into dedicated modules.
Provides a client for the context engine's streaming sync protocol: walk+hash, diff, stream batches, sync-complete. Supports full and incremental sync with concurrency control, retry with backoff, and deterministic batch IDs. The protocol is well-documented and could be reused by other clients needing efficient codebase synchronization.
Implements token-aware chunking of code elements: groups by file, merges small elements, splits oversized ones based on token estimates. Handles edge cases like empty files and large elements. The algorithm is language-agnostic and could be extracted for any text chunking task requiring token budget management.
Implements a multi-strategy retriever that combines vector, keyword, and graph search results with deduplication and scoring. The pattern is extensible (new strategies can be added) and could be reused in any search system requiring fusion of heterogeneous retrieval methods.
Implements a hierarchical permission system for tool approval: global defaults, project overrides, and per-tool exceptions. Supports auto-approve, destructive-only, and ask-everything levels. The design is decoupled from the UI and could be extracted as a standalone permission library for any agent system.
Provides file-level checkpointing before agent edits, enabling per-turn undo via reverse application of diffs. Uses atomic writes and a manifest file for state tracking. The pattern is generic and could be reused in any system requiring safe, reversible file modifications.