{
  "markdown": "# kb — the shared brain\n\nA single, plain-text knowledge base that every coding agent (Claude Code, Codex,\nHermes, OpenClaw, …) and every repo reads from and writes to — the **root source\nof truth for agent memory**. Write a fact once; every agent on every device uses it.\n\nPublic repo: general, durable, *public-facing* knowledge only — never secrets,\ntokens, internal hosts, or anything you wouldn't post on a blog.\n\n## Design\n\nSimple and hackable (Zettelkasten-style): plain markdown, no database (agents\n`grep` it); **atomic notes** (one fact per file); **index-first** (`MEMORY.md`\nloaded before anything else); **linked** via `[[wikilinks]]` + `tags` (browsable\nas a graph in Obsidian); **self-healing** via the `DREAM.md` consolidation pass.\n\n## Structure\n\n```\nkb/\n├── AGENTS.md      ← canonical protocol for ALL agents (read/write/dream rules)\n├── CLAUDE.md      ← thin pointer to AGENTS.md\n├── DREAM.md       ← memory-consolidation (\"dream\") protocol\n├── MEMORY.md      ← master index, one line per note — load first\n├── raw/           ← capture inbox (raw/inbox/<date>.md) + ground-truth sources\n├── memory/        ← the OKF v0.1 bundle: notes nested under <group>/…\n│   ├── index.md   ← generated OKF listing (okf_version: \"0.1\") — run `kb gen`\n│   ├── log.md     ← generated change history (newest-first)\n│   ├── _TEMPLATE.md  ← the note standard\n│   ├── user/ feedback/ reference/ projects/  ← memory-layer groups\n│   └── topics/<domain>/  ← cloudflare, llm-agents, web, ci, workflow, standards\n├── skills/        ← kb-memory, kb-dream (installable Claude Code skills)\n├── scripts/       ← bootstrap / install / kb CLI / sync / lint / okf_gen.py\n├── viz.html       ← generated self-contained graph viewer — run `kb viz`\n└── .agent/        ← state.json (ingested files + tasks)\n```\n\nThis repo **is a conformant [OKF v0.1](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md) bundle** — `memory/` is the bundle root; each concept is one `.md` carrying `type` (an OKF custom field). `index.md`/`log.md`/`viz.html` are generated; re-run `kb gen` (or `kb viz` to also open the viewer) after writing notes. See `tech-okf-bundle` note / OKF layout for the full alignment.\n\nEvery note follows `memory/_TEMPLATE.md` and must pass `kb lint`. Format spec in\n`AGENTS.md`.\n\n## How it works\n\n- **Read in:** `kb index` (= `MEMORY.md`), open the relevant notes; fetch a note's\n  `sources:` (`llms.txt`) for deeper detail.\n- **Write out:** unsure it's durable → `kb capture \"note\"` (lands in `raw/inbox/`);\n  known keeper → a standard note in `memory/<group>/…`. Then\n  `kb lint && kb gen && kb sync` (regenerate the OKF `index.md`/`viz.html`).\n- **Dream:** periodically (or `/loop`) run `DREAM.md` — it ingests the inbox + raw\n  sources into clean notes, dedupes, refreshes stale notes from `sources:`, rebuilds\n  the index, and syncs.\n\n## Install (any machine)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/duyet/kb/main/scripts/bootstrap.sh | bash\n```\n\nMinimal footprint — the changes to your machine are: **link the skills** into\n`~/.claude/skills`, **wire the reflex** into each installed agent's global config\n(a small marked, removable block), and a **PATH line** you add for the `kb` CLI\n(the script stays in the repo, nothing is copied):\n\n```bash\nexport PATH=\"$HOME/kb/bin:$PATH\"     # add to ~/.zshrc or ~/.bashrc\n```\n\n**Wiring is multi-agent and adaptive** — it only touches agents that are present:\nClaude Code (`~/.claude/CLAUDE.md`+`AGENTS.md`), Codex (`~/.codex/AGENTS.md`),\nopencode (`~/.config/opencode/AGENTS.md`), hermes (`~/.hermes/SOUL.md`), openclaw\n(`~/.openclaw/CLAUDE.md`). Toggle with `kb wire on|off`; skip at install with\n`KB_NO_WIRE=1`.\n\nNo cron, no other edits. Opt in to background sync with `kb autosync on`. Remove\neverything with `scripts/uninstall.sh` (unlinks + unwires; repo untouched). Env:\n`KB_DIR`, `KB_REPO`, `CLAUDE_SKILLS_DIR`. Verify: `kb root`.\n\n## CLI\n\n```bash\nkb capture \"rough note\"   # → raw/inbox/<today>.md\nkb ingest <file>          # add a source doc to raw/\nkb index | kb lint | kb sync | kb dream | kb root\nkb autosync on|off|status # opt-in */15min sync cron\n```\n\nSkills `kb-memory` (read/write protocol) and `kb-dream` (consolidation) install to\n`~/.claude/skills/` and resolve the KB via `$KB_DIR` / `kb root`, so they work\nwherever kb is cloned. They're **canonical in this repo** — install via the symlink\ninstaller (auto-updates on `git pull`). To share a skill without shipping your\nmemory, mirror `skills/` into a separate plugins repo (path-agnostic via `KB_DIR`).\n\n## Quality gates (lint + secret scan)\n\n`scripts/lint.sh` validates every note (required frontmatter, `name`==filename,\ntype-token filename prefix, `[[wikilink]]` resolution, `MEMORY.md` index\ncoverage) and runs the public-repo secret/PII scan from `AGENTS.md` §3 over the\nnotes, `raw/inbox/`, and `MEMORY.md`. Run it directly with `kb lint` (or\n`KB_DIR=$PWD bash scripts/lint.sh`).\n\nTwo enforcement points share it:\n\n- **Local pre-commit hook** (committed, opt-in per clone):\n\n  ```bash\n  git config core.hooksPath githooks\n  ```\n\n  `githooks/pre-commit` then runs the lint and blocks any commit that fails.\n\n- **CI** — `.github/workflows/lint.yml` runs `scripts/lint.sh` and\n  `gitleaks detect --no-git --config .gitleaks.toml` on every push and PR.\n\n## Website\n\nThe knowledge base website at [kb.duyet.net](https://kb.duyet.net) is rendered\nby the [`apps/kb/`](https://github.com/duyet/monorepo/tree/master/apps/kb) app\nin the monorepo, which consumes this repo as a git submodule. No website code\nlives here — only `.md` knowledge files and agent skills.\n\n## Scope\n\nPublic, general, durable knowledge only. **Never** here: secrets, SSH hosts,\ninternal/employer-confidential details, anything user-private — those stay in a\nrepo's local kb or the agent's private per-project memory.\n",
  "bytes": 5844,
  "sha": "cb12a7153045f158429894caec9b0e4afc9116c9c8c971f7692e21b174a1f12a",
  "repo_slug": "duyet/kb",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_duyet_kb_memory_index_md_72116603/readme"
}