For the cross-editor diagnostic and CodeLens data contract, see
LSP Diagnostic Data.
The Mumei language server (mumei lsp) provides editor-level visibility into verification feedback, contracts, and intent/spec alignment for .mm files.
During initialize, the server advertises:
textDocumentSyncfor full-document updates, includingtextDocument/didChangere-validationhoverProviderfor atom contract summariescompletionProviderfor keywords and parsed item namesdefinitionProviderfor source jumpscodeLensProviderwithresolveProvider: truefor inline intent/spec metadata
textDocument/codeLens returns lenses for each parsed atom, including atoms inside impl blocks.
Atom definition lines show:
Intent Drift: 0.42
The current score is a lightweight heuristic derived from:
requiresandensuresconstraint complexity- quantifier count
- body/control-flow/operator complexity
- effects, resources, and effect state transitions
- parameter, generic, and trait-bound count
Scores are normalized to 0.00 through 1.00:
| Score | Meaning |
|---|---|
0.00 - 0.30 |
Low drift risk; implementation and contract are simple. |
0.31 - 0.74 |
Medium drift risk; review the contract/body relationship. |
0.75 - 1.00 |
High drift risk; the LSP also emits a warning diagnostic. |
The CodeLens command is mumei.showIntentDrift with arguments:
["file:///path/to/file.mm", "atom_name", 0.42]This command is intended for editor extensions to open a detail dashboard. Future versions can replace the heuristic with mumei-agent's IntentTracker output while keeping the same LSP surface.
Each requires: and ensures: clause shows a mapping lens:
Spec-Code Mapping: requires → atom_name
Spec-Code Mapping: ensures → atom_name
The CodeLens command is mumei.showSpecCodeMapping with arguments:
["file:///path/to/file.mm", "atom_name", "requires"]Editor extensions can use this to open a side panel that connects the selected contract clause to the atom implementation, diagnostics, counter-examples, and proof artifacts.
The LSP appends intent drift warnings to normal parse/Z3 diagnostics when a score is at least 0.75:
High intent drift score (0.82) for atom 'transfer'. Review spec-code mapping.
The diagnostic data field includes:
{
"intentDrift": 0.82,
"atom": "transfer"
}For .mm files, comments beginning with /// spec: are sent to
mumei-agent validate-spec --input <tmpfile> --format json. Returned spec_health_issues
and cross_validation_gaps become diagnostics on the original comment lines, with next_steps
attached as the human-review handoff rather than renamed into a separate recommendation bucket.
If validate-spec reports failure but neither bucket has entries, a fallback diagnostic is
emitted so silent failures are still visible.
For foreign code, opening a .py, .rs, .ts, .tsx, .go, or .sol document writes the current
editor buffer to a temporary file and runs mumei-agent validate-code --input <tmpfile>
(--language is optional; inferred from extension). Returned verification_violations,
cross_validation_gaps, and verification_status are shown inline using the source
line/column metadata from the JSON payload, with next_steps surfaced as relatedInformation.
If mumei-agent is not installed or returns malformed JSON, the server
gracefully degrades: .mm documents still receive the existing parse/Z3
diagnostics, and foreign-code agent diagnostics are omitted.
The bundled VS Code extension registers:
mumei.showIntentDrift: opens an intent drift detail dashboard for the provided atom.mumei.showSpecCodeMapping: opens a side panel focused on the selectedrequiresorensuresclause.
The LSP client requests CodeLens for .mm files and refreshes lenses after document edits so scores update with the current source text.
- Start the server with
mumei lsp. - Open a
.mmfile in an editor configured for the Mumei LSP. - Confirm atom definitions show
Intent DriftCodeLens entries. - Confirm
requires:andensures:lines showSpec-Code Mappingentries. - Confirm
/// spec:comments or attached foreign-code files (.py,.rs,.ts,.tsx,.go,.sol) showmumei-agentdiagnostics, and that editing the buffer triggerstextDocument/didChangeupdates which re-run validation and clear stale diagnostics. - Click the lenses in an editor extension that implements the corresponding commands.