How anthropics/claude-code works
Claude Code is an agentic coding tool used from a terminal, IDE, or GitHub mention to help with coding, explanations, routine tasks, and Git workflows (README). The supplied tree is a set of hook modules, not the CLI’s main runtime entry point, so this map focuses on evidenced product subsystems rather than inventing a top-level execution chain. It includes Git diff/pane support, agent instruction-file handling, security and privacy hooks, and telemetry-related modules. Several subsystem details are known only from paths or README claims; those are shown without speculative internal links.
Main entry points: repository-of.ts Repository probe · hooks/register.ts Security defaults · tag-pre-session.ts Pre-session tagging · hooks/register.ts Privacy hooks
Components 21
Git and diff
- Diff hooks
mods/diff/hooks/register.ts - Repository probe
mods/diff/hooks/git/probes/repository-of/repository-of.ts - Git data types
mods/diff/hooks/git/types - Absolute-path check
mods/diff/hooks/git/probes/is-absolute-path - Repository line count
mods/diff/hooks/git/probes/repository-lines - Pre-session tagging
mods/diff/hooks/git/probes/tag-pre-session.ts - File dating
mods/diff/hooks/git/probes/datings-of - Start dirty state
mods/diff/hooks/git/probes/was-dirty-at-start
Agent instructions
- Agents MD hooks
mods/agents-md/hooks/register.ts
Security and privacy
- Security defaults
mods/sec-default/hooks/register.ts - Admission checks
mods/sec-default/hooks/admission-failure - Identity refusal
mods/sec-default/hooks/identity-refusal - Managed-mod policy
mods/sec-default/hooks/managed-mods-only-refusal - Privacy hooks
mods/privacy/hooks/register.ts - Outbound inspection
mods/privacy/hooks/outbound
Telemetry and tools
- Telemetry hooks
mods/telemetry/hooks/register.ts - Event ingest address
mods/telemetry/hooks/entries/ingest-url.ts - Easel hooks
mods/easel/hooks/register.ts - Tool query extraction
mods/easel/hooks/shell/query-of/query-of.ts - JSON value lookup
mods/easel/hooks/core/json
Other components
- Developer
Connections 11
- Developer → Agents MD hooks: uses coding tool
README.md - Repository probe → Git data types: uses types
mods/diff/hooks/git/probes/repository-of/repository-of.ts - Repository probe → Absolute-path check: validates paths
mods/diff/hooks/git/probes/repository-of/repository-of.ts - Repository probe → Repository line count: checks line count
mods/diff/hooks/git/probes/repository-of/repository-of.ts - Pre-session tagging → File dating: gets dates
mods/diff/hooks/git/probes/tag-pre-session.ts - Pre-session tagging → Start dirty state: checks prior dirt
mods/diff/hooks/git/probes/tag-pre-session.ts - Security defaults → Admission checks: uses checks
mods/sec-default/hooks/register.ts - Security defaults → Identity refusal: refuses identity
mods/sec-default/hooks/register.ts - Security defaults → Managed-mod policy: enforces policy
mods/sec-default/hooks/register.ts - Privacy hooks → Outbound inspection: inspects outgoing text
mods/privacy/hooks/register.ts - Tool query extraction → JSON value lookup: reads values
mods/easel/hooks/shell/query-of/query-of.ts