agentleFS
oomkapwnoomkapwn/enquire-mcp/AGENTS.md

enquire-mcp

AGENTS.md33 starsChanged 6 months agoMITView on GitHub

Notes for AI coding agents (Cursor, Claude Code, Codex, Aider, Devin, etc.) working in this repo. You are NOT a user. Users invoke enquire-mcp via MCP from their AI agents. This file is for AI agents modifying enquire-mcp's source code (PRs, refactors, bug fixes). For end-user docs see README.md and docs/. release.yml directly enumerates the 13 release-required CI checks listed below, all of which run on every PR. Branch protection enforces all 13 directly enumerated contexts (live snapshot verified 2026-10-04).…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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 repository2 other files it gives its agents.

The file

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

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Test: npm test (full unit + compiled-dist suite.

    line 12
  2. Distinctive:

    Every PR must add a CHANGELOG entry with a TL;DR blockquote + method note.

    line 95
  3. Distinctive:

    Wait for all 13 release-required CI checks to pass green before merging.

    line 109
  4. Very specific:

    Create an annotated tag on the squash-merge SHA on main (not the pre-merge branch HEAD): git tag -a vX.Y.Z <squash-merge-SHA> -m vX.Y.Z.

    line 110
  5. Very specific:

    Do NOT bump version in package.json alone: Run node scripts/check-version-consistency.mjs after — version must sync across 8 surfaces …

    line 181
  6. Distinctive:

    Do NOT make instance fixes when a class fix is needed: When an audit finds a "drift" of any kind (CLI text, inline comment, doc fragment), …

    line 187

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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

AGENTS.md

Notes for AI coding agents (Cursor, Claude Code, Codex, Aider, Devin, etc.) working in this repo.

You are NOT a user. Users invoke enquire-mcp via MCP from their AI agents. This file is for AI agents modifying enquire-mcp's source code (PRs, refactors, bug fixes). For end-user docs see README.md and docs/.

TL;DR

  • Production code: src/*.ts (TypeScript strict + noUncheckedIndexedAccess)
  • Tests: tests/*.test.ts (Vitest, 2272+ tests)
  • Build: npm run build (tsc → dist/)
  • Test: npm test (full unit + compiled-dist suite; duration is hardware-dependent)
  • Lint: npm run lint (biome — must exit 0)
  • Coverage: npm run test:coverage (13 per-file coverage floors enforced)
  • Audit: npm run check:audit (source + published-consumer dependency graphs)
  • OIA: npm run check:oia (state-driven drift scan — 12 checks)
  • Version sync: node scripts/check-version-consistency.mjs

release.yml directly enumerates the 13 release-required CI checks listed below, all of which run on every PR. Branch protection enforces all 13 directly enumerated contexts (live snapshot verified 2026-10-04). The protected test (22) context runs exactly Node 22.13.0, the literal engines.node floor; its explicit matrix label must not change. The pinned test-windows hostile-filesystem and startup-interlock job is an additional named check-run enforced transitively as a blocking prerequisite of smoke, so a Windows failure must make smoke fail rather than skip. The package-consumer context aggregates blocking Linux, Windows, and macOS packed-install lanes; mcpb-basic consumes one exact Linux-built bundle on those same three systems. In the current maintainer-approved lane, the commands above run in hosted CI: do not install dependencies or run project validation on the maintainer's MacBook. Review source and diffs locally; require green candidate CI before merging and green merged-main CI before claiming completion.

Architecture (5-minute orientation)

src/
├── cli.ts              — commander.js CLI (subcommands: serve, serve-http, first-run, setup, configure, install-model, build-embeddings, index, doctor, eval, eval-compare, install-ocr-lang, gen-token, clear-cache, clear-feedback, clear-index, clear-embeddings, query, prune)
├── cli-help.ts         — shared CLI help-text constants (drift-prevention; see "Help text rule" below)
├── first-run.ts        — deterministic preview/apply onboarding plan + stop/resume executor
├── server.ts           — MCP server bootstrap + dependency wiring
├── mcp-registration.ts — SDK-agnostic gated registration facade (no server monkey-patch)
├── initialize-instructions.ts — configuration-aware, byte-bounded MCP handshake guidance
├── tool-registry.ts    — tool registration manifest
├── tool-manifest.ts    — tool metadata (names, schemas, readOnlyHint)
├── prompts.ts          — 19 MCP prompts
├── tools/              — 47 tool implementations (read, write, search, media, meta)
├── vault.ts            — Obsidian vault filesystem layer + privacy filter
├── fts5.ts             — SQLite FTS5 BM25 index
├── embed-db.ts         — embedding storage (int8-quantized BLOBs)
├── embeddings.ts       — Hugging Face transformer.js loader
├── embed-pipeline.ts   — chunking + embedding build pipeline
├── embed-sync.ts       — bulk embedding sync (fail-soft runtime / strict evidence mode)
├── hnsw.ts             — HNSW vector index wrapper
├── rrf.ts              — reciprocal-rank-fusion (orchestration in tools/search.ts)
├── watcher.ts          — chokidar filesystem watcher → incremental re-index
├── http-transport.ts   — streamable HTTP MCP transport (Express)
├── bases.ts            — Obsidian Bases DSL parser + executor
└── doctor.ts           — health check (color-coded ✓/⚠/✗)

scripts/
├── oia-walk.mjs                       — state-driven drift scan (12 checks)
├── build-pages.mjs                    — deterministic Pages landing + TypeDoc composite
├── check-per-file-coverage.mjs        — per-file branch floor enforcement
├── check-version-consistency.mjs      — version sync across 8 surfaces
├── check-changelog-coverage.mjs       — CHANGELOG claims vs reality
├── bump-test-count.mjs                — recompute the source-test count across the 21 declared surfaces

tests/
├── *.test.ts                          — Vitest unit tests
├── docs-consistency.test.ts           — invariant: README/package.json claims match reality
├── cli-parity.test.ts                 — invariant: serve and serve-http have identical shared-flag help text
├── k1-class-invariant.test.ts         — structural guard for the K-1 saga
└── ...

docs/
├── api.md              — tool catalog
├── COMPARISON.md       — TOP-1 product case + evidence-bound proof surface
├── QUICKSTART.md       — onboarding
├── benchmarks.md       — retrieval-quality benchmarks
├── http-transport.md   — remote MCP transport guide
└── api-reference/      — auto-generated TypeDoc (do NOT edit by hand)

site/                   — version-controlled GitHub Pages landing source

Conventions

TypeScript

  • Strict mode + noUncheckedIndexedAccess. Index access (arr[i]) returns T | undefined.
  • TSDoc (/** ... */) on every exported symbol with @param / @returns / @example. Drift between TSDoc and implementation is the α-class antipattern (caught by CLAUDE.md rule + invariant tests).
  • No any — use unknown + narrowing.
  • Imports: alphabetical, grouped (node → third-party → local).

