
AGENTS.md Generator
io.github.nusheyPublished by GitHub account nusheyv0.6.1Updated Oct 24, 2026
Analyzes codebases with tree-sitter and generates AGENTS.md files for AI coding agents.
Overview
Analyzes a local codebase with tree-sitter and produces AGENTS.md context files for AI coding agents.
- What you can do
- Exposes three tools: generate_agents_md runs the analysis pipeline and returns chunked instructions for writing an AGENTS.md file, scan_codebase returns a pure data payload of architectural context without generating a file, and read_payload_chunk streams that payload in chunks. It parses git-tracked source files with tree-sitter, extracting public symbols, entry points, environment variable references, setup and test commands, and conventions. Incremental scanning re-parses only files whose SHA-256 hash changed.
- When to use it
- Useful when you want an AI coding client to understand a project's architecture, conventions, and commands without reading every file, or when you want to generate or refresh an AGENTS.md file. The scan_codebase tool is also handy for code review, planning, and Q&A tasks that need codebase context.
- Requirements
- Local process; Python 3.11+ and Git must be installed. Installed via pip (agents-md-generator) or run with uvx. Requires an MCP-compatible client such as Claude Code, Gemini CLI, Cursor, Windsurf, or Codex CLI. No authentication, API keys, or headers are declared. Optional AGENTS_MD_LOG_LEVEL environment variable controls log verbosity.
Installation
In SourceWeft
- Open AGENTS.md Generator in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
agents-md-generator
MCP server that analyzes codebases with tree-sitter and generates AGENTS.md files.
[PyPI] [Python] [License: MIT] [MCP]
Python · C# · TypeScript · JavaScript · Go
Installation · Usage · Configuration · How It Works · Contributing
Compatible with any MCP-capable client: Claude Code, Gemini CLI, Cursor, Windsurf, Codex CLI, and others.
The server exposes three tools with a clear separation of concerns:
generate_agents_md— main entry point. Runs the analysis pipeline internally, embeds writing rules into the payload, and returns chunked read instructions to your client.scan_codebase— standalone context tool for when you want deep codebase understanding without generating any file.read_payload_chunk— streams the payload back in chunks regardless of which tool produced it.
No large data travels over the MCP wire.
Table of Contents
- Installation
- Usage
- What Gets Generated
- How Incremental Scanning Works
- Project Configuration
- What the Analysis Detects
- Credits
Installation
Requirements: Python 3.11+, Git, and any MCP-compatible client.
See INSTALLATION.md for the full guide including prerequisites and troubleshooting.
Option A — pip install + setup wizard (recommended)
The setup wizard detects your installed clients, asks whether to configure globally or per-project, and patches the config files automatically. Supports Claude Code, Gemini CLI, Cursor, Windsurf, and Codex CLI.
Option B — uvx (no install needed)
If you have uv installed, uvx runs the package without a prior install step. Add the entry manually to your client's MCP config:
For Claude Code specifically:
claude mcp adddefaults to--scope local(current project only). Add-s userto register it for all projects.
Usage
Once registered, ask your AI client:
"Generate the AGENTS.md for this project"
The client will call generate_agents_md automatically. To scan a different directory:
"Generate the AGENTS.md for the project at /path/to/project"
Tools
Tool Parameters
generate_agents_md
scan_codebase
read_payload_chunk
What Gets Generated
The generated AGENTS.md follows the agents.md open standard. It is written as a README for AI agents, not as documentation for humans. Sections include:
Sections with no detected data are omitted entirely.
How Incremental Scanning Works
- First run (cold start) — all git-tracked source files are parsed with tree-sitter and cached
- Subsequent runs — only files whose SHA-256 hash changed since the last scan are re-parsed
- Semantic diff — for modified files, only changed public symbols are included in the payload
- No source changes? — the tool stops and asks whether you want to improve the existing
AGENTS.mdcontent anyway - Private symbols and test file internals are excluded from both cache and payload — only the public API surface matters for
AGENTS.md
How Large Payloads Are Streamed
For large codebases the analysis payload can be too big to return inline over the MCP wire. The server handles this transparently through read_payload_chunk.
Scans run in a separate process with stage progress notifications and a five-minute timeout. Cancellation stops the scan worker. Only one scan per project can run at a time in a server instance; use .agents-config.json to narrow repositories that exceed the time limit.
Generation always assembles a current snapshot, reusing cached symbols for unchanged source files. An interrupted generation can be retried even after its payload was consumed or another scan ran. The client remains responsible for writing AGENTS.md.
Serialized payloads are capped at 300,000 characters. Dropped analysis sections are recorded in metadata.degradations and metadata.truncated_sections. Existing AGENTS.md content and writing instructions are preserved; if these alone exceed the budget, the tool returns an error instead of truncating the document.
generate_agents_md flow
generate_agents_mdruns the pipeline internally, writes the payload to disk (includingAGENTS.mdwriting rules), and returnstotal_chunkswith read instructions- The client calls
read_payload_chunk(project_path, chunk_index=0), then incrementschunk_indexuntilhas_moreis false - The client concatenates all
datafields — the payload contains the rules and analysis data needed to writeAGENTS.md - The payload file is automatically deleted after the last chunk is read
scan_codebase flow (pure context, no AGENTS.md mandate)
scan_codebaseruns the analysis and writes a pure data payload to disk- Same chunked read via
read_payload_chunk - The client uses the payload for any purpose — code review, planning, Q&A
This flow is pure MCP — no filesystem access required from the client side. Any MCP-compatible client can follow it.
Cache and Payload Location
All runtime artifacts are stored outside your project, in the user cache directory:
The <project-hash> is a SHA-256 of the project's absolute path — unique per project. Nothing is written to your repository.
Note: The server also writes a temporary
payload.jsonto this directory during analysis, but it is managed entirely by theread_payload_chunktool and deleted automatically after the last chunk is read. You never need to access it directly.
Project Configuration
Create .agents-config.json at your project root to customize behavior. This file is optional — all fields have defaults, and you can commit it to share settings with your team.
Full default configuration
Options
Environment Variables
Project Size Profiles
The project_size setting controls how aggressively the payload is compressed. A single knob tunes all internal caps — methods per class, symbols per file, directory aggregation, route caps, tree depth, and impact filtering.
Detailed profile values
What the Analysis Detects
Environment Variables
The server scans all source files for environment variable references using language-specific patterns:
It also parses .env.example, .env.template, and .env.sample files at the project root.
Entry Points
Files named index, main, app, server, program, bootstrap, or startup (with any supported extension) are detected as entry points and annotated with their inferred role (e.g., "HTTP server bootstrap", "Electron main process").
Public API Surface
Tree-sitter parses each source file and extracts public symbols — classes, functions, methods, interfaces — filtering out private/protected members and underscore-prefixed symbols. For classes and structs, constructors (when they have parameters) and public properties are also included, revealing dependency injection patterns and data shapes. Interface methods are always included as they define the public contract. These are used to detect naming conventions, DI patterns, and export contracts across layers.
Architectural Distillation
For large codebases, the tool applies several heuristics to ensure the payload remains high-signal:
- Boilerplate Suppression — common directories like
Migrations,bin,obj, andPropertiesare automatically flagged and collapsed in the project structure, preventing them from bloating the directory listing. - Low-Entropy Summarization — files that primarily contain data structures (DTOs, Entities) with no logic methods are "minified". Instead of listing every property, the tool provides a high-level summary (e.g., "Contains 25 DTO classes").
- Semantic Clustering — the aggregator groups these minified summaries at the directory level, allowing the consuming AI to understand entire data layers through a single line of signal.
- Instruction Embedding — when called via
generate_agents_md, writing rules are embedded directly in the payload so the AI agent reads the "Rules of Engagement" before processing the code architecture. Directscan_codebasecalls return pure data with no mandate.
Credits
AGENTS.md format based on the open agents.md standard.
Licensed under the MIT License
Source: README.md at commit 156c70c
Tools
0Version history
1- v0.6.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts