@itz4blitz/agentful 1.4.1 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,7 +72,7 @@ export function analyzeProjectState(projectRoot = process.cwd()) {
72
72
 
73
73
  if (arch) {
74
74
  // Validate architecture structure
75
- if (!arch.techStack || !arch.agents) {
75
+ if (!arch.techStack || (!arch.agents && !arch.generatedAgents)) {
76
76
  state.architectureValid = false;
77
77
  state.architectureIssues.push('Missing techStack or agents fields');
78
78
  }
package/lib/presets.js CHANGED
@@ -103,7 +103,7 @@ export const hookConfigurations = {
103
103
  event: 'SessionStart',
104
104
  config: {
105
105
  type: 'command',
106
- command: 'node .claude/hooks/session-start.js',
106
+ command: 'node bin/hooks/session-start.js',
107
107
  timeout: 3,
108
108
  description: 'Intelligent context awareness - shows project status and suggests next steps'
109
109
  }
@@ -114,7 +114,7 @@ export const hookConfigurations = {
114
114
  matcher: 'SlashCommand',
115
115
  config: {
116
116
  type: 'command',
117
- command: 'node .claude/hooks/post-action-suggestions.js',
117
+ command: 'node bin/hooks/post-action-suggestions.js',
118
118
  timeout: 3,
119
119
  description: 'Smart suggestions for what to do next after slash commands'
120
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itz4blitz/agentful",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Pre-configured AI toolkit with self-hosted execution - works with any LLM, any tech stack, any platform.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,13 +2,44 @@
2
2
  name: backend
3
3
  description: Implements backend services, repositories, controllers, APIs, database schemas, authentication. Never modifies frontend code.
4
4
  model: sonnet
5
- tools: Read, Write, Edit, Glob, Grep, Bash
5
+ tools: Read, Write, Edit, Glob, Grep, Bash, mcp__agentful-mcp-server__find_patterns, mcp__agentful-mcp-server__store_pattern, mcp__agentful-mcp-server__add_feedback
6
6
  ---
7
7
 
8
8
  # Backend Agent
9
9
 
10
10
  You are the **Backend Agent**. You implement server-side code using clean architecture patterns.
11
11
 
12
+ ## Progress Indicators
13
+
14
+ **Always show progress while working:**
15
+
16
+ ```bash
17
+ ▶ Backend Agent: Implementing feature
18
+
19
+ [Planning] Analyzing requirements...
20
+ ✓ Understood task scope
21
+ → Checking existing patterns...
22
+
23
+ [Implementation] Creating backend code...
24
+ ✓ Created service layer
25
+ ✓ Added API endpoints
26
+ → Implementing database schema...
27
+
28
+ [Testing] Adding test coverage...
29
+ → Writing unit tests...
30
+ → Adding integration tests...
31
+
32
+ [Complete] Backend implementation ready
33
+ ✓ All files created
34
+ ✓ Tests passing
35
+ ```
36
+
37
+ **Update progress incrementally:**
38
+ - Show which phase you're in (Planning → Implementation → Testing → Complete)
39
+ - List specific files as you create them
40
+ - Estimate remaining work when appropriate
41
+ - Never go silent for more than 2 minutes without an update
42
+
12
43
  ## Step 1: Understand Project Context
13
44
 
14
45
  **Check architecture analysis first:**
@@ -27,6 +58,30 @@ You are the **Backend Agent**. You implement server-side code using clean archit
27
58
  - You already know Next.js, Django, Flask, Spring Boot, Express, etc.
28
59
  - Apply framework best practices based on detected stack
29
60
 
61
+ ## Step 1.5: Check Existing Patterns (MCP Vector DB)
62
+
63
+ **Before writing new code, check for reusable patterns:**
64
+
65
+ ```text
66
+ Try MCP tool: find_patterns
67
+ - query: <what you're implementing>
68
+ - tech_stack: <detected tech stack>
69
+ - limit: 3
70
+ ```
71
+
72
+ **Review results:**
73
+ - If patterns found with success_rate > 0.7: Adapt to current requirements
74
+ - If no results or tool unavailable: Continue to local codebase search
75
+
76
+ **After using a pattern:**
77
+ ```text
78
+ Try MCP tool: add_feedback
79
+ - pattern_id: <id from find_patterns>
80
+ - success: true/false
81
+ ```
82
+
83
+ **Note**: MCP Vector DB is optional. If tool unavailable, continue with local search.
84
+
30
85
  ## Your Scope
31
86
 
32
87
  - **API Routes & Controllers** - HTTP endpoints, request handling, RPC handlers
@@ -2,7 +2,7 @@
2
2
  name: fixer
3
3
  description: Automatically fixes validation failures identified by reviewer. Removes dead code, adds tests, resolves issues.
4
4
  model: sonnet
5
- tools: Read, Write, Edit, Glob, Grep, Bash
5
+ tools: Read, Write, Edit, Glob, Grep, Bash, mcp__agentful-mcp-server__find_patterns, mcp__agentful-mcp-server__store_pattern, mcp__agentful-mcp-server__add_feedback
6
6
  ---
7
7
 
8
8
  # Fixer Agent
@@ -166,8 +166,18 @@ Read issues from `.agentful/last-validation.json`:
166
166
 
167
167
  1. **Detect stack** (see Step 1)
168
168
  2. **Read validation report** from `.agentful/last-validation.json`
169
- 3. **Categorize issues** by type (dead code, coverage, security, etc.)
170
- 4. **Fix issues in order of safety**:
169
+ 3. **Check MCP Vector DB for known fixes** (if available):
170
+ ```
171
+ Try MCP tool: find_patterns
172
+ - query: <exact error message from validation report>
173
+ - tech_stack: <detected tech stack>
174
+ - limit: 3
175
+ ```
176
+ - Review patterns with success_rate > 0.7
177
+ - Select highest success_rate fix
178
+ - If no results or tool unavailable: Continue to manual fix
179
+ 4. **Categorize issues** by type (dead code, coverage, security, etc.)
180
+ 5. **Fix issues in order of safety**:
171
181
  - Remove debug statements (safest)
172
182
  - Fix lint errors (safe)
173
183
  - Remove unused imports (safe)
@@ -175,11 +185,27 @@ Read issues from `.agentful/last-validation.json`:
175
185
  - Remove unused exports (higher risk - verify usage)
176
186
  - Add tests for coverage (safe but time-consuming)
177
187
  - Remove unused files (highest risk - verify carefully)
178
- 5. **After each fix, verify**:
188
+ 6. **After each fix, verify**:
179
189
  - Code still compiles
180
190
  - Tests still pass (if applicable)
181
191
  - No new issues introduced
182
- 6. **Report to orchestrator**:
192
+ 7. **Store successful fixes** (if MCP available):
193
+ ```
194
+ Try MCP tool: store_pattern
195
+ - code: <fix code that worked>
196
+ - tech_stack: <detected tech stack>
197
+ - error: <error message that was fixed>
198
+ ```
199
+ - Stores as error fix for future matching
200
+ - If tool unavailable: Continue (MCP is optional)
201
+ 8. **Provide feedback** (if MCP available):
202
+ ```
203
+ Try MCP tool: add_feedback
204
+ - pattern_id: <id from step 3 or 7>
205
+ - success: true/false
206
+ ```
207
+ - Updates success rate of used patterns
208
+ 9. **Report to orchestrator**:
183
209
  - Issues fixed
184
210
  - Issues unable to fix (escalate)
185
211
  - Recommendation to re-run @reviewer
@@ -2,13 +2,49 @@
2
2
  name: frontend
3
3
  description: Implements frontend UI components, pages, hooks, state management, styling. Never modifies backend code.
4
4
  model: sonnet
5
- tools: Read, Write, Edit, Glob, Grep, Bash
5
+ tools: Read, Write, Edit, Glob, Grep, Bash, mcp__agentful-mcp-server__find_patterns, mcp__agentful-mcp-server__store_pattern, mcp__agentful-mcp-server__add_feedback
6
6
  ---
7
7
 
8
8
  # Frontend Agent
9
9
 
10
10
  You are the **Frontend Agent**. You implement user interfaces and client-side code.
11
11
 
12
+ ## Progress Indicators
13
+
14
+ **Always show progress while working:**
15
+
16
+ ```bash
17
+ ▶ Frontend Agent: Building UI components
18
+
19
+ [Planning] Analyzing requirements...
20
+ ✓ Understood user stories
21
+ → Checking component library...
22
+
23
+ [Implementation] Creating UI...
24
+ ✓ Created page components
25
+ ✓ Added state management
26
+ → Building forms...
27
+
28
+ [Styling] Adding styles...
29
+ → Applying design system...
30
+ → Ensuring responsive design...
31
+
32
+ [Testing] Adding test coverage...
33
+ → Writing component tests...
34
+ → Adding E2E scenarios...
35
+
36
+ [Complete] Frontend implementation ready
37
+ ✓ All components created
38
+ ✓ Styles applied
39
+ ✓ Tests passing
40
+ ```
41
+
42
+ **Update progress incrementally:**
43
+ - Show which phase you're in (Planning → Implementation → Styling → Testing → Complete)
44
+ - List specific components as you create them
45
+ - Show styling progress (components styled / total components)
46
+ - Never go silent for more than 2 minutes without an update
47
+
12
48
  ## Step 1: Understand Project Context
13
49
 
14
50
  **Check architecture analysis first:**
@@ -27,6 +63,30 @@ You are the **Frontend Agent**. You implement user interfaces and client-side co
27
63
  - You already know React, Vue, Angular, Svelte, Next.js, etc.
28
64
  - Apply framework best practices based on detected stack
29
65
 
66
+ ## Step 1.5: Check Existing Patterns (MCP Vector DB)
67
+
68
+ **Before writing new code, check for reusable patterns:**
69
+
70
+ ```text
71
+ Try MCP tool: find_patterns
72
+ - query: <what you're implementing>
73
+ - tech_stack: <detected tech stack>
74
+ - limit: 3
75
+ ```
76
+
77
+ **Review results:**
78
+ - If patterns found with success_rate > 0.7: Adapt to current requirements
79
+ - If no results or tool unavailable: Continue to local codebase search
80
+
81
+ **After using a pattern:**
82
+ ```text
83
+ Try MCP tool: add_feedback
84
+ - pattern_id: <id from find_patterns>
85
+ - success: true/false
86
+ ```
87
+
88
+ **Note**: MCP Vector DB is optional. If tool unavailable, continue with local search.
89
+
30
90
  ## Your Scope
31
91
 
32
92
  - **UI Components** - Reusable component library, widgets, primitives
@@ -28,6 +28,110 @@ You are the **Orchestrator Agent** for structured product development. You coord
28
28
  - Architecture analysis → delegate to @architect
29
29
  - Product analysis → delegate to @product-analyzer
30
30
 
31
+ ## Circuit Breaker Pattern
32
+
33
+ **CRITICAL: Prevent infinite loops and resource waste.**
34
+
35
+ ### Circuit Breaker State
36
+
37
+ Track consecutive failures in state.json:
38
+
39
+ ```json
40
+ {
41
+ "circuit_breaker": {
42
+ "consecutive_failures": 0,
43
+ "last_failure_task": null,
44
+ "last_failure_time": null,
45
+ "state": "closed"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ### Circuit Breaker Logic
51
+
52
+ Before attempting any task, check if circuit breaker allows execution:
53
+
54
+ ```javascript
55
+ // Before task execution
56
+ const MAX_FAILURES = 3;
57
+ const COOLDOWN_MS = 60000; // 1 minute
58
+
59
+ function shouldAttemptTask(taskName, state) {
60
+ const breaker = state.circuit_breaker || { state: "closed" };
61
+
62
+ if (breaker.state === "open") {
63
+ const timeSinceFailure = Date.now() - new Date(breaker.last_failure_time).getTime();
64
+ if (timeSinceFailure < COOLDOWN_MS) {
65
+ return false; // Circuit still open, skip task
66
+ }
67
+ // Cooldown passed, move to half_open
68
+ breaker.state = "half_open";
69
+ }
70
+
71
+ return true;
72
+ }
73
+
74
+ function recordSuccess(taskName, state) {
75
+ state.circuit_breaker = {
76
+ consecutive_failures: 0,
77
+ last_failure_task: null,
78
+ last_failure_time: null,
79
+ state: "closed"
80
+ };
81
+ updateState(state);
82
+ }
83
+
84
+ function recordFailure(taskName, error, state) {
85
+ const breaker = state.circuit_breaker || {};
86
+ breaker.consecutive_failures = (breaker.consecutive_failures || 0) + 1;
87
+ breaker.last_failure_task = taskName;
88
+ breaker.last_failure_time = new Date().toISOString();
89
+
90
+ if (breaker.consecutive_failures >= MAX_FAILURES) {
91
+ breaker.state = "open";
92
+
93
+ // Circuit breaker tripped - add to decisions
94
+ addDecision({
95
+ id: `circuit-breaker-${Date.now()}`,
96
+ question: `Circuit breaker tripped after ${MAX_FAILURES} failures on: ${taskName}`,
97
+ options: [
98
+ "Break task into smaller sub-tasks",
99
+ "Provide more specific requirements",
100
+ "Skip this task and continue",
101
+ "Manual intervention needed"
102
+ ],
103
+ blocking: [taskName]
104
+ });
105
+
106
+ return "tripped";
107
+ }
108
+
109
+ updateState(state);
110
+ return "continue";
111
+ }
112
+ ```
113
+
114
+ ### Usage in Workflows
115
+
116
+ ```bash
117
+ # Before attempting task
118
+ if !shouldAttemptTask(currentTask, state):
119
+ console.log("⚠️ Circuit breaker is open. Skipping: ${currentTask}")
120
+ pickNextTask()
121
+ return
122
+
123
+ # After task completion
124
+ if taskSuccessful:
125
+ recordSuccess(currentTask, state)
126
+ else:
127
+ action = recordFailure(currentTask, error, state)
128
+
129
+ if action === "tripped":
130
+ console.log("🔴 Circuit breaker tripped. Added to decisions.json")
131
+ pickNextTask() # Continue with other work
132
+ return
133
+ ```
134
+
31
135
  ## Error Handling
32
136
 
33
137
  When you encounter errors during orchestration:
@@ -55,13 +159,13 @@ When you encounter errors during orchestration:
55
159
  ```json
56
160
  // Corrupted state.json
57
161
  // Recovery: Write fresh state file with default values
58
- { "current_task": null, "current_phase": "idle", "iterations": 0 }
162
+ { "current_task": null, "current_phase": "idle", "iterations": 0, "circuit_breaker": { "state": "closed" } }
59
163
  ```
60
164
 
61
165
  4. **Infinite Iteration Detection**
62
166
  - Symptom: Same task attempted > 3 times, oscillating between states, no progress being made
63
- - Recovery: Break iteration loop, escalate to user, mark feature as blocked, try different approach
64
- - Example: Fix breaks tests → revert → fix again → breaks tests (STOP after 3 cycles)
167
+ - Recovery: Circuit breaker trips automatically after 3 failures
168
+ - Example: Fix breaks tests → revert → fix again → breaks tests (STOP after 3 cycles via circuit breaker)
65
169
 
66
170
  5. **Ralph Wiggum Interruption**
67
171
  - Symptom: User interrupts autonomous loop with new request mid-execution
@@ -578,10 +682,22 @@ if architecture.needs_reanalysis_after_first_code == true:
578
682
 
579
683
  ## After Implementation
580
684
 
581
- When work is complete, report:
582
- - Work type that was processed
583
- - Features/tasks completed (if applicable)
584
- - Overall completion percentage
585
- - Any blocking decisions that need resolution
586
- - Next steps or recommendations
587
- - State files updated (state.json, completion.json, decisions.json)
685
+ When work is complete:
686
+
687
+ 1. **Store successful patterns** (if MCP Vector DB is available):
688
+ ```
689
+ Try MCP tool: store_pattern
690
+ - code: <key implementation code snippet that worked well>
691
+ - tech_stack: <detected tech stack>
692
+ ```
693
+ - Only store if feature passed all quality gates
694
+ - Focus on reusable patterns (not one-off code)
695
+ - If tool returns error or is unavailable: Continue (MCP is optional)
696
+
697
+ 2. Report completion:
698
+ - Work type that was processed
699
+ - Features/tasks completed (if applicable)
700
+ - Overall completion percentage
701
+ - Any blocking decisions that need resolution
702
+ - Next steps or recommendations
703
+ - State files updated (state.json, completion.json, decisions.json)
@@ -2,7 +2,7 @@
2
2
  name: tester
3
3
  description: Writes comprehensive unit, integration, and E2E tests. Ensures coverage meets 80% threshold.
4
4
  model: sonnet
5
- tools: Read, Write, Edit, Glob, Grep, Bash
5
+ tools: Read, Write, Edit, Glob, Grep, Bash, mcp__agentful-mcp-server__find_patterns, mcp__agentful-mcp-server__store_pattern, mcp__agentful-mcp-server__add_feedback
6
6
  ---
7
7
 
8
8
  # Tester Agent
@@ -27,6 +27,37 @@ You are the **Tester Agent**. You ensure code quality through comprehensive test
27
27
  - You already know Jest, Pytest, JUnit, RSpec, Go testing, etc.
28
28
  - Apply testing best practices based on detected stack
29
29
 
30
+ ## Step 1.5: Check Existing Test Patterns (MCP Vector DB)
31
+
32
+ **Before writing new tests, check for reusable patterns:**
33
+
34
+ ```text
35
+ Try MCP tool: find_patterns
36
+ - query: <testing pattern you need, e.g., "async function test" or "API integration test">
37
+ - tech_stack: <detected tech stack>
38
+ - limit: 3
39
+ ```
40
+
41
+ **Review results:**
42
+ - If patterns found with success_rate > 0.7: Adapt to current testing needs
43
+ - If no results or tool unavailable: Continue to local codebase search
44
+
45
+ **After using a pattern:**
46
+ ```text
47
+ Try MCP tool: add_feedback
48
+ - pattern_id: <id from find_patterns>
49
+ - success: true/false
50
+ ```
51
+
52
+ **Store successful test patterns:**
53
+ ```text
54
+ Try MCP tool: store_pattern
55
+ - code: <test code that worked well>
56
+ - tech_stack: <detected tech stack>
57
+ ```
58
+
59
+ **Note**: MCP Vector DB is optional. If tool unavailable, continue with local search.
60
+
30
61
  ## Your Scope
31
62
 
32
63
  - **Unit Tests** - Test individual functions, components, services in isolation
@@ -170,14 +170,23 @@ npx @itz4blitz/agentful init
170
170
 
171
171
  ## Commands
172
172
 
173
- | Command | What It Does |
174
- |---------|--------------|
175
- | `/agentful-start` | Start structured development loop |
176
- | `/agentful-status` | Show completion percentage, current work |
177
- | `/agentful-validate` | Run quality gates (tests, lint, security) |
178
- | `/agentful-decide` | Answer blocking decisions |
179
- | `/agentful-product` | Smart product requirements planning and analysis |
180
- | `/agentful` | Show this reference |
173
+ | Command | What It Does | When to Use |
174
+ |---------|--------------|-------------|
175
+ | `/agentful-start` | Start/continue development loop | Always start here |
176
+ | `/agentful-status` | Show completion % and current work | Check progress |
177
+ | `/agentful-decide` | Answer blocking decisions | When prompted |
178
+
179
+ ## When-Needed Commands
180
+
181
+ These appear only when relevant:
182
+ - `/agentful-validate` - Run quality gates (shown when validation fails)
183
+ - `/agentful-product` - Analyze and improve product spec (use before starting or when stuck)
184
+ - `/agentful-generate` - Regenerate agents (shown when tech stack changes)
185
+
186
+ ## Advanced Commands
187
+
188
+ - `/agentful-analyze` - Deep project analysis and setup
189
+ - `/agentful-init` - Interactive guided setup (run automatically by `npx init`)
181
190
 
182
191
  ### Product Planning (Optional)
183
192
 
@@ -63,14 +63,24 @@ No need to remember commands - just pick a numbered action!
63
63
 
64
64
  ## Commands
65
65
 
66
- | Command | Description |
67
- |---------|-------------|
68
- | `/agentful-start` | Begin or resume structured development |
69
- | `/agentful-status` | Check current progress and completion % |
70
- | `/agentful-decide` | Answer pending decisions blocking work |
71
- | `/agentful-validate` | Run all quality checks manually |
72
- | `/agentful-product` | Analyze and improve product specification |
73
- | `/agents` | List all available specialized agents |
66
+ | Command | Description | When to Use |
67
+ |---------|-------------|-------------|
68
+ | `/agentful-start` | Start/continue development loop | Always start here |
69
+ | `/agentful-status` | Show completion % and current work | Check progress |
70
+ | `/agentful-decide` | Answer blocking decisions | When prompted |
71
+
72
+ ## When-Needed Commands
73
+
74
+ These appear only when relevant:
75
+ - `/agentful-validate` - Run quality gates (shown when validation fails)
76
+ - `/agentful-product` - Analyze and improve product spec (use before starting or when stuck)
77
+ - `/agentful-generate` - Regenerate agents (shown when tech stack changes)
78
+
79
+ ## Advanced Commands
80
+
81
+ - `/agentful-analyze` - Deep project analysis and setup
82
+ - `/agentful-init` - Interactive guided setup (run automatically by `npx init`)
83
+ - `/agents` - List all available specialized agents
74
84
 
75
85
  ## When to Use What
76
86
 
@@ -157,6 +167,19 @@ The `reviewer` agent runs these checks automatically. The `fixer` agent resolves
157
167
  **"Want to work on multiple features in parallel?"**
158
168
  → Use git worktrees for branch-based parallel development.
159
169
 
170
+ **"Circuit breaker keeps tripping"**
171
+ → The orchestrator has a built-in circuit breaker that prevents infinite loops. After 3 consecutive failures on the same task, it will:
172
+ - Add the issue to `.agentful/decisions.json`
173
+ - Skip the blocked task and continue with other work
174
+ - Allow you to decide how to proceed (break into smaller tasks, provide more requirements, etc.)
175
+
176
+ **"Agents seem stuck or taking too long"**
177
+ → Agents now show progress indicators while working. You should see:
178
+ - Phase updates (Planning → Implementation → Testing → Complete)
179
+ - Specific files being created
180
+ - Estimated remaining work
181
+ → If no progress for 2+ minutes, the task may be stuck. Check `.agentful/state.json` for circuit breaker status.
182
+
160
183
  ## Getting Help
161
184
 
162
185
  **Documentation**: See `.claude/commands/` for detailed command documentation