# opencode | Anomaly | Knowledge Base | Instagit

The open source coding agent.

GitHub Stars: 105k

Repository: https://github.com/anomalyco/opencode

---

## Articles

### [How OpenCode Web Search and Web Fetch Tools Handle External Requests: A Deep Dive into the Permission-First Architecture](/anomalyco/opencode/how-do-opencode-web-tools-handle-external-requests)

Discover how OpenCode's web search and fetch tools manage external requests using a permission-first architecture. Learn about user approval, safety limits, and HTTP request handling.

- Tags: deep-dive
- Published: 2026-02-19

### [How OpenCode Implements Session Sharing: Architecture and Code Deep Dive](/anomalyco/opencode/how-does-opencode-implement-session-sharing)

Discover how OpenCode implements session sharing with its ShareNext module. Learn about REST API integration, SQLite persistence, and batched sync to Enterprise Share.

- Tags: architecture
- Published: 2026-02-19

### [How OpenCode Session Revert Functionality Works to Undo Changes](/anomalyco/opencode/how-does-opencode-session-revert-work)

Discover how OpenCode's session revert functionality undoes changes with its three-step workflow: marking revert points, restoring the working tree with snapshots, and cleaning the database for a seamless experience.

- Tags: internals
- Published: 2026-02-19

### [How OpenCode Implements Terminal UI Server Routes: A Deep Dive into the TUI HTTP API](/anomalyco/opencode/how-does-opencode-implement-tui-server-routes)

Explore how OpenCode implements TUI server routes with its Hono powered HTTP API. Learn about its AsyncQueue and event-driven Bus for seamless request-response handling.

- Tags: deep-dive
- Published: 2026-02-16

### [How OpenCode Integrates with GitHub Copilot as an AI Provider](/anomalyco/opencode/how-does-opencode-integrate-with-github-copilot)

Learn how OpenCode integrates with GitHub Copilot as an AI provider. Discover seamless integration with automatic authentication and unified configuration.

- Tags: how-to-guide
- Published: 2026-02-16

### [How OpenCode Handles External Directory Access and Security Boundaries](/anomalyco/opencode/how-does-opencode-handle-external-directory-access-and-security)

Discover how OpenCode secures external directory access with its permission engine, isolating operations to project instances for enhanced security.

- Tags: security
- Published: 2026-02-16

### [How OpenCode's Session Summary Generation System Tracks Code Changes](/anomalyco/opencode/what-is-opencode-session-summary-generation-system)

Discover how OpenCode's session summary generation system tracks all code changes in real-time comparing snapshot markers to effectively monitor additions deletions and modifications.

- Tags: internals
- Published: 2026-02-16

### [How OpenCode Implements Retry Logic for Failed LLM Operations: A Deep Dive into the Dual-Layer Architecture](/anomalyco/opencode/how-does-opencode-implement-retry-logic-for-llm-operations)

Discover how OpenCode implements retry logic for failed LLM operations. Explore its dual-layer architecture featuring exponential back-off and LLM-specific session retries.

- Tags: deep-dive
- Published: 2026-02-16

### [How OpenCode Handles Concurrent File Modifications in the Multi-Edit Tool](/anomalyco/opencode/how-does-opencode-multi-edit-tool-handle-concurrent-modifications)

Learn how OpenCode's multi-edit tool manages concurrent file modifications using sequential Promise chains, read-time tracking, and staleness assertions to ensure data integrity.

- Tags: internals
- Published: 2026-02-16

### [Message Processing Pipeline in OpenCode Sessions: A Deep Dive into ACP Agent Architecture](/anomalyco/opencode/what-is-opencode-session-message-processing-pipeline)

Explore OpenCode sessions' message processing pipeline. Discover how raw LLM output becomes UI-friendly ACP updates through typed chunk parsing for tools, text, files, and reasoning.

- Tags: deep-dive
- Published: 2026-02-16

### [OpenCode Configuration Options and Precedence Order: The Complete Guide](/anomalyco/opencode/what-are-opencode-configuration-options-and-precedence)

Master OpenCode configuration options and precedence. Understand how seven sources merge, from managed directories to remote endpoints, ensuring optimal control for your projects.

- Tags: how-to-guide
- Published: 2026-02-16

### [OpenCode Server Architecture: A Deep Dive into PTY, TUI, and Session Routes](/anomalyco/opencode/what-is-opencode-server-architecture-pty-tui-session-routes)

Explore OpenCodes server architecture. Learn how Hono, Session routes, PTY routes, and TUI routes manage terminal UI and pseudo-terminal lifecycles for seamless collaboration.

- Tags: architecture
- Published: 2026-02-16

### [What Is the Agent Client Protocol (ACP) and How OpenCode Implements It](/anomalyco/opencode/what-is-agent-client-protocol-acp-and-how-does-opencode-use-it)

Learn about the Agent Client Protocol ACP and how OpenCode uses this standardized JSON-RPC protocol to connect AI language models to editors like VS Code.

- Tags: deep-dive
- Published: 2026-02-16

### [OpenCode Tool System Architecture: How grep, glob, read, write, edit, and lsp Work Together](/anomalyco/opencode/what-is-opencode-tool-system-architecture)

Explore OpenCode's tool system architecture learn how grep, glob, read, write, edit, and lsp work together securely using a modular, permission-aware design with Tool.define, ToolRegistry, and Tool.Context.

- Tags: architecture
- Published: 2026-02-16

### [How OpenCode Implements Session Compaction and Memory Optimization](/anomalyco/opencode/how-does-opencode-implement-session-compaction-and-trigger-memory-optimization)

Discover how OpenCode uses session compaction and memory optimization to manage context window overflow. Learn about its summarization LLM calls and endpoint triggers.

- Tags: internals
- Published: 2026-02-16

### [How OpenCode Manages SQLite Database Migrations with Drizzle ORM](/anomalyco/opencode/how-does-opencode-manage-sqlite-database-migrations-with-drizzle-orm)

Discover how OpenCode manages SQLite database migrations using Drizzle ORM and Drizzle Kit. Learn to define schemas in TypeScript, generate migrations, and apply them at runtime.

- Tags: how-to-guide
- Published: 2026-02-16

### [How OpenCode Handles AI Provider Fallback When One Provider Fails](/anomalyco/opencode/how-does-opencode-handle-ai-provider-fallback)

Discover how OpenCode ensures AI reliability by automatically retrying failed LLM requests with a backup provider up to three times when the primary fails.

- Tags: how-to-guide
- Published: 2026-02-16

### [OpenCode MCP Server Architecture and OAuth Flow: A Deep Dive](/anomalyco/opencode/what-is-the-architecture-of-opencode-mcp-server-and-oauth-flow)

Explore the OpenCode MCP server architecture and OAuth flow. Learn about its modular design, local callback server, CSRF validation, and persistent credential storage for secure API access.

- Tags: deep-dive
- Published: 2026-02-16

### [OpenCode Plan Agent Permissions: Default Access Control and File Edit Restrictions](/anomalyco/opencode/opencode-plan-agent-permissions)

Discover OpenCode plan agent permissions. Learn about default access control and file edit restrictions, including allowed modifications to plan files.

- Tags: permissions
- Published: 2026-02-16

### [OpenCode CLI Commands: Why They're Missing from the anomalyco/opencode Repository](/anomalyco/opencode/available-commands-opencode-cli)

Discover why OpenCode CLI commands are absent from the anomalyco/opencode repository. Learn about the current state of the CLI and its intended functionality.

- Tags: how-to-guide
- Published: 2026-02-16

### [How OpenCode Manages Session History and Compaction: A Deep Dive into the Architecture](/anomalyco/opencode/opencode-session-history-compaction)

Explore OpenCode's efficient session history management and compaction. Discover its LLM-driven approach to summarize and prune tool outputs, preserving context and avoiding token overflow.

- Tags: deep-dive
- Published: 2026-02-16

