mcp-multi-root-git AGENTS.md

Repository instructions for developing and onboarding contributors to the mcp-multi-root-git project. The project is an MCP server that provides Git tools for repositories with multiple roots, meaning multiple project directories.

In plain words
What is it for?
Use it to understand the project structure, change its interfaces safely, follow development and commit conventions, and run validation or CI checks.
Why use it?
It points developers to the canonical documentation and explains where implementation, contracts, validation, and publishing details are defined.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/rethunk-ai/mcp-multi-root-git/agents-md
Clone the repo
git clone --depth 1 https://github.com/Rethunk-AI/mcp-multi-root-git

Made for: Codex, OpenCode.

Per session 3,775 This file is loaded in full into every session.
When invoked 3,775 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.03775 $0.03775
Opus 5 $0.01887 $0.01887
Sonnet 5 $0.00755 $0.00755
Haiku 4.5 $0.00378 $0.00378

Measured yesterday against content hash b607e547b639, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-multi-root-git AGENTS.md scanned grade A with 0 findings 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 95 lines

How it starts

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

AGENTS.md — LLM + dev onboarding

IDEs injecting this as context: do not re-link from rules.

Package: @rethunk/mcp-multi-root-git. MCP stdio server. Entry src/server.ts → FastMCP + registerRethunkGitTools. Build output dist/server.js (publish ships full dist/).

Canonical docs — do not duplicate:

Implementation map

File Symbols
src/server.ts FastMCP + roots: { enabled: true }; MCP_JSON_FORMAT_VERSION; registerRethunkGitTools
src/server/json.ts jsonRespond() (minified, no envelope), readMcpServerVersion(), spreadWhen, spreadDefined
src/server/git.ts gateGit, spawnGitAsync (optional { timeoutMs, signal, env }), asyncPool, GIT_SUBPROCESS_PARALLELISM, GIT_SUBPROCESS_TIMEOUT_MS, gitTopLevelAsync, gitRevParseGitDirAsync, gitRevParseHeadAsync, createTopLevelMemo, createRevParseHeadMemo, buildFilteredGitEnv, parseGitSubmodulePaths, hasGitMetadata, gitStatusSnapshotAsync, gitStatusShortBranchAsync, fetchAheadBehind, isSafeGitUpstreamToken, gitFailureDetail
src/server/roots.ts requireGitAndRootsAsync (fan-out root resolution: string / string[] / "*", bounded-pool toplevel resolution), requireSingleRepo (workspaceRoot), resolveRootPathListAsync, RootPickArgs — shared tool preludes; session root resolution
src/server/presets.ts PRESET_FILE_PATH, loadPresetsFromGitTop, presetLoadErrorPayload, applyPresetNestedRoots, applyPresetParityPairs; Zod schemas must match git-mcp-presets.schema.json
src/server/schemas.ts WorkspacePickSchema (single-repo: workspaceRoot), RootPickSchema (fan-out: polymorphic root), MAX_ROOT_PATHS (256)
src/server/inventory.ts InventoryEntryJson, MAX_INVENTORY_ROOTS_DEFAULT, MAX_BRANCH_STATUS_LINES_DEFAULT, makeSkipEntry, collectInventoryEntry
src/server/git-refs.ts isProtectedBranch, PROTECTED_BRANCH_NAMES_TEXT, isSafeGitRefToken, isSafeGitRangeToken, isSafeGitAncestorRef, isSafeGitCommitIsh; getCurrentBranch, getRefSha, resolveRef, isWorkingTreeClean, isFullyMergedInto, isContentEquivalentlyMergedInto, commitListBetween; listWorktrees, worktreeForBranch; inferRemoteFromUpstream; conflictPaths
src/server/error-codes.ts ERROR_CODES (centralised error-code registry — the exact error field strings on the wire)
src/server/tools.ts registerRethunkGitTools — dispatches to register* below; selectToolRegistrars(envValue, registrars) — pure parse/filter fn for RETHUNK_GIT_TOOLS (reads env inside registerRethunkGitTools, not at module scope); TOOL_REGISTRARS ordered array
src/server/git-status-tool.ts git_status
src/server/git-inventory-tool.ts git_inventory — optional compareRefs: { left, right } ahead/behind between arbitrary local refs
src/server/git-parity-tool.ts git_parity
src/server/list-presets-tool.ts list_presets
src/server/git-log-tool.ts git_log — v3 JSON shape: sha (full), workspaceRoot, no sha7/ageRelative, optional email; optional follow (exactly one paths entry)
src/server/git-grep-tool.ts git_grep — read-only fan-out pickaxe history search (git log -S/-G via required pickaxe, commits[] per root); content mode removed in v6
src/server/git-diff-summary-tool.ts git_diff_summary — structured token-efficient diff viewer; read-only
src/server/git-diff-tool.ts git_diff — raw scoped diff text; read-only
src/server/git-show-tool.ts git_show — inspect commit message + diff or file content at a ref; read-only
src/server/git-conflicts-tool.ts git_conflicts — inspect unresolved merge conflicts (state detection + per-file ours/theirs/base hunk parsing)
src/server/git-stash-tool.ts git_stash_apply, git_stash_push
src/server/git-blame-tool.ts git_blame — file authorship, run-length grouped by contiguous same-commit line runs; read-only
src/server/git-tag-tool.ts git_tag — create/delete annotated or lightweight tags
src/server/git-branch-tool.ts git_branch — create/delete/rename local branches; protected-name checks on every action
src/server/git-worktree-tool.ts git_worktree_add, git_worktree_remove
src/server/batch-commit-tool.ts batch_commit — sequential multi-commit; mutating; exports PushReport, runPushAfter
src/server/git-push-tool.ts git_push — standalone push with optional upstream tracking
src/server/git-merge-tool.ts git_merge — mutating
src/server/git-cherry-pick-tool.ts git_cherry_pick (onConflict?: "abort"|"pause"), git_cherry_pick_continue (action?: "continue"|"abort", resumes/aborts a paused cherry-pick) — both mutating
src/server/git-reset-soft-tool.ts git_reset_soft — soft-reset; mutating
src/server/git-revert-tool.ts git_revert — inverse-commit revert; mutating, non-history-rewriting
src/server/presets-resource.ts rethunk-git://presets resource
src/server/tool-parameter-schemas.ts buildToolParameterSchemaDocument, captureToolParameterSchemas; backs tool-parameters.schema.json and published schemas/*.json snapshots
src/server/coverage.ts parseAllFilesLineCoverage — parses bun test coverage output for coverage:check CI gate
src/repo-paths.ts resolvePathForRepo, assertRelativePathUnderTop, isStrictlyUnderGitTop, validateRepoPath (combines the first two; the shared path-confinement check)

Read the full file on GitHub · 95 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. yesterday First seen · 95 lines · 3,775 tokens per session scan A b607e547b639

Subscribe to this mod's changes

mcp-multi-root-git AGENTS.md is an instructions file published in the GitHub repository Rethunk-AI/mcp-multi-root-git (0 stars, last pushed 18d ago), licensed MIT. It adds 3,775 tokens to every session, about $0.0189 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.

Related

Other instructions, from other repositories

vscode design-philosophy.instructions.md

VS Code design philosophy — the shared Values→Principles→Moves vocabulary for reasoning about UI in design terms rather than raw pixels. Use when creating, editing, or reviewing any visual surface (CSS, DOM, theming, icons, motion). Name the value/principle before reaching for a token.

microsoft/vscode · 577 tokens

deepagents AGENTS.md

AGENTS.md instructions for langchain-ai/deepagents, covering global development guidelines for the deep agents monorepo, corridor security analysis, development workflow, suppressing ruff rules and pr conventions.

langchain-ai/deepagents · 2,268 tokens

walkerOS CLAUDE.md

Instructions for elbwalker/walkerOS, covering claude.md and important: use agent.md.

elbwalker/walkerOS · 93 tokens

huly-mcp CLAUDE.md

Instructions for dearlordylord/huly-mcp, covering project instructions, design principle: llm-first api, project harness (copy to new projects), package manager and verification.

dearlordylord/huly-mcp · 3,317 tokens

movi-player AGENTS.md

Instructions for MrUjjwalG/movi-player, covering agents.md — movi-player for ai coding assistants, 1. what this is, 2. package entry points, 3. architecture map and 4. the web component .

MrUjjwalG/movi-player · 6,875 tokens

sofagent GEMINI.md

Instructions for KongFangXun/sofagent, covering gemini.md · sofagent gemini cli 适配(薄挂载), 会话开始时按序加载(四层加载链), 审计强制(平台无关) and 连接 mcp server.

KongFangXun/sofagent · 464 tokens