feat: Implement user prompt syncing to Chroma and enhance timeline querying

- Added `getObservationById` method to retrieve observations by ID in SessionStore.
- Introduced `getSessionSummariesByIds` and `getUserPromptsByIds` methods for fetching session summaries and user prompts by IDs.
- Developed `getTimelineAroundTimestamp` and `getTimelineAroundObservation` methods to provide a unified timeline of observations, sessions, and prompts around a specified anchor point.
- Enhanced ChromaSync to format and sync user prompts, including a new `syncUserPrompt` method.
- Updated WorkerService to sync the latest user prompt to Chroma after updating the worker port.
- Created tests for timeline querying and MCP handler logic to ensure functionality.
- Documented the implementation plan for user prompts and timeline context tool in the Chroma search completion plan.
This commit is contained in:
Alex Newman
2025-11-03 16:55:33 -05:00
parent c6bf72ca72
commit 633f89a5fb
18 changed files with 2152 additions and 229 deletions
+9 -9
View File
@@ -190,10 +190,10 @@ function contextHook(input?: SessionStartInput, useColors: boolean = false, useI
if (timelineObs.length > 0) {
// Legend/Key
if (useColors) {
output.push(`${colors.dim}Legend: 🎯 session-request | 🔴 bugfix | 🟢 feature | 🔵 refactor | change | 🟡 discovery | 🟤 decision${colors.reset}`);
output.push(`${colors.dim}Legend: 🎯 session-request | 🔴 bugfix | 🟣 feature | 🔄 refactor | change | 🔵 discovery | 🧠 decision${colors.reset}`);
output.push('');
} else {
output.push(`**Legend:** 🎯 session-request | 🔴 bugfix | 🟢 feature | 🔵 refactor | change | 🟡 discovery | 🟤 decision`);
output.push(`**Legend:** 🎯 session-request | 🔴 bugfix | 🟣 feature | 🔄 refactor | change | 🔵 discovery | 🧠 decision`);
output.push('');
}
@@ -202,13 +202,13 @@ function contextHook(input?: SessionStartInput, useColors: boolean = false, useI
output.push(`${colors.dim}💡 Progressive Disclosure: This index shows WHAT exists (titles) and retrieval COST (token counts).${colors.reset}`);
output.push(`${colors.dim} → Use MCP search tools to fetch full observation details on-demand (Layer 2)${colors.reset}`);
output.push(`${colors.dim} → Prefer searching observations over re-reading code for past decisions and learnings${colors.reset}`);
output.push(`${colors.dim} → Critical types (🔴 bugfix, 🟤 decision) often worth fetching immediately${colors.reset}`);
output.push(`${colors.dim} → Critical types (🔴 bugfix, 🧠 decision) often worth fetching immediately${colors.reset}`);
output.push('');
} else {
output.push(`💡 **Progressive Disclosure:** This index shows WHAT exists (titles) and retrieval COST (token counts).`);
output.push(`- Use MCP search tools to fetch full observation details on-demand (Layer 2)`);
output.push(`- Prefer searching observations over re-reading code for past decisions and learnings`);
output.push(`- Critical types (🔴 bugfix, 🟤 decision) often worth fetching immediately`);
output.push(`- Critical types (🔴 bugfix, 🧠 decision) often worth fetching immediately`);
output.push('');
}
@@ -340,19 +340,19 @@ function contextHook(input?: SessionStartInput, useColors: boolean = false, useI
icon = '🔴';
break;
case 'feature':
icon = '🟢';
icon = '🟣';
break;
case 'refactor':
icon = '🔵';
icon = '🔄';
break;
case 'change':
icon = '';
icon = '';
break;
case 'discovery':
icon = '🟡';
icon = '🔵';
break;
case 'decision':
icon = '🟤';
icon = '🧠';
break;
default:
icon = '•';