clawmaster icon indicating copy to clipboard operation
clawmaster copied to clipboard

LLM Wiki — a persistent, compounding knowledge base module

Open AIwork4me opened this issue 7 months ago • 3 comments

Related capability

Applications — this is a new application module that transforms how users accumulate and retrieve knowledge through OpenClaw agents.


Problem or motivation

Today, knowledge management in OpenClaw follows a RAG-like pattern: the agent retrieves relevant chunks from raw sources at query time and synthesizes an answer from scratch. This works for simple lookups, but it has a fundamental limitation — there is no accumulation. Ask a subtle question that requires synthesizing five documents, and the agent must find and piece together the relevant fragments every single time. Nothing is built up. The agent pays the extraction cost on every question, cannot cross-reference across sessions, and cannot build up structured knowledge over time.

Andrej Karpathy recently described an alternative pattern he calls LLM Wiki: instead of just retrieving from raw documents at query time, the LLM incrementally builds and maintains a persistent wiki — a structured, interlinked collection of markdown files that sits between the user and the raw sources. When you add a new source, the LLM doesn't just index it for later retrieval. It reads it, extracts key information, and integrates it into the existing wiki — updating entity pages, revising topic summaries, noting where new data contradicts old claims. The knowledge is compiled once and then kept current, not re-derived on every query.

The key insight: the wiki is a persistent, compounding artifact. The cross-references are already there. The contradictions have already been flagged. The synthesis already reflects everything you've read. The wiki keeps getting richer with every source you add and every question you ask.

This is particularly relevant for ClawMaster users who:

  • Manage multiple LLM providers and want a unified knowledge layer across agent sessions
  • Need their agents to build domain expertise over time (research, competitive analysis, documentation)
  • Want knowledge that compounds rather than resets with each conversation

ClawMaster already has the infrastructure to make this work — PowerMem for semantic search, OCR for document parsing, multi-LLM provider support, and a plugin system. What's missing is the wiki layer that turns these building blocks into a compounding knowledge engine.


Proposed solution

Overview

Add a new LLM Wiki module to ClawMaster, consisting of:

  1. A new frontend module (wiki) following the ClawModule pattern
  2. A new backend plugin (openclaw-wiki) following the OpenClaw plugin pattern
  3. Three core operations: Ingest, Query, and Lint

Three-layer architecture

Following Karpathy's original design:

┌──────────────────────────────────────────────────────┐
│  Raw Sources (immutable)                              │
│  PDF, HTML, DOCX, TXT, MD — the user's source docs   │
│  LLM reads but never modifies                         │
├──────────────────────────────────────────────────────┤
│  Wiki Pages (LLM-generated & maintained)              │
│  entity/, concept/, source/, synthesis/, process/     │
│  Auto-created, cross-linked, continuously updated     │
├──────────────────────────────────────────────────────┤
│  Schema (conventions & rules)                         │
│  SCHEMA.md — page types, frontmatter, lint rules      │
│  Co-evolved by user and LLM                           │
└──────────────────────────────────────────────────────┘

Core operations

Ingest — Drop a source into the vault, the LLM:

  1. Parses the source (leveraging existing PaddleOCR for PDFs/images)
  2. Extracts entities, concepts, key claims with evidence
  3. Creates structured wiki pages with YAML frontmatter
  4. Inserts [[page-name]] bidirectional links
  5. Writes back to existing pages that relate to the new content (updates, supplements, flags contradictions)
  6. Updates index.md (content catalog) and log.md (append-only chronicle)
  7. Auto-commits to git

Query — Ask a question against the wiki:

  1. LLM reads index.md first to locate relevant pages
  2. Drills into top pages, follows [[links]]
  3. Synthesizes an answer with citations ([[source-page]])
  4. Optionally files good answers back as new synthesis pages

Lint — Periodic health-check:

  1. Detect orphan pages (no inbound links)
  2. Flag contradictions between pages
  3. Find stale claims superseded by newer sources
  4. Identify missing cross-references
  5. Check schema compliance

Leveraging existing ClawMaster infrastructure

