Skip to content

docs(skill): lessons captured without a topical tag bypass the duplicate guard - #176

Merged
navbytes merged 1 commit into
mainfrom
claude/lesson-capture-requires-tag
Jul 29, 2026
Merged

navbytes merged 1 commit into
mainfrom
claude/lesson-capture-requires-tag

Conversation

@navbytes

Copy link
Copy Markdown
Owner

Closes the loop on why a real nt store fragmented into ~150 near-duplicate one-line lessons.

The mechanism

--lesson applies only the structural lesson tag. FindSimilar strips structural tags before the shared-tag test, so a lesson carrying nothing else has an empty tag set → sharedTag is never true → the title-Jaccard branch is never evaluated → nt silently accepts a near-duplicate.

Verified both directions on a copy of a real store, against the same existing note:

capture command result
nt note … --kind lesson silently created a duplicate
nt note … --kind lesson --tag browser refused, with append/supersede/force hints
nt note … --kind lesson --project browser refused

Why this explains the fragmentation

On a real 193-note store: 116 notes live in lessons/, and 66 had no topical tag at all. Those are the ones that fragmented — ~75% of notes ended up with an empty body because the content went into the title, and near-identical lessons piled up unchecked. Meanwhile decisions/ stayed clean, because --kind decision applies decision, which is non-structural and therefore survives the strip.

Three consolidation paths all depended on that one predicate and all stayed silent: the write-time refusal, the MCP similar list, and nt distill.

What this changes

Documentation only — both skills now state that a --project or topical --tag is mandatory on capture, and why, so it reads as a correctness requirement rather than tidiness.

Follow-up worth considering (not in this PR)

The durable fix is in code: nt note --kind lesson with no topical tag or project could warn, or fall back to comparing on title alone. Documentation stops a well-behaved agent; it doesn't stop the footgun. Note that #174 (folding project into the tag set) only helps notes that have a project — it does nothing for the tagless case above.

Related: #174.

…licate guard

--lesson applies only the structural 'lesson' tag, which FindSimilar strips
before comparing. With nothing else on the note the tag set is empty, sharedTag
is never true, and the Jaccard branch is never evaluated — so nt accepts a
near-copy of an existing lesson without a word.

Measured on a real 193-note store: 116 notes live in lessons/ and 66 carried no
topical tag at all, which is how it fragmented to ~75% empty-bodied one-liners
while decisions/ (which gets a non-structural 'decision' tag) stayed clean.
Verified both directions: --kind lesson alone silently creates the duplicate;
adding --tag or --project makes the guard refuse it.
@navbytes
navbytes merged commit 731213c into main Jul 29, 2026
9 checks passed
@navbytes
navbytes deleted the claude/lesson-capture-requires-tag branch July 29, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant