| 1 | --- |
| 2 | name: sigit-code |
| 3 | description: Engineering reference for siGit Code, the public Rust CLI / ACP coding agent (getsigit/sigit), and how it connects to the smbCloud ecosystem (accounts, siGit Code Cloud). Use when working on the sigit codebase, its inference backends, account commands, or coordinating a change across sigit / sigit-si / onde-cloud. The repo is public; see AGENTS.md for what must not go in it. |
| 4 | --- |
| 5 | |
| 6 | # siGit Code |
| 7 | |
| 8 | siGit Code is the coding agent: a Rust CLI (`sigit`, repo `getsigit/sigit`) that |
| 9 | runs over ACP in editors like Zed and as an interactive terminal TUI. The repo is |
| 10 | **public**, keep secrets, provider names, and strategy out of it (see |
| 11 | `AGENTS.md`). |
| 12 | |
| 13 | It is the **engine** for the whole family: the hosted chat (**siGit Code Cloud**) |
| 14 | runs the same agent against cloud inference, and the autonomous **siGit Code Cloud |
| 15 | Agent** (planning) runs it headless in a sandbox to open pull requests. `sigit.si` |
| 16 | is Git hosting; `code.sigit.si` is the home of siGit Code. Full product map: |
| 17 | [`docs/product/product-overview.md`](../../../docs/product/product-overview.md). |
| 18 | |
| 19 | ## Codebase map (`sigit/src`) |
| 20 | |
| 21 | - `main.rs`: entry point. Routes to the account subcommands |
| 22 | (`login`/`logout`/`whoami`), the interactive TUI (when stdin is a tty), or the |
| 23 | ACP server (when stdin is piped). Holds the system prompt. |
| 24 | - `chat.rs`: the terminal TUI and the agent's tool-call loop. |
| 25 | - `backend.rs`: the `InferenceBackend` trait with two implementations: |
| 26 | `LocalBackend` (on-device via the `onde` crate's `ChatEngine`) and |
| 27 | `OpenAiBackend` (any OpenAI-compatible HTTP endpoint). Uses neutral |
| 28 | `ToolSpec` / `ToolCall` / `ToolResult` / `TurnResult` types so the loop does |
| 29 | not depend on a specific backend. |
| 30 | - `provider.rs`: backend selection and quality tiers. Precedence: an explicit |
| 31 | override (`OPENAI_BASE_URL` + `OPENAI_API_KEY`, or `~/.config/sigit/providers.toml`), |
| 32 | then siGit Code Cloud when logged in, then on-device. |
| 33 | - `account.rs`: account core against the account API, surfaced as the `/login`, |
| 34 | `/logout`, `/whoami` slash commands (both TUI and ACP). |
| 35 | - `credentials.rs`: the local session-token store. |
| 36 | - `tools.rs`: tool implementations and their JSON schemas. |
| 37 | - `models.rs`, `setup.rs`: local model picker and HuggingFace cache setup. |
| 38 | |
| 39 | ## Inference backends |
| 40 | |
| 41 | The agent loop talks to `Arc<dyn InferenceBackend>` and never to a concrete |
| 42 | engine. `LocalBackend` runs fully on-device. `OpenAiBackend` handles the cloud |
| 43 | tier and any bring-your-own endpoint. `is_remote()` lets the UI label the active |
| 44 | backend correctly. |
| 45 | |
| 46 | For the hosted product (auth, tiers, and the `onde-cloud` API), see the |
| 47 | `sigit-code-cloud` skill. For the on-device `ChatEngine` API itself, see the |
| 48 | `ai-assisted-coding` skill in the public `sigit` repo. For the protocol, see its |
| 49 | `agent-client-protocol` skill. |
| 50 | |
| 51 | ## Account and cloud integration |
| 52 | |
| 53 | siGit Code authenticates through `sigit.si` and uses the returned session token |
| 54 | for siGit Code Cloud requests. Keep the account command request/response shapes |
| 55 | in sync with the desktop client (`sigit-app`) and the `smbcloud-auth` skill; |
| 56 | those shapes are a shared contract. |
| 57 | |
| 58 | ## Building and testing |
| 59 | |
| 60 | `cargo build`, `cargo test`, `cargo clippy`. Interactive (TUI) mode is Unix-only |
| 61 | because it redirects file descriptors to keep logs out of the display. |
| 62 | |
| 63 | ## Public-repo discipline |
| 64 | |
| 65 | Anything written into `sigit` is world-readable. Keep comments technical, humanize |
| 66 | prose (no AI-writing tells), and never name an upstream provider or expose |
| 67 | secrets or strategy. The reasoning that belongs with a change usually goes in a |
| 68 | private skill here, not in a public code comment. See `AGENTS.md`. |
| 69 | |
| 70 | ## Cross-references |
| 71 | |
| 72 | - `sigit-code-cloud` (this repo): the hosted chat product (siGit Code Cloud). |
| 73 | - `sigit-code-cloud-agent` (this repo): the autonomous task -> PR product (planning). |
| 74 | - `smbcloud-auth` (this repo): the auth service. |
| 75 | - `ai-assisted-coding` (sigit repo): the `onde` `ChatEngine` API. |
| 76 | - `agent-client-protocol` (sigit repo): ACP. |
| 77 | - `branding` (sigit repo): the case-sensitive names. |