aider/codex AGENTS.md: embedded rule bodies add top-level ## headings (two "## Commands" sections)

Open Beginner friendly
#458 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash
Domain
cli

Research direction

Start with adapters/codex/install.sh, which compiles the embedded rule bodies into AGENTS.md, and inspect the template that adds the second ## Commands section. Reproduce with HOME=$(mktemp -d) bash install.sh --adapter aider in an empty project folder, then check the generated headings. Done means embedded headings no longer appear as duplicate top-level sections for both aider and codex output.

Written by the indexing model from the issue text.

Description

bug

What happens

bash install.sh --adapter aider writes an AGENTS.md whose sections are ambiguous. The file is compiled by adapters/codex/install.sh, which embeds the full body of each rule (and the memory template some rules include) under ## Rules as ### <rule-name> sections. Those bodies keep their own top-level ## headings, for example ## Commit Message Format or ## Standard Project Structure. One embedded template even adds a second ## Commands section with - Dev: / - Build: / - Test: placeholders.

As a result:

  • anything that reads AGENTS.md by ## section (an agent, a script, a person skimming the outline) sees the ## Rules section end after its first rule and finds two ## Commands sections;
  • the installer receipt counts rules by ### name lines, so the receipt is right, but a naive ##-section count of commands or rules is not.

Codex users get the same file, so this likely applies to --adapter codex too.

How to see it

HOME=$(mktemp -d) bash install.sh --adapter aider   # run from an empty project folder
grep -n '^## Commands' AGENTS.md                     # prints two lines

Suggested fix

Demote the headings inside embedded bodies by two levels (## becomes ####) when compiling, or fence each embedded body so its headings are not part of the outline. A check in CI that AGENTS.md has each top-level section exactly once would keep it that way.

Dominant language
HTML
Stars
347
Forks
12
Avg merge
2d 16h
Merged PRs (30d)
95

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coco-research/coco

All issues in coco-research/coco

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.