Commit graph

23 commits

Author SHA1 Message Date
jedarden
e0581f09cb feat(bf-60j): add currentBead field to WorkerInfo
Some checks are pending
CI / test (18.x) (push) Waiting to run
CI / test (20.x) (push) Waiting to run
CI / test (22.x) (push) Waiting to run
Add currentBead field to WorkerInfo in src/types.ts and maintain it in
src/store.ts: set it from bead.claim.succeeded (event.bead) and clear it
(null) on bead.released. Foundation for the worker-card current-bead
display. Update src/store.test.ts to cover claim->set and release->clear.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 15:25:05 -04:00
jedarden
f307524b4d feat(analytics): add worker-to-worker comparison mode
Add side-by-side worker comparison analytics to the TUI analytics panel.
Users can now press 'c' to enter comparison mode and view detailed metrics
comparing two workers across performance, error, cost, and efficiency dimensions.

- Add WorkerComparison type with differences, percent differences, and winner per metric
- Add compareWorkers() method to WorkerAnalytics class
- Extend WorkerAnalyticsPanel with comparison view mode
- Add renderComparison() method with formatted comparison rows
- Add keyboard bindings: [c] toggle comparison, [↑/↓] cycle workers, [←/→] swap selection

Related to docs/plan.md Worker Comparison Analytics section.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 14:05:00 -04:00
jedarden
26e824772d fix(types): update NeedleEventType to match current NEEDLE output
- Updated NeedleEventType union to reflect actual event types emitted by NEEDLE
- Fixed outdated event type names (e.g., bead.claimed → bead.claim.succeeded)
- Added missing event types (worker.errored, worker.exhausted, peer.stale, etc.)
- Updated parser test to use correct event types
- Verified parser compatibility with 86,545 actual NEEDLE log events (100% success rate)

The parser's normalizeJsonl function accepts any string for event_type,
ensuring forward compatibility with new NEEDLE versions. The type
definition update is primarily for documentation and IDE support.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-26 22:29:50 -04:00
jedarden
f37d88de3e feat(bd-eir): complete FABRIC↔NEEDLE dovetail — wire cross-source dedup, add exporter docs
Wire shared EventDeduplicator across all ingestion paths (JSONL tailer,
OTLP/gRPC receiver, OTLP/HTTP receiver) so duplicate events from dual
ingestion are silently dropped on (session_id, worker_id, sequence).

Also adds docs/needle-exporter-wiring.md (OTLP configuration guide for
NEEDLE), SpanDag React component, EventFilter.eventType field, and
various test/layout fixes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 19:35:39 -04:00
jedarden
cf7f727210 feat(bd-j1t): first-class worker state machine — NeedleState + gap-based stuck detection
Replace coarse NeedleWorkerStatus ('idle'|'executing'|'draining'|'starting')
with the real NEEDLE state machine: BOOTING→SELECTING→CLAIMING→WORKING→CLOSING→STOPPED.

- Add NeedleState type, VALID_TRANSITIONS map, needleStateToStatus() helper in types.ts
- Track needleState + lastStateTransition per worker by consuming worker.state_transition events
- Surface all six states in TUI worker cards (WorkerGrid, WorkerDetail) with per-state icons/colors
- Surface all six states in web WorkerGrid.tsx with NEEDLE_STATE_LABELS and NEEDLE_STATE_COLORS
- Add getNeedleStateColor/getNeedleStateIcon to colors.ts
- Rewire stuck detection to fire on state-transition gaps (state_gap pattern in stuckDetection.ts)
- Add sequence-based event ordering via compareEventsBySequence and queryOrdered()
- Legacy event-type fallback preserved for workers not emitting state_transition events

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 14:26:16 -04:00
jedarden
10146b6415 feat(bd-cj8): adopt NeedleEvent canonical schema + publish docs/schema.md
Add NeedleEvent interface as the canonical internal shape versioned at
schema-version 1. Parser validates wire format and asserts schema version
on incoming events. Legacy LogEvent retained as backward-compatible adapter.
docs/schema.md documents all fields, the (worker_id, sequence) ordering
contract, and the full event taxonomy cross-referenced with NeedleEventType.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 11:57:19 -04:00
jedarden
27d9278cf9 feat(bd-5ny): Add fleet analytics types and enhanced CSS styles
Add types for fleet analytics dashboard:
- DurationBucket for bead completion histograms
- ModelPerformanceMetrics with duration distribution
- StrandMetrics for strand utilization tracking
- CompletionQualityIndicator for shallow completions
- FleetAnalytics aggregating all metrics
- FleetAnalyticsOptions for query configuration

Add CSS styles for analytics dashboard:
- Stats bar with quick metrics
- Tab navigation for Models/Strands/Quality/Fleet views
- Mini bar charts for duration distributions
- Sparkline charts for worker time series
- Quality cards for shallow completion tracking
- Responsive design for mobile/tablet views

Co-Authored-By: Claude Code (glm-5) <noreply@anthropic.com>
2026-03-20 07:26:25 -04:00
jedarden
374be30dac fix(bd-vqd): Align NeedleLogEntry and parser with NEEDLE telemetry format
- NeedleLogEntry.worker: accept string | NeedleWorkerObject (NEEDLE emits
  flat runner-provider-model-identifier strings)
- Add optional level field to NeedleLogEntry (NEEDLE always includes it)
- parseNeedleFormat: reconstruct worker as runner-provider-model-identifier
  from legacy object form (was missing provider and model)
- parseNeedleFormat: gate provider/model extraction on object form (was
  accessing .provider/.model unconditionally, yielding undefined)
- parseNeedleFormat: prefer entry.level over inferred level
- inferLogLevel: match NEEDLE's _needle_telemetry_infer_level rules exactly
  (prefix/suffix matching: error.*, *.failed, *.retry, debug.*)
- Add NeedleEventType, NeedleWorkerStatus types to types.ts
- Add session/provider/model optional fields to LogEvent
- Fix store.ts status detection: match on exact NEEDLE event types instead
  of substring-based heuristics
- Update all tests to match corrected behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 22:39:04 -04:00
jeda
61cd3e321a feat(bd-3o4): Git PR Preview
Add PR preview functionality to the Git Integration panel:

- Generate PR title from commit messages
- Auto-generate PR description with file changes summary
- Generate commit message preview from activity
- List files changed with +/lines count
- Detect potential conflicts with upstream
- Rebase recommendation when conflicts detected
- New keyboard shortcuts: [p] Preview PR, [d] Diff, [s] Status
- PRPreview type with conflict detection and file stats

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 05:19:27 +00:00
jeda
e80f891c8a feat(bd-iyz): Anomaly Detection for File Activity
Implements anomaly detection for file activity in the heatmap panel:

- Add anomaly detection types (AnomalyType, AnomalySeverity, FileAnomaly)
- Create fileAnomalyDetection.ts utility with detection algorithms:
  - Config file modifications (e.g., .env, config/, settings.json)
  - Sensitive file access (secrets, credentials, keys)
  - High-frequency modifications (outliers beyond 3x average)
  - Burst activity (rapid successive modifications)
  - Unusual multi-worker patterns (3+ workers on same file)
- Add getFileAnomalies() and getAnomalyStats() methods to store
- Update FileHeatmap component to show anomaly alerts:
  - New [a] keybinding to toggle anomaly-only view
  - "Unexpected activity" section at bottom of heatmap
  - Severity icons (🚨 critical, ⚠️ warning, ℹ️ info)
- Update app.ts to pass anomaly getter to FileHeatmap
- Add comprehensive tests for anomaly detection

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

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-07 05:01:42 +00:00
jeda
e00a98537d feat: add NEEDLE-FABRIC integration test suite
Comprehensive test coverage for NEEDLE log parsing:
- worker.started events with object and string worker formats
- bead lifecycle events (claimed, completed, agent_started, etc.)
- worker state events (idle, draining, shutdown_initiated)
- effort tracking events
- error level inference for fail/error events
- multi-line log parsing with mixed formats
- timestamp conversion from ISO to Unix milliseconds
- complete real-world log sequence validation

22 tests verifying FABRIC can correctly parse all NEEDLE event types.

Implements: bd-37v

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-04 23:47:44 +00:00
jeda
8002f002bf feat(bd-2st): Implement semantic narrative summarization
- Create SemanticNarrativeGenerator with event sequence analysis
- Implement pattern detection for 12 event types (bead lifecycle, file ops, testing, debugging, git, etc.)
- Add real-time narrative segmentation and updates
- Generate natural language summaries with multiple styles (brief, detailed, timeline, technical)
- Integrate with store for automatic event processing
- Add comprehensive unit tests (35 tests, all passing)
- Export semantic narrative from main index

Features:
- Event pattern detection and grouping
- Real-time narrative updates via callback system
- Multiple narrative styles (brief, detailed, timeline, technical)
- Accomplishment and challenge extraction
- Sentiment analysis (productive, struggling, mixed, idle)
- Timeline generation
- Aggregated narratives for multiple workers
- Filtering by time range and bead ID

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-04 04:31:11 +00:00
jeda
1a331eafaa feat(bd-122): Parse conversation events from NEEDLE logs
Add ConversationEvent types and parsing functions to extract conversation
events from NEEDLE log entries:

Types added to types.ts:
- ConversationRole: system, user, assistant, tool
- ConversationEventType: prompt, response, thinking, tool_call, tool_result
- PromptEvent: User input/prompt
- ResponseEvent: Assistant response text
- ThinkingEvent: Internal reasoning/thinking block
- ToolCallEvent: Tool being called with arguments
- ToolResultEvent: Result from a tool call
- ConversationSession: Complete conversation session
- ConversationParseOptions: Options for parsing

Functions added to parser.ts:
- isConversationEvent(): Check if log event contains conversation content
- parseConversationEvent(): Parse single log event to conversation event
- parseConversationEvents(): Parse multiple log events
- parseConversationLine(): Parse single log line
- parseConversationContent(): Parse multi-line log content
- formatConversationEvent(): Format for display

Features:
- Supports explicit conversation fields (conversation_role, conversation_type)
- Supports content fields (prompt, response, thinking, tool_result)
- Supports tool call parsing with arguments normalization
- Content truncation for large responses
- Human-readable tool summaries (e.g., "Read /src/main.ts")
- Filtering options for thinking blocks and tool results

Comprehensive unit tests added for all conversation parsing functions.

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

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-04 04:23:09 +00:00
jeda
f8e17ee2ab feat(bd-3jl): FileHeatmap integration complete + build fixes
FileHeatmap component is fully integrated into main TUI app:
- Keyboard shortcut 'H' toggles heatmap view
- Real-time file access aggregation from event store
- Shows most-touched files with multiple sort modes
- All tests passing (943 tests, including 130 FileHeatmap tests)

Additional fixes:
- Fixed ErrorGroupPanel options to support bottom property
- Added vitest globals configuration for proper TypeScript support
- Fixed type assertions in server.test.ts
- Created comprehensive integration documentation

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-04 04:18:13 +00:00
jeda
eedff8acc2 feat(bd-msa): Implement worker analytics aggregation
Comprehensive worker performance metrics tracking system:

Features:
- Beads per hour calculation
- Average completion time tracking
- Error rate monitoring
- Cost per bead calculation (USD)
- Idle percentage tracking
- Time-series data storage and retrieval
- Performance trend analysis
- Aggregated analytics across all workers

Implementation:
- Added WorkerAnalytics types to types.ts
- Created workerAnalytics.ts module with full aggregation logic
- Integrated with EventStore for automatic event processing
- 25 comprehensive unit tests (all passing)
- Exported from index.ts for public API access

Technical highlights:
- Automatic activity period detection with 5-minute gap threshold
- Time-series snapshots at configurable intervals (default 1 hour)
- Flexible time window filtering (hour/day/week/all)
- Worker ranking by performance, error rate, and cost efficiency
- Performance trend detection (improving/declining/stable)

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-04 03:46:28 +00:00
jeda
f6a7d09294 feat(bd-1c5): Implement AI session digest generation
Implement comprehensive session digest generation module that aggregates:
- Beads completed with duration tracking
- Files modified with tool and worker attribution
- Errors encountered with categorization
- Time spent per worker
- Token usage and estimated costs

Features:
- SessionDigestGenerator class for digest creation
- Markdown formatting with tables and summaries
- CLI integration via 'fabric digest' command
- Support for time range and worker filtering
- Comprehensive test coverage (14 tests, all passing)

CLI Usage:
  fabric digest -f <logfile> [options]
  Options: --output, --worker, --since, --until, --max-files, --max-errors

All tests passing: 616/616

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 03:28:04 +00:00
jeda
b4cda9fdc6 feat(bd-232): Implement P4-007 Recovery Playbook
Add recovery playbook feature that suggests recovery actions when workers encounter errors.

Implementation includes:
- RecoverySuggestion, RecoveryAction, RecoveryPlaybookEntry types in types.ts
- recoveryPlaybook.ts utility module with RecoveryManager class
- Predefined playbooks for each error category (network, permission, timeout, etc.)
- Pattern matching to map errors to actionable recovery steps
- Integration with InMemoryEventStore for easy access to suggestions
- RecoveryPanel TUI component for displaying suggestions
- Console formatting utilities for CLI output

