Install
openclaw skills install @extraterrest/chat2kbConvert chat conversations into structured Markdown knowledge-base files. Use when the user wants to save, capture, export, or document a conversation, including requests like "save this conversation", "export our discussion", "generate KB", "turn this into notes", "保存对话", "生成知识库", "转成KB", or "导出笔记".
openclaw skills install @extraterrest/chat2kbConvert chat history into clean, structured Markdown knowledge-base files.
Use this skill when the user wants to:
If the request is ambiguous, ask one short clarification question instead of skipping the export flow.
Read the relevant conversation scope and identify distinct topics.
all to save each topic separatelycombine to merge selected topics into one KB fileUse this format when multiple topics are found:
Detected 3 topics:
1. [Title]
[One-sentence summary]
2. [Title]
[One-sentence summary]
3. [Title]
[One-sentence summary]
Which topics would you like to save?
-> Enter numbers, e.g. 1,3
-> Enter all
-> Enter combine
Before generating a new file, scan the conversation for a previous conversation_id for the same topic.
Conversation ID format:
kb_{YYYYMMDD}_{HHMMSS}_{6hex}
Example: kb_20260410_143052_a7c9e2
Generation:
CONVERSATION_ID="kb_$(date +%Y%m%d_%H%M%S)_$(openssl rand -hex 3)"
Use this prompt when a previous export exists:
Found a previous KB for this topic (ID: kb_20260410_143052_a7c9e2)
-> A: Update (regenerate the full KB with all content)
-> B: Append (export only content added since last save)
-> C: New (ignore previous KB, create an independent one)
For each selected topic, extract:
summary: 1-2 paragraph overviewkey_points: grouped by theme, not chronologycode_examples: only if code was discussedaction_items: completed and pending itemsExtraction rules:
Use this structure:
---
conversation_id: kb_20260410_143052_a7c9e2
created_at: YYYY-MM-DDTHH:MM:SSZ
updated_at: YYYY-MM-DDTHH:MM:SSZ
export_type: full
topics: [tag1, tag2]
language: en
participants: [User, Assistant]
platform: openclaw
word_count: 342
---
# [Topic Title]
**Date**: YYYY-MM-DD
## Summary
[1-2 paragraphs]
## Key Points
### [Theme 1]
- insight
- detail
### [Theme 2]
- insight
## Code Examples
```language
// code
Rules:
- group by theme, not chronology
- use bullet points in `Key Points`
- omit `Code Examples` if no code was discussed
- omit `Action Items` if none exist
- do not include a full transcript
- set `word_count` to the total number of words in the body (excluding frontmatter)
### Step 5: Preview before writing
Always show the generated Markdown before writing the file.
Use this preview structure:
Preview (not saved yet)
[full Markdown content]
Will save to: /path/to/YYYY-MM-DD-topic-slug.md
-> Y Save -> E Edit summary -> N Cancel
If the user chooses `E`, accept the revised summary, regenerate the preview, and ask again.
### Step 6: Resolve save path and write
Resolve the save path in this order:
1. `~/.chat2kb/config.yml`
2. `CHAT2KB_FOLDER`
3. ask the user
Config file example:
```yaml
kb_folder: ~/Documents/KnowledgeBase
dry_run: false
create_backup: true
log_level: info
Environment overrides:
| Variable | Purpose |
|---|---|
CHAT2KB_FOLDER | KB save location |
CHAT2KB_DRY_RUN | true = preview only |
CHAT2KB_LOG_LEVEL | Logging verbosity |
Write behavior:
YYYY-MM-DD-<topic-slug>.mdYYYY-MM-DD-<topic-slug>-part{N}.mddry_run: true or CHAT2KB_DRY_RUN=true, do not write the file; clearly report preview-only modecreate_backup: true, create a backup firstThe <topic-slug> in the filename must follow these rules:
Examples:
2026-04-10-react-performance-optimization.md ✅2026-04-10-react-performance-optimization-and-other-things.md ❌ too long2026-04-10--react.md ❌ double hyphenAfter writing, report:
conversation_idUse this format:
Knowledge base saved!
Location: /absolute/path/to/2026-04-10-react-optimization.md
ID: kb_20260410_143052_a7c9e2
If running in dry-run mode, say so explicitly:
Dry run complete — preview generated, no file written.
Cannot write to folder: /path/to/folder
Reason: directory does not exist or no write permission
Suggested fixes:
No content to export.
Reason: no messages found in the selected time range.
Suggested fixes:
File already exists: 2026-04-10-react-optimization.md
-> A: Overwrite
-> B: Rename
-> C: Cancel