claude-flow-novice 2.14.31 → 2.14.33

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 (57) hide show
  1. package/.claude/cfn-data/cfn-loop.db +0 -0
  2. package/.claude/commands/CFN_LOOP_TASK_MODE.md +1 -1
  3. package/.claude/skills/cfn-agent-discovery/agents-registry.json +10 -9
  4. package/.claude/skills/cfn-docker-agent-spawning/SKILL.md +394 -0
  5. package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +521 -0
  6. package/.claude/skills/cfn-docker-loop-orchestration/SKILL.md +449 -0
  7. package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +787 -0
  8. package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +435 -0
  9. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +635 -0
  10. package/.claude/skills/cfn-docker-skill-mcp-selection/SKILL.md +289 -0
  11. package/.claude/skills/cfn-docker-skill-mcp-selection/skill-mcp-selector.js +472 -0
  12. package/.claude/skills/cfn-loop-validation/config.json +2 -2
  13. package/.claude/skills/pre-edit-backup/backup.sh +107 -0
  14. package/README.md +95 -0
  15. package/claude-assets/agents/README-AGENT_LIFECYCLE.md +10 -37
  16. package/claude-assets/agents/README-VALIDATION.md +8 -0
  17. package/claude-assets/agents/cfn-dev-team/README.md +8 -0
  18. package/claude-assets/agents/cfn-dev-team/coordinators/README.md +9 -1
  19. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +71 -9
  20. package/claude-assets/agents/cfn-dev-team/developers/README.md +9 -1
  21. package/claude-assets/agents/cfn-dev-team/documentation/README-VALIDATION.md +8 -0
  22. package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +10 -0
  23. package/claude-assets/agents/cfn-dev-team/reviewers/README.md +9 -1
  24. package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +10 -0
  25. package/claude-assets/agents/cfn-dev-team/test-agent.md +10 -0
  26. package/claude-assets/agents/cfn-dev-team/testers/README.md +9 -1
  27. package/claude-assets/agents/csuite/cto-agent.md +10 -0
  28. package/claude-assets/agents/custom/cfn-system-expert.md +128 -1
  29. package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +5 -1
  30. package/claude-assets/agents/docker-team/csuite/c-suite-template.md +5 -1
  31. package/claude-assets/agents/docker-team/infrastructure/team-coordinator-template.md +5 -1
  32. package/claude-assets/agents/marketing_hybrid/cost_tracker.md +10 -0
  33. package/claude-assets/agents/marketing_hybrid/docker_deployer.md +10 -0
  34. package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +10 -0
  35. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +1 -1
  36. package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +20 -0
  37. package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +20 -0
  38. package/claude-assets/skills/cfn-agent-discovery/agents-registry.json +10 -9
  39. package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +70 -10
  40. package/claude-assets/skills/cfn-loop-validation/config.json +2 -2
  41. package/claude-assets/skills/cfn-memory-management/SKILL.md +271 -0
  42. package/claude-assets/skills/cfn-memory-management/check-memory.sh +160 -0
  43. package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +197 -0
  44. package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +442 -0
  45. package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +306 -0
  46. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +2 -2
  47. package/claude-assets/skills/hook-pipeline/security-scanner.sh +102 -0
  48. package/claude-assets/skills/pre-edit-backup/backup.sh +107 -0
  49. package/dist/cli/agent-command.js +44 -2
  50. package/dist/cli/agent-command.js.map +1 -1
  51. package/dist/cli/config-manager.js +91 -109
  52. package/dist/cli/config-manager.js.map +1 -1
  53. package/dist/cli/index.js +29 -2
  54. package/dist/cli/index.js.map +1 -1
  55. package/package.json +22 -5
  56. package/scripts/deploy-production.sh +356 -0
  57. package/scripts/memory-leak-prevention.sh +306 -0
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: readme-agent-lifecycle
3
+ description: Documentation file for agent lifecycle management and CFN loop protocols
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Agent Lifecycle Documentation
2
10
 
3
11
  **Version:** 2.0 (Post-Waiting Mode Removal)
@@ -52,15 +60,6 @@ This document clarifies the complete lifecycle of agents in the CFN Loop system,
52
60
  2. **Report confidence:**
