Skip to content

Rewrite copilot-instructions.md to remove redundant context#638

Open
hdwhdw wants to merge 2 commits intosonic-net:masterfrom
hdwhdw:rewrite-copilot-instructions
Open

Rewrite copilot-instructions.md to remove redundant context#638
hdwhdw wants to merge 2 commits intosonic-net:masterfrom
hdwhdw:rewrite-copilot-instructions

Conversation

@hdwhdw
Copy link
Copy Markdown
Contributor

@hdwhdw hdwhdw commented Apr 2, 2026

Replace the auto-generated style instructions file with only non-discoverable gotchas and code review guidance.

Why: Per Addy Osmani's argument, redundant AI context (directory trees, naming conventions, dependency lists) inflates agent cost ~20% and reduces task success rates. It also increase the burden on maintainers to keep these instruction up to date or risk misleading the agent. Agent should discover the information dynamically by reading code.

Removed:

  • Directory tree listing
  • Go naming conventions / gofmt guidance
  • Build commands that don't work outside SONiC build env (go get -u, go test ./...)
  • Dependency list (readable from go.mod)
  • Generic gotchas discoverable from code

Kept/Added (non-discoverable only):

  1. Sibling directory layout requirement (go.mod replace directive)
  2. Build tags silently disable write support
  3. Unit tests that actually require sudo + Redis
  4. CI dependency on external Azure pipeline artifacts
  5. Vendor patching corrupts state on partial failure
  6. pure.mk is the local dev CI
  7. Proto generation modifies go.mod as side effect

Added code review guidance:

  • Prefer pure packages (testable via pure.mk) for new code
  • Prefer idiomatic Go layout (internal/, pkg/) over new top-level directories

Replace the auto-generated style instructions file with only
non-discoverable gotchas and code review guidance, per Addy Osmani's
argument that redundant AI context inflates cost and reduces agent
task success rates.

Removed: directory tree, naming conventions, build commands that
don't work outside SONiC build env, dependency lists, generic Go
style guidance — all discoverable by reading the code.

Added: sibling repo layout requirement, silent write-disable via
build tags, vendor corruption on partial failure, pure.mk as local
CI, and review guidance to prefer pure packages and idiomatic Go
project layout for new code.

Signed-off-by: Dawei Huang <[email protected]>
Copilot AI review requested due to automatic review settings April 2, 2026 15:52
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR rewrites .github/copilot-instructions.md to remove broadly discoverable repository context and keep only high-signal build/test gotchas plus code review guidance, reducing instruction bloat for automated agents and reviewers.

Changes:

  • Replaces the prior long-form project overview with a short “Non-obvious gotchas” list focused on local build/CI pitfalls.
  • Adds/keeps guidance intended to steer new changes toward “pure” packages and idiomatic Go layout.

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@hdwhdw hdwhdw requested a review from rustiqly April 2, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants