PersonaKit has three extension points. Two replace a scoring function; the third may narrow a read to fewer memories. None can do anything else.
| Hook | Signature | Built-in | Used by |
|---|---|---|---|
relevance |
(question: str, memories: Sequence[Memory]) -> Sequence[float] |
word overlap (text, category and the owner's hints) | personakit serve (which memories answer a question, and in what order; when the assistant states a context it is called a second time with that text, and each memory keeps its higher score) |
similarity |
(a: str, b: str) -> float between 0 and 1 |
shared words, with number, negation and order guards | personakit tidy (which memories are twins) |
select |
(question: str, context: str, memories: Sequence[Memory], client: str) -> Sequence[Memory] | None |
none (off) | personakit serve, once per read, after the read policy: it sees only the relevant memories that may be served, best first, and the name the assistant connected with ("" when unknown). It returns the ones to serve, or None to leave the read as it is |
Policy stays in the core, whatever a plugin returns:
- Restricted and archived memories are never served. A relevance score only orders what the read
policy already allows, and
selectnever sees them. selectcan only narrow. A memory it returns that it was not offered is ignored, the order of what is served stays the core's, and the limit still applies.- Only unconfirmed memories with the same category and scope, none resting on an assistant's
proposal, can be proposed as twins, and only when they mention the same numbers and agree on
negation. Merging still needs
personakit tidy --applyand is reversible. - No hook can approve, restrict, archive, restore or forget.
A plugin is still Python code running as you, with access to your store file. Enable only plugins you trust and have read.
Nothing is loaded just because it is installed. Name the plugins you want:
pip install some-personakit-plugin
export PERSONAKIT_PLUGINS=some-name # comma separated for several, applied in order
personakit tidyA name that is not installed is an error, not a silent fallback.
Register a function in the personakit.plugins entry-point group. It receives a Hooks object
and replaces what it provides:
# pyproject.toml of the plugin
[project.entry-points."personakit.plugins"]
some-name = "some_package:register"# some_package/__init__.py
def register(hooks):
hooks.similarity = my_similarity # leave hooks.relevance alone to keep the built-inFor anything beyond scoring, use PersonaKit as a library: personakit.store.Store is the one
place that reads and writes the database, and Store.merge, Store.undo_merge,
Store.set_state and Store.restore are the same reversible operations the CLI uses.