53
61
  ```bash
54
62
  ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
55
-
56
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
57
-
58
- **Why This Matters:**
59
- - Orchestrator collects confidence/consensus scores from Redis
60
- - Enables adaptive agent specialization for next iteration
61
- - Prevents orchestrator blocking on wait $PID
62
- - Coordinator spawns appropriate specialist based on feedback type
63
-
64
63
  --task-id "$TASK_ID" \
65
64
  --agent-id "$AGENT_ID" \
66
65
  --confidence [0.0-1.0] \
@@ -106,15 +105,6 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
106
105
  ### Step 3: Report Confidence Score
107
106
  ```bash
108
107
  ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
109
-
110
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
111
-
112
- **Why This Matters:**
113
- - Orchestrator collects confidence/consensus scores from Redis
114
- - Enables adaptive agent specialization for next iteration
115
- - Prevents orchestrator blocking on wait $PID
116
- - Coordinator spawns appropriate specialist based on feedback type
117
-
118
108
  --task-id "$TASK_ID" \
119
109
  --agent-id "$AGENT_ID" \
120
110
  --confidence [0.0-1.0] \
@@ -165,15 +155,6 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
165
155
  ### Step 5: Report Consensus Score
166
156
  ```bash
167
157
  ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
168
-
169
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
170
-
171
- **Why This Matters:**
172
- - Orchestrator collects confidence/consensus scores from Redis
173
- - Enables adaptive agent specialization for next iteration
174
- - Prevents orchestrator blocking on wait $PID
175
- - Coordinator spawns appropriate specialist based on feedback type
176
-
177
158
  --task-id "$TASK_ID" \
178
159
  --agent-id "$AGENT_ID" \
179
160
  --confidence [0.0-1.0] \
@@ -299,6 +280,7 @@ CONFIDENCE=$(redis-cli get "swarm:${TASK_ID}:${AGENT_ID}:confidence")
299
280
  ### ❌ Anti-Pattern 1: Waiting Mode
300
281
  ```bash
301
282
  # WRONG - DO NOT USE:
283
+ ./.claude/skills/redis-coordination/invoke-waiting-mode.sh wait \
302
284
  --task-id "$TASK_ID" \
303
285
  --agent-id "$AGENT_ID"
304
286
  ```
@@ -346,15 +328,6 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
346
328
 
347
329
  # Step 2: Report confidence
348
330
  ./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
349
-
350
- **After reporting, exit cleanly. Do NOT enter waiting mode.**
351
-
352
- **Why This Matters:**
353
- - Orchestrator collects confidence/consensus scores from Redis
354
- - Enables adaptive agent specialization for next iteration
355
- - Prevents orchestrator blocking on wait $PID
356
- - Coordinator spawns appropriate specialist based on feedback type
357
-
358
331
  --task-id "$TASK_ID" \
359
332
  --agent-id "$AGENT_ID" \
360
333
  --confidence 0.95 \
@@ -519,4 +492,4 @@ swarm:{TASK_ID}:metrics:iteration_start → List of timestamps
519
492
 
520
493
  **Version History:**
521
494
  - v1.0: Original with waiting mode
522
- - v2.0 (2025-10-21): Waiting mode removed, PATTERN-022 compliant
495
+ - v2.0 (2025-10-21): Waiting mode removed, PATTERN-022 compliant
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: readme-validation-main
3
+ description: Documentation file for agent profile validation tool and standards compliance
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Agent Profile Validation Tool
2
10
 
3
11
  A comprehensive validation script that checks agent profiles against CLAUDE.md standards and provides actionable feedback.
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: cfn-dev-team-readme
3
+ description: Documentation file for CFN dev team agent structure and organization overview
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # CFN Dev Team Agent Structure
2
10
 
3
11
  ## Overview
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: coordinators-readme
3
+ description: Documentation file for CFN dev team coordinators overview and usage patterns
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Coordinators
2
10
 
3
11
  Agent profiles for coordination and orchestration of multi-agent workflows.
@@ -39,4 +47,4 @@ Coordinator handles all agent spawning internally via orchestration scripts.
39
47
  ## Related Skills
40
48
  - `.claude/skills/cfn-redis-coordination/` - Multi-agent coordination patterns
41
49
  - `.claude/skills/cfn-loop-validation/` - CFN Loop mechanics
42
- - `.claude/skills/cfn-agent-spawning/` - CLI spawning patterns
50
+ - `.claude/skills/cfn-agent-spawning/` - CLI spawning patterns
@@ -16,18 +16,16 @@ You coordinate CFN Loop v3 execution with Redis-based agent orchestration and CL
16
16
 
17
17
  Orchestrate CFN Loop v3 execution using Redis coordination for CLI agent spawning, context management, and consensus collection.
18
18
 
19
- ## Mode-Specific Execution
19
+ ## CLI Mode Execution (Coordinator is ALWAYS CLI Mode)
20
20
 
21
- **CLI Mode (Production):**
21
+ **IMPORTANT:** This coordinator agent is **ALWAYS CLI mode**. Task mode coordination happens directly in Main Chat, not via coordinator agents.
22
+
23
+ When spawned via CLI (`npx claude-flow-novice agent-spawn`), implement full Redis coordination:
22
24
  - Use Redis coordination for agent spawning
23
25
  - Store context in Redis for swarm recovery
24
26
  - Collect confidence scores via Redis signals
25
27
  - Use background execution with monitoring
26
-
27
- **Task Mode (Debugging):**
28
- - Direct Task() spawning (no Redis needed)
29
- - Main Chat handles coordination
30
- - Simple JSON response only
28
+ - **ALWAYS invoke the orchestrator** - never handle tasks directly
31
29
 
32
30
  ## Redis Coordination Protocols
33
31
 
@@ -494,11 +492,75 @@ Extract deliverables from task description:
494
492
  - Estimate iteration count
495
493
  - Provide reasoning for choices
496
494
 
495
+ ## Execution Steps (CLI Mode Only)
496
+
497
+ **CRITICAL:** This coordinator is ALWAYS CLI mode. There is no Task Mode execution path.
498
+
499
+ ### Step 1: Task Classification (REQUIRED)
500
+ ```bash
501
+ # Classify task type (use hardcoded defaults if script fails)
502
+ TASK_TYPE="infrastructure" # Default fallback
503
+ if [[ -f ".claude/skills/task-classifier/classify-task.sh" ]]; then
504
+ CLASSIFIED_TYPE=$(bash .claude/skills/task-classifier/classify-task.sh "$TASK_DESCRIPTION" 2>/dev/null || echo "")
505
+ [[ -n "$CLASSIFIED_TYPE" ]] && TASK_TYPE="$CLASSIFIED_TYPE"
506
+ fi
507
+ ```
508
+
509
+ ### Step 2: Agent Selection with Fallback (REQUIRED)
510
+ ```bash
511
+ # Select agents with hardcoded fallbacks (never fail)
512
+ LOOP3_AGENTS="terraform-engineer,devops-engineer" # Infrastructure default
513
+ LOOP2_AGENTS="security-auditor,compliance-checker,cost-optimizer" # Validation default
514
+ PRODUCT_OWNER="product-owner"
515
+
516
+ # Try dynamic selection but fall back to defaults
517
+ if [[ -f ".claude/skills/cfn-agent-selector/select-agents.sh" ]]; then
518
+ SELECTED_AGENTS=$(bash .claude/skills/cfn-agent-selector/select-agents.sh --task-type "$TASK_TYPE" --description "$TASK_DESCRIPTION" 2>/dev/null || echo "")
519
+ if [[ -n "$SELECTED_AGENTS" ]]; then
520
+ PARSED_AGENTS=$(echo "$SELECTED_AGENTS" | jq -r '.loop3 // empty | join(",")')
521
+ [[ -n "$PARSED_AGENTS" ]] && LOOP3_AGENTS="$PARSED_AGENTS"
522
+
523
+ PARSED_AGENTS=$(echo "$SELECTED_AGENTS" | jq -r '.loop2 // empty | join(",")')
524
+ [[ -n "$PARSED_AGENTS" ]] && LOOP2_AGENTS="$PARSED_AGENTS"
525
+ fi
526
+ fi
527
+ ```
528
+
529
+ ### Step 3: INVOKE ORCHESTRATOR (MANDATORY - NOT OPTIONAL)
530
+
531
+ **CRITICAL:** You MUST invoke orchestrator by iteration 3. DO NOT complete tasks directly.
532
+
533
+ ```bash
534
+ # ALWAYS invoke orchestrator - this is your ONLY responsibility
535
+ ./.claude/skills/cfn-loop-orchestration/orchestrate.sh \
536
+ --task-id "$TASK_ID" \
537
+ --mode "standard" \
538
+ --loop3-agents "$LOOP3_AGENTS" \
539
+ --loop2-agents "$LOOP2_AGENTS" \
540
+ --product-owner "$PRODUCT_OWNER" \
541
+ --max-iterations 10 \
542
+ --success-criteria '{"deliverables":[],"acceptanceCriteria":["Implementation complete"]}'
543
+
544
+ # The orchestrator handles ALL CFN Loop execution including:
545
+ # - Loop 3 agent spawning and iteration
546
+ # - Loop 2 validator spawning and consensus
547
+ # - Product Owner decision (PROCEED/ITERATE/ABORT)
548
+ # - Git commit and push (on PROCEED)
549
+ # - Sprint summary generation
550
+
551
+ # Your job is complete after invoking this command - DO NOT wait for results
552
+ ```
553
+
554
+ **EXECUTION GUARANTEE:**
555
+ - If steps 1-2 fail, use hardcoded defaults and proceed to step 3
556
+ - **Never exit without invoking orchestrator**
557
+ - **Orchestrator invocation MUST happen by iteration 3**
558
+ - This coordinator's ONLY job is to configure and invoke the orchestrator
559
+
497
560
  ## Success Metrics
498
561
 
499
562
  - Agent selections match domain expertise
500
563
  - Validation criteria cover all critical requirements
501
564
  - Deliverable list is comprehensive
502
565
  - Confidence score ≥ 0.85 in analysis quality
503
-
504
- Provide structured output with confidence score based on analysis completeness and agent selection appropriateness.
566
+ - **CRITICAL: Orchestrator invoked successfully**
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: developers-readme
3
+ description: Documentation file for CFN dev team developers overview and implementation standards
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Developers
2
10
 
3
11
  Implementation agents focused on building features and components.
@@ -66,4 +74,4 @@ Developers MUST run after every file edit:
66
74
  ./.claude/hooks/cfn-invoke-post-edit.sh "$EDITED_FILE" --agent-id "$AGENT_ID"
67
75
  ```
68
76
 
69
- This ensures code quality, test coverage, and security validation.
77
+ This ensures code quality, test coverage, and security validation.
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: readme-validation
3
+ description: Documentation file for agent profile validation tool usage and standards
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Agent Profile Validation Tool
2
10
 
3
11
  A comprehensive validation script that checks agent profiles against CLAUDE.md standards and provides actionable feedback.
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: agent-type-guidelines
3
+ description: MUST BE USED when creating agent type guidelines and documentation. Use PROACTIVELY for agent architecture, type definitions, development standards. Keywords - agent, guidelines, types, architecture, development
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: sonnet
6
+ type: specialist
7
+ acl_level: 2
8
+ capabilities: [agent-documentation, type-guidelines, architecture-standards]
9
+ ---
10
+
1
11
  # Agent Type Guidelines
2
12
 
3
13
  **Version:** 2.0.0
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: reviewers-readme
3
+ description: Documentation file for CFN dev team reviewers overview and code review standards
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Reviewers
2
10
 
3
11
  Code review and validation agents focused on quality assurance.
@@ -55,4 +63,4 @@ Structured feedback with:
55
63
  - Critical issues (blocking)
56
64
  - Warnings (should fix)
57
65
  - Suggestions (improvements)
58
- - Specific file/line references
66
+ - Specific file/line references
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: quality-metrics
3
+ description: MUST BE USED when measuring agent effectiveness and code quality validation. Use PROACTIVELY for metrics analysis, quality assessment, performance validation. Keywords - quality, metrics, validation, measurement, effectiveness
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: haiku
6
+ type: validator
7
+ acl_level: 2
8
+ capabilities: [quality-metrics, performance-analysis, validation]
9
+ ---
10
+
1
11
  # Quality Metrics & Validation
2
12
 
3
13
  **Version:** 2.0.0
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: test-agent
3
+ description: MUST BE USED when documenting epic creator deletion issues and bug fixes. Use PROACTIVELY for issue tracking, bug documentation, resolution summaries. Keywords - test, bug, issue, documentation, epic, deletion
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: haiku
6
+ type: specialist
7
+ acl_level: 1
8
+ capabilities: [bug-documentation, issue-tracking, test-summary]
9
+ ---
10
+
1
11
  # Epic Creator Deletion Issue - Complete Summary
2
12
 
3
13
  **Date:** 2025-11-03
@@ -1,3 +1,11 @@
1
+ ---
2
+ name: testers-readme
3
+ description: Documentation file for CFN dev team testers overview and testing standards
4
+ tools: []
5
+ model: haiku
6
+ type: documentation
7
+ ---
8
+
1
9
  # Testers
2
10
 
3
11
  Testing and validation specialists ensuring code quality and correctness.
@@ -91,4 +99,4 @@ Structured report with:
91
99
  - Test execution summary
92
100
  - Coverage analysis
93
101
  - Failed test details
94
- - Recommendations for improvement
102
+ - Recommendations for improvement
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: cto-agent
3
+ description: MUST BE USED when making strategic technical decisions and architectural oversight. Use PROACTIVELY for technical roadmap planning, architecture reviews, strategic guidance. Keywords - CTO, technical strategy, architecture, leadership, oversight
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: sonnet
6
+ type: coordinator
7
+ acl_level: 4
8
+ capabilities: [technical-strategy, architecture-oversight, leadership]
9
+ ---
10
+
1
11
  # CTO Agent - Dr. Tech
2
12
 
3
13
  ## Role Identity
@@ -256,4 +256,131 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
256
256
  - `.claude/skills/cfn-redis-coordination/SKILL.md`: Coordination patterns
257
257
  - `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`: Parameter specifications
258
258
  - `planning/cfn-v3/DUAL_MODE_IMPLEMENTATION.md`: Architecture details
259
- - Planning documents: Sprint lessons and adaptive context insights
259
+ - Planning documents: Sprint lessons and adaptive context insights
260
+
261
+ ## CFN Implementation Patterns & Lessons Learned
262
+
263
+ ### Core Architecture Patterns
264
+
265
+ #### STRAT-007: Background Execution Strategy
266
+ - **Insight**: Use background execution with coordination monitoring for long-running orchestration workflows (>10 minutes). Bash tool has hard 10-minute timeout that cannot be extended.
267
+ - **Application**: Essential for CFN Loop orchestration that exceeds standard timeout limits.
268
+
269
+ #### PATTERN-008: Product Owner Decision Flow
270
+ - **Insight**: Implement explicit Product Owner decision flow after Loop 2 consensus to prevent validator scope creep and enforce strategic boundaries.
271
+ - **Application**: Core CFN Loop governance pattern ensuring proper decision hierarchy.
272
+
273
+ #### PATTERN-010: Parallel Execution with Temp Files
274
+ - **Insight**: Use background processes with temporary files to eliminate race conditions in parallel agent coordination. Pattern: spawn all agents in background with `(skill-execution > /tmp/output-file) &`, collect PIDs, use `wait` to synchronize, read results from temp files after completion.
275
+ - **Application**: Optimizes CFN Loop parallel agent execution while maintaining coordination integrity.
276
+
277
+ ### Context Management Patterns
278
+
279
+ #### STRAT-021: Standardized Context Extraction Templates
280
+ - **Insight**: Use standardized context extraction templates in coordinators. Template structure: epicGoal (1-2 sentences), inScope (list), outOfScope (list), deliverables (file paths), directory (creation path), acceptanceCriteria (measurable requirements).
281
+ - **Application**: Prevents minimal context that causes wrong deliverables in CFN execution.
282
+
283
+ #### PATTERN-020: Multi-Layer Context Injection
284
+ - **Context**: Coordinator → Orchestrator → Agent Flow
285
+ - **Insight**: When implementing multi-layer coordination, ensure context flows through ALL layers. Breaking this chain causes 'consensus on vapor' (high confidence, zero deliverables).
286
+ - **Application**: Critical for CFN Loop context integrity across coordinator-orchestrator-agent chain.
287
+
288
+ #### PATTERN-021: Context Validation Pipeline
289
+ - **Context**: Multi-Layer Coordination
290
+ - **Insight**: Design context validation pipeline with checkpoints at each layer. Pattern: (1) Coordinator validates extracted context, (2) Orchestrator validates persistence retrieval, (3) Agents validate received context.
291
+ - **Application**: Fail-fast prevents cascading context loss in CFN workflows.
292
+
293
+ #### PATTERN-022: Agent Lifecycle - Clean Exit Protocol
294
+ - **Insight**: Agents must exit cleanly after reporting confidence. Pattern: (1) Signal done via coordination protocol, (2) Report confidence score, (3) Exit immediately.
295
+ - **Application**: Enables adaptive agent specialization and prevents orchestrator blocking.
296
+
297
+ ### Sprint Execution Patterns
298
+
299
+ #### Sprint Context Structure
300
+ ```json
301
+ {
302
+ "sprint_name": "P1 Coordinator Monitoring",
303
+ "sprint_num": 1,
304
+ "total_sprints": 7,
305
+ "deliverables": [
306
+ "test-p1-monitoring.sh",
307
+ "docs/P1_MONITORING_RESULTS.md"
308
+ ],
309
+ "in_scope": [
310
+ "P1 coordinator monitoring validation",
311
+ "Test timeout mechanisms",
312
+ "Logging verification"
313
+ ],
314
+ "out_of_scope": [
315
+ "P2-P7 monitoring",
316
+ "Cross-priority integration",
317
+ "Epic-level summary"
318
+ ],
319
+ "directory": "/mnt/c/Users/masha/Documents/claude-flow-novice/tests/p1"
320
+ }
321
+ ```
322
+
323
+ #### Sprint Execution Tool: `execute-sprint-task.sh`
324
+ - **Purpose**: Enables sprint-aware agent execution with focused context injection
325
+ - **Usage**: Decompose large epics into focused sprints with clear deliverables and scope boundaries
326
+ - **Key Principles**: Focused scope, incremental progress, precise deliverables, context specificity
327
+
328
+ ### CFN v3 Advanced Patterns
329
+
330
+ #### STRAT-026: Persistence Context Storage Over CLI Parameters
331
+ - **Insight**: Use persistence layer for complex JSON context storage instead of CLI parameters. Eliminates shell escaping issues, enables swarm recovery, and provides single source of truth.
332
+ - **Application**: Foundation for CFN v3 dual-mode architecture.
333
+
334
+ #### PATTERN-023: Dual-Mode Architecture Pattern
335
+ - **Insight**: Implement dual execution modes (optimized vs simplified) sharing core logic. CLI mode for production (cost-optimized), Task mode for debugging (full visibility).
336
+ - **Application**: Enables flexible CFN execution based on user needs.
337
+
338
+ #### PATTERN-024: Swarm Recovery via Persistence
339
+ - **Insight**: Store swarm state in persistence layer with TTL to enable crash recovery. Agents can resume from last known state using task_id as recovery key.
340
+ - **Application**: Critical for long-running CFN Loops and system reliability.
341
+
342
+ #### STRAT-028: Modular Skill Architecture
343
+ - **Insight**: Decompose complex systems into independent skills (20 skills in CFN v3). Enables reuse, testing isolation, and incremental enhancement.
344
+ - **Application**: Core architectural principle for CFN system maintainability.
345
+
346
+ ### CFN Anti-Patterns & Prevention
347
+
348
+ #### ANTI-020: Context Storage Without Injection
349
+ - **Context**: Coordination Systems
350
+ - **Insight**: Avoid storing context in persistence layer without retrieving and injecting it into agent prompts.
351
+ - **Prevention**: Always validate context injection chain: storage → retrieval → agent delivery.
352
+
353
+ #### ANTI-021: Generic Context When Specifics Exist
354
+ - **Context**: Agent Spawning
355
+ - **Insight**: Never pass generic iteration-level context when task-specific deliverables exist.
356
+ - **Prevention**: Always inject complete deliverables, directory paths, and acceptance criteria.
357
+
358
+ #### ANTI-023: Task-Spawned Validators Without Completion Protocol
359
+ - **Context**: Loop 2 Validation (Task Mode)
360
+ - **Insight**: Main Chat spawns validators via Task() without clear scope boundaries or mode-aware completion protocols.
361
+ - **Prevention**: Task-spawned validators should return structured output only - no coordination signals.
362
+
363
+ ### CFN Testing & Debugging
364
+
365
+ #### EDGE-020: Comparative Agent Spawn Testing
366
+ - **Context**: Context Debugging
367
+ - **Insight**: When debugging context issues, use comparative agent spawn testing. Manual spawn with explicit context vs CFN Loop with generic context reveals injection failures.
368
+ - **Application**: Primary debugging technique for context-related CFN issues.
369
+
370
+ ### Universal Anti-Patterns (CFN Relevance)
371
+
372
+ #### ANTI-004: Regex Validation Anti-Pattern
373
+ - **Insight**: Avoid simplistic regex matching for agent validation. Pattern `[[ $AGENTS =~ $AGENTS ]]` always returns true.
374
+ - **CFN Relevance**: Critical for agent validation logic in CFN coordination.
375
+
376
+ #### PATTERN-025: Comprehensive File Validation
377
+ - **Insight**: Implement multi-stage validation including file type, permissions, size constraints, and content integrity.
378
+ - **CFN Relevance**: Essential for CFN deliverable verification and security.
379
+
380
+ #### PATTERN-026: Shell Strict Mode
381
+ - **Insight**: Enable shell strict mode using `set -euo pipefail` for robust and predictable shell scripts.
382
+ - **CFN Relevance**: Critical reliability pattern for all CFN skill scripts.
383
+
384
+ #### PATTERN-028: Process Group Management
385
+ - **Insight**: Implement comprehensive process group management for clean termination and resource cleanup.
386
+ - **CFN Relevance**: Essential for CFN background process orchestration and preventing resource leaks.
@@ -1,7 +1,11 @@
1
1
  ---
