Spec-driven workflow
Vix is developed specification-first. Each member crate’s spec/index.md
describes that crate’s intended behavior and is the source of truth; the code
implements it. Cross-cutting / app-level specs live at the repo-root spec/.
The loop
- Read the spec. Find the owning crate’s
spec/index.md(or the relevant rootspec/topic — see the map below). If the change alters intended behavior, edit the spec first so it stays authoritative. - Implement in the smallest fitting module. Keep editing/state logic in the
library; keep rendering in
tui/src/ui.rs. - Internationalize any new user-facing text: add the key(s) to
the right
crates/vix-i18n/locales/*.ymlfile (English at minimum; other locales fall back to English) and render witht!. - Document every new public item (the build denies missing docs).
- Test: extend
tui/tests/integration/main.rs(itsmods:common.rsfor shared fixtures, plus one file per area —ai,catalog,compare,cowork,db,editing,find,git,ide_parity,im,keybindings,keymaps,large_file,lsp,mcp,menu,modal,org,palette,panels,save,scripting,themes,workspace, and others;ls tui/tests/integration/) or a module’s unit tests. Remote editing has its own top-level suites (tui/tests/authority_*.rs,remote_agent.rs,remote_ui.rs). A pure transform gets unit tests next to it; a fuzz target if it parses untrusted text; a Criterion benchmark if it runs per keystroke or per frame. - Verify: run the whole
scripts/checkgate (fmt, build, clippy at pedantic with-D warnings, tests, feature combinations, headless examples,cargo docwith warnings denied, generated reference docs and man page current, semver,scripts/check-docswith CSpell, per-binary licenses). It ends withOK (scope changed, …)by default, because locallycargo docand semver cover only the crates changed sincemainplus their dependents (a root, toolchain or lint file change widens this to the whole workspace;--scope allforces it, and CI and the attestation use it), or withOK: … all passedfor the whole workspace. It runs in a clean room (T764): nokache/sccachewrapper on PATH or inRUSTC_WRAPPER,HOST_CC=cc,HOST_CXX=c++, set byscripts/checkitself (opt out withVIX_CLEAN_ROOM=0), so do not strip them by hand. Give every gate that runs at the same time its ownCARGO_TARGET_DIR(one per worktree, never one shared; cargo’s lock serializes a shared directory), and read the==> environment:line in the log to see what it ran in. While iterating,scripts/check --tier fast(fmt, clippy and tests of the crates changed sincemain) or--tier pushis quicker, but only the defaultfulltier counts as the landing gate; the shorter tiers end inOK (tier …), never the full pass line. Run all of it right before every commit you intend to land, not a hand-picked subset:cargo doc, the reference-docs diff andcheck-docscatch things clippy and the tests never see. - Record user-visible changes in
CHANGELOG.md.
Landing a change
- One branch per change, off
main; merge withgit merge --no-ffso the feature boundary stays in history, then delete the branch. Push only when the maintainer asks (git push origin mainreaches GitHub, GitLab and Codeberg at once). - Attest before pushing (T761).
scripts/attestruns thefullgate on a clean checkout and records a signed note (refs/notes/vix-gate) bound to the tree.make hooksinstalls apre-pushhook that refuses to pushmainor a tag without a valid attestation (scripts/attest --verify); a non-main branch may useVIX_ALLOW_UNATTESTED=1(the hook then runs thefasttier),mainand tags never. Itspre-commithook checks staged files only (format, secrets, new files over 1 MiB, code lints; T833). Push the notes besidemainwithgit push origin refs/notes/vix-gate. Commit signing is never bypassed. Seespec/local-ci. - Several agents share one checkout. Work in your own git worktree
(
.claude/worktrees/<name>), and merge large branches in a separate worktree rather than switching the shared checkout’s branch under another session. Checkgit statusandgit logfresh before starting: another session may already have landed the task. - Never use a bare
git stash/git stash pop: the stash stack is shared by every worktree. Prefer a temporary WIP commit. - Commits are SSH-signed (
commit.gpgsign). The first signature in a session can wait on the key’s passphrase; rungit commitunder a timeout (for exampletimeout 90 git commit …) and stop to ask if it hangs, rather than disabling signing. - AI-assisted commits end with a
Co-Authored-By:trailer naming the model; the git author and committer stay human. SeeAI_STATEMENT.mdfor what an agent may do without asking (it may runcargo publish; it may not tag or cut a release).
Reviewing a change
Review against the same rules the change had to follow; the pull-request
template (.github/pull_request_template.md, with an identical
.forgejo/pull_request_template.md that tui/tests/code_lints.rs keeps in
step) is the author’s half of this list.
- Read the spec diff first. The owning spec should say what the code now does. A behavior change with no spec change, or a spec that describes something the code does not do, is drift: ask for the missing half rather than approving one side.
- Read the whole diff, tests included.
git diff main...<branch>(three dots: only what the branch added). A changed snapshot undertui/tests/snapshots/is read line by line; an unexplained moved line is a regression until shown otherwise. - Check what the tools cannot. clippy, the tests and
scripts/check-docscatch most mechanical slips. A reviewer looks for what they miss: a user-facing string outsidet!, or a key missing from a locale its neighbors have; a new action id without exactly onerun_actionarm and a menu leaf, palette entry orvix-action-catalogrow; an#[allow]without areason;unwrap/expecton a runtime path; unchecked arithmetic in new code (spec/rust-checked-arithmetic); a new child process or print that went into an allowlist without a convincing reason (tui/tests/spawn_sites.rs,tui/tests/code_lints.rs); a public API break in a published crate (cargo semver-checks, run by the full gate). - Check the bookkeeping. A user-visible change has a
CHANGELOG.mdline under[Unreleased]; a task is ticked intasks.mdwith its(Done: …)note; regenerated files (docs/reference/) match their generator. - Check provenance.
git log --show-signature main..<branch>shows every commit signed, and an AI-assisted commit ends with itsCo-Authored-By:trailer.scripts/attest --verify <rev>says whether that tree passed the full gate; without an attestation, runscripts/checkyourself before merging. - Prefer a question to a guess. Comment on the line, say what you expected
and why (a spec section, a rule, a failing case). Approving means you would
be willing to land it yourself; merging is
git merge --no-ff, as above.
Writing a spec
A spec says what the feature is, not how the code happens to be arranged today. Keep them in this shape:
- One page per crate at
crates/<crate>/spec/index.md; a crate with several distinct features addsspec/<topic>/index.mdsub-specs and links them. - Open with the contract: the action ids, the menu path, and the one-sentence behavior. A reader should be able to stop after the first paragraph.
- Tables for enumerable things — items, actions, keys, settings, formats. Prose for the rules that are not a list.
- Say why, where it is surprising. A spec that records the reason for a decision survives the next refactor; one that restates the code does not.
- Name the code that implements it (module, function, host method) at the end, so drift is visible from either side.
- Point at neighbors with relative links, and keep them resolvable —
scripts/check-docsfails on a broken one.
Some documentation directories carry index.md and a byte-identical
README.md — the doc map links the first, a forge renders the second when you
browse to the directory. Where both exist they must match: make README.md a
symlink (ln -s index.md README.md) and edit only index.md.
scripts/check-docs fails if they drift.
Auditing for drift
Drift is when code, spec, and docs disagree. scripts/check-docs catches the
mechanical half — broken links and paths, a crate with no spec, a crate missing
from the crate map, a README.md that no longer matches its twin. The rest is a
reading job:
- Compare each crate’s
spec/index.mdagainst the crate it describes (and the rootspec/topics against the app shell). - Compare
README.md/index.md/docs/*against current features, crate names, and key bindings — bindings rot fastest. - Check that every action id used by a menu or the palette has a
run_actionarm and an i18n label key, and that norun_actionarm is unreachable. - Check that user-facing strings go through
t!, that everyt!key exists incrates/vix-i18n/locales/, and that each call fills exactly the%{name}placeholders its string declares —tui/tests/i18n_keys.rsnow gates all three, because all three shipped broken at least once. (localeis reserved byt!: it selects the target locale, so it can never be a placeholder name.) - Check that every menu item has a
<label>.helptooltip key;show_menu_tooltipsis on by default, so a missing one is a blank hover. - Run
scripts/docs-coverageafter adding a user-facing crate: it lists crates with nodocs/page (docs/coverage.md); give the crate a page or add a reasonedEXCLUDEentry. - Watch for counts and versions in prose (crate count, keymap count, language count, toolchain floor) — they are the first thing to go stale.
Fix drift by aligning all three (code, spec, docs).
Spec map
Feature specs live at crates/<crate>/spec/index.md; cross-cutting ones stay at
the repo-root spec/. Notable ones:
| Spec | Covers |
|---|---|
spec/index | Overview, dependencies, architecture, status |
spec/navigation | Position history, go-to-definition/symbol |
spec/overlay-priority | One table orders overlay drawing and keys |
spec/tools | The Tools menu and which crate owns each item |
spec/test | Test strategy: unit, integration, fuzz, bench |
spec/ci | The gate, and the three forges that run it |
spec/rust-clippy-pedantic | clippy::pedantic on all targets |
spec/rust-msrv-n-minus-2 | The MSRV policy: current stable minus two |
spec/agents-directory-name-is-lowercase | Why the guidance lives in agents/, lowercase |
spec/dependabot | Dependabot: security updates + scheduled PRs |
spec/comparisons, spec/emacs-menus | Editor comparisons; Emacs menu parity |
spec/cargo-features | Capability features (full, net, opt-in cowork) |
spec/remote-editing, crates/vix-authority/spec | Remote editing over SSH; the authority slot |
spec/cowork, spec/instant-message | Real-time co-editing; the IM menu |
spec/mcp-server, spec/jupyter | vix --mcp; the Jupyter design (spike only) |
spec/ide-parity, spec/open-container | IDE-parity features; the OC container menu |
spec/worldwide | No feature may favor one country or region |
spec/llms-json-and-llms-txt, spec/monorepo-github-pages | AI maps; the website subproject |
crates/vix-menu/spec | Menu bar structure and every item |
crates/vix-keymap-model/spec | The fourteen keymaps and how keys dispatch |
crates/vix-palette/spec | Palette modes and behavior |
crates/vix-editor/spec | The editor host: tabs, splits, per-action specs |
crates/vix-editor-core/spec | The editor widget: buffer, wrap, brackets, history |
spec/find-and-replace, crates/vix-find-panel/spec | Find/replace, workspace search, query-replace |
crates/vix-fileops/spec, crates/vix-left-dock/spec | Explorer tree and file operations |
crates/vix-lsp/spec, crates/vix-dap/spec | Language Server Protocol; DAP debugger |
crates/vix-git/spec | Git status/diff/staging/conflicts |
spec/git-monorepos | Large-repository costs, measured (T800) |
crates/vix-db/spec | The database workbench |
crates/vix-org/spec, crates/vix-org-table/spec, crates/vix-org-capture/spec | Org editing, tables, capture |
crates/vix-theme/spec, crates/vix-i18n/spec | Themes; internationalization |
crates/vix-settings/spec, crates/vix-session/spec | Settings keys; session/workspace restore |
crates/vix-clipboard/spec | Clipboard access and its test isolation |