-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Overview
The narrativeContextProvider.js file provides narrative memory context for LLM prompts, including storylines, self-reflection, and timeline lore. With only 12.38% coverage, this provider that enriches agent responses is largely untested.
Current Coverage
- Statements: 12.38%
- Branches: 50.00%
- Functions: 16.66%
- Lines: 12.38%
- Target: 80%+ coverage
Uncovered Areas
Major untested sections:
- Provider initialization
- Narrative memory retrieval
- Storyline context formatting
- Self-reflection integration
- Timeline lore formatting
- Evolution-aware prompts
- Context aggregation
- Freshness filtering
- Error handling
Key Functionality to Test
1. Context Provision
- Getting narrative context for prompts
- Storyline context retrieval
- Self-reflection retrieval
- Timeline lore access
- Context formatting
2. Memory Integration
- Narrative memory queries
- Historical summary access
- Topic-based filtering
- Time-window filtering
- Relevance scoring
3. Evolution Awareness
- Topic evolution tracking
- Storyline advancement
- Narrative progression
- Context freshness
4. Provider Lifecycle
- Initialization with runtime
- Dynamic vs static provision
- Cache management
- Error recovery
Testing Strategy
describe('NarrativeContextProvider', () => {
describe('Initialization', () => {
test('initializes with runtime');
test('handles missing narrative memory');
test('sets up as dynamic provider');
});
describe('Context Retrieval', () => {
test('provides narrative context');
test('includes storylines');
test('includes self-reflections');
test('includes timeline lore');
test('formats context for prompts');
});
describe('Memory Integration', () => {
test('queries narrative memory');
test('retrieves hourly summaries');
test('retrieves daily summaries');
test('filters by relevance');
test('filters by time window');
});
describe('Evolution Awareness', () => {
test('tracks topic evolution');
test('monitors storyline advancement');
test('provides fresh context');
test('filters stale information');
});
describe('Error Handling', () => {
test('handles missing memories gracefully');
test('continues with empty context');
test('logs errors appropriately');
});
});Test Fixtures Needed
- Mock narrative memory with sample data
- Sample storylines and reflections
- Timeline lore examples
- Mock runtime
- Various time windows
Acceptance Criteria
- Provider initialization tested
- Context retrieval fully covered
- Memory integration verified
- Evolution awareness tested
- Error handling covered
- Context formatting validated
- Overall coverage >80%
Related
- Parent: Increase plugin-nostr test coverage to 100% #39 - Increase plugin-nostr test coverage to 100%
- Dependencies:
lib/narrativeMemory.js,lib/selfReflection.js - See: Evolution-aware prompts documentation
Priority
🔴 HIGH - Critical for providing rich context to LLM responses and maintaining narrative coherence.
Copilot