Skip to content

sergeyramas/memory-karpathy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memory Karpathy / Память Карпаты

Personal knowledge base compiled from AI conversations. Inspired by Andrej Karpathy's LLM Knowledge Base.

Персональная база знаний, автоматически компилируемая из разговоров с AI. Без RAG, без embeddings — только структурированный markdown и LLM-компилятор.


For Humans / Для людей

What is this? / Что это?

Система из трёх компонентов:

  1. Compiler — хуки Claude Code, которые автоматически записывают знания из каждой сессии
  2. Skills — 14 навыков для работы с вики (обновление, запрос, линтинг, экспорт)
  3. Vault — Obsidian-совместимое хранилище знаний (markdown + wikilinks)

Quick Start / Быстрый старт

git clone https://github.com/sergeyramas/memory-karpathy.git
cd memory-karpathy
chmod +x setup.sh
./setup.sh

Setup script:

  1. Creates ~/.obsidian-wiki/config pointing to vault location
  2. Installs compiler hooks into ~/.claude/settings.json
  3. Symlinks skills to ~/.claude/skills/
  4. Sets up Python environment for compiler scripts

How it works / Как работает

You work with Claude Code
        ↓
[SessionStart] injects knowledge index into conversation
        ↓
You work, make decisions, learn things
        ↓
[SessionEnd] captures conversation → flush.py extracts knowledge
        ↓
daily/YYYY-MM-DD.md (daily log) gets new entries
        ↓
[After 18:00] compile.py → knowledge articles in vault
        ↓
Next session — knowledge is injected again (cycle repeats)

Manual commands / Ручные команды

# Compile daily logs into knowledge articles
cd compiler && uv run python scripts/compile.py

# Ask a question to the knowledge base
cd compiler && uv run python scripts/query.py "How does the purchase bot work?"

# Lint the knowledge base
cd compiler && uv run python scripts/lint.py --structural-only

# Sync current project to wiki (inside Claude Code)
/wiki-update

# Query wiki from Claude Code
/wiki-query "What patterns did we use?"

Obsidian integration / Интеграция с Obsidian

The vault is pure markdown with [[wikilinks]]. Open the vault/ directory as an Obsidian vault for:

  • Graph view (visual connections between concepts)
  • Backlinks (automatic reverse linking)
  • Search (full-text across all knowledge)
  • Templates (in _templates/)

Cross-machine setup / Настройка на нескольких машинах

Each project gets:

  • AGENTS.md — instructions for AI agents
  • wiki/ symlink — points to local vault path
# Local machine
ln -s "/Users/user/Obsidian Vault/obsidian-ramos" ~/project/wiki

# VPS
ln -s /root/obsidian-ramos ~/project/wiki

The rule ./wiki/index.md works everywhere. See docs/symlink-pattern.md.


For AI Agents / Для AI-агентов

Context loading protocol

  1. Read vault/index.md — this is the retrieval mechanism
  2. Based on task, identify relevant articles from the index
  3. Read those articles for full context
  4. After work, update the vault using the wiki-update skill

Vault structure

vault/
├── index.md              ← READ THIS FIRST (master catalog)
├── log.md                ← Build history
├── .manifest.json        ← Ingestion tracking
├── concepts/             ← Atomic knowledge (bugs, patterns, decisions)
├── entities/             ← People, tools, services
├── skills/               ← Reusable how-tos
├── projects/             ← Per-project overviews
│   ├── ebay-automation/  ← eBay dropshipping system
│   └── betaline/         ← AI landing page
└── synthesis/            ← Cross-project insights

Page format

Every page has YAML frontmatter with: title, category, tags, sources, summary, provenance, created, updated.

Use [[wikilinks]] for cross-references. Use provenance markers: ^[extracted], ^[inferred], ^[ambiguous].

Available skills

Command What it does
/wiki-update Sync current project knowledge to vault
/wiki-query "question" Ask the knowledge base
/wiki-lint Run health checks
/wiki-status Show what changed since last sync

Compiler hooks

Hooks in compiler/hooks/ fire automatically:

  • SessionStart → injects index.md + recent daily log as context
  • SessionEnd → captures transcript, spawns flush.py background process
  • PreCompact → same as SessionEnd, fires before auto-compaction

Key conventions

  • Write in encyclopedia style — factual, concise
  • Every article links to 2+ related articles
  • Sources always trace back to daily logs or project files
  • No RAG — index-guided retrieval at personal scale (50-500 articles)

Costs / Стоимость

Operation Cost
Memory flush (per session) ~$0.02-0.05
Compile one daily log ~$0.45-0.65
Query (no file-back) ~$0.15-0.25
Structural lint Free
Full lint (with LLM) ~$0.15-0.25

Dependencies / Зависимости

  • Python 3.12+
  • uv — Python package manager
  • Claude Code — CLI tool
  • claude-agent-sdk >= 0.1.29
  • Obsidian (optional, for visual browsing)

No API key needed — uses Claude Code's built-in credentials.


License

MIT

About

Personal knowledge base compiled from AI conversations. Inspired by Karpathy's LLM KB pattern.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors