Conversation Learnings Extractor
Extract structured learnings (lessons, decisions, patterns, dead ends) from exported AI conversations using either a local Ollama model or any OpenAI-compatible API. This skill is designed to work with exports from OpenAI and Anthropic, and pairs well with the chat-history-importer skill for a complete conversation analysis workflow.
Data Handling and Safety
This skill reads private conversation exports and writes model-generated output into your agent's persistent memory. Treat both directions as sensitive.
- Dry run first. Always start with
--dry-runand read the output before letting it write anything to memory. - Prefer local processing. The default Ollama path runs against
http://127.0.0.1:11434on loopback, so export contents never leave your machine. - Remote endpoints send your exports. When
OPENAI_API_KEYis set, conversation content and the API key are sent to the configured endpoint. Only setOPENAI_BASE_URLto a trusted HTTPS provider you control. - Review before you trust. Model output is unreviewed text written into persistent agent memory. Read the generated learnings before relying on them.
- Scope the input. Narrow
--dirand--sinceso you import only what you intend.
See references/model-modes-and-categories.md for the OpenAI-compatible API setup and the full extraction category list.
Configuration, model modes, and the full output format are documented in references/model-modes-and-categories.md.
Quick Start
Using Ollama (default)
python3 scripts/extract.py --dir /path/to/exports --limit 3 --dry-run
python3 scripts/extract.py --file single-conversation.json
python3 scripts/extract.py --dir /path/to/exports --since 2026-04-01
How It Works
- Parse OpenAI/Anthropic JSON exports using bundled parsers (from sibling
chat-history-importerskill) - Deduplicate via
.processed_idsfile (skip already-processed chats) - Summarize conversation to key excerpts (to fit model context)
- Extract structured learnings using your chosen model: lessons, decisions, patterns, dead ends
- Append results to
memory/semantic/learnings-from-exports.md
Integration with chat-history-importer
This skill pairs with chat-history-importer:
- First, run
chat-history-importerto ingest raw conversations into episodic memory (memory/episodic/YYYY-MM-DD.md) - Then, run this skill to extract structured learnings into semantic memory (
memory/semantic/learnings-from-exports.md)
This workflow keeps raw conversation logs separate from actionable insights, enabling better knowledge organization.
Flags
--dir DIR— Process all JSON files in directory--file FILE— Process single file--limit N— Process only first N conversations (useful for testing or limiting API costs)--since YYYY-MM-DD— Skip conversations before this date--model MODEL— Override default model name--dry-run— Print output without writing to disk or updating dedup state
References
references/model-modes-and-categories.md— Configuration, model modes, output formatreferences/prompt-template.md— The extraction prompt sent to the modelscripts/extract.py— Main script (reuses parsers from sibling skill)
Implementation Notes
- Tracks processed chat IDs in
.processed_idsto avoid re-processing - Workspace detection: checks
OPENCLAW_WORKSPACEenv var, falls back to~/.openclaw/workspace - Automatically detects OpenAI vs Anthropic export formats
- Truncates long messages for context efficiency
