InkdownInkdown
Start writing

Claude-Code

62 filesยท4 subfolders

Shared Workspace

Claude-Code
codex

0100_project_overview_tech_stack_runtime_modes_and_folder_map

Shared from "Claude-Code" on Inkdown

What This Project Is For, Tech Stack, Runtime Modes, And Folder Map

What The Project Does

This project is a TypeScript and Bun codebase for a Claude Code client runtime that can operate as:

  • An interactive terminal UI built with Ink and React.
  • A headless --print and SDK-compatible stream-json client.
  • A remote-control and CCR bridge host.
  • A remote session viewer.
  • A tool-rich agent runtime with permissions, MCP servers, plugins, skills, background tasks, worktrees, and multi-agent flows.

At a high level the system takes conversation state plus workspace context, calls an LLM, allows the model to invoke tools safely, persists session state, and exposes the experience either through a TUI or a structured stdout protocol.

Who It Is For

0000_start_here_index_and_recommended_reading_order.md
0100_project_overview_tech_stack_runtime_modes_and_folder_map.md
0200_startup_flow_entry_points_and_cold_start_sequence.md
0300_codebase_modules_layers_state_models_and_schemas.md
0400_system_architecture_and_design_rationale.md
0500_interactive_repl_request_flow_end_to_end.md
0600_headless_sdk_and_print_mode_request_flow_end_to_end.md
0700_mcp_integration_connection_and_tool_call_flow.md
0800_external_services_sdks_storage_and_local_dependencies.md
0900_environment_variables_settings_feature_flags_and_failure_modes.md
1000_non_obvious_patterns_gotchas_and_debugging_traps.md
1100_full_codebase_file_inventory_grouped_by_directory.md
kimi
00-overview.md
01-entrypoints.md
02-state-management.md
03-query-system.md
04-tools-system.md
05-tasks-system.md
06-ui-components.md
07-bridge-remote.md
08-services.md
09-skills-plugins.md
10-commands.md
11-testing-architecture.md
12-permission-system.md
13-build-system.md
14-ink-internals.md
15-git-internals.md
16-context-compaction.md
17-vim-mode.md
18-mailbox-notifications.md
19-session-persistence.md
20-hooks-system.md
21-error-recovery.md
README.md
qwen
00-overview.md
01-entry-points.md
02-query-engine.md
03-tools-and-tasks.md
04-commands-and-skills.md
05-state-management.md
06-ink-rendering.md
07-bridge-remote.md
08-mcp-services.md
09-services-overview.md
10-multi-agent.md
11-system-prompt-constants.md
12-tool-interface.md
13-memory-system.md
14-buddy-companion.md
15-keybindings.md
16-stop-hooks.md
17-vim-mode.md
18-upstreamproxy.md
19-cost-tracking-history.md
20-contexts-styles-onboarding.md
21-hooks.md
22-screens.md
tweets-explain
claude-code-memory-analysis.md
compact
memory-system
agentic-architecture
  • End users running claude interactively in a terminal.
  • SDK or host integrations that spawn the client in headless mode.
  • Remote-control infrastructure that needs CCR and session-ingress connectivity.
  • Plugin, skill, and MCP authors extending the client.
  • Enterprise environments enforcing managed settings and policy.
  • Tech Stack

    • Runtime and build shape: Bun feature gating via bun:bundle with Node-compatible APIs used throughout.
    • Language: TypeScript and TSX.
    • Interactive UI: React and Ink.
    • Validation: Zod-heavy schemas.
    • Provider support: Anthropic first-party plus Bedrock, Vertex, and Foundry paths.
    • Observability: OpenTelemetry, first-party analytics, and Datadog helpers.
    • Extensibility: commands, tools, plugins, skills, and MCP.

    Runtime Modes

    • Interactive CLI and TUI: entrypoints/cli.tsx dispatches to main.tsx, which renders screens/REPL.tsx.
    • Headless SDK and print mode: main.tsx branches into cli/print.ts.
    • Remote control and bridge host: entrypoints/cli.tsx fast-paths into bridge/bridgeMain.ts.
    • Remote session viewer: the session is backed by remote/RemoteSessionManager.ts.
    • MCP entrypoints and servers: entrypoints/mcp.ts plus services/mcp/*.

    Top-Level Folder Map

    Top-level areaFilesLinesIncoming importsWhat lives there
    (root)1811986622Root orchestration and shared abstractions: CLI startup, query engine, tool base types, setup, and top-level session wiring.
    entrypoints8405913Bootstrap entrypoints and public SDK or CLI type contracts.
    bootstrap11759260Process-global bootstrap state and counters used very early in startup and throughout the session.
    state61196134AppState shape, store utilities, and state change propagation.
    commands20726656167Slash and local command registry plus implementations for config, review, plugin, permissions, worktrees, status, and more.
    components389819351160Ink and React UI components for the REPL, dialogs, settings, message rendering, permissions, teams, tasks, and design-system primitives.
    hooks10419308258React hooks for UI and runtime behavior, notifications, IDE integration, queues, remote sessions, and plugin state.
    screens359802Top-level screens such as REPL and doctor or resume flows.
    services13053810914Business services: API clients, MCP, analytics, compacting, OAuth, policy, plugin install, tips, LSP, memory sync, and more.
    tools18451012717Model-callable tools, their prompts, UI surfaces, and shared tool helpers.
    tasks12329879Background, local, and remote task state models and task implementations.
    remote4113110Remote session viewer and manager pieces for CCR-backed sessions.
    bridge311264485Remote-control and CCR bridge transport, polling, adapters, permission callbacks, and session registration.
    plugins21845Built-in plugin definitions and bundled plugin registration.
    skills20408637Bundled skill loading and skill-directory support.
    utils5641810365646Cross-cutting infrastructure: config, settings, permissions, filesystem, git, session storage, telemetry, plugin loading, prompt processing, and platform glue.
    types11345740Shared type definitions and generated event or protobuf models.
    constants212669204Static constants, prompt fragments, beta headers, XML tags, and product metadata.
    context9101372System and user context builders plus React contexts.
    query46564Query-loop helpers, token budget logic, transitions, and dependency injection points.
    assistant1881Assistant-mode specific behavior, discovery, and session-history helpers.
    coordinator13704Coordinator-mode behavior and filters for multi-agent orchestration.
    cli191237225Headless and SDK-facing I/O surfaces, transports, structured streaming, and auth/plugin/MCP sub-handlers.
    ink9619938337Local Ink wrapper and terminal rendering primitives.
    keybindings143173166Keyboard shortcut definitions, formatting, and provider setup.
    memdir8174445Memory prompt loading and path helpers for CLAUDE.md and team memory.
    migrations1161411One-shot config and model migration helpers applied at startup.
    native-ts440855Native-accelerated TypeScript wrappers such as file indexing and terminal layout helpers.
    schemas12233Shared Zod schemas.
    server33613Direct-connect server and session bootstrapping.
    upstreamproxy27421Upstream proxy support for remote and CCR environments.
    vim515188Vim-mode support.
    voice1555Voice-mode entry logic.
    buddy6130411Buddy and companion UI and prompt assets.
    moreright1261MoreRight feature surface.
    outputStyles1991Output-style registry.

    What To Notice In The Folder Map

    • utils/ is the largest and most central layer. It is the platform layer for settings, filesystem, git, session persistence, permissions, telemetry, plugins, prompt processing, and OS glue.
    • components/ is large because the TUI is not thin. Many dialogs and stateful UI helpers live there rather than in screens.
    • commands/ and tools/ are different extension surfaces. Commands are human-entered local flows; tools are model-callable actions.
    • services/ owns subsystem-style logic: API calls, MCP, analytics, policy limits, OAuth, LSP, settings sync, remote managed settings, and other integrations.
    • The root files plus bootstrap/, state/, query/, and entrypoints/ form the main execution spine.