diff --git a/products/desktop/packages/agent/src/adapters/claude/session/instructions.test.ts b/products/desktop/packages/agent/src/adapters/claude/session/instructions.test.ts index d720e82a01dd..b5b9067b544c 100644 --- a/products/desktop/packages/agent/src/adapters/claude/session/instructions.test.ts +++ b/products/desktop/packages/agent/src/adapters/claude/session/instructions.test.ts @@ -22,6 +22,7 @@ describe("buildAppendedInstructions", () => { "# Plan Mode", "# MCP Tool Access", "# Data Handling", + "# Repository Conventions", "# Shell Efficiency", ])("always appends %s", (heading) => { expect(buildAppendedInstructions({ spokenNarration: false })).toContain( diff --git a/products/desktop/packages/agent/src/adapters/claude/session/instructions.ts b/products/desktop/packages/agent/src/adapters/claude/session/instructions.ts index 93e611c76c57..1f212c056659 100644 --- a/products/desktop/packages/agent/src/adapters/claude/session/instructions.ts +++ b/products/desktop/packages/agent/src/adapters/claude/session/instructions.ts @@ -40,6 +40,17 @@ const DATA_HANDLING = ` Material you were given as task context — customer conversations, support tickets, logs, internal threads — stays out of code, test data, comments, commit messages, and pull request text. Rewriting it, summarizing it, or swapping out names and domains does not clear it. `; +const REPOSITORY_CONVENTIONS = ` +# Repository Conventions + +Repositories carry their own coding conventions. Before your first edit, discover and read the ones this harness does not load for you: + +- \`AGENTS.md\` files: at the repo root and in any directory whose files you edit. \`CLAUDE.md\` is loaded for you automatically; when an \`AGENTS.md\` merely mirrors it you can move on, but when it carries its own content, follow that too. +- Cursor rule files: \`.cursor/rules/*.mdc\` (the repo root's, and any nested \`.cursor/rules/\` near the files you edit) and the legacy \`.cursorrules\`. These are never loaded automatically. A rule's frontmatter tells you its scope: \`alwaysApply: true\` rules apply to every change, \`globs\` scope a rule to matching files. + +Follow those conventions, and match the style of the surrounding code even where no rule states it. Comment density matters most: do not add comments that narrate the change or restate what the code plainly does. Keep only comments a rule or the existing code style would call for. +`; + const SHELL_EFFICIENCY = ` # Shell Efficiency @@ -77,6 +88,7 @@ const BASE_INSTRUCTIONS = PLAN_MODE + MCP_TOOLS + DATA_HANDLING + + REPOSITORY_CONVENTIONS + SHELL_EFFICIENCY; /** Shell-word shaped, so nothing else in the variable reaches the prompt. */