kind: WavePipeline metadata: name: housekeeping description: "Audit and repair Zettelkasten link health, orphans, and index completeness" release: true input: source: cli examples: - "" - "orphans only" - "dangling links only" steps: - id: audit persona: navigator workspace: mount: - source: ./ target: /project mode: readonly exec: type: prompt source: | Audit the Zettelkasten for health issues. ## Steps 1. **Find orphans**: Run `notesium list --orphans` - For each orphan, read the note to understand its content - Suggest which existing note it should be linked from 2. **Find dangling links**: Run `notesium links --dangling` - For each dangling link, identify the source file and broken target - Suggest whether to retarget or remove the link 3. **Get stats**: Run `notesium stats` - Record total notes, total links, label count 4. **Check index completeness**: Read the index note - Compare sections listed in the index against known sections - Identify any sections or major topics missing from the index 5. **Find dead ends**: Run `notesium links` to get all links - Identify notes that have outgoing links but no incoming links - These are reachable only via search, not by traversal ## Output Write the result as JSON to output/audit-report.json matching the contract schema. Include: - orphans: list with filename, title, suggested_connection - dangling_links: list with source_filename, target_filename, link_text, suggested_fix - stats: total_notes, total_links, label_notes, orphan_count, dangling_count, avg_links_per_note - index_gaps: list with section, description, suggested_entry_point - dead_ends: list with filename, title, outgoing_links count - timestamp: current ISO 8601 timestamp output_artifacts: - name: audit-report path: output/audit-report.json type: json handover: contract: type: json_schema source: output/audit-report.json schema_path: .wave/contracts/audit-report.schema.json on_failure: retry max_retries: 2 - id: repair persona: scribe dependencies: [audit] memory: inject_artifacts: - step: audit artifact: audit-report as: audit workspace: mount: - source: ./ target: /project mode: readwrite exec: type: prompt source: | Repair issues found in the Zettelkasten audit. Read the audit report: cat artifacts/audit ## Steps 1. **Fix orphans**: For each orphan in the report: - Read the orphan note and the suggested_connection note - Add a contextual link from the suggested note to the orphan - Explain *why* the connection exists 2. **Fix dangling links**: For each dangling link: - If suggested_fix is "retarget": find the correct target note and update the link - If suggested_fix is "remove": delete the broken link from the source file 3. **Fix index gaps**: For each index gap: - Read the index note - Add the missing keyword → entry point mapping - Use the suggested_entry_point from the audit 4. **Skip dead ends** if the count is large — only fix the most obvious ones (notes that clearly belong in an existing Folgezettel sequence) 5. **Commit all fixes**: - `git add *.md` - Count the total issues fixed - `git commit -m "housekeeping: fix {n} issues"` 6. **Write repair log** to output/repair-log.md: - Number of orphans linked - Number of dangling links fixed - Number of index entries added - List of files modified output_artifacts: - name: repair-log path: output/repair-log.md type: markdown