Skip to content

nolan57/opencodeclaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9,856 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenCode

OpenCode

The open-source AI coding agent with self-evolving capabilities.

Discord npm Build


Overview

OpenCode is an AI coding agent designed to remember, learn, and improve over time. Unlike traditional AI assistants that start fresh each session, OpenCode builds persistent memory across sessions, enabling true long-term consistency and continuous self-improvement.

Key Differentiators

Feature Traditional AI Assistants OpenCode
Session Memory Lost after conversation Permanent, searchable
Pattern Learning None Auto-detects reusable patterns
Skill Development Manual setup only Auto-generates skills
Failure Learning Repeats mistakes Negative memory prevents repetition
Project Understanding Starts fresh each time Hierarchical code memory
Self-Improvement None Continuous evolution

Features

πŸ€– Self-Evolving Agent System

A three-layer evolution system that continuously improves:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Self-Evolving Agent                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Layer 1: Prompt Self-Optimization                          β”‚
β”‚  β€’ Analyzes session interactions                            β”‚
β”‚  β€’ Generates prompt improvements                            β”‚
β”‚  β€’ Stores optimized prompts for future use                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Layer 2: Skill Dynamic Generation                         β”‚
β”‚  β€’ Detects reusable task patterns                          β”‚
β”‚  β€’ Auto-generates SKILL.md files                           β”‚
β”‚  β€’ Requires approval before activation                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Layer 3: Memory Enhancement                                β”‚
β”‚  β€’ Extracts learnings from sessions                         β”‚
β”‚  β€’ Cross-session pattern recognition                       β”‚
β”‚  β€’ Relevance-based memory retrieval                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧠 Three-Layer Memory Architecture

  • Session Memory: Ephemeral context for current session
  • Evolution Memory: Long-term skills, constraints, learned patterns
  • Project Memory: Knowledge graph with code entities and relationships

⚠️ Negative Memory System

Prevents repeated failures by tracking what didn't work:

negativeMemory.recordFailure({
  failure_type: "install_failed",
  description: "npm install timeout",
  context: { url: "..." },
  severity: 3,
})

πŸ“š Learning from External Sources

  • Web search, arXiv papers, GitHub integration
  • Auto-scoring and tag extraction
  • High-value items become skills automatically

πŸ”§ Skill System

  • SKILL.md format with metadata
  • Auto-discovery across multiple directories
  • Approval workflow for new skills

πŸ’» Multi-Agent Architecture

  • build: Full-access agent for code execution
  • plan: Read-only agent for review
  • explore: Fast agent for codebase exploration
  • custom: User-defined agents with permissions

🌐 Plugin System

  • QQ Bot (Tencent messaging)
  • Slack integration
  • iMessage support (macOS)
  • Plugin SDK for custom platforms

🎨 Multiple Interfaces

  • TUI: Rich terminal interface
  • Desktop: Native app (Tauri)
  • Web: Browser-based access
  • Console: Server management

πŸ”Œ Multi-Provider Support

20+ AI providers including:

  • Anthropic (Claude)
  • OpenAI (GPT-4/4o)
  • Google (Gemini)
  • Azure OpenAI
  • Amazon Bedrock
  • And more...

Installation

# Quick install
curl -fsSL https://opencode.ai/install | bash

# Package managers
npm i -g opencode-ai@latest        # npm
bun add -g opencode-ai@latest       # bun
pnpm add -g opencode-ai@latest     # pnpm
brew install anomalyco/tap/opencode # macOS/Linux
scoop install opencode              # Windows

Quick Start

# Run with a prompt
opencode "Create a REST API for user management"

# Continue a conversation
opencode -c

# Start ACP server (Agent Client Protocol)
opencode acp

# List MCP servers
opencode mcp list

# Evolution commands
opencode evolve list              # List skills
opencode evolve status            # Show system status
opencode evolve approve <id>       # Approve skill proposal

Project Structure

packages/
β”œβ”€β”€ opencode/           # Core CLI application
β”œβ”€β”€ app/               # Main SolidJS web application
β”œβ”€β”€ desktop/           # Tauri desktop application
β”œβ”€β”€ console/          # Console web application
β”œβ”€β”€ enterprise/       # Enterprise features
β”œβ”€β”€ ui/               # Shared UI components
β”œβ”€β”€ plugin/           # Plugin SDK
β”œβ”€β”€ plugin-qqbot/     # QQ Bot plugin
β”œβ”€β”€ slack/            # Slack integration
β”œβ”€β”€ sdk/              # JavaScript/TypeScript SDK
β”œβ”€β”€ function/         # Cloud functions
β”œβ”€β”€ util/             # Utilities
β”œβ”€β”€ identity/         # Logos and assets
β”œβ”€β”€ web/              # Documentation site
└── containers/       # Docker configurations

Architecture

Data Flow

Session Complete
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Integration β”‚ ─── Extracts tool calls & success status
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Evolution Layers                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Prompt   β”‚ Analyzes β†’ Generates suggestions β†’ Saves        β”‚
β”‚ Skill    β”‚ Detects patterns β†’ Creates drafts β†’ Approves   β”‚
β”‚ Memory   β”‚ Extracts learnings β†’ Stores β†’ Retrieves         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β–Ό
Vector Store (sqlite-vec)
      β”‚
      β–Ό
Semantic Search for Future Sessions

Database Schema

  • Sessions: Messages, parts (text, tool calls, reasoning)
  • Knowledge Graph: Nodes + Edges (relationships)
  • Vector Memory: content, code, constraint, character, scene
  • Negative Memory: failure_type, severity, blocked_items
  • Evolution Store: prompts.json, skills.json, memories.json

Configuration

Create opencode.jsonc in your project:

{
  "model": "claude-sonnet-4-20250514",
  "agent": "build",
  "mcp": {
    "server-name": {
      "type": "remote",
      "url": "https://example.com/mcp"
    }
  },
  "evolution": {
    "enabled": true,
    "directions": ["code quality", "performance optimization"],
    "sources": ["web", "github"]
  }
}

Development

# Install dependencies
bun install

# Build all packages
bun turbo build

# Run tests
bun test                    # From package directory
bun test src/foo.test.ts    # Single file

# Type checking
bun typecheck               # Root or per package

# Development
bun run dev                 # CLI
bun run dev:desktop         # Desktop app
bun run dev:web             # Web app

Observability

OpenCode includes an X-Ray Mode observability system for debugging:

cd deploy/observability
docker-compose up -d

Features:

  • Distributed tracing with OpenTelemetry
  • Data lineage tracking (trace memory origins)
  • Smart span truncation (prevent bloat)
  • Background task context propagation

Documentation


FAQ

How is this different from Claude Code or Cursor?

OpenCode focuses on long-term consistency and self-improvement:

  1. Persistent Memory: Remembers context across all sessions
  2. Self-Evolution: Improves prompts, skills, and memories over time
  3. Negative Memory: Learns from failures to avoid repeated mistakes
  4. Codebase Index: Understands project structure semantically
  5. Plugin Ecosystem: Extensible to any platform

What models are supported?

20+ providers including Anthropic, OpenAI, Google, Azure, Bedrock, and more via the SDK.


License

MIT License - see LICENSE for details.


Community: Discord | X

Built with ❀️ by the OpenCode community

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages