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.
When to Use Workspace Mode
Section titled “When to Use Workspace Mode”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
Activating Workspace Mode
Section titled “Activating Workspace Mode”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:
- Preserves existing contracts, scoring, and gates
- Defines crate roles based on the workspace structure
- Proposes architecture rules at
.lexicon/architecture/rules.toml
Crate Roles
Section titled “Crate Roles”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.
Dependency Rules
Section titled “Dependency Rules”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.
Upgrading from Repo Mode
Section titled “Upgrading from Repo Mode”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.