# Knowledge Base

> Personal knowledge base manager. Processes inbox files (PDF, MD, DOCX, RTF, TXT, HTML, PNG, URL), extracts metadata, renames with citation conventions, generates summaries, maintains a generated searchable index, answers questions grounded in indexed sources, performs full-text keyword search, reports corpus health, moves pipeline output into topic folders, and builds slide decks from indexed or…

- **Type:** Skill
- **Install:** `agentstack add skill-ai-business-tools-claude-code-knowledge-base`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [AI-Business-Tools](https://agentstack.voostack.com/s/ai-business-tools)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [AI-Business-Tools](https://github.com/AI-Business-Tools)
- **Source:** https://github.com/AI-Business-Tools/claude-code/tree/main/skills/knowledge-base

## Install

```sh
agentstack add skill-ai-business-tools-claude-code-knowledge-base
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Knowledge Base Manager

## Knowledge Base Location

**Edit the path on the line below to match where your knowledge base lives.** That line is the single place the root is configured; this skill reads no environment variable for it, and there is nothing else to set.

```
~/knowledge-base/
```

Written as `` where a placeholder reads more clearly. All paths in this skill are relative to this root unless otherwise specified.

**The only deletion this skill performs is the split folder that Mode 1 Step 4a removes.** The `rm` entry in `allowed-tools` is scoped to exactly that path shape (`*_build/split_*`) and grants nothing broader; every other cleanup is a `mv`.

## Directory Structure

The knowledge base supports two document storage patterns:

### Pattern A: Per-document subfolder (default for all filing)

Every filed document gets its own subfolder containing the source, text extraction, summary, and any slides or build artifacts. This is the default for inbox processing (Mode 1), `kb move` (Mode 3), and the content-skill pipelines that write into the knowledge base.

```
knowledge-base/
├── AI-articles/
│   ├── 2026-01-28 Payrolls to Prompts.../     /*_summary.md` (flat) and `/*/*_summary.md` (subfolder). Also check for `_text.md` files as the engagement artifact.
- The `aa-inbox/` folder is the ingestion point for new unprocessed content.
- Summary or slides skills can run directly in topic folders; they do not need to go through inbox.
- Topic folders are created by the user; the skill suggests but does not create them without approval.

## Helper commands

This skill delegates its mechanical work to small scripts you supply, so that no step depends on a model remembering to do bookkeeping. Wire each one behind the name used throughout this skill; any implementation meeting the contract works. Each is deterministic and costs no model time.

| Command | Contract | If you have not built it |
|---|---|---|
| `kb-index` | Walk the knowledge base and regenerate `index.md` from every `_summary.md`'s frontmatter. Atomic write, guarded by a count floor so a partial walk cannot truncate the index. Prints warnings (missing frontmatter, topic drift, invalid date, duplicate rows). | Claude regenerates the WHOLE table from frontmatter (see below). |
| `kb-search search ` | Ranked full-text hits over `_summary.md` and `_text.md` bodies. See Mode 4. | `grep -ril` over the same files. Cannot rank and cannot filter; say so. |
| `kb-search reindex [--incremental]` | Rebuild the full-text index from current content. | Nothing to rebuild: with no index, `kb search` is the `grep` fallback every time. Skip the step silently. |
| `kb-dup-check "" [--url ]` | Duplicate check on a prospective filename stem. Prints and exits `OK` (0), `DUP` (1), `NEAR` (2), or `ERROR` (3). | Targeted `grep index.md` on the stem, and on the URL when known (see below). No fuzzy `NEAR`. |
| `kb-status` | One-screen corpus health readout. See Mode 6. | Partial: the counts below run, drift and full-text freshness do not. See Mode 6. |
| `kb-recents` | Rebuild the `aa-recents/` symlink folder. See Mode 1 Step 5. | Skip the rebuild and say so once per run. `aa-recents/` is a browse view; nothing reads it. |
| `kb-fetch-url  --out ` | Mechanically capture a web page to a file and print its metadata. Exit codes are contract; see Mode 1 Step 1. | Fetch with the built-in web fetch tool and save the returned text VERBATIM (see below). |

**These fallbacks are real and named at each call site, with two exceptions stated plainly here rather than left to be discovered.** They are slower and less exact than the scripts, and each carries a caveat worth reading before you rely on it.

- **`kb-index`: regenerate, never hand-edit.** The fallback is Claude walking every `_summary.md` and rendering the entire table from their frontmatter, exactly as the script would, then writing `index.md` in one pass. **That is generation, and it is the correct fallback.** What "generated and never hand-edited" forbids is different: opening `index.md` and changing, adding, or deleting an individual row, which makes that row disagree with the summary nothing knows was edited. The test is whether the whole file was rebuilt from the summaries (allowed) or one row was touched in place (never). To change a row either way, edit the item's frontmatter and regenerate.
- **`kb-dup-check`: a targeted `grep`, which is not the read the prohibition forbids.** Run `grep -i -F "" index.md`, and `grep -i -F "" index.md` as well when the item's URL is known. A hit is a `DUP` (show the matched row), no hit is an `OK`, and a grep that cannot run, because `index.md` is missing or unreadable, is an `ERROR`. There is no fallback for `NEAR`: fuzzy matching needs the script, so a knowledge base without it detects exact duplicates and not near ones, which is worth saying once in the run report. **The rule "never eyeball-compare against a whole-file `index.md` read" bans reading the index into context and judging by eye; a `grep` for one stem reads one line back and is the sanctioned substitute.**
- **`kb-fetch-url`: fetch mechanically, and never write the body yourself.** With no script, fetch the page with the built-in web fetch tool and save what it returns to the output path verbatim, then add the `extract_note:` disclosure Mode 1 Step 1 requires for any non-script capture. **Saving retrieved text verbatim is legal. Composing the source's body is not, and no absence of a script authorizes it:** writing prose assembled from search results into the source file is the one thing `references/inbox.md` prohibits outright, because downstream skills read that file as the publication. Without the script you also lose the exit code that sets `source_basis` mechanically, so set it by the rules in Mode 1 Step 1 instead: `partial` when what came back is visibly a fragment, `excerpts` only on a reconstruction after nothing could be captured, and absent otherwise.
- **`kb-status`: partial, and Mode 6 says which half is missing.** Inbox backlog counts and an index row count run without it; index-versus-full-text drift and full-text freshness do not, because both compare against a database the script owns.
- **`kb-recents`: no fallback, and no consequence.** Building the symlink set by hand is not worth the steps. Skip the rebuild, note it once in the run report, and leave `aa-recents/` as it is. Every other reader (the index, search, and Q&A) walks topic folders directly.

## Modes

**Index-first gate (lookups and membership questions).** Any request to find, locate, recall, or check whether something is in the knowledge base (whether phrased as `kb ask`, `kb search`, "is X in my kb?", "what do I have on X?", or an informal question) MUST begin by consulting the index before reading or scanning topic folders directly. Run `kb search `, and `grep index.md`. Direct folder browsing is a fallback only, used after the index returns nothing relevant. Never answer a lookup from a folder scan you ran before checking the index.

**Read exactly one mode file.** The modes are mutually exclusive on any one run. Read this file plus the row that matches the invocation, and **do not read the other mode files**; they describe work this run is not doing.

| Invocation | Mode | Read |
|---|---|---|
| `kb`, `process inbox` | 1. Process Inbox | `references/inbox.md` |
| `kb ask ` | 2. Q&A | `references/qa.md` |
| `kb move  `, "file this in ``" | 3. Move Project | `references/move.md` |
| `kb search `, `kb find ` | 4. Search | inline below |
| `kb slides `, `slides from kb`, `build slides from` | 5. Slides | `references/slides.md` |
| `kb slides  headless`, `mode=headless` | 5. Slides, headless | `references/slides.md`, then `references/slides-headless.md` |
| `kb status`, `kb health` | 6. Status | inline below |

**Mode 5 is the one mode that may need a second mode file.** Its Step 2 file-first cases invoke Mode 1, and its file-after step invokes Mode 3; `references/slides.md` states at each point whether to open `references/inbox.md` or `references/move.md`, and when not to. No other mode opens a second file.

### 1. Process Inbox (`/kb` or "process inbox"): read `references/inbox.md`

Mode 1 lives in **`references/inbox.md`**: the processing levels and the companion-`.txt` convention, the agent-per-item architecture and its Flow, the subagent model and effort table, Step 1 (file-type routing, the visual-content check, the source-fetch failure rule), Step 4 (`_text.md` and the summary), Step 5 (filing, the index, `aa-recents/`, the search refresh, the report and rate-usage formats), Correcting a filing, and Blog Post Processing.

On any inbox invocation, **read `references/inbox.md` now and follow it in full.** Every reference elsewhere in this skill to a Mode 1 step, to the Flow, to Correcting a filing, or to Blog Post Processing resolves into that file, except three blocks held here because more than one mode needs them: Citation metadata and naming (below), The frontmatter block (below), and Index Format. **In Mode 5, read it only where `references/slides.md` Step 2 says to. Skip it entirely in Modes 2, 3, 4, and 6.**

### 2. Q&A (`/kb ask [question]` or "kb ask"): read `references/qa.md`

Mode 2 lives in **`references/qa.md`**: the mandatory index-first consult, source selection including the `materials/` markdown rule, answer synthesis and its citation and provenance requirements, and the optional save-the-answer step. On a `kb ask` invocation, **read `references/qa.md` now and follow it in full.** It writes the frontmatter block held in this file, not a copy of its own. **Skip it in every other mode.**

### 3. Move Project (`kb move  `): read `references/move.md`

Mode 3 lives in **`references/move.md`**: the `materials/` refusal, Step 1 (inventory and the artifact pattern table), Step 2 (always Pattern A), Step 3 (renaming and the pre-move duplicate check), Step 4 (the move and its verification), and Step 5 (index, recents, and search refresh). On a `kb move` invocation, **read `references/move.md` now and follow it in full.** Mode 5's file-after step invokes its Steps 3 to 5 and says so at that point. **Skip it in Modes 1, 2, 4, and 6.**

### 4. Search (`kb search `)

Keyword search over the full body of every indexed `_summary.md` and `_text.md`. Use this when the question is "find me everything that touches X" rather than "answer this question." Q&A synthesis is not invoked.

**Triggers:** `kb search `, `kb find `, `search kb for `.

Run:

```bash
kb-search search 
```

Optional filters: `--since YYYY[-MM[-DD]]` (items dated on or after; a partial stored date matches as its earliest day, undated items drop out), `--type `, `--source ` (topic folder name). **`--type` takes the values of the `type:` frontmatter field and no others: `paper`, `article`, `web`, `doc`, `blog`, `podcast`, `video`, `report`** (the enum is defined once, under The frontmatter block). `qa-answer` is deliberately not a filter value: those artifacts are `_notes.md` files, never walked by the index generator or the reindexer, so no stored row carries that type. A `grep` fallback cannot filter; with filters active, say so rather than returning unfiltered rows as though they were filtered.

The reference implementation is a local SQLite FTS5 index built from every `_summary.md` and `_text.md` and queried with BM25 ranking; any equivalent full-text indexer works. **Without one, the fallback is `grep -ril "" /*/*_summary.md /*/*/*_summary.md`** (add the matching `_text.md` globs to search extractions too). It returns unranked, unfiltered, exact-substring matches, so report it as what it is rather than presenting its output as ranked hits. Each hit from a real index prints date, topic, author, title, type, score, summary and body snippets with the matched terms in `[brackets]`, and the absolute path to the source file.

Relay the ranked output to the user verbatim, plus a one-line interpretation if the top hit is unobvious. Do not synthesize an answer from the snippets; that is `kb ask`'s job.

**When the index is empty or stale:** if the search reports no results and the query terms are common, suggest a full `kb-search reindex` to rebuild from current source content. The rebuild completes in well under a minute at a few hundred documents and costs no model time.

**The index is authoritative; the full-text database is not.** `index.md` is the complete, generated inventory of every document. The full-text database is a derived accelerator that covers only a subset of the corpus: it skips `$`-, `_`-, and `.`-prefixed folders, `*_build`, and `materials/`. A document can be fully catalogued in `index.md` yet absent from the full-text index. Treat a `kb search` miss as "not in the full-text index," never as "not in the knowledge base."

**Membership questions ("is X in the kb?") must consult `index.md` directly.** Before concluding any document is absent, `grep index.md` for the title, author surname, or concept terms. A reindex should also ingest `index.md` itself as a backstop row, so a catalogued term normally surfaces there even when no per-document hit exists; the authoritative check, though, is the `index.md` grep, not the full-text result.

### 5. Slides (`kb slides  [beamer] [deck] [lite] [structure=...] [register=...] [plan=...]`): read `references/slides.md`

**The default builds a compiled Beamer PDF through [slides-content](../slides-content/), which runs [beamer](../beamer/).** Both ship alongside this skill, so `kb slides ` works on a fresh install with nothing wired and no tokens typed. `beamer` names that same route explicitly.

**`deck` and `lite` are an optional upgrade and need a native PowerPoint generator you supply; none ships here.** Until you replace the `` placeholder in `references/slides.md` Step 4 with your own generator's skill name, both tokens are refused with a message naming the two ways out, rather than failing partway through a build. The same holds for `headless`, which needs an unattended entry point you supply (`references/slides-headless.md`).

Mode 5 lives in **`references/slides.md`**: generator and tier selection, the optional deck generator and its gate, the outside-source move confirmation, the slide-path model pin, Step 1 (resolve the target), Step 2 (the lite gate and the Case A, B, and C file-first logic with the reuse bar and the grandfather sentinel), Step 3 (existing-slides check), Step 4 (generator handoff and the provenance gate), and Step 5 (post-build sync, the file-after step, and the post-build assertion).

On any slides invocation, **read `references/slides.md` now and follow it in full.** Every reference elsewhere in this skill to Mode 5, to the reuse bar, or to the slide-path model pin resolves into that file. **Skip it in Modes 1, 2, 3, 4, and 6.**

**Headless** (`kb slides  headless`, `mode=headless`, or any unattended caller) applies seven overrides to those same Steps 1 to 5; they live in **`references/slides-headless.md`**. Read it after `references/slides.md` when, and only when, the `headless` token is present. **Skip it on every interactive run.**

### 6. Status (`kb status`)

One-screen health readout: index-versus-full-text row drift, full-text freshness and integrity and whether the last build was full or incremental, and inbox backlog counts (`aa-inbox/`, `aa-blog/`, `aa-slides-inbox/`). Read-only; no content reads, no disk walk.

**Triggers:** `kb status`, `kb health`.

Run:

```bash
kb-status
```

**Without the `kb-status` script, Mode 6 runs at half strength and says so.** Two of its four readouts are plain counts and still run: the inbox backlogs (`ls aa-inbox/ | wc -l`, and the same for `aa-blog/` and `aa-slides-inbox/` where they exist) and the index row count (`grep -c '^| ' index.md`, minus the header rows). The other two, index-versus-full-text drift and full-text freshness and integrity, compare against a database the script owns and **cannot be produced by hand: repor

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [AI-Business-Tools](https://github.com/AI-Business-Tools)
- **Source:** [AI-Business-Tools/claude-code](https://github.com/AI-Business-Tools/claude-code)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-ai-business-tools-claude-code-knowledge-base
- Seller: https://agentstack.voostack.com/s/ai-business-tools
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
