Skip to content

Library PKM integrations

Reference hooks that connect calibre-librarian events to tool-chest PKM systems.

agent-wiki hook

agent_wiki_hook.py appends structured entries to knowledge/agent-wiki/log.md when:

  • a library search runs (library-search)
  • a passage is retrieved (library-passage)
  • a book is indexed (library-indexed)

Register at MCP startup in your consumer environment:

from pathlib import Path

from library.events import bus
from integrations.library.agent_wiki_hook import register_agent_wiki_hooks

register_agent_wiki_hooks(
    bus,
    wiki_log_path=Path("knowledge/agent-wiki/log.md"),
)

Authoring new hooks

  1. Subscribe to events on library.events.bus (or a dedicated EventBus in tests).
  2. Keep handlers synchronous and failure-tolerant — the library core already isolates handler errors.
  3. Do not import tool-chest paths from the library/ package.

See library/INTEGRATION.md for event payload shapes.