v4.11.0 — Opt-in --apply for personal-notes link-discovery (V4 #43 follow-up)
MINOR. v4.10.0's link-discovery audit was strictly read-only — it surfaced suggestions and left the operator to paste [[wikilinks]] by hand. This adds an explicit, opt-in --apply mode that writes the safe suggestions in for you, used to dogfood the operator's own ~390-note vault (143 links across 64 notes, plus a one-time rename of 25 bracketed-date filenames so those pairs became linkable). The tool stays read-only by default; --apply is the operator-directed escape hatch (A3 is satisfied because the operator asks for it). Single-repo release; crickets untouched.
Added
--applymode (notes_link_discovery.py). Writes the suggested links into a marked## Relatedsection at the end of each source note. Backs the whole corpus up first to<vault>/_meta/notes-backup-<date>.tar.gzand refuses to apply if the backup fails; prints thetar xzf …revert command. Idempotent — re-running merges into the one marked section, never duplicates it. Only writes wikilink-safe targets (skips bracketed/|/#/^names) the note doesn't already link, in both directions.plan_apply/apply_links/backup_corpus/_split_relatedare the pieces; +9 tests.
Internal
- Feedback-loop fix. The TF-IDF / embedding scoring body now excludes the agent's own
## Relatedsection, so injected[[link]]text can't inflate similarity and surface ever-more pairs on the next run — without this,--applywas not idempotent on clustered note series (note.linksis still parsed from the full body, so dedup still sees applied links). - Adversarial review caught destructive data loss.
_split_relatedoriginally detected the agent block by a bare substring search for the marker, so a note that merely mentioned the tool in prose — or carried a human-authored## Related— had its prose truncated and the human section clobbered on--apply. Now the agent block is anchored to its actual%% … %%Obsidian-comment line; a prose mention or a human## Relatedis preserved and the new section appended below. Regression-tested. - +9 tests (
scripts/test_notes_link_discovery.py): read-only-by-default, backup-before-write, idempotent/no-double-section, merge-into-existing, skip-already-linked, no-feedback-loop, prose-mention-not-clobbered, split-related-ignores-prose-marker. 426 → 435.
Cross-references
- agentm v4.10.0 — the read-only audit this adds an opt-in writer to.
- ROADMAP-V4 item #43.