Documentation
Nity Loop
Overview

Nity Loop — Overview

The autonomous loop system enables iterative development with safety mechanisms. Located at extensions/nity-loop/.

Components

  • LoopEngine — Iteration executor with progress streaming
  • CircuitBreaker — Stagnation detection with CLOSED/HALF_OPEN/OPEN states
  • ResponseAnalyzer — Exit signal detection, stuck-loop detection, confidence scoring
  • Exit Strategiesauto, fix_plan, done_signals, circuit_breaker

Loop Flow

task
  → analyze (task-analyzer)
  → plan (strategy-planner)
  → execute loop (loop-engine)
      → check circuit breaker
      → run iteration
      → analyze response (response-analyzer)
      → check exit condition
      → update circuit breaker
      → stream progress
      → repeat until done
  → record episode
  → reflect

The loop is not infinite by design. Every loop has a max iteration count, a circuit breaker with stagnation thresholds, and an exit strategy. Safety is not optional.

Safety Architecture

The loop system enforces three layers of safety:

LayerMechanismPurpose
Hard limitmaxIterationsAbsolute ceiling on iterations
Stagnation detectionCircuit BreakerStops when progress halts
Signal detectionResponse AnalyzerRecognizes completion or stuck states

Integration Points

The loop engine integrates with:

  • Nity Coordinator — Receives tasks, returns results
  • Quality Gates — Validates output before accepting
  • Episode Recorder — Logs each iteration's outcome
  • Progress Tracker — Streams status to TUI and external clients