Skip to content

feat(loop-context): implement semantic frustration circuit breaker#337

Merged
cobusgreyling merged 1 commit into
cobusgreyling:mainfrom
THRISHAL12345:feat-loop-context-frustration
Jul 21, 2026
Merged

feat(loop-context): implement semantic frustration circuit breaker#337
cobusgreyling merged 1 commit into
cobusgreyling:mainfrom
THRISHAL12345:feat-loop-context-frustration

Conversation

@THRISHAL12345

Copy link
Copy Markdown
Contributor

Summary

Introduces a semantic "frustration" circuit breaker to loop-context that detects when an agent loops repeatedly on the same semantic action (even if yielding different errors) and escalates before draining the token budget.

Changes

  • New pattern or starter (followed templates/pattern-template.md + updated registry.yaml)
  • Doc / example improvement
  • Tool change (loop-context)
  • Story (includes real failure or surprise + lesson)

Checklist (from CONTRIBUTING)

  • All required sections present for patterns
  • Links work from README, patterns/README, starters/README, docs/index
  • No secrets, tokens, internal company URLs
  • STATE.md* examples use .example suffix
  • Safety-related content references docs/safety.md
  • Ran node tools/loop-audit/dist/cli.js . (or on the starter) and addressed findings

Testing / Dogfood

  • loop-audit passes on affected starters or this repo
  • Manual review of generated state / skill output
  • Added rigorous unit tests in loop-context/test/context-manager.test.mjs verifying semantic similarity triggers.

Screenshots / Examples (if UI or command output)

When an agent repeats semantically similar actions without success, the circuit breaker now outputs:

{
  "shouldContinue": false,
  "escalate": true,
  "trigger": "frustration",
  "reason": "Semantic looping detected: agent repeated highly similar action 3× in a row (threshold 3): \"Try to fix the syntax error\". Escalating.",
  "iterations": 3,
  "tokensUsed": 15000
}

@cobusgreyling
cobusgreyling merged commit 9b90b48 into cobusgreyling:main Jul 21, 2026
2 checks passed
@cobusgreyling

Copy link
Copy Markdown
Owner

Thanks @THRISHAL12345 — merged; published as loop-context@1.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants