agentleFS
dirstraldirstral/dir2mcp/AGENTS.md

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.

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
  1. Very specific:

    Create an issue branch if one does not already exist (e.g.

    line 34
  2. Distinctive:

    Keep commits scoped and atomic.

    line 35
  3. Distinctive:

    Use Conventional Commits for all commit messages: <https://www.conventionalcommits.org/>.

    line 36
  4. Distinctive:

    Do not mention yourself in commit messages.

    line 37
  5. Distinctive:

    Do not push directly to main.

    line 39
  6. Distinctive:

    Run before proposing merge:

    line 49
  7. Distinctive:

    Keep patches minimal and issue-focused.

    line 94
  8. Very specific:

    Do not silently change API/schema/error contracts.

    line 95
  9. Common:

    Never hardcode API keys, auth tokens, or provider base URLs.

    line 97
  10. Common:

    Never introduce secret leakage in logs or error payloads.

    line 98
  11. Distinctive:

    Do not add extra markdown files unless explicitly requested for the task.

    line 99
  12. Distinctive:

    Keep dependency additions minimal and justified.

    line 100
  13. Distinctive:

    Update tests and docs together when behavior changes.

    line 101
  14. Very specific:

    Keep all test files in the tests/ folder.

    line 105
  15. Very specific:

    Do not add new *_test.go files under cmd/ or internal/.

    line 106
  16. Very specific:

    Ensure new test coverage follows existing patterns in tests/.

    line 107
  17. Very specific:

    All relevant tests pass (make check green).

    line 111
  18. Distinctive:

    No unrelated refactors in issue PRs.

    line 113

≈ “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

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 affected cmd/, internal/, and tests/ 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 entrypoint
  • internal/cli - command handlers and runtime wiring
  • internal/config - config precedence and validation
  • internal/ingest - ingestion + derived representations
  • internal/retrieval - retrieval/search/ask/open_file services
  • internal/mcp - MCP server and tool handlers
  • internal/mistral - Mistral provider client code
  • internal/x402 - payment types and facilitator HTTP client
  • internal/store - sqlite metadata storage
  • tests - integration/system tests by area
  • docs/ - 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 main before 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 review

Run before proposing merge:

make check

Useful focused checks:

go test ./tests/mcp -run X402
go test ./tests/x402
go test ./tests/cli

Integration 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_MistralAPI

MCP 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-mcp

Coding 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.go files under cmd/ or internal/.
  • Ensure new test coverage follows existing patterns in tests/.

Review/merge readiness

  • All relevant tests pass (make check green).
  • README.md and docs/ 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 help subcommand; invoke dir2mcp for usage text.
  • Security: local bind default; public mode enforces auth by default.
  • x402 mode:
    • off = disabled
    • on = fail-open on incomplete payment config
    • required = strict gating/validation
  • Retrieval status:
    • internal/retrieval/engine.go Ask() is implemented (issue #70 closed).
    • retrieval.Service.Stats() is implemented (issue #71 closed).

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.