zettelkasten.server¶
zettelkasten.server ¶
Zettelkasten MCP server.
Provides tools for creating, querying, and traversing knowledge graphs stored as markdown notes with YAML frontmatter.
refresh_graphs ¶
Force a staleness check + reload for each named graph, bypassing the throttle.
See _refresh_graph_if_stale. Used by multi-graph, correctness-sensitive
readers (cross-graph connectivity) so no in-scope graph is read stale from the
in-process cache within the auto-reload throttle window. Invalid or duplicate
names are skipped; only graphs whose files actually changed are reloaded.
Source code in zettelkasten/server.py
create_graph ¶
create_graph(name: str, description: str, source: str = '', relations: list[dict] | None = None) -> str
Create a new concept box (knowledge graph).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Short kebab-case name (e.g. 'investments', 'machine-learning') |
required |
description
|
str
|
What this graph covers |
required |
source
|
str
|
Primary source material (e.g. 'Investments by Bodie, Kane, Marcus') |
''
|
relations
|
list[dict] | None
|
Optional source-level relations [{target, relation}] |
None
|
Source code in zettelkasten/server.py
list_graphs ¶
List all available concept boxes (knowledge graphs).
Source graphs (no underscore prefix) are listed as primary entries. The _cross/ folder is included if it exists (synthesis notes graph).
Source code in zettelkasten/server.py
add_note ¶
add_note(graph: str, title: str, type: str, body: str, source_book: str = '', source_chapter: str = '', source_page: str = '', tags: list[str] | None = None, links: list[dict] | None = None, prerequisites: list[str] | None = None, aliases: list[str] | None = None, project: str = '', synthesis_status: str = '', synthesis_graph: str = '', data: dict | None = None, snapshot: dict | None = None, grounding: dict | None = None, epistemic_status: str = '', applies_when: dict | None = None) -> dict
Add a new note to a knowledge graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box to add to |
required |
title
|
str
|
The concept/term name (e.g. 'Information Ratio') |
required |
type
|
str
|
One of: claim, concept, critique, definition, equation, example, figure, finding, method, model, question, quote, synthesis |
required |
body
|
str
|
The note content in markdown. For an |
required |
snapshot
|
dict | None
|
For an |
None
|
source_book
|
str
|
Book title |
''
|
source_chapter
|
str
|
Chapter number or name |
''
|
source_page
|
str
|
Page number |
''
|
tags
|
list[str] | None
|
Topic tags for categorization |
None
|
links
|
list[dict] | None
|
List of {target, relation, direction?} linking to other notes by ID |
None
|
prerequisites
|
list[str] | None
|
List of note IDs required to understand this |
None
|
aliases
|
list[str] | None
|
Alternative names for this concept |
None
|
data
|
dict | None
|
For a |
None
|
project
|
str
|
When adding to |
''
|
synthesis_status
|
str
|
Spine lifecycle marker ( |
''
|
synthesis_graph
|
str
|
With |
''
|
grounding
|
dict | None
|
Explicit grounding provenance for the note. Chiefly a
|
None
|
epistemic_status
|
str
|
Epistemic provenance for a claim/evidence note —
|
''
|
applies_when
|
dict | None
|
Conditional applicability for a |
None
|
Source code in zettelkasten/server.py
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | |
add_notes_batch ¶
add_notes_batch(graph: str, notes: list[dict] | None = None, links: list[dict] | None = None, project: str = '', synthesis_graph: str = '') -> dict
Add many notes (and cross-links) to one graph with a SINGLE embed pass.
The batched counterpart of :func:add_note for grounded-extraction scribes,
which mint many notes per slice. Each note goes through the SAME
:func:_prepare_note core as :func:add_note — identical validation and the
identical verify_quote grounding gate — so batching never weakens the
per-note contract. Semantics are per-note best-effort: a note that fails
validation/grounding fails ONLY itself (captured in failed); the rest
still commit.
The efficiency win is embedding. :meth:ZettelGraph.save_note embeds each
note as it is written, so a naive loop pays one model call per note. Here the
box's embedding index is SUSPENDED for the duration of the writes (so each
save_note performs only the crash-safe .md write + in-memory index
mutation, skipping the per-note embed) and then a SINGLE batched embed pass
runs over the whole batch at the end. Suspension is done under the box's
_embeddings_lock so a concurrent reader never observes a half-suspended
index (the same lock every index mutation already serializes on).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
The target box (a source graph, or |
required |
notes
|
list[dict] | None
|
Note specs, each a dict of :func: |
None
|
links
|
list[dict] | None
|
Cross-note links applied AFTER every note is saved (so both
endpoints can be freshly-created notes). Each is
|
None
|
project
|
str
|
Extraction context project (strict-tag enforcement) + the
|
''
|
synthesis_graph
|
str
|
Extraction context synthesis graph, shared by the batch. |
''
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
|
dict
|
|
dict
|
a DUPLICATE ref (two specs sharing one |
dict
|
COLLIDES with a note id/title that existed before the batch (a link naming |
dict
|
it resolves to the batch note, shadowing the pre-existing one). |
Source code in zettelkasten/server.py
1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | |
attach_to_dimension ¶
attach_to_dimension(graph: str, note_id: str, tag: str, project: str = '', synthesis_graph: str = '') -> dict
Attach a claim to its schema dimension node in the run's spine — deterministically.
The whole point: the scribe names only the dimension tag; the SERVER
resolves the dimension node id, the synthesis graph, the relation, and — most
importantly — the EDGE DIRECTION from the run's structure persisted on the
source meta (extraction.structure). The scribe never decides direction,
which is the spine-wiring failure mode a smaller model is most likely to get
wrong.
Direction is keyed on the persisted attach_relation:
- spine-member (fresh scaffold default + promoted spine): SPINE-SIDE —
dim_node --spine-member--> claim, edge lives in the SYNTHESIS graph,
cross-graph into the source. This is the ONLY direction the v2
matrix/outline/overlay membership readback sees.
- input-to (explicit legacy base-side): BASE-SIDE — claim --input-to-->
dim_node, edge lives in the SOURCE graph, cross-graph into the synthesis
graph. HARDENING: because the membership readback indexes ONLY spine-side
spine-member edges, a base-side attach is additionally MIRRORED into a
canonical dim_node --spine-member--> claim edge so the claim is never
membership-invisible. The return carries mirrored_membership in this
case.
Returns the edge it wrote, or an error dict (no structure for this source, an
unknown tag, or a failed link). The caller (the note dispatch) holds
the write lock over BOTH graphs.
project + synthesis_graph select the extraction CONTEXT whose
structure is used to resolve the dimension node. A source attached to
several spines (multiple schemas/projects) keeps an independent structure per
context. Resolution follows :func:resolve_extraction_context:
- With NEITHER supplied (no-context), the flat block's
structureis used (a keyed write mirrors its coherent rubric -- including structure -- into the flat block, so a no-context attach against a keyed-written source still resolves a spine). - With BOTH supplied (a FULL key), the matching
(project, synthesis_graph)context'sstructureis used; a populatedcontextslist with no match surfaces a cleanExtractionContextNotFound(never a silent mis-route to another context's structure). - A PARTIAL pair (only one supplied) can never match a keyed entry, so it degrades to the flat block exactly like a no-context read -- it does NOT raise. (The trio never passes a partial pair: scribe/auditor pass both keys or neither.)
CONTRACT: against a source carrying MULTIPLE keyed contexts, a no-context
attach resolves the flat block's structure (the LAST structure-bearing
keyed write, last-write-wins) and may route the claim onto the WRONG spine.
Non-trio / manual callers MUST thread the run's (project, synthesis_graph);
such a degrade is logged at WARNING by :func:resolve_extraction_context.
Source code in zettelkasten/server.py
1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | |
link_notes ¶
link_notes(graph: str, source_id: str, target_id: str, relation: str, direction: str = 'outgoing', equation: str = '', target_graph: str = '', primary: bool = False) -> str
Add a link between two existing notes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
source_id
|
str
|
ID of the note to add the link FROM |
required |
target_id
|
str
|
ID of the note being linked TO |
required |
relation
|
str
|
Relationship type (e.g. 'depends-on', 'contrasts', 'supports') |
required |
direction
|
str
|
'outgoing' or 'bidirectional' |
'outgoing'
|
equation
|
str
|
Optional formula capturing the mathematical relationship (e.g. 'IR = α / ω') |
''
|
target_graph
|
str
|
Optional target graph name for cross-graph links (e.g. another source name, '_citations', '_cross') |
''
|
primary
|
bool
|
Mark the edge as THE one durable structural parent of a
cross-graph sub-spine composition ( |
False
|
Source code in zettelkasten/server.py
1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 | |
get_note ¶
Get a note by ID or by title/alias, including full content and all links.
Also useful for checking whether a concept already has a note before creating a new one (pass title).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
note_id
|
str
|
The note's unique ID (preferred when known) |
''
|
title
|
str
|
Title or alias to look up (case-insensitive; used when note_id is empty) |
''
|
Source code in zettelkasten/server.py
search_notes ¶
search_notes(graph: str, query: str = '', type: str = '', tag: str = '', mode: str = 'hybrid', top_k: int = 20, limit: int = 50) -> list[dict]
Search notes by meaning + keyword, or list all notes when query is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
query
|
str
|
Search term. Empty = list all notes (with filters). |
''
|
type
|
str
|
Optional filter by note type |
''
|
tag
|
str
|
Optional filter by tag |
''
|
mode
|
str
|
"hybrid" (default) fuses keyword + semantic rankings via Reciprocal
Rank Fusion — the best general default: exact term matches rank at the
top while conceptually related notes are still surfaced. Use
"keyword" for exact-substring/id lookups or bulk type/tag browsing
(returns up to |
'hybrid'
|
top_k
|
int
|
Semantic/hybrid mode only: number of results (default 20) |
20
|
limit
|
int
|
Keyword/list mode: cap on results returned (default 50) so large graphs don't return thousands of notes at once. Pass 0 for no cap; narrow with type/tag/query or raise the limit if you need more. |
50
|
Source code in zettelkasten/server.py
1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 | |
list_notes ¶
List all notes in a graph with optional filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
type
|
str
|
Filter by note type (definition, concept, model, etc.) |
''
|
tag
|
str
|
Filter by tag |
''
|
Source code in zettelkasten/server.py
follow_links ¶
follow_links(graph: str, note_id: str, relation: str = '', direction: str = 'both', project: str = '') -> dict
Traverse a note's links, filtered by relation and/or direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
note_id
|
str
|
The note to traverse from |
required |
relation
|
str
|
Optional relation filter (e.g. 'depends-on', 'input-to') |
''
|
direction
|
str
|
'outgoing' | 'incoming' | 'both' (default). 'incoming' returns only backlinks; 'outgoing' only forward links. |
'both'
|
project
|
str
|
When set with an incoming direction, ALSO gather cross-graph backlinks from every source graph in the project — the one call that rolls up a synthesis dimension node's grounding (the claims attaching to it from other graphs). |
''
|
Source code in zettelkasten/server.py
get_prerequisites ¶
Get the full prerequisite chain for a note (what you need to know first).
Returns prerequisites in learning order (earliest first).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
note_id
|
str
|
The note to get prerequisites for |
required |
Source code in zettelkasten/server.py
find_by_title ¶
Look up a note by its title or alias (case-insensitive).
Useful for checking if a concept already has a note before creating a new one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
title
|
str
|
The title or alias to search for |
required |
Source code in zettelkasten/server.py
get_graph_summary ¶
Get a summary of a knowledge graph: counts by type, most-linked notes, orphans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
Source code in zettelkasten/server.py
health ¶
Return diagnostic information about the zettelkasten server.
Reports loaded graphs, note counts, embedding index status, graphs directory path, and install location.
Source code in zettelkasten/server.py
rebuild_global_index ¶
Rebuild the global note-level ANN index from the live .md sources.
The global index (_global.kgl) is a disposable derived cache that powers
broad, cross-project semantic search (project_search / query_topic)
with a single pre-filtered vector query instead of a per-box fan-out. It is
maintained incrementally as notes are written, but this tool does a full
rebuild — reconciling any drift (e.g. notes deleted while the server was down)
and re-deriving every vector from the source of truth. Unchanged notes reuse
their existing vector, so a rebuild does not re-embed the whole corpus.
Source code in zettelkasten/server.py
semantic_search ¶
Search notes by meaning using embeddings (not just keyword matching).
Use this when keyword search fails or you want conceptually related notes even if they don't share exact terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
query
|
str
|
Natural language query (e.g. 'measures of risk-adjusted performance') |
required |
top_k
|
int
|
Number of results to return (default 10) |
10
|
Source code in zettelkasten/server.py
suggest_connections ¶
Find notes that are semantically related but not yet linked.
Use this after creating a note to discover potential connections, or periodically to find missing links in the graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
note_id
|
str
|
The note to find connections for |
required |
top_k
|
int
|
Number of suggestions to return |
8
|
Source code in zettelkasten/server.py
suggest_structure ¶
Analyze the graph and suggest structural improvements.
Proactively identifies: - Orphan notes (no links in or out) that should probably connect to something - Dense clusters that might benefit from a synthesis note - Frequently referenced concepts that don't have their own note yet - Notes with high semantic similarity that aren't linked
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
Source code in zettelkasten/server.py
2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 | |
overview ¶
Use this first when you're unsure how to work with the zettelkasten: a compact orientation map.
Read-only. Returns the store's purpose, the workflows you reach for most,
and a tool -> action index. Authoritative action values also live on each
tool's own action schema enum. Reads are always available; writes may be
gated by ZK_DISABLE_WRITE / ZK_DISABLE_DELETE.
Source code in zettelkasten/server.py
suggest ¶
suggest(kind: str, graph: str = '', note_id: str = '', top_k: int = 8, project: str = '', similarity_threshold: 'float | None' = None, min_sources: int = 2, since_source: str = '', accept: dict | None = None, target_scope: str = 'project', include_types: 'list[str] | None' = None, min_cross_degree: int = 1, max_candidates: int = 500, max_notes_per_source: int = 200) -> dict
Use this when you want the graph analyzed proactively: suggest links, structure fixes, or synthesis hubs.
Kinds
connections: Notes semantically related to note_id but not yet linked,
WITHIN note_id's own graph. Use after creating a note. Requires graph
and note_id. (For CROSS-graph candidates use cross-connections.)
cross-connections: Semantically related notes in a DIFFERENT graph that
are not yet linked, plus a connectivity audit (island graphs +
under-connected notes). This is the job-2 (flat cross-graph
connectivity) engine — the cross-graph counterpart of connections,
which is graph-local and cannot connect a note to another source.
READ-ONLY: write the edges you judge real with
note(action="link", ..., target_graph=target_scope
(default 'project') restricts candidate targets to a project's sources
or opens them to the whole corpus. Idempotent: already-linked pairs are
excluded, so a re-run after wiring edges returns only what's missing.
structure: Whole-graph analysis — orphans, missing links, clusters
ready for synthesis notes, unresolved references. Requires graph.
concept-hubs: Cross-source concept clusters in a project that could
become synthesis notes in _cross/. Requires project. Each suggestion
is tagged action='attach' (link into an existing hub — preferred) or
action='new_hub' (mint a new synthesis note). Pass since_source after
adding/extracting a source to get the cheap incremental check that
only looks at that source (and follows its links into existing hubs).
Pass accept (a proposed theme: {title, members, theme_id?,
body?, tags?}) to ACCEPT a proposed theme — it materializes a
landscape concept hub in _cross/ (a concept note tagged
landscape + surveys edges) via the idempotent, ownership-safe
materialize_theme producer wrapper and returns the hub.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
str
|
"connections", "cross-connections", "structure", or "concept-hubs". |
required |
graph
|
str
|
Concept box name (connections, structure, cross-connections). |
''
|
note_id
|
str
|
Note to find connections for (connections, cross-connections). |
''
|
top_k
|
int
|
Number of suggestions / candidate targets per source note. |
8
|
project
|
str
|
Project name (concept-hubs, cross-connections). |
''
|
similarity_threshold
|
'float | None'
|
Minimum pair similarity. Omit to use the kind's own default (concept-hubs 0.7; cross-connections 0.5 — cross-graph cosine is compressed, so genuine neighbors sit ~0.5–0.66). Pass a value to take control: raise it for precision, lower it for recall. |
None
|
min_sources
|
int
|
Minimum distinct sources per cluster (concept-hubs). |
2
|
since_source
|
str
|
Restrict concept-hubs to clusters involving this one source (incremental, cheap — use right after adding or extracting it). |
''
|
accept
|
dict | None
|
Accept a proposed theme (concept-hubs): a dict with |
None
|
target_scope
|
str
|
cross-connections — 'project' (default; targets restricted to the project's sources) or 'corpus' (any source graph). |
'project'
|
include_types
|
'list[str] | None'
|
cross-connections — content note types to consider (default claim/finding/method/definition/model/concept; never quotes or hub/spine nodes). |
None
|
min_cross_degree
|
int
|
cross-connections — a content note with fewer cross-graph
edges than this is reported |
1
|
max_candidates
|
int
|
cross-connections — global cap on returned pairs
( |
500
|
max_notes_per_source
|
int
|
cross-connections — per-graph note cap for the similarity sweep (bounds cost/memory as the corpus grows). |
200
|
Source code in zettelkasten/server.py
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | |
update_note ¶
update_note(graph: str, note_id: str, append_body: str = '', new_type: str = '', add_tags: list[str] | None = None, add_links: list[dict] | None = None, add_aliases: list[str] | None = None, add_prerequisites: list[str] | None = None, replace_body: str = '', synthesis_status: str = '') -> dict
Update an existing note with additional content or metadata.
Use this when the user provides more depth about an existing concept (additional formulas, interpretations, caveats, etc.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
note_id
|
str
|
ID of the note to update |
required |
append_body
|
str
|
Markdown content to append to the body |
''
|
replace_body
|
str
|
Overwrite the body wholesale (mutually exclusive with append_body). Use this when a synthesizer authors a spine node's portrait so the original "claims attach here" scaffold sentence is replaced, not left stranded above the prose. |
''
|
new_type
|
str
|
Upgrade the note type (e.g. 'definition' → 'concept') |
''
|
add_tags
|
list[str] | None
|
Tags to add (won't duplicate existing ones) |
None
|
add_links
|
list[dict] | None
|
New links to add: [{target, relation, direction?}] |
None
|
add_aliases
|
list[str] | None
|
New aliases to add |
None
|
add_prerequisites
|
list[str] | None
|
New prerequisite IDs to add |
None
|
synthesis_status
|
str
|
Flip a spine node's lifecycle ( |
''
|
Source code in zettelkasten/server.py
2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 | |
verify_grounding ¶
Re-verify a note's method='data' grounding by RE-COMPUTING it.
Loads the note and re-runs
:func:zettelkasten.data_grounding.verify_data_grounding over its data
citation. On a CLEAN reproduce (verified True, severity ok) it
stamps grounding.verified=True plus verified_at (UTC ISO 8601) and
verified_in (<repo>@<short-sha> for this repo) onto the note and
saves it. The structured verify result is ALWAYS returned, whether or not the
claim reproduced. angelo VERIFIES/STORES here — it never composes the claim.
Source code in zettelkasten/server.py
set_note_confidence ¶
Attach an advisory extraction-confidence score to a note's grounding.
Confidence is ADVISORY (governance): it is merged onto note.grounding
(preserving any quote-verification keys already there) and surfaced in the
note panel + synthesis-matrix cells, but it never gates publishing or
routing. score is clamped to 0..1. This is the persistence seam for the
Stream post-extraction scoring pass (:mod:stream.scoring); it is a plain
in-process mutator (no MCP surface) — callers serialize writes themselves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Source graph the note lives in. |
required |
note_id
|
str
|
Note to annotate (typically a |
required |
score
|
float
|
Support/extraction confidence in 0..1 (a >1 value is treated as a percent and divided by 100). |
required |
method
|
str
|
How the score was produced (e.g. |
'logprob'
|
Source code in zettelkasten/server.py
delete_note ¶
Delete a note from the knowledge graph.
Removes the markdown file and de-indexes the note. Does NOT remove links from other notes that point to this one (they become unresolved references, visible via suggest_structure).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
Name of the concept box |
required |
note_id
|
str
|
ID of the note to delete |
required |
Source code in zettelkasten/server.py
3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 | |
create_source ¶
create_source(name: str, doc_type: str, title: str = '', authors: list[str] | None = None, year: int | None = None, venue: str = '', doi: str = '', abstract: str = '', zotero_key: str = '', content_hash: str = '', source_path: str = '', relations: list[dict] | None = None, update: bool = False, date: str = '') -> str
Create a source folder with enriched _meta.yaml.
Dedups on content_hash: if a source already carries the same content_hash (the sha256 from ingest_source), the existing source is returned instead of creating a duplicate.
GROWABLE SOURCES: pass update=True for a source whose underlying document
grows over time (e.g. a live transcript streamed segment by segment). Then an
EXISTING box of this name is not an error — its content pointer
(content_hash / source_path) is REFRESHED to the new (larger) document
and the memoized grounding corpus is invalidated, so subsequent incremental
extraction reads and grounds against the whole accumulated text while all
claims land in the one box. With update=True the content-hash dedup shortcut
is skipped (the caller is deliberately targeting this named box).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Short kebab-case folder name (e.g. 'bodie-investments-12e') |
required |
doc_type
|
str
|
Document type (e.g. 'journal-article', 'book', 'working-paper', 'report') |
required |
title
|
str
|
Full title of the source |
''
|
authors
|
list[str] | None
|
List of author names |
None
|
year
|
int | None
|
Publication year |
None
|
venue
|
str
|
Journal, publisher, or conference |
''
|
doi
|
str
|
Digital Object Identifier |
''
|
abstract
|
str
|
Brief abstract or description |
''
|
zotero_key
|
str
|
Zotero item key for reference manager integration |
''
|
content_hash
|
str
|
sha256 of the source file's bytes (from ingest_source); anchors the full-text reference and dedups re-ingested files |
''
|
source_path
|
str
|
Path the full text was extracted from (local path or Zotero PDF path) |
''
|
relations
|
list[dict] | None
|
Optional source-level relations [{target, relation}] |
None
|
date
|
str
|
Optional fine-grained source date ( |
''
|
Source code in zettelkasten/server.py
3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 | |
analyze_gaps ¶
analyze_gaps(project: str = '', graph: str = '', limit: int = 25, gap_types: list[str] | None = None) -> str
Surface a TYPED, RANKED research agenda over the claim graph.
The successor to the old flat find_gaps: instead of five hard-coded
lists, this is a typed scan that names WHY a region of the corpus is
incomplete, scores HOW MUCH it matters (a bounded severity = salience ×
type-weight × actionability), and wires each finding to the producer-loop
tool that would CLOSE it. Deterministic and LLM-free — every gap and score is
reproducible from the graph. Gap TYPES:
evidential— a thin claim (few distinct supporting sources / low bounded strength) or a replication gap →expand_citations/claim('test').dialectical— an unresolved debate (a contested, non-superseded claim) or an unarticulated counterclaim →claim('test').structural— a foundational claim that is under-supported, a bridge claim (high centrality), or a frontier claim (no structural neighbours) →claim('test')/expand_citations.coverage— a thinly-developed landscape hub →claim('propose').comprehensiveness— a high-value unread (co-cited) citation not promoted to a local source →promote_citation.temporal— a stale claim whose newest supporting paper lags the citation frontier →expand_citations(forward).
Plus six OPT-IN negative-space "opportunity" families (propose-only) that scan
the MISSING edges + unmatched nodes across the graph and the memory↔
zettelkasten boundary. They are emitted ONLY when explicitly named in
gap_types — the default scan is unchanged:
asymmetry— a practice memory-node with no aligned canon claim, or a canon claim with no aligned practice node (the cross-store overlay).bridge— two dense clusters with (near-)zero connecting edges but high inter-cluster embedding similarity (a synthesis opportunity).crux— an unresolved central debate (a contested camp, ranked by strength × centrality).orphaned_question— aquestionnote with no answering backlink.void— a sparse-but-surrounded region of embedding space.transfer— a method/model note that fits an untried adjacent cluster.
Each gap carries its type, structural predicate, severity,
salience/type_weight/actionability components, the anchor it
concerns, and the executable action (a producer-loop tool call).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name to scope sources (ignored when |
''
|
graph
|
str
|
Single source graph to scope to (takes priority over |
''
|
limit
|
int
|
Max ranked gaps to return (by severity desc). |
25
|
gap_types
|
list[str] | None
|
Optional subset of gap types to emit; empty = the six default claim-anchored types (the six opportunity families are opt-in). |
None
|
Source code in zettelkasten/server.py
3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 | |
rank_missing_papers ¶
Rank cited-but-unowned works as ACQUISITION targets.
The acquisition companion to analyze_gaps: where analyze_gaps names
what is missing in the articulated graph, this names which WORKS to acquire
to close it. A target is any cited-but-unowned work in the corpus (a citation
with no local source folder), scored on a bounded 0–1 composite (claim-unlock
+ corpus influence + external citation mass). Claim-unlock leads: a work that
is the CORE paper of an otherwise-uncovered key claim — uncovered because an
unowned core cannot be read — ranks highest, since acquiring it is the only
way to cover that claim. Deterministic and LLM-free; degenerate scopes (no
claims, or no owned sources) are handled gracefully, not as errors.
Each target carries its score and components (influence,
cited_by_count, unlocks_count + the unlocks claim list), a short
reason, and the executable promote_citation action that acquires
it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name to scope sources (ignored when |
''
|
graph
|
str
|
Single source graph to scope to (takes priority over |
''
|
limit
|
int
|
Max ranked targets to return (by score desc); negative = all. |
25
|
Source code in zettelkasten/server.py
build_syllabus ¶
build_syllabus(project: str = '', graph: str = '', budget: int = 12, suggested_only: bool = False, as_of: str = '') -> str
Assemble the Papers view: a scored, situated, theme-covered reading list.
The read-side companion to analyze_gaps: where analyze_gaps surfaces
what's missing, this surfaces what to read and why. It runs the deterministic
syllabus engine end-to-end (scoring → trends → interestingness/situate →
theme model → set cover) over the corpus and returns one JSON payload the
Papers view renders. No LLM, no network — every number is reproducible from
the graph.
Scope is a single graph (one source), a project (its source set), or
everything when both are empty. relation_edges and landscape hubs are
derived from the graph's own links; embedding/cluster-driven signals
(surprise, novelty, embedding-cluster themes) are left null here because the
MCP server has no embedding machinery — the dashboard's /papers endpoint
fills those in. Everything else (influence, salience, importance, anchor,
read_priority, trajectory/velocity, dissent/brokerage/anomaly, situate
labels, why_read/why_interesting, the suggested set) is fully populated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name to scope sources (ignored when |
''
|
graph
|
str
|
Single source graph to scope to (takes priority over |
''
|
budget
|
int
|
Max papers in the suggested reading set. |
12
|
suggested_only
|
bool
|
Return only the works in the suggested set. |
False
|
as_of
|
str
|
Replay trends as of this year (e.g. "2020"); empty = live. |
''
|
Source code in zettelkasten/server.py
build_claims ¶
Assemble the Claims view: ranked key claims with status and core papers.
The claim-level companion to build_syllabus: where the Papers view scores
works, this scores the claims and findings the corpus asserts. It runs the
deterministic, LLM-free claim engine (zettelkasten.claims) over the scoped
graphs — extracting active claim/finding notes, building a one-pass reverse
index of every support/corroboration/contestation/structural edge, and from
that deriving each claim's bounded strength, derived status (established |
contested | superseded), cross-source support span, and the single
core paper to read for it. Returns one JSON payload: the scope, the claim and
source counts, a status summary, and the ranked key_claims.
Scope is a single graph (one source), a project (its source set), or
everything when both are empty. No LLM, no network, and no embeddings (mirrors
build_syllabus); every score is reproducible from the graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name to scope sources (ignored when |
''
|
graph
|
str
|
Single source graph to scope to (takes priority over |
''
|
limit
|
int
|
Max key claims to return; 0 (default) returns the full ranking. |
0
|
Source code in zettelkasten/server.py
build_outline ¶
build_outline(project: str = '', graph: str = '', claim_ids: list[str] | None = None, as_of: str = '', name: str = '', outline_id: str = '', spine: str = '', spine_mode: str = '', ancestor_uids: list[str] | None = None, ancestor_levels: int = 0, force: bool = False, peek: bool = False) -> str
Build the grounded writing-scaffold outline for a scope (GATHER→DRAFT→write).
The writing-side companion to build_syllabus/build_claims: where those
score the reading list and the claim ladder, this assembles the deterministic
GATHER material for the scope, hands it to the DRAFT agent under the
assemble-grounded-outline skill contract, runs the deterministic integrity
post-pass, and persists the scaffold as a regenerable derived artifact at
_reviews/<name>.md (the durable authored state stays the
_reviews/<name>.yaml overlay). A matching generation signature with an
extant artifact short-circuits to the cached markdown with no agent call
(cached=True) unless force is set.
Scope is a single graph (one source), a project (its source set), or
everything when both are empty. claim_ids pins the exact claims/order
(else every active claim in salience order, with the claim-sparse fallback).
spine/ancestor_uids/ancestor_levels bring this tool to PARITY with
the dashboard's POST /graphs|projects/{name}/outline route (which forwards
the identical set to outline.build_outline). Omitting all three yields the
historical flat, byte-identical single-spine/theme partition, so existing
callers are unaffected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name to scope sources (ignored when |
''
|
graph
|
str
|
Single source graph to scope to (takes priority over |
''
|
claim_ids
|
list[str] | None
|
Exact claim uids/ids to outline, in order; empty = all claims. |
None
|
as_of
|
str
|
Replay trends as of this year (e.g. "2020"); empty = live. |
''
|
name
|
str
|
Review name to persist under; defaults to graph/project/"all". |
''
|
outline_id
|
str
|
Which of the review's outlines to build; empty = the manifest-backed default. |
''
|
spine
|
str
|
Optional SPINE section partition (an organization id): the outline's sections become that spine's dimensions instead of the theme/settled partition. Empty = the historical theme partition. |
''
|
ancestor_uids
|
list[str] | None
|
AUTHORITATIVE nested-composition selection — the EXPLICIT,
ordered (root→leaf) set of ancestor node uids to keep as framing tiers
above the subject spine's leaf partition (the checked tiers of the
frontend's projection). |
None
|
ancestor_levels
|
int
|
DEPRECATED count-based fallback for the nested selection,
kept only for back-compat: |
0
|
force
|
bool
|
Redraft even when the cached signature is unchanged. |
False
|
peek
|
bool
|
Cost-free read-only staleness probe; never gathers/drafts/writes. |
False
|
Source code in zettelkasten/server.py
3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 | |
claim_anatomy ¶
Assemble the full anatomy of a single claim or finding.
The claim-level detail companion to get_note: given a claim/finding's home
graph and note_id, returns the claim (title/body/source locator), its
evidence (supporting/replicating quote notes with page + grounding,
strongest first), its strongest counterclaims with their own evidence, its
caveats (qualifies) and any supersedes edges, the derived status, the
bounded claim strength, the single :func:core_paper_atom to read, and an
ordered reading path (prerequisite claims first). Read-only and LLM-free.
Claim ids are unique only WITHIN a graph, so both graph and note_id are
required to identify the claim. By default the index is built over the home
graph alone; pass project to widen the scope so cross-source supporters
and counterclaims living in the project's other sources are seen. Returns
{"error": ..., "type": "NotFound"} when no such claim exists in graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
str
|
The source graph the claim/finding lives in (its home graph). |
required |
note_id
|
str
|
The claim/finding note id (unique only within |
required |
project
|
str
|
Optional project to widen the index scope for cross-source links. |
''
|
Source code in zettelkasten/server.py
syllabus ¶
syllabus(action: Literal['papers', 'claims', 'outline', 'gaps', 'missing', 'anatomy'], project: str = '', graph: str = '', note_id: str = '', budget: int = 12, limit: int = 0, suggested_only: bool = False, as_of: str = '', claim_ids: list[str] | None = None, name: str = '', outline_id: str = '', spine: str = '', spine_mode: str = '', ancestor_uids: list[str] | None = None, ancestor_levels: int = 0, force: bool = False, peek: bool = False, gap_types: list[str] | None = None) -> str
Use this when you need the read-only Workshop view: the reading list, claim ladder, writing outline, and typed research agenda over the corpus.
All actions are read-only, LLM-free, and reproducible from the graph. Scope
is a single graph (one source), a project (its source set), or
everything when both are empty.
Actions — name(required, optional?):
papers(project?, graph?, budget?, suggested_only?, as_of?): scored,
theme-covered reading list.
claims(project?, graph?, limit?): ranked key claims with status and core
papers (limit 0 = all).
outline(project?, graph?, claim_ids?, as_of?, name?, outline_id?, spine?, spine_mode?, ancestor_uids?, ancestor_levels?, force?, peek?):
grounded writing scaffold (dashboard-parity). spine partitions
sections by an organization's dimensions; ancestor_uids selects
nested-composition framing tiers (preferred over deprecated
ancestor_levels); peek is a cost-free staleness probe;
force redrafts.
gaps(project?, graph?, limit?, gap_types?): typed, ranked research agenda
over the claim graph (default limit 25). Six opt-in negative-space
families (asymmetry/bridge/crux/orphaned_question/void/transfer) emit
only when named in gap_types.
missing(project?, graph?, limit?): cited-but-unowned works ranked as
acquisition targets (default limit 25).
anatomy(graph, note_id, project?): full anatomy of one claim/finding.
All return JSON.
Source code in zettelkasten/server.py
3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 | |
note ¶
note(action: Literal['get', 'search', 'follow', 'prerequisites', 'add', 'add_batch', 'update', 'link', 'attach', 'verify_grounding'], graph: str = '', note_id: str = '', title: str = '', query: str = '', type: str = '', tag: str = '', mode: str = 'keyword', top_k: int = 10, limit: int = 50, relation: str = '', body: str = '', source_book: str = '', source_chapter: str = '', source_page: str = '', tags: list[str] | None = None, links: list[dict] | None = None, notes: list[dict] | None = None, prerequisites: list[str] | None = None, aliases: list[str] | None = None, source_id: str = '', target_id: str = '', direction: str = 'both', equation: str = '', target_graph: str = '', append_body: str = '', new_type: str = '', add_tags: list[str] | None = None, add_links: list[dict] | None = None, add_aliases: list[str] | None = None, add_prerequisites: list[str] | None = None, project: str = '', synthesis_status: str = '', synthesis_graph: str = '', replace_body: str = '', data: dict | None = None, snapshot: dict | None = None, grounding: dict | None = None, epistemic_status: str = '', applies_when: dict | None = None) -> str
Use this when reading or writing notes: read (get/search/follow/prerequisites) or write (add/add_batch/update/link/attach/verify_grounding).
READ actions are always available; WRITE actions are refused at runtime when
the server is write-free (ZK_DISABLE_WRITE). Every add/add_batch
runs the same validation + verify_quote grounding gate.
Actions — name(required, optional?):
get(graph, note_id?, title?): one note by id or title.
search(graph, query?, type?, tag?, mode?, top_k?, limit?): keyword/semantic
search or list (empty query lists notes).
follow(graph, note_id, relation?, direction?, project?): links from a note
(direction = outgoing|incoming|both). Pass project to also roll
up CROSS-GRAPH incoming edges (a synthesis dimension's grounding).
prerequisites(graph, note_id): the ordered prerequisite chain.
add(graph, title, type, body, source_book?, source_chapter?, source_page?, tags?, links?, prerequisites?, aliases?, project?, synthesis_status?, synthesis_graph?, data?, snapshot?, grounding?, epistemic_status?, applies_when?):
create a note. An equation note's body is LaTeX (render-checked)
with an optional snapshot PDF crop; a figure note describes a
chart/diagram in body with a snapshot image as its visual
ground-truth (grounded when it resolves, else inferred); a claim may
carry grounding + epistemic_status (grounded|measured|inferred);
a requirement may carry applies_when (decision-tree, see guide).
graph='_cross' + project auto-claims a synthesis note.
add_batch(graph, notes, links?, project?, synthesis_graph?): create many
notes in one box under a single lock + batched embed; a failure fails
only that note. Returns {created, failed, links_added}.
update(graph, note_id, append_body?, replace_body?, new_type?, add_tags?, add_links?, add_aliases?, add_prerequisites?, synthesis_status?):
extend a note. body is an alias for replace_body here;
synthesis_status flips a spine node scaffold→materialized.
link(graph, source_id, target_id, relation, direction?, equation?, target_graph?):
link two notes.
attach(graph, note_id, tag, project?, synthesis_graph?): attach a claim to
its schema dimension (tag) in a spine-backed run; the server
resolves the dimension node, synthesis graph, relation, and edge
direction from the persisted structure (the scribe never decides it).
verify_grounding(graph, note_id): re-verify a method='data' grounding
by RE-COMPUTING it; a clean reproduce stamps the note verified.
add/attach accept project + synthesis_graph to select the
source's per-context extraction rubric. All return JSON.
Source code in zettelkasten/server.py
3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 | |
source ¶
source(action: Literal['fulltext', 'outline', 'verify', 'coverage', 'protocol', 'ingest', 'create', 'set_coverage', 'backfill', 'mark_extracted'], source: str = '', doc_type: str = '', max_chars: int = 200000, name: str = '', title: str = '', authors: list[str] | None = None, year: int | None = None, venue: str = '', doi: str = '', abstract: str = '', zotero_key: str = '', content_hash: str = '', source_path: str = '', relations: list[dict] | None = None, key: str = '', path: str = '', agent: str = '', human: str = '', apply: bool = False, link_floor: float = 0.45, schema: str = '', project: str = '', synthesis_graph: str = '', offset: int = 0, page_start: int | None = None, page_end: int | None = None, cache_full: bool = False, graph: str = '', slices: list[dict] | None = None, run_id: str = '') -> str
Use this when reading or writing sources: read (fulltext/outline/verify/coverage/protocol) or write (ingest/create/set_coverage/backfill/mark_extracted).
READ actions are always available; WRITE actions are refused at runtime when
write-free (ZK_DISABLE_WRITE).
Actions — name(required, optional?):
fulltext(source, max_chars?, offset?, page_start?, page_end?): extracted
full text; slice a book-scale source by offset (char start) or a
0-based page_start/page_end range. Reports
total_chars/num_pages/sliced.
outline(source): cached chapter outline + page index (empty when the
source has no detectable bookmarks).
verify(source): extraction QA report.
coverage(source, schema?, project?, synthesis_graph?): deterministic
Covered/Thin/Missing matrix over schema dimension tags (rubric from
schema or the run's persisted per-context rubric). Advisory,
model-independent.
protocol(doc_type): the extraction protocol for a doc_type (no source).
ingest(key?, path?, title?, max_chars?, cache_full?): resolve a paper to
full text + a stable hash; provide exactly one of key (Zotero),
path (local file), or title (Zotero lookup).
create(name, doc_type, title?, authors?, year?, venue?, doi?, abstract?, zotero_key?, content_hash?, source_path?, relations?):
create a source folder; dedups on content_hash.
set_coverage(source, agent?, human?): set agent/human coverage flags.
backfill(source, apply?, link_floor?): backfill grounded quotes for a source.
mark_extracted(graph, slices, project?, synthesis_graph?, schema?, content_hash?, run_id?):
record extracted slices (span dicts) onto the source's incremental
ledger so the efficiency pipeline skips already-mined regions
(graph = the source box).
All return JSON.
Source code in zettelkasten/server.py
3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 | |
dataset ¶
dataset(action: Literal['add', 'get', 'values', 'snapshot', 'attach'], graph: str = '', note_id: str = '', title: str = '', body: str = '', backend: str = '', format: str = '', path: str = '', content_hash: str = '', schema: list[dict] | None = None, fetch: dict | None = None, tags: list[str] | None = None, links: list[dict] | None = None, source_book: str = '', source_chapter: str = '', source_page: str = '', project: str = '', target_id: str = '', target_graph: str = '', relation: str = 'measures', offset: int = 0, limit: int = 200) -> str
Use this when working with numerical/tabular datasets attached to a source: add/get/values/snapshot/attach.
A dataset is a typed note whose numbers live OUT of the markdown (a committed
sidecar, a DVC-tracked file, or an API-fetched cache). READ actions are always
available; WRITE actions (add/attach) are refused at runtime when
write-free (ZK_DISABLE_WRITE).
Actions — name(required, optional?):
add(graph, title, body?, backend?, format?, path?, content_hash?, schema?, fetch?, tags?, links?, source_book?, source_chapter?, source_page?, project?):
create a dataset note with a storage pointer — backend =
sidecar|dvc|api (inferred), format = csv|json|parquet (inferred
from path), and either path (a file in the source folder) OR
fetch ({provider, params}).
get(graph, note_id): the note + resolved metadata (columns, row count,
backend, warnings) WITHOUT row data.
values(graph, note_id, offset?, limit?): resolve and return a paginated
rows payload (limit default 200).
snapshot(graph, note_id): re-read CURRENT source bytes and pin their hash
as content_hash (reproducible offline reads / realigning a declared
hash). Returns new + previous hash and whether it changed.
attach(graph, note_id, target_id, target_graph?, relation?): link the
dataset to a target (relation default measures; supports
grounds a claim, derives-from for a derived series).
All return JSON.
Source code in zettelkasten/server.py
4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 | |
graph ¶
graph(action: Literal['list', 'summary', 'project', 'create', 'export', 'import'], graph: str = '', project: str = '', name: str = '', description: str = '', source: str = '', relations: list[dict] | None = None, format: str = 'gexf', source_dir: str = '', out_dir: str = '') -> str
Use this when managing zettelkasten graphs: read (list/summary/project), create, or export/import.
Reads always available; create/import are refused at runtime when
write-free (ZK_DISABLE_WRITE); export is read-only.
Actions — name(required, optional?):
list(): all concept boxes.
summary(graph): summary of one box.
project(project): render a project's combined graph.
create(name, description?, source?, relations?): create a concept box.
export(graph, format?, out_dir?): READ-ONLY export of one box.
format="gexf" (default) returns a GEXF 1.2 document for
Gephi/networkx; format="obsidian" writes one .md per note
(frontmatter + Dataview wikilinks) under out_dir.
import(graph, source_dir, format?): bulk-import an Obsidian/markdown vault
(format="obsidian") into the box. Idempotent (dedup on
content_hash); notes land as epistemic_status=inferred. Under
ZK_PROPOSE_ONLY returns a dry-run manifest and writes nothing.
All return JSON.
Source code in zettelkasten/server.py
export_graph ¶
Export one box to GEXF or an Obsidian vault (read-only).
format="gexf" returns {format, graph, node_count, gexf} with the XML
document inline; format="obsidian" writes one .md per note under
out_dir (default <workspace>/export/<graph>-vault) and returns the
write manifest.
Source code in zettelkasten/server.py
import_graph ¶
Import an Obsidian/markdown vault at source_dir into the graph box.
Honors ZK_PROPOSE_ONLY (dry-run manifest, no canonical writes) and the
ZK_DISABLE_WRITE barrier (refused at runtime when not proposing).
Source code in zettelkasten/server.py
citation ¶
citation(action: Literal['create', 'dedup', 'promote', 'expand_corpus', 'expand', 'unlink', 'export_bibliography', 'export'], id: str = '', title: str = '', authors: list[str] | None = None, year: int = 0, doc_type: str = '', doi: str = '', zotero_key: str = '', citation_id: str = '', dry_run: bool | None = None, source: str = '', sources: list[str] | None = None, remove_global: bool = False, direction: str = 'both', limit: int = 25, project: str = '', format: str = 'bibtex') -> str
Use this when managing citations, expanding a corpus, or exporting a bibliography.
WRITE actions mutate _citations and are refused at runtime when write-free;
the read-only export_bibliography/export stays available even then.
Actions — name(required, optional?):
create(id, title, authors, year, doc_type?, doi?, zotero_key?, source?):
create a citation entity; source records it on that source's
references list.
dedup(dry_run?): dedup _citations (dry_run default true).
promote(citation_id): promote a citation to a full local source.
expand_corpus(citation_id?, zotero_key?): expand a citation's neighbourhood.
expand(source?, doi?, direction?, limit?, dry_run?): expand a source's
citation graph via OpenAlex (dry_run default false).
unlink(citation_id, sources?, remove_global?, dry_run?): remove a
citation's links (scoped to sources; remove_global=true also
DELETEs the global entity, refused when deletes are off).
export_bibliography / export (project?, format?): READ-ONLY bibliography
from a project's sources/citations. format = bibtex (default) |
formatted (author-year).
All return JSON.
Source code in zettelkasten/server.py
4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 | |
project ¶
project(action: Literal['create', 'add', 'add_cross', 'remove_cross', 'set_default_spine'], name: str = '', description: str = '', sources: list[str] | None = None, cross: list[str] | None = None, project: str = '', source: str = '', cross_id: str = '', org_id: str = '') -> str
Use this to create or wire up projects (WRITE): create, add a source, cross-link a synthesis note, or set a default spine. Structurally unregistered when write-free.
Cross membership is EXPLICIT: a synthesis note belongs to a project iff its id
is in the manifest's cross: list (one physical note in _cross/, many
references). default_spine is the parallel registry for organizing
STRUCTURES.
Actions — name(required, optional?):
create(name, description?, sources?, cross?): create a project.
add(project, source): add a source to a project.
add_cross(project, cross_id): claim a _cross note for a project.
remove_cross(project, cross_id): release a _cross note from a project.
set_default_spine(project, org_id?): point a project's default_spine at
org org_id; empty org_id clears it to the intrinsic lens.
All return JSON.
Source code in zettelkasten/server.py
spine ¶
spine(action: Literal['list', 'promote', 'demote', 'resync', 'verify', 'delete'], org_id: str = '', project: str = '', graph: str = '', tag_stamp: bool = False, semantic: bool = False) -> str
Use this to manage a spine's lifecycle: list, promote, demote, resync, verify, or delete.
A spine definition (an owner-scoped arrangement of the corpus) is either a
proposed lens (a read-only projection) or a materialized spine (a real
synthesis graph); this tool drives the transitions. Every op except list
targets one owner — pass project OR graph (not both). Set a project's
primary "Organize by" spine via project(action="set_default_spine").
Actions — name(required, optional?):
list(project): the spines/lenses in a project (read-only; same catalog as
schema(action="spines")).
promote(org_id, project?, graph?, tag_stamp?): materialize a proposed lens
into a spine graph (apex + one dimension per column + one hub per row,
bulk-attach members). tag_stamp (default OFF) also stamps each
member's dimension tag onto its base note. WRITE.
demote(org_id, project?, graph?): revert a spine to a lens while KEEPING
its graph/nodes/edges (non-destructive). WRITE.
resync(org_id, project?, graph?): incrementally route new/unrouted in-scope
notes into an existing spine (idempotent). WRITE.
verify(org_id, project?, graph?, semantic?): read-only synthesis audit
flagging cells whose members are missing/ungrounded. semantic=true
opts into a per-cell model call.
delete(org_id, project?, graph?): revert the definition to a lens and
delete its synthesis graph folder. Gated by the DELETE barrier. WRITE.
All return JSON.
Source code in zettelkasten/server.py
4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 | |
remine ¶
remine(action: Literal['propose', 'apply'], owner_type: str = '', owner_name: str = '', org_id: str = '', schema: str = '', intent: str = '', grid: dict | None = None, tag_stamp: bool = False, depth: int = 0) -> str
Use this when re-mining an org's corpus into its schema dimensions (propose → apply).
Two-phase, propose-first (the dashboard's approve-to-apply gate). Identify the
org with owner_type (project|graph) + owner_name + org_id.
apply is refused at runtime when write-free.
Actions — name(required, optional?):
propose(owner_type, owner_name, org_id, schema?, intent?, depth?):
READ-ONLY. Classify the org's row-axis scope into a matrix-shaped grid
(cells carry inferred members + a residual bucket); writes nothing.
An intent ("make a matrix for X") INDUCES columns from the corpus
(flagged induced=True) instead of the org's fixed dimensions;
depth>=1 (default 0) sub-clusters each induced column into
children (emergent columns only).
apply(owner_type, owner_name, org_id, grid, tag_stamp?): promote the
approved grid (the propose payload) via the attach seam, writing
spine-member edges. tag_stamp (default OFF) also stamps each
dimension tag onto members' base notes.
All return JSON.
Source code in zettelkasten/server.py
discover_spines ¶
Find materialized synthesis spines living in a project.
A spine is an apex node (tagged synthesis + extraction-synthesis)
with materialized dimension nodes (tagged extraction-dimension) rolling up
into it, plus an optional spec stub, in a dedicated synthesis graph. This scans
the project the caller is in and returns each spine as a concrete shape a schema
author can model or extend — so a new schema's synthesis block can mirror
the apex type and dimension tags that already exist, instead of leaning on a
shipped example.
Spines live in TWO places, and a complete answer must look at both:
- A LEGACY extraction spine (
coordinator.extraction.prep_spine) is registered as a project SOURCE — found by the sources scan. - A PROMOTED / PORTED spine (
organizations.promote_organizationor the lazy legacy port) is deliberately NOT a project source; it lives in the org registry as astate=='spine'org naming its synthesis graph inspine_ref(the spine CATALOG, per the "spines are additive/selectable layers, NOT project sources" decision). Under the current org model this is the majority case — a project whose spines are all promoted used to read back EMPTY here because only sources were scanned.
include_catalog (default True) unions the catalog's spine graphs into the
scan so BOTH kinds surface; a promoted/ported spine also carries its org_id/
org_title in the result. It is set False by the port_spines caller (which
injects this as its discover_fn): porting must see only source-registered
legacy spines, since stamping a promoted spine into the ported-marker would
wrongly re-register its graph as a source on a later delete.
project may be omitted when the repo has exactly one project (the common
case); otherwise the available project names are returned so the caller can
disambiguate.
Source code in zettelkasten/server.py
4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 | |
schema ¶
schema(action: Literal['list', 'get', 'spines', 'validate', 'save'], name: str = '', spec: dict | None = None, project: str = '') -> str
Use this when working with extraction schemas — the rubric a grounded-extraction run reads documents through: list/get/spines/validate/save.
A schema is a run's FOCUS LENS: named dimensions (each tag becomes a
note tag + cross-source comparison index), an optional relations backbone,
and an optional synthesis block that materializes a persistent spine (apex
+ one node per dimension) in a dedicated graph. You supply the judgment
(drafting from a goal, optionally after reading a sample via
source(action="fulltext")); this tool guarantees a valid block lands in the
registry. Author TWO deliberate policies: EXTRACTION (how claims come out —
dimensions + grounded/strict + hub) and SYNTHESIS (how they
roll up — a synthesis block, or a deliberate flat checklist; "no block"
must be a choice, not an omission). A declared synthesis spine is DONE only
once its apex/dimension prose is authored by hand (prep pre-creates empty nodes).
Actions — name(required, optional?):
list(): names of all registered schemas (package defaults + project).
get(name): the fully-expanded schema object.
spines(project?): discover materialized synthesis spines already living in
the project — legacy source spines AND promoted/ported catalog spines
(which carry their org_id/org_title). Call before authoring so a
new synthesis block mirrors existing structure.
validate(spec): expand a draft spec (raw schema block) WITHOUT writing;
returns the expanded object or a validation error.
save(name, spec): validate then write spec under name into the
project's extraction-schemas.yaml (overrides a built-in of the same
name). WRITE; refused when write-free. Restart the coordinator +
zettelkasten MCP servers to pick it up (registry cached at load).
A spec is the raw YAML block as a dict, e.g.::
{"description": "...", "grounded": true, "link_relation": "input-to",
"hub": {"type": "concept", "title_template": "{persona}: Profile"},
"dimensions": [{"tag": "attends-to", "desc": "..."}, ...],
"relations": [{"from": "ranking-rule", "to": "attends-to",
"relation": "depends-on"}],
"synthesis": {"graph": "{label}-profile",
"node": {"type": "synthesis", "title_template": "{label}: Profile",
"link_relation": "related"},
"dimension_node": {"type": "concept",
"title_template": "{label} - {dimension}",
"attach_relation": "input-to",
"relation": "component-of"}}}
Source code in zettelkasten/server.py
5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 | |
zotero ¶
zotero(action: Literal['lookup', 'collections', 'list', 'fetch_pdf'], query: str = '', key: str = '', collection: str = '', limit: int = 200, include_text: bool = True, include_annotations: bool = True) -> str
Use this when you need read-only Zotero library access: lookup, collections, list, or fetch a PDF.
Actions — name(required, optional?):
lookup(query): search the library by title/author/keyword.
collections(): list collections (folders) with key, name, path, parent, and
item count — browse what the library actually holds.
list(collection?, limit?): papers in a collection (key preferred, or name);
empty collection lists the most recently added top-level items
(limit default 200). Same summaries as lookup, ready for
fetch_pdf.
fetch_pdf(key, include_text?, include_annotations?): resolve a Zotero item
to its local PDF (full text + annotations).
All return JSON.
Source code in zettelkasten/server.py
review ¶
review(action: Literal['list', 'load', 'create', 'update', 'rename', 'delete', 'suggest_claims', 'propose_placements'], name: str = '', *, new_name: str = '', title: str = '', project: str = '', graph: str = '', question: str = '', ordering: list | None = None, set_tier: dict | None = None, exclude: list[str] | None = None, unexclude: list[str] | None = None, add_scaffold: dict | None = None, remove_scaffold: list[str] | None = None, rename_section: dict | None = None, set_section_note: dict | None = None, set_placement: dict | None = None, favorite: list[str] | None = None, unfavorite: list[str] | None = None, add_proposed_claim: dict | None = None, remove_proposed_claim: list[str] | None = None, add_proposed_theme: dict | None = None, remove_proposed_theme: list[str] | None = None, remove_derived_theme: list[str] | None = None, restore_derived_theme: list[str] | None = None, text: str = '', top_k: int = 0, granularity: int = 50, whole_pool: bool = False) -> str
Use this when reading or authoring a literature-review overlay (the _reviews/ editorial layer).
A review is a curated, theme-structured narrative over the corpus with two
separate halves: the PROJECTION (a deterministic, LLM-free view of the corpus
into themes + a top-level unplaced worklist, recomputed on every read) and
the OVERLAY (the author's durable editorial decisions stored as ID-references —
the SOURCE OF TRUTH; load reconciles it onto a fresh projection). Scope is
LOCAL-REPO ONLY; writes are crash-safe (per-review lock, atomic rename,
debounced zettelkasten-mcp commit, path-traversal-validated name).
Actions — name(required, optional?):
list(): every local review manifest. Read-only.
load(name): the reconciled view (fresh projection + applied overlay);
returns {"error", "type":"NotFound"} for an unknown review.
create(name, title?, project?, graph?, question?): create (idempotent) the
manifest; initial ordering seeded from the projection order.
update(name, title?, question?, project?, graph?, ordering?, set_tier?, exclude?, unexclude?, add_scaffold?, remove_scaffold?, rename_section?, set_section_note?, set_placement?, favorite?, unfavorite?, add_proposed_claim?, remove_proposed_claim?, add_proposed_theme?, remove_proposed_theme?, remove_derived_theme?, restore_derived_theme?):
apply any combination of overlay mutations. project/graph change
the projection SCOPE (re-projects on next load); set_placement
{uid: theme_id} drags a claim into a theme (None returns it to
Unplaced); the add_proposed_*/remove_proposed_* families draft
themes/claims that live ONLY in the overlay until the user promotes them.
rename(name, new_name): change the slug (moves manifest + regenerable
sidecars); refuses a colliding name.
delete(name): remove the review (durable overlay + regenerable outline).
Idempotent; the only NON-regenerable destructive action — gated by the
DELETE barrier (refused when ZK_DISABLE_DELETE/WRITE).
suggest_claims(name, text, top_k?): rank the corpus's EXISTING claims by
similarity to a text topic (read-only).
propose_placements(name, granularity?, whole_pool?): propose homes for
unplaced claims — an existing theme or a clustered new-theme pitch
(read-only). granularity 10..90 (default 50) tunes clustering (low =
fewer/broader, high = more/narrower); whole_pool clusters EVERY
in-scope claim as fresh topics.
All return JSON.
Source code in zettelkasten/server.py
5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 | |
claim ¶
claim(action: Literal['create', 'delete', 'delete_theme', 'materialize', 'materialize_theme', 'propose', 'test', 'discover_contradictions', 'debate_map', 'find_supersessions'], claim_id: str = '', *, title: str = '', body: str | None = None, supports: list | None = None, contradicts: list | None = None, quotes: list | None = None, members: list | None = None, tags: list[str] | None = None, source: dict | None = None, status: str = '', confidence: float | None = None, theme: str = '', text: str = '', project: str = '', graph: str = '', top_k: int = 0, force: bool = False) -> str
Use this when producing grounded claims and landscape themes in the _cross graph (write + read/compute).
The WRITE companion to the read-only Claims engine (build_claims /
claim_anatomy): it AUTHORS new claims but never fabricates text/quotes/
stances — the caller supplies the grounded sentence (title + body),
member/evidence ids, and verbatim quotes; the tool wires them into the data
model. The three FIRST-CLASS-WRITE actions (create, materialize,
materialize_theme) mint real _cross entities and obey the PROPOSE-ONLY
barrier (refused under ZK_PROPOSE_ONLY/ZK_DISABLE_WRITE with
{"type":"ProposeOnly"} — draft via review('update') instead); the
read/compute actions stay available. Scope is LOCAL-REPO ONLY; writes are
crash-safe.
Actions — name(required, optional?):
create(title, claim_id?, body?, supports?, contradicts?, quotes?, tags?, source?, status?, confidence?, project?):
create-or-overwrite a grounded claim note (omit claim_id to mint
from the title). supports/contradicts are member refs
({id, graph, confidence?} or bare id) authored as stance edges. WRITE.
delete(claim_id): SOFT-delete a claim (status=discarded, reversible) and
tombstone its stance edges. NOT a hard delete.
delete_theme(claim_id): SOFT-delete a landscape concept hub (reverse of
materialize_theme); NOT gated by PROPOSE-ONLY (reversible).
materialize(claim_id, title, body?, supports?, contradicts?, quotes?, tags?, source?, confidence?, project?):
idempotently accept a claim proposal — create plus verbatim
quote notes. Requires a stable claim_id. WRITE.
materialize_theme(claim_id, title, members?, project?): idempotently
materialize a landscape concept hub whose surveys edges bundle
members (work-id strings or {id, graph?}). WRITE.
propose(theme, project?, graph?, top_k?, force?): MINE grounded claim
candidates for a theme (landscape hub id) for the author to accept.
READ/COMPUTE only (cached per theme+graph-signature; force bypasses).
test(text, project?, graph?, top_k?): TEST a hypothesis against the corpus —
gathers evidence, stance-classifies, returns a verdict
(supported|contested|refuted|untested-in-corpus) + for/against tally +
a promote descriptor. READ/COMPUTE only (quotes retrieved, never
generated).
discover_contradictions(project?, graph?): DISCOVER candidate contradictions
between claims (precision-first). READ/COMPUTE only; returns ranked
proposals with gated promote descriptors.
debate_map(project?, graph?): aggregate stance edges into a dashboard
tension graph (nodes = claims; camps = connected components over
contradicts edges). READ only.
find_supersessions(project?, graph?): propose belief-revision supersedes
edges (B supersedes A when B contradicts A, is stronger + newer, and
support overlaps). READ/COMPUTE only.
On the write actions project auto-claims the minted _cross note for
that project (explicit membership); on the read/compute actions it scopes the
corpus (graph takes priority). top_k=0 means each action's own engine
default. All return JSON.
Source code in zettelkasten/server.py
5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 | |
create_project ¶
create_project(name: str, description: str, sources: list[str] | None = None, cross: list[str] | None = None) -> str
Create a project manifest in _projects/.
Projects group multiple source graphs for composite analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Project name (kebab-case, e.g. 'portfolio-theory') |
required |
description
|
str
|
What this project studies |
required |
sources
|
list[str] | None
|
Optional initial list of source graph names to include |
None
|
cross
|
list[str] | None
|
Optional initial list of |
None
|
Source code in zettelkasten/server.py
add_cross_to_project ¶
Claim a _cross note id for a project (append to its cross: list).
Explicit membership: a synthesis note belongs to a project iff its id is in
the manifest's cross: list. The same id may be claimed by several
projects (the "crosses projects" case) — one physical note, many references,
no copies. Idempotent.
Source code in zettelkasten/server.py
remove_cross_from_project ¶
Release a _cross note id from a project's cross: list.
Removes only the reference (the note itself and every other project's claim on it are untouched). Idempotent: removing an unclaimed id is a no-op.
Source code in zettelkasten/server.py
set_default_spine_for_project ¶
Set (or clear) a project's default_spine pointer (the primary org).
The spine directory's counterpart to :func:add_cross_to_project: org_id
names the project-owned org that is the project's primary organizing principle
(its "Organize by" default). An EMPTY org_id clears the pointer back to the
implicit intrinsic lens (the organic cluster graph, which has no org record).
Idempotent. Mirrors the cross write path: load → set → rewrite the manifest,
under the project's write lock.
A non-empty org_id is VALIDATED before it is written: it must resolve to an
existing project-owned org, so the pointer can never be set to a name that
dangles from the moment it is written (the deletion-time clears in
organizations guard the other direction). An empty org_id always clears.
LOCKING (defects A+B). The whole validate-then-write runs under the project's
OWNER lock — review_write_lock(organizations._owner_lock_name('project', P))
— the EXACT same (non-reentrant) lock delete_organization /
save_organization / ensure_migrated take. This guarantees set and the
clear-on-delete are MUTUALLY EXCLUSIVE (a delete that clears default_spine
can never interleave between this function's existence check and its pointer
write), and that exactly ONE lock is held (the dispatch no longer wraps this in
project::P, so there is no double-acquire). Because the owner lock is taken
here, the existence re-check inside it uses migrate=False (a migrate=True
load would re-enter ensure_migrated and re-acquire this very lock → deadlock);
any un-absorbed legacy tables are migrated ONCE up front, outside the lock.
Source code in zettelkasten/server.py
5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 | |
add_to_project ¶
Add a source graph to a project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name |
required |
source
|
str
|
Source graph name to add |
required |
Source code in zettelkasten/server.py
get_extraction_protocol ¶
Get extraction guidance for a document type.
Returns recommended note types to extract and strategies for different kinds of source material, plus a cross-cutting evidence protocol describing how notes must be backed by direct quotes (preferring the user's Zotero highlights) and that quotes are RETRIEVED, never generated. create_source embeds this automatically; call this directly to re-fetch the protocol mid-extraction without recreating the source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc_type
|
str
|
One of 'journal-article', 'book', 'working-paper', 'report', 'review', 'blog' |
required |
Source code in zettelkasten/server.py
zotero_lookup ¶
Search the user's Zotero library by title or author.
Requires ZOTERO_USER_ID and ZOTERO_API_KEY env vars to be configured.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search term (title, author, keyword) |
required |
Source code in zettelkasten/server.py
zotero_fetch_pdf ¶
Fetch a paper's full-text PDF from the LOCAL Zotero install.
Resolves a Zotero item key (the zotero_key stored on a source or citation)
to its PDF attachment on disk, returning the absolute file path plus the
extracted text and any saved highlights/notes. Reads the local Zotero data
dir (~/Zotero, override with ZOTERO_DATA_DIR) directly — no API key needed
and works offline. Unlike zotero_lookup (Web API, metadata only), this
gives full text for deep extraction into the zettelkasten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Zotero item key (top-level item; its PDF attachment is resolved automatically) |
required |
include_text
|
bool
|
Extract the PDF's text (needs pypdf; falls back to path-only with a warning) |
True
|
include_annotations
|
bool
|
Include saved highlights/notes from local storage |
True
|
Source code in zettelkasten/server.py
zotero_collections ¶
List the Zotero library's collections (folders) for browsing.
Local-first (reads ~/Zotero, override with ZOTERO_DATA_DIR) with a Web API fallback when ZOTERO_USER_ID/ZOTERO_API_KEY are set. Each collection reports its key, name, full path, parent key, and top-level item count — so you can see how the library is organized instead of only guessing keyword searches.
Source code in zettelkasten/server.py
zotero_list_items ¶
List the papers in a Zotero collection (or the whole library).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
str
|
A collection key (preferred) or name (case-insensitive). Empty lists the most recently added top-level items library-wide. |
''
|
limit
|
int
|
Maximum items to return (default 200). |
200
|
Source code in zettelkasten/server.py
backfill_quotes ¶
Retroactively capture verbatim quote notes from saved Zotero highlights.
Sources extracted before the quote-evidence protocol carry paraphrased
claim/finding notes but no verbatim quotes. This walks such sources, pulls the
user's saved Zotero highlights, and materializes each as a quote note whose
body is the verbatim text and whose source.page is the highlight's pageLabel —
linked supports to the claim/finding it best matches (by embedding
similarity, the same backend as semantic_search). Highlights are RETRIEVED,
never generated; a highlight below link_floor is still preserved as an
unlinked quote rather than mis-attributed. Idempotent: a highlight already
captured as a quote note is skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
A single source folder to backfill; empty = every source with a zotero_key. |
''
|
apply
|
bool
|
Dry run when False (default) — reports the plan without writing. Set True to actually create the quote notes and their links. |
False
|
link_floor
|
float
|
Minimum similarity (0-1) to link a highlight to a claim; below it the quote is created unlinked. |
0.45
|
Source code in zettelkasten/server.py
ingest_source ¶
ingest_source(key: str = '', path: str = '', title: str = '', max_chars: int = 200000, cache_full: bool = False) -> str
Canonical source front door: resolve a paper to full text + a stable hash.
Provide exactly one of: key (a Zotero item key), path (a local file —
absolute, cwd-relative, or a bare filename under ZK_SOURCES_DIR), or title
(looked up in Zotero; a single match resolves automatically, otherwise the
candidate list is returned). Extracts the full text and any saved annotations,
computes a stable content_hash (sha256 of the file bytes), caches the text
for later offline reuse, and reports existing_source when a source already
carries that hash.
Feed content_hash, source_path, and zotero_key from the result into
create_source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Zotero item key (preferred path; find it via zotero_lookup) |
''
|
path
|
str
|
Local file path (fallback path) |
''
|
title
|
str
|
Title to look up in Zotero |
''
|
max_chars
|
int
|
Maximum characters of text to extract (default 200000) |
200000
|
cache_full
|
bool
|
Cache the WHOLE document (plus a page/outline sidecar) while
still returning at most |
False
|
Source code in zettelkasten/server.py
get_fulltext ¶
get_fulltext(source: str, max_chars: int = 200000, offset: int = 0, page_start: 'int | None' = None, page_end: 'int | None' = None) -> str
Return a source's cached full text (or a window of it), re-deriving cold.
Reads the disposable cache at .angelo/zettel/fulltext/source_path, else zotero_key) and repopulates the cache — so the
reference is reproducible offline without re-fetching from Zotero.
For book-scale sources the cache holds the WHOLE document; pass offset (char
start) or a page_start/page_end range (0-based, inclusive end) to read a
later slice. The result reports total_chars, num_pages, and sliced so a
reader knows there is more beyond the returned window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Source graph name (folder under .zettelkasten/) |
required |
max_chars
|
int
|
Maximum characters to return in this window (default 200000) |
200000
|
offset
|
int
|
Char index to start reading from (default 0). Ignored when a page range is given and a page table exists. |
0
|
page_start
|
'int | None'
|
0-based first page of the window (needs a cached page index). |
None
|
page_end
|
'int | None'
|
0-based last page of the window, inclusive. |
None
|
Source code in zettelkasten/server.py
6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 | |
get_source_outline ¶
Return a source's cached chapter outline + page index, if any.
Reads the disposable <content_hash>.pages.json sidecar. Returns
{source, content_hash, num_pages, total_chars, outline} where each outline
entry is {title, page, char_offset}. outline is empty for sources with no
detectable bookmarks (papers, un-bookmarked PDFs, plain text) — the caller
then falls back to char-window slicing.
Source code in zettelkasten/server.py
project_search ¶
project_search(query: str, top_k: int = 10, project: str = '', since: str = '', until: str = '') -> str
Semantic search across all sources in a project (merged embeddings).
If project is empty, searches ALL source graphs + _cross/ globally. When the global ANN index is enabled (default), a broad scope is served by a single pre-filtered vector search rather than a per-box fan-out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Natural language search query |
required |
top_k
|
int
|
Number of results to return (default 10) |
10
|
project
|
str
|
Project name (empty = search all graphs) |
''
|
since
|
str
|
Optional inclusive lower date bound ( |
''
|
until
|
str
|
Optional inclusive upper date bound (filled to the end of its
period, so |
''
|
Source code in zettelkasten/server.py
6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 | |
query_topic ¶
query_topic(project: str, topic: str, top_k: int = 15, raw: bool = False, since: str = '', until: str = '') -> str
Use this when you want to research a topic across project sources and get structured output.
Finds relevant notes, groups by type, identifies disagreements between sources, and flags coverage warnings for under-reviewed sources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name (with raw=True, empty = search ALL graphs) |
required |
topic
|
str
|
Research topic or question |
required |
top_k
|
int
|
Number of notes to retrieve (default 15) |
15
|
raw
|
bool
|
If true, return a flat semantic-search result list across the project's sources (no grouping/disagreement analysis) |
False
|
since
|
str
|
Optional inclusive lower date bound ( |
''
|
until
|
str
|
Optional inclusive upper date bound (filled to the end of its
period, so |
''
|
Source code in zettelkasten/server.py
6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 | |
frame_question ¶
frame_question(question: str, project: str = '', facets: list[str] | None = None, max_facets: int = 5, per_facet_k: int = 12, thin_min_results: int = 2, thin_min_similarity: float = 0.15) -> str
Use this when you want to reframe the existing corpus along the axis of a research question.
Projects what you already have (sources, notes, landscape hubs) through a question to show the landscape: it decomposes the question into facets, semantically retrieves the relevant notes per facet, characterizes each facet as established (substantive claims/findings, no recorded contradiction), contested (carries contradicts/qualifies edges), or thin (little relevant material — a gap for this question), and bundles the citations each facet's evidence references. No data is written; this is a read-only lens over the graph.
Facets come from one of two places
- if
facetsis given, those strings are used (let the agent decompose the question into sub-questions and pass them here); otherwise - facets are derived from the existing landscape
concepthubs most relevant to the question — i.e. the field's own decomposition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
question
|
str
|
The research question to frame. |
required |
project
|
str
|
Project name to scope sources; empty frames across everything. |
''
|
facets
|
list[str] | None
|
Optional explicit sub-question/facet strings (agent-decomposed). |
None
|
max_facets
|
int
|
Max auto-derived facets when |
5
|
per_facet_k
|
int
|
Notes retrieved per facet. |
12
|
thin_min_results
|
int
|
Fewer results than this marks a facet 'thin' (a gap). |
2
|
thin_min_similarity
|
float
|
Top similarity below this marks a facet 'thin'. |
0.15
|
Source code in zettelkasten/server.py
guide ¶
guide(action: Literal['apply', 'next'] = 'apply', project: str = '', graph: str = '', params: dict | None = None) -> str
Use this when navigating conditional requirement notes as a decision tree (codes/standards/assumptions).
A normative document (a building code, an engineering standard, a quant
model's assumptions) extracted under the reference-standard schema is a
graph of requirement notes, each optionally carrying an applies_when
block ({condition, predicate?}). Given a design parameter context this
walks that graph, prunes branches whose predicates are definitively false,
and returns the applicable clauses with their grounding quotes + citations —
the compact, cited bundle a simulator feeds itself instead of re-reading the
source. Read-only; nothing is written.
Scope the walk with EITHER graph (one source/synthesis graph name) OR
project (its sources walked as a forest). params is the design
context, e.g. {"seismic_category": "D", "height_m": 32, "material":
"steel"}; predicates are ANDed and compared with a whitelisted evaluator
(>= > <= < == != in / not in) — never arbitrary code. A node is
unresolved when it has a human condition but no machine predicate, or a
predicate referencing a param absent from params.
Actions — name(required, optional?):
apply(project?, graph?, params?): [default] the full pruned bundle —
nodes (each kept node with its evidence + children uids),
roots, and flat applicable/unresolved/excluded uid lists.
next(project?, graph?, params?): the shallowest UNRESOLVED decision for an
interactive step-through; its missing_params name what to supply.
Provide either project or graph. Read-only; all return JSON.
Source code in zettelkasten/server.py
synapse ¶
synapse(action: Literal['search', 'frame', 'get', 'connections', 'matrix', 'synthesize', 'debate', 'navigate', 'build'], query: str = '', question: str = '', node_id: str = '', projects: list[str] | None = None, top_k: int = 15, max_nodes: int = -1, hops: int = -1, trace_floor: float = -1.0, token_budget: int = -1, render_max_body_chars: int = -1, expand: bool = False, max_sources: int = -1, facets: list[str] | None = None, max_facets: int = 5, per_facet_k: int = 12, thin_min_results: int = 2, thin_min_similarity: float = 0.15, min_confidence: float = -1.0, synthesize: bool = False, max_rows: int = 60, max_columns: int = 60, per_node_k: int | None = None, sim_threshold: float = 0.45, max_pairs: int = 200, kind: str = 'generic', overfetch: int | None = None, model: str = '') -> str
Use this when working across stores: the layer linking the memory tree (.memory/, episodic "practice") and the zettelkasten (propositional "canon").
Read-only except build (which writes only synapse's own overlay, never
.memory/ or .zettelkasten/). Scope is the intersecting ZK projects:
omit projects for the configured intersection, pass a list to override, or
[] for memory only. Hits are tagged store (memory|zk) and tier
(practice|canon). search/frame/build/navigate run
OUT-OF-PROCESS to contain native-kglite SIGSEGVs (mapped to a clean
NativeCrash); SYNAPSE_INPROCESS_READ=1 forces the in-process read
path (search/frame only).
Actions — name(required, optional?):
search(query, projects?, top_k?, expand?, max_sources?): hybrid RRF-fused
search across both stores; expand also pulls each hit's cross-store
neighbours.
frame(question, projects?, facets?, max_facets?, per_facet_k?, thin_min_results?, thin_min_similarity?, max_sources?):
frame a research question into facets (established/contested/thin).
get(node_id): read the FULL body of a MEMORY entry (for a ZK note use
get_note).
connections(node_id, min_confidence?): typed cross-store edges touching a
node.
matrix(projects?, min_confidence?, synthesize?, max_rows?, max_columns?, kind?):
project the overlay as a practice × canon matrix; synthesize adds
LLM row/column/apex summaries; kind="claim" uses the claim-aligned
overlay.
synthesize(projects?, min_confidence?, max_rows?, max_columns?): grounded
per-cell briefs over the CLAIM overlay (cites memory ids + retrieved
quotes, invents nothing).
debate(projects?): the claim debate map fed with cross-store
counter-evidence (practice nodes that contradict a canon claim).
navigate(question, projects?, max_nodes?, hops?, trace_floor?, token_budget?, render_max_body_chars?, model?): run the
grounded cross-store navigation loop — assemble a neighborhood for
question, then let the deterministic Navigator steer an LLM to an
ANSWER/ABSTAIN verdict it can never fabricate. READ-ONLY (no
CANONICAL-store writes — .memory/, .zettelkasten/, the link
overlay, .synapse/ — though, like search/frame, the
disposable .angelo/ embedding cache may still be written/warmed on
a cold assembly) and runs OUT-OF-PROCESS (the agent bridge and cold
kglite assembly cannot run in the stdio server; a native crash maps to
a clean NativeCrash). Any assembly or model failure degrades to a
labeled abstain. max_nodes=-1 uses the default neighborhood cap,
0 removes the caller-specified count cap while retaining a
token-derived pre-assembly safety ceiling, and >0 sets an explicit
hard cap shared by assembly and Navigator expansion. hops>0 enables
pre-loop neighborhood expansion;
trace_floor tunes the router's prose gate. token_budget raises/lowers the navigator's
hard per-run token guardrail and render_max_body_chars caps the
SHOWN body length (a positive value elides long bodies to a lossy view
the ground move re-fetches in full, so a body-heavy neighborhood
no longer halts on budget before the model is called; 0 disables
elision). render_max_body_chars bounds per-node body DEPTH, NOT
neighborhood WIDTH — a wide hub (many neighbors) is bounded by
token_budget / max_nodes, never by this knob. Each defers to
the navigator default when unset (negative). model requests a
Cursor model id; the bridge forwards it without claiming that the
provider exposed a resolved runtime model.
Returns the verdict, wire status, reasons, halted_reason,
conclusion, serialized envelope, and hop/renavigation telemetry.
Accepted answers additionally carry a deterministic versioned
answer_surface containing display text, epistemic status, resolved
citation addresses, and inseparable outdated disclosure. Every
abstention/failure carries answer_surface: null.
build(projects?, per_node_k?, sim_threshold?, min_confidence?, max_pairs?, kind?, overfetch?):
(re)build the connection overlay (semantic NN + shared provenance,
LLM-typed) to .synapse/links/. WRITE, refused when write-free.
kind="claim" builds the claim-aligned overlay (overfetch widens
recall).
max_sources=-1 (default) uses the synapse config; 0 disables source
pruning; a positive value caps it (memory always in scope). All return JSON.
Source code in zettelkasten/server.py
7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 | |