terminalAgent
CLAUDE.md121 starsChanged 11 months agoApache-2.0View on GitHub
Terminal Coding Agent (v5.0) is a CLI-based multi-agent coding assistant powered by the Claude Agent SDK. It wraps the SDK's query() function with a custom terminal UI featuring: - / command menu for invoking Skills - @ file browser for attaching files to context - Smart routing to specialized agents (Reader, Coder, Reviewer, Coordinator) - Inter-agent communication via message bus and shared context - Multiple execution modes: single, parallel, react, coordinator Important: The agent spawns Claude Code as a subprocess…
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 91
Default to Reader for understanding context first
- Very specific: line 122
All use raw process.stdin with setRawMode(true) for keyboard handling
- Very specific: line 152
Use .js extension in imports (ESM requirement)
- Very specific: line 153
Run npm run build before committing to verify types
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Terminal Coding Agent (v5.0) is a CLI-based multi-agent coding assistant powered by the Claude Agent SDK. It wraps the SDK's query() function with a custom terminal UI featuring:
/command menu for invoking Skills@file browser for attaching files to context- Smart routing to specialized agents (Reader, Coder, Reviewer, Coordinator)
- Inter-agent communication via message bus and shared context
- Multiple execution modes: single, parallel, react, coordinator
Important: The agent spawns Claude Code as a subprocess and cannot run inside Claude Code itself.
Commands
# From repo root
npm run install:all # Install all dependencies (into deepresearch/)
npm run dev # Development (tsx src/index.ts)
npm run build # TypeScript compilation
npm start # Run compiled output
# From deepresearch/ directory
npm run test:ui # Test UI components
# Global CLI (after npm link in deepresearch/)
agent # Interactive mode
agent "your question" # Single query
agent /commit # Invoke a skill directlyArchitecture
deepresearch/
├── src/
│ ├── index.ts # Main entry, input loop, runQuery/runCoordinator
│ ├── agents/ # Agent classes
│ │ ├── base.ts # BaseAgent abstract class (SDK integration)
│ │ ├── types.ts # SubagentType, AgentConfig, AgentResult
│ │ ├── coordinator.ts # Multi-agent dispatch, [DISPATCH:agent] parsing
│ │ ├── reader.ts # Code reading and analysis
│ │ ├── coder.ts # Code writing and modification
│ │ └── reviewer.ts # Code review and quality checks
│ ├── core/
│ │ ├── router.ts # Router class - keyword matching, skill→agent mapping
│ │ ├── session.ts # Session management
│ │ └── permissions.ts # Permission mode handling
│ ├── runtime/
│ │ ├── bus.ts # MessageBus - inter-agent pub/sub communication
│ │ ├── shared.ts # SharedContext - cross-agent state
│ │ ├── pool.ts # AgentPool - task queue and parallel execution
│ │ ├── orchestrator.ts # Orchestrator - execution mode coordination
│ │ └── react.ts # ReAct executor for multi-step reasoning
│ ├── config/
│ │ ├── agents.ts # AGENT_CONFIGS, AGENT_KEYWORDS, SKILL_AGENT_MAP
│ │ ├── constants.ts # VERSION, MAX_SUBAGENT_DEPTH, DEFAULT_MODEL
│ │ └── tools.ts # MCP_SERVERS configuration
│ ├── ui/
│ │ ├── smart-input.ts # SmartInput - main input with "/" and "@" triggers
│ │ ├── commands.ts # CommandPicker - arrow-key navigable "/" menu
│ │ ├── file-browser.ts # FileBrowser - "@" file selection
│ │ └── theme.ts # ANSI colors, icons, box drawing
│ ├── tools/
│ │ ├── message.ts # MessageTool - agent messaging wrapper
│ │ ├── context.ts # ContextTool - shared context wrapper
│ │ └── dispatch.ts # Dispatch utilities
│ └── utils/
│ ├── prompt-loader.ts # Loads agent prompts from .md files
│ ├── transcript.ts # Session logging (text + JSON)
│ └── message-handler.ts # SDK message processing
├── prompts/ # Agent-specific system prompts (.md)
├── .claude/skills/ # Global Skills
├── bin/agent.cjs # Global CLI entry (CommonJS wrapper)
└── dist/ # Build outputMulti-Agent System
Agent Types (defined in config/agents.ts):
- Coordinator (🎯): Task decomposition, multi-agent dispatch via
[DISPATCH:agent] - Reader (📖): Code reading, analysis, understanding
- Coder (💻): Code writing, modification, implementation
- Reviewer (🔍): Code review, quality checks, bug detection
Routing Logic (core/router.ts):
- Skill commands have highest priority (
/code-review→ Reviewer viaSKILL_AGENT_MAP) - Keyword detection with word boundaries (see
AGENT_KEYWORDSinconfig/agents.ts) - Default to Reader for understanding context first
Execution Modes (via runtime/orchestrator.ts):
single: Direct agent executionparallel: Multiple agents viaAgentPoolreact: Multi-step reasoning loopcoordinator: Reader → Coder → Reviewer pipeline
Inter-Agent Communication:
MessageBus(runtime/bus.ts): EventEmitter-based pub/subSharedContext(runtime/shared.ts): Key-value store for cross-agent state
Key Patterns
SDK Integration (agents/base.ts):
- Uses
@anthropic-ai/claude-agent-sdk'squery()function - Configures:
settingSources: ["project"],additionalDirectories,mcpServers - Uses
permissionMode: "acceptEdits" (safe) or "bypassPermissions" (unsafe) - Streams messages via async iterator, handles
system,assistant,result,tool_progress
Skills Loading (index.ts: loadSkillsFromDir):
- Global skills:
deepresearch/.claude/skills/ - Project skills:
<cwd>/.claude/skills/ - Internal skills (hidden from menu):
web-scrape,doc-generate,deep-research
Dispatch Pattern (index.ts: detectDispatch):
- Coordinator outputs
[DISPATCH:reader] task description - Main loop parses these and spawns subagents
- Results are fed back to Coordinator for synthesis
UI Components (src/ui/):
- All use raw
process.stdinwithsetRawMode(true)for keyboard handling SmartInput: Main input, detects/and@triggersCommandPicker: Arrow-key navigable popup for/commandsFileBrowser: Directory navigation + fuzzy search for@files
Skills Format
Skills follow Anthropic's official format in .claude/skills/<name>/SKILL.md:
---
name: skill-name
description: Brief description
version: 1.0.0
allowed-tools:
- Read
- Write
- Bash
---
# Skill Name
Instructions for Claude...Coding Conventions
- TypeScript ES modules for
src/, CommonJS forbin/ - 2-space indentation, semicolons required
- Kebab-case filenames
- Use
.jsextension in imports (ESM requirement) - Run
npm run buildbefore committing to verify types - Global singletons:
getRouter(),getMessageBus(),getSharedContext(),getOrchestrator()
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.

