claude-flow-novice 1.5.20 → 1.5.22

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.
Files changed (25) hide show
  1. package/.claude/agents/CLAUDE.md +186 -2386
  2. package/.claude/agents/agent-principles/agent-type-guidelines.md +328 -0
  3. package/.claude/agents/agent-principles/format-selection.md +204 -0
  4. package/.claude/agents/agent-principles/prompt-engineering.md +371 -0
  5. package/.claude/agents/agent-principles/quality-metrics.md +294 -0
  6. package/.claude/agents/frontend/README.md +640 -0
  7. package/.claude/agents/frontend/interaction-tester.md +879 -0
  8. package/.claude/agents/frontend/react-frontend-engineer.md +130 -0
  9. package/.claude/agents/frontend/state-architect.md +250 -0
  10. package/.claude/agents/frontend/ui-designer.md +325 -0
  11. package/.claude/agents/researcher.md +1 -1
  12. package/.claude/agents/swarm/test-coordinator.md +383 -0
  13. package/.claude/agents/task-coordinator.md +126 -0
  14. package/.claude/settings.json +7 -7
  15. package/.claude-flow-novice/dist/src/hooks/enhanced-hooks-cli.js +168 -167
  16. package/.claude-flow-novice/dist/src/providers/tiered-router.js +118 -0
  17. package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -0
  18. package/.claude-flow-novice/dist/src/providers/types.js.map +1 -1
  19. package/.claude-flow-novice/dist/src/providers/zai-provider.js +268 -0
  20. package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -0
  21. package/package.json +1 -1
  22. package/src/cli/simple-commands/init/templates/CLAUDE.md +25 -0
  23. package/src/hooks/enhanced-hooks-cli.js +23 -3
  24. package/src/hooks/enhanced-post-edit-pipeline.js +154 -75
  25. /package/.claude/agents/{CLAUDE_AGENT_DESIGN_PRINCIPLES.md → agent-principles/CLAUDE_AGENT_DESIGN_PRINCIPLES.md} +0 -0
