Skip to content

Repository files navigation

Open C Code (OCC)

A safe, open-source coding agent — capabilities aligned with Claude Code.

npm version License: MIT Runtime: Bun Tracks: Claude Code 2.1.223

简体中文 · English


What is OCC

Open C Code (OCC) is an open-source coding agent. Its capabilities are aligned with Claude Code (currently tracking 2.1.223 — 2.1.218 fully aligned, 2.1.219 + 2.1.221 + 2.1.223 partial, 2.1.222 staged, per OCC-46 gap report). The code is fully open, auditable, backdoor-free, and your data stays under your control.

If you worry that a closed-source CLI might hide backdoors, or that your code and credentials are uploaded to unauditable services, OCC is for you: all source is open and unobfuscated, the build is reproducible from source, and API credentials are sent only to endpoints you configure.

Positioning

  • 🔓 Open & auditable — full source, no obfuscation, line-by-line reviewable.
  • 🛡️ Transparent & safe — no telemetry black boxes, no hidden reporting; behavior you can supervise.
  • 🎯 Capability-aligned — REPL, tool system, permission model, MCP, sub-agents, slash commands — on par with Claude Code.
  • 🔧 Data sovereignty — API Key / Bedrock / Vertex / Azure credentials stay on your machine; requests go only to endpoints you specify.
  • 🧩 Hackable — trim, extend, or fork subsystems; feature flags and a workspace stub layer make the boundary between live and trimmed code explicit.

Quick install

npm i -g @cnwenf/occ   # install
occ                    # launch the interactive REPL

Requires a valid Anthropic API Key (or AWS Bedrock / Google Vertex / Azure Foundry credentials).

Feature highlights

  • 🖥️ Interactive REPL — Ink terminal renderer with full UI: vim mode, themes, scroll, search highlight, virtual lists.
  • 🔧 Full tool suite — Bash, Read, Edit, Write, NotebookEdit, Grep, Glob, Agent, WebFetch, WebSearch, WebBrowser (real Chrome via CDP), Todo, Skills, and more.
  • 🤖 Sub-agents — spawn fork / async / background / remote agents; team swarms (TeamCreate/TeamDelete) and worktree isolation.
  • 🔀 Workflow engine — vm-sandboxed multi-agent workflow scripts; /workflows browse + async launch (remote: true) + progress tracking. (live via WORKFLOW_SCRIPTS)
  • 📊 Monitor tool — self-contained monitoring. (live via MONITOR_TOOL)
  • 🌐 WebBrowser — navigate, read page text, screenshot, and batch actions through a real Chrome instance (CDP).
  • 🛡️ Permission modeldefault / acceptEdits / plan / bypassPermissions modes, auto-approval, destructive-command blocking, path validation, rule matching.
  • 🪝 HooksPreToolUse, PostToolUse, PermissionDenied, Stop, and more, configurable via settings.json.
  • 🧩 MCP support — connect external tools via Model Context Protocol servers (--mcp-config, .mcp.json); list/read MCP resources.
  • 🎯 Skills system — frontmatter-driven skills, /skills discovery + cache, attribution, MCP-delivered skills. (live via EXPERIMENTAL_SKILL_SEARCH + MCP_SKILLS)
  • 📝 /goal tracking — set a session goal with a Stop hook that keeps the agent on-target.
  • /effort ultracode — max-reasoning effort level with badge + keyword trigger; also low/medium/high/max/auto.
  • 🎨 Custom themes/color and /theme for live theming and custom theme creation.
  • ⌨️ Keybindings — vim mode, Ctrl+L clear, Ctrl+J newline, scroll, configurable via /keybindings.
  • 🌍 Language setting — instruct OCC to respond in your preferred language.
  • 🔄 Session management/resume, auto-compaction, /doctor, /status, /cost.
  • 🧠 Smart classifiers — transcript + bash command classification. (live via TRANSCRIPT_CLASSIFIER + BASH_CLASSIFIER)

OCC vs Claude Code

OCC Claude Code
Source Fully open, unobfuscated Closed binary
Auditability Line-by-line reviewable No
Telemetry Minimal (analytics stubbed) Standard
Data sovereignty Credentials stay on your machine; requests only to endpoints you configure Anthropic endpoints
Capability parity Tracks CC 2.1.223 (partial) Reference implementation
Providers Anthropic Direct, Bedrock, Vertex, Azure Anthropic, Bedrock, Vertex
Cost Free & open-source (MIT) Subscription
Build Reproducible from source N/A

Quick start

# interactive REPL
occ

# pipe mode (-p) — non-interactive
echo "say hello" | occ -p

# run from source (dev)
bun run dev

Slash commands

OCC ships dozens of slash commands. Highlights:

Category Commands
Session /clear /compact /autocompact /resume /status /cost /doctor /export /context
Model & effort /model /effort /fast /usage
Configuration /config /permissions /keybindings /color /theme /memory /init /login /logout
Agents & tasks /agents /background /daemon /stop /tasks /goal /skills /hooks /plugin
MCP /mcp
Review & git /review /commit /commit-push-pr /diff /branch /pr_comments
Help /help /update /onboarding

Tools

