Tools
Agent Knowledge Database
Evidence-grounded internal document ingestion and retrieval plugin for OpenClaw
Install
npm install
npm
README
# OpenClaw Internal Knowledge Base
A native OpenClaw plugin that automatically ingests documents received through Telegram, Mattermost, and other attachment-capable channels. It keeps immutable originals, converts content to provenance-marked Markdown, builds a local SQLite FTS index, and gives the agent retrieval tools that require exact source citations.
## Supported formats
- PDF, including OCR fallback for scanned pages
- DOCX
- PPTX
- XLSX
- HTML
- Markdown and plain text
- PNG, JPEG, TIFF, and WebP through OCR
PDFs cite original pages, presentations cite slides, DOCX files cite heading/paragraph blocks, spreadsheets cite sheet/cell ranges, and text formats cite line ranges.
## Install
OpenClaw 2026.7.1-2 requires Node 22.22.3+, Node 24.15+, or Node 25.9+.
```bash
npm install
npm run plugin:build
npm run plugin:validate
npm pack
openclaw plugins install npm-pack:./company-openclaw-internal-knowledge-base-0.1.0.tgz --force
openclaw gateway restart
openclaw plugins inspect internal-knowledge-base --runtime --json
```
OpenClaw's `plugins validate --entry` command is only for packages created with `defineToolPlugin`; this plugin intentionally combines typed hooks and tools. `npm run plugin:validate` therefore runs its TypeScript and test validation, while `plugins inspect --runtime` is the authoritative OpenClaw mixed-plugin registration check.
For development, `openclaw plugins install --link .` can be used before the final packed-install proof.
## Configure
The default vault is `~/.openclaw/internal-knowledge-base`. Example `openclaw.json` entry:
```json5
{
plugins: {
entries: {
"internal-knowledge-base": {
enabled: true,
config: {
vaultPath: "~/.openclaw/internal-knowledge-base",
maxFileBytes: 52428800,
maxPages: 500,
maxSpreadsheetCells: 200000,
concurrency: 1,
ocr: { enabled: true, languages: ["eng"] }
}
}
}
}
}
```
Enable OpenClaw progress drafts on each channel where verbose live status is desired:
```json5
{
channels: {
telegram: { streaming: { mode: "progress" } },
mattermost: { streaming: { mode: "progress" } }
}
}
```
The generated Markdown vault can optionally participate in OpenClaw 2026.7.1-2's
hybrid memory search. In this release, memory search belongs under
`agents.defaults.memorySearch` (or an individual agent's `memorySearch`), not
under `memory.search`:
```json5
{
agents: {
defaults: {
memorySearch: {
extraPaths: ["~/.openclaw/internal-knowledge-base/documents"]
}
}
}
}
```
After changing the configuration, rebuild the memory index for the agent that
should search the vault:
```bash
openclaw memory status --deep --agent main
openclaw memory index --force --agent main
```
The plugin's `internal_docs_read` tool remains the authoritative citation source.
## Grounding contract
The bundled skill requires a search/read/refine loop. Answers must name the original document, exact locator, and a supporting snippet. When retrieved passages do not support an answer, the agent must say that the knowledge base contains insufficient evidence. Uploaded content is always treated as untrusted data, never executable instructions.
## Storage layout
```text
~/.openclaw/internal-knowledge-base/
├── originals/<sha256>/<original-name>
├── documents/<document-id>/v<number>.md
└── index.sqlite
```
Byte-identical uploads reuse the existing version. Changed files with the same normalized filename create a new logical version. V1 intentionally provides ingestion and query only; removal and ACL management are outside its scope.
tools
Comments
Sign in to leave a comment