← Back to Plugins
Tools

Plugin Wiki Memory

h104651 By h104651 👁 28 views ▲ 0 votes

OpenClaw memory plugin backed by a Markdown-based LLM Wiki with hybrid semantic search (embedding + FTS). Fail-open by design.

GitHub

Configuration Example

{
     "plugins": {
       "slots": {
         "memory": "astor-wiki-memory"
       },
       "allow": ["astor-wiki-memory"],
       "load": {
         "paths": ["/path/to/openclaw-plugin-wiki-memory"],
         "allowFail": true
       }
     }
   }

README

# openclaw-plugin-wiki-memory

OpenClaw memory plugin backed by a **Markdown-based LLM Wiki** with hybrid semantic search (embedding + FTS).

Thin adapter that delegates to the [`astor-wiki-memory`](https://github.com/h104651/astor-wiki-memory) CLI tool. Fail-open by design: if the CLI or index is unavailable, the plugin returns a graceful fallback instead of blocking the agent.

## Features

- **Human-readable memory** โ€” every memory is a Markdown file in your wiki. No binary lock-in, no proprietary format.
- **Hybrid search** โ€” embedding + FTS score fusion for relevant recall.
- **Fail-open** โ€” CLI errors, missing index, or tool unavailability won't break the agent.
- **Post-write auto-index** โ€” optional `autoIndexAfterWrite` re-indexes after each write so new memories are immediately searchable.
- **10 tools** โ€” `memory_recall`, `wiki_recall`, `wiki_get`, `memory_store`, `wiki_crystallize`, `memory_update`, `memory_forget`, `wiki_index_update`, `memory_stats`, `wiki_stats`.

## Prerequisites

- **Node.js 20+** (ESM)
- **OpenClaw** (tested with v0.6+)
- **`astor-wiki-memory` CLI** โ€” the binary that does the actual indexing and search.  
  Install from [h104651/astor-wiki-memory](https://github.com/h104651/astor-wiki-memory) or build from source.
- **LLM Wiki** โ€” a directory of Markdown files. See the wiki repo for setup.

## Installation

1. **Install the CLI** (see upstream README).
2. **Clone this plugin** into your OpenClaw workspace:
   ```bash
   cd /path/to/your/openclaw/workspace
   git clone https://github.com/h104651/openclaw-plugin-wiki-memory.git
   ```
3. **Add to `openclaw.json`**:
   ```json
   {
     "plugins": {
       "slots": {
         "memory": "astor-wiki-memory"
       },
       "allow": ["astor-wiki-memory"],
       "load": {
         "paths": ["/path/to/openclaw-plugin-wiki-memory"],
         "allowFail": true
       }
     }
   }
   ```
4. **(Optional) Configure the CLI path** โ€” if `astor-wiki-memory` is not at `/usr/local/bin/astor-wiki-memory`:
   ```json
   {
     "plugins": {
       "config": {
         "astor-wiki-memory": {
           "cliPath": "/custom/path/astor-wiki-memory",
           "autoIndexAfterWrite": true
         }
       }
     }
   }
   ```

## Available Tools

| Tool | Description |
|------|-------------|
| `memory_recall` | Hybrid semantic search of the wiki (embedding + FTS). |
| `wiki_recall` | Same as above, strict token budget variant. |
| `wiki_get` | Retrieve a single chunk by ID (from recall results). |
| `memory_store` | Write a new memory page via Markdown. Triggers auto-index if enabled. |
| `wiki_crystallize` | Same as `memory_store` with wiki-centric naming. |
| `memory_update` | Write a superseding/corrected memory. |
| `memory_forget` | Safe guard โ€” does not auto-delete; instructs the agent to edit the wiki file manually. |
| `wiki_index_update` | Manually rebuild the search index from Markdown sources. |
| `memory_stats` | Show index chunk count and DB path. |
| `wiki_stats` | Same as `memory_stats`. |

## Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   tool calls    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   exec    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  OpenClaw   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚  openclaw-plugin-    โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚ astor-wiki-memory โ”‚
โ”‚  Agent      โ”‚ โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  wiki-memory         โ”‚ โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ CLI              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                                         โ”‚
                                                                         โ–ผ
                                                                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                                                โ”‚  LLM Wiki        โ”‚
                                                                โ”‚  (Markdown files) โ”‚
                                                                โ”‚                  โ”‚
                                                                โ”‚  SQLite index     โ”‚
                                                                โ”‚  (hybrid search)  โ”‚
                                                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

- **Source of truth**: the Markdown files. Edit them directly with any editor.
- **Search index**: SQLite-backed, rebuilt on demand (`wiki_index_update`) or automatically after write.
- **No vector DB vendor lock**: the index is local, file-based, and portable.

## Acknowledgments

This plugin's design was informed by several projects in the LLM-native memory space.
No code was copied; the architecture, tool shape, and fail-open approach were independently developed.

### Knowledge Base Schema

The wiki directory structure (`wiki/entities/`, `wiki/topics/`, `wiki/sources/`, `raw/`, `index.md`, `log.md`) is inherited from:

- **[Karpathy's llm-wiki](https://gist.github.com/karpathy/193a681de9e5f5c1d049e1e2c290eff9)** โ€” the original concept of AI-maintained Markdown wiki as long-term memory
- **[sdyckjq-lab/llm-wiki-skill](https://github.com/sdyckjq-lab/llm-wiki-skill)** (v3.3.0) โ€” multi-platform implementation of Karpathy's methodology that shaped the file layout and workflow

### Architecture & API Design

- **[QMD](https://github.com/tobi/qmd)** โ€” Markdown collection, BM25/vector hybrid search, MCP agent workflow
- **[Pyrite](https://github.com/markramm/pyrite)** โ€” Markdown/YAML source of truth with SQLite index, MCP/REST access patterns
- **[sage-wiki](https://github.com/xoai/sage-wiki)** โ€” chunk-level indexing, wiki Q&A, hybrid search
- **[LanceDB](https://github.com/lancedb/lancedb)** โ€” API design inspiration for scope isolation and recall/writeback

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...