Skip to content

feat: Circuit Breaker Pattern and UX Improvements (v2.0.0)#4

Merged
itz4blitz merged 12 commits intomainfrom
feature/circuit-breaker-and-ux-improvements
Jan 28, 2026
Merged

feat: Circuit Breaker Pattern and UX Improvements (v2.0.0)#4
itz4blitz merged 12 commits intomainfrom
feature/circuit-breaker-and-ux-improvements

Conversation

@itz4blitz
Copy link
Owner

🎯 Overview

This PR introduces significant reliability and user experience improvements to agentful, including a circuit breaker pattern to prevent infinite loops, simplified command structure, and real-time progress indicators.

This is a breaking change and will be released as v2.0.0.

🚀 What's New

Circuit Breaker Pattern

  • Prevents infinite loops by tracking consecutive failures
  • Auto-trips after 3 failures on the same task
  • Adds blocking decision to decisions.json with recovery options
  • Continues with other work instead of getting stuck
  • 1-minute cooldown period before retry

Impact: Reduces token waste and prevents stuck agents from burning resources.

Simplified Command Structure

  • Primary Commands: 3 essentials (start, status, decide)
  • When-Needed Commands: Contextual (validate, product, generate)
  • Advanced Commands: Power-user features (analyze, init, agents)
  • Clear "When to Use" guidance for each command

Impact: Reduces choice paralysis and makes agentful more approachable.

Progress Indicators

  • Phase-based progress: Planning → Implementation → Testing → Complete
  • Incremental updates every 2 minutes max
  • Specific file creation notifications
  • Visual progress bars with checkmarks
  • Estimated remaining work when appropriate

Impact: Users get real-time visibility into agent work, reducing "is it stuck?" anxiety.

Enhanced Documentation

  • Updated CLAUDE.md with new command structure
  • Added circuit breaker troubleshooting
  • Added progress indicator expectations
  • Clearer command organization

📋 Breaking Changes

State File Structure

  • state.json now includes circuit_breaker object
    {
      "circuit_breaker": {
        "consecutive_failures": 0,
        "last_failure_task": null,
        "last_failure_time": null,
        "state": "closed"
      }
    }

Migration Notes

  • Existing state.json files will continue to work (circuit breaker defaults to closed state)
  • No manual migration needed
  • New projects will get circuit breaker automatically

🔧 Technical Details

Circuit Breaker Logic

// Before task execution
if (!shouldAttemptTask(currentTask, state)) {
  console.log("⚠️ Circuit breaker is open. Skipping task");
  pickNextTask();
  return;
}

// After task completion
if (taskSuccessful) {
  recordSuccess(currentTask, state);
} else {
  action = recordFailure(currentTask, error, state);
  if (action === "tripped") {
    console.log("🔴 Circuit breaker tripped. Added to decisions.json");
    pickNextTask();  // Continue with other work
    return;
  }
}

Progress Indicator Pattern

▶ Backend Agent: Implementing feature

[Planning] Analyzing requirements...
  ✓ Understood task scope
  → Checking existing patterns...

[Implementation] Creating backend code...
  ✓ Created service layer
  ✓ Added API endpoints
  → Implementing database schema...

✅ Test Plan

  • Circuit breaker triggers after 3 failures
  • Circuit breaker adds decision to decisions.json
  • Progress indicators show incremental updates
  • Commands simplified in template
  • Documentation updated
  • Integration tests with orchestrator
  • End-to-end test with real workflow

📚 Documentation

  • Updated template/.claude/agents/orchestrator.md with circuit breaker pattern
  • Updated template/.claude/agents/backend.md with progress indicators
  • Updated template/.claude/agents/frontend.md with progress indicators
  • Updated template/.claude/commands/agentful.md with simplified commands
  • Updated template/CLAUDE.md with new structure and troubleshooting

🎯 Next Steps

This PR is part of the v2.0.0 release. Future PRs will add:

  • MCP server implementation
  • Vector database integration
  • Enhanced error recovery dashboard
  • Quick-start templates

📊 Version Bump

  • Current: v1.4.0
  • Target: v2.0.0 (major version due to breaking changes)

Co-authored-by: agentful agentful@itz4blitz.com

itz4blitz and others added 12 commits January 25, 2026 15:02
Added three hook files that were referenced in settings.json but missing from the template:
- session-start.js: Intelligent context awareness on session start
- context-awareness.js: Alternative context awareness implementation
- post-action-suggestions.js: Smart follow-up suggestions after commands

This fixes a bug where agentful init would create broken installations
with settings.json referencing non-existent hook files.

