I'm siGit, running on siGit Code & Deploy platform, browsing siGit Code coding agent repo.
development
| 1 | # sigit-agent |
| 2 | |
| 3 | siGit Code as a library, for apps that embed the agent instead of launching the |
| 4 | [`sigit`](https://crates.io/crates/sigit) binary. |
| 5 | |
| 6 | It is an [`ed-acp`](https://crates.io/crates/ed-acp) agent profile. A host serves it in |
| 7 | process over an in-memory channel and talks to it with an |
| 8 | [Agent Client Protocol](https://agentclientprotocol.com) client on the other end. That is |
| 9 | what lets a sandboxed app (a Mac App Store build, an iOS app) run the agent without spawning |
| 10 | a subprocess. |
| 11 | |
| 12 | ## What is in the crate |
| 13 | |
| 14 | - `SiGitCode`, the `ed_acp::Profile`: the system prompt, the workspace tools, the `/init` |
| 15 | command and the sign-in. `SiGitCode::new()` includes `run_command`. |
| 16 | `SiGitCode::without_shell()` is for a host that cannot start processes. It drops |
| 17 | `run_command` and tells the model so. |
| 18 | - `SiGitAuth`, the profile's `AuthProvider`. It runs the browser sign-in (a public OAuth |
| 19 | client with PKCE) and keeps the resulting session in the `credentials` module. |
| 20 | - `official_mcp_servers()`, the official siGit MCP server as a session server for the |
| 21 | signed-in user. It is empty when signed out. Pass it in `mcpServers` when you open a |
| 22 | session, so a sign-out does not leave a stale bearer behind in a shared server. |
| 23 | - `prompt`, which holds `SYSTEM_PROMPT` and `INIT_PROMPT`. The `sigit` binary uses the same |
| 24 | ones. |
| 25 | |
| 26 | Inference goes to siGit Code Cloud (`https://sigit.si/api/v1`, or `SIGIT_CLOUD_URL`) with the |
| 27 | stored session token as the bearer. |
| 28 | |
| 29 | ## Serving it |
| 30 | |
| 31 | ```rust |
| 32 | use std::sync::Arc; |
| 33 | |
| 34 | use agent_client_protocol::Channel; |
| 35 | use ed_acp::ServeOptions; |
| 36 | use sigit_agent::SiGitCode; |
| 37 | |
| 38 | let (agent_end, client_end) = Channel::duplex(); |
| 39 | let opts = ServeOptions { yolo: false, surface: "app" }; |
| 40 | |
| 41 | tokio::spawn(ed_acp::serve(Arc::new(SiGitCode::without_shell()), opts, agent_end)); |
| 42 | // Connect an ACP client to `client_end`, then initialize, authenticate and open a session. |
| 43 | ``` |
| 44 | |
| 45 | `ed_acp::serve` is a future, so this runs inside the host's own async runtime. The example |
| 46 | assumes a `tokio` runtime, so the host needs `tokio` as a dependency. |
| 47 | |
| 48 | `crates/sigit-agent/tests/embedded.rs` is a complete version of this against a mock |
| 49 | endpoint: it checks that the sign-in method is advertised, that a signed-out session is |
| 50 | refused, that a stored session reaches the endpoint as the bearer, and that signing out takes |
| 51 | it away again. |
| 52 | |
| 53 | ## Where the session lives |
| 54 | |
| 55 | Call `credentials::use_config_dir` with your app's own data directory before anything else. |
| 56 | In a sandboxed app that directory is inside the container, so the app and the `sigit` CLI |
| 57 | never share or overwrite each other's session. |
| 58 | |
| 59 | ## Environment |
| 60 | |
| 61 | | Variable | Effect | |
| 62 | | --- | --- | |
| 63 | | `SIGIT_CLOUD_URL` | Inference endpoint. Defaults to `https://sigit.si/api/v1`. | |
| 64 | | `SIGIT_CONFIG_DIR` | Where the session is stored. | |
| 65 | | `SIGIT_MCP_OFFICIAL` | `off` makes `official_mcp_servers()` return nothing. | |
| 66 | | `SIGIT_MCP_URL` | Overrides the official MCP server URL. | |
| 67 | |
| 68 | ## License |
| 69 | |
| 70 | Apache-2.0. |