Stuck-Loop & Dead-End Detector
Spots when an agent gets the exact same failure twice and stops wasted retries.
An agent hits a broken external dependency and burns 60% extra LLM tokens repeating the same edit.
After 2 identical failures, Convergence halts cleanly (HALT_SAME_SAW_REPEATED) and explains the dead end.
What It Does (In Plain English)
Normal agents happily bang their head against the same failing error 10 times in a row, burning dollars. Convergence fingerprints what the agent expected vs. what it actually saw (EXPECTED / SAW / FENCE / DEAD ENDS), feeds clear structured feedback on failure, and halts early if the exact same failure repeats.
Real-World Example
- 1Agent runs tests and sees
TypeError: missing billingConfig.taxRate. - 2Agent tweaks a comment, re-runs tests, and gets the exact same failure fingerprint.
- 3Convergence injects the
DEAD ENDSreminder so the agent knows not to repeat that path. - 4If it hits the identical error again, Convergence stops the run to save tokens and escalate.
When Should You Turn It On?
Pair with working-state on multi-step coding, troubleshooting, or retry workflows.
Safety level note: Level 1 · Review — Read-only. Can inspect and answer, never changes outside systems.
How to Add It (workspace.yaml)
kits:
- "@neusym/kit-convergence@0.1.0"
kitConfigs:
convergence:
maxSameSawRepeats: 2Kits It Works With
Technical Details & Configuration Options (5 settings)
| Package | @neusym/kit-convergence |
|---|---|
| Provides Ports | convergence@1 |
| Requires Ports | tasks@1 |
| Optional Ports | artifacts@1secrets@1notifier@1working-state@1 |
| Publishes Events | convergence.stalled |
| Owned DB Collections | convergence_ledgers |
Configuration Options (kitConfigs.convergence)
| Setting | Type | Default | Description |
|---|---|---|---|
maxSameSawRepeats | integer | 2 | Number of identical SAW fingerprints in a scope that triggers stagnation halt. |
maxDeadEnds | integer | 12 | Maximum dead-end attempts retained per scope ledger. |
maxSawChars | integer | 1000 | Maximum characters retained per redacted SAW summary. |
autoTrackTaskFailures | boolean | false | When true, terminal task failures automatically record a provisional convergence attempt for the task's goal (else its scope, else the task); a richer record of the same task, such as the planner's per-step one, replaces it. |
autoTrackToolFailures | boolean | false | When true, failed action.completed events automatically record a convergence attempt. |