vtcode-commons

July 4, 2026 · View on GitHub

Root AGENTS.md | Shared traits and utilities. Zero business logic — pure infrastructure.

Module Groups

AreaModules
Traitspaths/ (WorkspacePaths, PathResolver), errors/ (ErrorFormatter, ErrorReporter), telemetry/ (TelemetrySink)
Displayansi/, colors/, styling/, diff_preview/, color256_theme/, color_policy/
LLMllm/ (BackendKind, LLMError, Usage)
Filesystemfs/, diff/, diff_paths/, vtcodegitignore/
Texttokens/, unicode/, sanitizer/, slug/, formatting/
Asyncasync_utils/, thread_safety/ (RelaxedAtomic)
Othereditor/, http/, project/, validation/, serde_helpers/, env_lock/

Rules

  • Re-export key types from lib.rs: WorkspacePaths, TelemetrySink, ErrorFormatter, BackendKind, etc.
  • reference.rs provides in-memory test adapters: StaticWorkspacePaths, MemoryTelemetry, MemoryErrorReporter.
  • ui_protocol/ is a submodule, not a flat module.
  • anstyle_utils gated behind tui feature.

Gotchas

  • paths has two containment tiers: lexical ensure_path_within_workspace and async symlink-resolving ensure_path_within_workspace_resolved. Downstream crates delegate here — do not fork the logic.
  • retry owns the canonical RetryPolicy (delay math, jitter, RetryDecision/RetryStep, simple() constructor). vtcode-core only layers domain adapters on top.
  • error_category/ classifies LLM errors for retry — is_retryable_llm_error_message() is the key function; classify_anyhow_errorErrorCategory is the single classifier for tool errors.
  • env_lock/ is macOS-specific env mutex — used by vtcode binary, not by library crates.
  • utils/ contains calculate_sha256() used by vtcode-indexer.