Getting Started
This guide takes you from zero to a working tracey setup: a spec with requirements, annotated source code, and a coverage dashboard.
Install tracey
# Pre-built binary (fast)
cargo binstall tracey
# Or build from source
cargo install traceyCreate your spec
Create a markdown file with your requirements. Each requirement uses the syntax r[requirement.id] followed by its text:
<!-- docs/spec/api.md -->
# API Specification
## Authentication
r[auth.login]
The system must accept a username and password and return a session token on success.
r[auth.token-expiry]
Session tokens must expire after 24 hours of inactivity.The r prefix is just a convention — you can use any lowercase alphanumeric prefix like req, h2, or api. Tracey infers the prefix from what you write.
Annotate your code
Reference requirements from source code comments using PREFIX[VERB req.id]:
// src/auth.rs
// r[impl auth.login]
pub fn login ( username : & str , password : & str ) -> Result < Token > {
let user = verify_credentials ( username, password) ?;
Ok ( Token :: new ( user. id ))
}
// r[impl auth.token-expiry]
pub fn is_token_valid ( token : & Token ) -> bool {
token. age () < Duration :: hours ( 24 )
} The verb defaults to impl if omitted, so r[auth.login] and r[impl auth.login] are equivalent. Other verbs: verify for tests, depends for strict dependencies, related for loose connections.
// tests/auth_test.rs
// r[verify auth.login]
# [ test ]
fn test_login_success () {
let token = login ( "alice" , "correct-password" ). unwrap ();
assert! ( is_token_valid ( & token));
} Configure tracey
Create .config/tracey/config.styx in your project root:
specs (
{
name my-api
include ( docs/spec/**/*.md )
impls (
{
name rust
include ( src/**/*.rs )
}
)
}
) This tells tracey where to find your spec files and which source files to scan for annotations.
Launch the dashboard
tracey web --open This starts the dashboard at http://localhost:3000 and opens it in your browser. You'll see your spec rendered with coverage badges showing which requirements have implementations.
Check from the terminal
You can also query coverage without the dashboard:
# Coverage overview
tracey query status
# List requirements without implementations
tracey query uncovered
# List requirements without tests
tracey query untestedWhat's next
- Writing Specs — requirement syntax, naming conventions, and document structure
- Annotating Code — all verbs, language examples, and ignore directives
- Configuration — multiple specs, test files, exclude patterns
- Dashboard — navigating the web UI
- Editor Integration — LSP setup for real-time feedback
- Versioning — tracking spec changes over time