Phase 4 adds the intelligence layer between the existing knowledge engine and the existing distributed AgentRun runtime. It does not replace retrieval, GraphRAG, gap analysis, the Agent Harness, task leases, retries, or worker scheduling.
flowchart LR
K1["Knowledge Intelligence"] -->|"snapshot + KnowledgeGap"| I["Investigation Engine"]
I -->|"InvestigationPlan + ready task wave"| D["Distributed Runtime"]
D -->|"AgentRun"| H["Agent Harness"]
H -->|"InvestigationResult + Evidence"| I
I -->|"verified KnowledgeUpdate"| K1
ResearchObjectiverecords the question, scope, constraints, success criteria, metadata, identifier, and creation time.InvestigationSessionis an explicitPLANNING → EXECUTING → EVALUATING → UPDATINGstate machine with paused and terminal states.KnowledgeSnapshotcaptures retrieval references, GraphRAG entities and relations, gaps, contradiction keys, uncertainty, and observation metadata.CandidateInvestigationis a deterministic transformation of a measurable gap. It records the hypothesis, evidence need, capability requirements, gain, cost, time, risk, and priority.InvestigationPlanvalidates dependencies and compiles to distributed task contracts.Evidence,Evaluation,VerificationReport,InvestigationKnowledgeUpdate, andProgressReportmake the epistemic result inspectable rather than concatenating agent text.
All identifiers and important state are serializable. SQLiteInvestigationRepository
persists the objective, session, iteration, and ordered artifacts. A process restart
can reload collected InvestigationResult and EvidenceSet values and continue
evaluation without rerunning completed agents.
InvestigationApplication exposes independently callable stages:
observegeneratescoreselectbuild_planstart_execution/advance_executioncollect_evidenceevaluateverifyupdate_knowledgefinish_iteration
plan_iteration and process_results are thin compositions of those services. They
do not hide an unbounded research loop.
The high-level CLI is also thin:
nexus-research create QUESTION --criterion CRITERION
nexus-research status SESSION_ID
nexus-research pause SESSION_ID
nexus-research resume SESSION_ID
nexus-research cancel SESSION_ID
nexus-research explain SESSION_ID
nexus-research evidence SESSION_ID
nexus-research gaps SESSION_ID
nexus-research plan SESSION_ID
nexus-research iterations SESSION_ID
The current distributed record intentionally has no dependency field. The
investigation layer therefore submits only dependency-ready waves. It never assigns a
worker, claims a lease, retries an attempt, or executes an agent. When a parent task
succeeds, PlanExecutionController submits newly ready children through
RuntimeApplication. A cancelled or dead-lettered parent marks descendants blocked
in the persisted plan execution rather than pretending they ran.
The first wave can contain many independent tasks, allowing the distributed scheduler to place them concurrently according to required capabilities.
explain reconstructs three decision chains:
- gap → gain/importance/uncertainty/cost/risk → score → selection;
- claim → evidence → source lineage → evaluation → verification;
- termination reason → objective confidence → gaps → contradictions → budget.
Structured events use the investigation.* namespace and preserve objective/session
correlation. Metrics include sessions, iterations, gaps discovered and resolved,
generated/executed investigations, evidence, contradictions, updates, information
gain, and cost per resolved gap.
Run the deterministic 10/50/10 baseline with:
nexus-investigation-benchSee lifecycle, planning, evidence, provenance, verification, and closed loop.