Memory Copilot Slim Initiative Changes
Summary
Refactored Memory Copilot to store minimal initiative data (pointers only), with detailed task data expected to live in Task Copilot. This reduces context bloat when /continue loads initiatives.
Changes Made
1. Database Schema (v2 Migration)
New columns added to initiatives and initiatives_archive:
task_copilot_linked(INTEGER) - Whether initiative is linked to Task Copilotactive_prd_ids(TEXT) - JSON array of active PRD IDscurrent_focus(TEXT) - Current work focus (max 100 chars)next_action(TEXT) - Next action to take (max 100 chars)
Existing columns retained for backward compatibility:
completed,in_progress,blocked,resume_instructions(marked DEPRECATED)
Migration: Automatic on first run. Version bumped from 1 to 2.
2. Type Definitions
Updated Initiative interface (src/types.ts):
interface Initiative {
// NEW: Task Copilot integration
taskCopilotLinked?: boolean;
activePrdIds?: string[];
// NEW: Slim resume context
currentFocus?: string; // Max 100 chars
nextAction?: string; // Max 100 chars
// DEPRECATED (but kept)
completed: string[];
inProgress: string[];
blocked: string[];
resumeInstructions?: string;
}
Added new input/output types:
InitiativeSlimInput- Input for slim operationInitiativeSlimOutput- Output with savings metrics
3. New Tool: initiative_slim
Purpose: Slim down bloated initiatives by removing task lists
Input:
{
"archiveDetails": true // Archive removed data to file (default: true)
}
Output:
{
"initiativeId": "abc-123",
"archived": true,
"archivePath": "~/.claude/memory/archives/abc-123_2025-01-15_pre_slim.json",
"removedFields": ["completed", "inProgress", "blocked", "resumeInstructions"],
"beforeSize": 2400,
"afterSize": 600,
"savings": "75% reduction"
}
Behavior:
- Archives removed data to
~/.claude/memory/archives/{id}_pre_slim.json - Removes:
completed,inProgress,blocked,resumeInstructions - Keeps:
decisions,lessons,keyFiles(permanent knowledge) - Resets Task Copilot fields to defaults
4. Enhanced initiative_update
New fields accepted:
taskCopilotLinked(boolean)activePrdIds(string[])currentFocus(string, auto-truncated to 100 chars)nextAction(string, auto-truncated to 100 chars)
Backward compatibility:
- Still accepts deprecated fields (
completed,inProgress, etc.) - Warns to console if
completedarray exceeds 10 items
5. Enhanced initiative_get
New behavior:
- Adds hint to output if initiative is bloated (>10 tasks or >200 char resume)
- Hint text: "HINT: This initiative has bloated task lists. Consider using initiative_slim to reduce context usage."
6. Documentation Updates
README.md:
- Added "Initiative Structure" section explaining slim vs legacy modes
- Added usage examples for slim workflow
- Updated tool descriptions
Files Modified
src/types.ts- Added new fields and typessrc/db/schema.ts- Added new columns, v2 migrationsrc/db/client.ts- Updated upsert/archive to handle new columns, migration logicsrc/tools/initiative-tools.ts- AddedinitiativeSlim, updated conversion functionssrc/tools/index.ts- Exported new functionsrc/index.ts- Added tool definition and handlerREADME.md- Documentation updates
Backward Compatibility
- Existing initiatives continue to work unchanged
- Old fields (
completed, etc.) are retained in database - Migration is automatic and non-destructive
initiative_slimprovides opt-in migration path
Token Savings
Before (bloated initiative):
- 50+ completed tasks
- 5-10 in-progress tasks
- Verbose resume instructions
- Total: ~2000-3000 tokens
After (slim initiative):
- Task Copilot pointers only
- 100 char focus/action strings
- Decisions/lessons retained
- Total: ~500-800 tokens
Typical savings: 60-75% reduction in context usage
Testing
To test the changes:
- Start initiative:
initiative_start - Add some tasks using legacy fields:
initiative_updatewithcompleted,inProgress - Check for hint:
initiative_get(should show bloat warning if >10 items) - Slim it down:
initiative_slim - Verify reduction: Check
beforeSizevsafterSizein output - Confirm archive: Check file at
archivePath - Test new fields:
initiative_updatewithcurrentFocus,nextAction
Migration Guide
For Existing Initiatives
# 1. Get current initiative to see size
claude tool initiative_get
# 2. Slim it down (archives to file first)
claude tool initiative_slim '{"archiveDetails": true}'
# 3. Update with new slim fields
claude tool initiative_update '{
"taskCopilotLinked": true,
"activePrdIds": ["PRD-001"],
"currentFocus": "Implementing Phase 2",
"nextAction": "Run task TASK-123"
}'
For New Initiatives
# Use slim mode from the start
claude tool initiative_start '{"name": "New Feature", "goal": "Build it"}'
claude tool initiative_update '{
"currentFocus": "Starting Phase 1",
"nextAction": "Create PRD"
}'
Next Steps
- Update
/continuecommand to use slim fields when resuming - Integrate with Task Copilot for seamless task management
- Consider deprecation timeline for legacy fields (future v3)