/memento:lint
Enforce the reasoning-artifact schema across every _context.md in a vault. Prose templates can't do this — that's the point.
What gets checked
| Rule | Applies to | Required text (case-insensitive) |
|---|---|---|
| R1 | [D], [I] |
invalidates if / invalidates when / dies if |
| R2 | [S] |
Activation: / activates when (use --strict to require literal Activation:) |
| R3 | [E] |
fix: |
| R4 | all | # column non-empty |
| R5 | all | priority column non-empty |
| R6 | all | row contains a YYYY-MM-DD date |
[I] shares R1 with [D] because the inline grammar documented in session-complete is identical ([I] insight — invalidates if condition).
How to invoke
Default — lint the current vault
python3 ${MEMENTO_PLUGIN_ROOT:-skills/memento-lint}/lint.py
The script discovers the vault root via:
- The path argument if provided
- The
$MEMENTO_VAULT_ROOTenv var - The current working directory
Common flags
# Lint a specific vault
python3 lint.py ~/Documents/Developer/knowledge-os
# Strict mode — require literal "Activation:" for all [S]
python3 lint.py --strict
# Machine-readable output for hooks / CI
python3 lint.py --format json
# Show only violations
python3 lint.py --quiet
Exit codes
| Code | Meaning |
|---|---|
| 0 | No violations |
| 1 | Violations found |
| 2 | Usage error / vault root missing |
When the agent invokes this
- User says "lint", "validate", "check artifacts", or wires lint into a hook.
- Agent runs
python3 <plugin>/skills/memento-lint/lint.py <vault_root>via Bash. - Agent reads stdout, presents the violation list to the user.
- For each violation, offer to fix in-place:
- R1 missing — ask user for the invalidation trigger, then
Editthe artifact row to append— invalidates if <trigger>. - R2 missing — ask user for the activation condition, then append
Activation: <condition>(or— activates when <condition>in lax mode). - R3 missing — ask user what unblocked the error, then append
— fix: <what solved it>. - R4/R5/R6 — fix by inspection: assign a
#, infer priority from the matrix, add today's date.
- R1 missing — ask user for the invalidation trigger, then
- Re-run lint after fixes to confirm green.
Hook / CI wiring
pre-commit
- repo: local
hooks:
- id: memento-lint
name: memento:lint
entry: python3 .claude/plugins/memento-os/skills/memento-lint/lint.py
language: system
pass_filenames: false
files: '_context\.md$'
GitHub Actions
- name: Validate reasoning artifacts
run: python3 .claude/plugins/memento-os/skills/memento-lint/lint.py ${{ github.workspace }}/vault
Sample report
memento:lint — vault validation report (vault: /Users/me/vault)
Projects/memento-os/_context.md
L47 [D]#1 OK
L48 [D]#2 R1: missing 'invalidates if|invalidates when|dies if' clause
L67 [S]#27 OK
Knowledge/_context.md
L23 [D]#5 R6: no YYYY-MM-DD date in row
Summary: 2 violations across 2 files (5 artifacts checked)
Done condition
- Lint exits 0 against the vault, OR
- All violations have been triaged (fixed, accepted with override, or artifact removed).
Don't
- Don't auto-fix without user confirmation. The schema is load-bearing; silently rewriting artifacts erodes trust.
- Don't widen the rules to accommodate sloppy artifacts. Adding
"maybe invalidates if"etc. defeats the purpose. - Don't run lint with
--stricton legacy vaults without warning the user — many existing[S]entries useactivates when.