Install
openclaw skills install knowledge-brainCapture, summarize, and organize knowledge from URLs, YouTube videos, documents, and files. Proactively recall stored knowledge when relevant.
openclaw skills install knowledge-brainManage a personal knowledge base that extracts content from artifacts, generates summaries, and organizes entries into fluid categories.
When to activate this skill:
Explicit knowledge operations: the user says "save this", "add to knowledge", "capture this article", "summarize this video", "sort knowledge", "organize categories", "import knowledge", etc.
Proactive recall: the user asks about ANY topic where the knowledge base might have relevant entries. This includes general questions like "what's a good workout routine", "how should I approach this design problem", "what do I know about sleep training", etc. When in doubt, check the knowledge base -- it is an extension of memory. Search it whenever the user's question touches a topic that could plausibly have been captured previously.
The knowledge base path is not hardcoded. On first invocation:
~/Documents/knowledge/ or a sensible default.The agent's persistent memory should contain a lightweight index of the knowledge base so that category awareness is always in context — even before this skill is activated. This is what makes proactive recall possible.
After any operation that changes the knowledge base structure (adding entries, sorting, creating/splitting/merging/renaming categories), update the index in agent memory. The index should look approximately like this:
## Knowledge Base
Path: ~/Documents/knowledge/
Categories:
- fitness: exercise routines, nutrition, recovery
- parenting: child development, sleep training, education approaches
- software-design: architecture patterns, API design, system modeling
- industrial-design: product design, materials, manufacturing
Unsorted: 3 entries
Keep the index under ~20 lines. Update it immediately after any structural change.
{descriptive-slug}--{YYYY-MM-DD}.md
{knowledge-base-path}/
README.md
CHANGELOG.md
unsorted/
raw/
summary/
{category}/
_category.md
raw/
summary/
Category directories are created on demand when knowledge is sorted into them.
On first invocation:
README.md does not exist at the knowledge base path, create:
README.md (see README Template below)CHANGELOG.md with an initial entryunsorted/raw/ and unsorted/summary/ directories (use mkdir -p via Bash)If git is available and the knowledge base directory is not already a git repository, initialize one (git init). The knowledge base benefits from version control — it provides history for category reorganizations, a safety net for bulk imports, and makes it easy to sync across machines.
After meaningful operations (adding knowledge, sorting, reorganizing), commit the changes with a short descriptive message. Keep commits atomic: one commit per logical operation rather than batching unrelated changes. Do not push unless the user has configured a remote and asks to push.
---
title: "{Human-readable title}"
source: "{URL, file path, or description of origin}"
---
{Full extracted content. Preserve original structure where possible.}
The filename carries the ID and date ({slug}--{YYYY-MM-DD}.md). No need to duplicate them in frontmatter.
Rules:
[HH:MM:SS] timestamps at paragraph boundaries.---
title: "{Human-readable title}"
source: "{URL, file path, or description of origin}"
---
## Summary
{2-4 paragraphs capturing the main ideas, arguments, or content.
Write in plain, direct prose.}
## Key Points
- {Bullet point}
## Takeaways
{1-2 sentences on why this matters or how it connects to broader themes.}
The filename carries the ID and date. The corresponding raw file is always at ../raw/{same-filename}. Category directories and descriptive filenames provide the semantic structure — no tags needed.
Rules:
---
category: {category-slug}
description: "{One-sentence scope definition}"
---
## {Category Name}
{1-3 sentences defining what belongs in this category and what does not.
Be specific enough to resolve ambiguity when sorting.}
## Notes
{Optional guidance on navigating this category, notable themes,
or conventions specific to this domain.}
# Knowledge Base Changelog
## YYYY-MM-DD
### Added
- [{id}] "{title}" from {source_type} -- placed in `{category}/`
### Moved
- [{id}] moved from `{old-category}/` to `{new-category}/`
### Categories
- Created `{category-name}`: {description}
- Renamed `{old-name}` to `{new-name}`
- Split `{old-name}` into `{new-name-1}` and `{new-name-2}`
- Merged `{name-1}` and `{name-2}` into `{new-name}`
Group entries under the current date heading. If today's heading exists, append to it.
When the user provides a URL, YouTube link, file path, or content to capture:
Step 1: Detect source type.
youtube.com/watch, youtu.be/, or youtube.com/shorts/http:// or https://Step 2: Extract raw content.
| Source | Method |
|---|---|
| URL | WebFetch(url, "Extract the main article content of this page as plain text") |
| YouTube | Bash: yt-dlp --write-auto-sub --sub-lang "en" --skip-download --print title --print description -o "/tmp/yt-%(id)s" "{url}" then Read the .vtt file and clean it (see transcript cleaning below) |
| Local file | Read(filepath) |
| Audio | Bash: whisper "{path}" --output_format txt if available; otherwise note as placeholder |
| Pasted text | Use directly |
YouTube transcript cleaning:
WEBVTT, Kind:, Language:)XX:XX:XX.XXX --> XX:XX:XX.XXX)[HH:MM:SS] markers approximately every 60 seconds as paragraph breaks/tmp/Step 3: Generate descriptive slug. Read the extracted content and produce a 3-6 word lowercase hyphenated slug. Examples:
deep-work-productivity-strategies--2026-02-27react-server-components-explained--2026-02-27infant-sleep-training-methods--2026-02-27Step 4: Check for duplicates. Grep across **/raw/*.md for the source URL in frontmatter. If found, warn the user and ask whether to overwrite or create a suffixed version.
Step 5: Determine placement. Consult the knowledge index in agent memory. If an existing category is an obvious fit for this content (e.g., a workout video clearly belongs in fitness), place it directly in that category. If the fit is ambiguous or no category matches, place it in unsorted/. When in doubt, use unsorted/.
Step 6: Write the raw file to {target}/raw/{slug}--{date}.md where {target} is either the chosen category or unsorted. Create the directory with mkdir -p if needed.
Step 7: Generate the summary. Read the full raw content. Produce a summary following the template above.
Step 8: Write the summary file to {target}/summary/{slug}--{date}.md.
Step 9: Extract book references. Scan the raw content and summary for mentions of books — titles, authors, "in his book...", "as described in...", ISBN references, etc. For each book found, append it to books-to-read.md at the knowledge base root (see Books to Read below). If the book is already listed, add this artifact's ID to its "Referenced By" column instead of creating a duplicate.
Step 10: Update CHANGELOG.md. Append an "Added" entry under today's date.
Step 11: Update the knowledge index in agent memory. If a new category was created or the unsorted count changed, update the index immediately.
Step 12: Report to the user. Display the title, source, summary key points, file locations, the category it was placed in (or note that it's in unsorted/ and suggest sorting), and any books that were extracted.
When the user asks to sort knowledge or after adding new knowledge:
Enumerate unsorted entries. Glob unsorted/summary/*.md. Read frontmatter for titles.
Enumerate existing categories. Glob */_category.md (excluding unsorted/). Read each for scope.
Propose categorization. For each unsorted entry:
Confirm with the user via AskUserQuestion. Present proposed moves as a list. Wait for confirmation.
Execute moves. For each entry:
a. Create target category directory structure if needed (mkdir -p {category}/raw {category}/summary).
b. Write _category.md if this is a new category.
c. Move raw file: Bash mv unsorted/raw/{filename} {category}/raw/{filename}.
d. Move summary file: Bash mv unsorted/summary/{filename} {category}/summary/{filename}.
Update CHANGELOG.md. Record moves and new categories.
Update the knowledge index in agent memory. Reflect any new categories and the updated unsorted count.
Report to the user.
Always confirm with the user before executing any reorganization.
_category.md files.mv.rm -r after confirming it is empty.-2 suffix to both raw and summary filenames._category.md.mv._category.md frontmatter.When the user asks a question, references a topic, or requests context that the knowledge base may contain:
Consult the knowledge index. The memory index lists all categories with brief descriptions. Use it to identify which categories are likely relevant to the query. This narrows the search before touching any files.
Locate relevant entries. Using whatever search capabilities the agent has:
summary/ directories for keywords related to the query._category.md files for the relevant categories and follow their notes.Load into working context. Read the relevant summary files fully. If deeper detail is needed, read the corresponding raw file at ../raw/{same-filename}. The goal is to internalize the knowledge — absorb it into the current conversation context, embedding, or working memory so it informs subsequent responses.
Synthesize across entries. When multiple entries are relevant, connect them. Surface patterns, contradictions, or complementary perspectives across the loaded knowledge.
Cite sources. When drawing on loaded knowledge, reference the entry by title and ID so the user can trace back to the original artifact.
Proactive recall. When the knowledge index shows a relevant category exists, load and reference it without being asked. The knowledge base is an extension of memory — if relevant knowledge is there, use it.
When the user points to an existing directory, collection of files, or structured knowledge source to onboard into the knowledge base:
Scan the source. Use Glob and Read to inventory the source directory or file list. Identify:
Present a migration plan. Before touching anything, report:
Process each file. For each importable file:
a. Read the content.
b. If the file already has structured metadata (YAML frontmatter, title, date), preserve and adapt it to the knowledge base format.
c. If the file is unstructured, infer a title from the filename or first heading, and use the file's modification date as the captured date.
d. Write the raw file using the standard template and naming convention.
e. Generate a summary following the standard template.
f. Place files according to the migration plan — either into a mapped category or into unsorted/.
Preserve source structure as categories. If the source has meaningful subdirectories:
_category.md files with descriptions inferred from the directory name and contents.unsorted/ for manual sorting later.Verify placement. After all files are imported, confirm entries are in appropriate categories.
Update CHANGELOG.md. Record the import as a batch operation:
### Imported
- Imported {count} entries from `{source_path}`
- Categories created: {list}
- Entries placed in unsorted: {count}
Update the knowledge index in agent memory. Reflect all new categories and updated entry counts.
Report to the user. Summarize what was imported, where it landed, and flag anything that needs manual attention (duplicates, unprocessable files, ambiguous categorization).
Rules:
After completing any ability that writes or moves files (Abilities 1, 2, 3, 5), commit the changes to git if the knowledge base is a git repository. Use a short descriptive message. One commit per logical operation.
Suggest but never execute without user confirmation.
unsorted/ share a common theme not covered by existing categories._category.md description has become overly broad.After adding knowledge, briefly note if reorganization might be warranted. Example: "Note: unsorted/ now has 5 entries about cooking. Consider creating a cooking category."
Before creating a new raw file, check if a file with the same filename already exists anywhere (Glob **/raw/{slug}--{date}.md). If so, warn the user and ask whether to overwrite or suffix.
If two artifacts about similar topics are captured on the same day and produce the same slug, append a numeric suffix: {slug}-2--{date}.md.
When the last entry leaves a category, ask the user whether to delete the empty category or keep it for future use.
A flat index file at the knowledge base root that automatically captures book references found in any processed artifact.
books-to-read.md# Books to Read
| Title | Author | Referenced By | Date Added |
|-------|--------|---------------|------------|
| Deep Work | Cal Newport | deep-work-productivity--2026-02-27 | 2026-02-27 |
| Atomic Habits | James Clear | habit-stacking-overview--2026-02-27, morning-routine-video--2026-02-28 | 2026-02-28 |
—.On first-run, generate a brief README.md explaining the directory structure, file naming convention ({slug}--{date}.md), and basic usage (add, sort, reorganize, search, browse).