Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Local-first Go CLI agent for safe, bounded self-diagnosis and self-healing using a local LLM.
Jump to setup instructionsFetched from the repository for this visit.
goshi is a Go-based CLI tool and the self-hosted, self-aware successor to grok-cli.
Its primary goal is to be safe, diagnosable, auditable, and self-healing — for itself only.
This project explores a constrained, local-first model of AI-assisted tooling where no action is implicit and no mutation is silent.
Most documentation lives in the docs/ directory. README stays at the repo root so GitHub renders it on the main project page.
goshi offers two modes of interaction:
Run goshi or goshi chat to launch an interactive Text User Interface:
./goshi
Layout (v2.0):
Text User Interface

Command Line Interface running filesystem list in current folder

Features:
Keyboard Controls:
Tab / Shift+Tab — Cycle focus (output → inspect panel → input)↑/↓ or PgUp/PgDn — Scroll focused regionCtrl+S or Enter — Send messageCtrl+M — Cycle mode (Chat → Command → Diff)Ctrl+D — Toggle Dry RunCtrl+T — Toggle DeterministicCtrl+C or Esc — QuitExecution Modifiers:
Status Indicators:
● — Waiting for LLM response▊ — Streaming in progress✓ — Tool executed successfully✗ — Tool execution failed(focused) — Currently focused regionAccessibility:
For scripts, automation, or traditional stdio interactions, use the --headless flag:
./goshi chat --headless
This mode provides:
goshi explores a stricter model of AI-assisted automation where:
This is an experiment in bounded autonomy, not a general-purpose AI agent.
Declares intent and purpose.
File:
goshi.human.context.yamlDefines machine-enforced identity, scope, and safety constraints.
File:
goshi.self.model.yamlThe self model is treated as authoritative and violations are considered safety breaches.
All actions are gated by diagnostic stages, executed in order:
If any stage fails, execution halts.
goshi integrates LLMs as tool-calling assistants with strict permission boundaries and comprehensive audit trails. The integration is designed to be deterministic, inspectable, and reversible.
Structured Message Types — Type-safe message protocol between CLI and LLM:
UserMessage: User input to the chatAssistantTextMessage: LLM text responseAssistantActionMessage: LLM tool call requestToolResultMessage: Result from executing a toolSystemPrompt: System instructions for the LLMAll messages are converted to a unified JSON schema for transmission and persistence.
Tool Registry — Dynamic discovery and validation of available tools:
fs.read, fs.write, fs.list)Permission Model — Fine-grained capability-based access control:
FS_READ, FS_WRITE)Audit Trail — Complete record of all security-relevant events:
session.GetAuditLog()The chat loop implements a strict execution pipeline:
Each step is independent and can be inspected. Steps 4-6 require explicit tool routing through permission checks.
A ChatSession encapsulates one chat interaction:
Chat sessions are created with an explicit system prompt and LLM backend:
session, err := cli.NewChatSession(ctx, "You are a helpful assistant.", backend)
if err != nil {
return err
}
// Grant permission for reads
session.GrantPermission("FS_READ")
// Add user message
session.AddUserMessage("List the files in the current directory")
// Execute tool (permission checked internally)
result := session.ToolRouter.Handle(app.ToolCall{
Name: "fs.list",
Args: map[string]any{"path": "."},
})
// Result is added to message history automatically
session.AddToolResultMessage("fs.list", result)
Tools are executed through a strict validation pipeline:
The router returns typed results compatible with both legacy and structured workflows.
The LLM's response is parsed into a deterministic structure:
{
"type": "action",
"action": {
"tool": "fs.read",
"args": {"path": "file.txt"}
}
}
Or for text responses:
{
"type": "text",
"text": "Here is the information you requested..."
}
The parser is conservative and falls back to text mode if JSON parsing fails. Tool pattern detection works on common patterns but is not required.
goshi uses a two-step, proposal-based filesystem model.
Creating a write does not modify the filesystem.
echo "NEW CONTENT" | goshi fs write path/to/file.txt
Applying a proposal requires two explicit opt-ins:
goshi fs apply <proposal-id> --yes --dry-run=false
If the target file has changed since the proposal was created, apply will fail.
goshi follows a deterministic, auditable pipeline:
Each step is independent, deterministic, and inspectable.
goshi supports multiple LLM backends with a local-first philosophy.
Ollama is the default provider, running models entirely on your machine:
# Install Ollama (https://ollama.ai)
ollama pull qwen3:8b-q8_0
# Run goshi (auto-detects Ollama)
./goshi chat
Configuration (goshi.yaml):
llm:
provider: ollama # or "auto" to auto-detect
model: qwen3:8b-q8_0
temperature: 0
local:
url: http://localhost
port: 11434
For cloud-based models, goshi supports OpenAI's API:
Setup:
Get an API key from https://platform.openai.com/api-keys
Set the environment variable:
export OPENAI_API_KEY='sk-...'
Configure the provider:
llm:
provider: openai
model: gpt-4o # or gpt-4o-mini, gpt-4-turbo
temperature: 0
Run goshi:
./goshi chat
Supported Models:
gpt-4o — Latest GPT-4 Omni (recommended)gpt-4o-mini — Faster, more cost-effectivegpt-4-turbo — Previous generation GPT-4gpt-3.5-turbo — Legacy model (not recommended for tool calling)Important Notes:
Environment Variables:
# Required
export OPENAI_API_KEY='your-api-key-here'
# Optional (for organization accounts)
export OPENAI_ORG_ID='org-...'
Provider Selection:
# Explicit provider via config
vim goshi.yaml # Set provider: openai
# Or via environment variable
export GOSHI_LLM_PROVIDER=openai
./goshi chat
# Auto-detect (prefers Ollama if available)
export GOSHI_LLM_PROVIDER=auto
./goshi chat
| Feature | Ollama | OpenAI |
|---|---|---|
| Privacy | ✅ Fully local | ❌ Cloud-based |
| Cost | ✅ Free | ❌ Pay per token |
| Internet Required | ❌ No | ✅ Yes |
| Setup Complexity | Medium (install + pull models) | Low (just API key) |
| Model Selection | Any Ollama-compatible model | OpenAI models only |
| Streaming | ✅ Yes | ✅ Yes |
| Tool Calling | ✅ Yes (prompt-based) | ✅ Yes |
| Cost Monitoring | N/A | ✅ Yes |
| Circuit Breaker | ❌ No | ✅ Yes |
| Connection Pooling | ✅ Yes | ✅ Yes |
| Retry Logic | ✅ Basic | ✅ Exponential backoff |
OpenAI Optimization Features:
For full LLM integration details, see docs/LLM_INTEGRATION.md.
goshi records permission decisions and tool activity into session-scoped audit logs on your local machine. Logs are JSONL files stored under .goshi/audit/ (one file per session), designed to be human-readable and easy to export.
Quick view:
goshi audit
Filter and export:
goshi audit --since=1h --type=tool
goshi audit --format=json --limit=200
Configuration highlights:
audit.tool_arguments_style: full | long | short | summaries (default: summaries)audit.redact: redact sensitive values in logs (default: true)audit.retention_days / audit.max_sessions: retention controlsDesign notes and schema details: docs/AUDIT_LOGS_DESIGN.md
goshi maintains an offline rebuild reference bundle in .goshi/:
.goshi/goshi.manifest — SHA256 manifest of all Go sources with metadata.goshi/goshi.source.tar.gz — deterministic tarball of Go sourcesGenerate or refresh the bundle:
bash scripts/generate_goshi_manifest.sh
Verify it against your working tree:
bash scripts/verify_goshi_manifest.sh
goshi doctor uses this bundle for integrity checks, and goshi heal can restore missing or modified Go files from the tarball.
goshi exposes an internal version system for builds and diagnostics:
goshi version
Use --format=json or --format=yaml for structured output.
goshi includes comprehensive test coverage for reliability and security across the system:
Core Packages:
LLM Integration:
TUI Integration (Bubble Tea):
Total: 282 passing tests across 16+ packages.
Run all tests:
go test ./internal/...
Run tests with coverage:
go test -cover ./internal/...
Run specific test package:
go test -v ./internal/cli/...
Run specific test function:
go test -run TestIntegration_FSReadTool ./internal/cli
Choose one of the following and paste it into your terminal:
HTTPS
git clone https://github.com/cshaiku/goshi.git
cd goshi
go mod download
make build
./goshi --help
SSH
git clone git@github.com:cshaiku/goshi.git
cd goshi
go mod download
make build
./goshi --help
GitHub CLI
gh repo clone cshaiku/goshi
cd goshi
go mod download
make build
./goshi --help
Want to contribute? Fork the repo on GitHub, then replace cshaiku/goshi with your fork URL.
go build -o goshi
./goshi --help
Build with make:
make build
MIT
GitHub checked 207h 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.