Wiki Need Existing ClawMaster Capability
Semantic search over wiki pages PowerMem (128-dim vector embeddings, cosine similarity, SQLite/SeekDB backend)
Document parsing (PDF, images) PaddleOCR bundled skill
LLM content generation Multi-LLM providers (OpenAI, Anthropic, Google, Ollama, OpenAI-compatible)
Agent tool surface Plugin SDK (registerTool, event hooks)
Frontend module system ClawModule auto-discovery
CLI commands Plugin CLI (registerCli)
Version history Git (wiki is just a repo of markdown files)
i18n Existing zh/en/ja infrastructure

Proposed file structure

# Frontend module (new)
packages/web/src/modules/wiki/
  index.ts              # ClawModule definition (icon: 'book-open', group: 'main')
  WikiPage.tsx          # Main wiki dashboard
  components/
    WikiGraphView.tsx   # Knowledge graph visualization (D3/Cytoscape)
    WikiSearchBar.tsx   # Search + query interface
    WikiPageViewer.tsx  # Markdown page viewer with [[link]] navigation
    WikiIngestPanel.tsx # Drop zone + ingest progress

# Backend plugin (new)
plugins/openclaw-wiki/
  index.ts              # Plugin registration (tools, CLI, service)
  src/
    ingest.ts           # Ingest pipeline (parse → extract → create → write-back)
    query.ts            # Query engine (index-first search → LLM synthesis)
    lint.ts             # Lint engine (7+ health checks)
    schema.ts           # Schema parser & validator
    graph.ts            # Graph compilation from page relationships
    vault.ts            # Vault initialization & file management
    markdown.ts         # Page types, frontmatter, [[link]] parsing

# Wiki vault (user-side, git-tracked)
~/.clawmaster/wiki/
  raw/                  # User's source files (immutable)
  pages/                # LLM-generated wiki pages
    entities/           # People, organizations, tools
    concepts/           # Theories, methods, frameworks
    sources/            # Source document summaries
    synthesis/          # Cross-source analyses
    processes/          # Step-by-step workflows
  index.md              # Auto-maintained content catalog
  log.md                # Append-only activity log
  SCHEMA.md             # Wiki conventions & rules
  .git/

Agent tools (registered via plugin SDK)

Following the same pattern as memory-clawmaster-powermem:

  • wiki_ingest — Process one or more raw sources into wiki pages
  • wiki_search — Search wiki pages (text mode via index, semantic mode via PowerMem)
  • wiki_query — Ask a question, get a synthesized answer with citations
  • wiki_get — Read a specific wiki page
  • wiki_lint — Run health checks on the wiki
  • wiki_apply — Create or update a wiki page (for manual corrections)

Phased delivery

Phase 1 — MVP (Core wiki engine):

  • Ingest pipeline: parse → extract → create pages → write-back → index update
  • Basic query: index-first search + LLM synthesis with citations
  • Simple frontend module: page list, search bar, page viewer, drop zone for ingest
  • Git auto-commit on every ingest
  • Reuses PowerMem for semantic search, PaddleOCR for document parsing

Phase 2 — Visualization & enrichment:

  • Knowledge graph view (interactive node-link diagram)
  • Enriched page types: process/, question/ pages
  • Query write-back: suggest filing good answers as new pages
  • Schema templates: Research mode, Book mode, Team mode

Phase 3 — Intelligence & collaboration:

  • Contradiction detection (auto-flag conflicting claims across pages)
  • Multi-format output: Marp slides, structured tables, chat summaries
  • Channel integration: deliver wiki answers via Telegram/Discord/Slack
  • Lint automation: scheduled health checks with auto-fix suggestions

User stories

  1. As a researcher, I ingest 20 PDF papers into the wiki. The LLM extracts 35 entities, 12 concepts, and produces 5 synthesis pages. I can query "how does RLHF affect model capabilities?" and get a synthesized answer citing specific papers, instead of re-reading all 20 PDFs every session.

  2. As a team lead, I configure the wiki plugin for my team's project docs. Each meeting transcript gets auto-ingested. The wiki builds up a structured picture of decisions, action items, and evolving requirements — maintained by the LLM so no one has to do the bookkeeping.

  3. As a ClawMaster operator, I use the wiki as a persistent knowledge layer across agent sessions. The agent recalls compiled knowledge instead of re-deriving from raw sources each turn. My PowerMem vector store indexes the wiki for semantic search.

  4. As a learner, I'm reading a textbook chapter by chapter. Each chapter gets ingested. The wiki builds pages for key concepts, examples, and cross-chapter connections. By the end I have a rich companion wiki — like a fan wiki, but personal and auto-maintained.