@@ -0,0 +1,328 @@
1
+ # Agent Type Guidelines
2
+
3
+ **Version:** 2.0.0
4
+ **Last Updated:** 2025-09-30
5
+
6
+ ## Overview
7
+
8
+ This document provides specific guidance for creating different types of agents based on their primary function.
9
+
10
+ ---
11
+
12
+ ## 1. Coder Agents
13
+
14
+ ### For Rust (VALIDATED)
15
+
16
+ **Basic Tasks:** Use CODE-HEAVY
17
+
18
+ ```yaml
19
+ Tasks:
20
+ - String processing
21
+ - Basic error handling
22
+ - Simple data structures
23
+ - CRUD operations
24
+ - Configuration parsing
25
+
26
+ Expected Improvement: +43% quality vs Minimal
27
+ ```
28
+
29
+ **Complex Tasks:** Use MINIMAL
30
+
31
+ ```yaml
32
+ Tasks:
33
+ - Lock-free algorithms
34
+ - Lifetime-complex generics
35
+ - Unsafe code design
36
+ - Embedded HAL
37
+ - Async runtime design
38
+
39
+ Expected Improvement: +31% quality vs Code-Heavy
40
+ ```
41
+
42
+ **Example Agents:**
43
+ - `benchmarking-tests/test-agent-code-heavy.md` - Basic tasks
44
+ - `benchmarking-tests/test-agent-minimal.md` - Complex tasks
45
+
46
+ ### For JavaScript/TypeScript (HYPOTHESIS)
47
+
48
+ Apply same principles but validate with testing:
49
+
50
+ **Basic Tasks:** Code-Heavy
51
+ - Simple React components
52
+ - Express route handlers
53
+ - Utility functions
54
+ - Basic async/await
55
+
56
+ **Complex Tasks:** Minimal
57
+ - State management architecture
58
+ - Complex React patterns (render props, HOCs)
59
+ - Performance optimization
60
+ - TypeScript advanced types
61
+
62
+ ---
63
+
64
+ ## 2. Reviewer Agents
65
+
66
+ **Recommended Format:** MINIMAL
67
+
68
+ **Rationale:**
69
+ - Reviews require contextual reasoning
70
+ - Over-specification creates checklist mentality
71
+ - Need flexibility to identify novel issues
72
+ - Trust AI's pattern recognition
73
+
74
+ **Key Responsibilities:**
75
+ - Assess code quality, readability, and maintainability
76
+ - Identify bugs, security issues, and performance problems
77
+ - Suggest architectural improvements
78
+ - Ensure adherence to best practices
79
+
80
+ **Review Approach:**
81
+
82
+ ### 1. Initial Assessment
83
+ - Understand the change's purpose
84
+ - Review related context (issues, documentation)
85
+ - Identify the scope and impact
86
+
87
+ ### 2. Deep Analysis
88
+ - **Correctness**: Does it work as intended?
89
+ - **Security**: Any vulnerabilities?
90
+ - **Performance**: Efficiency concerns?
91
+ - **Maintainability**: Easy to understand and modify?
92
+ - **Testing**: Adequate test coverage?
93
+
94
+ ### 3. Provide Feedback
95
+ - Be specific and actionable
96
+ - Explain the "why" behind suggestions
97
+ - Offer alternatives when critiquing
98
+ - Acknowledge good patterns
99
+
100
+ **Example:** `quality/reviewer.md`
101
+
102
+ ---
103
+
104
+ ## 3. Architect Agents
105
+
106
+ **Recommended Format:** MINIMAL
107
+
108
+ **Rationale:**
109
+ - Architecture requires strategic thinking
110
+ - Solutions must be context-specific
111
+ - Over-constraining limits creative solutions
112
+ - Need to consider trade-offs dynamically
113
+
114
+ **Core Responsibilities:**
115
+ - Design system architectures from requirements
116
+ - Make strategic technical decisions
117
+ - Evaluate technology trade-offs
118
+ - Create architectural documentation
119
+
120
+ **Approach:**
121
+
122
+ ### Requirements Analysis
123
+ Extract functional and non-functional requirements, identify constraints and quality attributes, understand stakeholder needs.
124
+
125
+ ### Architecture Design
126
+ Apply appropriate patterns (microservices, event-driven, CQRS), consider trade-offs, document decisions with ADRs.
127
+
128
+ ### Decision Making
129
+ Framework for evaluating options with explicit trade-off documentation.
130
+
131
+ **Collaboration:**
132
+ - Work with Coder agents for implementation guidance
133
+ - Coordinate with Reviewer agents for design validation
134
+ - Provide specifications to DevOps for infrastructure
135
+ - Share ADRs via memory system
136
+
137
+ **Example:** `architecture/system-architect.md`
138
+
139
+ ---
140
+
141
+ ## 4. Tester Agents
142
+
143
+ **Recommended Format:** CODE-HEAVY for unit tests, METADATA for test strategy
144
+
145
+ **Rationale:**
146
+ - Unit tests benefit from concrete patterns
147
+ - Test structure is often formulaic
148
+ - Examples show proper assertion style
149
+ - But test strategy needs metadata structure
150
+
151
+ **Test Patterns:**
152
+
153
+ ### Rust Testing Pattern
154
+
155
+ ```rust
156
+ #[cfg(test)]
157
+ mod tests {
158
+ use super::*;
159
+
160
+ #[test]
161
+ fn test_success_case() {
162
+ let result = function_under_test(valid_input);
163
+ assert_eq!(result, expected_output);
164
+ }
165
+
166
+ #[test]
167
+ fn test_error_case() {
168
+ let result = function_under_test(invalid_input);
169
+ assert!(result.is_err());
170
+ }
171
+
172
+ #[test]
173
+ #[should_panic(expected = "error message")]
174
+ fn test_panic_case() {
175
+ function_that_should_panic();
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### JavaScript Testing Pattern
181
+
182
+ ```javascript
183
+ describe('ModuleName', () => {
184
+ beforeEach(() => {
185
+ // Setup
186
+ });
187
+
188
+ afterEach(() => {
189
+ // Cleanup
190
+ });
191
+
192
+ test('should handle success case', () => {
193
+ const result = functionUnderTest(validInput);
194
+ expect(result).toEqual(expectedOutput);
195
+ });
196
+
197
+ test('should handle error case', async () => {
198
+ await expect(asyncFunction(invalidInput))
199
+ .rejects.toThrow('error message');
200
+ });
201
+ });
202
+ ```
203
+
204
+ **Test Strategy:**
205
+
206
+ ```yaml
207
+ Coverage Requirements:
208
+ unit_tests: 85%
209
+ integration_tests: 70%
210
+ e2e_tests: 30%
211
+
212
+ Test Categories:
213
+ - Happy path tests
214
+ - Error condition tests
215
+ - Edge case tests
216
+ - Performance tests (if applicable)
217
+ ```
218
+
219
+ **Example:** `testing/unit/tdd-london-swarm.md`
220
+
221
+ ---
222
+
223
+ ## 5. Researcher Agents
224
+
225
+ **Recommended Format:** MINIMAL
226
+
227
+ **Rationale:**
228
+ - Research requires open-ended exploration
229
+ - Avoid bias from excessive structure
230
+ - Let evidence guide conclusions
231
+ - Need flexibility in methodology
232
+
233
+ **Core Responsibilities:**
234
+ - Research technologies, patterns, and best practices
235
+ - Analyze trade-offs and alternatives
236
+ - Provide evidence-based recommendations
237
+ - Stay current with industry trends
238
+
239
+ **Research Approach:**
240
+
241
+ 1. **Define Scope**: Clarify what needs research
242
+ 2. **Gather Information**: Use multiple sources
243
+ 3. **Analyze Findings**: Evaluate objectively
244
+ 4. **Synthesize**: Draw actionable conclusions
245
+ 5. **Document**: Clear, referenced reports
246
+
247
+ **Success Metrics:**
248
+ - Recommendations are actionable
249
+ - Research is thorough and unbiased
250
+ - Sources are credible and current
251
+
252
+ **Example:** `researcher.md`
253
+
254
+ ---
255
+
256
+ ## 6. DevOps Agents
257
+
258
+ **Recommended Format:** METADATA
259
+
260
+ **Rationale:**
261
+ - DevOps involves structured workflows
262
+ - Clear requirements for CI/CD pipelines
263
+ - Deployment checklists are essential
264
+ - Balance structure with flexibility
265
+
266
+ **Pipeline Structure:**
267
+
268
+ ```yaml
269
+ CI Pipeline Stages:
270
+ 1_build:
271
+ steps: [checkout, dependencies, compile]
272
+ failure_action: fail_fast
273
+
274
+ 2_test:
275
+ steps: [unit_tests, integration_tests, e2e_tests]
276
+ coverage_threshold: 80%
277
+
278
+ 3_quality:
279
+ steps: [lint, security_scan, dependency_audit]
280
+ blocking: true
281
+
282
+ 4_deploy:
283
+ environments: [staging, production]
284
+ strategy: blue_green
285
+ rollback_enabled: true
286
+ ```
287
+
288
+ **Deployment Strategy:**
289
+
290
+ ```yaml
291
+ Deployment Process:
292
+ pre_deployment:
293
+ - backup_database
294
+ - notify_team
295
+ - create_deployment_tag
296
+
297
+ deployment:
298
+ - deploy_to_staging
299
+ - run_smoke_tests
300
+ - await_approval
301
+ - deploy_to_production
302
+
303
+ post_deployment:
304
+ - verify_health_checks
305
+ - monitor_metrics
306
+ - notify_completion
307
+
308
+ rollback_triggers:
309
+ - error_rate > 5%
310
+ - response_time > 2s
311
+ - health_check_failures > 3
312
+ ```
313
+
314
+ **Example:** `devops/ci-cd/ops-cicd-github.md`
315
+
316
+ ---
317
+
318
+ ## Agent Selection Guide
319
+
320
+ **Core Development**: coder, tester, reviewer
321
+ **Backend**: backend-dev, api-docs, system-architect
322
+ **Frontend**: coder (specialized), mobile-dev
323
+ **Quality**: tester, reviewer, security-specialist, perf-analyzer
324
+ **Planning**: researcher, planner, architect
325
+ **Operations**: devops-engineer, cicd-engineer
326
+ **Documentation**: api-docs, researcher
327
+
328
+ **Select agents based on actual task needs, not predefined patterns.**
@@ -0,0 +1,204 @@
1
+ # Agent Format Selection Principles
2
+
3
+ **Version:** 2.0.0
4
+ **Last Updated:** 2025-09-30
5
+
6
+ ## The Three Agent Formats
7
+
8
+ ### Format 1: MINIMAL (Complex Tasks)
9
+
10
+ **Use For:**
11
+ - Architectural design
12
+ - Code review and analysis
13
+ - Research and investigation
14
+ - Strategic decision-making
15
+ - Creative problem-solving
16
+
17
+ **Characteristics:**
18
+ - **Length**: 200-400 lines
19
+ - **Structure**: Role definition + Core principles + Minimal constraints
20
+ - **Philosophy**: Trust the AI's reasoning; provide direction, not prescription
21
+
22
+ **Why Minimal Works for Complex Tasks:**
23
+ - Avoids over-constraining the solution space
24
+ - Allows creative application of principles
25
+ - Reduces cognitive load from excessive instructions
26
+ - Trusts AI's pattern recognition and reasoning
27
+
28
+ ---
29
+
30
+ ### Format 2: METADATA (Medium Complexity)
31
+
32
+ **Use For:**
33
+ - Structured workflows with clear steps
34
+ - API development with specifications
35
+ - DevOps pipeline automation
36
+ - Data processing pipelines
37
+ - Configuration management
38
+
39
+ **Characteristics:**
40
+ - **Length**: 400-700 lines
41
+ - **Structure**: Detailed specifications + Requirements + Structured examples
42
+ - **Philosophy**: Provide scaffolding through metadata; guide without examples
43
+
44
+ **Why Metadata Works for Medium Tasks:**
45
+ - Provides structure without over-prescribing implementation
46
+ - Ensures completeness through checklists
47
+ - Balances guidance with flexibility
48
+ - Clearly defines requirements and success criteria
49
+
50
+ ---
51
+
52
+ ### Format 3: CODE-HEAVY (Basic Tasks)
53
+
54
+ **Use For:**
55
+ - Basic CRUD operations
56
+ - Simple parsing and string manipulation
57
+ - Standard configuration tasks
58
+ - Common testing patterns
59
+ - Straightforward implementations
60
+
61
+ **Characteristics:**
62
+ - **Length**: 700-1200 lines
63
+ - **Structure**: Detailed examples + Code patterns + Step-by-step guidance
64
+ - **Philosophy**: Show exactly what good looks like; prime with concrete examples
65
+
66
+ **Why Code-Heavy Works for Basic Tasks:**
67
+ - Concrete examples reduce ambiguity
68
+ - Patterns prime the AI for correct idioms
69
+ - Step-by-step guidance ensures completeness
70
+ - Visual comparisons (❌ vs ✅) reinforce best practices
71
+ - Reduces iteration cycles for straightforward tasks
72
+
73
+ ---
74
+
75
+ ## Format Selection Decision Tree
76
+
77
+ ```
78
+ ┌─────────────────────────────────────────────────────┐
79
+ │ What is the PRIMARY task complexity? │
80
+ └─────────────────────────────────────────────────────┘
81
+
82
+ ┌───────────────┼───────────────┐
83
+ │ │ │
84
+ ▼ ▼ ▼
85
+ ┌───────┐ ┌─────────┐ ┌─────────┐
86
+ │ BASIC │ │ MEDIUM │ │ COMPLEX │
87
+ └───────┘ └─────────┘ └─────────┘
88
+ │ │ │
89
+ │ │ │
90
+ ▼ ▼ ▼
91
+
92
+ ┌─────────────┐ ┌───────────────┐ ┌──────────────┐
93
+ │ CODE-HEAVY │ │ METADATA │ │ MINIMAL │
94
+ │ FORMAT │ │ FORMAT │ │ FORMAT │
95
+ └─────────────┘ └───────────────┘ └──────────────┘
96
+
97
+ Examples: Examples: Examples:
98
+ - Parsing - API dev - Architecture
99
+ - CRUD ops - CI/CD - Code review
100
+ - String manip - Data pipeline - Research
101
+ - Config files - Workflow auto - Strategy
102
+ - Unit tests - ETL processes - Design
103
+
104
+ Quality: Quality: Quality:
105
+ +43% vs Min Balanced +31% vs Code
106
+
107
+ Lines: Lines: Lines:
108
+ 700-1200 400-700 200-400
109
+ ```
110
+
111
+ ## Decision Factors Matrix
112
+
113
+ | Factor | Basic (Code-Heavy) | Medium (Metadata) | Complex (Minimal) |
114
+ |--------|-------------------|-------------------|-------------------|
115
+ | **Task Nature** | Straightforward, well-defined | Multi-step, structured | Open-ended, strategic |
116
+ | **Ambiguity** | Low (clear inputs/outputs) | Medium (some interpretation) | High (requires reasoning) |
117
+ | **Creativity Required** | Low (follow patterns) | Medium (adapt patterns) | High (novel solutions) |
118
+ | **Domain Expertise** | Low-Medium | Medium | High |
119
+ | **Iteration Tolerance** | Low (want first-time success) | Medium | High (expect refinement) |
120
+ | **Example Benefit** | High (priming effect) | Medium (reference) | Low (constraining) |
121
+
122
+ ---
123
+
124
+ ## The Sparse Language Findings
125
+
126
+ ### Executive Summary from Benchmark Testing
127
+
128
+ Our comprehensive benchmarking system tested three agent formats across 5 Rust complexity levels (basic to master) and 10 JavaScript scenarios.
129
+
130
+ #### Key Discoveries
131
+
132
+ **1. The Complexity-Verbosity Inverse Law**
133
+
134
+ ```
135
+ Task Complexity ↑ → Prompt Verbosity ↓
136
+
137
+ Basic Tasks (parsing, CRUD):
138
+ - Code-Heavy: 85.3% quality (+43% vs Minimal)
139
+ - Metadata: 78.9% quality
140
+ - Minimal: 59.6% quality
141
+
142
+ Complex Tasks (architecture, lock-free algorithms):
143
+ - Minimal: 87.2% quality (+31% vs Code-Heavy)
144
+ - Metadata: 74.5% quality
145
+ - Code-Heavy: 66.4% quality (over-constrained)
146
+ ```
147
+
148
+ **Why This Happens:**
149
+ - **Basic tasks**: Benefit from concrete examples and patterns (priming effect)
150
+ - **Complex tasks**: Need reasoning freedom; verbose prompts create tunnel vision
151
+ - **Medium tasks**: Structured metadata provides scaffolding without over-constraining
152
+
153
+ **2. The Priming Paradox**
154
+
155
+ ```yaml
156
+ Priming Effect:
157
+ Definition: "Providing examples/patterns guides behavior"
158
+
159
+ Positive Priming (Basic Tasks):
160
+ - Code examples → faster convergence
161
+ - Pattern demonstrations → correct idioms
162
+ - Concrete syntax → fewer compile errors
163
+
164
+ Negative Priming (Complex Tasks):
165
+ - Excessive examples → tunnel vision
166
+ - Over-specification → missed creative solutions
167
+ - Pattern fixation → suboptimal architectures
168
+ ```
169
+
170
+ **3. Language-Specific Validation Status**
171
+
172
+ | Language | Validation Status | Evidence | Confidence |
173
+ |----------|------------------|----------|------------|
174
+ | **Rust** | ✅ **VALIDATED** | 60 benchmark runs, statistical significance | **HIGH** |
175
+ | JavaScript | 🟡 **HYPOTHESIS** | 60 benchmark runs, patterns observed | **MEDIUM** |
176
+ | TypeScript | 🟡 **HYPOTHESIS** | Extrapolated from JS findings | **MEDIUM** |
177
+ | Python | 🟡 **HYPOTHESIS** | Similar to JS patterns | **LOW-MEDIUM** |
178
+ | Go | 🟡 **HYPOTHESIS** | Similar to Rust (system language) | **LOW** |
179
+
180
+ **Recommendation:** Use Rust findings as the baseline; validate for your specific language context.
181
+
182
+ ---
183
+
184
+ ## Quick Start: Choose Your Format in 30 Seconds
185
+
186
+ ```yaml
187
+ Is the task BASIC (parsing, simple logic, CRUD)?
188
+ → Use CODE-HEAVY format (+43% quality improvement)
189
+ → Example: tests/benchmarking-tests/test-agent-code-heavy.md
190
+
191
+ Is the task COMPLEX with clear requirements (architecture, review)?
192
+ → Use MINIMAL format (avoid over-constraining)
193
+ → Example: architecture/system-architect.md
194
+
195
+ Is the task MEDIUM complexity with structured steps?
196
+ → Use METADATA format (structured guidance)
197
+ → Example: development/backend/dev-backend-api.md
198
+ ```
199
+
200
+ ## The Three Golden Rules
201
+
202
+ 1. **Complexity-Verbosity Inverse Law**: As task complexity increases, prompt verbosity should DECREASE
203
+ 2. **Priming Paradox**: Verbose prompts excel at basic tasks, minimal prompts excel at complex reasoning
204
+ 3. **Rust Validation**: These findings are validated for Rust; hypotheses for other languages