Documentation Index
Fetch the complete documentation index at: https://docs.getcore.me/llms.txt
Use this file to discover all available pages before exploring further.
Pipeline overview
CORE V2 search routes a query through two stages before any episode retrieval: a vector lookup against topic labels, then a structured LLM call that extracts aspects, query type, temporal scope, and entity hints. A handler is dispatched perqueryType. Results are merged, optionally reranked, and trimmed to a token budget.
Stage 1: Intent routing
The router lives inapps/webapp/app/services/search-v2/router.ts and runs two sequential steps.
First, searchLabels() embeds the query and runs vector search against the LABEL namespace. The similarity threshold comes from SEARCH_LABEL_VECTOR_THRESHOLD. Matched labels are returned as matchedLabels.
Second, extractAspects() calls an LLM with the query and the matched labels as context. The LLM returns a structured object:
matchedLabels (from the label vector search) and routingTimeMs.
shouldProceedWithSearch() short-circuits the pipeline when shouldSearch === false or confidence < 0.2. In that case no handler runs and an empty result is returned.
Stage 2: Handler dispatch
Handlers live inapps/webapp/app/services/search-v2/handlers.ts. Dispatch is by queryType.
aspect_query
Triggered when the query is about a topic, behavior, or category (for example “my views on remote work”). handleAspectQuery runs three calls in parallel:
getEpisodesForAspect: graph query scoped bylabelIds,aspects, and temporal range.getEpisodesViaEntityHints: resolves each entity hint via vector search on theENTITYnamespace, then fetches episodes from the graph.getEpisodesViaVectorSearch: vector search on episode embeddings, only whenlabelIds.length === 0(no label match to scope by).
entity_lookup
Triggered when the query targets a specific entity (for example “what is my wife’s name”). handleEntityLookup resolves each entry in entityHints via vector search on the ENTITY namespace. Then it branches on lookupMode:
attribute: returns the entity with the requested attribute, usingattributeHintto select the field.broad: returns episodes that mention the entity.
temporal
Triggered when the query has an explicit time scope (for example “what did I do last week”). handleTemporal runs in parallel:
getEpisodesForTemporal: graph query scoped bylabelIdsand the temporal range.- Entity-hint path: vector on
ENTITY, then graph fetch, with the time filter applied to results. - Vector fallback: episode vector search, with the time filter applied.
temporal_facets
Triggered when the query asks for an aggregate over a time range (for example “what topics did I discuss this month”). handleTemporalFacets aggregates facets (topics, entities, aspects) over the range and returns counts. It does not return episodes.
exploratory
Triggered for broad recall queries (for example “summarize recent work”). handleExploratory queries the Document table for compacted session rows scoped by labelIds. It also runs the entity-hint path and the vector fallback in parallel.
Returns compacted session documents plus any matching episodes.
relationship
Triggered when the query connects two or more entities (for example “how do Alice and Bob know each other”). handleRelationship requires entityHints.length >= 2. Each hint is resolved via vector search on the ENTITY namespace, then graph traversal finds connecting statements.
Returns statements that link the entities.
Stage 3: Merge, rerank, budget
After a handler returns:- Merge and dedupe episodes across the parallel sub-results.
- If
options.enableRerankingis true,applyCohereEpisodeRerankingreorders episodes using a Cohere rerank model. applyTokenBudgettrims the episode list to fit the configured token limit, preserving rerank order.
Worked examples
Aspect query
Input:"what is my view on code review".
Router output (compact):
handleAspectQuery runs getEpisodesForAspect scoped by the resolved labelIds and aspects. No entity hints, so the entity path is skipped. Because labels matched, the vector fallback is skipped.
Returns: deduped episodes about code review preferences.
Entity lookup, attribute mode
Input:"what is my wife's birthday".
Router output:
handleEntityLookup resolves "wife" via vector search on the ENTITY namespace, then returns the matched entity with the birthday attribute populated.
Returns: an entity record with the requested attribute.
Temporal query
Input:"what did I work on last week".
Router output:
handleTemporal runs getEpisodesForTemporal scoped by labelIds and the seven day range, plus the vector fallback with the same time filter applied.
Returns: deduped episodes within the last seven days.
V1 fallback
Workspace versioning is checked inapps/webapp/app/services/agent/memory.ts. When workspace.version === "V3", only V2 runs. For any other version, V2 runs first and the legacy V1 path runs as a fallback when V2 returns empty. V1 uses BM25, vector search, and BFS graph traversal.
V2 itself does not use BM25. All V2 retrieval is graph plus vector.
