UNPKG

claude-flow-novice

Version:

Claude Flow Novice - Advanced orchestration platform for multi-agent AI workflows with CFN Loop architecture Includes Local RuVector Accelerator and all CFN skills for complete functionality.

35 lines (34 loc) 9.23 kB
{ "task_id": "test-hooks-in-agent", "extraction_timestamp": "2025-11-09T09:16:50Z", "extraction_version": "1.0.0", "redis_keys_analyzed": 5, "agents": { "backend-developer-1": { "agent_type": "backend-developer", "loop": "3", "data": {}, "confidence": 0.9, "completion_signal": "complete", "messages": [ "{\"role\":\"user\",\"content\":\"# Agent: backend-developer\\n\\nMUST BE USED when developing scalable backend services with comprehensive testing. Use PROACTIVELY for backend architecture, API design, database optimization, security implementation. Keywords - backend, API, database, scalability, security, testing, validation\\n\\n## Task\\n\\nCreate a simple test file called /tmp/agent-hooks-test.js with console.log('Hello World') and run a basic validation\\n\\n**Task ID:** test-hooks-in-agent\\n\\n## Agent Definition\\n\\n# Backend Developer Agent\\n\\n## Core Responsibilities\\n- Design and implement scalable backend services\\n- Create robust API endpoints\\n- Ensure data integrity and security\\n- Optimize database interactions\\n- Implement comprehensive error handling\\n\\n## Technical Stack\\n- Languages: Python, Go, Node.js\\n- Databases: PostgreSQL, MongoDB\\n- Frameworks: Express, Django, Flask\\n- Cloud: AWS, GCP, Azure\\n- Containerization: Docker, Kubernetes\\n\\n## Mandatory Validation Protocol\\n\\n### API Endpoint Testing (REQUIRED)\\nAfter creating or modifying API endpoints, you MUST perform functional testing:\\n\\n1. **Direct Endpoint Testing**:\\n ```bash\\n # Test single request\\n curl -s http://localhost:PORT/api/endpoint | jq .\\n\\n # Test error handling\\n curl -s http://localhost:PORT/api/invalid | jq .\\n\\n # Verify status codes\\n curl -I http://localhost:PORT/api/endpoint\\n ```\\n\\n2. **Polling Behavior Testing** (for auto-refresh endpoints):\\n ```bash\\n # Simulate 10 requests (20 seconds of usage)\\n for i in {1..10}; do\\n curl -s http://localhost:PORT/api/endpoint | jq .taskId\\n sleep 2\\n done\\n ```\\n\\n3. **Rate Limiting Validation**:\\n - Calculate expected request volume\\n - Verify rate limits exclude high-frequency endpoints\\n - Test that dashboards don't hit 429 errors\\n\\n### Tool Usage\\n- **Primary**: Bash tool for curl testing\\n- **Fallback**: Request validation via code review only if Bash unavailable\\n- **Browser Tools** (if available): mcp__playwright__browser_network_requests, mcp__chrome-devtools__list_console_messages\\n\\n### Confidence Reporting\\n- ❌ DO NOT report >0.80 confidence without functional testing\\n- ✅ MUST include test results in confidence assessment\\n- Document: \\\"Tested with curl: X requests succeeded, Y failed\\\"\\n\\n## Best Practices\\n- Use middleware for authentication\\n- Implement comprehensive logging\\n- Design for horizontal scalability\\n- Follow RESTful API design principles\\n- Use TypeScript/strong typing where possible\\n\\n## Security Guidelines\\n- Sanitize all input data\\n- Implement rate limiting\\n- Use secure JWT token management\\n- Encrypt sensitive data at rest\\n- Follow OWASP top 10 security practices\\n\\n## Performance Optimization\\n- Index database queries\\n- Implement caching strategies\\n- Use connection pooling\\n- Profile and optimize slow queries\\n- Minimize N+1 query patterns\\n\\n## Completion Protocol\\n\\nComplete your work and provide a structured response with:\\n- Confidence score (0.0-1.0) based on work quality\\n- Summary of analysis/review completed\\n- List of findings or deliverables\\n- Any recommendations made\\n\\n**Note:** Coordination instructions are provided when spawned via CLI.\\n\\n\\n## CFN Loop Redis Completion Protocol\\n\\nYou are participating in a CFN Loop workflow. Follow this protocol EXACTLY:\\n\\n### Step 1: Complete Your Work\\nExecute your assigned task (implementation, review, testing, etc.)\\n\\n### Step 2: Calculate Confidence Score\\nAssess your work quality and assign a confidence score (0.0-1.0):\\n- 0.90-1.0: Excellent, production-ready\\n- 0.75-0.89: Good, minor issues possible\\n- 0.50-0.74: Acceptable, needs review\\n- 0.0-0.49: Poor, significant issues\\n\\n### Step 3: Report Completion to Redis\\n```bash\\n./.claude/skills/cfn-redis-coordination/report-completion.sh \\\\\\n --task-id \\\"test-hooks-in-agent\\\" \\\\\\n --agent-id \\\"backend-developer-1\\\" \\\\\\n --confidence [YOUR_CONFIDENCE_SCORE] \\\\\\n --iteration ${ITERATION:-1}\\n```\\n\\nThis script automatically:\\n- Signals completion via `swarm:test-hooks-in-agent:backend-developer-1:done`\\n- Stores confidence in `swarm:test-hooks-in-agent:backend-developer-1:confidence`\\n- Creates result hash in `swarm:test-hooks-in-agent:backend-developer-1:result`\\n- Updates SQLite persistence layer\\n\\n### Step 4: Exit Cleanly\\nAfter reporting, exit immediately. DO NOT enter waiting mode.\\n\\nThe orchestrator will:\\n- Collect confidence scores from all agents\\n- Run gate check (≥0.75 threshold)\\n- Spawn validators if gate passes\\n- Spawn fresh agents for iteration N+1 if needed\\n\\n**Environment Variables Available:**\\n- TASK_ID: test-hooks-in-agent\\n- AGENT_ID: backend-developer-1\\n- ITERATION: Current iteration number (default: 1)\\n- CONFIDENCE_SCORE: Your final confidence assessment\\n\\n**Why This Matters:**\\n- Enables zero-token coordination (orchestrator uses Redis BLPOP)\\n- Supports adaptive agent specialization (spawn different specialist for iteration N+1)\\n- Prevents memory leaks (agents exit after reporting)\\n- Confidence scores drive gate checks and consensus validation\\n\\n**CRITICAL:** Report completion before exiting. Orchestrator is waiting for your signal.\\n\\n\\n\\n## Environment Variables\\n\\n```bash\\nTASK_ID=test-hooks-in-agent\\n```\\n\\n\\n## Execution Instructions\\n\\n1. Read and understand the task requirements\\n2. Execute your core responsibilities as defined above\\n3. Follow any protocol steps (CFN Loop, validation hooks, etc.)\\n4. Provide clear, concise output\\n5. Report confidence score if applicable\\n\\n## Pre-Edit Backup Protocol (MANDATORY)\\n\\n**BEFORE ANY Edit/Write/MultiEdit operation, you MUST create a backup:**\\n\\n```bash\\nBACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh \\\"$FILE_TO_EDIT\\\" --agent-id \\\"backend-developer-1\\\")\\n```\\n\\n**Why:** Enables safe file revert without git operations during parallel sessions.\\n**Location:** `.backups/[agent-id]/[timestamp]_[hash]/`\\n**Retention:** 24h TTL (configurable)\\n\\n**Complete Edit Workflow:**\\n```bash\\n# 1. Pre-Edit: Create backup\\nBACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh \\\"src/file.ts\\\" --agent-id \\\"backend-developer-1\\\")\\n\\n# 2. Edit: Perform file modification\\nEdit: file_path=\\\"src/file.ts\\\" old_string=\\\"...\\\" new_string=\\\"...\\\"\\n\\n# 3. Post-Edit: Validate changes\\n./.claude/hooks/cfn-invoke-post-edit.sh \\\"src/file.ts\\\" --agent-id \\\"backend-developer-1\\\"\\n```\\n\\n## Available Tools\\n\\nYou have access to: Read, Write, Edit, Bash, Grep, TodoWrite\\n\",\"iteration\":1,\"timestamp\":\"2025-11-09T09:16:43.604Z\"}", "{\"role\":\"assistant\",\"content\":\"I'll create the test file and run validation. Let me start by creating the pre-edit backup and then creating the file.\\nI'll create the test file first since it doesn't exist yet, then run the validation:\\nNow let me run a basic validation test by executing the Node.js file:\\nPerfect! Let me also check the file content to confirm it's correct:\\nNow I'll report completion to Redis with the coordination protocol:\\n## Task Completion Summary\\n\\n**Analysis completed:** Created and validated a simple Node.js test file for hook testing.\\n\\n**Findings:**\\n- ✅ Successfully created `/tmp/agent-hooks-test.js` with `console.log('Hello World')`\\n- ✅ File execution works correctly (outputs \\\"Hello World\\\")\\n- ✅ Post-edit validation completed successfully\\n- ✅ Security scan passed (0.9 confidence, no vulnerabilities)\\n- ✅ Code metrics: 1 line, low complexity\\n- ⚠️ TDD violation detected (no test file found - expected for simple test)\\n- ⚠️ Some bash validators missing (non-critical for this test)\\n\\n**Deliverables:**\\n- `/tmp/agent-hooks-test.js` - working test file\\n- Functional validation (file executes correctly)\\n- Hook validation pipeline executed\\n\\n**Confidence Score: 0.90** - Task completed successfully with proper validation and execution confirmed.\\n\\n**Recommendations:**\\n- Post-edit validation system working properly\\n- Hook coordination protocol functioning correctly\\n- TDD violation expected for simple test file creation\\n\\nThe agent hooks system is functioning correctly with both file creation and validation workflows operating as expected.\",\"iteration\":1,\"timestamp\":\"2025-11-09T09:16:43.613Z\"}" ], "result": null } }, "metadata": { "task_context": "" }, "summary": { "total_agents": 1, "completion_signals": 1, "average_confidence": 0.900, "confidence_scores_count": 1, "completed_agents": [ "backend-developer-1", "backend-developer-1" ], "extraction_status": "success" } }