claude_code_cli
Copilot instructions105 starsChanged 8 months agoMITView on GitHub
This is the leaked source code of Anthropic's Claude Code CLI (leaked 2026-03-31). It is a read-only reference codebase — there is no build system, no tests, and no package.json included. Treat it as a study/exploration resource. Bun strips inactive code at build time via import { feature } from 'bun:bundle'. Notable flags: PROACTIVE, KAIROS, BRIDGE_MODE, DAEMON, VOICE_MODE, AGENT_TRIGGERS, MONITOR_TOOL, COORDINATOR_MODE.
- Reads credentials
17 other projects use a version of this.
Adopted by
Most recently taken up by
- LTY711/claude-code-leakword for word, first seen Apr 7, 2026
- mowgly11/claude-codeword for word, first seen Apr 3, 2026
- el1ght/claude-codeword for word, first seen Mar 31, 2026
- 777genius/claude-code-source-code-fullword for word, first seen Mar 31, 2026
- Candicezsss/claude-codeword for word, first seen Mar 31, 2026
- CubeVato/Claude-codeword for word, first seen Mar 31, 2026
Other versions17 projects use a version of this.
Word for word · 17
- 777genius/claude-code-source-code-full★ 412100% same
- Silin144/claude-code★ 16100% same
- el1ght/claude-code★ 2100% same
- ermultimidia/freecode★ 2100% same
- Candicezsss/claude-code★ 1100% same
- DebojyotiMishra/claude-code★ 1100% same
- devonte5stars11/claude-code★ 1100% same
- fotechv/claude-code★ 1100% same
- jleechan2015/claude-code★ 1100% same
- LTY711/claude-code-leak★ 1100% same
7 more not listed
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repositoryOne other file it gives its agents.
- claude-code-skillSkill
The file
We split this copilot-instructions.md into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 59
Find a tool: Look in src/tools/<ToolName>/ — each tool is a directory with its implementation, UI, and permissions co-located
- Very specific: line 60
Find a command: Look in src/commands/<command-name>/ or src/commands/<command-name>.ts
- Very specific: line 61
Understand permissions: Start at src/hooks/toolPermission/
- Very specific: line 62
Trace an API call: Start at src/QueryEngine.ts → src/services/api/
- Distinctive: line 70
Always kill the terminal: after the command completes, whether it succeeds or fails — never leave terminals open
- Distinctive: line 71
Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- Distinctive: line 73
If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude Code CLI — Agent Instructions
What This Is
This is the leaked source code of Anthropic's Claude Code CLI (leaked 2026-03-31). It is a read-only reference codebase — there is no build system, no tests, and no package.json included. Treat it as a study/exploration resource.
- Language: TypeScript / TSX
- Runtime: Bun (not Node.js)
- Terminal UI: React + Ink (React for CLI)
- Scale: ~1,900 files, 512,000+ lines across
src/
Architecture
Core Pipeline
- Entrypoint —
src/main.tsx: Commander.js CLI parser, service initialization, lazy feature loading via Bun feature flags - Query Engine —
src/QueryEngine.ts(~46K lines): LLM API call handler — streaming, tool loops, thinking mode, retries, token counting - Tool System —
src/Tool.ts(~29K lines) +src/tools/: ~50 tools (BashTool, FileEditTool, AgentTool, etc.), each self-contained with input schema, permissions, and execution logic - Command System —
src/commands.ts(~25K lines) +src/commands/: ~50 slash commands (/commit,/review,/config, etc.) - Context —
src/context.ts: Collects OS, shell, git, and user context for prompt construction
Key Subsystems
| Directory | Purpose |
src/bridge/ | IDE integration layer (VS Code, JetBrains) — bidirectional messaging, JWT auth, session management |
src/coordinator/ | Multi-agent orchestration |
src/services/ | External integrations — Anthropic API, MCP, OAuth, LSP, analytics, plugins |
src/hooks/ | React hooks including toolPermission/ for per-tool permission checks |
src/components/ | ~140 Ink UI components |
src/plugins/ | Plugin system |
src/skills/ | Skill system |
src/tasks/ | Task management |
src/types/ | Centralized TypeScript type definitions |
src/utils/ | Shared utilities |
src/schemas/ | Zod-based config schemas |
src/memdir/ | Persistent memory directory |
src/voice/ | Voice input |
src/vim/ | Vim mode |
src/buddy/ | Companion sprite (Easter egg) |
Feature Flags (Dead Code Elimination)
Bun strips inactive code at build time via import { feature } from 'bun:bundle'. Notable flags: PROACTIVE, KAIROS, BRIDGE_MODE, DAEMON, VOICE_MODE, AGENT_TRIGGERS, MONITOR_TOOL, COORDINATOR_MODE.
Code Style & Conventions
- Imports: ESM with explicit
.jsextensions (e.g.,from './commands.js') - Files/Dirs: kebab-case (
commit-push-pr.ts,add-dir/) - Classes/Components: PascalCase (
BashTool,QueryEngine) - Functions: camelCase (
getCommands(),getAllTools()) - Constants: UPPER_SNAKE_CASE (
ALLOWED_TOOLS,FRAME_INTERVAL_MS) - Linter: Biome (not ESLint). Look for
biome-ignoredirectives - Ant-only code: Some imports/features are gated behind
process.env.USER_TYPE === 'ant'(Anthropic internal) - Index pattern: Features export via
index.tsfiles
Navigation Tips
- Find a tool: Look in
src/tools/<ToolName>/— each tool is a directory with its implementation, UI, and permissions co-located - Find a command: Look in
src/commands/<command-name>/orsrc/commands/<command-name>.ts - Understand permissions: Start at
src/hooks/toolPermission/ - Trace an API call: Start at
src/QueryEngine.ts→src/services/api/ - Understand types: Centralized in
src/types/, tool-specific types insrc/Tool.ts - Follow the bridge: IDE integration starts at
src/bridge/bridgeMain.ts - MCP integration:
src/services/mcp/
Terminal Management
- Always use background terminals (
isBackground: true) for every command so a terminal ID is returned - Always kill the terminal after the command completes, whether it succeeds or fails — never leave terminals open
- Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- In GitHub Codespaces, agent-spawned terminals may be hidden — they still work. Do not assume a terminal is broken if you cannot see it
- If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

