Skip to content

mrbear1024/ai-content-kb

Repository files navigation

AI Content Knowledge Base

A review-first, AI-native knowledge base for people who research, write, teach, and publish.

Markdown + Codex + Obsidian + typed YAML relationships

GitHub stars MIT license Codex AGENTS.md Obsidian compatible

English · 简体中文


Note

This project was inspired by Andrej Karpathy's LLM Wiki pattern: immutable raw sources, a persistent and compounding Markdown wiki maintained by an LLM, and a repository schema such as AGENTS.md that defines how the agent should ingest, query, and maintain knowledge.

ai-content-kb extends that idea with explicit provenance roles, a first-class published-product layer, review-first staging, typed machine-readable relationships, content-creation workflows, and safe legacy-vault migration.

Most knowledge bases mix personal thinking, external evidence, published work, and AI-generated text in the same pile. This template gives each a clear role—and gives AI agents rules for working without silently polluting originals or publication workflows.

Originals stay trustworthy. The wiki stays readable. The graph stays queryable. AI output stays reviewable.

Example of a mature Obsidian knowledge graph

The screenshot shows a mature vault using this architecture. A fresh clone starts with a small synthetic example and grows as you add reviewed notes, links, and tags.

Why this project

Need How this project handles it
Keep personal ideas distinct from external claims Separate raw/ and sources/ provenance layers
Reuse published articles, courses, and scripts Treat reviewed output as a first-class products/ layer
Let people browse without turning summaries into proof Use wiki/ as a cited human interface
Give agents precise relationships Store typed, evidenced YAML sidecars in .kb/links/
Prevent generated text from becoming truth by accident Route AI output through .kb/staging/ and human review
Work naturally with Codex Ship durable workflows in root AGENTS.md
Keep Obsidian optional Store everything as ordinary Markdown, YAML, JSON, and folders

Quickstart

git clone https://github.com/mrbear1024/ai-content-kb.git
cd ai-content-kb

No application is required to read the vault. Use plain Markdown, open the root as an Obsidian vault, or use the intended Codex workflow below.

Open in Codex

  1. Open the Codex desktop app.
  2. Select + in Projects.
  3. Choose Use an existing folder.
  4. Select the cloned repository root.
  5. Start a new task and say:
Inspect the project structure, read the knowledge-base rules,
make no changes, and list the available workflows.

Codex reads repository AGENTS.md guidance before starting work. The root instructions then route it to the rest of this project's rules. See the official Codex documentation.

The phrases below are natural-language workflows defined by this repository, not native slash commands. No plugin is required.

Talk to your knowledge base

Say this Default result
加入知识库:这是我的原创笔记 Store owner-authored input under raw/ and create staged index candidates
add to knowledge base: this attachment is an external source Preserve provenance under sources/ and create staged candidates
增加 Wiki 索引:刚才的材料 Draft cited wiki pages and typed relationships in staging
query knowledge base: <question> Navigate the wiki and graph, return to originals, and cite paths
compose from knowledge base: <brief> Build a source plan, outline, and sourced staging draft
migrate legacy knowledge base: inventory <path> Produce a read-only inventory and mapping proposal
review and publish index: <staging path> Validate and promote accepted wiki and graph candidates
lint knowledge base Report broken paths, citations, aliases, hash changes, and privacy risks

How it works

flowchart LR
    R["raw/\nOwner input"]
    S["sources/\nExternal evidence"]
    P["products/\nReviewed output"]
    T[".kb/staging/\nAI candidates"]
    W["wiki/\nHuman interface"]
    G[".kb/links/\nMachine graph"]

    R -->|ingest| T
    S -->|ingest| T
    P -->|backfill| T
    T -->|human review| W
    T -->|human review| G
    W -->|compose| P
    G -->|retrieve evidence| P
Loading
Path Role Source of truth?
raw/ Original notes, judgments, voice transcripts, owned research, active drafts Yes—owner intent
sources/ External clips, papers, books, reports, and media transcripts Yes—external claims
products/ Reviewed articles, courses, scripts, and delivered work Yes—published expression
wiki/ Concepts, entities, maps, and high-value source notes No—must cite originals
.kb/links/ Reviewed typed relationships with evidence and hashes Rebuildable
.kb/staging/ Unreviewed AI prose, wiki pages, mappings, and graph candidates No

Read the architecture rationale and graph schema for details.

Core workflows

Capture and index

add to knowledge base: this attachment is an external source.
Preserve provenance, check existing aliases, and keep generated wiki and graph data in staging.

Review .kb/staging/wiki/ and .kb/staging/links/ before promotion.

Create with AI

Compose from the knowledge base:
Write an article for AI product managers about Context Engineering.
Separate my judgments from external claims, cite repository paths,
and create a source plan and outline before drafting.

Unreviewed prose goes to .kb/staging/drafts/, accepted work moves to raw/drafts/ for development, and only publication-ready work belongs in products/.

Read the content creation guide.

Migrate an existing vault

Migrate legacy knowledge base: inventory the provided directory in read-only mode.
Do not move, copy, delete, or modify files.
Propose a 20–50 file pilot and stop for review.

Migration follows backup → inventory → mapping review → pilot → validation → reviewed batches → cutover.

Read the migration guide.

Explore in Obsidian

Open the repository root with Open folder as vault, then select Graph view in the left ribbon. The included .obsidian/graph.json colors nodes by raw, sources, products, and wiki.

Obsidian visualizes Markdown links and tags. Typed .kb/links/*.yaml relationships are a separate machine layer and do not automatically become Obsidian lines.

Review-first lifecycle

State Destination
Unreviewed article or script .kb/staging/drafts/
Unreviewed course outline .kb/staging/course-drafts/
Unreviewed concept, entity, map, or source note .kb/staging/wiki/
Unreviewed relationship sidecar .kb/staging/links/
Draft selected for human development raw/drafts/
Reviewed knowledge and relationships wiki/ and .kb/links/
Reviewed, publication-ready output products/

The deciding factors are review status, intended use, human ownership, and publication readiness—not whether AI helped write the text.

Documentation

Document Purpose
Start here Reading order and core boundaries
Agent rules Durable Codex workflows and safety rules
Knowledge base guide Human-facing operating principles
Architecture Layer model, lifecycle, and scaling path
Graph schema YAML sidecar fields and edge vocabulary
Content creation Research, outlining, drafting, review, and backfill
Migration Safe migration from an existing vault
Public release checklist Privacy, secrets, rights, and release checks

Project scope

This repository is a reference architecture and working template, not a hosted knowledge-management application. Automation is intentionally minimal: validate the content roles and review workflow with files first, then add manifests, search, embeddings, or a graph database only when real queries justify them.

Obsidian and Codex are optional interfaces. The durable system is the repository itself.

Contributing and support

  • Found a problem or have a proposal? Open an issue.
  • Pull requests improving the information model, examples, schemas, lint rules, and documentation are welcome.
  • Do not submit private notes, copyrighted captures, credentials, absolute home paths, or generated databases containing personal metadata.
  • Before publishing a fork, use the public release checklist.

Maintained by mrbear1024 and contributors.

License

MIT. This project is not affiliated with or endorsed by Obsidian or OpenAI.

About

A review-first reference architecture for AI-assisted personal content knowledge systems

Resources

License

Stars

112 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors