Skip to content

[v2] Cognitive Lattice: Build Recursion Depth Detector #663

Description

@SHAURYASANYAL3

Phase 4: Cognitive Lattice

The Context

Agents sometimes get trapped in internal self-reflection loops: "I think I should... but wait, my previous reasoning was wrong... let me reconsider." This burns tokens and stalls execution.

Tasks

  • Implement RecursionDepthDetector.
  • Maintain a rolling buffer of the agent's raw reasoning text for the last N steps.
  • Define a list of self-referential regex patterns (e.g., r"i think i should", r"let me reconsider", r"i was wrong about").
  • Count occurrences of these patterns. If the count exceeds the threshold (e.g., > 5 per 10 steps), flag a cognitive violation and block further execution.

Part of Epic #651

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions