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 Strategies —
auto,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
→ reflectThe 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:
| Layer | Mechanism | Purpose |
|---|---|---|
| Hard limit | maxIterations | Absolute ceiling on iterations |
| Stagnation detection | Circuit Breaker | Stops when progress halts |
| Signal detection | Response Analyzer | Recognizes 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