Always available: Bash, FileRead, FileEdit, FileWrite, NotebookEdit, Grep, Glob, Agent, TaskOutput, TaskStop, WebFetch, WebSearch, WebBrowser (Navigate / GetPageText / Screenshot / Batch), TodoWrite, AskUserQuestion, Skill, EnterPlanMode, ExitPlanMode, Cron (Create / Delete / List), Brief, ListMcpResources, ReadMcpResource, ReadMcpResourceDir.

Live (feature-allowlisted): Workflow (WORKFLOW_SCRIPTS), Monitor (MONITOR_TOOL).

Conditional: TaskCreate/Get/Update/List (Todo v2), EnterWorktree/ExitWorktree (worktree mode), ToolSearch (deferred tool loading), PowerShell (Windows), LSP (ENABLE_LSP_TOOL).

Disabled / stubbed: subsystems behind non-allowlisted feature flags — Sleep, RemoteTrigger, SendUserFile, PushNotification, SubscribePR, ListPeers, Snip, coordinator/bridge/voice modes, and ANT-only stubs (Tungsten, REPL, SuggestBackgroundPR). Computer Use (@ant/*) and most *-napi packages are stubs (color-diff-napi is fully implemented). Analytics / GrowthBook / Sentry are empty implementations.

Configuration

OCC reads settings from (later files override earlier):

  • ~/.claude/settings.json — user-global
  • .claude/settings.json — project-shared (checked in)
  • .claude/settings.local.json — project-local (gitignored)

Configure permissions, hooks, model, theme, MCP servers, and keybindings there. Provider credentials live in env vars (ANTHROPIC_API_KEY, AWS_*, CLAUDE_CODE_USE_VERTEX, etc.) — never in source.

For the full settings reference, environment variables, and permission modes, see CLAUDE.md.

Architecture overview

src/entrypoints/cli.tsx   true entrypoint (runtime polyfills, macros)
src/main.tsx              Commander.js CLI definition
src/query.ts              main API query loop (streaming + tool-call loop)
src/QueryEngine.ts        conversation orchestrator (state, compaction, attribution)
src/screens/REPL.tsx      interactive REPL screen (React/Ink)
src/services/api/         API clients (Anthropic / Bedrock / Vertex / Azure)
src/tools/<Name>/         one directory per tool
src/ink/                  custom Ink framework (reconciler, hooks, virtual list)
src/commands/<Name>/      one directory per slash command
packages/                 workspace stubs (@ant/*, *-napi)

Runtime & build: Bun (not Node). ESM + TSX with react-jsx. Single-file bundle via bun build. Bun workspaces resolve internal packages/*.

Core loop: query.ts sends messages to the Claude API, handles streaming, processes tool calls, and manages the conversation turn loop. QueryEngine.ts wraps it with state, compaction, and file-history snapshots.

Feature flags: feature(name) returns true for an allowlist — WORKFLOW_SCRIPTS, MONITOR_TOOL, TRANSCRIPT_CLASSIFIER, BASH_CLASSIFIER, EXPERIMENTAL_SKILL_SEARCH, MCP_SKILLS — and false for everything else. This reactivates the workflow engine, Monitor tool, skill discovery, MCP skills, and the transcript/bash classifiers at runtime; most other internal subsystems (COORDINATOR_MODE, KAIROS, PROACTIVE, BRIDGE_MODE, VOICE_MODE, etc.) stay disabled.

Build from source

Requires Bun >= 1.3.11 (use bun upgrade — older Bun causes spurious errors).

bun install
bun run dev          # run from source; version prints 2.1.270 (dev polyfill; build overrides with pkg.version) when working
bun run build        # output: dist/cli.js (~26 MB, single-file bundle)
bun test             # test suite (Bun test runner)
bun run lint         # Biome lint (formatter disabled to avoid large diffs)
bun run check:unused # knip — detect unused exports/dependencies
bun run health       # code health check

Note on type errors: the codebase carries ~1300 non-blocking tsc type errors (loose unknown/never/{} types throughout). They do not affect Bun runtime execution. Lint (Biome) is the gate, not tsc.

For architecture, entry/bootstrap, tool system, UI layer, and module-status details, see CLAUDE.md.

Status

  • Tracks Claude Code 2.1.223 (partial) (2.1.218 fully aligned; 2.1.219 + 2.1.221 + 2.1.223 partial, 2.1.222 staged — see docs/upstream-version-gap-occ46.md).
  • Published to npm as @cnwenf/occ.
  • Many modules are intentionally stubbed or feature-flagged off — see "Disabled / stubbed" above.

Docs

Contributing

Contributions are welcome. Please:

  1. Open an issue to discuss the change first for non-trivial work.
  2. Keep code under 800 lines/file, functions under 50 lines, no deep nesting.
  3. Run bun run lint and bun test before submitting — Biome lint is the gate.
  4. Follow conventional commits (feat:, fix:, refactor:, docs:, test:, chore:).
  5. Don't try to fix all tsc type errors — they don't affect the Bun runtime and tsc is not in CI.

A pre-commit hook (.githooks/, wired via bun run prepare) runs biome lint on staged src/*.{ts,tsx,js,jsx} files. Bypass with --no-verify when lint errors are from pre-existing noise.

License

MIT License — see LICENSE.

About

A safe, open-source, auditable coding agent — capabilities aligned with Claude Code.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages