agentsclimarketplace

Memory attribution lint

Skill cerebrocybersolutions/libro/skills/memory-attribution-lint

Ops harness for Claude Code — 5 install profiles, 7 shipped skills, full session rituals. Apache 2.0.

Install
npx -y skills add cerebrocybersolutions/libro --skill memory-attribution-lint

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Validate and auto-inject the 11-key provenance frontmatter contract on memory files at write time. Use when authoring memory entries, running lint passes on memory directories, or backfilling missing attribution fields. Enforces a uniform provenance schema (name, description, type, source_surface, host, tool, session_id, written_at_utc, source_path, confidence, lifecycle) so every memory entry is traceable to its origin surface, tool, and session.

SKILL.md

3.6 KB, as published. Nobody here has run it

memory-attribution-lint

Write-time validator + auto-injector for memory file frontmatter. Enforces an 11-key provenance contract on .md files in memory directories. Closes the "where did this memory come from?" gap by capturing source surface, tool, host, and session at write time.

Why provenance matters

Memory entries accumulate across sessions, tools, and surfaces. Without provenance, stale or contradictory entries are hard to triage. The 11-key contract gives every memory file a complete audit trail: who wrote it, from what tool, on what host, in what session, at what time, with what confidence, and at what lifecycle stage.

Contract

Required frontmatter keys:

KeySourceAuto-derived
nameauthorNO
descriptionauthorNO
typeauthor (user/feedback/project/reference)NO
source_surfaceenv CLAUDE_SURFACE or defaultYES
hostsocket.gethostname()YES
toolenv CLAUDE_TOOL or default unknownYES
session_idenv CLAUDE_SESSION_ID or unknownYES
written_at_utcdatetime.now(timezone.utc).isoformat()YES
source_pathauthor declaresNO
confidenceauthor: high/med/lowNO
lifecycleauthor: pinned/active/archived/closed/superseded/stale-by:YYYY-MM-DDNO

Scripts

  • Scripts/lint.py — validate + auto-inject; exit 0=pass, 1=blocked, 2=injected
  • Scripts/backfill.py — bulk backfill existing memory files
  • Scripts/tests/fixtures/ — golden samples for validation cases

Invocation

# Validate single file
python3 Scripts/lint.py path/to/memory.md

# Dry-run (report only)
python3 Scripts/lint.py --dry-run path/to/memory.md

# Backfill all memory dirs
python3 Scripts/backfill.py --dry-run
python3 Scripts/backfill.py --execute

Hook wire (PreToolUse)

See .claude/settings.json hooks.PreToolUse → Write/Edit matching **/memory/*.md. The hook fires lint on any Write/Edit to a file matching the pattern; exit 1 blocks the write until missing required keys are supplied, exit 2 auto-injects derivable keys and allows the write to proceed.

Environment variables consumed

VariablePurposeDefault if unset
CLAUDE_SURFACETool surface label (cc / hermes / etc.)unknown
CLAUDE_TOOLSpecific tool that initiated the writeunknown
CLAUDE_SESSION_IDSession identifier for cross-referenceunknown

Set these at session start to capture full provenance automatically. Without them, the required keys still pass validation (defaulted to unknown) but lose audit value.

Scope Contract (Least-Privilege)

DimensionScope
Read pathsAny .md file passed as target argument
Write pathsSame file (auto-inject mode only); never writes outside target
MCP / tool surfaceNone — pure Python, stdlib only
Network egressNone
SurfaceAny (hook fires at write-time regardless of surface)
CredentialsNone
Escalation triggerExit 1 (blocked write) — operator must add missing required keys manually

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.