Persistent memory for your AI tools.
Shared context across sessions, tools, and machines.
AIKB gives your agents shared context that survives across sessions, tools, and machines. It stays local-first, Git-backed, and fully inspectable, so your memory system feels like infrastructure you control instead of a black box you hope is right.
Your AI tools should not start from zero.
Get Started • How It Works • Tool Support
Every AI session starts from zero. You re-explain your projects, your stack, your preferences, and your constraints every time. Context windows are finite, sessions end, and the useful working memory disappears with them.
If you use multiple tools, the problem gets worse. Claude, Gemini, Codex, Cursor, ChatGPT, and web copilots all end up relearning the same context from scratch.
AIKB is a structured knowledge base stored in a private GitHub repo. Your agents read it at the start of a session to orient themselves, and write back to it when they learn something durable. The result is memory that stays inspectable, portable, and under your control.
Session starts → Agent reads AIKB → Agent knows everything
Session ends → Agent writes updates → Next session picks up where this one left off
- Shared context across tools — one memory layer for Claude Code, Gemini CLI, Codex, Cursor, ChatGPT, and more
- Local-first and Git-backed — durable memory in files you can inspect, diff, sync, and own
- Two access modes — local clone for speed, or GitHub MCP for remote sessions and new machines
- Semantic search — optional
aikb_searchMCP tool for natural-language queries across your knowledge base - Runtime memory pipeline — optional
_runtime/staging and_tools/memory-pipeline/helpers for event capture, candidate review, nightly maintenance, and dream-style consolidation - Operator HUD + approvals log — optional
runtime_cli.pyand_pending_approvals.mdworkflows for focus, verification, and sign-off visibility - Structured closeout capture — optional
runtime_cli.py closeoutcommand for end-of-session memory capture when you wrap up work - Operator intents — optional runbooks that teach your agents how to execute your shorthand requests and recurring workflows
- Nightly dream cycle — optional bundle, quality, contradiction, and distilled-memory artifacts for higher-signal overnight memory synthesis
- Layered loading — agents read only what they need, preserving context window budget
- Checkpoint commits — agents can save progress during long sessions so memory survives interruptions
- Secrets-safe — credentials stay in your secrets manager; AIKB stores references only
- Machine-aware — each machine gets a profile so the agent uses the right paths, tools, and conventions
| What it gives you | Why it matters |
|---|---|
| Persistent session memory | Stop repeating the same setup and project context |
| Inspectable storage | Trust the memory because it lives in Markdown + Git |
| Cross-tool continuity | Switch tools without losing your working context |
| Structured updates | Capture decisions, gotchas, blockers, and state changes cleanly |
| Optional dream consolidation | Turn noisy daily memory into bundled, reviewable nightly summaries |
The core AIKB workflow is simple:
Start session -> agent reads _index.md + _state.yaml
Do work -> capture decisions, blockers, and approvals as needed
Wrap up -> record a structured closeout event
Next session -> load the latest state instead of starting cold
If you enable the runtime helpers, that operator loop becomes tangible:
# See what AIKB thinks is active right now
python3 _tools/memory-pipeline/runtime_cli.py hud
# Keep a current objective visible during longer work
python3 _tools/memory-pipeline/runtime_cli.py focus set \
--task "Ship dashboard cleanup" \
--verify "Run tests and confirm deploy status"
# When you finish for now, capture the wrap-up state
python3 _tools/memory-pipeline/runtime_cli.py closeout \
--phrase "lets wrap up for now"That closeout event is stored in _runtime/events/YYYY-MM-DD.ndjson, so the next session can recover not just what exists in your docs, but how the current stretch of work ended.
By default, those raw runtime event files are local working memory. Promote durable signal into candidates, approvals, summaries, or canonical docs instead of auto-committing every event log.
The AIKB includes a set of optional CLI tools to help automate knowledge curation and retrieval:
- Ambient Context Injection (
_tools/memory-pipeline/ambient_ask.sh) — A wrapper for your AI CLI that automatically injects relevant facts from your AIKB into your prompt before the agent starts. - Temporal Knowledge Graph (
_tools/memory-pipeline/build_temporal_graph.py) — Generates a structured JSON graph of your knowledge, extracting entities like IPs and tools to track how they change over time. - Semantic Search (
_tools/memory-pipeline/memory_search.py) — A hybrid keyword/semantic search tool to quickly locate specific memories across your entire repository.
| Tool | Integration | AIKB Access Mode |
|---|---|---|
| Claude Code | ~/.claude/CLAUDE.md auto-loaded |
Local clone or GitHub MCP |
| Gemini CLI | ~/.gemini/GEMINI.md auto-loaded |
Local clone or GitHub MCP |
| Codex CLI | AGENTS.md in project root |
Local clone (or MCP if configured) |
| Cursor | User Rules (Settings UI) | Local clone |
| ChatGPT | Custom Instructions (Settings UI) | Manual paste at session start |
| Google Gemini | Custom Instructions (Settings UI) | Manual paste at session start |
| Grok | Customise Grok (Settings UI) | Manual paste at session start |
Prerequisites: Git, a GitHub account, and at least one AI tool.
Click Use this template → name it AIKB → set it to Private.
Or from the CLI:
gh repo create AIKB --template mcglothi/ai-knowledge-base --private --clone
cd AIKBchmod +x install.sh
./install.shThe script will ask for your GitHub username, repo name, and preferred local path, then generate personalized agent instruction files.
If you cloned from your own GitHub repo first, it auto-detects the GitHub username and repo name from origin, so most people can accept the defaults.
Follow the guide for your tool in _agents/README.md:
- Claude Code — copy
_agents/claude-code.mdto~/.claude/CLAUDE.md - Gemini CLI — copy
_agents/gemini-cli.mdto~/.gemini/GEMINI.md - Codex CLI — copy
_agents/codex.mdtoAGENTS.mdin each Codex project repo, or use./sync-agents.sh /path/to/project [...] - Cursor — paste
_agents/cursor.mdinto Settings → Cursor Settings → Rules → User Rules - ChatGPT / Gemini / Grok — paste the relevant file into Custom Instructions
install.sh creates these files automatically — they just need your details:
personal/profile.md— your background, skills, and communication preferencespersonal/dev-environment/README.md— your machine inventory (hostnames, OS, code roots)personal/dev-environment/<hostname>.md— installed tools on your primary machine
The example/ directory has annotated examples showing what good entries look like.
Run one command to enable natural language queries across all your AIKB files:
bash _tools/aikb-search/setup.shAfter setup, your agent can answer questions like "what's currently broken?" or "what SSL certs expire soon?" without you having to know which file to load. See docs/search-setup.md for details.
If you want more than static docs, AIKB also supports an operator-facing runtime layer:
python3 _tools/memory-pipeline/runtime_cli.py hud
python3 _tools/memory-pipeline/runtime_cli.py closeout --phrase "lets wrap up for now"
python3 _tools/memory-pipeline/approvals_cli.py listThis gives you:
- a compact session HUD
- a structured wrap-up capture path
- a visible sign-off queue for high-impact actions
You can also capture recurring shorthand requests in a runbook so future sessions do not need to rediscover them:
"restart staging"
"wrap up for now"
"wake lab server"
See home-lab/runbooks/operator-intents.md and _templates/operator-intent-template.md.
If you want the fastest path from "installed" to "this feels useful," follow the lightweight operator loop:
python3 _tools/memory-pipeline/runtime_cli.py hud
python3 _tools/memory-pipeline/runtime_cli.py focus set \
--task "Your current task" \
--verify "What you will verify next"
python3 _tools/memory-pipeline/runtime_cli.py closeout \
--phrase "lets wrap up for now"See docs/operator-loop.md for the public-facing workflow, when to use approvals, and how operator intents fit into the loop.
If you want a terminal walkthrough instead of reading docs, run:
bash _tools/feature-tour.shLaunch your AI tool. It will read AIKB and immediately know who you are, what machines you use, and what you're working on.
Clone your private AIKB repo and run install.sh again. It detects the new hostname, scaffolds a machine profile for it, and sets up your AI tools — your existing personalization is already in the repo, no re-entering needed.
When improvements are made to the template (better agent instructions, new tool support, updated schemas), you can pull them without touching your personal content.
install.sh automatically adds this repo as an upstream git remote and saves your personal config to a git-ignored .aikb-config.d/ directory. When you want updates, run:
python3 _tools/memory-pipeline/runtime_cli.py template-sync --auto-check
python3 _tools/memory-pipeline/runtime_cli.py template-sync --set-interval 7
./sync.shsync.sh will:
- Fetch the latest changes from upstream
- Use
.aikb-config.d/template-sync-state.jsonto remember when you last checked and which upstream SHA you last applied - In
--checkmode, show whether framework updates are waiting without touching tracked files - In normal mode, show you exactly what changed in the framework dirs (
AGENTS.md,_agents/,_templates/,_tools/,docs/, and selected root framework files) - Ask for confirmation before applying anything
- Re-apply your personal values (username, repo name, paths, secrets manager) automatically
- Re-copy to
~/.claude/CLAUDE.mdor~/.gemini/GEMINI.mdif you set those up during install - Commit the result
What gets updated: AGENTS.md, _agents/, _templates/, _tools/, docs/, _pending_approvals.md, sync.sh, sync-agents.sh, install.sh, .gitignore
What is never touched: _index.md, _state.yaml, personal/, projects/, work/, and any other dirs you've created
Suggested habit:
- Let agents run
python3 _tools/memory-pipeline/runtime_cli.py template-sync --auto-checkduring session setup or when you explicitly ask about updates. - Keep the default cadence at
7days unless the public template is changing quickly; use--set-interval 3for active rollout periods or--set-interval 14for a quieter cadence. - Keep actual
./sync.shapplication operator-approved, since it changes tracked framework files. - After a framework sync, re-sync downstream Codex project repos with
./sync-agents.sh.
AIKB/
├── README.md ← Human-readable overview (you're reading it)
├── _index.md ← One-line status for every project (agents read this first)
├── _state.yaml ← Time-sensitive surface: SSL expiry, incidents, recent changes
├── _pending_approvals.md ← Human sign-off queue for high-impact agent actions
├── _agents/ ← Instruction files for every AI tool
│ ├── README.md ← Setup steps and comparison table
│ ├── claude-code.md ← Source of truth for ~/.claude/CLAUDE.md
│ ├── gemini-cli.md ← Source of truth for ~/.gemini/GEMINI.md
│ ├── codex.md ← Source of truth for repo-level AGENTS.md
│ ├── cursor.md ← Paste into Cursor User Rules
│ ├── chatgpt.md ← Paste into ChatGPT Custom Instructions
│ ├── gemini.md ← Paste into Gemini Custom Instructions
│ ├── grok.md ← Paste into Grok Customise Grok
│ ├── active.md ← Live session presence (agents register here)
│ └── registry.md ← Per-tool capability notes for multi-agent sessions
├── _runtime/ ← Session event logs, memory candidates, and nightly artifacts
├── _templates/ ← Blank templates for new files
├── _tools/ ← Optional CLI helpers for search and memory pipeline
├── personal/ ← Your profile, machines, and dev environments
├── projects/ ← Your coding projects
├── work/ ← Work context (non-sensitive)
└── [your-domain]/ ← Add folders for home lab, clients, etc.
Agents follow a layered loading strategy to avoid blowing the context window:
- Read
_index.md— one row per project/system, quick orientation - Read
_state.yaml— time-sensitive items (SSL expiry, open incidents, pending tasks) - Load specific files only when the task requires them
This means a session about Project A never loads Project B's files. Context budget is preserved for actual work.
Agents update AIKB when they learn something useful for future sessions:
- A system's state changed
- A decision was made (and the rationale should be preserved)
- A gotcha or pitfall was discovered
- A task was completed or a new one identified
Updates go directly into the relevant file (no append-only corrections), followed by a commit and push. Mid-session checkpoint commits are encouraged.
If you enable runtime memory, the writing protocol also gains a non-canonical staging layer:
_runtime/events/for session observations and closeout captures_pending_approvals.mdfor human sign-off items_runtime/candidates/and related tools for review-before-promotion workflows
