Ziqi (Katrina) Ding

Back

The Situation#

We had a good copilot-instructions.md. Project overview, tech stack, folder structure, coding conventions, security rules, the works. Over 300 lines. Then we added a custom chat mode for package upgrades and a handful of prompt files for bug fixes and features.

And Copilot got worse.

The Problems#

Context window gets full too fast#

Every request now carried:

  • the full custom instructions
  • the chat mode’s system prompt
  • the inline prompt for the task
  • plus the actual code we were working on

Then we hit the wall. The model ran out of room to remember the conversation.

What we noticed:

  • Had to re-explain the problem multiple times
  • Responses got generic and lost all the project context
  • Stopped following the response guidelines we defined at the start

Instructions fighting each other#

We set up nice instructions everywhere, then they started contradicting.

Real example we hit:

  • copilot-instructions.md says “always use async/await for consistency”
  • A legacy prompt file mentions “callbacks for compatibility”
  • Copilot gets confused and produces a weird mix of both

The mess we ended up with:

  • Code that’s half async, half callback
  • Different patterns in the same function
  • Copilot switching approaches mid-conversation

Wrong instructions win#

Here’s what we learned the hard way: prompts have a priority order.

  1. Whatever you just typed (inline prompts)
  2. Your chat mode’s system prompt
  3. copilot-instructions.md

Where it breaks: you use a quick prompt to format something, and suddenly it ignores the syntax rules from copilot-instructions.md.

It gets worse with weaker models:

  • They follow the latest prompt blindly
  • Forget your coding standards
  • Skip the security checks you carefully set up

The Solution#

After a few trials, the best approach we found (for now) is to split the prompts apart by what they’re for.

1. Separate instructions from context#

Instead of cramming everything into copilot-instructions.md, split it:

.github
├── copilot-instructions.md     # AI behaviour rules only
├── copilot-project-context.md  # Technical details, stack, structure
└── prompts/
    ├── bug-fix.prompt.md        # Task-specific procedures
    └── add-feature.prompt.md
sh

What goes where:

  • copilot-instructions.md: how the AI should behave. Ask first, plan before coding, state confidence, when to stop.
  • copilot-project-context.md: what the project is. Tech stack, folder structure, conventions, no-go areas.
  • Individual prompt files: the procedure for one kind of task.

Copilot only auto-loads copilot-instructions.md. The context file is read on demand, when the instructions tell the model to go read it.

2. Keep instructions short and focused#

We learned to be brutal about cutting. Our copilot-instructions.md went from 300+ lines to under 120.

What we kept:

  • Critical workflow rules (like “never edit code immediately”)
  • Security guidelines
  • A confidence assessment framework
  • Fallback procedures

What we moved out:

  • Project tech stack → copilot-project-context.md
  • Architecture details → copilot-project-context.md
  • Task-specific steps → individual prompt files

3. Cross-reference instead of duplicate#

Instead of repeating info everywhere, each file points at the others.

In copilot-instructions.md:

## 📋 Project Technical Context

For project-specific details (tech stack, architecture, restrictions), read:
→ [copilot-project-context.md](copilot-project-context.md)
markdown

In copilot-project-context.md:

## 🤖 AI Behavioral Rules

For AI workflow rules and behavioral guidelines, see:
→ [copilot-instructions.md](copilot-instructions.md)
markdown

And at the top of every prompt file:

## Before Starting
- Follow behavioral rules: [copilot-instructions.md](../copilot-instructions.md)
- For project technical context: [copilot-project-context.md](../copilot-project-context.md)
markdown

Each file stays focused, one fact lives in one place, and there’s nothing left to contradict.

What It Looks Like#

The trimmed instructions file we settled on (copilot-instructions.md) looks like this:

# Copilot Instructions

## 📋 Project Technical Context
→ read copilot-project-context.md

## 🚨 CRITICAL: NEVER EDIT CODE IMMEDIATELY 🚨
Ask clarifying questions → present a plan → wait for approval → one small change at a time.
For new tasks, write the plan to `.dev-notes/` first.

## AI Confidence Assessment
High (>90%) / Medium (70–90%) / Low (<70%), and what to do at each level.

## Fallback
When stuck: stop, summarise what you know, ask.
markdown

Everything about this project (stack, structure, “do not touch src/utils/BLE/”) lives in the context file, and each task procedure lives in its own prompt.

Summary#

If Copilot starts ignoring your rules, it’s usually not the model. It’s a 300-line instructions file competing with a chat mode and an inline prompt for the same context window. Split behaviour from project context, cut both hard, and cross-reference instead of repeating.

References#

Why Your Copilot Instructions Stop Working - Split Behaviour From Project Context
https://katrina-ziqi-ding.com/blog/split-copilot-instructions
Author Ziqi (Katrina) Ding
Published at 25-08-2025