.cursor/skills/episodic-memory-patterns/SKILL.md
--- name: episodic-memory-patterns description: Guides episodic memory implementation: (state, action, next_state, outcome) tuple storage, outcome collection, memory pruning. Use when implementing outcome tracking, writing episodic tuples, wiring new user actions to outcome collection, or working on Phase 1 tasks. --- # Episodic Memory Patterns ## Core Principle Every user action must produce an episodic tuple: `(state_before, action, state_after, outcome)`. This is the training data for the
npx skillsauth add avra-cadavra/avrai .cursor/skills/episodic-memory-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Every user action must produce an episodic tuple: (state_before, action, state_after, outcome). This is the training data for the entire world model. No episodic data = no learning.
/// Core episodic memory tuple
class EpisodicTuple {
final StateFeatureVector stateBefore; // Full 105-115D state snapshot
final String actionType; // From action taxonomy
final Map<String, dynamic> actionEntity; // Entity features
final StateFeatureVector stateAfter; // State after action
final OutcomeSignal outcome; // What happened
final AtomicTimestamp timestamp; // From AtomicClockService
final bool isContrastive; // Was this a rejected recommendation?
final String? recommendedAction; // What was recommended (if contrastive)
}
/// Outcome signal types
enum OutcomeType {
binary, // did/didn't (attended event, joined community)
quality, // 1-5 rating (post-event feedback)
behavioral, // personality shift magnitude
temporal, // returned within N days
}
Every new user action must be wired:
/// Pattern: Wire an action to episodic memory
Future<void> handleUserAction(String agentId, Action action) async {
// 1. Capture state BEFORE action
final stateBefore = await featureExtractor.extractFeatures(agentId);
// 2. Execute the action
final result = await executeAction(action);
// 3. Capture state AFTER action (may be immediate or delayed)
final stateAfter = await featureExtractor.extractFeatures(agentId);
// 4. Record outcome
final outcome = OutcomeSignal(
type: OutcomeType.binary,
value: result.success ? 1.0 : 0.0,
);
// 5. Store episodic tuple
await episodicMemory.store(EpisodicTuple(
stateBefore: stateBefore,
actionType: action.type,
actionEntity: action.entityFeatures,
stateAfter: stateAfter,
outcome: outcome,
timestamp: atomicClock.now(),
isContrastive: false,
));
}
All actions must use the defined taxonomy:
visit_spot, attend_event, join_community, connect_ai2ai,
save_list, create_reservation, message_friend, message_community,
ask_agent, host_event, consult_expert
| Action | Outcome Source | Timing |
|--------|--------------|--------|
| attend_event | ReservationCheckInService confirmation | Immediate |
| attend_event | PostEventFeedbackService rating | Next app open |
| join_community | Return visits within 7 days | Delayed |
| visit_spot | Dwell time, return visits | Session end |
| connect_ai2ai | Connection quality, learning value | Session end |
| save_list | Did user act on saved items? | 24-48 hours |
| message_friend | Chat led to real-world meeting? | 7 days |
| create_reservation | Did user show up? | Event time |
/// Keep last N episodes per action type, compress old episodes
Future<void> pruneMemory() async {
for (final actionType in ActionTaxonomy.all) {
final episodes = await episodicMemory.getByType(actionType);
if (episodes.length > maxPerType) {
// Keep most recent
final toKeep = episodes.sublist(0, maxPerType);
// Compress old into summary statistics
final summary = _compressSummary(episodes.sublist(maxPerType));
await episodicMemory.replaceWithSummary(actionType, toKeep, summary);
}
}
}
WorldModelFeatureExtractor)OutcomeTypeEpisodicMemoryStoreAtomicClockService used for timestampsdocs/MASTER_PLAN.md Phase 1 (Outcome Data & Episodic Memory)lib/core/services/calling_score_data_collector.dart - Outcome collection templatelib/core/ai/continuous_learning_system.dart - Wire point for processUserInteractiondevelopment
--- name: world-model-development description: Guides world model development patterns: state/action encoders, ONNX inference, feature extraction pipeline, latency budgets. Use when implementing world model components, state encoders, action encoders, feature extractors, or ONNX models. Core skill for Phases 3-6. --- # World Model Development Patterns ## Core Principle All world model components follow LeCun's autonomous machine intelligence framework. State observations flow through a percep
tools
Implements base workflow controller patterns for multi-step processes. Use when creating complex workflows that require orchestration of multiple steps with error handling and rollback.
testing
--- name: widget-test-patterns description: Guides widget test patterns: BLoC testing, user interactions, state changes, material app setup. Use when writing widget tests, testing UI components, or validating widget behavior. --- # Widget Test Patterns ## Core Pattern Widget tests verify UI behavior: user interactions, state changes, and visual display. ## Basic Widget Test Setup ```dart testWidgets('widget displays correctly', (WidgetTester tester) async { // Arrange: Create widget awa
testing
--- name: test-template-generation description: Generates test templates: unit, widget, integration, service tests following project patterns. Use when creating new tests or ensuring tests follow project standards. --- # Test Template Generation ## Available Templates Test templates are located in `test/templates/`: - `unit_test_template.dart` - `widget_test_template.dart` - `integration_test_template.dart` - `service_test_template.dart` ## Unit Test Template ```dart /// SPOTS Component Uni