How vinhnx/vtcode works
Project type and purpose
• VT Code is a Rust-based, terminal-first “coding agent” CLI application with a built-in TUI, a modular library core (vtcode-core), a configuration subsystem (vtcode-config), tool abstractions (vtcode-tools, vtcode-bash-runner), and optional IDE integration via the Agent Client Protocol (ACP) through VS Code and Zed extensions.
• Its purpose is to provide AI-driven code intelligence (completion, analysis, refactoring, semantic search) by orchestrating LLM providers, enforcing security policies, managing context budgets, and hosting a rich TUI/IDE frontend.
File structure
• Workspace root: Cargo.toml enumerates many internal crates (vtcode, vtcode-core, vtcode-config, vtcode-tools, vtcode-commons, vtcode-acp-client, vtcode-bash-runner, etc.).
• src/main.rs & src/lib.rs: Entry points for the CLI.
• src/cli/: Each subcommand (ask, chat_tools, init, exec, etc.) lives here.
• src/agent/: The core agent run loop, context management, telemetry, tool pipelines, unified execution, and UI integration.
• src/acp/: ACP server/client for editor integrations.
• src/process_hardening, src/sandbox, src/workspace_trust: Security and sandboxing.
• vtcode-core crate: Contains the reusable core engine—LLM provider abstraction, prompt generation, context compression/curation, tool interfaces, exec policies, telemetry, and TUI widgets.
• vtcode-config crate: Configuration loader, schema, precedence, API-key management, hook registration.
• vtcode-tools / vtcode-bash-runner crates: Implement built-in tools and secure bash execution.
• IDE/extensions: vscode-extension and zed-extension talk to the ACP subsystem and embed the core as a library.
• Scripts, docs, tests: Build, CI, benchmarks, documentation, architecture guides.
README for additional insights
• Architecture docs: docs/ARCHITECTURE.md exists—likely high-level descriptions.
• Key features call out: Multi-provider AI, security model, TUI, ACP integration, lifecycle hooks, semantic search.
• Deployment: Single binary (vtcode) installed via Cargo or Homebrew, plus separate VS Code extension.
Essential elements, but don’t overcomplicate
• Break the system into high-level components first, then drill down into submodules if needed (e.g., within LLM Adapter, show each provider as a plugin).
• Sequence or data flow for the most critical mission: “User types → CLI → Agent Run Loop → LLM → Tool → UI.”