agentleFS
treylomtreylom/knowledge-manager/CLAUDE.md

knowledge-manager

CLAUDE.md251 starsChanged 5 months agoMITView on GitHub

This file is read automatically by Claude Code when it opens the knowledge-manager repo. It tells Claude how the placeholder system works and how to edit skill, agent, and command files without breaking portability for other users. knowledge-manager is a deployment repo. End users clone it, run /knowledge-manager-setup, and the wizard substitutes their personal paths into the skill/agent/command files. The source tree in this repo must stay portable — meaning it must contain {{PLACEHOLDER}} tokens, not one specific user's hardcoded…

The file

We split this CLAUDE.md into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If you hardcode /home/tofu/AI/AI_Second_Brain (or any other personal path) into a skill file, every downstream user who pulls that change …

    line 9
  2. Very specific:

    Every file under skills/, agents/, and commands/ is either:

    line 15
  3. Very specific:

    Never hardcode a personal vault path: If you need to reference a vault location, use {{VAULT_PATH}}.

    line 46
  4. Very specific:

    Never hardcode a personal Obsidian CLI path: Use {{OBSIDIAN_CLI}}. Example:

    line 48
  5. Distinctive:

    Before committing any change that touches a skill, agent, or command file:

    line 63
  6. Very specific:

    If a file you want to commit is marked S, you must git update-index --no-skip-worktree <file> before the change can be staged.

    line 81
  7. Very specific:

    If you are opening a PR against knowledge-manager:

    line 131
  8. Distinctive:

    Always grep for personal paths: before pushing (see step 1 above).

    line 134

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — Claude Code project contract

This file is read automatically by Claude Code when it opens the knowledge-manager repo. It tells Claude how the placeholder system works and how to edit skill, agent, and command files without breaking portability for other users.

Repository purpose

knowledge-manager is a deployment repo. End users clone it, run /knowledge-manager-setup, and the wizard substitutes their personal paths into the skill/agent/command files. The source tree in this repo must stay portable — meaning it must contain {{PLACEHOLDER}} tokens, not one specific user's hardcoded vault path.

If you hardcode /home/tofu/AI/AI_Second_Brain (or any other personal path) into a skill file, every downstream user who pulls that change is broken until they manually reset it.


Critical: Placeholder System

Every file under skills/, agents/, and commands/ is either:

  1. Pristine source (what lives in git) — contains placeholder tokens like {{VAULT_PATH}}.
  2. Substituted local copy (what the user actually uses) — tokens replaced with real values from km-config.json, and marked git update-index --skip-worktree so the changes don't show up as dirty.

The 5 placeholders

PlaceholderReplaced withSource config field
{{VAULT_PATH}}Absolute vault path, e.g. /home/user/Documents/MyVaultstorage.obsidian.vaultPath
{{VAULT_NAME}}Basename of vault path, e.g. MyVault(derived)
{{OBSIDIAN_CLI}}Path to Obsidian CLI executable, or emptyobsidianCli.path
{{ZETTELKASTEN_ROOT}}Vault-relative folder, e.g. Zettelkastenstorage.obsidian.zettelkastenRoot
{{RESEARCH_ROOT}}Vault-relative folder, e.g. Researchstorage.obsidian.researchRoot

Placeholders in source vs after setup

# IN SOURCE (what you commit):
Save the extracted note to {{VAULT_PATH}}/{{ZETTELKASTEN_ROOT}}/AI/note.md

# AFTER /knowledge-manager-setup (local user view):
Save the extracted note to /home/user/Documents/MyVault/Zettelkasten/AI/note.md

You will sometimes read files where the substituted form is visible in your working tree because skip-worktree is active. Do not confuse that with source content. Run git show HEAD:<file> to see the committed form.


