Skip to content
How it learnsFrom coding sessions, reviews, Slack and docs.Only what fitsEach session gets the few rules its task needs.Pull request reviewEvery PR checked against your team’s rules.Keep it trueA gate, conflicts, disputes and stale rules, handled.HandoffsCarry the work to another session or a teammate.SecurityWhat it sends, what it changes and how to leave.
Engineering teamsOne agent or several: what one person learns, every session uses.PR review onlyInstall the GitHub App. Nothing on anyone’s machine.Teams that mix agentsClaude Code, Cursor, Codex and Copilot, the same rules.On your ownYour corrections follow you across repos, machines and agents.Book a call30 minutes with Roei, if you want a hand. Never required.
DocsPricingSign in
Connect your agents →
For teamsOn your ownPR review onlyHow it learnsOnly what fitsPull request reviewKeep it trueSecurityDocsPricingSign inConnect your agents →
Home/Answers

Answers

Ignores its rule file

  • HTML comments in CLAUDE.md
  • "Read AGENTS.md" does not import
  • Antigravity ignores AGENTS.md
  • Windsurf ignores rules

Rule file too long

  • AGENTS.md too long for Codex
  • Antigravity rule size limit
  • Copilot instructions length
  • Cursor rules too long

Rules drift from the code

  • CLAUDE.md and AGENTS.md drift
  • Directory trees in rule files

Share rules across repos and agents

  • Share CLAUDE.md across repos
  • Share AGENTS.md in Codex
  • Copilot org instructions
  • Gemini CLI and AGENTS.md
  • Share Windsurf rules

Memory between sessions

  • Gemini CLI memory

Answers

Leave the directory tree out of CLAUDE.md and AGENTS.md: it goes stale and the agent can list files itself

Published November 18, 2026

A directory tree pasted into CLAUDE.md or AGENTS.md is the first part of the file to go stale, and the agent does not need it: Claude Code and Codex can list the repository themselves. Replace the tree with one line per surprise, such as "webhooks live in payments/webhooks/, not api/", and delete it when the code moves.

For Claude Code and Codex. Vendor facts are from the pages linked below, read on November 18, 2026.

What to write instead

  • Find trees: search the file for box-drawing characters such as ├── and └──.
  • Delete the tree. Keep only the paths an agent would guess wrong, as a sentence each.
  • Point at the source of truth for structure instead, for example "packages are listed in pnpm-workspace.yaml".
  • When a pull request moves a folder, search the rule files for the old path in the same PR.
grep -nE "├──|└──" CLAUDE.md AGENTS.md

The numbers

MeasureValueSource
Public CLAUDE.md files that contain a directory tree16.9% (weighted, of 1,932)Harbor study, 18 Oct 2026
Public AGENTS.md files that contain a directory tree10.5% (weighted, of 1,966)Harbor study, 18 Oct 2026
CLAUDE.md files past Anthropic’s 200-line target18.9% (weighted)Harbor study, 18 Oct 2026
Median CLAUDE.md length81 lines; 1 in 10 longer than 309Harbor study, 18 Oct 2026

Study figures are weighted estimates from 1,935 CLAUDE.md and 1,970 AGENTS.md files sampled from public GitHub repositories on 18 October 2026, with GitHub's own counts for the totals. Every figure is in the study's CSV, and the method is in the study.

What the docs say

  • Claude Code memory docs: Target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.
  • Codex: Custom instructions with AGENTS.md: All project AGENTS.md files share a 32 KiB budget by default, so lines that describe the layout are spent before the rules below them.

Where Harbor fits

Harbor connects Claude Code, Codex, Cursor and GitHub Copilot (the CLI and VS Code agent mode; the cloud agent is not supported yet) through hooks and an MCP server. It ties rules to the code they are about: when a push deletes the file a rule names, the rule is retired, or flagged if other repos still use it, instead of sitting in a file nobody re-reads. Each rule shows how often it was served and how often an answer cited it. A citation is evidence a rule was used, not proof it was obeyed.

Read next

  • Context rot and stale rules
  • How long should CLAUDE.md be?
  • The study behind the numbers
  • CLAUDE.md and AGENTS.md drift apart in 7% of repos that copy one into the other: import instead
  • Claude Code strips HTML comments from CLAUDE.md, so a rule inside one never loads
  • "Read AGENTS.md" in CLAUDE.md does not load it: put @AGENTS.md on its own line
  • Codex reads 32 KiB of AGENTS.md and cuts the rest: raise project_doc_max_bytes or trim
  • Every answer, by agent and problem

Questions

Should I put a directory tree in CLAUDE.md?

No. It costs lines on every turn, it goes stale the first time a folder moves, and Claude Code can list the files itself. Write only the paths an agent would get wrong.

How many CLAUDE.md files include a directory tree?

In our 18 October 2026 sample, 16.9 percent of public CLAUDE.md files and 10.5 percent of AGENTS.md files (weighted) had box-drawing characters on two or more lines.

How do I stop rule files going stale?

Keep only what the code cannot tell the agent, put each rule in the folder it is about, and change the rule file in the same pull request that changes the code. A check in CI that greps rule files for deleted paths catches the rest.

Your team’s rules, in every agent, checked on every PR.

Harbor is shared memory for your team’s Claude Code, Cursor, Codex and Copilot. Free for you and one teammate. No card. No end date.

Start free →

Product

  • How it learns
  • Only what fits
  • Pull request review
  • Keep it true
  • Handoffs
  • The result
  • Security
  • For coding agents
  • Pricing

Developers

  • Docs
  • Quickstart
  • Install
  • CLI
  • MCP server
  • Served and cited
  • Rule-file checker
  • Blog

Guides

  • Why Claude ignores CLAUDE.md
  • AGENTS.md vs CLAUDE.md
  • Share Claude Code memory with a team
  • Why Codex ignores AGENTS.md
  • Why Cursor ignores rules
  • Copilot instructions vs AGENTS.md
  • Shared memory across agents
  • Copilot Memory and Dreaming

Compare

  • All comparisons
  • vs Mem0
  • vs Zep
  • vs Unblocked
  • vs ByteRover
  • vs Cognee
  • vs Hindsight
  • vs OpenViking
  • vs Supermemory
  • vs Glen
  • vs MemPalace
  • vs Sentra
  • vs Trail-code

Company

  • Questions
  • Contact
  • X
  • LinkedIn
  • Privacy Policy
  • Terms of Service
  • Data Processing Agreement
  • Refund Policy
© 2026 HarborConnect your agents