2
- description: "CFN Docker v3 Coordinator - Container-based agent orchestration with skill-based MCP isolation"
2
+ name: cfn-docker-v3-coordinator
3
+ description: MUST BE USED when orchestrating container-based CFN Loop execution with MCP isolation. Use PROACTIVELY for docker-based agent coordination, skill selection, resource management. Keywords - docker, containers, orchestration, MCP, isolation
3
4
  argument-hint: "[task-description] --mode=mvp|standard|enterprise --memory-limit=1g --docker-network=mcp-network"
4
5
  allowed-tools: ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "TodoWrite", "Task"]
6
+ model: sonnet
7
+ type: coordinator
8
+ acl_level: 3
5
9
  ---
6
10
 
7
11
  # CFN Docker V3 Coordinator
@@ -1,8 +1,12 @@
1
1
  ---
2
- description: C-Suite executive personas for strategic decision-making in organizational architecture
2
+ name: c-suite-template
3
+ description: MUST BE USED when creating C-Suite executive personas for strategic decision-making. Use PROACTIVELY for organizational architecture, executive strategy, decision authority. Keywords - c-suite, executive, strategy, decision-making, leadership
3
4
  tools: [Read, Write, TodoWrite, Bash]
4
5
  priority: medium
5
6
  tags: [csuite, executive, strategy, decision-making, cmo, cfo, coo, ceo]
7
+ model: sonnet
8
+ type: specialist
9
+ acl_level: 4
6
10
  ---
7
11
 
8
12
  # C-Suite Agent Template
@@ -1,8 +1,12 @@
1
1
  ---
2
- description: Generate team-specific coordinator configurations for Docker organizational architecture
2
+ name: team-coordinator-template
3
+ description: MUST BE USED when generating team-specific coordinator configurations for Docker architecture. Use PROACTIVELY for infrastructure templating, team configuration, Docker services. Keywords - docker, infrastructure, templating, coordinator, team-config
3
4
  tools: [Read, Write, Edit, Bash, Grep, Glob]
4
5
  priority: high
5
6
  tags: [docker, infrastructure, templating, coordinator, team-config]
7
+ model: haiku
8
+ type: specialist
9
+ acl_level: 3
6
10
  ---
7
11
 
8
12
  # Team Coordinator Template Agent
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: cost-tracker
3
+ description: MUST BE USED when monitoring Z.ai worker costs during pilot testing. Use PROACTIVELY for cost tracking, budget monitoring, expense reporting. Keywords - cost, tracking, monitoring, Z.ai, budget, expenses
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: haiku
6
+ type: specialist
7
+ acl_level: 2
8
+ capabilities: [cost-monitoring, budget-tracking, expense-reporting]
9
+ ---
10
+
1
11
  # Cost Tracking Agent
2
12
  ## Role
3
13
  Monitor Z.ai worker costs during 48-hour pilot
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: docker-deployer
3
+ description: MUST BE USED when deploying marketing coordinator services via Docker. Use PROACTIVELY for container deployment, service configuration, docker-compose management. Keywords - docker, deploy, containers, docker-compose, services
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: haiku
6
+ type: specialist
7
+ acl_level: 2
8
+ capabilities: [docker-deployment, container-management, service-configuration]
9
+ ---
10
+
1
11
  # Docker Deployer Agent
2
12
  ## Role
3
13
  Deploy marketing coordinator using docker-compose.hybrid.yml
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: zai-worker-spawner
3
+ description: MUST BE USED when spawning Z.ai workers for marketing pilot testing. Use PROACTIVELY for worker orchestration, API configuration, service scaling. Keywords - Z.ai, worker, spawner, scaling, orchestration
4
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
5
+ model: haiku
6
+ type: specialist
7
+ acl_level: 2
8
+ capabilities: [worker-spawning, service-orchestration, api-configuration]
9
+ ---
10
+
1
11
  # Z.ai Worker Spawner Agent
2
12
  ## Role
3
13
  Spawn 3 Z.ai workers for marketing pilot
@@ -467,7 +467,7 @@ Complex/Enterprise (>5 files, >500 LOC): +code-analyzer
467
467
  ### Complexity Analysis CLI
468
468
  ```bash
469
469
  ./.claude/skills/task-complexity/analyze.sh --task "$DESC" --files "$LIST"
470
- # Output: {"score": 85, "category": "standard", "validators": ["reviewer","tester","architect","security-specialist"], "threshold": 0.90}
470
+ # Output: {"score": 85, "category": "standard", "validators": ["reviewer","tester","system-architect","security-specialist"], "threshold": 0.90}
471
471
  ```
472
472
 
473
473
  ---
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+
3
+ # CFN Post-Execution Memory Cleanup Hook
4
+ # Automatically cleans up memory resources after CFN operations
5
+
6
+ set -euo pipefail
7
+
8
+ # Hook configuration
9
+ HOOK_SCRIPT_PATH="$(dirname "$0")/memory-cleanup.sh"
10
+ MEMORY_MANAGEMENT_SKILL="$(dirname "$0")/../../skills/cfn-memory-management/cleanup-memory.sh"
11
+
12
+ # Use the memory management skill if available, otherwise use local fallback
13
+ if [[ -f "$MEMORY_MANAGEMENT_SKILL" ]]; then
14
+ exec "$MEMORY_MANAGEMENT_SKILL" "$@"
15
+ elif [[ -f "$HOOK_SCRIPT_PATH" ]]; then
16
+ exec "$HOOK_SCRIPT_PATH" "$@"
17
+ else
18
+ echo "WARNING: Memory cleanup scripts not found, skipping cleanup"
19
+ exit 0
20
+ fi
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+
3
+ # CFN Pre-Execution Memory Check Hook
4
+ # Automatically checks memory availability before CFN operations
5
+
6
+ set -euo pipefail
7
+
8
+ # Hook configuration
9
+ HOOK_SCRIPT_PATH="$(dirname "$0")/memory-check.sh"
10
+ MEMORY_MANAGEMENT_SKILL="$(dirname "$0")/../../skills/cfn-memory-management/check-memory.sh"
11
+
12
+ # Use the memory management skill if available, otherwise use local fallback
13
+ if [[ -f "$MEMORY_MANAGEMENT_SKILL" ]]; then
14
+ exec "$MEMORY_MANAGEMENT_SKILL" "$@"
15
+ elif [[ -f "$HOOK_SCRIPT_PATH" ]]; then
16
+ exec "$HOOK_SCRIPT_PATH" "$@"
17
+ else
18
+ echo "WARNING: Memory check scripts not found, proceeding without memory validation"
19
+ exit 0
20
+ fi