ruvnet/ruflo · error

[Prime Radiant] RAG coherence warning: ${coherence.violation

Error message

[Prime Radiant] RAG coherence warning: ${coherence.violations.join(', ')}

What it means

Warning branch of the pre-rag-retrieval hook in PrimeRadiantPlugin: retrieved context vectors failed the coherence check with listed violations. The retrieval proceeds, but the context may induce hallucinations and is surfaced as a warning.

Source

Thrown at v3/plugins/prime-radiant/src/plugin.ts:1247

  private createPreRagRetrievalHook(): PluginHook {
    return {
      name: 'pr/pre-rag-retrieval',
      event: 'pre-rag-retrieval',
      priority: 100 as HookPriority,
      description: 'Checks retrieved context coherence to prevent hallucinations',
      handler: async (_context: PluginContext, payload: unknown) => {
        const retrieval = payload as {
          retrievedDocs: Array<{ embedding: number[] }>;
        };

        const vectors = retrieval.retrievedDocs.map((d) => new Float32Array(d.embedding));

        if (vectors.length < 2) return payload;

        const coherence = await this.bridge.checkCoherence(vectors);

        if (coherence.energy > 0.5) {
          console.warn(
            `[Prime Radiant] RAG coherence warning: ${coherence.violations.join(', ')}`
          );

          return {
            ...retrieval,
            retrievedDocs: retrieval.retrievedDocs.slice(
              0,
              Math.ceil(retrieval.retrievedDocs.length / 2)
            ),
            coherenceFiltered: true,
            originalCoherenceEnergy: coherence.energy,
          };
        }

        return payload;
      },
    };
  }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Inspect the listed coherence violations and revise or remove the offending RAG documents/chunks.
  2. Re-embed documents with the current embedding model if they were embedded with an older one.
  3. Adjust coherence thresholds if the violations are false positives.
Defensive patterns

Strategy: validation

When it happens

Trigger: RAG retrieval/insertion violates one or more coherence constraints (contradictory or low-coherence context); violations are joined into the warning for inspection.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/adb81f25adfc8c6f. Report an issue: GitHub.