← 返回 Skills 市场
extraterrest

chat2kb

作者 extraterrest · GitHub ↗ · v0.0.4 · MIT-0
cross-platform ✓ 安全检测通过
131
总下载
0
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install chat2kb
功能描述
Convert chat conversations into structured Markdown knowledge-base files. Use when the user wants to save, capture, export, or document a conversation, inclu...
使用说明 (SKILL.md)

Chat2KB for OpenClaw

Convert chat history into clean, structured Markdown knowledge-base files.

When To Use

Use this skill when the user wants to:

  • save the current conversation as notes or KB
  • export part or all of a discussion into Markdown
  • turn a design/debug/brainstorming thread into reusable documentation
  • update a previously saved KB entry with new discussion content

If the request is ambiguous, ask one short clarification question instead of skipping the export flow.

OpenClaw Workflow

Step 1: Detect topics

Read the relevant conversation scope and identify distinct topics.

  • If the user specified a time range or topic, honor that first
  • If only one topic is present, continue directly
  • If multiple topics are present, present a numbered list
  • Support all to save each topic separately
  • Support combine to merge selected topics into one KB file

Use 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

Step 2: Check for previous export

Before generating a new file, scan the conversation for a previous conversation_id for the same topic.

  • If no previous export exists, generate a new ID
  • If a previous export exists, ask whether to update, append, or create a new KB

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)

Step 3: Extract content

For each selected topic, extract:

  • summary: 1-2 paragraph overview
  • key_points: grouped by theme, not chronology
  • code_examples: only if code was discussed
  • action_items: completed and pending items

Extraction rules:

  • preserve technical accuracy over elegance
  • group related ideas by theme
  • prefer decisions, tradeoffs, and takeaways over transcript-like detail
  • include code only when it helps future reuse
  • omit empty sections instead of leaving placeholders

Step 4: Generate Markdown

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

Action Items

  • Done item
  • Pending item

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:

  • create the directory if needed
  • use filename YYYY-MM-DD-\x3Ctopic-slug>.md
  • for incremental export use YYYY-MM-DD-\x3Ctopic-slug>-part{N}.md
  • if config dry_run: true or CHAT2KB_DRY_RUN=true, do not write the file; clearly report preview-only mode
  • if overwriting and create_backup: true, create a backup first

Slug rules

The \x3Ctopic-slug> in the filename must follow these rules:

  • lowercase alphanumeric and hyphens only
  • no leading or trailing hyphens
  • maximum 50 characters
  • derived from the conversation topic

Examples:

  • 2026-04-10-react-performance-optimization.md
  • 2026-04-10-react-performance-optimization-and-other-things.md ❌ too long
  • 2026-04-10--react.md ❌ double hyphen

Step 7: Confirm success

After writing, report:

  • saved file path
  • filename
  • conversation_id

Use 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.

Error Handling

Cannot write to folder

Cannot write to folder: /path/to/folder
Reason: directory does not exist or no write permission

Suggested fixes:

  • create the directory
  • check write permissions
  • ask the user for an alternate save location

No content found

No content to export.
Reason: no messages found in the selected time range.

Suggested fixes:

  • export the full conversation
  • widen the requested time range

File conflict

File already exists: 2026-04-10-react-optimization.md
-> A: Overwrite
-> B: Rename
-> C: Cancel
安全使用建议
This appears coherent and matches its description. Before enabling or running it: 1) set CHAT2KB_FOLDER to a directory you intend the agent to write to (or rely on ~/.chat2kb/config.yml) so files land in the right place; 2) keep CHAT2KB_DRY_RUN=true while you test so it only previews output; 3) review the preview each time before confirming save (the skill explicitly shows a preview step); and 4) inspect ~/.chat2kb/config.yml (if present) to ensure it contains only expected settings. There are no hidden network calls or secret-requesting env vars, so the main risk is accidental writing of export files to an unintended location — guard the folder and config file accordingly.
能力评估
Purpose & Capability
Name/description match what the skill asks for: it needs a target folder, dry-run and log-level flags, and two small binaries (date and openssl). date is used for timestamps and openssl is used to generate a short hex ID — both are reasonable for the stated export/ID-generation functionality.
Instruction Scope
SKILL.md confines actions to reading the conversation, optionally reading ~/.chat2kb/config.yml and the declared environment variables, generating Markdown, previewing with the user, and writing files to a user-specified folder. There are no instructions to collect unrelated files, call external endpoints, or exfiltrate data.
Install Mechanism
Instruction-only skill with no install spec and no code files; nothing is written to disk by an installer. This is low-risk and appropriate for a prose-only exporter.
Credentials
Required environment variables (CHAT2KB_FOLDER, CHAT2KB_DRY_RUN, CHAT2KB_LOG_LEVEL) and the declared config path (~/.chat2kb/config.yml) are consistent with the skill's behavior (resolving save path, dry-run behavior, logging). No unrelated credentials or secrets are requested.
Persistence & Privilege
Skill is not always-enabled and does not request elevated privileges or modify other skills. It does write user-visible KB files (expected for its purpose); users should note it will create directories and backups per the config.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install chat2kb
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /chat2kb 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.4
Fix code block visibility on ClawHub: remove text language hints so blocks render with proper contrast
v0.0.3
Add MIT license to SKILL.md frontmatter
v0.0.2
v0.0.2 - Declare required bins, env vars, and config path in metadata to fix audit mismatch
v0.0.1
Initial release - OpenClaw skill for converting conversations to structured knowledge-base files
元数据
Slug chat2kb
版本 0.0.4
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 4
常见问题

chat2kb 是什么?

Convert chat conversations into structured Markdown knowledge-base files. Use when the user wants to save, capture, export, or document a conversation, inclu... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 131 次。

如何安装 chat2kb?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install chat2kb」即可一键安装,无需额外配置。

chat2kb 是免费的吗?

是的,chat2kb 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

chat2kb 支持哪些平台?

chat2kb 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 chat2kb?

由 extraterrest(@extraterrest)开发并维护,当前版本 v0.0.4。

💬 留言讨论