Skip to content
Systems programming for what’s next.
— Vex

Vex agent workflow ​

Use this workflow when writing, porting, debugging or reviewing Vex .vx code. Vex is a separate systems language. Start from its documented syntax and APIs even when the task resembles Rust, Go, C++ or TypeScript.

Establish the project ​

Read the project's instructions, vex.json and nearby working code. Check vex --version before choosing commands or interpreting diagnostics. Keep the user's requested target and dependency constraints. The documentation targets 0.4.0; recorded example checks identify their actual compiler separately in verification evidence.

For a new project, follow the first-project walkthrough. For an existing project, reuse its layout and test entry points. Finish this step with an identified entry file, compiler version and relevant test command.

Read for the task ​

Read only the references needed for the change. Start with the corresponding row, then follow a package link for its exact imports, signatures and ownership.

TaskRead
Write or translate a functionSyntax, variables, functions
Work with records or variantsStructs, enums, error handling
Return, retain or mutate dataOwnership workflows
Choose a package or parse inputStandard-library entry path, package map, then the selected API guide
Validate JSON configurationChecked fields and a complete tested program
Add a regression or benchmarkTesting and the project's existing tests
Coordinate async workConcurrency overview, then the relevant channel/task recipe
Call a native libraryFirst native integration
Generate declarationsComptime recipes
Use tensors, graphs or devicesCapability map, then the specific execution guide

Use Vex contracts ​

  • Bind with let; use let! when rebinding or mutation is required. Read the receiver signature before choosing a shared or mutable borrow.
  • Use fn name(...): ReturnType and the documented import { Name } from "module"; form. Prelude types such as Vec, Map, Option and Result need no invented package import. Package names such as "fs" and "serde/json" come from their guides.
  • Use $println and $format for builtin formatting. Builtin namespaces Math, Bit and Crypto are distinct from imported packages.
  • Distinguish owning string from borrowed str. Keep owners alive while retaining views, spans or pointers; use the package's owning conversion when data must outlive its input. Follow ownership workflows for return values, collections, callbacks and async boundaries.
  • Preserve Option absence and Result errors. Use ? only where the enclosing return type supports propagation. Select the actual return type from the reference instead of adding .unwrap() by analogy.
  • For external data, select a checked parser with explicit resource limits where available. Wire-format validation and application-schema validation are separate steps. The serde guide describes the dynamic parse and field/type/range checks used at input boundaries.

Before using an unfamiliar API, locate its declaration or current reference. If the installed version differs, preserve the diagnostic and resolve that specific mismatch against its source or versioned documentation.

Make the change verifiable ​

Use the smallest complete program or existing test that exercises the desired behavior. Keep imports, setup and expected output with the example. Distinguish copyable programs from fragments that depend on surrounding bindings.

Run the relevant check, program or test with the identified compiler. For parsers, include a malformed input; for an owning/borrowed conversion, exercise the intended lifetime; for concurrency, check completion and shutdown. Choose checks that establish the requested behavior rather than reproducing the implementation line by line.

When execution is unavailable, report what was source-checked and what remains unexecuted. Passing a CPU example does not qualify a GPU path, a parser example does not qualify a protocol session, and successful compilation does not prove native-library interoperability. Report the files changed, the command and observed result, and any remaining task-relevant limitation.

Released under the MIT License.