AI Integration

Tracey exposes its coverage analysis as MCP (Model Context Protocol) tools, letting AI assistants like Claude Code query requirements, find uncovered code, and add annotations.

Setup

Register tracey with supported MCP clients:

bash
tracey ai

This checks your PATH, prompts before running each MCP registration command, and installs the bundled Tracey skill for the selected clients.

Use --codex or --claude to target only one:

bash
tracey ai --codex
tracey ai --claude

Manual commands are still available:

  • tracey mcp register - register MCP only
  • tracey skill install - install/reinstall the bundled skill only

Available tools

ToolPurpose
tracey_statusCoverage overview — shows configured specs, prefixes, and percentages
tracey_uncoveredRequirements without impl references
tracey_untestedRequirements without verify references
tracey_staleReferences pointing to older rule versions
tracey_unmappedSource tree with coverage — shows code without requirement references
tracey_ruleFull details about a specific requirement
tracey_configDisplay current configuration
tracey_validateCheck for broken references, naming issues, duplicates
tracey_reloadReload config and rebuild data
tracey_config_includeAdd an include pattern to an implementation
tracey_config_excludeAdd an exclude pattern to an implementation

Filtering

tracey_uncovered, tracey_untested, and tracey_stale accept optional parameters:

  • spec_impl — filter to a specific spec/implementation (e.g., "myapp/rust")
  • prefix — filter by requirement ID prefix (e.g., "auth." to see only auth requirements)

tracey_unmapped accepts an optional path parameter to zoom into a directory or file.

Workflow

A typical session with an AI assistant:

  1. Check coverage — the assistant calls tracey_status to see what specs exist, what prefix to use, and current coverage percentages.

  2. Find worktracey_uncovered shows requirements that lack implementations. tracey_untested shows requirements without tests.

  3. Read requirementstracey_rule fetches the full text of a specific requirement, along with all existing references.

  4. Annotate code — the assistant adds r[impl req.id] or r[verify req.id] comments to the appropriate code.

  5. Verifytracey_status again confirms coverage improved.

Example conversation

You: "Add spec annotations to the auth module"

The assistant calls tracey_status, sees prefix r and 45% coverage, then calls tracey_uncovered to find auth.login, auth.token-expiry, and auth.rate-limiting are uncovered. It reads each requirement with tracey_rule, finds the implementing functions, and adds the annotations.

Response format

MCP tool responses include:

  • Status header — current coverage for all spec/implementation pairs
  • Delta — what changed since the last query (newly covered requirements)
  • Hints — suggestions for what to query next

Responses are formatted as human-readable text, not JSON.

Single vs. multiple specs

When only one spec and one implementation are configured, tools use them by default — no need to specify spec_impl. When multiple exist, tools either auto-detect from context or ask you to specify.