agentleFS
MichaellivMichaelliv/napkin/AGENTS.md

napkin

AGENTS.md428 starsChanged 2 months agoMITView on GitHub

Local-first CLI for Obsidian vaults. Operates directly on markdown files — no Obsidian app required. Designed as a memory system for AI agents using progressive disclosure. .napkin/ holds config. Content lives in the project directory:

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

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

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Output triple: Every command supports --json, --quiet, and human-readable output

    line 52
  2. Distinctive:

    Fingerprint caching: search and overview cache their results keyed by vault file mtimes — any file change invalidates.

    line 55
  3. Very specific:

    Import and register in src/main.ts as a Commander subcommand

    line 76
  4. Very specific:

    Use the output() helper for triple output

    line 77
  5. Very specific:

    Add tests in src/commands/<name>.test.ts

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.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
AGENTS.md

napkin

Local-first CLI for Obsidian vaults. Operates directly on markdown files — no Obsidian app required. Designed as a memory system for AI agents using progressive disclosure.

Commands

bun run dev -- <command>     # Dev
bun test                     # Tests
bun run check                # Biome lint + format

Architecture

  • src/main.ts — Commander entry point, global --json/--quiet/--vault/--copy flags
  • src/commands/ — One file per command group
  • src/core/tokenizer.ts — Overview tokenizer (noise stripping, stopwords, term counts)
  • src/templates/ — Vault template definitions (coding, personal, research, company, product)
  • src/utils/output.ts — Chalk output helpers, triple output (json/quiet/human)
  • src/utils/exit-codes.ts — Standardized exit codes
  • src/utils/vault.ts — Vault discovery (walks up from cwd looking for .napkin/)
  • src/utils/vault-internals.ts — Owner of napkin-internal files + skip directories
  • src/utils/files.ts — File listing, resolution (wikilink-style name or exact path)
  • src/utils/frontmatter.ts — YAML frontmatter parse/set/remove
  • src/utils/config.ts — Unified config (load/save/update, syncs to .obsidian/)
  • src/utils/markdown.ts — Extract headings, tasks, tags, links from markdown
  • src/utils/fingerprint.ts — Whole-vault mtime fingerprint (keys both caches)
  • src/utils/search-cache.ts — Search index cache
  • src/utils/overview-cache.ts — Overview result cache (fingerprint + options key)
  • skills/ — Agent skills shipped in the npm package: distill (conversation → vault notes) and tend (periodic vault upkeep)

Vault Structure

.napkin/ holds config. Content lives in the project directory:

project/
  .napkin/                  # napkin config + caches
    config.json             # Unified config (syncs to .obsidian/)
    search-cache.json       # Auto-managed, safe to delete
    overview-cache.json     # Auto-managed, safe to delete
  .obsidian/                # Obsidian config (auto-generated)
  NAPKIN.md                 # Level 0 context note
  decisions/                # Template-defined dirs
  architecture/
  Templates/                # Note templates
  src/                      # Project source (not in vault)

Key Patterns

  • Output triple: Every command supports --json, --quiet, and human-readable output
  • Vault auto-detect: Walks up from cwd looking for .napkin/ directory
  • .napkin/ holds config + caches: Vault content lives in the project root; .napkin/ holds config.json and the auto-managed search/overview caches
  • Fingerprint caching: search and overview cache their results keyed by vault file mtimes — any file change invalidates; caches are safe to delete
  • Search engine: @shift-labs/ferrosearch — native, MiniSearch-compatible (index format included); minisearch remains a devDependency as the cache-migration test oracle
  • File resolution: positional <file> or --file resolves by name (like wikilinks), --path requires exact path from vault root
  • No Obsidian dependency: Pure file-system operations on markdown files
  • Progressive disclosure: overview → search → read (4 levels, L0-L3)
  • NAPKIN.md: Level 0 context note, rendered at top of overview
  • Templates: napkin init --template <name> scaffolds vault structure + note templates

Progressive Disclosure

LevelCommandWhat it does
L0NAPKIN.mdAlways-loaded context (rendered in overview)
L1napkin overviewVault map with search-validated domain keywords per folder
L2napkin search <query>BM25 + backlinks + recency ranked results with snippets
L3napkin read <file>Full file content

Adding a New Command

  1. Create src/commands/<name>.ts
  2. Export an async function with (args, options: OutputOptions) signature
  3. Import and register in src/main.ts as a Commander subcommand
  4. Use the output() helper for triple output
  5. Add tests in src/commands/<name>.test.ts

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.