singhcoder/claude-code
Claude Code Snapshot for Research. All original source code is the property of Anthropic.
Python rewrite of Claude Code agent harness with archived subsystem references
Commands flow through argument parsing to query engines that route against archived reference data, producing manifest summaries and parity audits.
Under the hood, the system uses 4 data pools, 3 control points to manage its runtime behavior.
Structural Verdict
A 10-component ml inference with 9 connections. 55 files analyzed. Well-connected — clear data flow between components.
How Data Flows Through the System
Commands flow through argument parsing to query engines that route against archived reference data, producing manifest summaries and parity audits.
- Parse CLI args — argparse processes subcommands and arguments from user input
- Load reference data — JSON snapshots of commands and tools are loaded with caching
- Build manifest — Scan Python workspace to create current state summary (config: src_root, total_python_files)
- Route queries — Match user prompts against archived command/tool inventories with scoring
- Generate output — Render markdown summaries, audit reports, or query results
System Behavior
How the system actually operates at runtime — where data accumulates, what loops, what waits, and what controls what.
Data Pools
LRU-cached command metadata loaded from JSON snapshots
LRU-cached tool metadata loaded from JSON snapshots
JSON files containing archived subsystem and command/tool metadata
List accumulating resource usage events during operations
Delays & Async Processing
- JSON File Loading (async-processing, ~milliseconds) — First access to command/tool data requires file system read and JSON parsing
- Filesystem Scanning (async-processing, ~seconds) — Manifest building scans entire Python workspace directory tree
Control Points
- Query Result Limit (runtime-toggle) — Controls: Number of results returned by commands and tools subcommands. Default: 20 (default), 32 (subsystems), 5 (route)
- Cache Size (threshold) — Controls: LRU cache size for snapshot loading functions. Default: maxsize=1
- Python Version Requirement (env-var) — Controls: Minimum Python version for the porting workspace. Default: 3.13+
Technology Stack
Primary runtime and development language
CLI argument parsing and subcommand routing
Type-safe data models and configuration structures
Performance optimization for JSON snapshot loading
Modern path handling and filesystem operations
Test framework for the porting workspace
Reference data storage format for archived snapshots
Key Components
- main (function) — CLI entry point that routes subcommands for summary, manifest, parity audit, and query operations
src/main.py - QueryEnginePort (class) — Core query engine that renders markdown summaries and routes prompts through the ported system
src/query_engine.py - PortRuntime (class) — Routes user prompts against mirrored command/tool inventories with scoring
src/runtime.py - build_port_manifest (function) — Scans the Python workspace and builds a manifest of all modules and their metadata
src/port_manifest.py - run_parity_audit (function) — Compares the Python workspace against the archived TypeScript source for coverage analysis
src/parity_audit.py - load_command_snapshot (function) — Loads mirrored command entries from archived JSON snapshot with LRU caching
src/commands.py - load_tool_snapshot (function) — Loads mirrored tool entries from archived JSON snapshot with LRU caching
src/tools.py - PortingModule (class) — Data model representing a module in the porting process with name, responsibility, and status
src/models.py - CostTracker (class) — Tracks resource usage units and events during porting operations
src/cost_tracker.py - build_port_context (function) — Creates a PortContext with paths to source, tests, and assets directories
src/context.py
Configuration
src/context.py (python-dataclass)
source_root(Path, unknown)tests_root(Path, unknown)assets_root(Path, unknown)
src/cost_tracker.py (python-dataclass)
total_units(int, unknown) — default: 0events(list[str], unknown) — default: field(default_factory=list)
src/dialogLaunchers.py (python-dataclass)
name(str, unknown)description(str, unknown)
src/history.py (python-dataclass)
title(str, unknown)detail(str, unknown)
Explore the interactive analysis
See the full architecture map, data flow, and code patterns visualization.
Analyze on CodeSeaRelated Ml Inference Repositories
Frequently Asked Questions
What is claude-code used for?
Python rewrite of Claude Code agent harness with archived subsystem references singhcoder/claude-code is a 10-component ml inference written in Python. Well-connected — clear data flow between components. The codebase contains 55 files.
How is claude-code architected?
claude-code is organized into 4 architecture layers: CLI Interface, Core Porting Engine, Reference Data Layer, Placeholder Packages. Well-connected — clear data flow between components. This layered structure enables tight integration between components.
How does data flow through claude-code?
Data moves through 5 stages: Parse CLI args → Load reference data → Build manifest → Route queries → Generate output. Commands flow through argument parsing to query engines that route against archived reference data, producing manifest summaries and parity audits. This pipeline design reflects a complex multi-stage processing system.
What technologies does claude-code use?
The core stack includes Python 3.13+ (Primary runtime and development language), argparse (CLI argument parsing and subcommand routing), dataclasses (Type-safe data models and configuration structures), functools.lru_cache (Performance optimization for JSON snapshot loading), pathlib (Modern path handling and filesystem operations), unittest (Test framework for the porting workspace), and 1 more. A focused set of dependencies that keeps the build manageable.
What system dynamics does claude-code have?
claude-code exhibits 4 data pools (Command Snapshot Cache, Tool Snapshot Cache), 3 control points, 2 delays. These runtime behaviors shape how the system responds to load, failures, and configuration changes.
What design patterns does claude-code use?
4 design patterns detected: Placeholder Package Pattern, Snapshot Loading Pattern, Dataclass Models, CLI Subcommand Pattern.
Analyzed on April 1, 2026 by CodeSea. Written by Karolina Sarna.