Updated verification notes confirming all 57 tests pass. The test failures
described in the original bead were fixed by commits 797c9f1 and 4839d48,
which addressed mock setup issues and made render() public.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Make render() public so tests can call it directly without casting
- Change hide() to call this.render() instead of this.box.screen.render() directly
- This makes hide() consistent with show() and improves test compatibility
These changes address test failures in FileContextPanel.test.ts where:
- Tests call (panel as any).render() directly
- Tests expect mainBoxInstance.screen.render to be called after show/hide
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The original mock returned the same instance for all blessed.box() calls,
but the implementation creates 4 separate boxes (main, fileInfo, fileContent,
fileHistory). This caused tests to fail because they couldn't distinguish
which methods were called on which elements.
Changes:
- Make the mock return a new instance for each blessed.box() call
- Track all mock instances in a mockBoxes array
- Keep mainBoxInstance reference for tests that need the primary box
- Fix test expecting setContent on main box to use mockBoxes[1] (fileInfo)
All 57 FileContextPanel tests now pass.
Fixed test setup to correctly capture the mock instances that were
actually used during CommandPalette construction. The previous
approach of re-calling blessedMock.box() after clearing mocks
resulted in checking different mock instances than those used by
the actual palette object.
Changed from:
- Calling blessedMock.box() after construction (different instances)
To:
- Accessing blessedMock.box.mock.results[0]?.value (same instances)
This ensures tests correctly verify the behavior of the actual
CommandPalette instance, not mock instances that were never used
by the palette.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Confirmed that all issues from genesis bead description were already
fixed in previous runs:
- src/memoryProfiler.ts exists and fully implemented (255 lines)
- FileHeatmap treemap + timelapse: 31 tests pass
- SpanDag zoom/pan: tests pass
- All 2484 tests pass (4 skipped)
The original test failures were due to better-sqlite3 native module
version mismatch, not missing implementations.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All tests were failing due to better-sqlite3 native module version
mismatch (NODE_MODULE_VERSION 137 vs 127). Rebuilt the module
with 'npm rebuild better-sqlite3' - all 2484 tests now pass.
No source code changes were needed; src/memoryProfiler.ts was already
present and complete.
The bead description claimed missing modules and features, but investigation
showed all implementation gaps were already closed. Test failures were due
to better-sqlite3 native module version mismatch (NODE_MODULE_VERSION 115
vs 137), resolved by rebuilding the module.
All 2484 tests now pass (4 skipped). No source code changes were needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix beadWorkspaceScanner.test.ts: make beforeEach async to use top-level await
- Fix parser.real-logs.integration.test.ts: change sequence test to non-decreasing (real logs have duplicate sequences)
- Fix FleetSummaryBar.test.tsx: correct expected separator count from 5 to 4
All 2484 tests now pass (was 89 failed due to wrong Node.js version + 3 test bugs).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 9 UI change 2. Updated WorkerGrid component to display bead progress
instead of raw event count. Shows current bead when WORKING state.
- Added beadsCompleted and currentBead fields to frontend WorkerInfo type
- Worker card now shows "bead: bf-5r22 / 31 completed" when WORKING
- Shows "31 completed" when not WORKING or no current bead
- Removed eventCount display from worker card UI
- Updated tests to cover new display format
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 9 UI change 1: Add always-visible summary line at top of web dashboard.
- New FleetSummaryBar component showing:
- N WORKING (workers in WORKING needleState)
- N SELECTING (workers in SELECTING needleState)
- N EXHAUSTED (workers in EXHAUSTED_IDLE or STOPPED)
- N beads today (sum of beadsCompleted from workers)
- N stuck (count of workers with stuck=true)
- Wired into App.tsx above WorkerGrid
- Comprehensive frontend tests covering all states and reactivity
- CSS styling with color-coded states
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 9 implementation: Bead workspace scanner and project breakdown.
- Add beadWorkspaceScanner.ts to scan .beads/issues.jsonl files
- Count CLOSED beads per project, deriving project from bead id prefix
- Use close_reason/closed_at/assignee for productivity tracking
- Add configurable workspace list in config.ts (WorkspaceConfig interface)
- Extend GET /api/productivity to add byProject array
- Add By Project section to ProductivityPanel React component
- Add tests for bead workspace scanner
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The working-tree issues.jsonl had been wiped (db reset); this restores the
authoritative 153-bead history and adds the Phase 9 Productivity Analytics
gap beads created 2026-05-22:
bf-2wf epic: Phase 9 remaining gaps
bf-60j currentBead field on WorkerInfo (completed by worker)
bf-3xp bead workspace scanner + /api/productivity project breakdown
bf-4f3 fleet summary bar component
bf-3t8 worker-card enrichment (blocked by bf-60j)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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>
Adds GET /api/productivity returning daily bead completion counts (last 30
days) from bead.released/release_success events and a worker leaderboard
sorted by beadsCompleted. Adds a Productivity tab in the web UI with a 14-day
SVG bar chart and a worker leaderboard table.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Modern NEEDLE emits bead.released with reason=release_success instead of
legacy bead.completed. Update store.ts and workerAnalytics.ts to handle
this event: increment beadsCompleted, set status to idle, and clear
activeBead/activeFiles/activeDirectories.
Also fixes workerAnalytics trackBeadEvent to use explicit isReleasedSuccess
check instead of broad msg.includes('success') which could false-positive.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WorkerGrid now sorts by WORKING > CLAIMING > SELECTING > BOOTING >
CLOSING > EXHAUSTED_IDLE > STOPPED and filters out test workers
(test-*, claude-test-*, nonexistent-*, needle-test, strand-runner,
-test-worker) by default. App header gets a toggle button to show/hide
test workers. EXHAUSTED_IDLE added to NeedleState type and propagated
to WorkerDetail and WorkerGrid state maps.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All implementation gaps from Phases 1-8 are closed (2418 tests passing).
Phase 9 planning added to docs/plan.md with productivity analytics design.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bead-Id: bf-48nk
Integrate the conversationParser module with the InMemoryEventStore and web server
to provide complete conversation transcript functionality.
Store integration:
- Add conversation session caching with 5-second TTL
- Invalidate cache when conversation events are added
- Add methods: getConversationSessions, getWorkerConversationSessions,
getBeadConversationSession, getConversationSession,
getConversationEvents, getWorkerConversationEvents,
getBeadConversationEvents
Web API integration:
- GET /api/conversations/sessions - Get all conversation sessions
- GET /api/conversations/workers/:workerId - Get sessions for worker
- GET /api/conversations/beads/:beadId - Get session for bead
- GET /api/conversations/:sessionId - Get session by ID
- GET /api/conversations/events - Get all conversation events
- GET /api/conversations/workers/:workerId/events - Get worker events
- GET /api/conversations/beads/:beadId/events - Get bead events
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add standalone conversationParser module to extract full conversation
transcripts from NEEDLE logs. This completes Phase 1 Core Infrastructure
item for conversation parsing.
Implementation:
- isConversationSpanEvent(): Identify conversation-related span events
- buildConversationSessions(): Build sessions from log events
- getWorkerConversationSessions(): Filter sessions by worker
- getBeadConversationSession(): Get session for a specific bead
- extractConversationEvents(): Extract all conversation events
Types supported:
- PromptEvent: User input/prompt
- ResponseEvent: Assistant response text
- ThinkingEvent: Internal reasoning/thinking blocks
- ToolCallEvent: Tool invocations with arguments
- ToolResultEvent: Tool call results
Also updates docs/plan.md to mark Phase 1 Core Infrastructure items complete.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The vitest mock hoisting errors were already fixed in commit 7686974.
CrossReferencePanel.test.ts and WorkerAnalyticsPanel.test.ts both
use vi.hoisted() correctly and all 2399 tests pass.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All claimed gaps verified complete:
- src/memoryProfiler.ts exists and fully implemented
- FileHeatmap treemap + timelapse implemented
- SpanDag zoom/pan interaction implemented
- Unit tests: 2399 passed, 4 skipped, 0 failed
E2E test failures (53) are unrelated to claimed implementation gaps.
No E2E tests exist for FileHeatmap or SpanDag features.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Fix CrossReferencePanel.test.ts and WorkerAnalyticsPanel.test.ts
which failed to load due to vi.mock() hoisting issues.
The vi.mock() factory functions referenced variables declared after
the mock call. When vitest hoists these mocks to the top of the
file, those variables weren't initialized yet, causing
"Cannot access before initialization" errors.
Solution: Use vi.hoisted() to declare mock variables before the
factory runs, ensuring they're available when the mock is evaluated.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Verified that the 3 failing tests in SemanticNarrativePanel.test.ts were
already fixed in commit 62370103. The issue was test mocks missing required
fields (workerId, events, startTime, endTime, durationMs) added to the
SemanticNarrative type.
All 59 tests now pass. The implementation methods (refresh, updateFromWorker,
updateAggregated) were always correct - the failure was purely test data.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Verified all 57 tests in src/tui/components/FileContextPanel.test.ts pass.
The implementation already includes all expected functionality from the
original bead description. The bead was based on stale information.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All unit tests passing (2399 tests, 4 skipped):
- memoryProfiler.ts exists and is fully implemented
- FileHeatmap treemap + timelapse fully implemented
- SpanDag zoom/pan fully implemented
E2E test improvements (7 failures, down from 15):
- Fixed focus mode multipin test expectations
- Updated getPinnedCount helper to count directly
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Verified all claimed implementation gaps were already complete:
- src/memoryProfiler.ts exists and works (7530 bytes)
- FileHeatmap treemap + timelapse fully implemented
- SpanDag zoom/pan fully implemented
- All 2399 tests passing (4 skipped, 0 failed)
This was a retrospective tracking bead for work completed
in previous commits (f824c2e, ae4c12c, 6237010).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Investigation found that all 57 FileContextPanel tests are passing.
The issues described in the bead were already fixed in the original
implementation (bd-2u6). No code changes required.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Fixed test mocks to include required fields added to SemanticNarrative type:
- workerId: required string field
- events: array field for narrative events
- startTime, endTime, durationMs: temporal fields
Also fixed store.ts to handle potential undefined avgModificationInterval.
All 2399 unit tests pass (4 skipped).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All 5 tests mentioned in the bead are passing. The required public API
(addSuggestion, addSuggestions, clearSuggestions, setSuggestions) and
behaviors (empty query returns all suggestions, navigation wrap-around)
are fully implemented in src/tui/components/CommandPalette.ts.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Verified all implementation gaps from the genesis bead checklist are complete:
- memoryProfiler.ts: Fully implemented with snapshot tracking and V8 heap dumps
- FileHeatmap treemap + timelapse: Both views fully implemented with playback controls
- SpanDag zoom/pan: Fully implemented with wheel zoom and drag-to-pan
All 2399 tests pass (4 skipped).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Investigation revealed all claimed implementation gaps were already complete:
- memoryProfiler.ts exists and fully implemented
- FileHeatmap treemap/timelapse fully implemented
- SpanDag zoom/pan fully implemented
- All 2399 tests passing (4 skipped)
Only work done was updating retrospective notes in notes/bf-48nk.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The parseDiff function in src/tui/components/DiffView.ts correctly:
- Returns empty array for empty input
- Splits diff on newlines
- Classifies '+++' and '---' as headers (not added/removed)
- Classifies '+' lines as added
- Classifies '-' lines as removed
All 44 DiffView tests pass. No code changes needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The bead description claimed significant implementation gaps, but upon
investigation all mentioned features were already complete:
- memoryProfiler.ts: exists (f824c2e)
- FileHeatmap treemap/timelapse: fully implemented
- SpanDag zoom/pan: fully implemented
- Only 1 test failing (selector bug, now fixed)
All tests pass: 2399 passed, 4 skipped (65 test files)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The test was looking for `.timelapse-playback button.primary` but the button
only has the "primary" class when isPlaying is true. Initially it's false,
so the selector failed. Changed to `.timelapse-playback button` to find
the button regardless of its play state.
All tests now pass: 2399 passed, 4 skipped (65 test files)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The bead description claimed src/memoryProfiler.ts was missing,
but investigation revealed it was fully implemented in commit
f824c2e. All 90 web server tests pass successfully.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The bead was already closed when picked up. This note documents
that the memoryProfiler module was fully implemented by a previous
agent and all tests pass.
Re-verified memoryProfiler.ts implementation is complete and functional.
All tests passing, no action required.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The file src/memoryProfiler.ts already exists and was added in commit
233e381. All 90 web server tests pass. The bead description indicated
the file was missing, but it is present and functional.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1. maxEvents limit enforcement:
- Changed trimming condition from `> maxEvents + TRIM_BATCH_SIZE` to `> maxEvents`
- Now properly trims to exactly maxEvents when limit is exceeded
- Fixed: tests "should trim old events when over limit", "should keep most recent events",
"should use default maxEvents of 10000"
2. Cross-Reference Integration:
- Modified CrossReferenceManager.processEvent() to create immediate worker->event links
- This ensures every event creates at least one cross-reference link
- Fixed: tests "should track cross-references when events are added",
"should create links between events and workers", "should find linked entities"
3. Bead collision detection:
- Fixed detectBeadCollision() to include all workers in collision set
- Added time window check: only detect collision if other worker was active within
BEAD_COLLISION_WINDOW_MS (60 seconds)
- Fixed: tests "should detect collision when multiple workers work on same bead",
"should not detect bead collision outside time window", "should update worker
collision types for bead collision"
All 103 tests now pass (1 skipped).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Implements the MemoryProfiler class with:
- Real-time memory usage tracking and trend analysis
- Baseline/diff functionality for leak detection
- V8 heap snapshot capture to disk
- In-memory snapshot ring buffer (max 100)
- Periodic capture support with configurable intervals
Exports getMemoryProfiler() singleton used by server.ts endpoints:
- GET /api/memory/stats
- POST /api/memory/capture
- GET /api/memory/diff
- POST /api/memory/baseline
- POST /api/memory/heap-snapshot
- GET /api/memory/snapshots
Resolves bd-ch6.7 memory profiling plan.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add comprehensive tests for the worker count badge feature that
displays active/idle/error worker counts in the TUI header.
Tests verify:
- Badge displays with active workers
- Mixed status badges (active, idle, error)
- Real-time updates as workers join/leave
- Filter indicator display
- Graceful handling of no workers
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The requested feature to add a worker count badge to the TUI header
is already fully implemented in src/tui/app.ts via:
- getWorkerStats(): returns counts by status (active/idle/error)
- getHeaderContent(): builds badge with color-coded indicators
- updateHeader(): called in real-time via addEvent()
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The hot reload functionality for workers.log was already implemented
in src/cli.ts (lines 152-179). This commit adds comprehensive tests
to verify the behavior.
Key findings:
- workers.log is monitored via LogTailer when it exists at TUI startup
- New events are parsed and added to store/TUI in real-time
- CLI filters are applied correctly
- Deduplication works for canonical NeedleEvents (sequence >= 0)
- Legacy events (sequence < 0) cannot be deduplicated
Known limitations:
- If workers.log doesn't exist at TUI startup, it won't be watched
- File rotation is handled but may have edge cases
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add fs.watch-based monitoring for ~/.needle/logs/workers.log in the TUI
command. When new lines are appended to workers.log, they are parsed and
the TUI updates in real-time without requiring manual refresh.
Key features:
- Separate LogTailer for workers.log alongside the existing DirectoryTailer
- Starts tailing immediately if workers.log exists at startup
- Watches directory for workers.log creation if it doesn't exist initially
- Proper cleanup on shutdown (stops both tailer and directory watcher)
- Applies CLI filters (worker/level) to events from workers.log
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>