pingdotgg / pingdotgg/t3code

repo_conventions injects AGENTS.md and CLAUDE.md as two blocks — identical content is paid twice when CLAUDE.md is a symlink/copy of AGENTS.md

Open Beginner friendly
#12,503 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accepted bug via-triage
Dominant language
TypeScript
Stars
23k
Forks
5.9k
Avg merge
11h 14m
Merged PRs (30d)
357

Description

Summary

When generating commit messages / change-request descriptions, the repo_conventions text-generation policy appends the repository's AGENTS.md and CLAUDE.md as two separate blocks. A very common convention (recommended in the agents.md ecosystem and by Claude Code docs) is to keep CLAUDE.md as a symlink to (or byte-identical copy of) AGENTS.md. In that setup the same content is included twice in every such prompt — in our repo that is ~38k chars ≈ ~10k tokens, so ~20k tokens per generation for zero new information.

Where

Observed in the installed macOS app, T3 Code (Alpha) 0.0.42, app.asar (minified; the repo_conventions case of the text-generation policy builder):

case "repo_conventions": {
  const subjects = yield* readRecentCommitSubjects(cwd);
  const agentInstructions = yield* readRepositoryInstructions(cwd, "AGENTS.md");
  const claudeInstructions = settings.modelSelection.instanceId === "claudeAgent"
    || (yield* providerRegistry.getProviders).some((provider) =>
         provider.instanceId === settings.modelSelection.instanceId
         && provider.driver === "claudeAgent")
    ? yield* readRepositoryInstructions(cwd, "CLAUDE.md") : "";
  const examples = [
    ...subjects.length > 0 ? [["Recent commit subjects from this repository:", ...subjects].join("\n")] : [],
    ...agentInstructions ? [`Local AGENTS.md:\n${agentInstructions}`] : [],
    ...claudeInstructions ? [`Local CLAUDE.md:\n${claudeInstructions}`] : []
  ].join("\n\n");
  ...
}

readRepositoryInstructions reads through the symlink, so claudeInstructions ends up byte-identical to agentInstructions.

Repro

  1. Repo with a large AGENTS.md and CLAUDE.md -> AGENTS.md (symlink), Claude driver.
  2. Trigger commit-message / change-request generation.
  3. The conventions prompt contains Local AGENTS.md: and Local CLAUDE.md: blocks with the same content.

Proposed fix

Dedup by content after reading — cheapest form is a one-line guard:

...claudeInstructions && claudeInstructions !== agentInstructions
  ? [`Local CLAUDE.md:\n${claudeInstructions}`] : []

(String equality covers symlinks, hardlinks and manual copies alike; a content hash works too if the strings are large. Resolving symlinks alone would miss the copy case.)

Contributor guide

Open the contributing guide

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.

Research direction

Start at the repo_conventions case in the text-generation policy builder and inspect its readRepositoryInstructions calls for AGENTS.md and CLAUDE.md. Reproduce with CLAUDE.md as a symlink or identical copy, then verify the generated conventions prompt contains the shared content only once.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.