Skip to content

Maintainer Architecture Notes

Source mirrored from seocho/docs/MAINTAINER_ARCHITECTURE_NOTES.md

This page keeps maintainer-facing architecture notes that were previously mixed into the public overview. Start with /docs/architecture/ for the public map.

/docs/architecture/ should help a new user understand SEOCHO quickly. This page keeps lower-level migration notes, priority boards, and ownership guidance for contributors who are changing internals.

Use this page when you are touching runtime boundaries, query orchestration, ontology contracts, or compatibility shims.

PriorityWorkCurrent direction
P0runtime contract stabilityisolate OpenAI Agents SDK calls behind an adapter and preserve response payload shape
P0real database agent provisioningcreate agents only for reachable graph targets and expose degraded state
P1graph query durabilitykeep Cypher templates compatible with Neo4j/DozerDB warnings and elementId() assumptions
P1process isolation and healthseparate API readiness from batch/notebook readiness
P1agent readiness state machinenormalize graph agents to ready, degraded, or blocked
P2governance automationkeep /rules/assess and ontology artifact checks as promotion gates

Architecture changes are not done until a user can run the activation path:

  1. ingest raw data through /platform/ingest/raw
  2. ensure semantic indexes
  3. ask semantic/debate questions
  4. inspect trace and runtime payload
  5. pass the relevant smoke gate

Current canonical seams:

FlowSeam
local SDK ingestSeocho.add() -> _LocalEngine -> IngestionFacade -> IndexingPipeline
runtime semantic compositionruntime/server_runtime.py builds SemanticAgentFlow through seocho.query.AgentFactory
runtime graph readsruntime/memory_service.py routes reads through seocho.query.QueryProxy
runtime readinessruntime.agent_readiness.summarize_readiness() normalizes agent state

The legacy debate specialist-agent factory in extraction/agent_factory.py still exists for compatibility. It is not the desired canonical factory seam for new query behavior.

Ontology is a first-class SDK primitive, but it should not behave as one large implementation file.

ModuleResponsibility
src/seocho/ontology.pypublic Ontology, NodeDef, RelDef, P, schema validation, prompt-facing API
src/seocho/ontology_context.pyontology context hash, compact descriptors, graph-write metadata, query guardrails
src/seocho/ontology_serialization.pyJSON-LD load/save helpers
src/seocho/ontology_artifacts.pyapproved artifacts, semantic prompt context, vocabulary shaping
src/seocho/ontology_governance.pyoffline check, diff, export, OWL inspection

Canonical direction:

  • keep public API compatibility centered on Ontology
  • share explicit ontology-side contracts between SDK and runtime
  • keep heavy OWL and governance work out of request-time code

Related contracts:

  • docs/ONTOLOGY_RUN_CONTEXT_STRATEGY.md
  • docs/PROPERTY_GRAPH_LENS_STRATEGY.md

Seocho should remain a public facade, not a second home for engine logic.

ModuleRole
src/seocho/client.pypublic SDK facade and orchestration entrypoints
src/seocho/http_transport.pyHTTP wrapping and exception mapping
src/seocho/client_artifacts.pyontology-to-runtime artifact bridge
src/seocho/query/*canonical query behavior
src/seocho/agent/*agent runtime contracts

Keep constructor and top-level calls stable. Move transport, artifact bridge, and local engine internals out of client.py over incremental slices.

The extraction layer is being reduced toward transport, provisioning, and compatibility roles.

ClassificationPaths
shim nowextraction/rule_constraints.py, extraction/vector_store.py
compatibility alias nowextraction/agent_server.py, extraction/agent_readiness.py, extraction/middleware.py, extraction/memory_service.py, extraction/public_memory_api.py, extraction/server_runtime.py, extraction/policy.py, extraction/runtime_ingest.py
keep as runtime compositionruntime/agent_server.py, runtime/agent_readiness.py, runtime/middleware.py, runtime/memory_service.py, runtime/public_memory_api.py, runtime/server_runtime.py, runtime/runtime_ingest.py
shared canonical helperssrc/seocho/index/runtime_memory.py, src/seocho/index/runtime_artifacts.py, src/seocho/index/extraction_engine.py

src/seocho/index/extraction_engine.py owns shared extraction prompt rendering, linking prompt rendering, and graph payload normalization for SDK, compatibility pipeline, and runtime ingest setup.

Measure quality in two tracks:

TrackPurpose
private finance corpusingestion, graph construction, finance-domain QA
GraphRAG-Benchretrieval, evidence quality, reasoning

Measurement order:

  1. SEOCHO local SDK baseline
  2. SEOCHO runtime baseline
  3. peer baselines

This prevents deployment overhead from being confused with canonical engine quality. See docs/BENCHMARKS.md.

DatabaseRegistry validates database names and keeps the runtime database allowlist.

from config import db_registry
db_registry.register("mydb01")
db_registry.is_valid("mydb01")
db_registry.list_databases()

Name validation: ^[A-Za-z][A-Za-z0-9]*$.

GraphRegistry maps graph_id values to database, URI, ontology, and vocabulary descriptors.

from config import graph_registry
graph_registry.list_graph_ids()
graph_registry.get_graph("kgfibo")

Debate mode should fan out by graph_id, not only by database name.

AgentFactory creates tools bound to a specific graph target. SharedMemory is request-scoped and stores per-agent conclusions, cached query results, and synthesis inputs.

Keep these constraints:

  • create exactly one shared memory object per request
  • keep graph target context bound to each tool
  • do not hide connector failures as empty graph results
  • report degraded state when a graph target is skipped
ChangeValidation
runtime shell or aliasesbash scripts/ci/check-runtime-shell-contract.sh
module ownershipbash scripts/ci/check-module-ownership-contract.sh
docs contractbash scripts/ci/check-doc-contracts.sh and python3 scripts/ci/check_doc_structure.py
public site mirrorwebsite docs checks in website/ and tteon.github.io
shared behaviorbash scripts/ci/run_basic_ci.sh

If a live dependency is unavailable, record it as a validation gap. Do not replace a live-readiness or performance claim with mock evidence.