Current
Tags and links
Benchmark first
Corpora: QASPER · WikiSection · DocRED. Connectors use recorded provider fixtures because public content corpora do not test cursors, deletes, retries, or event ordering.
Protocol: Score text preservation, section Boundary F1/Pk/WindowDiff, entity/relation F1, stable-ID rate, duplicate rate, and incremental/full-sync equivalence. For polling and streaming, replay the same create→update→delete trace with injected duplicates, reordering, throttling, and cursor expiry; the final snapshot and emitted change set must agree.
Managed tags
TagDefinition, TagAssignments, assign_tags, normalize_tag, and search_weight keep curation separate from provider-owned documents, so resync does not erase it.
Derived links
extract_explicit_links finds explicit references. derive_links adds bounded similarity links and produces typed LinkCandidate values.
How it works
Tag keys are normalized before add/remove set operations; definitions validate that assignments refer to known tags. Search weight combines assigned tag weights through deterministic policy rather than rewriting source relevance. Explicit-link extraction recognizes source references first. Similarity linking scores only caller-supplied candidate IDs, removes self-links, applies a threshold and limit, and sorts ties stably. Returned links are proposals; committing and interpreting them remains application policy.
from mari_components.knowledge import (
TagAssignments, TagDefinition, assign_tags, derive_links, search_weight,
)
definitions = {"canonical": TagDefinition(key="canonical", label="Canonical",
kind="canonical", search_weight=2.0, behaviors=("Wins conflicts",))}
assignments = assign_tags(TagAssignments(), doc.document_id, definitions,
add=("canonical",))
weight = search_weight(doc.document_id, assignments, definitions)
links = derive_links(doc.document_id, candidate_ids,
score=lambda source, target: similarity_scores[source, target])
Research basis
Similarity measures for text processingA-MEM: dynamic linked-note organization
Mari’s managed-tag overlay and bounded link proposal rules are deterministic curation contracts.