Skip to content

Workspace Mode

Workspace Mode extends Lexicon for multi-crate Rust workspaces. It adds crate roles, dependency rules, architecture validation, and shared internal contracts on top of the standard Repo Mode capabilities.

Use Workspace Mode when your repository is a Cargo workspace with multiple crates and you want to:

  • assign roles to crates (core, adapter, interface, application)
  • enforce dependency directions between layers
  • share contracts within the workspace
  • validate architecture rules as part of verification

Workspace Mode is activated by having a .lexicon/workspace.toml file. This can be created during lexicon init if a Cargo workspace is detected, or manually.

The workspace manifest:

  1. Preserves existing contracts, scoring, and gates
  2. Defines crate roles based on the workspace structure
  3. Proposes architecture rules at .lexicon/architecture/rules.toml

Each crate in the workspace can have a declared role:

  • foundation — lowest layer, no upward dependencies
  • core — central domain logic
  • interface — trait and type definitions consumed by others
  • adapter — implementations of interfaces
  • integration — cross-crate glue
  • application — end-user entrypoints
  • tooling — developer utilities
  • experimental — exploratory code with relaxed constraints

Roles influence what dependencies are allowed and what gates are expected.

Architecture rules define allowed dependency directions:

  • foundation crates may not depend on application crates
  • interface crates may not import adapter internals
  • experimental crates cannot publish stable contracts

Violations are detected during lexicon verify.

Migration from Repo Mode is additive and safe:

  • existing contracts, scoring, and gates are preserved
  • workspace configuration is added alongside existing files
  • no existing state is modified or deleted

lexicon verify continues to work, now including workspace-level architecture checks.