feat(agent): Instruct agent to follow repo rules and match comment style - #3900
Open
posthog[bot] wants to merge 1 commit into
Open
feat(agent): Instruct agent to follow repo rules and match comment style#3900posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Adds a "Repository Conventions" block to the agent's appended system-prompt instructions telling it to discover and follow repo-level convention files (CLAUDE.md, AGENTS.md, .cursorrules, .cursor/rules/*.mdc) and to mirror the existing code's comment density instead of adding narrating comments. Claude Code loads CLAUDE.md/AGENTS.md natively but never reads Cursor rules, and nothing previously reinforced matching the repo's comment style. This addresses inbox-beta feedback that generated PRs ignore the user's coding style, add unnecessary comments, and don't follow the repo's cursor/claude rules. Applies to every session (desktop and cloud, including inbox-generated PRs) via buildAppendedInstructions -> buildSystemPrompt. Generated-By: PostHog Code Task-Id: 0a966bbb-531f-439e-a3c2-c2c6b0aabb79
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Twixes
marked this pull request as ready for review
July 28, 2026 20:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An inbox-beta user (ticket #64146) asked whether they can give the coding agent extra guidance, and reported that generated PRs don't follow their coding style, add lots of unnecessary comments that just explain the fix, and ignore the repo's cursor/claude rules. Giving direction at Create-PR time already shipped (the
feedbacksteering prompt), but nothing made the agent honor the repo's own conventions or match its comment style.Changes
Added a Repository Conventions block to the agent's appended system-prompt instructions (
buildAppendedInstructions→buildSystemPrompt), which is applied to every session (desktop and cloud, including inbox-generated PRs). It tells the agent to:CLAUDE.md,AGENTS.md,.cursorrules, and rule files under.cursor/rules/(*.mdc). Claude Code loadsCLAUDE.md/AGENTS.mdnatively but never reads Cursor rules, so the instruction explicitly points the agent at them.Why: directly addresses the beta feedback that PRs ignore coding style, over-comment, and skip the repo's cursor/claude rules.
How did you test this?
packages/agent/src/adapters/claude/session/instructions.test.ts– asserts the new "Repository Conventions" block is present (referencing.cursor/rules/and comment density). All 4 tests pass viapnpm exec vitest run.instructions.ts) with no new imports.Automatic notifications
Created with PostHog Code from an inbox report