A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface
🚨 SECURITY WARNING: 100% UNSAFE AND AUTONOMOUS 🚨
This agent operates with ZERO RESTRICTIONS and FULL AUTONOMY:
- ❌ No Sandbox - Complete unrestricted file system access
- ❌ No Permissions System - No approval required for any actions
- ❌ No Safety Guardrails - Can execute ANY command with full privileges
⚠️ Autonomous Execution - Makes decisions and executes actions independentlyONLY use in isolated environments (VMs, Docker containers) where AI agents can have unrestricted access. NOT SAFE for personal computers, production servers, or systems with sensitive data.
This repository contains two implementations of the agent:
| Implementation | Status | Package Manager | Install Command |
|---|---|---|---|
| JavaScript/Bun | Production Ready | npm | bun install -g @link-assistant/agent |
| Rust | Work in Progress | cargo | cargo install agent (when published) |
Both implementations aim to be fully compatible with OpenCode's run --format json mode.
The primary implementation, feature-complete and production-ready. Requires Bun >= 1.0.0.
# Install
bun install -g @link-assistant/agent
# Usage
echo "hi" | agentSee js/README.md for full documentation including:
- Complete CLI options reference
- Model selection examples
- Session resume functionality
- MCP (Model Context Protocol) configuration
- JSON output standards (OpenCode and Claude formats)
The Rust implementation provides core functionality but is still under active development.
# Build from source
cd rust
cargo build --release
./target/release/agent -p "hello"See rust/README.md for full documentation.
We're creating a slimmed-down, public domain version of OpenCode CLI focused on the "agentic run mode" for use in virtual machines, Docker containers, and other environments where unrestricted AI agent access is acceptable. This is not for general desktop use - it's for isolated environments where you want maximum AI agent freedom.
OpenCode Compatibility: We maintain 100% compatibility with OpenCode's JSON event streaming format, so tools expecting opencode run --format json --model opencode/grok-code output will work with our agent-cli.
- JSON Input/Output: Accepts JSON via stdin, outputs JSON event streams (OpenCode-compatible)
- Plain Text Input: Also accepts plain text messages (auto-converted to JSON format)
- Unrestricted Access: Full file system and command execution access (no sandbox, no restrictions)
- Tool Support: 13 tools including websearch, codesearch, batch - all enabled by default
- Flexible Model Selection: Supports OpenCode Zen, Claude OAuth, Groq, and more - see MODELS.md
- Public Domain: Unlicense - use it however you want
Plain text (easiest):
echo "hi" | agentSimple JSON message:
echo '{"message":"hi"}' | agentWith custom model:
echo "hi" | agent --model opencode/grok-codeDirect prompt mode:
agent -p "What is 2+2?"See js/README.md for more usage examples including model selection, session resume, and JSON output standards.
All 13 tools are enabled by default with no configuration required. See TOOLS.md for complete documentation.
read- Read file contentswrite- Write filesedit- Edit files with string replacementlist- List directory contents
glob- File pattern matching (**/*.js)grep- Text search with regex supportwebsearch✨ - Web search via Exa API (no config needed!)codesearch✨ - Code search via Exa API (no config needed!)
bash- Execute shell commandsbatch✨ - Batch multiple tool calls (no config needed!)task- Launch subagent tasks
todo- Task trackingwebfetch- Fetch and process URLs
✨ = Always enabled (no experimental flags or environment variables needed)
This agent reproduces OpenCode's run --format json command architecture:
- Streaming JSON Events: Real-time event stream output
- Event Types:
tool_use,text,step_start,step_finish,error - Session Management: Unique session IDs for each request
- Tool Execution: Tools with unrestricted access
- Compatible Format: Events match OpenCode's JSON schema exactly
The agent supports the Model Context Protocol (MCP), allowing you to extend functionality with MCP servers such as browser automation via Playwright.
Quick setup for Playwright MCP:
agent mcp add playwright npx @playwright/mcp@latestSee js/README.md for full MCP documentation including:
- Available Playwright tools (22+ browser automation capabilities)
- MCP server configuration
- Usage examples
| Document | Description |
|---|---|
| MODELS.md | Available models, providers, and pricing |
| TOOLS.md | Complete tool documentation |
| EXAMPLES.md | Usage examples for each tool |
| TESTING.md | Testing guide |
| js/README.md | JavaScript/Bun implementation (full docs) |
| rust/README.md | Rust implementation |
js/src/index.js- Main entry point with JSON/plain text input supportjs/src/session/- Session management and agent implementationjs/src/tool/- Tool implementationsjs/tests/- Comprehensive test suitejs/package.json- npm package configuration
rust/src/main.rs- Main entry pointrust/src/cli.rs- CLI argument parsingrust/src/tool/- Tool implementationsrust/Cargo.toml- Cargo package configuration
This repository includes official reference implementations as git submodules to provide best-in-class examples:
- original-opencode - OpenCode - The original OpenCode implementation we maintain compatibility with
- reference-gemini-cookbook - Google Gemini Cookbook - Official examples and guides for using the Gemini API
- reference-gemini-cli - Google Gemini CLI - Official AI agent bringing Gemini directly to the terminal
- reference-qwen3-coder - Qwen3-Coder - Official Qwen3 code model from Alibaba Cloud
To initialize all submodules:
git submodule update --init --recursiveThese reference implementations provide valuable insights into different approaches for building AI agents and can serve as learning resources for developers working with this codebase.
Unlicense (Public Domain)