agent-context-md 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_context_md-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
- agent_context_md-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +13 -0
- agent_context_md-0.1.0/.github/actions/agents-md-lint/action.yml +20 -0
- agent_context_md-0.1.0/.github/workflows/ci.yml +31 -0
- agent_context_md-0.1.0/.github/workflows/publish.yml +43 -0
- agent_context_md-0.1.0/AGENTS.md +54 -0
- agent_context_md-0.1.0/CONTRIBUTING.md +37 -0
- agent_context_md-0.1.0/LICENSE +21 -0
- agent_context_md-0.1.0/MANIFEST.in +6 -0
- agent_context_md-0.1.0/PKG-INFO +317 -0
- agent_context_md-0.1.0/README.md +285 -0
- agent_context_md-0.1.0/docs/demo.svg +20 -0
- agent_context_md-0.1.0/pyproject.toml +45 -0
- agent_context_md-0.1.0/setup.cfg +4 -0
- agent_context_md-0.1.0/src/agent_context_md.egg-info/PKG-INFO +317 -0
- agent_context_md-0.1.0/src/agent_context_md.egg-info/SOURCES.txt +31 -0
- agent_context_md-0.1.0/src/agent_context_md.egg-info/dependency_links.txt +1 -0
- agent_context_md-0.1.0/src/agent_context_md.egg-info/entry_points.txt +2 -0
- agent_context_md-0.1.0/src/agent_context_md.egg-info/requires.txt +13 -0
- agent_context_md-0.1.0/src/agent_context_md.egg-info/top_level.txt +1 -0
- agent_context_md-0.1.0/src/agents_md/__init__.py +3 -0
- agent_context_md-0.1.0/src/agents_md/__main__.py +4 -0
- agent_context_md-0.1.0/src/agents_md/cli.py +276 -0
- agent_context_md-0.1.0/src/agents_md/dedup.py +70 -0
- agent_context_md-0.1.0/src/agents_md/fingerprint.py +88 -0
- agent_context_md-0.1.0/src/agents_md/generator.py +181 -0
- agent_context_md-0.1.0/src/agents_md/llm.py +150 -0
- agent_context_md-0.1.0/src/agents_md/quality.py +261 -0
- agent_context_md-0.1.0/src/agents_md/scanner.py +711 -0
- agent_context_md-0.1.0/src/agents_md/types.py +56 -0
- agent_context_md-0.1.0/tests/test_cli.py +115 -0
- agent_context_md-0.1.0/tests/test_quality.py +122 -0
- agent_context_md-0.1.0/tests/test_scanner_generator.py +236 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report incorrect scanning, generation, linting, or update behavior.
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What Happened
|
|
8
|
+
|
|
9
|
+
## Expected Behavior
|
|
10
|
+
|
|
11
|
+
## Reproduction
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
agents-md --version
|
|
15
|
+
agents-md init --no-llm --dry-run
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Repository Signals
|
|
19
|
+
|
|
20
|
+
- Language/framework:
|
|
21
|
+
- Package manager:
|
|
22
|
+
- Existing AGENTS.md:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: agents-md lint
|
|
2
|
+
description: Lint an AGENTS.md file and fail when the score is below a threshold.
|
|
3
|
+
inputs:
|
|
4
|
+
path:
|
|
5
|
+
description: Path to AGENTS.md
|
|
6
|
+
required: false
|
|
7
|
+
default: AGENTS.md
|
|
8
|
+
threshold:
|
|
9
|
+
description: Minimum accepted lint score
|
|
10
|
+
required: false
|
|
11
|
+
default: "60"
|
|
12
|
+
runs:
|
|
13
|
+
using: composite
|
|
14
|
+
steps:
|
|
15
|
+
- name: Install agents-md from action source
|
|
16
|
+
shell: bash
|
|
17
|
+
run: python -m pip install "$GITHUB_ACTION_PATH/../../.."
|
|
18
|
+
- name: Lint AGENTS.md
|
|
19
|
+
shell: bash
|
|
20
|
+
run: agents-md lint "${{ inputs.path }}" --check --threshold "${{ inputs.threshold }}"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
- uses: actions/setup-python@v6
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.13"
|
|
19
|
+
- run: python -m pip install -e .[dev]
|
|
20
|
+
- run: python -m pytest
|
|
21
|
+
- run: python -m build
|
|
22
|
+
|
|
23
|
+
agents-md:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v6
|
|
27
|
+
- uses: actions/setup-python@v6
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.13"
|
|
30
|
+
- run: python -m pip install -e .
|
|
31
|
+
- run: agents-md lint AGENTS.md --check --threshold 70
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build distributions
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- uses: actions/setup-python@v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.13"
|
|
22
|
+
- run: python -m pip install build
|
|
23
|
+
- run: python -m build
|
|
24
|
+
- uses: actions/upload-artifact@v6
|
|
25
|
+
with:
|
|
26
|
+
name: python-package-distributions
|
|
27
|
+
path: dist/
|
|
28
|
+
|
|
29
|
+
publish:
|
|
30
|
+
name: Publish to PyPI
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment:
|
|
34
|
+
name: pypi
|
|
35
|
+
url: https://pypi.org/p/agent-context-md
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/download-artifact@v6
|
|
40
|
+
with:
|
|
41
|
+
name: python-package-distributions
|
|
42
|
+
path: dist/
|
|
43
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Generated by `agents-md`. Keep manual notes outside managed sections so `agents-md update` can preserve them.
|
|
4
|
+
|
|
5
|
+
<!-- agents-md:start:stack -->
|
|
6
|
+
## Stack
|
|
7
|
+
- Ci: GitHub Actions
|
|
8
|
+
- Language: Python
|
|
9
|
+
- Package: agent-context-md 0.1.0
|
|
10
|
+
- Package Manager: pip
|
|
11
|
+
- Runtime: Python >=3.11
|
|
12
|
+
<!-- agents-md:end:stack -->
|
|
13
|
+
|
|
14
|
+
<!-- agents-md:start:commands -->
|
|
15
|
+
## Commands
|
|
16
|
+
- install: `python -m pip install -e .[dev]` from pyproject.toml.
|
|
17
|
+
- build: `python -m build` from pyproject.toml.
|
|
18
|
+
- test: `python -m pytest` from pyproject.toml.
|
|
19
|
+
<!-- agents-md:end:commands -->
|
|
20
|
+
|
|
21
|
+
<!-- agents-md:start:testing -->
|
|
22
|
+
## Testing
|
|
23
|
+
- Full suite: `python -m pytest`
|
|
24
|
+
- Single test: `python -m pytest tests/test_cli.py::test_init_no_llm_writes_agents -xvs`
|
|
25
|
+
- Prefer the narrowest relevant test while iterating, then run the broader check before release changes.
|
|
26
|
+
<!-- agents-md:end:testing -->
|
|
27
|
+
|
|
28
|
+
<!-- agents-md:start:conventions -->
|
|
29
|
+
## Conventions
|
|
30
|
+
- Package code uses a `src/` layout; import through the installed package path. (src/)
|
|
31
|
+
- Python tests live under `tests/` as `test_*.py` files. (tests/)
|
|
32
|
+
- Custom Python error class detected: `LlmError`. (src/agents_md/llm.py)
|
|
33
|
+
<!-- agents-md:end:conventions -->
|
|
34
|
+
|
|
35
|
+
<!-- agents-md:start:boundaries -->
|
|
36
|
+
## Boundaries
|
|
37
|
+
### Always Do
|
|
38
|
+
- Run the narrowest relevant test before handing off a code change.
|
|
39
|
+
### Ask First
|
|
40
|
+
- Ask before deleting files, rewriting public history, changing release/package metadata, or running commands that mutate databases/infrastructure.
|
|
41
|
+
### Never Do
|
|
42
|
+
- Never commit secrets, tokens, or `.env` files.
|
|
43
|
+
- Never overwrite a hand-written AGENTS.md without `--force` or an explicit confirmation.
|
|
44
|
+
- Never modify `vendor/` unless the user explicitly asks.
|
|
45
|
+
<!-- agents-md:end:boundaries -->
|
|
46
|
+
|
|
47
|
+
<!-- agents-md:start:security -->
|
|
48
|
+
## Security
|
|
49
|
+
- Treat API keys as environment-only configuration; do not write them into AGENTS.md or generated logs.
|
|
50
|
+
- Prefer `--no-llm` in CI unless a provider key is intentionally configured for synthesis.
|
|
51
|
+
- Review generated files before publishing because AGENTS.md is meant to guide automated agents.
|
|
52
|
+
<!-- agents-md:end:security -->
|
|
53
|
+
|
|
54
|
+
<!-- agents-md:fingerprint {"files":{".github/workflows/ci.yml":"e3fb26fa9176b56ec99474e5a98b11f0fa1b62bbcf67a3211c125f470840e8b8",".github/workflows/publish.yml":"9c2a4ee53040cd1ff89f0ebb333470cfcf645c4d99c7b8452ab2e5f2399b8c7b","MANIFEST.in":"85d1c28249eb464538e1bbdaa1ac639db1af0753ab774b05111b4fa5690ec19b","pyproject.toml":"e46ba844a6233472372f6a03eaac0725bdf8ce82787ce06a7665c1239a2b88d1"},"version":1} -->
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve `agents-md`.
|
|
4
|
+
|
|
5
|
+
## Local Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m pip install -e .[dev]
|
|
9
|
+
python -m pytest
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Run one focused test while iterating:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
python -m pytest tests/test_quality.py::test_scores_core_sections -xvs
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Pull Request Expectations
|
|
19
|
+
|
|
20
|
+
- Keep the core package dependency-light.
|
|
21
|
+
- Add or update tests for scanner, generator, lint, or CLI behavior changes.
|
|
22
|
+
- Preserve non-destructive update semantics.
|
|
23
|
+
- Keep public docs accurate and short.
|
|
24
|
+
- Do not commit secrets, real API keys, downloaded browser metadata, or local
|
|
25
|
+
cache/build artifacts.
|
|
26
|
+
|
|
27
|
+
## Product Guardrails
|
|
28
|
+
|
|
29
|
+
Ask first before changing:
|
|
30
|
+
|
|
31
|
+
- Quality score thresholds or scoring weights
|
|
32
|
+
- Deduplication rules
|
|
33
|
+
- Managed marker comment format
|
|
34
|
+
- Default LLM provider/model choices
|
|
35
|
+
- Public package metadata
|
|
36
|
+
|
|
37
|
+
These choices shape user trust and should be discussed as product behavior.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Osmane B.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-context-md
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Generate short, useful AGENTS.md files without repeating what the repo already says.
|
|
5
|
+
Author: Osmane B.
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/osmaneb23/agents-md
|
|
8
|
+
Project-URL: Issues, https://github.com/osmaneb23/agents-md/issues
|
|
9
|
+
Keywords: agents.md,ai,cli,codex,claude,developer-tools
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Provides-Extra: anthropic
|
|
23
|
+
Requires-Dist: anthropic>=0.76; extra == "anthropic"
|
|
24
|
+
Provides-Extra: openai
|
|
25
|
+
Requires-Dist: openai>=2.9; extra == "openai"
|
|
26
|
+
Provides-Extra: gemini
|
|
27
|
+
Requires-Dist: google-genai>=1.52; extra == "gemini"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: build>=1.3; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest>=9.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# agents-md
|
|
34
|
+
|
|
35
|
+
Generate `AGENTS.md` context files that actually help AI coding agents.
|
|
36
|
+
|
|
37
|
+
[](https://github.com/osmaneb23/agents-md/actions)
|
|
38
|
+
[](pyproject.toml)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
*Demo runs on a JS/TS repo. Simpler repos generate shorter files.*
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
ETH Zurich [tested AI coding agents](https://arxiv.org/abs/2602.11988) across 8 benchmarks with auto-generated context files, hand-written files, and nothing. Auto-generated files made performance worse in 5 of 8 cases. Inference cost jumped 20-23%. Tasks took more steps.
|
|
48
|
+
|
|
49
|
+
The cause: generators write what agents can already read. Your README, your folder structure, your lint rules — the agent figures all of this out on its own. Putting it in AGENTS.md means reading it again on every task and paying for it each time.
|
|
50
|
+
|
|
51
|
+
`agents-md` reads your existing docs before writing anything. Everything the agent can discover on its own gets filtered out. What's left — exact commands with real flags, conventions the agent would get wrong, hard limits — is what ends up in the file.
|
|
52
|
+
|
|
53
|
+
This repo's own AGENTS.md was generated by `agents-md`.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Contents
|
|
58
|
+
|
|
59
|
+
- [Install](#install)
|
|
60
|
+
- [Usage](#usage)
|
|
61
|
+
- [Sample output](#sample-output)
|
|
62
|
+
- [How deduplication works](#how-deduplication-works)
|
|
63
|
+
- [Quality scoring](#quality-scoring)
|
|
64
|
+
- [GitHub Action](#github-action)
|
|
65
|
+
- [What gets detected](#what-gets-detected)
|
|
66
|
+
- [Alternatives](#alternatives)
|
|
67
|
+
- [Development](#development)
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Install
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Until the first PyPI release is live:
|
|
75
|
+
python -m pip install "git+https://github.com/osmaneb23/agents-md.git"
|
|
76
|
+
|
|
77
|
+
# After PyPI publication:
|
|
78
|
+
pip install agent-context-md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Zero runtime dependencies. No Node.js, no Docker.
|
|
82
|
+
|
|
83
|
+
LLM provider SDKs are optional extras — the tool works fully offline without them. From a source checkout:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python -m pip install -e .[anthropic]
|
|
87
|
+
python -m pip install -e .[openai]
|
|
88
|
+
python -m pip install -e .[gemini]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
After PyPI publication, use `pip install agent-context-md[anthropic]` or run it with uv:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
uvx --from agent-context-md agents-md init
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Usage
|
|
100
|
+
|
|
101
|
+
**Generate:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Static analysis only, no API key needed
|
|
105
|
+
agents-md init --no-llm
|
|
106
|
+
|
|
107
|
+
# With LLM synthesis (picks up key from env)
|
|
108
|
+
ANTHROPIC_API_KEY=sk-... agents-md init
|
|
109
|
+
OPENAI_API_KEY=sk-... agents-md init
|
|
110
|
+
GEMINI_API_KEY=... agents-md init
|
|
111
|
+
|
|
112
|
+
# Explicit provider + model
|
|
113
|
+
agents-md init --provider anthropic --model <model-id>
|
|
114
|
+
|
|
115
|
+
# Preview without writing anything
|
|
116
|
+
agents-md init --no-llm --dry-run --verbose
|
|
117
|
+
|
|
118
|
+
# Append managed sections to a hand-written file
|
|
119
|
+
agents-md init --merge
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Lint** — works on any AGENTS.md, including hand-written ones:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
agents-md lint # score ./AGENTS.md
|
|
126
|
+
agents-md lint path/to/AGENTS.md # specific file
|
|
127
|
+
agents-md lint --check --threshold 70 # exit 1 if score < 70
|
|
128
|
+
agents-md lint --fix # remove duplicate and style-rule lines
|
|
129
|
+
agents-md lint --json # machine-readable output
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Keep it current:**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
agents-md update # refresh managed sections, leave your notes alone
|
|
136
|
+
agents-md diff # show what changed in the repo since last generation
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Sample output
|
|
142
|
+
|
|
143
|
+
`agents-md init --no-llm` on a Next.js + TypeScript repo:
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
## Stack
|
|
147
|
+
- CI: GitHub Actions
|
|
148
|
+
- Framework: Next.js 15.3
|
|
149
|
+
- Language: TypeScript (strict mode)
|
|
150
|
+
- Package Manager: pnpm 10.0.0
|
|
151
|
+
- Test Runner: vitest 3.0.0
|
|
152
|
+
|
|
153
|
+
## Commands
|
|
154
|
+
- install: `pnpm install`
|
|
155
|
+
- run: `pnpm dev`
|
|
156
|
+
- build: `pnpm build`
|
|
157
|
+
- test: `pnpm test`
|
|
158
|
+
- lint: `pnpm lint`
|
|
159
|
+
|
|
160
|
+
## Testing
|
|
161
|
+
- Full suite: `pnpm test`
|
|
162
|
+
- Single test: `pnpm vitest run src/auth/login.test.ts -t "should reject expired tokens"`
|
|
163
|
+
- Prefer the narrowest test while iterating. Run the full suite before handing off.
|
|
164
|
+
|
|
165
|
+
## Boundaries
|
|
166
|
+
### Always Do
|
|
167
|
+
- Run the narrowest relevant test before handing off a code change.
|
|
168
|
+
### Ask First
|
|
169
|
+
- Ask before running `pnpm db:migrate` — it touches migrations.
|
|
170
|
+
- Ask before deleting files, rewriting history, or changing release metadata.
|
|
171
|
+
### Never Do
|
|
172
|
+
- Never commit secrets, tokens, or `.env` files.
|
|
173
|
+
- Never overwrite a hand-written AGENTS.md without `--force` or explicit confirmation.
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Sections are wrapped in `<!-- agents-md:start/end:section-name -->` markers. `agents-md update` uses them to refresh individual sections without touching anything you added by hand.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## How deduplication works
|
|
181
|
+
|
|
182
|
+
Before writing anything, the tool reads every Markdown file in your project root and `docs/`. It extracts facts from them — commands, framework mentions, structural notes. Then for each candidate line from the extractors, it asks: does this add anything the agent can't get from those docs?
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
README says: "We use pnpm. Run `pnpm install` to get started."
|
|
186
|
+
Extractor: install: pnpm install
|
|
187
|
+
|
|
188
|
+
→ Removed. The agent can read the README.
|
|
189
|
+
|
|
190
|
+
README says: "Run the tests before pushing."
|
|
191
|
+
Extractor: single test: pytest tests/test_auth.py::test_login -xvs
|
|
192
|
+
|
|
193
|
+
→ Kept. The README is vague. The exact command with flags is new.
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Boundaries and security lines are always kept, even when they overlap with the README.
|
|
197
|
+
|
|
198
|
+
Pass `--verbose` to see the full list of what was removed and why.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Quality scoring
|
|
203
|
+
|
|
204
|
+
`agents-md lint` scores any AGENTS.md out of 100 and tells you exactly what to fix.
|
|
205
|
+
|
|
206
|
+
| Criterion | Points |
|
|
207
|
+
|---|---|
|
|
208
|
+
| Commands section with 2+ exact commands | 10 |
|
|
209
|
+
| Commands include real flags (`-x`, `--watch`, etc.) | 15 |
|
|
210
|
+
| Single-test command targeting one file or function | 10 |
|
|
211
|
+
| Three-tier boundaries (Always / Ask First / Never) | 20 |
|
|
212
|
+
| Dedicated testing section | 10 |
|
|
213
|
+
| File under 150 lines | 15 |
|
|
214
|
+
| No README duplication | 15 |
|
|
215
|
+
| No linter-owned style rules | 5 |
|
|
216
|
+
|
|
217
|
+
Score guide:
|
|
218
|
+
|
|
219
|
+
- **85-100** — This file will improve agent performance.
|
|
220
|
+
- **65-84** — A few improvements would help.
|
|
221
|
+
- **45-64** — Key sections are missing or there's redundant content.
|
|
222
|
+
- **0-44** — This file is likely slowing agent sessions down.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## GitHub Action
|
|
227
|
+
|
|
228
|
+
Fail PRs when the score drops below a threshold:
|
|
229
|
+
|
|
230
|
+
```yaml
|
|
231
|
+
- uses: actions/checkout@v6
|
|
232
|
+
- uses: actions/setup-python@v6
|
|
233
|
+
with:
|
|
234
|
+
python-version: "3.13"
|
|
235
|
+
- uses: osmaneb23/agents-md/.github/actions/agents-md-lint@main
|
|
236
|
+
with:
|
|
237
|
+
path: AGENTS.md
|
|
238
|
+
threshold: "70"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Pin to a release tag once you cut the first release.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## What gets detected
|
|
246
|
+
|
|
247
|
+
<details>
|
|
248
|
+
<summary><strong>Commands</strong></summary>
|
|
249
|
+
|
|
250
|
+
Scripts and tasks from `package.json`, `Makefile`, `pyproject.toml` (taskipy, poe), `Justfile`, `Taskfile.yml`. Single-test commands are inferred for pytest, unittest, Jest, Vitest, Mocha, Cargo, and Go.
|
|
251
|
+
|
|
252
|
+
</details>
|
|
253
|
+
|
|
254
|
+
<details>
|
|
255
|
+
<summary><strong>Stack</strong></summary>
|
|
256
|
+
|
|
257
|
+
Package manager detected from lock files, never guessed. Framework, language, TypeScript strict mode (from tsconfig), runtime, test runner, linter, type checker, CI system.
|
|
258
|
+
|
|
259
|
+
</details>
|
|
260
|
+
|
|
261
|
+
<details>
|
|
262
|
+
<summary><strong>Conventions</strong></summary>
|
|
263
|
+
|
|
264
|
+
`src/` layout, test naming patterns, TypeScript path aliases, named-export-only modules, barrel files with their import alias, `Result<T,E>` error-as-value patterns, centralized HTTP wrappers, catch blocks that intentionally return fallback values, `.env.example` variables, test fixture and factory directories. Only things an agent would plausibly get wrong on the first attempt.
|
|
265
|
+
|
|
266
|
+
</details>
|
|
267
|
+
|
|
268
|
+
<details>
|
|
269
|
+
<summary><strong>Fingerprint</strong></summary>
|
|
270
|
+
|
|
271
|
+
SHA-256 hashes of key manifests stored in a comment at the bottom of the file. `agents-md diff` compares them against the current state and tells you whether an update is worth running.
|
|
272
|
+
|
|
273
|
+
</details>
|
|
274
|
+
|
|
275
|
+
Supported: **Python**, **JavaScript/TypeScript**, **Go**, **Rust**.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Alternatives
|
|
280
|
+
|
|
281
|
+
| Tool | What it does | Where it falls short |
|
|
282
|
+
|---|---|---|
|
|
283
|
+
| `agents-init` (npm) | Sets up AGENTS.md + MCP config + subagents | No dedup filter. Generates the kind of bloated file the ETH study warns against. |
|
|
284
|
+
| `GenerateAgents.md` (PyPI) | DSPy-based generation, any model | DSPy is a heavy dependency. No dedup. |
|
|
285
|
+
| `AGENTS.md_generator` (Python) | Safe-by-default skeleton | Intentionally minimal. You still fill it in manually. |
|
|
286
|
+
| Hand-written | Full control | Drifts with the codebase. No quality feedback. |
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Design decisions
|
|
291
|
+
|
|
292
|
+
- **Zero runtime dependencies.** The core package installs in seconds. LLM SDKs are opt-in extras.
|
|
293
|
+
- **Non-destructive updates.** `agents-md update` only touches content inside managed markers. `lint --fix` creates a `.bak` before writing. `init` prompts before overwriting.
|
|
294
|
+
- **No guessing.** If the package manager can't be determined from lock files, it's left blank. A wrong command is worse than a missing one.
|
|
295
|
+
- **Short over padded.** The LLM synthesis prompt explicitly tells the model to refuse to pad. A 30-line file beats a 150-line one if the repo is simple.
|
|
296
|
+
- **No Node.js required.** Python only, works anywhere Python runs.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Development
|
|
301
|
+
|
|
302
|
+
The project's own [AGENTS.md](AGENTS.md) has the authoritative commands, conventions, and boundaries. Check it before changing code or opening a PR.
|
|
303
|
+
|
|
304
|
+
Before changing scoring weights, deduplication rules, or managed marker formats, open an issue. These are product decisions, not implementation details.
|
|
305
|
+
|
|
306
|
+
Releases go through PyPI Trusted Publishing via `.github/workflows/publish.yml`. To publish: set up a pending publisher for project `agent-context-md`, repository `osmaneb23/agents-md`, workflow `publish.yml`, environment `pypi`, then run the publish workflow.
|
|
307
|
+
|
|
308
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for PR expectations.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Sources
|
|
313
|
+
|
|
314
|
+
- ETH Zurich study: [arxiv.org/abs/2602.11988](https://arxiv.org/abs/2602.11988)
|
|
315
|
+
- AGENTS.md open format: [github.com/agentsmd/agents.md](https://github.com/agentsmd/agents.md)
|
|
316
|
+
- GitHub's analysis of 2,500+ AGENTS.md files: [github.blog](https://github.blog/ai-and-ml/github-copilot/how-to-write-a-great-agents-md-lessons-from-over-2500-repositories/)
|
|
317
|
+
- Augment Code guide: [augmentcode.com/guides/how-to-build-agents-md](https://www.augmentcode.com/guides/how-to-build-agents-md)
|