arborist/docs/diagrams/aborist-modules.dot
russell@unturf.com de07ad9392
docs: distill #000008+#000009+#000010 into core docs + diagrams
Three Explore agents fanned out in parallel for a docs/ + diagrams/
+ code-comment audit against the shipped state of the three
preflight tickets. This commit lands all the alignment fixes.

Core docs updates:

  CLAUDE.md
    - dag.py module description: stage counts now read
      "7/8 quote · 9/10 CTI · 3 reject" reflecting #000009 preflight
      stage + reject-broad early-return shape.

  docs/cti-architecture.md §2.2 + §2.3
    - §2.3 Merkle-AGI-DAG section rewritten: documents all five DAG
      shapes (legacy 7/9, post-#000009 8/10, reject-broad 3),
      describes the preflight stage's 5 nested CTI clauses
      (classifier / answer_contract / prompt_contract /
      evidence_contract / policy_refs), pins
      PREFLIGHT_NODE_VERSION = "preflight-node-v1", states the
      audit-replay payoff.
    - §2.2 CTI section: adds the four new modules
      (quantifier, model_profiles, quantifier_reminder,
      metacognition) as code anchors. Notes that pre-answer
      preflight contract extends CTI upstream of retrieval.

  docs/seven-point-program.md
    - D3 status ½ → ¾ — pre-answer preflight contract landed via
      #000008 + #000010. Code anchors + pinning tests updated.
    - D4 status ½ → ¾ — preflight stage adds upstream control
      commitment to the run-DAG. Code anchors include
      build_reject_run_dag + preflight_node_hash.
    - Status snapshot table: tickets column now references
      #000008/#000009/#000010 against D1/D3/D4 directives.
    - "Post-landing addendum (2026-05-03 / 2026-05-04)" subsection
      summarises all three tickets + their commit shas + final
      test count (993 passing, up from 734).

  docs/modules.md
    - Q&A pipeline table: added 4 new modules (quantifier.py,
      model_profiles.py, quantifier_reminder.py, metacognition.py).
      dag.py row updated to "7/8 quote · 9/10 CTI · 3 reject".
    - dag.py subsection rewritten: documents all 5 DAG shapes,
      describes the preflight payload's 5 clauses + question_state.
    - 4 new module subsections (quantifier / model_profiles /
      quantifier_reminder / metacognition) explaining each
      module's purpose, signature, and how it feeds the run-DAG
      preflight clause.

Diagram updates:

  docs/diagrams/query-pipeline.dot + .svg
    - New "PREFLIGHT (#000008 + #000010)" node inserted between
      cache_check and concepts_lookup.
    - New "REJECT-BROAD" node showing the 3-stage minimal DAG
      escape path.
    - render node label extended with the audit-line tail token
      catalog.

  docs/diagrams/aborist-modules.dot + .svg
    - 4 new qa_* nodes in the retrieval & verifier cluster.
    - 8 new edges: qa_query/qa_runner each call into all 4
      preflight modules; qa_dag has dotted edges to qa_quantifier
      + qa_metacognition (preflight clause sources).
    - qa_dag label updated to mention preflight_node_hash + 5 clauses.

  docs/diagrams/verifier-ladder.dot + .svg
    - Soft-demote violations list extended: BROAD_QUANTIFIER_RUNAWAY
      / CAP_APPLIED / SCOPE_UNBOUND, FORMAT_COLLAPSED, BARE_NAME_CLAIM.
    - New "AUDIT-LINE TAILS" annotation node listing all 11 tail
      tokens (#000008 broad-* + #000010 metacog + classic verifier).
    - Dashed edges from each rung to tails note showing tails
      compose onto labels.

Code-side stale-comment fixes (caught by 3rd Explore agent):

  aborist/qa/keys.py:218
    - "The four fields" → "The seven fields"; mention #000010 adds
      six more for metacognition.
  aborist/qa/query.py:2644
    - 7-stage / 9-stage comment expanded to enumerate all four
      base+preflight shapes plus the 3-stage reject path.
  aborist/qa/runner.py:835
    - same expansion as query.py for runner.ask() callsite.

mesh-*.dot, ingest-pipeline.dot, qa-modes-bench.md, bench-maxing.md,
bench-emergent-design.md, verifier-semantic-gap-design.md,
self-reference-design.md, concept-relations-design.md confirmed
orthogonal — no edits needed.

993 tests still passing (no behavior change). 7 files modified
across docs/ + 3 dot diagrams + 3 SVGs + 4 code-comment fixes.
2026-05-03 19:18:22 -04:00

144 lines
6.2 KiB
Text

// Aborist module graph — top-level packages & their dependencies.
//
// Arrows point in the import direction (A → B means A imports from B).
// Cluster boxes group modules with shared concerns (storage, retrieval,
// federation, etc.).
//
// Render: dot -Tsvg aborist-modules.dot -o aborist-modules.svg
digraph aborist_modules {
rankdir=LR
node [shape=box, style="rounded,filled", fontname="Helvetica", fontsize=10]
edge [fontname="Helvetica", fontsize=9]
bgcolor="white"
// ---- Substrate (pure crypto / serialization, no SQL) ----
subgraph cluster_substrate {
label="substrate"
style="rounded,dashed"
color="#999999"
merkle [label="merkle.py\n(Python port of Go merkle.go)", fillcolor="#fff7e6"]
document [label="document.py\nDocument · Edge · Chunker", fillcolor="#fff7e6"]
wikitext [label="wikitext.py\nto_base() prose-strip", fillcolor="#fff7e6"]
}
// ---- Storage layer ----
subgraph cluster_storage {
label="storage"
style="rounded,dashed"
color="#999999"
store [label="store.py\nv9.8 SQLite schema +\naudit chain helpers", fillcolor="#e6f0ff"]
ingest [label="ingest.py\nnormalize → chunk → merkle → upsert", fillcolor="#e6f0ff"]
evict [label="evict.py\nhot ↔ cold tier", fillcolor="#e6f0ff"]
}
// ---- Sources (corpus producers) ----
subgraph cluster_sources {
label="sources/"
style="rounded,dashed"
color="#999999"
wikipedia [label="wikipedia.py\ncur + old SQL dumps", fillcolor="#e7ffe7"]
wiki_xml [label="wikipedia_xml.py\nphase IV iterparse", fillcolor="#e7ffe7"]
html_page [label="html_page.py\nselectolax + httpx", fillcolor="#e7ffe7"]
crawler [label="crawler/\nasync HTML BFS", fillcolor="#e7ffe7"]
grok [label="grok.py\nxAI export", fillcolor="#e7ffe7"]
vcs [label="vcs.py\ngit + Mercurial", fillcolor="#e7ffe7"]
}
// ---- Retrieval & verifier ----
subgraph cluster_retrieval {
label="retrieval & verifier"
style="rounded,dashed"
color="#999999"
search [label="search/\nFTS5 backend + ABC", fillcolor="#ffe6f0"]
concepts [label="concepts/\nsynonym & rivalry overlay\n(per-shard concept_relations)", fillcolor="#ffe6f0"]
qa_query [label="qa/query.py\nmulti-source RAG", fillcolor="#ffe6f0"]
qa_verify [label="qa/verify.py\nquote/span/entity/paraphrase\n+ claim_lattice (7 hard checks)", fillcolor="#ffe6f0"]
qa_warrant[label="qa/warrant.py\n5 anchor classes\n(proper-noun · date · count\n · entity-list · cause)", fillcolor="#ffe6f0"]
qa_evidence[label="qa/evidence.py\nEvidenceObject + spotlight", fillcolor="#ffe6f0"]
qa_runner [label="qa/runner.py\nask(): single-doc Q&A", fillcolor="#ffe6f0"]
qa_dag [label="qa/dag.py\nper-run Merkle DAG\n(7/8 quote · 9/10 CTI · 3 reject)\npreflight_node_hash + 5 clauses", fillcolor="#ffe6f0"]
qa_keys [label="qa/keys.py\n8-dim cache_key + question_hash", fillcolor="#ffe6f0"]
qa_inspect[label="qa/inspect.py\nsidecar diagnostic\n(read-only)", fillcolor="#ffe6f0"]
// Preflight modules (Tickets #000008 + #000010)
qa_quantifier [label="qa/quantifier.py\n10-rung intensity classifier\n(#000008)", fillcolor="#ffe6f0"]
qa_model_profiles [label="qa/model_profiles.py\nper-model claim-cap profiles\n(#000008)", fillcolor="#ffe6f0"]
qa_quantifier_reminder[label="qa/quantifier_reminder.py\nbroad-query reminder text\n(#000008)", fillcolor="#ffe6f0"]
qa_metacognition [label="qa/metacognition.py\nQuestionState + 4 detectors\n(temporal · contradiction ·\n false-premise · out-of-corpus)\n(#000010)", fillcolor="#ffe6f0"]
}
// ---- Distill (surface → core) ----
distill [label="distill/\nDistiller ABC + tfidf + first_sentence", fillcolor="#fff0e0"]
// ---- Federation (off by default) ----
mesh [label="mesh/\nfederation: identity, roster,\nAEAD epoch secret, gossip wire", fillcolor="#f0e6ff"]
// ---- Entry point ----
cli [label="cli.py\nargparse entrypoint\n(make targets call into here)", fillcolor="#dddddd", shape=note]
// Substrate dependencies
document -> merkle
store -> merkle
store -> document
ingest -> store
ingest -> document
// Sources -> ingest path
wikipedia -> ingest
wiki_xml -> ingest
html_page -> ingest [label="parse_html →\nedges rows"]
crawler -> html_page
grok -> ingest
vcs -> ingest
// Retrieval pipeline
qa_query -> search
qa_query -> concepts [label="synonym_expand /\nrivalry_excluded"]
qa_query -> qa_keys
qa_query -> qa_verify
qa_query -> qa_evidence
qa_query -> qa_dag
qa_query -> wikitext [label="to_base()"]
qa_verify -> qa_warrant
qa_verify -> qa_evidence
qa_runner -> qa_query
qa_inspect -> qa_query [style=dashed, label="read-only sidecar"]
// Preflight wiring (#000008 + #000010 → #000009 DAG binding)
qa_query -> qa_quantifier [label="classify_question_quantifier"]
qa_query -> qa_model_profiles [label="cap_for_intensity"]
qa_query -> qa_quantifier_reminder [label="broad_quantifier_reminder"]
qa_query -> qa_metacognition [label="preflight_question"]
qa_runner -> qa_quantifier
qa_runner -> qa_model_profiles
qa_runner -> qa_quantifier_reminder
qa_runner -> qa_metacognition
qa_dag -> qa_quantifier [style=dotted, label="preflight clause"]
qa_dag -> qa_metacognition [style=dotted, label="preflight clause"]
// Concepts reads existing edges
concepts -> store [label="reads edges,\nwrites concept_relations"]
// Search reads chunks
search -> store
// Distill consumes store, writes derivations
distill -> store
distill -> document
// Eviction
evict -> store
// Mesh
mesh -> store
// CLI dispatches everywhere
cli -> ingest
cli -> qa_runner
cli -> qa_query
cli -> qa_inspect
cli -> distill
cli -> evict
cli -> mesh
cli -> concepts
}