Skip to content

Commit e0373bd

Browse files
keli-wenclaude
andcommitted
docs(design): add Mermaid class + flow diagrams to navigation design
Two single-purpose diagrams, each answering one reader question: - classDiagram in "Navigation Tree Base and Paper Binding": the type model — NavigationTree base, TreeKnowledge/PaperNavigationTree subclasses, TreeNode/ Citation composition, and lineage to PaperSourceRevision/PaperChunkSet. - flowchart in a new "Design at a Glance": the cross-package spine (preprocess -> flows -> knowledge -> library -> mind) with a dotted hybrid branch, distinguishing deterministic/code stages from the model stage and marking where embeddings enter. Theme-neutral (no hardcoded colors), labels match the prose identifiers, and package boundaries use subgraphs. First exemplar toward a shared Mermaid convention for contexts/design. Refs #122, #95, #71. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c0dbdcc commit e0373bd

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

contexts/design/mind/navigation.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
## Contents
2424

2525
- [Motivation](#motivation)
26+
- [Design at a Glance](#design-at-a-glance)
2627
- [Ownership](#ownership)
2728
- [Navigation Tree Base and Paper Binding](#navigation-tree-base-and-paper-binding)
2829
- [Build Pipeline](#build-pipeline)
@@ -49,6 +50,44 @@ page provenance. `quantmind.knowledge` already records this as the purpose of
4950
`TreeKnowledge`, and embeddings there "act as a coarse pre-filter, never as a
5051
replacement for that reasoning."
5152

53+
## Design at a Glance
54+
55+
The build spine is solid; the dotted branch is the later hybrid path that adds
56+
embeddings. Each package owns one stage, and every deterministic or code-owned
57+
stage carries no model call.
58+
59+
```mermaid
60+
flowchart TD
61+
PD["ParsedDocument (page-aware)"]
62+
subgraph PRE["preprocess — deterministic"]
63+
OUT["outline signals: TOC / headings / page offset"]
64+
end
65+
subgraph FLW["flows"]
66+
DRAFT["draft structuring agent (model, private draft)"]
67+
end
68+
subgraph KNW["knowledge"]
69+
FD["PaperNavigationTree.from_draft() (code): mint ids, links, citations + validate() gate"]
70+
end
71+
subgraph LIB["library"]
72+
PUT["put artifact: paper_artifacts (no embeddings)"]
73+
PROJ["per-node projections (embeddings)"]
74+
SRCH["search(SemanticQuery)"]
75+
RES["resolve(locator): page-cited content"]
76+
end
77+
subgraph MND["mind"]
78+
NAV["navigate(tree, question): single-pass / agentic"]
79+
end
80+
PD --> OUT
81+
OUT --> DRAFT
82+
DRAFT --> FD
83+
FD --> PUT
84+
PUT --> NAV
85+
NAV -->|get_node_content| RES
86+
PUT -.->|P2 projections| PROJ
87+
PROJ -.->|candidates| SRCH
88+
SRCH -.->|seed_locators| NAV
89+
```
90+
5291
## Ownership
5392

5493
Each existing package keeps its responsibility; only agentic traversal introduces
@@ -70,6 +109,53 @@ LLM dependency and hosts no PageIndex draft producer.
70109
The tree structure is shared across document types; the identity binding is not.
71110
The design factors the two apart so the codebase keeps exactly one tree, not two.
72111

112+
```mermaid
113+
classDiagram
114+
class NavigationTree {
115+
<<structural base>>
116+
+UUID root_node_id
117+
+Map nodes
118+
+root()
119+
+children_of()
120+
+walk_dfs()
121+
+find_path()
122+
+validate()
123+
}
124+
class TreeNode {
125+
+UUID node_id
126+
+UUID parent_id
127+
+str title
128+
+str summary
129+
}
130+
class Citation {
131+
+int page
132+
+UUID node_id
133+
}
134+
class BaseKnowledge {
135+
<<canonical identity>>
136+
}
137+
class TreeKnowledge
138+
class PaperNavigationTree {
139+
+PaperArtifactKind artifact_kind
140+
+UUID source_revision_id
141+
+str producer_config_hash
142+
+str content_hash
143+
+from_draft()
144+
}
145+
class PaperSourceRevision {
146+
<<source-first anchor>>
147+
}
148+
class PaperChunkSet
149+
150+
NavigationTree <|-- TreeKnowledge
151+
BaseKnowledge <|-- TreeKnowledge
152+
NavigationTree <|-- PaperNavigationTree
153+
NavigationTree *-- TreeNode : nodes
154+
TreeNode *-- Citation : citations
155+
PaperNavigationTree ..> PaperSourceRevision : source_revision_id
156+
PaperNavigationTree ..> PaperChunkSet : lineage
157+
```
158+
73159
`NavigationTree` is a structural base — a plain `BaseModel` with no
74160
`BaseKnowledge` identity: `root_node_id: UUID`, `nodes: dict[UUID, TreeNode]`, the
75161
navigation surface (`root()`, `children_of()`, `walk_dfs()`, `find_path()`), and

0 commit comments

Comments
 (0)