cx notes lint is a structural lint surface for note-to-code drift. It runs outside the bundle path and defaults to dry-run.
Prerequisite: reconcile notes/CX Semantic Drift Detection.md with actual cx notes drift behavior before expanding lint semantics. Today notes drift reports structural note-to-code drift and validation health; semantic claim/spec/doc comparison remains a design target.
Drift Taxonomy
Structural categories come from NoteCodePathWarning: missing, outside_master_list, and excluded_from_plan.
Semantic contradictions are reported as contradictions and are never auto-fixed.
Auto-fix Decision Matrix
| Category | Auto-fixable? | Trigger | Action |
|---|---|---|---|
missing (file deleted) |
No |
always |
report only |
missing (file renamed, single git-follow match) |
Yes |
confidence >= 0.9 |
rewrite structural frontmatter anchor |
missing (file renamed, ambiguous) |
No |
confidence < 0.9 |
report with candidate list |
outside_master_list |
Conditional |
|
propose include glob update |
excluded_from_plan |
No |
always |
report; suggest section fix |
Contradiction |
Never |
always |
report only |
Stale |
No |
always |
report only; audit metadata requires human review |
Stale tags derived from path |
Yes |
always |
rewrite frontmatter |
Hard Constraints
Auto-fix never edits prose body content. It may rewrite only frontmatter and structural anchors.
Notes lint runs in a separate command path from cx bundle; bundling never triggers note rewrites.
Default mode is dry-run. Mutation requires explicit --write.
Every auto-fix appends one JSON object to notes/.lint-history.jsonl with note ID, change kind, and before/after hashes. The log is append-only.
The mutation contract is captured in notes/Notes Lint Mutation Contract.md and must remain machine-checkable:
type NotesLintMutationKind =
| "frontmatter.path_tags"
| "frontmatter.structural_anchor";
Any new --write behavior extends this enum first, then adds tests proving body-byte preservation and audit history output.
Confidence Scoring
A single git-follow match in the last five commits scores 0.95.
Multiple candidates score max - second_max.
No auto-fix runs below 0.9.