Self-maintenance: the EVOLVE operation (merged from #110)

Across customer interviews we consistently hear the same contradiction:

Leadership mandates a knowledge base — knowledge must live in the system, not in any one person's head — but nobody wants to maintain it.

Every knowledge base then follows the same lifecycle:

enthusiastic build → gradually unmaintained → stale/wrong content piles up → trust erodes
→ usage collapses → value goes to zero → leadership pushes rebuild

The root cause is that existing knowledge bases are passive warehouses — they store but don't cultivate. Once a doc goes in, nothing keeps it accurate or useful.

This section extends the three-operation model (Ingest / Query / Lint) above with a fourth operation, EVOLVE, so the wiki maintains itself. Combined with the design above, the complete model is:

Operation Trigger Effect
INGEST new source added parse → extract → integrate → cross-link (a single source may update 10–15 existing pages)
QUERY user asks a question hybrid retrieval → synthesize answer → optionally persist valuable answers as new synthesis pages (compounding loop)
LINT scheduled detect contradictions, orphan pages, missing cross-refs, duplicates, schema violations
EVOLVE scheduled decay scoring → stale detection → auto-refresh from source → feedback-driven graph updates

a) Ebbinghaus decay model — automated staleness detection

R(retention) = importance × exp(-decay_rate × days_since_access)
decay_rate   = 0.16 × (1 - importance × 0.8)
  • High-importance content decays slowly; low-importance content decays quickly.
  • Each read / citation resets the decay clock.
  • Content whose retention drops below a threshold is auto-flagged as "needs verification."

b) Freshness-weighted ranking — newer facts win at query time

score(query, page) = α × cosine_similarity + (1-α) × 0.5^(age_days / half_life)
  • Per-category half-lives: pricing 7 days, API docs 14 days, compliance policy 180 days.
  • Query results prefer fresh, accurate content.

c) Feedback-driven evolution (EvoRAG pattern)

  • Capture implicit / explicit user feedback (citation, dismissal, correction).
  • Feed feedback back into the knowledge graph's triples, updating contribution scores.
  • High-contribution triples are reinforced; low-contribution triples are down-weighted or pruned.
  • Produces a virtuous cycle: the more the wiki is used, the more accurate it becomes.

d) Auto-triggered source refresh

  • When a page is detected as stale, the system re-fetches the original source (e.g. a URL).
  • If the source changed, the wiki page updates and the change is logged.
  • If the source is unreachable, the page is marked "needs human confirmation" and a notification is pushed.

Storage: dual-engine strategy

PowerMem and OceanBase seekdb serve complementary roles:

Scenario PowerMem OceanBase seekdb
Semantic similarity search 128-dim vector + cosine —
Full-text keyword search — native full-text index
Hybrid retrieval (semantic + keyword + filter) — DBMS_HYBRID_SEARCH
Freshness-filtered queries — WHERE last_verified < NOW() - TTL
Knowledge-graph triple storage — relational tables + AI functions
Page content storage Markdown files full-text indexed copy
Decay-state tracking — freshness_score column + scheduled updates
Conflict detection — transactional consistency

The system degrades gracefully: when seekdb is unavailable, it falls back to PowerMem + SQLite for retrieval.

Frontend additions for self-maintenance

On top of the Wiki module structure above, add:

  • FreshnessDashboard.tsx — visualizes the decay state of the whole vault so stale content stops being hidden.
  • ConflictAlert.tsx — surfaces contradictions the LINT pass found, with suggested resolutions.
  • WikiGraphView.tsx — interactive graph of entities / concepts / links; useful for spotting orphans and clusters.

How this closes the "built but not maintained" loop

Old pain point EVOLVE answer Outcome
Nobody wants to update content EVOLVE auto-detects staleness and attempts refresh zero manual maintenance cost
Stale content stays hidden Ebbinghaus decay + Freshness dashboard stale content becomes visible
Errors compound LINT + contradiction detection errors are surfaced, not spread
Knowledge fragments don't connect INGEST auto cross-links knowledge is interconnected by construction
Leadership mandate vs. employee resistance system maintains; humans only contribute raw material compliance without human toil
Knowledge only lives in one person's head QUERY auto-persists valuable answers tacit knowledge becomes explicit
Low usage → zero value feedback-driven evolution: more use → more accuracy virtuous cycle replaces vicious cycle

Alternatives considered

Pure RAG (status quo): The agent re-derives answers from raw sources each turn via memory_recall. Works for simple queries but degrades with scale — no cross-referencing across sessions, no structured claims, no compounding.

External wiki services (Notion, Confluence, Obsidian-only): Adds network dependencies, requires separate auth, and breaks the "wiki lives alongside the agent" integration model. A built-in module can leverage PowerMem, OCR, and multi-LLM providers directly.

Separate standalone application: Building this outside ClawMaster would duplicate the LLM provider configuration, memory infrastructure, and agent integration. Better to build it as a module inside the control plane where all the infrastructure already exists.

AIwork4me avatar Apr 17 '26 00:04 AIwork4me

I think we should discuss the underlying architecture first, then UI/UX after the community aligns on the model.

ClawMaster already has strong pieces in place:

  • managed PowerMem memory runtime
  • support for both powermem-sqlite and powermem-seekdb
  • local/workspace file import from memory/
  • auto-recall before agent start
  • auto-capture after agent end
  • a Memory module that already compares managed memory vs legacy OpenClaw memory

So for #49, I think the real question is:

How do we make full use of PowerMem and seekdb as the root of ClawMaster memory, while still embracing local/file-based data as a first-class part of that system?

My current proposal

1) PowerMem should be the runtime root

PowerMem should be the central operational abstraction for memory in ClawMaster.

That means it should be the main layer for:

  • add / list / search / delete / reset
  • scoping by user / agent / workspace
  • stats and health
  • lifecycle hooks
  • auto-recall / auto-capture
  • import/export orchestration

So the product should think in terms of managed memory via PowerMem, not ad hoc file parsing or backend-specific logic.

2) seekdb should be the preferred retrieval/index root

Where supported, I think seekdb should be the preferred backend for memory retrieval/indexing.

Its role:

  • semantic search
  • vector indexing
  • hybrid retrieval
  • ranking support
  • scalable local retrieval

SQLite still matters as compatibility fallback, but if we want to “make full use” of the system, then seekdb should be the primary retrieval path, not just an optional optimization.

3) Local files should be first-class, but integrated into the managed root

I still think local files are very important, but I would frame them as:

  • first-class local memory sources
  • first-class persistence/inspection surfaces
  • first-class promotion targets for durable memory

In other words:

PowerMem manages memory, seekdb retrieves memory, and local files are integrated into that system as local-first data surfaces.

Not three separate silos.


Proposed system model

I think all memory types should flow through one managed model:

  • file-imported memory
  • manually added memory
  • conversation-captured memory
  • distilled durable memory
  • legacy OpenClaw imported memory

That means:

  • operationally: all are PowerMem-managed records
  • retrieval-wise: all are searchable through the same managed pipeline
  • where supported: retrieval is primarily seekdb-backed
  • provenance tells us where each record came from

So the root model becomes:

PowerMem as runtime root + seekdb as retrieval/index root + local files as integrated local memory surfaces


Proposed memory stem direction

I don’t think the long-term architecture should stop at “store transcript chunks into memory.”

If we want to make full use of PowerMem, then it should become the home for a memory stem / distillation pipeline:

  1. capture source material
  2. extract memory candidates
  3. classify them
  4. dedupe/merge against existing managed memory
  5. store them as managed memory
  6. recall them through seekdb-backed retrieval
  7. optionally promote durable/high-value records back into local files

That would let us move from raw chunk storage toward structured durable memory.


Proposed record model

I think every managed memory record should explicitly carry:

  • source type
  • durability
  • scope
  • provenance
  • optionally quality/confidence

Something like:

type MemorySourceType =
  | 'workspace_file'
  | 'manual_entry'
  | 'conversation_capture'
  | 'distilled_fact'
  | 'legacy_openclaw_import'
  | 'system_generated'

type MemoryDurability =
  | 'ephemeral'
  | 'working'
  | 'durable'
  | 'canonical'

type MemoryCategory =
  | 'preference'
  | 'fact'
  | 'procedure'
  | 'decision'
  | 'project_context'
  | 'task_context'
  | 'identity'
  | 'reference'
  | 'episodic'
  | 'other'

interface MemoryScope {
  profileKey?: string
  workspacePath?: string
  userId?: string
  agentId?: string
}

interface MemoryProvenance {
  sourceType: MemorySourceType
  sourcePath?: string
  sourceId?: string
  sourceFingerprint?: string
  importedAt?: string
  capturedAt?: string
  createdBy?: 'user' | 'agent' | 'importer' | 'system'
  originSummary?: string
}

interface MemoryQuality {
  confidence?: number
  dedupeKey?: string
  canonicalScore?: number
  recallPriority?: number
}

interface ManagedMemoryRecord {
  id: string
  content: string
  scope: MemoryScope
  category: MemoryCategory
  durability: MemoryDurability
  provenance: MemoryProvenance
  quality?: MemoryQuality
  metadata: Record<string, unknown>
  createdAt: string
  updatedAt: string
  accessedAt?: string
  accessCount?: number
}

The key idea is that all memory types become PowerMem-managed records, with metadata describing where they came from and how durable they are.


Retrieval/ranking direction

If seekdb is the preferred retrieval root, we should use it fully.

I think ranking should consider:

  • semantic score
  • scope match
  • durability
  • source type
  • recency
  • access count
  • confidence / recallPriority

All else equal, I’d currently prefer ranking roughly like this:

  1. canonical + file-backed managed memory
  2. durable + distilled managed memory
  3. manual managed memory
  4. legacy imported managed memory
  5. episodic/captured managed memory

The point is not that files are a separate system — the point is that everything is retrieved from the same managed root, but provenance/durability help rank quality.


Role of local files in this model

I still think local files are essential, but their role becomes clearer:

  • as source: import human-authored knowledge into managed memory
  • as persistence surface: promote durable managed memory back into files
  • as trust layer: let users inspect/version important memory outside the runtime

So files stay first-class, but they are integrated through the PowerMem + seekdb root architecture rather than replacing it.


Why architecture before UI/UX

I think UI/UX should come after we align on:

  • is PowerMem the managed runtime root?
  • is seekdb the preferred retrieval/index root?
  • should all memory types normalize into one managed model?
  • how should source/durability/provenance work?
  • should long-term capture become distilled-first?
  • should durable managed memory be promotable into files?

Once those are settled, the UI discussion becomes much easier.


Open questions for the community

  1. Should PowerMem be the single managed runtime root for all memory types in ClawMaster?
  2. Should seekdb be the preferred retrieval/index backend wherever supported?
  3. Should file-backed memory be normalized into the same managed memory model instead of living as a separate silo?
  4. Should we formalize source type / durability / provenance / quality metadata for all managed memory records?
  5. Should long-term auto-capture shift from chunk-first to distilled-first?
  6. Should durable managed memories be promotable back into local files?
  7. How should we handle deletion/orphaning when a source file disappears?

My current position

ClawMaster memory should be rooted in PowerMem as the managed runtime and seekdb as the preferred retrieval/index backend.

Local/file-based memory should be a first-class part of that system, but integrated through the managed runtime rather than treated as a separate primary architecture.

In practice, that means:

  • all memory types become managed PowerMem records
  • seekdb is the preferred search/retrieval path
  • local files are importable, traceable, and promotable persistence surfaces
  • the system should evolve from raw chunk capture toward a memory stem/distillation pipeline

If the community aligns on that direction, then I think we can move on to the UI/UX discussion with a much clearer foundation.

webup avatar Apr 17 '26 03:04 webup

Thank you for the thoughtful and detailed response. I agree with most of your architectural direction — PowerMem as the managed runtime root, seekdb as the preferred retrieval backend, and the unified record model are all sound foundations. This comment tries to bridge the gap between our positions by identifying the one thing the "make PowerMem richer" approach doesn't cover on its own, and proposing a synthesis.


Where we agree

  • PowerMem should be the runtime root for all memory operations. No argument.
  • seekdb should be the preferred retrieval backend wherever supported. SQLite as compatibility fallback makes sense.
  • The unified record model you proposed (ManagedMemoryRecord with sourceType / durability / provenance / quality) is genuinely better than what I sketched. It provides a clean vocabulary for distinguishing raw captures from distilled facts.
  • The distillation pipeline (capture → extract → classify → dedupe → store → recall → promote) is exactly the right direction for evolving from raw chunk storage toward structured durable memory.
  • Architecture before UI/UX is the right sequencing.

