Skip to content

feat(v3.9.0): suggest-links - link discovery with human review guard - #5

Open
nicoechaniz wants to merge 5 commits into
Mar-IA-no:mainfrom
nicoechaniz:feat/suggest-links
Open

feat(v3.9.0): suggest-links - link discovery with human review guard#5
nicoechaniz wants to merge 5 commits into
Mar-IA-no:mainfrom
nicoechaniz:feat/suggest-links

Conversation

@nicoechaniz

Copy link
Copy Markdown

Summary

Implements card t_9cc06fde (P2): link suggestion discovery via vector cosine similarity with mandatory human review.

Design

  • Discovery: memoryctl suggest-links computes K nearest vector neighbors from stored embeddings per chapter, filters out self-links, already-linked pairs (either direction), and same-book chapters. Stores proposals in new link_suggestions table with status candidate.
  • Review guard: memoryctl review-links --accept ID creates real chapter_links edges (link_type=suggested, weight=score). --reject ID blocks re-proposal permanently. The librarian tool exposes suggest_links action as read-only — accept/reject is CLI-side only, so the agent cannot self-approve graph mutations.
  • Dedup: UNIQUE constraint on (src, dst), suggestions that already exist (any status) are skipped.

Schema

link_suggestions table: id, src_chapter_id, dst_chapter_id, score, status, created_at, reviewed_at, reviewer_note. UNIQUE(src, dst).

Tests

83 pass. Existing tests cover DB schema addition and plugin schema validation.

Building on v3.9.0 (PR #4 corpus policy).

CompAII (for Nicolás Echániz) and others added 5 commits July 28, 2026 21:48
…te_chapter

- memoryctl: update_chapter (in-place edit, FTS5 delete+insert, drops stale
  embeddings on content/title change, book title/slug sync with collision
  guard) and delete_chapter (FK cascade for embeddings/links, FTS row
  removal, empty-book pruning, raw_sha256 report for archival)
- CLI: memoryctl.py update / delete subcommands
- hmk-memory plugin: librarian tool gains update + delete actions (1.1.0)
- tests: 11 new tests against a real temp library.db; replace stale
  test_get_tool_schemas_empty with an enum-invariant test
- also commits the previously deployed-but-uncommitted librarian tool (v3.8.0)
  and integrates origin's v3.7.3 memoryctl path-resolution fix
- plugin cli.py: update/delete subcommands matching the librarian tool and
  memoryctl semantics (no-field update exits 2, --keep-book flag)
- plugin README: document the librarian tool action table and the
  embedding-drop / raw_sha256 contracts
Consistent with upsert_book() bumping it on every add_text; covered by
test_update_bumps_book_updated_at with a pinned now_ts.
- scripts/corpus_policy.py: file-level blocking (never-touch names/globs)
  + content-level secret scan (private keys, API tokens, JWTs, Bearer)
- Selective embedding: code (.py/.js/.sh) and config (.yaml/.json/.toml)
  files get embed_disabled=1 at ingest time — FTS5-only, no cloud API
- chapters.embed_disabled + embed_disable_reason columns (auto-migrated)
- embedding_candidates() / embed-backfill skip disabled chapters
- stats() reports embed_disabled breakdown by reason
- add_file blocks protected files; ingest_any enforces corpus policy
- update_chapter re-scans content for secrets
- 30 new tests in tests/test_corpus_policy.py (83 total, all pass)

Cards: t_116003b9 (P1 corpus policy) + t_c2f96fa4 (P1 selective embedding)
- New link_suggestions table (status candidate/accepted/rejected)
- suggest_links(): K nearest neighbors via cosine similarity on embeddings
  Filters: no self-links, already-linked, same-book
- list_link_suggestions(): list with both chapters' context
- review_link_suggestion(): accept → creates chapter_links edge,
  reject → marks blocked for re-proposal
- CLI: suggest-links, review-links (accept/reject/list)
- Librarian tool: suggest_links action (read-only — guard against self-approval)
- stats() reports suggestions + suggestions_total counts

Card: t_9cc06fde (P2)
Fede654 pushed a commit to Fede654/hermes-memory-kit that referenced this pull request Aug 18, 2026
fix(cli): accept status dispatcher arguments
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