Update siGit Code Cloud skill
Seto Elkahfi committed
Jun 22, 2026 at 19:44 UTC
29c1fece9d0719dd9ff3f2bc04ac0b785344efc4
3 files changed
+314
-1
.agents/AGENTS.md
+73
@@ -0,0 +1,73 @@
1
+# Agent rules for sigit-si
2
+
3
+Rules for agents working in this repo and across the siGit / smbCloud codebases.
4
+Read this before writing code or docs.
5
+
6
+## Repositories and the public boundary
7
+
8
+| Repo | Visibility | What it is |
9
+|------|------------|------------|
10
+| `sigit` (`getsigit/sigit`) | **public** | siGit Code: the Rust CLI / ACP coding agent |
11
+| `sigit-si` | private | the Rails app, account API, and these agent docs |
12
+| `sigit-app` | private | the desktop client (Tauri) |
13
+| `onde-cloud` | private | the OpenAI-compatible inference service |
14
+| `onde` | open source | the on-device inference crate |
15
+
16
+**Cardinal rule: `sigit` is public.** Everything committed there is world-readable:
17
+code, comments, doc strings, tests, commit messages. Never put any of the
18
+following in the public repo:
19
+
20
+- secrets, API keys, tokens, or credentials;
21
+- the identity of the upstream model providers behind siGit Code Cloud, or the
22
+ fact that any specific provider sits behind it;
23
+- business strategy, pricing, or positioning;
24
+- internal smbCloud auth mechanics (`app_secret`, validation flows, trust
25
+ boundaries);
26
+- customer names or internal infrastructure detail.
27
+
28
+That material belongs in `sigit-si` (server and strategy) or `sigit-app`
29
+(desktop), which are private. When in doubt, put the explanation in a private
30
+skill and keep the public comment purely about what the code does.
31
+
32
+## Writing for the public repo
33
+
34
+- Keep comments and docs technical and neutral. Say what the code does, not why
35
+ it is a good business.
36
+- Strip AI-writing tells: no em dashes, no forced groups of three, no
37
+ promotional or significance-inflating language, no "not just X but Y". Plain is
38
+ correct for reference text.
39
+- User- and client-facing error messages must not name a provider or echo
40
+ upstream error bodies. Log the detail server-side; return something neutral.
41
+
42
+## Branding
43
+
44
+Names are case-sensitive: `siGit Code` (product), `siGit Code Cloud` (hosted
45
+tier), `sigit` (CLI and crate), `smbCloud` (company), `Onde Cloud` / `Onde
46
+Inference` (infrastructure), `onde` (crate). The public `sigit` repo has a
47
+`branding` skill with the full rules.
48
+
49
+## Skills in this repo
50
+
51
+- `sigit-code`: engineering reference for siGit Code and how it connects to the
52
+ ecosystem (accounts, the cloud tier, cross-repo work).
53
+- `sigit-code-cloud`: the hosted inference product: auth, tiers, backend
54
+ selection, and the `onde-cloud` API behind it.
55
+- `smbcloud-auth`: the auth service integration.
56
+- `sigit-app`: the desktop client.
57
+- `deployment`, `design-system`, `local-environment`: as named.
58
+
59
+The public `sigit` repo carries its own skills (`ai-assisted-coding`,
60
+`agent-client-protocol`, `tool-calling`, `branding`, `sigit-code-release`). Those
61
+stay public-safe.
62
+
63
+## Validation
64
+
65
+- Rust (`sigit`, `onde-cloud`): `cargo build`, `cargo test`, `cargo clippy`.
66
+- Rails (`sigit-si`): `bundle exec rails routes`, `ruby -c` on touched files,
67
+ `rails db:migrate` when the schema changes.
68
+
69
+## Common mistakes
70
+
71
+- Putting strategy, a provider name, or a secret into the public `sigit` repo.
72
+- Leaving AI-writing tells in public prose.
73
+- Mixing the product, CLI, and company names.
.agents/skills/sigit-code-cloud/SKILL.md
new
+175
@@ -0,0 +1,175 @@
1
+---
2
+name: sigit-code-cloud
3
+description: Reference for siGit Code Cloud, the hosted inference offering for siGit Code. Use when working on the cloud product surface: the sigit login/logout/whoami account commands, the credential store, provider/backend selection (on-device vs siGit Code Cloud vs BYO endpoint), neutral quality tiers, or the onde-cloud API behind it. Covers the Copilot/Azure layering, the decoupled InferenceBackend engine, auth via sigit.si/api/v1, and what must never leak to the client.
4
+---
5
+
6
+# siGit Code Cloud
7
+
8
+**siGit Code Cloud** is the hosted inference offering for **siGit Code**. The
9
+product framing is deliberate:
10
+
11
+- **siGit Code Cloud is the product**, like GitHub Copilot. The user signs in,
12
+ picks a quality tier, and it works. They never see an API key, a base URL, or
13
+ the name of any model provider.
14
+- **Onde Cloud is the infrastructure**, like Azure. It is the OpenAI-compatible
15
+ inference service siGit Code Cloud runs on, and it is an implementation detail.
16
+- **Onde Cloud, in turn, routes to upstream providers** (today Anthropic) and
17
+ hides them too, see the onde-cloud `router`/`anthropic` modules.
18
+
19
+Keep the names straight (see the `branding` skill): the product is `siGit Code`,
20
+the hosted tier is `siGit Code Cloud`, the CLI is `sigit`, the company is
21
+`smbCloud`, the inference infrastructure is `Onde Cloud` / `Onde Inference`, and
22
+the on-device Rust crate is `onde`.
23
+
24
+## The layering (why it's built this way)
25
+
26
+The original instinct was right: abstract the infrastructure away entirely. The
27
+engine underneath is intentionally generic so that "Onde Cloud = swappable infra"
28
+is literally true, but that generality is an *internal* seam, not the product.
29
+
30
+```
31
+┌─ Product surface (Copilot) ────────────────────────────────────────┐
32
+│ sigit login → pick a tier (Fast / Balanced / Large) → just works │
33
+│ No key, no URL, no provider names. Token is the only credential. │
34
+└────────────────────────────────────────────────────────────────────┘
35
+┌─ Engine (generic, swappable) ──────────────────────────────────────┐
36
+│ InferenceBackend trait │
37
+│ ├─ LocalBackend → on-device onde::ChatEngine │
38
+│ └─ OpenAiBackend → any {base_url, api_key, model} over HTTP │
39
+└────────────────────────────────────────────────────────────────────┘
40
+┌─ Infrastructure (hidden) ──────────────────────────────────────────┐
41
+│ Onde Cloud (OpenAI-compatible) → router → Anthropic (never named) │
42
+└────────────────────────────────────────────────────────────────────┘
43
+```
44
+
45
+The generic engine is also what enables the **BYO-endpoint escape hatch**: an
46
+advanced user or enterprise can point siGit Code at their own OpenAI/Azure
47
+endpoint. That is a power-user override, **not** the front door.
48
+
49
+## Backend selection (precedence)
50
+
51
+Resolved in `sigit/src/provider.rs::active_provider()`, first match wins:
52
+
53
+1. **Override (power user / BYO):** `OPENAI_BASE_URL` + `OPENAI_API_KEY` env vars,
54
+ or the active profile in `~/.config/sigit/providers.toml`.
55
+2. **siGit Code Cloud (default product):** when logged in (`sigit login` stored a
56
+ token). Baked-in endpoint, token auth, neutral tier. The user provides nothing
57
+ but their login.
58
+3. **On-device:** not logged in, no override → runs locally via `onde::ChatEngine`.
59
+
60
+A missing piece in the override path is loud, not silent: `OPENAI_BASE_URL` set
61
+without `OPENAI_API_KEY` logs a warning and falls back to on-device, rather than
62
+silently looking like "the cloud didn't work."
63
+
64
+## Quality tiers (neutral by design)
65
+
66
+The user picks a tier, never a model id or provider. `SIGIT_TIER` selects it
67
+(default `balanced`); `provider.rs::tier_to_model` maps it:
68
+
69
+| Tier | Wire model id (Onde Cloud) |
70
+|------|----------------------------|
71
+| `fast` | `onde-fast` |
72
+| `balanced` | `onde-balanced` |
73
+| `large` | `onde-large` |
74
+
75
+The UI shows `siGit Code Cloud · Balanced`, never the model id or "Anthropic".
76
+`ProviderConfig.display_name` carries this label; the title bar uses it, and
77
+`InferenceBackend::is_remote()` ensures a persisted *local* model name can never
78
+override the cloud label.
79
+
80
+## Account / auth (via sigit.si)
81
+
82
+`sigit login | logout | whoami` are plain CLI verbs dispatched in
83
+`sigit/src/main.rs` before the TUI/ACP split, implemented in
84
+`sigit/src/account.rs`.
85
+
86
+- **Trust boundary is `sigit.si`.** It holds the confidential smbCloud
87
+ `app_secret` server-side and returns the client only a **bearer token**. The
88
+ client must never hold `app_secret` (it is a public/shipped binary, see the
89
+ `smbcloud-auth` skill's public-client rule).
90
+- **Base URL:** `$SIGIT_API_URL`, else `https://sigit.si` (dev:
91
+ `http://localhost:8088`).
92
+- **Endpoints (sigit.si `/api/v1`, token-based):** `POST /users/sign_in` →
93
+ `access_token`; `GET /me`; `DELETE /users/sign_out`. These reuse the planned
94
+ `/api/v1` JSON surface in sigit-si (see the `smbcloud-auth` skill); confirm the
95
+ exact routes/response shapes against that app and keep them in sync with the
96
+ desktop `account/command_*` set.
97
+- **Credential store:** `sigit/src/credentials.rs` writes
98
+ `~/.config/sigit/credentials.toml` (`$SIGIT_CONFIG_DIR` override), mode `0600`,
99
+ holding `access_token` (+ email for display).
100
+
101
+## Onde Cloud side (the API the cloud tier calls)
102
+
103
+Repo: `onde-cloud` (Rust/axum, OpenAI-compatible).
104
+
105
+- **Endpoints:** `POST /v1/chat/completions`, `GET /v1/models`.
106
+- **Routing:** `router.rs` resolves a request `model` to a backend. Neutral public
107
+ ids (`onde-fast/balanced/large`) map to upstream models; raw `claude-*` ids are
108
+ accepted as backward-compatible aliases but never advertised. `/v1/models`
109
+ reports `owned_by: "onde-inference"`: the upstream provider is never disclosed.
110
+- **Tool calling:** `anthropic.rs` maps OpenAI function-calling ↔ Anthropic
111
+ `tool_use`/`tool_result` (assistant `tool_calls` → `tool_use` blocks; coalesced
112
+ `tool` messages → one `tool_result` user turn; `parameters` → `input_schema`;
113
+ `stop_reason` → `finish_reason`). This is what makes the cloud tier a real
114
+ *agent* backend, not just chat.
115
+- **Error hygiene:** client-facing errors are neutral ("Onde Cloud upstream error
116
+ (NNN)"); full upstream detail is logged server-side only. Never echo provider
117
+ names or upstream error bodies to the client.
118
+- **Auth:** validates `app_id:app_secret` against smbCloud (`DEV_MODE=true`
119
+ bypasses for local dev and accepts any bearer).
120
+
121
+## Local dev / testing
122
+
123
+```bash
124
+# 1. Onde Cloud API (needs ANTHROPIC_API_KEY in onde-cloud/.env for the cloud tier)
125
+cd ~/Repositories/onde-cloud && set -a && . ./.env && set +a && ./target/debug/onde-cloud
126
+# → listens on $PORT (e.g. 8090); DEV_MODE=true accepts any bearer
127
+
128
+# 2a. Product path: point siGit Code Cloud at the local API and log in
129
+SIGIT_CLOUD_URL=http://localhost:8090/v1 SIGIT_API_URL=http://localhost:8088 \
130
+ sigit login # stores a token; then `sigit` defaults to the cloud
131
+
132
+# 2b. BYO/override path (no login needed): explicit endpoint
133
+OPENAI_BASE_URL=http://localhost:8090/v1 OPENAI_API_KEY=dev:dev SIGIT_TIER=fast sigit
134
+# (or ~/.config/sigit/providers.toml with active = "<profile>")
135
+```
136
+
137
+`SIGIT_CLOUD_URL` overrides the baked-in cloud endpoint for dev. Watch routing in
138
+the server log: `chat: routing app_id=... to Onde Cloud`. Use the `fast` tier
139
+while testing to keep upstream spend low.
140
+
141
+## Key files
142
+
143
+- `sigit/src/account.rs`: `login`/`logout`/`whoami`, sigit.si `/api/v1` client.
144
+- `sigit/src/credentials.rs`: local token store.
145
+- `sigit/src/provider.rs`: backend precedence, tiers, cloud default.
146
+- `sigit/src/backend.rs`: `InferenceBackend` trait, `LocalBackend`, `OpenAiBackend`.
147
+- `onde-cloud/src/{router,anthropic,chat,types}.rs`: the hosted API + mapping.
148
+
149
+## Open items / known gaps
150
+
151
+- **Inference token ↔ Onde Cloud auth.** Onde Cloud currently validates
152
+ `app_id:app_secret`; the product needs it to accept the sigit.si-issued user
153
+ token (sigit.si fronts/mints inference auth, mirroring the `git_token` exchange
154
+ in `sigit-app`). Until then, dev relies on `DEV_MODE`.
155
+- **`sigit.si/api/v1` routes** are assumed from the desktop contract, confirm and
156
+ keep in sync with the `smbcloud-auth` skill.
157
+- **Usage/billing:** `onde-cloud` returns zeroed `usage`; wire Anthropic's
158
+ returned token counts through for metering.
159
+- **Tool-call id fingerprint:** Onde Cloud passes Anthropic's `toolu_…` tool-call
160
+ ids straight through (OpenAI uses `call_…`). Reversibly rewrite before any
161
+ external launch so the id format doesn't reveal the backend.
162
+- **ACP path:** the Zed/ACP server in `sigit/src/main.rs` still calls `onde`
163
+ directly; route it through `InferenceBackend` too.
164
+
165
+## Common mistakes
166
+
167
+- Making BYO-endpoint (env / `providers.toml`) the default instead of the
168
+ `sigit login` product experience.
169
+- Exposing a model id, base URL, or provider name in product UI/errors.
170
+- Treating the account access token as a model API key, or shipping smbCloud
171
+ `app_secret` in the `sigit` binary (public-client violation).
172
+- Letting a persisted local model name show in the title while routing to the
173
+ cloud (guard with `InferenceBackend::is_remote()`).
174
+- Mixing the names: `siGit Code` (product), `siGit Code Cloud` (hosted tier),
175
+ `sigit` (CLI), `smbCloud` (company), `Onde Cloud` (infrastructure).
.agents/skills/sigit-code/SKILL.md
+66
-1
@@ -1,4 +1,69 @@
1
---
2
name: sigit-code
3
-description: A skill for working with 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
+## Codebase map (`sigit/src`)
14
+
15
+- `main.rs`: entry point. Routes to the account subcommands
16
+ (`login`/`logout`/`whoami`), the interactive TUI (when stdin is a tty), or the
17
+ ACP server (when stdin is piped). Holds the system prompt.
18
+- `chat.rs`: the terminal TUI and the agent's tool-call loop.
19
+- `backend.rs`: the `InferenceBackend` trait with two implementations:
20
+ `LocalBackend` (on-device via the `onde` crate's `ChatEngine`) and
21
+ `OpenAiBackend` (any OpenAI-compatible HTTP endpoint). Uses neutral
22
+ `ToolSpec` / `ToolCall` / `ToolResult` / `TurnResult` types so the loop does
23
+ not depend on a specific backend.
24
+- `provider.rs`: backend selection and quality tiers. Precedence: an explicit
25
+ override (`OPENAI_BASE_URL` + `OPENAI_API_KEY`, or `~/.config/sigit/providers.toml`),
26
+ then siGit Code Cloud when logged in, then on-device.
27
+- `account.rs`: `login` / `logout` / `whoami` against the account API.
28
+- `credentials.rs`: the local session-token store.
29
+- `tools.rs`: tool implementations and their JSON schemas.
30
+- `models.rs`, `setup.rs`: local model picker and HuggingFace cache setup.
31
+
32
+## Inference backends
33
+
34
+The agent loop talks to `Arc<dyn InferenceBackend>` and never to a concrete
35
+engine. `LocalBackend` runs fully on-device. `OpenAiBackend` handles the cloud
36
+tier and any bring-your-own endpoint. `is_remote()` lets the UI label the active
37
+backend correctly.
38
+
39
+For the hosted product (auth, tiers, and the `onde-cloud` API), see the
40
+`sigit-code-cloud` skill. For the on-device `ChatEngine` API itself, see the
41
+`ai-assisted-coding` skill in the public `sigit` repo. For the protocol, see its
42
+`agent-client-protocol` skill.
43
+
44
+## Account and cloud integration
45
+
46
+siGit Code authenticates through `sigit.si` and uses the returned session token
47
+for siGit Code Cloud requests. Keep the account command request/response shapes
48
+in sync with the desktop client (`sigit-app`) and the `smbcloud-auth` skill;
49
+those shapes are a shared contract.
50
+
51
+## Building and testing
52
+
53
+`cargo build`, `cargo test`, `cargo clippy`. Interactive (TUI) mode is Unix-only
54
+because it redirects file descriptors to keep logs out of the display.
55
+
56
+## Public-repo discipline
57
+
58
+Anything written into `sigit` is world-readable. Keep comments technical, humanize
59
+prose (no AI-writing tells), and never name an upstream provider or expose
60
+secrets or strategy. The reasoning that belongs with a change usually goes in a
61
+private skill here, not in a public code comment. See `AGENTS.md`.
62
+
63
+## Cross-references
64
+
65
+- `sigit-code-cloud` (this repo): the hosted inference product.
66
+- `smbcloud-auth` (this repo): the auth service.
67
+- `ai-assisted-coding` (sigit repo): the `onde` `ChatEngine` API.
68
+- `agent-client-protocol` (sigit repo): ACP.
69
+- `branding` (sigit repo): the case-sensitive names.