v3/docs/adr/ADR-347-trajectory-quality-judge-scoring.md
Ruflo's SONA intelligence pipeline uses a 4-step RETRIEVE→JUDGE→DISTILL→CONSOLIDATE loop. The JUDGE step currently assigns binary verdicts: success or failure per trajectory step. This was sufficient when short-horizon tasks dominated agent workloads.
Two 2026 findings change that calculus:
Additionally, Chronological Awareness scores (0.204–0.290 for frontier LLMs, mem0.ai State of AI Agent Memory 2026) reveal a systemic temporal reasoning weakness that binary verdicts cannot surface or train against.
Replace the binary JUDGE verdict in ReasoningBank with a 5-dimension trajectory quality score (TQS):
| Dimension | Range | Definition |
|---|---|---|
temporal_coherence | 0.0–1.0 | Fraction of steps with correct chronological ordering of prior events |
tool_call_accuracy | 0.0–1.0 | Ratio of tool calls that returned expected outputs vs. errors/retries |
horizon_persistence | 0.0–1.0 | Step at which agent diverges from correct path / total steps attempted |
partial_progress_ratio | 0.0–1.0 | Sub-goals completed / total sub-goals (even on failed trajectories) |
contradiction_resolution | 0.0–1.0 | Fraction of conflicting-instruction episodes resolved without halt |
Aggregate score: TQS = 0.25·temporal + 0.25·tool + 0.20·horizon + 0.20·partial + 0.10·contradiction
TQS ≥ 0.80 = success, 0.40–0.79 = partial, < 0.40 = failure. The existing binary success/failure field is preserved for backward compatibility but computed from TQS threshold.
Contamination guard: ReasoningBank stores the benchmark scaffold hash alongside each trajectory. If the same scaffold hash recurs across ≥3 trajectories with identical tool call sequences, the JUDGE flags the run as potentially contaminated and down-weights the TQS by 0.5 before DISTILL.
Positive:
Negative:
partial_progress_ratio requires sub-goal decomposition at task ingestion — tasks without explicit sub-goals default to 0.5 (neutral) until decomposed.verdict: "success"|"failure" becomes verdict: { tqs: number, dimensions: {...}, binary: "success"|"partial"|"failure" }. Migration required for existing stored trajectories (default: set tqs=1.0 for historical success, tqs=0.0 for historical failure).Neutral:
// v3/@claude-flow/memory/src/reasoningbank/judge.ts
interface TrajectoryQualityScore {
temporal_coherence: number; // 0.0-1.0
tool_call_accuracy: number;
horizon_persistence: number;
partial_progress_ratio: number;
contradiction_resolution: number;
aggregate: number; // weighted sum
binary: 'success' | 'partial' | 'failure';
contamination_flag: boolean;
scaffold_hash?: string;
}
function judgeTrajectory(steps: TrajectoryStep[]): TrajectoryQualityScore {
// compute 5 dimensions then aggregate
}
Files affected:
v3/@claude-flow/memory/src/reasoningbank/judge.ts (new TQS logic)v3/@claude-flow/memory/src/reasoningbank/types.ts (schema update)v3/@claude-flow/memory/src/reasoningbank/migrate.ts (historical default migration)v3/@claude-flow/hooks/src/workers/ultralearn.ts (consume TQS dimensions)