The gap: compiled knowledge is not enriched memory

There is a distinction I think is worth making explicit, because it shapes what the system needs to do above the storage layer.

Memory answers the question: "What do I know?" — facts, preferences, decisions, episodes. This is what PowerMem does well.

Compiled knowledge answers a different question: "What do we understand about topic X, and how does it connect to Y and Z?" This requires structure that flat records don't provide on their own: pages with sections, bidirectional links, typed relationships (entity → depends-on → concept, concept → refines → concept), and a navigable graph.

Karpathy describes the difference this way:

"Instead of just retrieving from raw documents at query time, the LLM incrementally builds and maintains a persistent wiki — a structured, interlinked collection of markdown files that sits between you and the raw sources. When you add a new source, the LLM doesn't just index it for later retrieval. It reads it, extracts key information, and integrates it into the existing wiki — updating entity pages, revising topic summaries, noting where new data contradicts old claims."

The key phrase is "integrates it into the existing wiki." A single source might touch 10-15 wiki pages. The LLM doesn't just store a distilled fact — it updates a network of interconnected pages. That network is the product, not the individual records.

"A single source might touch 10-15 wiki pages."

This is structural work — creating links, detecting contradictions across pages, maintaining cross-references — that goes beyond storing richer metadata on individual records.


Why markdown files matter: Obsidian compatibility

This is the concrete reason the wiki layer needs to maintain actual files on disk, not just PowerMem records.

Karpathy's original workflow explicitly relies on Obsidian as the browsing interface:

"In practice, I have the LLM agent open on one side and Obsidian open on the other. The LLM makes edits based on our conversation, and I browse the results in real time — following links, checking the graph view, reading the updated pages. Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase."

If all knowledge lives exclusively in PowerMem (SQLite/SeekDB), Obsidian sees nothing. The database is opaque to file-based tools. Users lose the ability to:

  • Browse the wiki in Obsidian with real-time [[link]] navigation
  • Use Obsidian's graph view to see knowledge topology — hubs, orphans, clusters
  • Edit pages manually in a text editor and have the system pick up changes
  • Track the wiki's evolution via git log / git diff
  • Open the wiki in any markdown-compatible tool (VS Code, Typora, etc.)

Karpathy emphasizes this point:

"The wiki is just a git repo of markdown files. You get version history, branching, and collaboration for free."

This is not a nice-to-have. It is the core interaction model of the LLM Wiki pattern. The user sees the wiki grow in real time, navigates it, and directs the LLM's attention based on what they see. Removing the file layer breaks that loop.


Proposed synthesis: layered architecture

I believe the right answer is not "separate wiki system" (my original proposal) or "everything in PowerMem" (the direction you described), but a layered approach:

┌───────────────────────────────────────────────────────┐
│  Wiki Compilation Layer                                │
│  - Organizes PowerMem records into structured pages    │
│  - Maintains [[bidirectional links]] between pages     │
│  - Generates index.md / log.md                         │
│  - Runs lint (contradiction, orphan, staleness)        │
│  - Writes markdown files to disk (Obsidian-readable)   │
│  - Syncs file edits back into PowerMem                 │
├───────────────────────────────────────────────────────┤
│  PowerMem (unified storage / retrieval engine)         │
│  - Your ManagedMemoryRecord model                      │
│  - sourceType / durability / provenance / quality      │
│  - seekdb-backed semantic retrieval                    │
│  - Distillation pipeline                               │
│  - Auto-recall / auto-capture hooks                    │
├───────────────────────────────────────────────────────┤
│  Local Files (persistence / inspection surface)        │
│  - Markdown files in ~/.clawmaster/wiki/               │
│  - Obsidian-readable, git-trackable                    │
│  - Import source: file edits → PowerMem                │
│  - Promotion target: PowerMem → durable file           │
│  - Raw sources (immutable) in raw/                     │
└───────────────────────────────────────────────────────┘

In this model:

  • PowerMem is the runtime root — all memory operations flow through it, exactly as you proposed.
  • Markdown files are the presentation surface — the wiki compilation layer writes files that Obsidian can read, and ingests manual edits back into PowerMem.
  • The wiki layer is a compiler, not a separate store — it reads from PowerMem, organizes records into pages with structure and links, and writes the result to disk. It adds no competing storage.