Fixes issues where new installations would fail on session-start hook
with MODULE_NOT_FOUND errors.
…h check

The health check was only looking for `techStack` (camelCase) but the
architecture.json uses `tech_stack` (snake_case). This caused false
"malformed architecture.json" warnings on every session start.

Updated the check to support both naming conventions.
The drift detector was firing on every file edit, creating confusing
"failed with status code 1" messages that weren't actually errors.

Changes:
- Only warn if analysis is stale (>7 days old)
- Silently mark drift for recent changes
- Return exit code 0 (success) for non-stale drift
- Clearer messaging when action is needed

This makes the hook useful without being noisy during normal development.
The drift detector was too noisy, firing on every dependency change.
Now it intelligently filters to only trigger on MEANINGFUL changes:

TRIGGERS:
✅ Tech stack changes (switched frameworks)
✅ Significant new patterns (20%+ growth AND 50+ new files)
✅ Very stale analysis (>30 days old)

DOES NOT TRIGGER:
❌ Minor dependency updates (version bumps)
❌ Small file additions
❌ Recent analysis (<30 days ago)

This makes auto-scanning actually useful instead of annoying.
…ation

The drift detector now intelligently distinguishes between:
- NEW libraries added → triggers re-analysis (creates new skills/agents)
- Version bumps → silent (no architectural change)

Key improvements:
- Parses package.json, requirements.txt, go.mod, etc.
- Compares current vs previous dependencies
- Only triggers on NEW library additions
- Shows which libraries were added in the warning
- Stores dependencies for next comparison

This ensures agentful generates skills for new capabilities
while ignoring minor version updates.
## Circuit Breaker Pattern
- Prevent infinite loops by tracking consecutive failures
- Automatically trips after 3 failures on same task
- Adds blocking decision to decisions.json with recovery options
- Continues with other work instead of getting stuck
- 1-minute cooldown period before retry

## Simplified Command Structure
- Primary Commands: 3 essentials (start, status, decide)
- When-Needed Commands: Contextual (validate, product, generate)
- Advanced Commands: Power-user features (analyze, init, agents)
- Clear "When to Use" guidance for each command

## Progress Indicators
- Phase-based progress (Planning → Implementation → Testing → Complete)
- Incremental updates every 2 minutes max
- Specific file creation notifications
- Visual progress bars with checkmarks
- Estimated remaining work when appropriate

## Documentation Updates
- Updated CLAUDE.md with new command structure
- Added circuit breaker troubleshooting
- Added progress indicator expectations
- Clearer command organization

These improvements make agentful more reliable and user-friendly
out-of-the-box by preventing infinite loops and providing better
visibility into agent progress.

Co-authored-by: agentful <agentful@itz4blitz.com>
…nents

- Implement integration tests for entry point functions including main, startServer, and signal handlers.
- Create unit tests for DatabaseManager, ErrorRepository, PatternRepository, and EmbeddingService with various scenarios.
- Introduce TypeScript configuration and Vitest setup for testing.
- Update package version to 2.0.0-beta.1.
- Enhance documentation for MCP Vector DB usage in agent templates.
- Add health check script for MCP server to ensure proper setup and configuration.
Add MCP (Model Context Protocol) integration to enable pattern learning
and error fix reuse across all agentful projects.

Changes:
- Add MCP tools to backend, frontend, tester, and fixer agents
- Fix context-awareness.js to check for both 'agents' and 'generatedAgents' fields
- Update version.json from 1.4.0 to 2.0.0-beta.1
- Add MCP server documentation with simple setup instructions
- MCP enables agents to store/find patterns and learn from past solutions

MCP Benefits:
- Fixer agent finds known error fixes instantly
- Backend/frontend agents reuse successful patterns
- Tester agent stores test patterns
- Continuous learning from all projects

Setup: claude mcp add npx @itz4blitz/agentful-mcp-server
Update build script to copy schema.sql to dist/ directory so it's
included in the npm package. This ensures the database schema is
available when the MCP server runs from installed package.

Build: tsc && cp sql-wasm.wasm dist/infrastructure/ && cp schema.sql dist/
Resolved version conflicts:
- Kept 2.0.0-beta.1 (our MCP feature version) over 1.4.1 from main
- MCP server integration requires beta version
Fixes CI validation failures where agent files required at least 30% of
code blocks to have language specifiers. Changed bare text
for MCP documentation sections in backend.md, frontend.md, and tester.md.
@itz4blitz itz4blitz merged commit 66bb278 into main Jan 28, 2026
9 checks passed
@itz4blitz itz4blitz deleted the feature/circuit-breaker-and-ux-improvements branch January 28, 2026 16:00
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.

1 participant