Files

4.7 KiB

1. Shared Protocol Components

  • 1.1 Extract stateless JSON payload and Executor evidence parsing components into neutral com.superbiz.agent.diagnosis.protocol, preserving legal no-evidence behavior and introducing no dependency on Graph, Hook, ChatService, or ThreadLocal.
  • 1.2 Extract Verifier and Composer output parsers, effective-verdict calculation, Composer safe-input construction, and deterministic safe rendering from ChatService.
  • 1.3 Make VerifierInputHook and ChatService delegate to the shared components without changing their public methods or legacy payload/output behavior.
  • 1.4 Run VerifierInputHookTest, ChatServiceSequentialAgentTest, and ExecutorGatekeeperServiceTest after the extraction and fix only behavior regressions in scope.

2. Agent Invocation And Adapters

  • 2.1 Implement constructor-injected DiagnosisAgentInvoker and a ReactAgent wrapper that forwards the exact input and RunnableConfig and returns AssistantMessage text, without adding a second Prompt/Agent factory.
  • 2.2 Implement a fail-closed, injectable Node failure classifier for invalid output, retryable invocation failure, and non-retryable failure.
  • 2.3 Implement Planner adapter with NORMAL/EVIDENCE_GAP_ONLY input projection, structured plan parsing, status mapping, and one event per attempt.
  • 2.4 Implement Executor adapter with incremental retry instructions, legal no-evidence completion, no technical retry, and complete-snapshot output parsing.
  • 2.5 Add focused adapter tests proving input whitelists, RunnableConfig identity, failure classification, event shape, legal no-evidence handling, and absence of parent-state leakage.

3. Gatekeeper And Verified Projection

  • 3.1 Implement the explicit Gatekeeper Node using current runId and ExecutorGatekeeperService.validateRun, preserving raw result separately from normalized status.
  • 3.2 Normalize missing, unknown, inconsistent, and exceptional Gatekeeper results to REJECT and record a deterministic reason code.
  • 3.3 Implement Verified Input Builder matching passed bindings by claim/invocation/tool/path and projecting only filtered claims plus matched-text evidence.
  • 3.4 Add mixed-binding tests proving one Gatekeeper call, correct PASS/LOW_CONFID/REJECT normalization, precise pass projection, and exclusion of failed, unreferenced, hypothesis, tool-summary, and raw materials.

4. Verifier, Evidence Retry, Composer And Fallback

  • 4.1 Implement Verifier adapter with whitelisted verified input, separate execution/model/effective fields, ceiling enforcement, and byte-identical technical retry input.
  • 4.2 Implement shared EvidenceGapExtractor and update DiagnosisGraphRouter so only critical no-evidence/indirect-support facts qualify.
  • 4.3 Implement Evidence Retry Prepare Node with prior verified data, structured gaps, deduplicated completed query refs, bounded constraints, and planner retry reset.
  • 4.4 Implement Composer adapter and safe-input builder with byte-identical technical retry input and no raw Executor/tool access.
  • 4.5 Implement distinct deterministic pre-verification and post-verification Fallback inputs/rendering with their allowed-material boundaries.
  • 4.6 Add focused tests for ceiling, fixed retry inputs, non-critical gap rejection, critical gap context, no Java claim merge, and both Fallback safety boundaries.

5. Real Graph Assembly

  • 5.1 Extend the diagnosis action set/factory to construct a CompiledGraph from the real Agent and deterministic Node dependencies without registering legacy VerifierInputHook on the Graph Verifier.
  • 5.2 Add CompiledGraph integration tests for PASS, legal no-evidence, Gatekeeper REJECT/LOW_CONFID, critical evidence retry, exhausted Agent technical retry, and Composer fallback paths.
  • 5.3 Verify Graph events/transitions, per-node invocation counts, same-input retries, one full-snapshot Gatekeeper revalidation after evidence retry, and bounded termination.
  • 5.4 Confirm the first completed Node module and final assembly against design/specs, with no core TODO or placeholder implementation.

6. Stage 2 Verification And Handoff

  • 6.1 Run new Node/Graph focused tests plus DiagnosisGraphRoutingTest and DiagnosisOrchestrationTraceBuilderTest.
  • 6.2 Run legacy focused regressions ChatServiceSequentialAgentTest, VerifierInputHookTest, and ExecutorGatekeeperServiceTest, then run Maven test compilation.
  • 6.3 Run OpenSpec strict validation, git diff --check, and source/reference checks proving ChatService does not invoke the real Graph and no DB/Trace/Prompt contract changed.
  • 6.4 Record that Maven live E2E, logs/, and database verification were intentionally not run in stage 2 and are reserved for stage 5.