feat(memory): implement persistent project-level Knowledge Graph and RAG (#899)

- Shift memory from session-scope to persistent project-scope\n- Add native JSON RAG with BM25-lite ranking\n- Implement passive technical concept extraction (IPs, versions, frameworks)\n- Orchestrate hierarchical context injection in the conversation loop
This commit is contained in:
3kin0x
2026-04-26 02:17:02 +02:00
committed by GitHub
parent 9e23c2bec4
commit 29f7579377
8 changed files with 649 additions and 145 deletions

View File

@@ -475,8 +475,14 @@ async function* queryLoop(
messagesForQuery = collapseResult.messages
}
const lastMessage = messagesForQuery[messagesForQuery.length - 1]
const userQueryText = lastMessage?.type === 'user' ? (typeof lastMessage.message.content === 'string' ? lastMessage.message.content : '') : ''
const { getArcSummary } = await import('./utils/conversationArc.js')
const arcSummary = getArcSummary(userQueryText)
const fullSystemPrompt = asSystemPrompt(
appendSystemContext(systemPrompt, systemContext),
appendSystemContext(`${systemPrompt}\n\n${arcSummary}`, systemContext),
)
queryCheckpoint('query_autocompact_start')
@@ -1867,6 +1873,13 @@ async function* queryLoop(
}
queryCheckpoint('query_recursive_call')
// Persist conversation progress to global project memory
if (getGlobalConfig().knowledgeGraphEnabled) {
const { finalizeArcTurn } = await import('./utils/conversationArc.js')
finalizeArcTurn()
}
const next: State = {
messages: [...messagesForQuery, ...assistantMessages, ...toolResults],
toolUseContext: toolUseContextWithQueryTracking,