Pular para o conteúdo
← Back to Skalablog

Published article

Claude Knowledge Base: A Self-Improving Setup

Software EngineeringClaudeClaude CodeAnthropic

Most 'AI second brain' demos stop at a chat window. A Claude knowledge base goes further by storing sources on disk, having the model synthesize a wiki over them, and running an improvement pass on a schedule with three outcome buckets: auto-apply, needs approval, and ask the user.

What a Claude Knowledge Base Is and How It Works

A Claude knowledge base is a local folder structure that an AI agent reads, indexes, and improves over time, following the concept Andrej Karpathy described for LLM-maintained knowledge bases on X. The agent in this setup is Claude Code, Anthropic terminal-based agentic coding tool, pointed at the folder as its working directory. The design is simple enough to describe in one sentence: raw sources go in one folder, the model synthesizes an index in another, and you query the index rather than the raw pile.

The structure has three parts. A raw folder holds unprocessed material such as transcripts, PDFs, and meeting notes. A wiki folder holds the model's synthesis of that material, with references back to the raw files so the agent knows where to look when you ask a question. A CLAUDE.md (or equivalent agent instruction file) holds the master rules for how the agent interacts with the base.

One detail matters more than any template: knowledge bases are personal. The video author splits a single wiki into business, personal, and research sub-wikis, each referencing the shared raw folder, all inside one master workspace folder. Copy the concept, not the exact layout.

Step 1: Create the Raw and Wiki Folder Structure

Start by creating one knowledge base folder with a raw subfolder and a wiki subfolder, plus an agent instruction file at the root. The raw folder is the drop zone for anything unprocessed. The wiki folder is where the model writes and maintains index pages that point back into raw.

You can generate this structure with a single prompt to Claude Code rather than by hand. The prompt should describe the raw/wiki split, the agent instruction file, and any domain sub-wikis you want, such as business, research, or personal. Because the layout is yours to define, write the prompt against your own categories instead of copying someone else's.

The wiki works because every synthesized page cites the raw file it came from. When you ask the agent a question, it searches the wiki first, then drills into raw sources when it needs the underlying evidence. That keeps answers traceable: the model can show you the original PDF or transcript behind any claim it makes.

Step 2: Package Ingestion into a Reusable Skill

Ingestion is the repetitive part of the workflow, so it should be a skill rather than a prompt you retype. Claude Code skills are project-local instruction packages that teach the agent a repeatable procedure. An ingest skill encodes one instruction: take any dropped file, whether text, Markdown, a PDF, or an image, place it in raw, then update the wiki index to reference it.

To create it, describe the ingestion procedure to Claude Code once and ask it to save the steps as a skill named ingest. After that, dropping a meeting note into the folder and invoking the skill handles placement, synthesis, and indexing in one trigger.

The same pattern applies to any recurring operation in the base. If you find yourself giving the same multi-step instruction twice, that instruction is a candidate for a skill. Skills also matter later: the scheduled improvement loop calls named skills, so proven skills become the building blocks of automation.

Step 3: Connect Data Sources That Feed the Base

A knowledge base grows only if real data flows into it. Three source categories cover most personal workflows, and each connects through a different mechanism.

Step 4: Schedule the Self-Improvement Loop

The final step automates the whole cycle, and its one rule decides whether the system works: never schedule a skill you have not proven manually. An untested skill on a cron schedule will faithfully ingest the wrong things or fail repeatedly, so build a working improvement skill first, run it by hand, and only then put it on a timer.

The improvement skill, which the author names improving-system, runs one pass across the entire base. In that pass the agent reviews the knowledge base, syncs session histories and outputs from your listed skills, refreshes context using your connectors, and looks for problems such as broken links or stale pages. You list your actual skill names in the prompt, and the prompt includes a guardrail: if a listed skill is missing, note it and continue, and never create new connections or use credentials without approval.

Claude Cowork feature provides the scheduling layer. You create a new scheduled task, either by describing it to Claude or configuring it manually with a name, description, prompt, project folder, permissions, default model, and frequency. The task's prompt simply triggers the improvement skill, which in turn calls your ingest and data-pulling skills.

Route Every Fix: Auto-Apply, Needs Approval, or Ask

A scheduled agent that edits freely is a risk, so the improvement prompt sorts every finding into three outcome buckets. This triage is the difference between a system you trust unattended and one you have to audit constantly.

The three buckets work as follows:

  • Auto-apply. Small, low-risk fixes such as correcting a broken link or refreshing an obviously stale date get applied immediately.
  • Needs approval. Skill edits and new skill candidates are flagged for your review, so nothing changes behind your back in files that control agent behavior.
  • Ask the user. Ambiguous decisions the agent cannot safely make alone trigger a question rather than a guess.

Each run ends with a summary covering the review performed, skills used, and data refreshed. Reading that summary is your ongoing audit trail, and it is where you catch drift before it compounds.

Frequently Asked Questions

  • Do I need Obsidian to run a Claude knowledge base? No. Obsidian is a Markdown editor that makes the folder pleasant to browse, but the system is plain files that any agent can read. The video author opens the base in Obsidian for readability while Claude Code does the automation.
  • How often should the scheduled improvement loop run? The video demonstrates a daily schedule, which suits sources that update frequently such as session histories and connectors. Start with a manual run, then a low frequency, and increase only after several clean runs with no unwanted edits.
  • Can other agents besides Claude Code use this setup? Yes. The structure is agent-agnostic: raw and wiki folders plus an instruction file work with any agent that can read and write local files, and the video shows Codex session histories being analyzed alongside Claude Code sessions.
  • What is the biggest mistake to avoid? Scheduling a skill before testing it. The author's stated biggest lesson is to prove each skill works manually, including its data pulls and ingest steps, before adding it to a cron-style scheduled task.
  • Is my data sent to the cloud? The files live on your machine, but the agent processing them is Claude cloud-hosted model, so file contents the agent reads are processed by Anthropic service under its data policies. A connector such as Slack or Gmail also passes data through the integration. Treat the base as locally stored, not locally processed.

Source video