Skip to content

feat(take-notes): user-defined genres, and a router generated from them - #13

Merged
davertor merged 4 commits into
mainfrom
feat/genre-router
Oct 1, 2026
Merged

davertor merged 4 commits into
mainfrom
feat/genre-router

Conversation

@davertor

@davertor davertor commented Sep 9, 2026 •

Copy link
Copy Markdown
Owner

TLDR: A genre is now one Markdown file with front-matter; users add their own under ~/take-notes/genres/, and Step 3's router table is generated from the installed set instead of written by hand.

  • scripts/genres.py (stdlib, --selftest): scans bundled + user genres, validates front-matter (layout, label-en, label-es, when), prints the router table in precedence order — user genres first, recipe, fieldguide, offprint last as the catch-all.
  • A genre without when: is on request only (--genre <name>); a user file named like a bundled genre replaces it.
  • Layouts stay closed (offprint / fieldguide / recipe); render.py resolves --genre by layout and records the genre's name on <html data-genre> — the two offprint templates now carry it too.
  • genres/offprint.md: the offprint's contract moves out of SKILL.md (−52 lines per note) into the same shape as the other two.
  • gallery.py takes card labels from the contracts; a note whose contract is gone shows its bare name.
  • check-drift.py refuses a hand-written router row in SKILL.md; CI runs genres --selftest.
  • The spine is declared once (second commit): Executive summary, The one takeaway, optional Concepts and Going deeper move to SKILL.md Step 4; each contract keeps only its own sections and says what its genre puts in the spine's. check-drift.py refuses a contract that re-declares one. The recipe's differently-named Description becomes the summary.
  • Progressive disclosure (third commit): SKILL.md 434 → 327 lines per note. Settings management → references/settings.md; combining several URLs (was spread over Steps 1, 3, 5) → references/combining.md; Related dropped. Each reference is read only when its case arises. check-drift.py now requires every references/*.md to be reachable from SKILL.md.
  • CHANGELOG entry for 1.6.0 included, per AGENTS.md.

Verified: 10 selftests + check-drift green; end-to-end with a temp ~/take-notes/genres/meeting.md — routed first, rendered on the offprint layout with data-genre="meeting", card labelled reunión, genre: meeting in the Markdown export; --genre nope rejected. An offprint render diffs against main only in the added data-genre="offprint" attribute; the 12 real notes on disk still parse.

🤖 Generated with Claude Code

davertor and others added 4 commits September 9, 2026 17:45
A genre was three things kept in step by hand: a contract file, a row in
SKILL.md's Step 3 table, and a label in gallery.py's UI dict — and the
offprint's contract was not even a file, it was a section of SKILL.md. That
made "add your own genre" impossible without editing the skill.

Now a genre is one Markdown file with a flat front-matter block (layout,
label-en, label-es, when) followed by the contract. genres.py scans the
bundled three plus ~/take-notes/genres/, validates them, and prints Step 3's
table from the `when:` lines in precedence order — user genres first, then
recipe, fieldguide, offprint as the catch-all. A genre without `when` is on
request only; a user file named like a bundled genre replaces it. The
layouts stay a closed set of three: a user genre picks one and brings its
sections, which is where the value is.

The offprint's contract moves to genres/offprint.md in the same shape, so
SKILL.md loses 52 lines per note and the three are defined identically.
Every template now records data-genre, the offprint's two included, so a
user genre on that layout reads back as itself; notes.py accepts slug names.
check-drift.py refuses a router row written back into SKILL.md by hand.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Every contract opened with Executive summary and The one takeaway and
closed with optional Concepts and Going deeper — three copies of the same
four sections, in prose, free to drift; the recipe's had already drifted to
a differently-named Description. The spine now lives in SKILL.md Step 4, a
contract lists only its own sections and says what its genre puts in the
spine's, and check-drift refuses a contract that writes one of those
headings out again.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Progressive disclosure, applied by one rule: what fewer than half the
invocations use leaves the file that every invocation loads. Settings
management (--tags, --theme, --retag: 65 lines, a few percent of runs) moves
to references/settings.md behind an eight-line dispatch. Everything about
combining several URLs into one note — spread over Steps 1, 3 and 5 — moves
to references/combining.md, read once when there is more than one URL. The
Related section, cross-references to other skills, is gone. 434 → 327 lines
per note; a normal note reads nothing it did not read before.

check-drift now scopes its acquisition-guide checks to the guides Step 1's
table routes to, and instead requires every file under references/ to be
reachable from somewhere in SKILL.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Writing a real recipe note showed the study-note sections do not fit: a
recipe has no single takeaway, no glossary, and "going deeper" is really the
list of things the source never measured. The recipe contract now has
Description, Card, Ingredients, Steps, Tips, and optional Gallery and Gaps.

The card gets a fixed core on every recipe so they compare across the
archive — Category from a closed list, Yield in the source's own words,
Active time, Total time, Setup — plus a few fields per category, like Proof
for bread. Missing values are written as missing; difficulty and unit
conversions are no longer inferred.

The shared spine this branch introduced assumed every genre was an
offprint. It shrinks to the one rule the gallery depends on — the body opens
with a paragraph — and the offprint and field guide declare their own
summary, takeaway, concepts and going deeper again. check-drift's spine
check goes with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davertor
davertor merged commit d19526f into main Oct 1, 2026
1 check passed
@davertor
davertor deleted the feat/genre-router branch October 1, 2026 17:43
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