Tests

  • Vitest. Every fix needs a positive and a negative-control test (rule since v3.6.4). A test that always passes proves nothing.
  • Invariant tests (tests/*-invariant.test.ts, tests/cli-parity.test.ts, tests/docs-consistency.test.ts) are structural defenses. Adding a new behavior often requires extending an invariant.
  • Per-file branch coverage floors live in scripts/check-per-file-coverage.mjs. Lowering a floor without uplift work is not allowed.

CLI help text rule

Every flag that BOTH serve and serve-http accept must pull its help text from a constant in src/cli-help.ts — not an inline string literal. The cli-parity.test.ts invariant fails the build if a shared flag has different help text. Adding a new shared flag = add a _HELP constant first.

CHANGELOG

  • Every PR must add a CHANGELOG entry with a TL;DR blockquote + method note.
  • Format: ## [version] — date headers, Keep-a-Changelog style.
  • "N of N fixed" claims require a structural test gate (rule since v3.6.4). Don't ship overclaims.

Commits

  • Co-Author trailer: Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> (or the model you are).
  • Conventional-commit-ish style preferred but not strictly enforced. Be descriptive.
  • One commit per logical change. Squash-merge to main via PR.

PRs

  • Title under 70 chars.
  • Body: ## Summary (bullets) + ## Test plan (markdown checklist).
  • Wait for all 13 release-required CI checks to pass green before merging.
  • Create an annotated tag on the squash-merge SHA on main (not the pre-merge branch HEAD): git tag -a vX.Y.Z <squash-merge-SHA> -m vX.Y.Z. The release preflight rejects lightweight tags.

Commands cheat sheet

# Setup
npm ci                              # install (uses package-lock.json)
npm run build                       # tsc → dist/

# Test
npm test                            # full unit + compiled-dist suite
npm test -- --reporter=verbose      # detailed output
npm test -- tests/cli-parity        # run one file

# Lint / format
npm run lint                        # biome check (must exit 0)

# Coverage
npm run test:coverage               # full suite + coverage-summary.json
node scripts/check-per-file-coverage.mjs  # enforce per-file floors

# State-driven audit (catches stale docs / drift)
# IMPORTANT: Check 6 (coverage drift) reads coverage/coverage-summary.json.
# On dirty dev trees with stale summary, it false-positives. Always run
# coverage IMMEDIATELY BEFORE OIA locally (rule since v3.8.0-rc.18 L-OIA-1):
npm run test:coverage && npm run check:oia   # local dev order
node scripts/oia-walk.mjs --allow   # override documented deferrals; Vitest focus/scan findings still fail

# Version consistency
node scripts/check-version-consistency.mjs  # checks 8 surfaces

# Supply-chain audit (root lockfile + registry-consumer resolution)
npm run check:audit

# CHANGELOG coverage gate
node scripts/check-changelog-coverage.mjs

# Smoke test (synthetic vault)
node scripts/smoke.mjs

CI checks (13 direct release gates + transitive Windows; all 13 branch-protected)

Directly release-required (all run on PRs; release.yml blocks publication unless every listed gate passed on the tagged SHA):

  1. lint — biome check
  2. test (22) — full suite plus native SQLite/FTS probe on exact Node 22.13.0 (engines.node floor)
  3. test (24) — full suite on Node 24
  4. smoke — JSON-RPC smoke against synthetic vault
  5. audit — source + published-consumer dependency audit (prod moderate+, dev high+)
  6. coverage — global + per-file branch floors
  7. version-consistency — 8-surface version sync
  8. docs — TypeDoc generation
  9. oia — state-driven drift scan
  10. protocol-conformance — Linux + Windows aggregate for official client v2 across modern/legacy stdio and stateless/stateful HTTP
  11. package-consumer — aggregate packed-install/type/runtime/privacy gate across Linux, Windows, and macOS
  12. mcpb-basic — one Linux-built Basic bundle, logical inventory/SBOM/notices, and official-client verification across Linux, Windows, and macOS
  13. docker — image build plus bounded CLI and tools/list introspection smoke

Additional unprotected checks:

  • test-macos is the only continue-on-error advisory job.
  • test-windows is fail-capable and unprotected by its own name, but transitively blocks protected/release-required smoke.
  • protocol-conformance (linux|windows) are fail-capable matrix legs aggregated by the directly release-required protocol-conformance context.
  • package-consumer (linux|windows|macos) are fail-capable matrix legs aggregated by the directly release-required package-consumer context.
  • mcpb-basic-package and mcpb-basic (linux|windows|macos) are fail-capable producer/consumer jobs aggregated by the directly release-required mcpb-basic context.
  • GitHub's default CodeQL setup runs two separate unprotected analyses: Analyze (actions) and Analyze (javascript-typescript).

Live branch-protection snapshot (verified 2026-10-04): all 13 contexts above, enforce_admins:true, required linear history, and no required approving-review configuration. Re-query GitHub before relying on this snapshot.

Do NOT

  • Do NOT modify shared CLI help strings inline. Lift to src/cli-help.ts first. The cli-parity.test.ts invariant fails inline drift between serve and serve-http.
  • Do NOT bump version in package.json alone. Run node scripts/check-version-consistency.mjs after — version must sync across 8 surfaces (package.json, package-lock.json root + packages[""], src/index.ts, CHANGELOG latest heading, server.json version + packages[0], and mcpb/manifest.json).
  • Do NOT skip CI hooks (--no-verify) without explicit user instruction. Investigate the hook failure root cause.
  • Do NOT force-push to main. Main is branch-protected. All changes go through PR + every directly enumerated release check.
  • Do NOT tag the pre-merge branch SHA or create a lightweight release tag. After gh pr merge --squash, create an annotated tag on the squash-merge SHA on main. Rule since v3.7.15 (Assert tag is on main guard); annotated-only enforcement starts with v4.0.0-rc.2.
  • Do NOT edit docs/api-reference/ — it's auto-generated TypeDoc output. Edit TSDoc in src/ instead.
  • Do NOT add // current X% inline comments without commitment to maintain. OIA check 6 catches drift > 1pp against coverage-summary.json. Either keep current OR remove the annotation.
  • Do NOT make instance fixes when a class fix is needed. When an audit finds a "drift" of any kind (CLI text, inline comment, doc fragment), run a full-surface sweep across the same surface type BEFORE the per-instance fix. Rule since v3.8.0-rc.11.
  • Do NOT add documentation files (*.md) unless explicitly requested. README, CHANGELOG, CLAUDE.md, AGENTS.md, llms.txt are the canonical project-level docs.

Helpful entrypoints when you're new

  1. Want to add a new MCP tool? Read src/tools/read.ts for a representative example. Add to src/tool-manifest.ts. Register in src/tool-registry.ts. Add to docs/api.md. Add tests.
  2. Want to fix a retrieval bug? Start in src/tools/search.ts (retrieval + rerank orchestration) and src/rrf.ts (rank fusion). The unit tests in tests/rrf.test.ts + tests/search.test.ts show the contracts.
  3. Want to extend the watcher? src/watcher.ts + tests/watcher.test.ts. Note: chokidar requires a 50ms warmup after w.start() before the first file write in tests (rule since v3.7.15 — see W-FLAKE-1/2 history). v3.9.0-rc.1+ added setOcrPdfs(enabled, langs?, maxPages?) for OCR-on-watch; v3.9.0-rc.2+ added attachHnsw(hnsw, rowsByLabel) for HNSW in-memory live update — both are late-binding methods called by server.ts after attachEmbed().
  4. Want to add a CHANGELOG entry? Follow the format in existing entries. TL;DR blockquote at the top, ### sections per finding, ### Stats at the bottom.

Project-specific style

  • Methodology context (sprint goals, anti-patterns, rules accumulated through rc cascades) lives in CLAUDE.md. Read it before non-trivial PRs.
  • We document explicit rejections of auditor recommendations inline in the CHANGELOG (rule since v3.5.14 L-2).
  • Tombstone vs current-claim comments: legitimate history (// v3.6.1 CRIT-2 — was X) is preserved. Current-state claims (// current behavior:, // since vA.B.C) are maintenance burden — prefer to remove if not strictly needed.
  • Empirical validation > theoretical: when an auditor flags a defense as "weak", the burden is on us to demonstrate empirically that the alternative is better (e.g., v3.5.14 L-2 optional-dep removal — rejected with bench data).

Where to ask

  • Bug? Open an issue. Tag the version (v3.7.20, v3.8.0-rc.11, etc.).
  • Question? Discussions tab.
  • Security? See SECURITY.md for disclosure policy. Don't open a public issue for vulnerabilities.

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.