Files

1 line
9.6 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "automataia/sir-bone-rs", "files": {"README.md": {"877169e84a4d48d9982d9d3e4196c4071244d395": {"t": 1785674438.0538652, "n": 9262, "h": "72c4cd6d5f2f84e8", "c": "<h1 align=\"center\">Sir Bone — Rust</h1>\n\n<img src=\"logos/sirbone.webp\" align=\"center\" />\n\n<p align=\"center\">\n <img src=\"https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg\" alt=\"License: MIT OR Apache-2.0\">\n <img src=\"https://img.shields.io/badge/rust-1.88%2B-dea584.svg?logo=rust\" alt=\"Rust 1.88+\">\n <img src=\"https://img.shields.io/badge/Async-Tokio_1-000000.svg?logo=tokio&logoColor=white\" alt=\"Async Tokio\">\n <img src=\"https://img.shields.io/badge/TUI-ratatui_0.29-ffd33d.svg?logo=ratatui&logoColor=black\" alt=\"ratatui\">\n <img src=\"https://img.shields.io/badge/MCP-rmcp_1.7-6366f1.svg?logo=modelcontextprotocol&logoColor=white\" alt=\"MCP\">\n</p>\n\n---\n\n**Sir Bone** is a Rust coding-agent harness for developers who want the model to help, not take over:\nvisible tool calls, explicit permission gates, reversible workspace snapshots, token-aware context\nmanagement — in **one native binary**.\n\nIt started as a compact rewrite inspired by [Pi](https://github.com/earendil-works/pi), with one\nthesis: keep the developer in command while cutting runtime weight, wasted tokens, and accidental\ncomplexity.\n\n---\n\n## Why it's lighter\n\n| | TypeScript (Pi) | Rust (Sir Bone) | Saving |\n|---|---|---|---|\n| Source LOC (no tests) | ~81,222 | ~10,771 | **−87%** |\n| Equivalent scope (shared features only) | ~12,720 | ~4,090 | **−68%** |\n| Binary + runtime | ~246 MB (Node + node_modules) | 11.35 MB | **−95%** |\n\n<sub>The honest reading is **−68%** (features present in both). 224 tests (unit + integration + proptest), mutation-tested with a hard CI gate on changed lines.</sub>\n\n**Benchmark (exploratory):** end-to-end on **SWE-bench Lite** — clone → one-shot agent → `git diff` → official Docker harness — **37/50 resolved (74%)** on the first 50 instances with `glm-5.2` (z.ai). This measures *harness + that model*, single-seed (astropy + django): a smoke-level signal, not a leaderboard number.\n\n---\n\n## Install\n\n**Prebuilt binary** (no Rust toolchain) — built by [`dist`](https://opensource.axo.dev/cargo-dist/), SHA256-verified:\n\n```bash\n# Linux / macOS\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/automataIA/sir-bone-rs/releases/latest/download/sir-bone-rs-installer.sh | sh\n```\n\n```powershell\n# Windows (PowerShell)\npowershell -ExecutionPolicy Bypass -c \"irm https://github.com/automataIA/sir-bone-rs/releases/latest/download/sir-bone-rs-installer.ps1 | iex\"\n```\n\n```bash\n# From crates.io (needs a Rust toolchain)\ncargo install sir-bone-rs --locked\n\n# Or the latest from source\ncargo install --git https://github.com/automataIA/sir-bone-rs --locked\n```\n\n`cargo binstall sir-bone-rs` also works once a release is published.\n\n---\n\n## Quick start\n\n```bash\nsirbone login # create a global ~/.sirbone/.env (chmod 600), then edit it\nsirbone doctor # check local readiness — offline, no model call\nsirbone # TUI (default)\nsirbone --repl \"in playground, inspect the calculator and suggest one safe improvement\"\nsirbone \"list the files in src/\" # one-shot, non-interactive\n```\n\n`sirbone login` seeds **one global** `~/.sirbone/.env` so you configure credentials **once** and run\nfrom any directory. A per-project `.env` (or a real environment variable) still wins where present.\n`login` and `doctor` run without a key, so you never have to enter the TUI/REPL to set up.\n\n### `.env` configuration\n\nEdit `~/.sirbone/.env` (created by `sirbone login`) and pick a provider — auto-detected\n(`ANTHROPIC_AUTH_TOKEN` → Anthropic, else OpenAI-compatible):\n\n```env\n# Anthropic\nANTHROPIC_AUTH_TOKEN=sk-ant-...\nSIRBONE_MODEL=claude-opus-4-7\n```\n\n```env\n# OpenAI / compatible (Ollama, Groq, LiteLLM, …)\nOPENAI_API_KEY=sk-...\nOPENAI_BASE_URL=https://api.openai.com/v1 # omit for OpenAI default\nSIRBONE_MODEL=gpt-4o\n```\n\n### Other commands\n\n```bash\nsirbone audit # export a local session audit (no model call)\nsirbone ground PLAN.md # verify a doc's claims about the code, deterministically — gates CI\nsirbone --continue \"follow-up\" # resume the most recent session\n```\n\nTry the scripted TUI without a key in the [WebAssembly demo](docs-site/book/src/demo.md).\n\n---\n\n## Why it's different\n\nMost coding-agent products compete on autonomy. Sir Bone's bet is narrower and testable:\n\n- **Supervision first** — every shell/file/MCP action goes through a permission pipeline, with\n interactive approval for ambiguous or risky work.\n- **Token discipline** — prompt caching, real context-window tracking, compaction, working notes,\n truncation, and an optional spend cap.\n- **Mechanical reliability over clever prompting** — stale-edit guards, same-file mutation\n serialization, retry classification, secret redaction, lifecycle hooks, snapshots, rollback.\n- **Measured honestly** — experimental features (e.g. `architect`) stay opt-in/default-off when\n ablations don't show a net win.\n\n---\n\n## Features at a glance\n\n- **~15 native tools** by default — `bash` (+ background jobs), `read`/`write`/`edit`/`undo`,\n `grep`/`glob`, `web_fetch`/`web_search`, `load_skill`, `note`, `verify`, `code_map`, `historia`.\n Plus opt-in `architect` and feature-gated `doc_search` (`rag`).\n- **Permission pipeline** — `allow`/`soft_deny` globs + destructive detection + a command-injection\n guard (every chained segment must pass on its own) + an optional LLM classifier for ambiguous bash.\n- **MCP** — generic stdio client; servers declared in `~/.sirbone/mcp.json`, enabled per project;\n each remote tool registered as `mcp__<server>__<tool>`.\n- **Two providers, one trait** — Anthropic (SSE + prompt caching + extended thinking) and\n OpenAI-compatible (`async-openai`), both with classified retry/backoff and secret redaction.\n- **Real context compaction** at 87.5% — LLM summary of old turns, keeps the last 6, persisted as a\n session checkpoint so resume rebuilds the compacted transcript.\n- **Workspace snapshots + `/rollback`** — a shadow git repo commits the work-tree once per run before\n the first mutation; your project's own `.git` is never touched. Non-git dirs work too.\n- **Edit safety** — fuzzy multi-pass matching + a staleness guard that rejects edits to files changed\n since the last `read`, forcing a re-read instead of a lost-update overwrite.\n- **Background jobs** survive restarts — detached `bash`, live `⚙` gauge with ETA, `/jobs` report,\n completion bell.\n- **Lifecycle hooks** (no LLM round-trip) — `pre_tool_use` exit-code gate, `post_tool_use` lint-on-edit,\n `stop` re-loop gate.\n- **Project memory** (`HISTORIA.md`) — a per-project changelog the agent keeps and reads back across\n sessions.\n- **SSRF-guarded `web_fetch`**, **secret redaction in logs**, **token spend cap**, **tracing spans**.\n\n> Full detail per subsystem lives in the **[mdBook](docs-site/book/src/)**:\n> [tools](docs-site/book/src/tools.md) ·\n> [permissions](docs-site/book/src/permissions.md) ·\n> [MCP](docs-site/book/src/mcp.md) ·\n> [providers](docs-site/book/src/providers.md) ·\n> [sessions & snapshots](docs-site/book/src/sessions.md) ·\n> [configuration](docs-site/book/src/configuration.md)\n\n---\n\n## TUI\n\n<p align=\"center\">\n <img src=\"logos/mock-tui.webp\" alt=\"Scripted Sir Bone TUI mock demo\" width=\"960\">\n</p>\n\nSplit-screen ratatui: output panel + input. Renders markdown, diffs, tables, mermaid, code blocks;\nlive tool boxes (spinner → ✓/✗ + output preview, click to expand); y/n confirm dialogs for\ndestructive commands; background-job gauge; 6 palettes (`Alt+P`); info bar with provider, model,\ncontext %, and prompt-cache hit share (`⚡N%`).\n\n| Key | Action |\n|---|---|\n| `Enter` | Send prompt (or queue if the agent is busy) |\n| `Tab` / `Shift+Tab` | Move focus chat ↔ input |\n| `↑` `↓` | Scroll output (chat) · input history (input) |\n| `PgUp` / `PgDn` | Fast scroll |\n| `G` | Go to bottom (auto-scroll) |\n| `Alt+B` / `Alt+P` | Toggle boar panel · cycle palette |\n| `Alt+A` / `Alt+S` | About · Settings (localize, architect, thinking budget; skills / MCP pickers) |\n| `y` / `n` | Allow / deny a destructive command |\n| `Esc` | Drop queued message · cancel turn · close popup |\n| `Ctrl+C` | Cancel agent · twice within 2s to quit |\n\nMouse text selection needs a modifier (`Shift`/`Alt`/`Ctrl` depending on terminal) — details in\n[tui.md](docs-site/book/src/tui.md).\n\n---\n\n## Build from source\n\n```bash\ncargo build\ncargo clippy -- -D warnings\ncargo test\ncargo run # TUI\ncargo run --example mock_tui # TUI sandbox, no API key\n```\n\nThe [`playground/`](playground/) is a Rust project with intentional bugs and an automated task\nrunner (`bash playground/tasks.sh`) that runs the agent then verifies with `cargo test` — an\nend-to-end check of agent behavior.\n\n---\n\n## Stack\n\n`tokio` · `reqwest` + SSE (Anthropic) · `async-openai 0.40` (OpenAI) · `ratatui 0.29` +\n`ratatui-markdown` · `rmcp 1.7` (MCP) · `clap 4` · `schemars 1` · `serde` · `crossterm 0.29`.\nCrate-wide `unsafe_code = \"forbid\"`.\n\n---\n\n## License\n\nDual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option. See\n[NOTICE](NOTICE) — Sir Bone is derived in part from [Pi](https://github.com/earendil-works/pi)\nby Mario Zechner (MIT).\n\nUnless you state otherwise, any contribution you submit for inclusion shall be dual-licensed as\nabove, without additional terms.\n"}}}}