Rules for editing skill / agent / command files

  1. Never hardcode a personal vault path. If you need to reference a vault location, use {{VAULT_PATH}}. If you need to reference a vault-relative subfolder, use {{VAULT_PATH}}/{{ZETTELKASTEN_ROOT}}/... or similar composition.
  2. Never hardcode a personal Obsidian CLI path. Use {{OBSIDIAN_CLI}}. Example:
    "{{OBSIDIAN_CLI}}" create --vault "{{VAULT_NAME}}" "Zettelkasten/note.md"
  3. Single source: top-level commands/ skills/ agents/. Project-mode install = scripts/install-to-project.sh. No mirror directory in the repo.
  4. Do not edit skills/km-storage-abstraction.md's anti-pattern example to use placeholders. That file intentionally teaches users not to prefix paths with the vault name, and the literal vault-name example is pedagogical. It uses the generic string YourVaultName instead.
  5. Do not touch km-config.json. That file is gitignored and holds the user's personal values. The km-config.example.json is the template you commit to.

How to test your edits

Before committing any change that touches a skill, agent, or command file:

  1. Grep for personal paths to make sure you haven't accidentally introduced one:
    grep -rE "/home/[^/]+/|/Users/[^/]+/|C:\\\\Users\\\\" skills/ agents/ commands/
    Expected: 0 hits.
  2. Dry-run the substitution engine against a sample km-config.json:
    bash scripts/configure-vault-paths.sh --dry-run
    Inspect the output; no errors, every placeholder should be replaced.
  3. Check the skip-worktree state of files you edited:
    git ls-files -v skills/ | grep '^S'
    If a file you want to commit is marked S, you must git update-index --no-skip-worktree <file> before the change can be staged.
  4. Run the /knowledge-manager-setup wizard end-to-end in a scratch clone if you changed the substitution logic, wizard Phase 4, or the placeholder taxonomy.

Directory Layout

knowledge-manager/
├── km-config.example.json        # Template schema (committed)
├── km-config.json                # User's local config (gitignored)
├── README.md                     # End-user docs
├── CLAUDE.md                     # THIS FILE
├── AGENTS.md                     # Generic AI agent contract
├── docs/
│   ├── vault-path-configuration.md   # Technical reference
│   └── plans/                    # Design docs
├── scripts/
│   ├── _lib-config.sh            # JSON parser (Node.js-backed)
│   ├── configure-vault-paths.sh  # Substitution engine
│   ├── km-update.sh              # Update orchestrator
│   ├── install-to-project.sh     # Project-mode installer (copies commands/ skills/ agents/ + send_kakao.py)
│   ├── km_link_gate.py           # Link gate
│   ├── send_kakao.py             # KakaoTalk helper (copied by installer)
│   ├── graphrag-ops/             # tofugraph.sh + km-tools/ (GraphRAG ops)
│   └── tests/                    # Shell tests + fixtures
├── skills/                       # Skill .md files (placeholder form in HEAD)
├── agents/                       # Agent .md files
├── templates/start-here/         # 000-START-HERE seed docs (used by setup Phase 5.5; not copied by installer)
├── .agent/skills/                # Codex/Gemini-CLI skill surface (.codex-plugin/plugin.json → skills)
├── agent-office/                 # Agent Office assets
└── commands/                     # Slash command .md files

Commands for Users

Slash commandWhat it does
/knowledge-manager-setupRuns the setup wizard. Generates km-config.json, detects Obsidian CLI, then calls scripts/configure-vault-paths.sh to substitute all placeholders and lock the files with skip-worktree.
/km-updateUnlocks placeholder files, restores pristine placeholder form, git pull, re-substitutes, re-locks. Safe replacement for raw git pull.
/knowledge-managerMain knowledge-management agent (content ingestion, summarization, note creation).
/knowledge-manager-atAgent-team variant (parallel Category Lead + RALPH + DA).

For Contributors

If you are opening a PR against knowledge-manager:

  • Never commit km-config.json. It is in .gitignore for good reason.
  • Always grep for personal paths before pushing (see step 1 above).
  • Do not add a mirror directory — the top-level commands/, skills/, and agents/ are the single source, and scripts/install-to-project.sh installs them into a project.
  • When adding a new skill file, use placeholders from day one, even if you're the only person who will ever read it. Future contributors will thank you.
  • When editing an existing skill file, if you see a raw personal path left over from before the placeholder refactor, replace it with the correct placeholder token and note it in your commit message.

See AGENTS.md for the same contract in vendor-neutral form, and docs/vault-path-configuration.md for the full technical reference.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.