Keep this file under 12 KiB; root plus the largest module AGENTS.md must fit the 16 KiB instruction budget (scripts/check_docs_links.py). Details belong in docs/, skills, .vtcode/memory/, or crate AGENTS.md; universal model behavior lives in vtcode-core/src/prompts/runtime_guidance.rs. Instruction files are user-controlled context, not a security boundary. Repo-only: never copy into other projects or shipped prompts.
- Orient: repository instructions, relevant source/tests, and task-relevant entries in
.vtcode/memory/(search, do not concatenate). For self-bugs, read.vtcode/logs/trajectory.jsonl,.vtcode/checkpoints,.vtcode/sessions. - Research hard problems only: DeepWiki MCP for
vinhnx/vtcode(baseline) andopenai/codex(upstream); verify claims against the checkout or pinned upstream source, attribute sources, stay within the original authorization. See the reference workflow. - Read and apply: use
read-and-apply,rust-skills/agentic-testing,verification-discipline; implement the smallest complete DRY/KISS improvement for CLI and desktop; preserveThreadEvent, harness split, sandbox/approval boundaries, rollback, durable history, unrelated work. Adapted upstream code keeps Apache-2.0 attribution (root notes). - Verify with
./scripts/check-dev.sh+cargo nextest run; record durable learnings in.vtcode/memory/(local-only, gitignored). Interview the user on plan open questions via the interactive question tool (one at a time, recommended answer first) instead of assuming defaults.
- Conventional Commits (
type(scope): subject). - 4-space indentation,
snake_casefns,PascalCasetypes,anyhow::Result<T>+.with_context(). See Rust style adoption matrix for borrows,must_use, API conventions. - CI sets
RUSTFLAGS: "-D warnings"and uses--locked. Match locally withcargo check --locked. - Keep changes surgical: know which files the increment owns, preserve APIs/unrelated work, stage reviewed paths, check each scoped commit's staged diff.
- Hard ceiling: no tracked text file over 1000 lines (
python3 scripts/check_file_length.py --mode enforce); generated/vendored outliers go inscripts/file_length_allowlist.txt(never first-party without a split plan). Rust: src warn 500/enforce 800, tests 1000; caps ratchet down only. - Prefer direct single-agent execution; no orchestrator/worker topologies (forced delegation burns usage limits). Delegate only for independent/parallel work or context isolation.
- Typed identity strings: closed sets and two-way contracts (tool names, wire types, statuses, keystrokes, deeplink verbs, config keys) use the owning enum/const table; single-use grammars stay inline. See string conventions.
vtcode-exec-events::ThreadEventis the authoritative runtime event contract — do not invent parallel types.- Harness config is split across
agent.harness,automation.full_auto,context.dynamic— do not add a new top-level harness subsystem. - Prefer
compact_str::CompactString(aliased asCompactStrinvtcode_core::types) overStringfor small string fields. UseCow<'static, str>for mostly-static return strings. - Shape-suffix naming: encode data shape in names; document a dimension key for feature vectors; promote structured tuples to named structs.
clippy.tomlallowsunwrap/panic/indexing in tests only. Avoid Rustunsafe(workspace lints warn onunsafe_code); where it is unavoidable, keep the block minimal and justify it with a// SAFETY:comment (undocumented_unsafe_blocks).- Treat the sandbox/exec boundary as a primary adversarial surface: use sandbox-aware launch paths and add adversarial regression coverage for command injection, path/symlink escape, environment leakage, and fail-closed behavior.
- All built-in themes must meet WCAG AA 4.5:1 contrast for foreground and all accent fields against background. Validate with
cargo nextest run -p vtcode-ui -E 'test(theme)'. See.vtcode/memory/gotchas.mdfor catppuccin-latte special-case. - Every new major feature must update docs: user-facing behavior in
docs/development/plus its quick-reference; tool surface in prompt guidance (vtcode-core/src/prompts/guidelines/) and schema (vtcode-utility-tool-specs); runtime contract inThreadEvent. - DO NOT read or modify the user's TODO.md (docs/project/TODO.md): private task management, agents keep out.
- When a bug appears in VT Code's own behavior, fix VT Code — do not work around it yourself. Patch the VT Code source that caused the bug; never substitute a manual workaround, wrapper script, or config shim in place of a source fix.
- Before proposing a fix, read the trajectory log at
.vtcode/logs/trajectory.jsonl,.vtcode/checkpoints,<repo>/.vtcode/sessionsto see what actually happened (tool calls, errors, retries) rather than guessing from the symptom. - Every self-bug fix must land in the shipped surfaces the release binary carries — runloop/tool logic and compiled prompts (
crates/codegen/vtcode-core/src/prompts/) — not only in workspace-local files (AGENTS.md, docs), which affect this repository alone. Changing compiled guidance requires updating its budget/presence test.
- Development, testing, evals: README, SETUP, testing, pty-testing, eval, desktop workspace.
- CI/release + models: ci-cd, toolchain/MSRV, CHANGELOG, ADDING_MODELS, WORKFLOW, CHECKLIST.
- Architecture + tools/security: code-organization, async, perf, grep-guide, grep-ref, COMMAND_SECURITY, security.
- WebMCP + harness: webmcp, agent-loop, harness INDEX, CORE_BELIEFS, INVARIANTS, LEGIBILITY.
- Prompt/runtime + planning/automation + loop: runtime-guidance, planning, full-auto, EXECUTION_POLICY, loop-eng.
Cargo workspace, 27 crates. Rust 1.100.0 MSRV, edition 2024. default-members: root + vtcode-core/vtcode-skills/vtcode-tui-runtime/vtcode-ui.
Crate roles live in each crate's Cargo.toml description and ARCHITECTURE. Not obvious from the code: vtcode-desktop is a non-publishable GPUI app while vtcode-desktop-protocol is published (the vtcode binary depends on it); vtcode-llm, vtcode-skills, and vtcode-tui-runtime are partial extractions from vtcode-core.
New reusable logic: prefer a small crate; ask before adding to vtcode-core — dedicated module or crate only.
Every crate has its own AGENTS.md with crate-specific conventions, next to its Cargo.toml (the root binary's is src/AGENTS.md); list them with git ls-files '*AGENTS.md'.
After significant changes, use the audit-module-agents skill. Keep each module AGENTS.md near 30 short lines (600-char cap enforced); put longer detail in docs/development/maintainer-notes/<crate>.md.
Session-independent knowledge lives in .vtcode/memory/ (gitignored, repo-local only): gotchas.md, issues.md, library.md, decisions.md, scratch.md. Read them when context is needed; write durable learnings there. The openai/codex harness pattern lives in library.md (2026-09-24). See .vtcode/memory/README.md for format rules.
- CI: overlap independent setup steps, keep Cargo steps sharing
target/sequential, and keySwatinem/rust-cacheper target in cross-target matrices (ci-cd). - Prefer
./scripts/check-dev.sh(10-30s) over./scripts/check.sh(2-5m) for iteration. - Release builds keep
debug-assertionsandoverflow-checkson: a violated invariant must crash loud. Gate expensive diagnostics behind#[cfg(debug_assertions)].
| Change | Command |
|---|---|
| Fast gate | ./scripts/check-dev.sh |
| + tests (quick) | ./scripts/check-dev.sh --test |
| + tests (changed crates) | ./scripts/check-dev.sh --changed |
| + workspace | ./scripts/check-dev.sh --workspace |
| + lints | ./scripts/check-dev.sh --lints |
| Harness PTY/TUI | ./scripts/check.sh harness |
| Release/PR | ./scripts/check.sh |
| Unsafe-docs gate | ./scripts/check.sh unsafe-docs |
| Hawk dead-code/visibility | ./scripts/hawk.sh |
| Hawk (deny warnings) | ./scripts/hawk.sh --deny |
- Runner:
cargo nextest run(parallel, fast). Always use nextest — nevercargo test. - Single test/crate:
cargo nextest run test_name/cargo nextest run -p vtcode-core. Profiles:default(full),quick(TDD, skips integration/e2e/slow),changed(delta since HEAD~1),ci(retries flaky, no fail-fast). - Harness regressions:
cargo nextest run -p vtcode-core -E 'binary(/pty_tests/)';cargo nextest run -p vtcode-bash-runner -E 'binary(/pipe_tests/)';cargo nextest run --locked -p vtcode -E 'test(inline_events)'. - Test layout: small suites in-module; larger ones in a private
#[cfg(test)] mod tests;after all items (foo.rsandfoo/mod.rsboth loadfoo/tests.rs). Integration tests intests/, script tests inscripts/tests/. - Test visibility: keep fixtures in their test module and use the narrowest
pub(super); never widen APIs, add dependencies, or change production behavior just for tests. - Test evidence: assert independently derived outcomes with asymmetric inputs and both sides of boundaries; for Tokio task IDs,
tokio::spawnthe tested future (root notes). - Verification scope: focused locked nextest filters with a nonzero match count, then broaden by risk; report passed, failed, and excluded tests. Docs-only edits need Markdown and diff checks.
- Project skills live in
.agents/skills/<name>/SKILL.md; onlyrust-skillsis linked into.claude/skills/. Where an agent does not load.agents/skills/, read the namedSKILL.mddirectly. - LLM providers: use the
adding-llm-providersskill. The/modelpicker usesModelId::all_models();builtin_model_presets()is used byModelsManager. Both may need updates. - New workspace crates: use the
adding-workspace-crateskill. This affects more thanCargo.toml; all workspace path dependencies needversionfields. - Structural code work: native
code_searchfor declarations, usages, and paths;ast-grep(neversg) only as an optional developer tool for AST-shape codemods;rgfor prose and config. All are developer tools, not runtime deps. GitHub: preferghover webfetch; on 403 rununset GITHUB_TOKEN && gh auth switch -u vinhnx(root notes). - Cap large output with
| head -c 4000, but never pipe verifier commands (it masks their exit status); in VT Code passmax_output_tokens.