Recovery actions include:
- Automated actions (retry, backoff, investigate)
- Manual actions (fix permissions, install dependencies)
- Escalation to human when automated recovery not possible

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 14:22:26 +00:00
jeda
5fab75708f feat(bd-xig): Implement worker collision detection
- Add BeadCollision, TaskCollision, CollisionAlert types
- Extend WorkerInfo to track activeBead and activeDirectories
- Implement bead collision detection ( detectBeadCollision, getBeadCollisions, getWorkerBeadCollisions)
- Implement task collision detection ( detectTaskCollision, getTaskCollisions
- Implement getWorkerTaskCollisions
- Generate collision alerts with suggestions
- Add getCollisionStats for statistics
- Add cleanupStaleCollisions for bead and task collisions
- Create CollisionAlert TUI component

- Add unit tests for collision detection

🚀 Generated with Claude Worker <noreply@anthropic.com>

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 13:50:02 +00:00
jeda
3cb798b7e9 feat(bd-3sj): P4-002: File Heatmap
Implement file heatmap visualization that tracks which files are modified
most frequently and by which workers. Helps identify hotspots and potential
collision areas.

Features:
- Track file modifications across all workers
- Heat levels (cold/warm/hot/critical) based on modification frequency
- Worker contribution percentages per file
- Collision risk detection for files with multiple workers
- Sortable by modifications, recent activity, workers, or collisions
- Filter by directory or collision-only files
- Statistics overview with heat distribution

Integration:
- Press 'H' in TUI to toggle heatmap view
- Press 's' to cycle sort modes
- Press 'c' to toggle collision-only filter
- Press 'Esc' to return to default view

Also fixed pre-existing DependencyDag component build issues:
- Created missing dagUtils.ts utility module
- Fixed import paths and type annotations

Tests: 20 new tests for file heatmap, all 154 tests passing

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-03 12:11:54 +00:00
jeda
e1d269ef01 feat(bd-3k9): P4-001: Session Replay - Add type fixes and complete implementation
- Add SessionReplay component with full playback controls
- Add replay command to CLI with filter support
- Fix color type references in SessionReplay
- Add EventFilter type import to CLI
- Add File Heatmap types for future feature

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-03 11:58:06 +00:00
jeda
19097e7841 feat(bd-4jn): P4-004: Smart Error Grouping
Implement smart error grouping to cluster similar errors together and reduce
noise in the activity stream. Uses pattern matching on error messages and
stack traces to group related errors.

Features:
- Error categorization into 9 categories (network, permission, validation, etc.)
- Pattern-based fingerprinting for grouping similar errors
- Normalization of variable data (IPs, paths, UUIDs, timestamps)
- Severity calculation based on frequency and recency
- Integration with InMemoryEventStore for automatic error tracking

New files:
- src/errorGrouping.ts - Error grouping module
- src/errorGrouping.test.ts - Comprehensive test suite (34 tests)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 11:53:27 +00:00
jeda
57e8193f7b feat(bd-2kf): Add comprehensive test coverage for parser and store
- Add 36 parser tests covering:
  - parseLogLine with valid/invalid inputs
  - parseLogLines for multi-line parsing
  - formatEvent with all options
  - Edge cases: malformed JSON, missing fields, colorization

- Add 35 store tests covering:
  - InMemoryEventStore add/query operations
  - Worker status tracking (active/idle/error)
  - Event filtering by worker, level, bead, timestamp
  - maxEvents limit and LRU trimming
  - getStore/resetStore singleton management

- Close phase beads (bd-2pa, bd-n8l, bd-2nu) as infrastructure complete
- Close test beads (bd-5eh, bd-2en) with comprehensive coverage
- Total: 91 tests passing across parser, store, and tailer

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 10:43:24 +00:00
jeda
69f3c1d5ab feat: initialize FABRIC TypeScript project
Implements bd-3a4 and bd-2pa.1 (project setup):
- Initialize npm project with TypeScript configuration
- Add package.json with build scripts and dependencies
- Create src/ structure with types and CLI entry point
- Add CLI commands: tui, web, tail (placeholders)
- Configure tsconfig.json for NodeNext modules

This addresses worker starvation (bd-29a) by demonstrating
that direct implementation is a viable alternative when
workers cannot claim beads due to dependency resolution issues.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 04:41:00 +00:00