Files
gravl/.claude/commands/claude-flow-memory.md
T
clawd d81e403f01 Phase 06 Tier 1: Complete Backend Implementation - Recovery Tracking & Swap System
COMPLETED TASKS:
 06-01: Workout Swap System
   - Added swapped_from_id to workout_logs
   - Created workout_swaps table for history
   - POST /api/workouts/:id/swap endpoint
   - GET /api/workouts/available endpoint
   - Reversible swaps with audit trail

 06-02: Muscle Group Recovery Tracking
   - Created muscle_group_recovery table
   - Implemented calculateRecoveryScore() function
   - GET /api/recovery/muscle-groups endpoint
   - GET /api/recovery/most-recovered endpoint
   - Auto-tracking on workout log completion

 06-03: Smart Workout Recommendations
   - GET /api/recommendations/smart-workout endpoint
   - 7-day workout analysis algorithm
   - Recovery-based filtering (>30% threshold)
   - Top 3 recommendations with context
   - Context-aware reasoning messages

DATABASE CHANGES:
- Added 4 new tables: muscle_group_recovery, workout_swaps, custom_workouts, custom_workout_exercises
- Extended workout_logs with: swapped_from_id, source_type, custom_workout_id, custom_workout_exercise_id
- Created 7 new indexes for performance

IMPLEMENTATION:
- Recovery service with 4 core functions
- 2 new route handlers (recovery, smartRecommendations)
- Updated workouts router with swap endpoints
- Integrated recovery tracking into POST /api/logs
- Full error handling and logging

TESTING:
- Test file created: /backend/test/phase-06-tests.js
- Ready for E2E and staging validation

STATUS: Ready for frontend integration and production review
Branch: feature/06-phase-06
2026-03-06 20:54:03 +01:00

108 lines
2.8 KiB
Markdown

---
name: claude-flow-memory
description: Interact with Claude-Flow memory system
---
# 🧠 Claude-Flow Memory System
The memory system provides persistent storage for cross-session and cross-agent collaboration with CRDT-based conflict resolution.
## Store Information
```bash
# Store with default namespace
./claude-flow memory store "key" "value"
# Store with specific namespace
./claude-flow memory store "architecture_decisions" "microservices with API gateway" --namespace arch
```
## Query Memory
```bash
# Search across all namespaces
./claude-flow memory query "authentication"
# Search with filters
./claude-flow memory query "API design" --namespace arch --limit 10
```
## Memory Statistics
```bash
# Show overall statistics
./claude-flow memory stats
# Show namespace-specific stats
./claude-flow memory stats --namespace project
```
## Export/Import
```bash
# Export all memory
./claude-flow memory export full-backup.json
# Export specific namespace
./claude-flow memory export project-backup.json --namespace project
# Import memory
./claude-flow memory import backup.json
```
## Cleanup Operations
```bash
# Clean entries older than 30 days
./claude-flow memory cleanup --days 30
# Clean specific namespace
./claude-flow memory cleanup --namespace temp --days 7
```
## 🗂️ Namespaces
- **default** - General storage
- **agents** - Agent-specific data and state
- **tasks** - Task information and results
- **sessions** - Session history and context
- **swarm** - Swarm coordination and objectives
- **project** - Project-specific context
- **spec** - Requirements and specifications
- **arch** - Architecture decisions
- **impl** - Implementation notes
- **test** - Test results and coverage
- **debug** - Debug logs and fixes
## 🎯 Best Practices
### Naming Conventions
- Use descriptive, searchable keys
- Include timestamp for time-sensitive data
- Prefix with component name for clarity
### Organization
- Use namespaces to categorize data
- Store related data together
- Keep values concise but complete
### Maintenance
- Regular backups with export
- Clean old data periodically
- Monitor storage statistics
- Compress large values
## Examples
### Store SPARC context:
```bash
./claude-flow memory store "spec_auth_requirements" "OAuth2 + JWT with refresh tokens" --namespace spec
./claude-flow memory store "arch_api_design" "RESTful microservices with GraphQL gateway" --namespace arch
./claude-flow memory store "test_coverage_auth" "95% coverage, all tests passing" --namespace test
```
### Query project decisions:
```bash
./claude-flow memory query "authentication" --namespace arch --limit 5
./claude-flow memory query "test results" --namespace test
```
### Backup project memory:
```bash
./claude-flow memory export project-$(date +%Y%m%d).json --namespace project
```