Clio — Claude Code CLI Clone banner
icebear0828 icebear0828

Clio — Claude Code CLI Clone

Development community intermediate

Description

Agentic coding CLI that connects to Anthropic API (or compatible endpoints) to provide a terminal-based Claude Code experience. 47 source files, ~9.7k lines, single runtime dependency (`fast-glob`).

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for icebear0828/clio, shared by 2 entries in this directory. It describes the repository, not this entry specifically.

Clio — Claude Code CLI Clone

Agentic coding CLI that connects to Anthropic API (or compatible endpoints) to provide a terminal-based Claude Code experience. 47 source files, ~9.7k lines, single runtime dependency (`fast-glob`).

Quick Reference

npm run dev              # Run without build (tsx)
npm run build            # Compile TypeScript
npm run test             # Run all tests (vitest)
npm run test -- --watch  # Watch mode
npm run test -- tests/permissions.test.ts  # Single file

Architecture

src/
├── index.ts              # Entry: REPL loop, command routing, print mode (-p)
├── types.ts              # Shared types (Config, Message, ContentBlock, UsageStats)
├── core/                 # Engine (18 files)
│   ├── agent.ts          # Agent loop (25 max iterations, auto-compact at 85%)
│   ├── client.ts         # HTTP client (SSE streaming, retry 429/502/503/504)
│   ├── system-prompt.ts  # 14-section system prompt builder
│   ├── section-cache.ts  # Static sections cached per session, dynamic recomputed
│   ├── context.ts        # CLAUDE.md upward traversal + git context
│   ├── settings.ts       # 4-layer config merge (global → project × committed/local)
│   ├── permissions.ts    # 3 modes (default/auto/plan) + allow/deny rules
│   ├── llm-classifier.ts # 2-stage: pattern match → LLM fallback
│   ├── session.ts        # Session persistence (~/.clio/sessions/)
│   ├── compact.ts        # Context compaction via summarization
│   ├── normalize.ts      # Message normalization (tool pairing, thinking blocks)
│   ├── memory.ts         # Auto memory (4 types, MEMORY.md index)
│   ├── adaptive-thinking.ts # Dynamic thinking budget
│   ├── pricing.ts        # Model pricing tables
│   ├── sandbox.ts        # Path/network/env sandboxing
│   ├── billing.ts        # Billing header for CC compatibility
│   └── prompts.ts        # Prompt templates
├── tools/                # Tool system (9 files)
│   ├── index.ts          # 21 tool definitions + executeTool() dispatcher
│   ├── mcp.ts            # MCP server lifecycle (JSON-RPC 2.0, zero deps)
│   ├── lsp.ts            # LSP client (Content-Length framing, zero deps)
│   ├── subagent.ts       # Sub-agent spawning (foreground/background/worktree)
│   ├── teams.ts          # Agent team coordination + SendMessage
│   ├── hooks.ts          # Pre/post tool hooks (shell commands)
│   ├── tasks.ts          # In-memory task store
│   ├── checkpoint.ts     # File undo/rollback
│   └── worktree.ts       # Git worktree isolation
├── ui/                   # Terminal UI (8 files)
│   ├── render.ts         # ANSI colors, spinners, box drawing
│   ├── input.ts          # Raw stdin, CSI parsing, undo/redo, history
│   ├── markdown.ts       # Streaming markdown renderer
│   ├── highlight.ts      # Syntax highlighting (TS/JS/Python/Rust/Go/Bash/JSON/CSS/HTML)
│   ├── statusbar.ts      # Footer bar (model, tokens, cost)
│   ├── keybindings.ts    # Keyboard shortcuts
│   ├── image.ts          # Image de