Skip to content

[v2] Cognitive Lattice: Build Goal Drift Detector #659

Description

@SHAURYASANYAL3

Phase 4: Cognitive Lattice

The Context

The Cognitive Lattice replaces the v1 LLM Auditor by using deterministic math to measure the "sanity" of the agent. The #1 cause of silent agent failure is "Goal Drift"—the agent starts on one task and wanders off into unrelated codebases. We will detect this using embedding similarities.

Tasks

  • Implement GoalDriftDetector.
  • Use sentence-transformers (e.g., all-MiniLM-L6-v2) to encode the initial user goal and the agent's recent steps into embeddings.
  • Calculate the rolling cosine similarity between the last N steps and the original goal.
  • Implement a threshold invariant:
    • < 0.4 -> Healthy
    • 0.4 - 0.7 -> Warning
    • > 0.7 -> Degraded (Hard block the action).
  • Ensure embedding models run locally to minimize latency overhead.

Part of Epic #651

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions