Install
openclaw skills install chat-learnings-extractorExtract structured learnings (lessons, decisions, patterns, dead ends) from AI conversation exports using a local Ollama model or any OpenAI-compatible API. Pairs with chat-history-importer. Trigger phrases: extract learnings from conversations, analyze chat exports, mine conversation insights, extract lessons from chats, chat learnings extractor.
openclaw skills install chat-learnings-extractorExtract 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.
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
export OPENAI_API_KEY=sk-...
export OPENAI_BASE_URL=https://api.openai.com/v1 # optional, defaults to OpenAI
python3 scripts/extract.py --dir /path/to/exports --model gpt-4o-mini
chat-history-importer skill).processed_ids file (skip already-processed chats)memory/semantic/learnings-from-exports.mdThis skill pairs with chat-history-importer:
chat-history-importer to ingest raw conversations into episodic memory (memory/episodic/YYYY-MM-DD.md)memory/semantic/learnings-from-exports.md)This workflow keeps raw conversation logs separate from actionable insights, enabling better knowledge organization.
Prerequisites: Ollama running at http://127.0.0.1:11434 (default)
# Use default model (gemma4:26b)
python3 scripts/extract.py --dir /path/to/exports
# Use a different local model
python3 scripts/extract.py --dir /path/to/exports --model llama2
# Custom Ollama endpoint
export OLLAMA_BASE_URL=http://ollama.example.com:11434
python3 scripts/extract.py --dir /path/to/exports
Environment Variables:
OLLAMA_BASE_URL — Ollama API endpoint (default: http://127.0.0.1:11434)Any API supporting the OpenAI /chat/completions endpoint (OpenAI, Bedrock, LM Studio, etc.)
export OPENAI_API_KEY=sk-...
export OPENAI_BASE_URL=https://api.openai.com/v1 # optional
python3 scripts/extract.py --dir /path/to/exports --model gpt-4o-mini
Environment Variables:
OPENAI_API_KEY — API key (required to enable this mode; if set, OpenAI mode is used instead of Ollama)OPENAI_BASE_URL — API base URL (default: https://api.openai.com/v1)Model auto-selection:
OPENAI_API_KEY is set → defaults to gpt-4o-miniOPENAI_API_KEY is not set → defaults to gemma4:26b (Ollama)--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 stateResults are appended to memory/semantic/learnings-from-exports.md with this structure:
## Chat Title (YYYY-MM-DD)
### Lessons Learned
- [bullet points]
### Decisions Made
- [bullet points]
### Patterns Noticed
- [bullet points]
### Dead Ends
- [bullet points]
Each category is optional — if a conversation doesn't have notable insights for a category, it will show "None".
references/prompt-template.md — The extraction prompt sent to the modelscripts/extract.py — Main script (reuses parsers from sibling skill).processed_ids to avoid re-processingOPENCLAW_WORKSPACE env var, falls back to ~/.openclaw/workspace