Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Terminal-based AI coding assistant with Claude/OpenAI support, secure local tools, web search, and MCP integrations.
Jump to setup instructionsGitHub checked 815h ago - refresh overdue
Sofos Code is a terminal-based AI coding assistant for software projects. It connects Claude or OpenAI models to local tools for reading code, editing files, running approved commands, searching the web, viewing images, and using external tools through the Model Context Protocol (MCP).
Sofos is written in Rust and runs in your terminal. Its access model is explicit: project files are available by default, while external paths and higher-risk actions require approval or configuration.
Sofos runs on macOS, Linux, and Windows. On macOS and Linux, the default shell mode uses an operating-system sandbox when the required platform support is available. On Windows, command confinement is disabled in this release. The bash executor still runs commands through the sh.exe provided by Git for Windows, which Sofos can find at the standard install path even when an integrated terminal does not expose Git on PATH.

Sofos provides an AI assistant with controlled access to your project from inside the terminal. It can:
The assistant acts through visible tool calls. Dangerous commands are blocked, deletion prompts for confirmation, and access outside the workspace is controlled by separate permission scopes.
read-only, sandboxed-ask, sandboxed-retry, sandboxed-strict, and unsandboxed.Set at least one provider API key:
ANTHROPIC_API_KEY for Claude models; orOPENAI_API_KEY for OpenAI models.Optional tools and keys:
ripgrep, recommended for fast code search through search_code;MORPH_API_KEY, required for the morph_edit_file tool.On Linux, the sandboxed-* presets need Bubblewrap (bwrap) for operating-system command confinement. Without it, Sofos starts unsandboxed and the sandboxed presets are disabled. Install it with your distribution's package manager:
# Debian / Ubuntu
sudo apt update
sudo apt install bubblewrap
# Fedora / RHEL
sudo dnf install bubblewrap
# Arch
sudo pacman -S bubblewrap
Bubblewrap also relies on kernel support for user namespaces, which is enabled by default on most modern distributions.
Download the latest binary from GitHub Releases.
# macOS / Linux
tar xzf sofos-*.tar.gz
sudo mv sofos /usr/local/bin/
# Windows
# Extract the .zip archive and add the extracted folder to PATH.
On macOS, Gatekeeper may block the first run. Open System Settings → Privacy & Security, then choose Allow Anyway for the Sofos binary.
cargo install sofos
git clone https://github.com/alexylon/sofos-code.git
cd sofos-code
cargo install --path .
Keep .sofos/ out of version control. It stores sessions, local permissions, and personal settings. AGENTS.md is project-level context and is intended to be version controlled.
Set a provider key:
export ANTHROPIC_API_KEY='your-anthropic-key'
# or
export OPENAI_API_KEY='your-openai-key'
Optionally enable Morph Apply edits:
export MORPH_API_KEY='your-morph-key'
Start the interactive assistant:
sofos
Use a different model:
sofos --model gpt-sol
sofos --model claude-opus -e high
sofos --model gpt # OpenAI's default model
Run one prompt and exit:
sofos -p "Review the error handling in src/error.rs"
Start with inspection tools only:
sofos --readonly
Resume a saved session:
sofos --resume
| Command | Description |
|---|---|
/resume | Open the session picker and resume a saved conversation. |
/clear | Clear the current conversation history and start a new session id. |
/compact | Compact older context to reduce token usage. |
/effort | Open the reasoning-effort picker. The picker lists only the levels supported by the active model. Use Up / Down to select, Enter to switch, and Esc to cancel. |
/effort low|medium|high|xhigh|max | Switch directly to a reasoning level. Unsupported levels print a clear error. |
/mode | Open the reasoning-mode picker. standard and pro; pro is disabled on the Anthropic models. Use Up / Down to select, Enter to switch, and Esc to cancel. |
/mode standard|pro | Switch reasoning mode. pro is accepted only on the OpenAI models; other models print a clear error. |
/model | Open the model picker. Use Up / Down to select, Enter to switch, and Esc to cancel. Models this session cannot switch to are greyed out and skipped: the other provider's models, because the API client is fixed at startup, and any model that rejects the active reasoning effort, reasoning mode, or output-token ceiling. Type /model <name> to see the reason a particular model is unavailable. |
/model <name> | Switch directly to a model on the active provider. To switch provider, restart Sofos with --model <name>. |
/permissions | Open the permission preset picker. The presets are read-only, sandboxed-ask, sandboxed-retry, sandboxed-strict, and unsandboxed. Use Up / Down to select, Enter to switch, and Esc to cancel. Where sandboxing is unavailable, such as Windows, the sandboxed-* presets are shown but disabled. |
/permissions <preset> | Switch directly to a permission preset. |
/exit, /quit, /q, Ctrl+D | Save the session and exit with a cost summary. |
Esc or Ctrl+C while busy | Interrupt the current AI turn. |
/ at the start of the input opens command suggestions. Use Up / Down to select, Enter to run the selected command, Tab to insert it into the input, and Esc or Ctrl+C to dismiss the list.One-shot mode sends a prompt, runs the assistant turn, saves the session, prints a summary, and exits.
sofos -p "Find the likely cause of the failing tests"
sofos -p "Create a high-level summary of this crate" --readonly
Redirecting the output to a file or another program produces plain text: colour and other terminal escape sequences are written only when the output is going to a terminal.
Ask about an image by mentioning the file path or URL in your message. Sofos will call view_image to open it.
What is wrong in ./screenshots/error.png?
Describe ./docs/architecture-diagram.webp.
Review https://example.com/chart.png
What do you see in the images in ./assets/?
For a folder, Sofos lists the directory first, then opens each image one by one.
Clipboard paste:
Ctrl+V # Inserts a numbered marker such as ①.
Supported formats are JPEG, PNG, GIF, and WebP. Local images are limited to 20 MB. Images larger than 2048 pixels on the long side are scaled down proportionally before being sent to the model, so large screenshots do not inflate token usage unnecessarily. Images outside the workspace require Read permission the first time, like any other external file.
-p, --prompt <TEXT> Run one prompt and exit.
--readonly Start in read-only mode with inspection tools only.
--no-sandbox Start unsandboxed: run shell commands without operating-system confinement.
-r, --resume Resume a previous session.
--check-connection Check provider connectivity and exit.
--api-key <KEY> Anthropic API key. Overrides ANTHROPIC_API_KEY.
--openai-api-key <KEY> OpenAI API key. Overrides OPENAI_API_KEY.
--morph-api-key <KEY> Morph API key. Overrides MORPH_API_KEY.
--model <MODEL> Model to use. Default: claude-opus.
--morph-model <MODEL> Morph model to use. Default: morph-v3-fast.
--max-tokens <N> Maximum output tokens per response. Default: 64000.
-e, --reasoning-effort <LV> low, medium, high, xhigh, or max. Default: medium.
--reasoning-mode <MODE> standard or pro (OpenAI only). Default: standard.
--max-tokens must be at least 16 and must not exceed the chosen model's own output limit — 128000 tokens on every supported model. The limit is checked at startup and when switching model with /model. The hidden, deprecated --thinking-budget flag still parses for backwards compatibility, but it has no effect and is intentionally omitted from the CLI help.
Sofos supports these models, shown in /model picker order. You choose a model by its short name; Sofos sends the current version to the provider.
| Name | Current version | Provider |
|---|---|---|
claude-fable | claude-fable-5-1 | Anthropic |
claude-opus (default) | claude-opus-5-5 | Anthropic |
claude-sonnet | claude-sonnet-5-5 | Anthropic |
claude-haiku | claude-haiku-5-5 | Anthropic |
gpt-astra | gpt-6-astra | OpenAI |
gpt-sol | gpt-6.1-sol | OpenAI |
gpt-terra | gpt-5.6-terra | OpenAI |
gpt-luna | gpt-6-luna | OpenAI |
--model and /model accept only the short names above, plus claude (picks claude-opus) and gpt (picks gpt-sol). A versioned name or any other value is refused, and Sofos prints the supported list.
Sofos exposes five reasoning levels:
low, medium, high, xhigh, max
The active model determines which levels are valid. Sofos validates the level at startup and when /effort is used, so unsupported combinations fail before a provider request is sent.
Examples:
sofos -e medium # Default balance.
sofos -e high # More reasoning for hard tasks.
sofos -e max --model claude-opus # Highest Anthropic level.
sofos -e max --model gpt-sol # Highest OpenAI level.
Every supported model currently accepts all five levels.
Provider mapping:
reasoning.effort directly. On the OpenAI models, --reasoning-mode pro (or /mode pro) additionally sends reasoning.mode: "pro" — the model does extra work before answering, trading latency and tokens for quality. standard is the default and omits the field. Mode is independent of effort.Claude Fable 5.1, Claude Opus 5.5, and Claude Sonnet 5.5 run safety classifiers that can decline a request. On those models Sofos asks Anthropic to answer a declined request on a substitute model rather than returning the refusal, and prints a bright notice naming the model that answered. If the substitute declines too, the turn ends with the reason shown.
On the Anthropic models, Sofos asks for a readable summary of the model's reasoning and prints it under a dimmed Thinking: heading while the answer is being prepared. Asking for the summary does not change what a conversation costs: these models carry their reasoning between turns either way, and Anthropic bills it the same whether the summary is returned or withheld.
| Tool | Purpose |
|---|---|
list_directory | List one directory. Use glob_files for recursive discovery. |
read_file | Read a file. External paths require Read permission. |
glob_files | Find files recursively with glob patterns. Build and vendor directories are skipped by default. |
search_code | Search code with ripgrep when rg is installed. |
write_file | Create, overwrite, or append to a file. External paths require Write permission. |
edit_file | Replace exact text in an existing file. Non-global edits require one unique match. Use replace_all only for intentional global replacement. External paths require Read and Write permission. |
morph_edit_file | Apply fast Morph edits when MORPH_API_KEY is configured. External paths require Read and Write permission. |
create_directory | Create directories. External paths require Write permission. |
move_file | Move or rename files or directories. External paths require Write permission. |
copy_file | Copy files. External sources require Read permission, and external destinations require Write permission. |
delete_file | Delete a file after confirmation. External paths require Write permission. |
delete_directory | Delete a directory after confirmation. External paths require Write permission. |
execute_bash | Run approved shell commands through the bash permission system. |
update_plan | Show the current task plan with pending, in_progress, and completed statuses. |
view_image | Attach a local image file or an http(s):// URL to the conversation so the model can see it. |
web_fetch | Fetch a URL and return readable text. |
web_search | Use provider-native web search. |
Clipboard pastes are not routed through a tool. Pressing Ctrl+V in the prompt attaches the image directly to the message.
Read-only mode is enabled with --readonly or the read-only preset in /permissions. It limits the native tool set to:
list_directory;read_file;glob_files;search_code when ripgrep is installed;update_plan;view_image;web_fetch;web_search.MCP tools are filtered out in read-only mode by default. To make a server's tools available in read-only mode, add one of these values to that server entry in ~/.sofos/config.toml or .sofos/config.local.toml:
readonly = "read_only" when the server is known to expose only read operations;readonly = "allow" when you explicitly want to allow the server even if it may mutate data.When read-only mode is enabled, the startup banner lists which MCP servers were filtered out and which were opted in.
Configured MCP servers can add tools dynamically. Sofos prefixes each MCP tool with the server name and a triple underscore separator so different (server, tool) pairs cannot collide:
filesystem___read_file
github___create_issue
Server names and tool names that contain the reserved separator are rejected at startup with a warning. If two servers expose the same tool name, the second registration is skipped and the first tool keeps its identifier. Tool listings are cached at startup for the session.
Sofos is built around explicit access boundaries. The assistant can work with a project without receiving unrestricted access to the host system.
Read(path) for reading files and listing directories;Write(path) for writing, editing, creating, moving, copying, and deleting;Bash(path) for bash commands that reference external paths.edit_file and morph_edit_file, require both Read and Write grants.A fourth scope, WebFetch(domain:example.com), controls the web_fetch tool. The first time the assistant fetches a URL from a host you have not allowed, Sofos shows the host and asks whether to allow it. You can allow it for the current session or remember it for future sessions. Allowing a host also covers its subdomains, so allowing example.com also allows docs.example.com. Redirects are followed only after the same check on the destination host. In non-interactive runs, a host that is not already allowed is refused.
A fifth scope, Mcp(servername), controls tools from MCP servers. MCP servers run outside the Sofos sandbox with open network access, so the first time the assistant calls a tool from a server you have not allowed, Sofos shows the server and tool and asks whether to allow it. You can allow it for the current session or remember it as Mcp(servername), which covers every tool from that server. A matching deny rule blocks the server outright. In non-interactive runs, a server that is not already allowed is refused.
Use /permissions to choose what the assistant may do. The current preset appears in the status line, and you can switch during a session. From least to most permissive:
read-only (also --readonly) — Inspection tools only. Writes and shell commands are disabled. The prompt shows :.sandboxed-ask (default when a sandbox is available) — Reads and writes are allowed in the project, and shell commands run inside the operating-system sandbox on macOS and Linux. Writes stay inside the project and temporary directories, the network is closed, familiar commands run automatically, and unfamiliar commands run without a prompt. If a command needs network access or must write outside the project, the assistant may ask you to approve running that one command outside the sandbox. The prompt shows >.sandboxed-retry — Same confinement as sandboxed-ask, but a command may be retried once without the sandbox when the failure appears to be caused by the sandbox.sandboxed-strict — Same confinement, with no sandbox lift. A blocked command fails.unsandboxed (also --no-sandbox) — Shell commands run without operating-system confinement. Unfamiliar commands prompt for approval. The prompt shows #.Where no operating-system sandbox can run, the sandboxed-* presets are unavailable. This includes Windows and Linux hosts without Bubblewrap, user-namespace support, or the required network filter. In those cases, the default is unsandboxed, the picker greys out the sandboxed presets, and the status line reports unsandboxed.
Operating-system confinement uses the available platform mechanism:
sandbox-exec). Writes are limited to the workspace and system temporary directories, the network is closed, and files blocked by Read(...) deny rules stay unreadable even when reached indirectly.bwrap). The constraints match macOS: writes stay inside the workspace and /tmp, network access is closed, local daemon sockets such as Docker are blocked, and files blocked by Read(...) deny rules stay unreadable. The bubblewrap package and kernel support for user namespaces are required.unsandboxed, the sandboxed-* presets are disabled, familiar commands run automatically, destructive commands are always refused, and any other command prompts for approval before running. The destructive-command blocklist, Read(...) deny rules for named paths, and external-path prompts still apply.On macOS and Linux, the project .sofos, .agents, .claude, and .codex directories stay read-only inside the sandbox, even though the rest of the workspace is writable. The .git directory is also read-only for any command other than plain Git commands that need to update repository state, so branch switches and local Git configuration still work while other commands cannot write Git hooks. These directories remain readable.
Sandboxing handles writes and reads differently, and that distinction is important.
Writes are fully confined automatically. The operating system blocks all writes outside the project, regardless of how the command is written. Network access is also closed.
Reads are not confined in the same way by default. An out-of-project read is checked only when the command explicitly names the external path. In that case, you'll see an external-path prompt asking you to approve access.
However, reads that reach files indirectly are not prompted or blocked by default. For example:
Because of this, out-of-project secrets are not protected by default.
To give a path the same kernel-level, unevadable protection that writes have, add a Read(...) deny rule for that path. See Permissions. Once configured, the sandbox refuses every read of that path, including indirect reads.
Lifting the sandbox for a single command always requires your approval, and clearly destructive commands remain refused.
Bash commands pass through three checks:
unsandboxed on any platform. Under a sandboxed preset on macOS and Linux, safe commands are confined too.$'...' quoting, and dangerous Git operations are always blocked. File output redirection and here-documents are blocked for commands that run without confinement. Under a sandboxed preset on macOS and Linux, a command whose only such issue is writing to a file runs confined and is allowed. On Windows, the command is refused and the assistant should use write_file or edit_file instead.~/ paths require Bash-path permission, even when the command runs confined. Confinement limits writes, network access, and files blocked by Read(...) deny rules, but it does not otherwise close general read access. An external path that is not denied still needs a Bash-path grant.| Tier | Behaviour | Examples |
|---|---|---|
| Allowed | Runs automatically after structural checks. Confined by the operating system under a sandboxed preset on macOS and Linux. | cargo, npm, go, ls, cat, grep, rg, git status, git log, git diff |
| Forbidden | Always blocked. | rm, rmdir, chmod, chown, sudo, dd, mkfs, systemctl, kill, destructive git operations |
| Other | Sandboxed preset on macOS and Linux: runs confined to the project. Sandboxed preset on Windows, or unsandboxed anywhere: prompts. | Unfamiliar commands, cp, mv, mkdir, selected git checkout forms |
delete_file and delete_directory always show a confirmation prompt before deletion. If you cancel a deletion in a batch of tool calls, Sofos returns placeholder results for the skipped tools so the next provider request remains valid.
Sofos reads configuration from:
.sofos/config.local.toml # Workspace-specific, ignored by git.
~/.sofos/config.toml # Global, optional.
Local configuration is loaded in addition to global configuration. Keep .sofos/ out of version control.
Two instruction files are loaded at startup and appended to the system prompt:
| File | Purpose |
|---|---|
AGENTS.md | Project-level instructions. Version controlled. |
.sofos/instructions.md | Personal instructions. Ignored by git. |
Use AGENTS.md for team-wide conventions, architecture notes, and project-specific rules. Use .sofos/instructions.md for private preferences or machine-local context.
Example permission configuration:
[permissions]
# Allowed reads, writes, bash paths and commands, web hosts, and MCP servers.
allow = [
"Read(~/.zshrc)",
"Read(~/.config/**)",
"Read(/etc/hosts)",
"Write(/tmp/sofos-output/**)",
"Bash(/var/log/**)",
"Bash(custom_tool)",
"Bash(cargo:*)",
"WebFetch(domain:blog.rust-lang.org)",
"Mcp(docs)",
]
# Deny always wins over allow.
deny = [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Bash(dangerous_tool)",
"WebFetch(domain:metadata.google.internal)",
"Mcp(untrusted-server)",
]
# Ask applies only to Bash commands.
ask = [
"Bash(unknown_tool)",
]
Remembering a permission rewrites the allow, deny, and ask lists, so keep comments on their own line before a list (as above); a comment placed between entries is not preserved.
Rules:
Read, Write, and Bash path scopes are independent.* matches within one path segment.** matches recursively.Read(/path/**) also covers /path itself.Bash(/path/**) grants bash path access, not command execution by itself.Bash(command) grants one exact command.Bash(command:*) grants commands by base name."Bash" in allow allows every bash command except built-in forbidden commands. Structural checks still apply."Bash" in deny rejects every bash command.ask is valid only for Bash command rules.Mcp(servername) allows or denies every tool from one MCP server.Configure MCP servers in either local or global configuration.
Stdio server:
[mcp-servers.github]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = { "GITHUB_TOKEN" = "ghp_YOUR_TOKEN" }
HTTP server:
[mcp-servers.internal-api]
url = "https://api.example.com/mcp"
headers = { "Authorization" = "Bearer token" }
Sofos connects to configured servers at startup, lists available tools, prefixes tool names by server, and caches the tool list for the session.
The first time the assistant calls a tool from a server, Sofos asks for approval; you can allow it for the session or remember it as an Mcp(servername) rule. See Permissions.
Sessions are saved automatically under:
.sofos/sessions/
A saved session includes:
Resume from the command line:
sofos --resume
Or resume from inside Sofos:
/resume
On exit, Sofos prints token usage and an estimated cost. The summary includes cache-read information when available, and accounts for provider cache discounts and cache-write premiums.
Each response is priced as it arrives, using the rates of the model that produced it, so switching model mid-session with /model — or having a request answered on a fallback model after a refusal — is costed correctly rather than at whichever model happens to be active at the end. If a fallback lands on a model Sofos has no prices for, that response is priced at the configured model's rates and the estimate is approximate for that turn.
For the complete source structure and ownership map, see STRUCTURE.md.
High-level layout:
src/
├── api/ Provider clients, shared message types, and model metadata.
├── repl/ Turn orchestration, request building, response handling, and TUI worker.
├── tools/ Native tool execution, permissions, filesystem, bash, search, and image handling.
├── mcp/ MCP configuration, clients, manager, and transports.
├── session/ Runtime session state and on-disk session persistence.
├── ui/ Markdown, syntax highlighting, diffs, cost summaries, and display helpers.
└── commands/ Slash-command parsing and dispatch.
Useful commands:
cargo fmt --all
cargo clippy --all-targets -- -D warnings
cargo test --all
cargo build --release
Debug logging:
RUST_LOG=debug sofos
This project uses cargo-release.
# Preview a patch release.
cargo release patch
# Execute a patch release.
cargo release patch --execute
# Release a specific increment.
cargo release minor --execute
See RELEASE.md for the full process.
| Problem | What to check |
|---|---|
| API key error | Set ANTHROPIC_API_KEY or OPENAI_API_KEY, or pass --api-key or --openai-api-key. |
| Cannot connect | Run sofos --check-connection. |
| Model rejects reasoning effort | Use /effort or -e with a level supported by the selected model. |
| Path denied | Add a Read, Write, or Bash rule, or approve the interactive prompt. |
| External edit denied | edit_file and morph_edit_file need Read and Write permission for external files. |
| Code search unavailable | Install ripgrep and ensure rg is on PATH. |
| Image not opening | Mention the image by path or URL in your message. For a folder, ask Sofos to look in the folder so it can list and open each image. |
| Terminal does not insert newline with Shift+Enter | Use Alt+Enter or Ctrl+Enter. |
| Sandboxed command cannot reach the network or Docker | This is expected in a sandboxed preset on macOS and Linux. Use a workspace-local alternative, approve a one-command sandbox lift when offered, or switch to unsandboxed for a trusted operation. |
| Build problems | Run rustup update, then cargo clean and cargo build. |
Apache License 2.0. See LICENSE. Reused third-party code is listed in THIRD_PARTY_NOTICES.
Sofos is built with Rust and uses Anthropic Claude or OpenAI models. Optional fast edits are provided through Morph Apply.
Disclaimer: Sofos Code can make mistakes. Review generated code and tool actions before relying on them.
GitHub checked 183h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.