This is analogous to how a compiler works: the source of truth is the AST (PowerMem records), and the compiled output is machine-readable code (markdown files). You don't lose the source by producing the output.

Your proposed record model actually supports this well:

Record Wiki mapping
sourceType: 'distilled_fact' + durability: 'canonical' Candidate for a wiki page section
category: 'fact' / 'procedure' / 'decision' Page type hint (entity / concept / process)
provenance.sourceId Source page link ([[source-xyz]])
quality.confidence Weight in lint (low confidence → flag for review)

The wiki compilation layer would group related PowerMem records into pages, add [[links]], and write the result to disk — without creating a competing storage system.


Responses to the open questions

1. Should PowerMem be the single managed runtime root for all memory types in ClawMaster?

Yes. The wiki layer should consume from PowerMem, not bypass it. All memory types flow through the managed pipeline. The wiki adds a structural compilation step on top, not a parallel storage system.

2. Should seekdb be the preferred retrieval/index backend wherever supported?

Yes. Wiki search should use seekdb for semantic retrieval (via PowerMem), supplemented by file-based index.md for structured navigation. The two serve different use cases — seekdb for "find me relevant knowledge," index.md for "show me what's in the wiki and how it's organized."

3. Should file-backed memory be normalized into the same managed memory model instead of living as a separate silo?

Yes for storage, no for presentation. All memory records should live in PowerMem's managed model. But the wiki compilation layer should also produce markdown files as a derived artifact — not as a competing store, but as an Obsidian-compatible presentation surface. Files are output, not source. The source is PowerMem.

4. Should we formalize source type / durability / provenance / quality metadata for all managed memory records?

Yes, strongly. Your proposed ManagedMemoryRecord model is excellent. The wiki compilation layer would use these fields to decide how to organize records into pages — durability: 'canonical' records become page sections, provenance.sourceId becomes source links, quality.confidence feeds into lint severity.

5. Should long-term auto-capture shift from chunk-first to distilled-first?

Yes. Raw chunk capture is the current ceiling. A distillation pipeline that extracts structured facts before storage would produce much higher-quality input for both recall and wiki compilation. Karpathy's insight here is that the LLM should do the "grunt work" of summarizing, cross-referencing, and filing:

"You never (or rarely) write the wiki yourself — the LLM writes and maintains all of it. You're in charge of sourcing, exploration, and asking the right questions. The LLM does all the grunt work — the summarizing, cross-referencing, filing, and bookkeeping that makes a knowledge base actually useful over time."

Distilled-first capture is exactly this principle applied to the auto-capture pipeline.

6. Should durable managed memories be promotable back into local files?

Yes. This is the bidirectional bridge between PowerMem and the file layer. Promotion means: the wiki compiler takes durable records, organizes them into structured markdown pages, and writes them to disk. Import means: manual edits to those files are detected and synced back into PowerMem with appropriate provenance. This is consistent with your framing of files as "importable, traceable, and promotable persistence surfaces."

7. How should we handle deletion/orphaning when a source file disappears?

I'd suggest three levels:

  • Raw source deleted: Mark associated wiki pages as status: source-missing in frontmatter. Lint flags these. Pages remain readable but get a visual indicator. The user decides whether to archive, delete, or find a replacement source.
  • PowerMem record deleted: The wiki compiler detects the missing record on next compile, removes the corresponding section from the page, and rewrites the file. Backlinks to that section are flagged by lint.
  • Manual file edit deleted a page: The compiler detects the file change, syncs the deletion back to PowerMem (removing the corresponding records), and updates index.md / log.md.

Suggested next step

I think the architecture is converging. The remaining design question is the shape of the wiki compilation layer API — specifically, how it reads from PowerMem, what it writes to disk, and how bidirectional sync works. That might be worth a focused design doc before moving to implementation.

Happy to iterate on the details. Thanks again for engaging deeply on this — the unified record model and distillation pipeline direction make the foundation much stronger.

AIwork4me avatar Apr 17 '26 09:04 AIwork4me

Implementation is starting via #110 on branch feat/wiki-module. The implementation will keep #49 as the umbrella architecture issue and ship one Wiki module rooted in managed PowerMem, using existing powermem-seekdb where supported, with markdown files as the compiled article surface.

webup avatar Apr 28 '26 16:04 webup