dir2mcp
AGENTS.md4 starsChanged 2 months agoMITView on GitHub
Operational guide for coding agents working in this repository. dir2mcp is a single-binary Go service that indexes local directory content and serves it over MCP with retrieval tools, provenance/citations, and optional x402 request gating. Run before committing: Run before proposing merge: Useful focused checks: Skipped by default. To run:
- Reads credentials
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 repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
18 rules. About 2 are common, 10 are distinctive, and 6 are very specific to this project.
≈2
Common · estimate
Many files like this have a rule of this kind.
≈10
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
- could be automatic: a setting could enforce it
- Very specific: line 34
Create an issue branch if one does not already exist (e.g.
- Distinctive: line 35
Keep commits scoped and atomic.
- Distinctive: line 36
Use Conventional Commits for all commit messages: <https://www.conventionalcommits.org/>.
- Distinctive: line 37
Do not mention yourself in commit messages.
- Distinctive: line 39
Do not push directly to main.
- Distinctive: line 49
Run before proposing merge:
- Distinctive: line 94
Keep patches minimal and issue-focused.
- Very specific: line 95
Do not silently change API/schema/error contracts.
- Common: line 97
Never hardcode API keys, auth tokens, or provider base URLs.
- Common: line 98
Never introduce secret leakage in logs or error payloads.
- Distinctive: line 99
Do not add extra markdown files unless explicitly requested for the task.
- Distinctive: line 100
Keep dependency additions minimal and justified.
- Distinctive: line 101
Update tests and docs together when behavior changes.
- Very specific: line 105
Keep all test files in the tests/ folder.
- Very specific: line 106
Do not add new *_test.go files under cmd/ or internal/.
- Very specific: line 107
Ensure new test coverage follows existing patterns in tests/.
- Very specific: line 111
All relevant tests pass (make check green).
- Distinctive: line 113
No unrelated refactors in issue PRs.
≈ “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.
Files
AGENTS.md
Purpose
Operational guide for coding agents working in this repository.
Before you start
- Re-check whether the requested plan still matches the current codebase before making changes.
- Review relevant context first:
README.md,dirstral-spec/docs/SPEC.md(canonical spec, vendored submodule), and the affectedcmd/,internal/, andtests/paths. - Preserve existing architecture and conventions unless the issue explicitly requires a refactor.
Project summary
dir2mcp is a single-binary Go service that indexes local directory content and serves it over MCP with retrieval tools, provenance/citations, and optional x402 request gating.
Repo map
cmd/dir2mcp- CLI binary entrypointinternal/cli- command handlers and runtime wiringinternal/config- config precedence and validationinternal/ingest- ingestion + derived representationsinternal/retrieval- retrieval/search/ask/open_file servicesinternal/mcp- MCP server and tool handlersinternal/mistral- Mistral provider client codeinternal/x402- payment types and facilitator HTTP clientinternal/store- sqlite metadata storagetests- integration/system tests by areadocs/- user guides (install, configuration, cli, mcp-tools, security, deployment, x402) and pointer stubs for the normative docs (SPEC, VISION, ECOSYSTEM, x402 adapter spec)
Git workflow
- Pull latest
mainbefore starting implementation work. - Create an issue branch if one does not already exist (e.g.
issue-<number>-<short-slug>). - Keep commits scoped and atomic; use separate commit messages per logical change.
- Use Conventional Commits for all commit messages: https://www.conventionalcommits.org/.
- Do not mention yourself in commit messages.
- Include the issue number in the pull request title.
- Do not push directly to
main.
Mandatory commands
Run before committing:
coderabbit reviewRun before proposing merge:
make checkUseful focused checks:
go test ./tests/mcp -run X402
go test ./tests/x402
go test ./tests/cliIntegration tests
Skipped by default. To run:
RUN_INTEGRATION_TESTS=1 \
MISTRAL_API_KEY=... \
go test -v ./tests/mistral -run Integration
RUN_INTEGRATION_TESTS=1 \
MISTRAL_API_KEY=... \
MISTRAL_OCR_SAMPLE=/path/to/file.pdf \
go test -v ./tests/mistral -run MistralOCR
RUN_INTEGRATION_TESTS=1 \
MISTRAL_API_KEY=... \
MISTRAL_STT_SAMPLE=/path/to/file.mp3 \
go test -v ./tests/mistral -run Transcribe_Integration_MistralAPIMCP dev servers (Codex)
codex mcp add everything -- npx -y @modelcontextprotocol/server-everything
codex mcp add sequential-thinking -- npx -y @modelcontextprotocol/server-sequential-thinking
codex mcp add playwright -- npx -y @playwright/mcp
codex mcp add github --url https://api.githubcopilot.com/mcp/ --bearer-token-env-var GITHUB_PERSONAL_ACCESS_TOKEN
codex mcp add context7 -- npx -y @upstash/context7-mcpCoding rules
- Work only in this repository unless explicitly instructed otherwise.
- Keep patches minimal and issue-focused.
- Do not silently change API/schema/error contracts.
- Maintain clear, machine-parseable errors for MCP/x402 paths.
- Never hardcode API keys, auth tokens, or provider base URLs; keep all credentials env-backed.
- Never introduce secret leakage in logs or error payloads.
- Do not add extra markdown files unless explicitly requested for the task.
- Keep dependency additions minimal and justified.
- Update tests and docs together when behavior changes.
Tests
- Keep all test files in the
tests/folder. - Do not add new
*_test.gofiles undercmd/orinternal/. - Ensure new test coverage follows existing patterns in
tests/.
Review/merge readiness
- All relevant tests pass (
make checkgreen). README.mdanddocs/are aligned with real behavior.- No unrelated refactors in issue PRs.
- Implementation aligns with
dirstral-spec/docs/SPEC.md(canonical spec) and current code behavior, not stale assumptions. - Secure defaults and existing auth/public-mode safety behavior are preserved.
Important behavior notes
- Usage/help: no
helpsubcommand; invokedir2mcpfor usage text. - Security: local bind default; public mode enforces auth by default.
- x402 mode:
off= disabledon= fail-open on incomplete payment configrequired= strict gating/validation
- Retrieval status:
internal/retrieval/engine.goAsk()is implemented (issue #70 closed).retrieval.Service.Stats()is implemented (issue #71 closed).
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
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.

