Commit Graph

24 Commits

Author SHA1 Message Date
Claude Code
e2847a64ba Refine discovery to trust mesh multiaddrs 2025-10-17 09:13:54 +11:00
Claude Code
3373f7b462 Add chorus-entrypoint label to standardized label set
Some checks failed
WHOOSH CI / speclint (push) Has been cancelled
WHOOSH CI / contracts (push) Has been cancelled
**Problem**: The standardized label set was missing the `chorus-entrypoint`
label, which is present in CHORUS repository and required for triggering
council formation for project kickoffs.

**Changes**:
- Added `chorus-entrypoint` label (#ff6b6b) to `EnsureRequiredLabels()`
  in `internal/gitea/client.go`
- Now creates 9 standard labels (was 8):
  1. bug
  2. bzzz-task
  3. chorus-entrypoint (NEW)
  4. duplicate
  5. enhancement
  6. help wanted
  7. invalid
  8. question
  9. wontfix

**Testing**:
- Rebuilt and deployed WHOOSH with updated label configuration
- Synced labels to all 5 monitored repositories (whoosh-ui,
  SequentialThinkingForCHORUS, TEST, WHOOSH, CHORUS)
- Verified all repositories now have complete 9-label set

**Impact**: All CHORUS ecosystem repositories now have consistent labeling
matching the CHORUS repository standard, enabling proper council formation
triggers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 22:06:10 +11:00
Claude Code
192bd99dfa Fix council-team foreign key constraint violation
Problem: Councils couldn't be assigned to tasks because they didn't exist in teams table
- Foreign key constraint tasks_assigned_team_id_fkey required valid team record
- Councils ARE teams (special subtype for project kickoffs)

Solution: Create team record when forming council
- Added team INSERT in storeCouncilComposition()
- Use same UUID for both team.id and council.id
- Team name: 'Council: {ProjectName}'
- ON CONFLICT DO NOTHING for idempotency

Result: Tasks can now be assigned to councils, unblocking task execution

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 11:33:32 +11:00
Claude Code
9aeaa433fc Fix Docker Swarm discovery network name mismatch
- Changed NetworkName from 'chorus_default' to 'chorus_net'
- This matches the actual network 'CHORUS_chorus_net' (service prefix added automatically)
- Fixes discovered_count:0 issue - now successfully discovering all 25 agents
- Updated IMPLEMENTATION-SUMMARY with deployment status

Result: All 25 CHORUS agents now discovered successfully via Docker Swarm API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 10:35:25 +11:00
Claude Code
2826b28645 Phase 1: Implement Docker Swarm API agent discovery
Replaces DNS-based discovery (2/34 agents) with Docker API enumeration
to discover ALL running CHORUS containers.

Implementation:
- NEW: internal/p2p/swarm_discovery.go (261 lines)
  * Docker API client for Swarm task enumeration
  * Extracts container IPs from network attachments
  * Optional health verification before registration
  * Comprehensive error handling and logging

- MODIFIED: internal/p2p/discovery.go (~50 lines)
  * Integrated Swarm discovery with fallback to DNS
  * New config: DISCOVERY_METHOD (swarm/dns/auto)
  * Tries Swarm first, falls back gracefully
  * Backward compatible with existing DNS discovery

- NEW: IMPLEMENTATION-SUMMARY-Phase1-Swarm-Discovery.md
  * Complete deployment guide
  * Testing checklist
  * Performance metrics
  * Phase 2 roadmap

Expected Results:
- Discovery: 34/34 agents (100% vs previous ~6%)
- Council activation: Both core roles claimed
- Task execution: Unblocked

Security:
- Read-only Docker socket mount
- No privileged mode required
- Minimal API surface (TaskList + Ping only)

Next: Build image, deploy, verify discovery, activate council

Part of hybrid approach:
- Phase 1: Docker API (this commit) 
- Phase 2: NATS migration (planned Week 3)

Related:
- /home/tony/chorus/docs/DIAGNOSIS-Agent-Discovery-And-P2P-Architecture.md
- /home/tony/chorus/docs/ARCHITECTURE-ANALYSIS-LibP2P-HMMM-Migration.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 09:48:16 +11:00
Claude Code
6d6241df87 Fix task ID lookup in triggerTeamCompositionForCouncil
Query the actual task_id from councils table instead of incorrectly
using council_id as task_id.

Issue: Council activation was failing to trigger team composition
because it was looking for a task with ID=council_id which doesn't exist.

Fix: Query SELECT task_id FROM councils WHERE id = council_id

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 09:23:07 +11:00
Claude Code
04509b848b Fix council formation broadcast and reduce core roles
Two critical fixes for E2E council workflow:

1. Reduced core council roles from 8 to 2 (tpm + senior-software-architect)
   - Faster council formation
   - Easier debugging
   - Sufficient for initial project planning

2. Added broadcast to monitor path
   - Monitor now broadcasts council opportunities to CHORUS agents
   - Previously only webhook path had broadcast, monitor path missed it
   - Added broadcaster parameter to NewMonitor()
   - Broadcast sent after council formation with 30s timeout

Verified working:
- Council formation successful
- Broadcast to CHORUS agents confirmed
- Role claims received (TPM claimed and loaded)
- Persona status "loaded" acknowledged

Image: anthonyrawlins/whoosh:broadcast-fix
Council: 2dad2070-292a-4dbd-9195-89795f84da19

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 09:12:08 +11:00
Claude Code
4526a267bf feat(whoosh): add /metrics + admin health alias; serve UI assets at root; ui: auth token control, spinner fix, delete repo/project, correct repo POST payload 2025-10-08 23:51:56 +11:00
Claude Code
28f02b61d1 Integrate wave-based scaling system with WHOOSH server
- Add scaling system components to server initialization
- Register scaling API and assignment broker routes
- Start bootstrap pool manager in server lifecycle
- Add graceful shutdown for scaling controller
- Update API routing to use chi.Router instead of gorilla/mux
- Fix Docker API compatibility issues
- Configure health gates with placeholder URLs for KACHING and BACKBEAT

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 13:59:01 +10:00
Claude Code
564852dc91 Implement wave-based scaling system for CHORUS Docker Swarm orchestration
- Health gates system for pre-scaling validation (KACHING, BACKBEAT, bootstrap peers)
- Assignment broker API for per-replica configuration management
- Bootstrap pool management with weighted peer selection and health monitoring
- Wave-based scaling algorithm with exponential backoff and failure recovery
- Enhanced SwarmManager with Docker service scaling capabilities
- Comprehensive scaling metrics collection and reporting system
- RESTful HTTP API for external scaling operations and monitoring
- Integration with CHORUS P2P networking and assignment systems

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 13:51:34 +10:00
Claude Code
55dd5951ea feat: implement LLM integration for team composition engine
Some checks failed
WHOOSH CI / speclint (push) Has been cancelled
WHOOSH CI / contracts (push) Has been cancelled
WHOOSH CI / speclint (pull_request) Has been cancelled
WHOOSH CI / contracts (pull_request) Has been cancelled
Resolves WHOOSH-LLM-002: Replace stubbed LLM functions with full Ollama API integration

## New Features
- Full Ollama API integration with automatic endpoint discovery
- LLM-powered task classification using configurable models
- LLM-powered skill requirement analysis
- Graceful fallback to heuristics on LLM failures
- Feature flag support for LLM vs heuristic execution
- Performance optimization with smaller, faster models (llama3.2:latest)

## Implementation Details
- Created OllamaClient with connection pooling and timeout handling
- Structured prompt engineering for consistent JSON responses
- Robust error handling with automatic failover to heuristics
- Comprehensive integration tests validating functionality
- Support for multiple Ollama endpoints with health checking

## Performance & Reliability
- Timeout configuration prevents hanging requests
- Fallback mechanism ensures system reliability
- Uses 3.2B parameter model for balance of speed vs accuracy
- Graceful degradation when LLM services unavailable

## Files Added
- internal/composer/ollama.go: Core Ollama API integration
- internal/composer/llm_test.go: Comprehensive integration tests

## Files Modified
- internal/composer/service.go: Implemented LLM functions
- internal/composer/models.go: Updated config for performance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 21:57:16 +10:00
Claude Code
9f57e48cef fix: resolve Docker Client API compilation error in swarm_manager.go
Some checks failed
WHOOSH CI / speclint (push) Has been cancelled
WHOOSH CI / contracts (push) Has been cancelled
WHOOSH CI / speclint (pull_request) Has been cancelled
WHOOSH CI / contracts (pull_request) Has been cancelled
Fixed undefined types.ContainerLogsOptions error by using an inline struct
that matches the Docker API interface. This resolves compilation issues
with the GetServiceLogs method while maintaining compatibility with the
existing Docker v24.0.7 dependency.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 21:46:54 +10:00
Claude Code
b4b1cce902 feat(labels): standardize automatic label creation to match ecosystem convention
Some checks failed
WHOOSH CI / speclint (push) Has been cancelled
WHOOSH CI / contracts (push) Has been cancelled
WHOOSH CI / speclint (pull_request) Has been cancelled
WHOOSH CI / contracts (pull_request) Has been cancelled
@goal: WHOOSH-LABELS-004, WSH-CONSISTENCY - Ecosystem standardization

Replace custom label set with standardized CHORUS ecosystem labels:
- Add all 8 GitHub-standard labels (bug, duplicate, enhancement, etc.)
- Fix bzzz-task color from #ff6b6b to #5319e7 for consistency
- Remove custom priority labels and whoosh-monitored label
- Maintain backward compatibility and error handling

Changes:
- Updated EnsureRequiredLabels() in internal/gitea/client.go
- Added requirement traceability comments throughout
- Updated integration points in internal/server/server.go
- Created comprehensive decision record

Benefits:
- Consistent labeling across WHOOSH, CHORUS, KACHING repositories
- Familiar GitHub-standard labels for better developer experience
- Improved tool integration and issue management
- Preserved bzzz-task automation for CHORUS workflow

Fixes: WHOOSH issue #4

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 17:35:15 +10:00
Claude Code
afccc94998 Updated project files and configuration
Some checks failed
WHOOSH CI / speclint (push) Has been cancelled
WHOOSH CI / contracts (push) Has been cancelled
- Added/updated .gitignore file
- Fixed remote URL configuration
- Updated project structure and files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 22:51:50 +10:00
Claude Code
131868bdca feat: Production readiness improvements for WHOOSH council formation
Major security, observability, and configuration improvements:

## Security Hardening
- Implemented configurable CORS (no more wildcards)
- Added comprehensive auth middleware for admin endpoints
- Enhanced webhook HMAC validation
- Added input validation and rate limiting
- Security headers and CSP policies

## Configuration Management
- Made N8N webhook URL configurable (WHOOSH_N8N_BASE_URL)
- Replaced all hardcoded endpoints with environment variables
- Added feature flags for LLM vs heuristic composition
- Gitea fetch hardening with EAGER_FILTER and FULL_RESCAN options

## API Completeness
- Implemented GetCouncilComposition function
- Added GET /api/v1/councils/{id} endpoint
- Council artifacts API (POST/GET /api/v1/councils/{id}/artifacts)
- /admin/health/details endpoint with component status
- Database lookup for repository URLs (no hardcoded fallbacks)

## Observability & Performance
- Added OpenTelemetry distributed tracing with goal/pulse correlation
- Performance optimization database indexes
- Comprehensive health monitoring
- Enhanced logging and error handling

## Infrastructure
- Production-ready P2P discovery (replaces mock implementation)
- Removed unused Redis configuration
- Enhanced Docker Swarm integration
- Added migration files for performance indexes

## Code Quality
- Comprehensive input validation
- Graceful error handling and failsafe fallbacks
- Backwards compatibility maintained
- Following security best practices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 20:34:17 +10:00
Claude Code
56ea52b743 Implement initial scan logic and council formation for WHOOSH project kickoffs
- Replace incremental sync with full scan for new repositories
- Add initial_scan status to bypass Since parameter filtering
- Implement council formation detection for Design Brief issues
- Add version display to WHOOSH UI header for debugging
- Fix Docker token authentication with trailing newline removal
- Add comprehensive council orchestration with Docker Swarm integration
- Include BACKBEAT prototype integration for distributed timing
- Support council-specific agent roles and deployment strategies
- Transition repositories to active status after content discovery

Key architectural improvements:
- Full scan approach for new project detection vs incremental sync
- Council formation triggered by chorus-entrypoint labeled Design Briefs
- Proper token handling and authentication for Gitea API calls
- Support for both initial discovery and ongoing task monitoring

This enables autonomous project kickoff workflows where Design Brief issues
automatically trigger formation of specialized agent councils for new projects.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 09:49:36 +10:00
Claude Code
b5c0deb6bc Fix critical issues in WHOOSH Gitea issue monitoring and task creation
This commit resolves multiple blocking issues that were preventing WHOOSH from
properly detecting and converting bzzz-task labeled issues from Gitea:

## Issues Fixed:

1. **JSON Parsing Error**: Gitea API returns repository owner as string in issue
   responses, but code expected User object. Added IssueRepository struct to
   handle this API response format difference.

2. **Database Error Handling**: Code was using database/sql.ErrNoRows but
   system uses pgx driver. Updated imports and error constants to use
   pgx.ErrNoRows consistently.

3. **NULL Value Scanning**: Database fields (repository, project_id,
   estimated_hours, complexity_score) can be NULL but Go structs used
   non-pointer types. Added proper NULL handling with pointer scanning
   and safe conversion.

## Results:
-  WHOOSH now successfully detects bzzz-task labeled issues
-  Task creation pipeline working end-to-end
-  Tasks API functioning properly
-  First bzzz-task converted: "Logic around registered agents faulty"

The core issue monitoring workflow is now fully operational and ready for
CHORUS integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 12:57:11 +10:00
Claude Code
4173c0c8c8 Add automatic Gitea label creation and repository edit functionality
- Implement automatic label creation when registering repositories:
  • bzzz-task (red) - Issues for CHORUS BZZZ task assignments
  • whoosh-monitored (teal) - Repository monitoring indicator
  • priority-high/medium/low labels for task prioritization
- Add repository edit modal with full configuration options
- Add manual "Labels" button to ensure labels for existing repos
- Enhance Gitea client with CreateLabel, GetLabels, EnsureRequiredLabels methods
- Add POST /api/v1/repositories/{id}/ensure-labels endpoint
- Fix label creation error handling with graceful degradation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 22:00:29 +10:00
Claude Code
982b63306a Implement comprehensive repository management system for WHOOSH
- Add database migrations for repositories, webhooks, and sync logs tables
- Implement full CRUD API for repository management
- Add web UI with repository list, add form, and management interface
- Support JSONB handling for topics and metadata
- Handle nullable database columns properly
- Integrate with existing WHOOSH dashboard and navigation
- Enable Gitea repository monitoring for issue tracking and CHORUS integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 19:46:28 +10:00
Claude Code
1a6ac007a4 Add BACKBEAT Clock component to WHOOSH dashboard
Features implemented:
- Real-time BACKBEAT pulse monitoring with current beat display
- ECG-like trace visualization with canvas-based rendering
- Downbeat detection and highlighting (every 4th beat)
- Phase monitoring (normal, degraded, recovery)
- Average beat interval tracking (2000ms intervals)
- Auto-refreshing data every second for real-time updates

API Integration:
- Added /api/v1/backbeat/status endpoint
- Returns simulated BACKBEAT data based on CHORUS log patterns
- JSON response includes beat numbers, phases, timing data

UI Components:
- BACKBEAT Clock card in dashboard overview
- Live pulse trace with 10-second rolling window
- Color-coded metrics display
- Grid background for ECG-style visualization
- Downbeat markers in red for emphasis

This provides visual feedback on the CHORUS system's distributed
coordination timing and autonomous AI team synchronization status.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 22:14:18 +10:00
Claude Code
69e812826e Implement comprehensive task management system with GITEA integration
Replace mock endpoints with real database-backed task management:
- Add tasks table with full relationships and indexes
- Create generic task management service supporting multiple sources
- Implement GITEA integration service for issue synchronization
- Add task creation, retrieval, assignment, and status updates

Database schema changes:
- New tasks table with external_id mapping for GITEA/GitHub/Jira
- Foreign key relationships to teams and agents
- Task workflow tracking (claimed_at, started_at, completed_at)
- JSONB fields for labels, tech_stack, requirements

Task management features:
- Generic TaskFilter with pagination and multi-field filtering
- Automatic tech stack inference from labels and descriptions
- Complexity scoring based on multiple factors
- Real task assignment to teams and agents
- GITEA webhook integration for automated task sync

API endpoints now use real database operations:
- GET /api/v1/tasks (real filtering and pagination)
- GET /api/v1/tasks/{id} (database lookup)
- POST /api/v1/tasks/ingest (creates actual task records)
- POST /api/v1/tasks/{id}/claim (real assignment operations)

GITEA integration includes:
- Issue-to-task synchronization with configurable task labels
- Priority mapping from issue labels
- Estimated hours extraction from issue descriptions
- Webhook processing for real-time updates

This removes the major mocked components and provides
a foundation for genuine E2E testing with real data.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 12:21:33 +10:00
Claude Code
3a351305e9 Complete remaining API endpoints for WHOOSH MVP
Implement comprehensive task ingestion and management:
- POST /api/v1/tasks/ingest (manual and webhook task submission)
- GET /api/v1/tasks/{id} (task details retrieval)
- PUT /api/v1/teams/{id}/status (team status updates)
- PUT /api/v1/agents/{id}/status (agent status and metrics)

Add SLURP integration proxy endpoints:
- POST /api/v1/slurp/submit (artifact submission with UCXL addressing)
- GET /api/v1/slurp/retrieve (artifact retrieval by UCXL address)
- Database persistence for submission tracking

Implement project task management:
- GET /api/v1/projects/{id}/tasks (project task listing)
- GET /api/v1/tasks/available (available task discovery)
- POST /api/v1/tasks/{id}/claim (task claiming by teams)

Key features added:
- Async processing for complex tasks
- Tech stack inference from labels
- UCXL address generation for SLURP integration
- Team and agent validation
- Comprehensive request validation and error handling
- Structured logging for all operations

WHOOSH MVP now has fully functional API endpoints beyond
the core Team Composer service, providing complete task
lifecycle management and CHORUS ecosystem integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:30:17 +10:00
Claude Code
37cbb99186 Implement complete Team Composer service for WHOOSH MVP
Add sophisticated team formation engine with:
- Task analysis and classification algorithms
- Skill requirement detection and mapping
- Agent capability matching with confidence scoring
- Database persistence with PostgreSQL/pgx integration
- Production-ready REST API endpoints

API endpoints added:
- POST /api/v1/teams (create teams with analysis)
- GET /api/v1/teams (list teams with pagination)
- GET /api/v1/teams/{id} (get team details)
- POST /api/v1/teams/analyze (analyze without creating)
- POST /api/v1/agents/register (register new agents)

Core Team Composer capabilities:
- Heuristic task classification (9 task types)
- Multi-dimensional complexity assessment
- Technology domain identification
- Role-based team composition strategies
- Agent matching with skill/availability scoring
- Full database CRUD with transaction support

This moves WHOOSH from basic N8N workflow stubs to a fully
functional team composition system with real business logic.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:23:28 +10:00
Claude Code
33676bae6d Add WHOOSH search service with BACKBEAT integration
Complete implementation:
- Go-based search service with PostgreSQL and Redis backend
- BACKBEAT SDK integration for beat-aware search operations
- Docker containerization with multi-stage builds
- Comprehensive API endpoints for project analysis and search
- Database migrations and schema management
- GITEA integration for repository management
- Team composition analysis and recommendations

Key features:
- Beat-synchronized search operations with timing coordination
- Phase-based operation tracking (started → querying → ranking → completed)
- Docker Swarm deployment configuration
- Health checks and monitoring
- Secure configuration with environment variables

Architecture:
- Microservice design with clean API boundaries
- Background processing for long-running analysis
- Modular internal structure with proper separation of concerns
- Integration with CHORUS ecosystem via BACKBEAT timing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 11:16:39 +10:00