Skip to content

chore: trim copilot-instructions.md (#999)#1002

Closed
bradygaster wants to merge 0 commit intodevfrom
squad/999-trim-copilot-instructions
Closed

chore: trim copilot-instructions.md (#999)#1002
bradygaster wants to merge 0 commit intodevfrom
squad/999-trim-copilot-instructions

Conversation

@bradygaster
Copy link
Copy Markdown
Owner

Summary

Trims .github/copilot-instructions.md from ~1,300 words / 9KB to ~400 words / 3KB (≤1,000 tokens) by:

  • Extracting Protected Files to .copilot/skills/protected-files/SKILL.md
  • Consolidating Git Safety — collapsed 4 sub-sections into a single flat list, resolved contradictory branch commands
  • Compacting Changeset Requirement — reduced to 2 sentences
  • Reordering sections — Team Context and Capability Self-Check now appear first
  • Removing duplication with .squad/copilot-instructions.md
  • Condensing Sweeping Refactor Rules to 2-sentence pointer

No product source code modified. Build passes.

Closes #999

Copilot AI review requested due to automatic review settings April 18, 2026 05:16
@bradygaster bradygaster added the type:chore Maintenance, refactoring, cleanup label Apr 18, 2026
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 reduces the always-injected Copilot instruction payload by trimming .github/copilot-instructions.md and moving the “Protected Files” guidance into an on-demand skill file, while also including a significant CI workflow consolidation (and deletion of the manual CI rerun workflow).

Changes:

  • Trimmed .github/copilot-instructions.md and pointed Protected Files guidance to .copilot/skills/protected-files/SKILL.md.
  • Added new Protected Files skill at .copilot/skills/protected-files/SKILL.md.
  • Refactored .github/workflows/squad-ci.yml (job consolidation / policy gates) and deleted .github/workflows/ci-rerun.yml.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/copilot-instructions.md Shortened Copilot instructions and replaced embedded “Protected Files” section with a pointer to a skill.
.copilot/skills/protected-files/SKILL.md New skill documenting zero-dependency bootstrap/protected files guidance.
.github/workflows/squad-ci.yml Consolidated/streamlined CI jobs and gates; added workflow-change detection output.
.github/workflows/ci-rerun.yml Removed the manual “CI rerun” workflow.
.github/actions/setup-squad-node/action.yml Updated header comment to remove ci-rerun.yml reference.
.squad/agents/booster/history.md Added a CI cleanup log entry documenting the workflow changes.

Comment on lines +405 to 419
- name: Check for SDK changes
if: steps.gate.outputs.skip != 'true'
id: sdk
run: |
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
# Three-dot diff (base...head) finds the merge-base automatically,
# so it works correctly even when the PR branch contains merge
# commits from syncing with the base branch.
# Change detection regex: ^packages/squad-sdk/src/
# Matches any file under the SDK source directory.
# Config or test-only changes don't require exports validation.
SDK_CHANGED=$(git diff --name-only "$BASE"..."$HEAD" | grep -E '^packages/squad-sdk/src/' || true)
SDK_CHANGED=$(git diff --name-only "$BASE"..."$HEAD" | grep -E '^packages/squad-sdk/(src/|package\.json)' || true)
if [ -z "$SDK_CHANGED" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "No SDK source changes detected -- exports check not applicable"
echo "No SDK changes detected exports validation not applicable"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "SDK source files changed:"
echo "SDK files changed:"
echo "$SDK_CHANGED"
fi
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

In sdk-exports-validation, the “Check for SDK changes” step uses github.event.pull_request.base.sha / head.sha. This job also runs on push events, where github.event.pull_request is undefined, causing git diff to error/noise and potentially break skip detection. Update the step to branch on github.event_name (use PR base/head SHAs for PRs; use HEAD~1...HEAD or similar for pushes), and avoid calling gh pr view on push events.

Copilot uses AI. Check for mistakes.
Comment on lines 519 to 531
- name: Check for SDK source changes
if: steps.flag.outputs.skip == 'false' && steps.label.outputs.skip != 'true'
id: changes
if: steps.gate.outputs.skip != 'true'
id: sdk
run: |
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
# Change detection regex: ^packages/squad-sdk/src/
# Only SDK source changes trigger sample rebuilds — doc or config changes are skipped.
SDK_CHANGED=$(git diff --name-only "$BASE"..."$HEAD" | grep -E '^packages/squad-sdk/src/' || true)
if [ -z "$SDK_CHANGED" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "No SDK source changes detected -- samples build not applicable"
echo "No SDK source changes samples build not applicable"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "SDK source files changed:"
echo "$SDK_CHANGED"
fi
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

The samples-build gate runs on push events (job-level if allows non-PR), but Check for SDK source changes reads github.event.pull_request.base.sha/head.sha. On pushes this context is missing, so git diff will fail and the step may incorrectly mark the gate as not applicable. Please add push-specific diff logic (e.g., compare HEAD~1...HEAD) or make this job PR-only if push support isn’t required.

Copilot uses AI. Check for mistakes.
- ❌ NEVER `git add .`, `git add -A`, or `git commit -a` — stage specific files only
- ❌ NEVER push to `dev` or `main` directly — always open a PR
- ❌ NEVER force push to shared branches
- ✅ Branch from latest dev: `git fetch origin && git checkout dev && git pull origin dev && git checkout -b <branch>`
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

The branch creation command here hard-codes origin as the source of dev. Elsewhere in this repo (e.g. CONTRIBUTING.md and .github/PULL_REQUEST_TEMPLATE.md) the documented convention is to fetch/rebase from upstream/dev, which matters for forks where origin points at the contributor’s fork. Consider switching this line to the repo’s established upstream convention (or explicitly describe when origin vs upstream applies) to avoid reintroducing contradictory guidance.

Suggested change
- ✅ Branch from latest dev: `git fetch origin && git checkout dev && git pull origin dev && git checkout -b <branch>`
- ✅ Branch from latest dev: `git fetch upstream && git checkout dev && git rebase upstream/dev && git checkout -b <branch>`

Copilot uses AI. Check for mistakes.
Comment on lines +175 to 187
# ── Consolidated policy gates ───────────────────────────────────────────
# Runs changelog, changelog-protection, workspace-integrity,
# prerelease-version-guard, publish-policy, and scope-check on one runner.
policy-gates:
name: Policy Gates
needs: changes
if: >-
github.event_name == 'pull_request'
&& !cancelled()
&& (needs.changes.outputs.code == 'true'
|| needs.changes.outputs.workflows == 'true'
|| needs.changes.result == 'failure')
runs-on: ubuntu-latest
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

This workflow is being substantially refactored (job consolidation, new policy gates, deletion of ci-rerun.yml in the same PR), but the PR title/description focus on trimming .github/copilot-instructions.md. Please update the PR title/description to reflect the CI workflow changes, or split the CI refactor into a separate PR, so reviewers and release notes accurately capture the scope.

Copilot uses AI. Check for mistakes.

### CI Cleanup — Issue #1000 (2026-04-17)

**Changes shipped in PR #1001:**
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

This new history entry says the CI cleanup “shipped in PR #1001”, but these changes are part of the current PR (#999 per metadata). Please correct the referenced PR number (or clarify that this entry is documenting a different PR) so the history log remains traceable.

Suggested change
**Changes shipped in PR #1001:**
**Changes shipped in PR #999:**

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:chore Maintenance, refactoring, cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim .github/copilot-instructions.md to reduce attention dilution

3 participants