Skip to content

Instantly share code, notes, and snippets.

@brandon-fryslie
Last active August 25, 2025 01:23
Show Gist options
  • Save brandon-fryslie/523796d01a5a924aaf030fb123c3debe to your computer and use it in GitHub Desktop.
Save brandon-fryslie/523796d01a5a924aaf030fb123c3debe to your computer and use it in GitHub Desktop.
What does Claude code do besides edit code?

Understood. Here’s what the Claude Code CLI / local agent is responsible for—only the client-side mechanics, not what the LLM reasons about.


Repository Modeling (local-only)

  • Workspace discovery → Detect monorepos/modules, language/toolchain boundaries.
    Input: root dir • Output: workspace graph (projects, package roots, build files).

  • Language/toolchain fingerprinting → Infer runtimes and build tools (e.g., Node/PNPM, Python/Poetry, Java/Maven/Gradle, Go, Rust/Cargo).
    Output: toolchain spec used to run builds/tests and parse metadata.

  • Dependency graphing → Parse manifests/lockfiles to build internal/external dep DAG with versions/scopes.
    Output: dep graph for impact, upgrade feasibility, and sandboxing.

  • Symbol/xref indexing (ctags/LSP/AST-assisted) → Cross-reference of definitions/usages across files.
    Output: queryable index: symbol → {defs, refs, file, line}.

  • Call/dataflow summaries (lightweight static analysis) → Function-level call graph; import graph; sometimes basic alias/taint edges.
    Output: graphs for impact calculation and change propagation.

  • Execution surface mapping → Enumerate CLIs, entrypoints, HTTP routes, handlers, cron/jobs based on framework conventions and annotations.
    Output: entrypoint/index maps.

  • Schema/config extraction → Detect ORM models, DB schemas/migrations, config/feature flags, env var surfaces.
    Output: schema & config maps usable for compatibility checks.


Localization & Impact (local-only)

  • Relevant-region retrieval → Hybrid search over the local indices (BM25/embeddings if available, plus xrefs) to shortlist files and symbols likely to change.
    Output: ranked candidate files/symbols/lines.

  • Change boundary delimitation → Compute a minimal edit set and seam locations (APIs, adapters, public vs internal).
    Output: edit scope with blast-radius estimate.

  • Impact analysis (forward/backward) → Traverse call/import graphs to find all affected callers, tests, schemas, routes, and docs.
    Output: propagation set for synchronized edits.

  • Ambiguity scoring (non-interactive) → When multiple target regions match equally well, score/rank them using repo signals (usage density, ownership patterns, test linkage) without asking the user.
    Output: best candidate set + tie-break metadata.


Transformation Plumbing (what the CLI executes/applies)

  • Patch application → Apply model-proposed hunks/AST transforms to the working tree, handling file creation/deletion/rename.
    Output: consistent on-disk changes; rejected hunks reported.

  • Cross-file propagation mechanics → Perform deterministic updates derived from indices (e.g., auto-update imports, rename files, fix package paths) when safe to do so.
    Output: synchronized changes beyond the raw patches.

  • Merge/conflict mediation (semantic where possible) → Attempt tree-aware merges against current HEAD; surface unresolved conflicts with precise spans.
    Output: resolved files or conflict report.


Validation & Assurance (local orchestration)

  • Format/lint/type/build gates → Run formatters, linters, type checkers, and compilers with repo-native configs; capture structured output.
    Output: gate results mapped to files/lines.

  • Selective test execution → Compute impacted tests (from xrefs/import graph) and run only those first; then widen if necessary.
    Output: fast failure signal + full-suite fallback.

  • Coverage delta → Overlay coverage on the diff to ensure changed lines are exercised.
    Output: before/after coverage, uncovered regions.

  • Performance harness orchestration (if benches exist) → Run micro/bench targets and compare to baseline; capture timing/allocs where supported.
    Output: perf deltas with thresholds.

  • Security/compliance scans (optional, when configured) → Secret detectors, SAST rule packs, license audits over deps.
    Output: findings tied to files and severity.


Environment & Execution Control

  • Toolchain normalization → Activate venvs, asdf/nvm/pyenv, or containerized runners; pin versions from lockfiles.
    Output: reproducible run context.

  • Hermetic sandboxes → Spin up ephemeral envs (venv/containers/docker-compose) to execute tests/servers without polluting host.
    Output: isolated execution logs/artifacts.

  • Targeted run orchestration → Shard tests, parallelize jobs, retry flaky tests, and capture artifacts (logs, snapshots) for model consumption.
    Output: structured evidence bundle.


VCS/PR Integration

  • Branching/checkpointing → Create/checkout branches; stage coherent commits aligned to plan steps.
    Output: commit series with machine-readable metadata.

  • Diffing & semantic summaries → Generate textual and (when supported) AST diffs; tag changes by subsystem/surface.
    Output: diff + change map.

  • PR construction → Open PRs with templated body (summary, risks, test evidence, coverage/perf deltas), attach artifacts.
    Output: ready-to-review PR.


Session/Context Management

  • Working-set curation → Maintain a rolling “active context” of snippets/files most relevant to the current task; evict stale regions.
    Output: compact bundle for round-trips.

  • Local caches/index persistence → Persist symbol/embedding indices per repo to accelerate subsequent sessions and improve retrieval quality.
    Output: on-disk indices keyed by commit hash.


Guardrails & Safety

  • Invariant checks → Enforce repo-specific rules (e.g., public API stability, migration policies, codeowners) before accepting edits.
    Output: hard stops or warnings with diffs.

  • Rollback scaffolding → Create restore points and scripted reverts (stash/branch/commit hooks) tied to each iteration.
    Output: deterministic rollback path.


What It Explicitly Does Not Do (by design)

  • Does not “reason” about intent or invent edits itself; it executes, scopes, measures, and validates.
  • Does not rely on full-repo uploads to the model; it streams curated slices derived from the local indices and graphs.
  • Does not replace your build/test stack; it orchestrates your existing tools and surfaces structured feedback.

One-Pass Example (local-only responsibilities)

  1. Index repo → build xrefs/graphs.
  2. Retrieve candidate regions for the task → delimit change boundaries.
  3. Apply incoming patch hunks → propagate safe deterministic updates (imports/renames).
  4. Run format/lint/type/build → run impacted tests first.
  5. Collect gates/coverage/perf deltas → prepare diffs/artifacts.
  6. Create commits/PR with evidence → provide rollback checkpoints.

That is the entire local surface area of Claude Code’s CLI: indexing, scoping, applying, validating, and packaging—everything deterministic and file-system/CI/VCS-facing—while omitting the LLM’s semantic work as requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment