1.5 KiB
1.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
Single-script tool that walks a hardcoded Obsidian notes folder and fills empty frontmatter fields (tags, slug, seo-title, seo-description, seo-keywords) by calling a local LM Studio LLM. Only empty fields are touched; everything else in frontmatter is preserved.
Run
pip install pyyaml requests
./tag-notes.py
Requires LM Studio running at LM_STUDIO_URL with MODEL_NAME loaded. There are no tests, linter, or build step.
Sanity-check the LLM endpoint with: curl http://localhost:1234/v1/models
Architecture
tag-notes.py— all logic. Top-of-file constants (LM_STUDIO_URL,MODEL_NAME,NOTES_FOLDER,TAXONOMY_FILE) are the configuration surface — edit them in place.tag-taxonomy.yaml—tags:list injected into the LLM system prompt. Add tags here when the LLM's "new_tag_suggestions" are worth keeping.- Flow per note:
extract_frontmatter(regex +yaml.safe_load) → decide which fields are empty → slug is derived locally from filename → if any LLM-backed field is empty, sendbody[:20000]tocall_llm, which expects a strict JSON response (with a fallback regex to unwrap ```json fences) →reconstruct_markdownwrites the file back withsort_keys=Falseto preserve field order. - The 20000-char cap lives inline at the
call_llminvocation, not as a constant. - Notes without
---frontmatter are skipped, not created.