conventions-mcp: Instructions file for Claude Code

AGENTS.md

conventions-mcp AGENTS.md is an instructions file for Claude Code, Codex, OpenCode from FedgeNo/conventions-mcp. It costs 6,372 tokens per session, scanned B, original, MIT.

Instructions for a local memory server that stores an agent's notes in SQLite and finds them using both words and meaning. MCP is a standard way for an AI agent to connect to external tools and data.

In plain words
What is it for?
It helps maintain the memory server, its database and search code, and the instructions for connecting it to supported AI clients.
Why use it?
It gives coding agents the repository's architecture and operating rules, reducing the chance that changes break storage, search, file locations, or client setup.

Instructions file for Claude CodeCodexOpenCode

Written for Claude Code and Codex and OpenCode: SessionStart hook event, but also the file is AGENTS.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is FedgeNo/conventions-mcp's own configuration. It tells Claude Code, Codex and OpenCode how to work on conventions-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything conventions-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to FedgeNo/conventions-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/FedgeNo/conventions-mcp/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/FedgeNo/conventions-mcp

Made for: Claude Code, Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for conventions-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/fedgeno/conventions-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/fedgeno/conventions-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/fedgeno/conventions-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/fedgeno/conventions-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for conventions-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/fedgeno/conventions-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/fedgeno/conventions-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 6,372 This file is loaded in full into every session.
When invoked 6,372 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.06372 $0.06372
Opus 5.5 $0.02549 $0.02549
Sonnet 5.5 $0.01274 $0.01274
Haiku 4.5 $0.00637 $0.00637

Measured 1mo ago against content hash dba2635855bb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

conventions-mcp AGENTS.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

Three hooks, configured in `~/.claude/settings.json` (not this repo — see
AGENTS.md · 443 lines

How it starts

The opening of the file, as written. The whole thing — 443 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — Conventions MCP

A personal memory MCP server: local SQLite storage, local embeddings, hybrid (vector + keyword) search, MCP over stdio. See README.md for the pitch and setup steps. This file is guidance for any coding agent working on the server's own code, plus client-specific instructions for wiring the finished server into supported clients.

Architecture

  • src/db.js — SQLite (better-sqlite3) + sqlite-vec (vector search) + FTS5 (keyword search). One thoughts table; FTS5 stays in sync via triggers; sqlite-vec does not, so deleteThought deletes both rows explicitly in one transaction. hybridSearch merges vector + FTS results with reciprocal rank fusion (1 / (k + rank)), not a raw score blend. DB_PATH (exported) resolves via MEMORY_DB_PATH, else defaultDbPath(): ./data/memory.db in a git checkout (detected by a sibling .git directory — npm never publishes one), or ~/.conventions-mcp/memory.db otherwise, since an npm/npx install's own directory usually isn't user-writable and gets wiped on upgrade. getDb() creates that directory if missing, so nothing upstream needs to mkdir first. The DB runs in WAL mode with synchronous=FULL, a bounded autocheckpoint, and a busy timeout. The WAL is part of the durable database state; writes do not force a checkpoint after commit because that can fail after a successful write or interfere with concurrent readers. Graceful shutdown checkpoints and closes the database. The database directory and files are private to the user on POSIX systems. backupDatabase uses SQLite's online backup API, verifies the snapshot, and publishes it atomically without overwriting an existing file. Existing database parents must already be private; never chmod a caller's shared directory automatically. Backup and restore staging files are created exclusively with mode 0600 before SQLite writes any records. app_metadata records the storage schema, embedding model, and dimension. Unknown non-empty legacy stores are rejected until migrate-storage creates a verified backup and re-embeds every row; declared incompatible formats are never silently adopted. restoreDatabase requires a stopped service (no WAL/SHM sidecars), validates the source and current-format metadata, makes a non-overwriting online rollback backup, stages the source beside the live database, and uses same-filesystem renames with rollback on publication failure. Source staging uses SQLite's backup API so committed source WAL records are included. Initialization caches a connection only after schema/format checks succeed, and closes failed connections on every error path.
  • src/load-env.js — side-effect module loading ~/.conventions-mcp/.env into process.env (without overriding anything already set), for entry points invoked without Node's own --env-file flag — the installed conventions-mcp bin and the hook scripts run standalone. Import it FIRST in any file that reads process.env at module-load time, before importing db.js; ES module static imports evaluate in file order, so a leading import guarantees this runs before those reads. Nothing in this codebase requires an env var; optional database, model-cache, transport, and timeout settings are listed in .env.example.
  • src/embeddings.js — local embedding model (Xenova/bge-small-en-v1.5, quantized), downloaded once, loaded lazily on first call, and held resident for the server process's lifetime. Its cache is persistent at ~/.conventions-mcp/models unless MEMORY_MODEL_CACHE_PATH overrides it, rather than living inside an npm installation that upgrades may replace. No GPU or hosted inference service. Concurrent callers share initialization; a rejected initialization is cleared so a later call can retry without restarting the process. The tracked .npmrc sets onnxruntime-node-install-cuda=skip; do not remove it unless GPU inference is deliberately implemented and tested, because ONNX Runtime otherwise downloads an unused CUDA artifact on Linux x64.
  • Classification (type/topics/projectScoped) happens in the calling agent, not the server — capture_thought/update_thought's zod inputSchema in server.js (CLASSIFICATION_FIELDS) carries the taxonomy via field descriptions, and the tool description instructs the caller to fill them in from the conversation the thought came from. The caller only judges whether a thought is scoped to the current project (projectScoped, defaulting to false/global unless the rule is specific to the current working directory) — it never has to name the project itself; see withProjectStamp in server.js. There is no server-side classification step and no network call anywhere in the capture pipeline.
  • db.js's listRules({ project }) — a plain deterministic SQL filter (project IS NULL OR project = ?), no embeddings, no LLM call. Backs the list_rules MCP tool — cheap enough to call on every turn.
  • hooks/hooks.json — Codex SessionStart and PreToolUse lifecycle configuration. The first runs the same fixed-size instruction used by Claude Code; the second denies every other tool until the agent calls list_rules. This avoids placing a potentially truncated rule set in hook output and reuses the same marker state on both clients.
  • bin/session-rules.js (SessionStart hook), bin/prompt-reminder.js (UserPromptSubmit hook), and bin/pre-tool-check.js (PreToolUse hook, matcher *) — see "Standing-rule hooks" below. None touch the database directly. session-rules.js emits a short, fixed-size instruction telling the model to call the list_rules MCP tool itself; embedding the rule content directly in hook output doesn't scale — a large enough stored rule set gets silently truncated to a small preview before it ever reaches the model. pre-tool-check.js is the enforcement layer: advisory instructions turned out to be ignorable in practice, so it denies any other tool call until list_rules has run this session, tracked by a marker file. The gate fires once per session start, not once per turn — session-rules.js re-arms it on every start, resume, compaction, or /clear, including when a resumed conversation retains an earlier rule load. prompt-reminder.js no longer touches the gate at all; it just re-anchors, every turn, "follow the loaded conventions, and capture only durable rules intended to govern future sessions or repeated work." Task-specific directions, temporary choices, status/history, one-job commands, and descriptions of how an individual job was completed remain in conversation context. Each script has a .cmd sibling (session-rules.cmd, prompt-reminder.cmd, pre-tool-check.cmd) that Windows settings.json entries point at — see "Platform support" below.
  • src/server.js — registers the seven MCP tools (capture_thought, update_thought, delete_thought, search_thoughts, list_thoughts, list_rules, thought_stats) and connects over stdio by default or localhost-only Streamable HTTP when MCP_TRANSPORT=http. HTTP exposes a database-backed /healthz readiness check and bounds retained sessions with MCP_HTTP_MAX_SESSIONS and MCP_HTTP_SESSION_IDLE_MS. Both transports use src/shutdown.js to bound graceful cleanup with MCP_SHUTDOWN_TIMEOUT_MS; failures are logged and set a failing process status while database cleanup is still attempted. update_thought is a real SQL UPDATE (preserves the row's id), not delete-then- reinsert — it re-embeds against the new content and takes fresh classification fields from the caller, then replaces the row's thoughts_vec entry in the same transaction (vec0 has no in-place UPDATE, so that part is delete+insert internally, unlike the thoughts/FTS side which is a real UPDATE synced by the existing trigger). withProjectStamp converts the caller's projectScoped boolean into a deterministic project field before storage — see src/project.js below for why that split exists. list_rules and list_thoughts render each row by its #id (list_rules ordered by id ascending), so the ids the user sees are exactly the ones they pass back to update_thought/delete_thought. createConventionsServer and runHTTPServer accept an optional embedding function for deterministic tests; production entry points always use the real local model. HTTP integration tests must inject a 384-value embedding rather than downloading the model, so the suite is reproducible offline. HTTP startup must reject listener errors rather than reporting success. Unknown or expired session IDs return HTTP 404 to signal reinitialization; missing required session IDs return HTTP 400. Active tool calls suspend idle expiry. Shutdown drains both handlers and HTTP responses before closing transports; forced closure cancels pending writes. Roots resolution has a one-second deadline and caches the scope until a roots-change notification, or for 30 seconds after a failed lookup.
  • src/project.js — getCurrentProject(cwd) derives a stable project id from the normalized absolute path prefixed by path:, preserving separators. Legacy hyphen-based IDs require explicit migrate-project ownership assignment with a verified backup; never infer ownership of a colliding ID. Used to stamp captures and to filter list_rules, so "which project" is a deterministic lookup rather than free-text matching against whatever string an LLM happened to write.
  • bin/cli.js — the npm "bin" entry (package.json's "bin": { "conventions-mcp": "bin/cli.js" }), so an installed copy resolves on PATH with no path management needed. Dispatches by subcommand (init-db, backup, warmup, doctor, codex-project-header, the two hook commands, --help, --version, or nothing → starts the MCP server) via dynamic import() of the same modules the npm run scripts already use — each does its work as a top-level side effect on import, so no refactor into exported functions was needed just for this. codex-project-header prints the current working directory as the X-Conventions-Project JSON header expected by Codex's http_headers_helper. No config bootstrap step — nothing here requires a .env to exist.
  • src/doctor.js — non-downloading operational diagnostics used by the doctor CLI command. It checks the supported Node.js floor, opens and quick-checks SQLite, verifies the vec0 table and data permissions, and reports whether the configured model cache looks complete. A missing model is a warning; runtime/storage failures make the command exit nonzero.

Read the full file on GitHub · 443 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +17 lines · +189 tokens per session dba2635855bb
  2. 1mo ago Changed · +51 lines · +733 tokens per session 7375fc4fc6d4
  3. 2mo ago First seen · 375 lines · 5,450 tokens per session scan B fb33c0390873

Subscribe to this mod's changes

conventions-mcp AGENTS.md is an instructions file published in the GitHub repository FedgeNo/conventions-mcp (0 stars, last pushed 1mo ago), licensed MIT. It adds 6,372 tokens to every session, about $0.0255 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-08.

Related

conventions-mcp AGENTS.md compared with instructions from other repositories

conventions-mcp AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
conventions-mcp AGENTS.mdFedgeNo/conventions-mcpInstructions file01mo agoMITB6,372Claude Code, Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode