First time here? Complete the C++ Framework Setup guide first to build the
gaia_core library.Native binary.
gaia-bash is a compiled C++ binary built on the GAIA C++ framework (gaia_core). No Python runtime required for the agent itself — just Lemonade Server for LLM inference.Overview
gaia-bash is a domain-specialized coding agent for bash/shell scripting. It provides:
- Interactive TUI — fullscreen terminal interface with markdown rendering, streaming tokens, and a tool-approval modal
- Bash expertise — system prompt tuned for POSIX compliance,
shellcheckintegration, BATS test generation - 10 built-in tools — file I/O, git inspection, shell execution, and environment introspection (more planned: linting, testing, clipboard)
- REST API server — OpenAI-compatible endpoint for external tool integration
- MCP server — stdio transport for Claude Code, OpenCode, and other MCP-compatible agents
- Session persistence — save and resume conversations across runs
- 100% local — runs entirely on AMD hardware via Lemonade Server, no cloud dependency
Quick Start
1
Build the binary
2
Start Lemonade Server
--model or LEMONADE_MODEL):3
Run the agent
Modes of Operation
Interactive TUI
The default mode. Launches a fullscreen terminal UI with:- Chat history — scrollable transcript, markdown-rendered, updated as tokens stream in
- Status bar — state marker (
[ok]/[..]/[!]), model, step counter, token count - Input line — single-line input with history (up/down arrows)
- Tool approval — modal for any
CONFIRM-policy tool:yallow once,aalways allow (persisted to the allowed-tools file),norescdeny
Cancellation is observed between agent steps, so a model call already in flight
finishes before the turn stops — the status bar says
cancel requested rather than
claiming the request was aborted.
The TUI needs a terminal on both stdin and stdout. When either is redirected —
piping, CI, --print — the agent falls back to CleanConsole automatically.
Single Query
Run one query, print the result, and exit:Pipe Mode
No TUI — streams plain text to stdout. Ideal for scripting and CI:API Server
Expose the agent as an HTTP REST API:MCP Server
Run as an MCP tool server for external agents:Session Resume
Resume a previous conversation:Slash Commands
Built-in commands available in interactive mode:
Bash-specific commands:
Built-in Tools
Framework Tools (shared with all C++ agents)
Bash-Specific Tools
Guarantees the toolbelt provides
Three properties are enforced by the tools themselves, because no prompt orSKILL.md can supply them:
An edit can never be applied to a file that moved underneath it. file_read
records the SHA-256 of the file it read. If file_write or file_edit later
finds different bytes on disk — a formatter ran, a build step regenerated the
file, another agent touched it — the change is refused with both hashes and the
size delta named, and nothing is written. The recovery is always the same:
re-read the file, then reissue the change.
A non-matching old_string is an error, not a success. file_edit reports
that nothing was replaced and the file is unchanged. When the text differs only
in indentation, tabs, or line endings, the error says so, which is the mistake
worth naming out of the ones a model actually makes.
file_search respects .gitignore. Vendored dependencies and build output
never reach the model’s context. Skipped entries are counted in
ignored_skipped, so a thin result set is explained rather than mysterious.
The pattern syntax is real globbing: *, ?, [a-z], and ** for
directories. A pattern containing / matches the path relative to the search
root; otherwise it matches the file name.
bash_execute runs in a persistent shell. cd build and export CC=clang
stay in effect for later commands, and the current directory comes back as
cwd. The session applies both inside the child shell rather than by changing
the agent process, so concurrent sessions cannot corrupt each other. stdin is
/dev/null, so a command that waits for input returns instead of burning the
timeout, and on POSIX a timeout kills the whole process group rather than
orphaning the build it spawned. Its CONFIRM policy and 32 KB output cap are
unchanged.
On Windows the agent uses bash when one is present (Git Bash, MSYS, WSL). With
no POSIX shell it falls back to a
cmd.exe script — keeping cd and set
requires running in one interpreter, and cmd offers that only to a script.
%VAR% expansion is unaffected, but a for loop variable is written %%i
rather than %i there.API Server
The API server exposes the bash agent via an OpenAI-compatible HTTP REST API, enabling integration with any tool that speaks the OpenAI protocol.Start the server
Endpoints
POST /v1/chat/completions
Main endpoint — send messages, get agent responses with tool calls.
Streaming is simulated: the response is delivered as a single SSE
data: chunk followed by data: [DONE], not token-by-token. The
agent runs its full tool loop before emitting the final answer, so
real incremental token streaming isn’t available through this endpoint
yet. The SSE envelope is OpenAI-compatible, so streaming clients work
unchanged.GET /v1/tools
List all registered tools with their parameter schemas:
POST /v1/tools/{name}
Execute a specific tool directly (bypass the LLM):
GET /health
Health check:
GET /sessions, DELETE /sessions/{id}
Session management:
MCP Server
The MCP server exposes the bash agent as a tool server over the Model Context Protocol, enabling any MCP-compatible agent to use bash tools.Configure in Claude Code
Add to~/.claude/settings.json:
Configure in OpenCode
Add to OpenCode’s MCP config:MCP Capabilities
Test the MCP server
Demo Walkthrough
A quick demo showing the key features ofgaia-bash:
1. Write a Script
2. Review the Script
3. Generate Tests
4. Use via API
5. Use via MCP from Claude Code
Configuration
Environment Variables
CLI Flags
Building from Source
Prerequisites
- CMake 3.14+
- C++17 compiler (MSVC 2019+, GCC 9+, Clang 10+)
- Lemonade Server running with a coding model loaded