Skip to content

Commit 1d9060b

Browse files
t3dotggclaude
andauthored
fix(server): commit prompts no longer repeat CLAUDE.md when it matches AGENTS.md (pingdotgg#22848)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 2d40894 commit 1d9060b

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

‎apps/server/src/git/GitManager.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,42 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
25572557
}),
25582558
);
25592559

2560+
it.effect("includes CLAUDE.md for Claude writers only when it differs from AGENTS.md", () =>
2561+
Effect.gen(function* () {
2562+
const repoDir = yield* makeTempDir("t3code-git-manager-");
2563+
yield* initRepo(repoDir);
2564+
NodeFS.writeFileSync(NodePath.join(repoDir, "AGENTS.md"), "Use imperative subjects.\n");
2565+
NodeFS.copyFileSync(NodePath.join(repoDir, "AGENTS.md"), NodePath.join(repoDir, "CLAUDE.md"));
2566+
NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), "hello\n");
2567+
const commitInstructions: Array<string | undefined> = [];
2568+
2569+
const { manager } = yield* makeManager({
2570+
serverSettings: {
2571+
textGenerationModelSelection: {
2572+
instanceId: ProviderInstanceId.make("claudeAgent"),
2573+
model: "claude-sonnet-4-5",
2574+
},
2575+
},
2576+
textGeneration: {
2577+
generateCommitMessage: (input) => {
2578+
commitInstructions.push(input.policy?.commitInstructions);
2579+
return Effect.succeed({ subject: "Update readme", body: "" });
2580+
},
2581+
},
2582+
});
2583+
2584+
yield* runStackedAction(manager, { cwd: repoDir, action: "commit" });
2585+
2586+
NodeFS.writeFileSync(NodePath.join(repoDir, "CLAUDE.md"), "Mention the Claude provider.\n");
2587+
NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), "hello again\n");
2588+
yield* runStackedAction(manager, { cwd: repoDir, action: "commit" });
2589+
2590+
expect(commitInstructions[0]).toContain("Local AGENTS.md:\nUse imperative subjects.");
2591+
expect(commitInstructions[0]).not.toContain("Local CLAUDE.md:");
2592+
expect(commitInstructions[1]).toContain("Local CLAUDE.md:\nMention the Claude provider.");
2593+
}),
2594+
);
2595+
25602596
it.effect("falls back when the dedicated source control writer is unavailable", () =>
25612597
Effect.gen(function* () {
25622598
const repoDir = yield* makeTempDir("t3code-git-manager-");

‎apps/server/src/git/GitManager.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,10 @@ export const make = Effect.gen(function* () {
863863
? [["Recent commit subjects from this repository:", ...subjects].join("\n")]
864864
: []),
865865
...(agentInstructions ? [`Local AGENTS.md:\n${agentInstructions}`] : []),
866-
...(claudeInstructions ? [`Local CLAUDE.md:\n${claudeInstructions}`] : []),
866+
// CLAUDE.md is often a symlink or copy of AGENTS.md; skip the duplicate.
867+
...(claudeInstructions && claudeInstructions !== agentInstructions
868+
? [`Local CLAUDE.md:\n${claudeInstructions}`]
869+
: []),
867870
].join("\n\n");
868871
if (!examples) {
869872
return repositoryConventionsTextGenerationPolicy;

0 commit comments

Comments
 (0)