Summary
Replace the current prompt-driven remory approach with deep system integration. Auto-search before tasks, auto-store after completion, with graceful fallback when remory is unavailable.
Background
Research findings (Jan 29, 2026):
- Current manual approach produces HIGH quality memories (47 stored, avg 468 chars)
- Agents store synthesized conclusions, not reasoning noise ✅
- Gap: Manual process means agents may miss relevant context or forget to store
Requirements
1. Remove Existing Stub Implementation
- Remove
remory_persist_thinking config flag (unused) - Clean out any stubbed/unused remory code paths
- Keep the core
memory/remory.ts API
2. Pre-Task Auto-Search
When a task/subagent is dispatched:
constmemories=awaitremory.search(taskDescription,{ user_id,limit: 5})constrelevant=memories.filter(m=>m.distance<0.40)// Confidence threshold// Inject into task system prompt as context3. Post-Task Auto-Store
When a task completes successfully:
// Generate one synthesized summary (NOT reasoning dump)constsummary=`Task: ${task.description}\nOutcome: ${task.status}\nApproach: ${task.summary}`awaitremory.add(summary,{
user_id,metadata: {type: inferType(task),// 'root_cause' | 'investigation' | 'fix' | 'pattern'issue: task.issueId,agent: task.agentType,date: newDate().toISOString()}})4. Graceful Fallback (CRITICAL)
If remory is not available (not installed, socket unavailable, errors):
- Log warning once per session, not per operation
- Continue without memory features — don't block or crash
- All remory calls must be wrapped in try/catch with fallback
asyncfunctionsafeRemorySearch(query: string): Promise<Memory[]>{if(!remoryAvailable)return[]try{returnawaitremory.search(query,{ user_id,limit: 5})}catch(e){markRemoryUnavailable()log.warn("Remory unavailable, continuing without memory features")return[]}}5. Structured Metadata
Add consistent metadata tagging:
interfaceMemoryMetadata{type: 'root_cause'|'investigation'|'security'|'fix'|'pattern'|'state'issue?: string// GitHub issue numberagent?: string// Agent type that created itfiles?: string[]// Related file pathsdate: string// ISO timestamp}Files to Modify
packages/opencode/src/memory/remory.ts — Add graceful fallback wrapperpackages/opencode/src/config/config.ts — Remove remory_persist_thinking stubpackages/opencode/src/session/ — Add pre-task search injectionpackages/opencode/src/task/ — Add post-task auto-store- Agent prompt files — Remove manual remory instructions (now automatic)
Acceptance Criteria
Non-Goals
- ❌ Storing reasoning blocks (confirmed low value, high noise)
- ❌ Storing every tool result
- ❌ Making remory a hard dependency
References
- Research: Remory value analysis (Jan 29, 2026)
- Current memories show high quality when synthesized
../remory/ — Remory codebase for reference~/.remory/remory.db — SQLite database
Summary
Replace the current prompt-driven remory approach with deep system integration. Auto-search before tasks, auto-store after completion, with graceful fallback when remory is unavailable.
Background
Research findings (Jan 29, 2026):
Requirements
1. Remove Existing Stub Implementation
remory_persist_thinkingconfig flag (unused)memory/remory.tsAPI2. Pre-Task Auto-Search
When a task/subagent is dispatched:
3. Post-Task Auto-Store
When a task completes successfully:
4. Graceful Fallback (CRITICAL)
If remory is not available (not installed, socket unavailable, errors):
5. Structured Metadata
Add consistent metadata tagging:
Files to Modify
packages/opencode/src/memory/remory.ts— Add graceful fallback wrapperpackages/opencode/src/config/config.ts— Removeremory_persist_thinkingstubpackages/opencode/src/session/— Add pre-task search injectionpackages/opencode/src/task/— Add post-task auto-storeAcceptance Criteria
remory search/addtools still available for explicit useNon-Goals
References
../remory/— Remory codebase for reference~/.remory/remory.db— SQLite database