feat: add conversation import system for extracting knowledge from prior AI agent history#252
Merged
Conversation
…ior AI agent history Introduces a pluggable system that detects, reads, and extracts long-term knowledge from conversation histories of 7 external AI coding agents: Claude Code, Codex, OpenCode, Cline, Continue, Pi, and Aider. Key components: - Provider interface (AgentHistoryProvider) with detect/readChunks methods - Detection orchestrator scanning all registered providers per project - Knowledge extraction via curator LLM (reuses shared parseOps/applyOps) - Idempotency tracking (import_history table, DB migration v19) - `lore import` CLI command with dry-run, agent filter, and progress - Auto-detection in `lore run` for fresh projects (background import) - 83 tests covering all providers, detection, extraction, and history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lore importCLI command and auto-detection inlore runfor fresh projectsparseOps/applyOpsinto shared helpers reused by the import extraction pipelineDetails
Architecture
The import system lives in
packages/core/src/import/with a clean layered design:AgentHistoryProvider) — each agent implementsdetect(projectPath)andreadChunks(projectPath, sessionIds)import_historytable (DB migration v19) tracks imported sources by hash to prevent re-importingProviders
~/.claude/projects/<mangled>/*.jsonl~/.codex/sessions/YYYY/MM/DD/*.jsonlcwdin session_meta~/.local/share/opencode/opencode.dbworktreein project table/tasks/<id>/cwdOnTaskInitialization~/.continue/sessions/<id>.jsonworkspaceDirectory~/.pi/agent/sessions/<encoded-cwd>/*.jsonl<project>/.aider.chat.history.mdCLI
Auto-detection (
lore run)On fresh projects (no existing knowledge/temporal data),
lore runchecks for prior conversations before launching the agent. If found, prompts the user once and runs import in the background. Declined imports are recorded so we don't ask again.Curator refactor
Extracted
parseOps()andapplyOps()fromcurator.tsinto exported shared helpers. Both the live curator and the import system use them — zero behavior change for existing code paths.Testing
83 new tests across 10 files covering:
Related