You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# GitHub Copilot File Manageme### Automation and Synchronization
2
2
3
-
This document describes the Copilot instruction system used across PSModule repositories to provide consistent guidance to AI coding agents.
3
+
All organization-tier Copilot files can be automatically synchron1. **Organization main instructions** (`instructions/organization/main.instructions.md`) - Organization-wide framework patterns
4
+
2.**Organization language instructions** (`instructions/organization/{Language}/main.instructions.md`) - Organization-wide language-specific patterns
5
+
3.**Organization context instructions** (`instructions/organization/{Language}/{context}.instructions.md`) - Organization-wide specialized patternsd from a central source to target repositories. The synchronization mechanism can be configured for different organizational contexts:
4
6
5
-
## Overview
7
+
**Standard Organization Setup:**
8
+
- Source: Organization's `.github` repository
9
+
- Target: Repositories with specific custom properties (e.g., `type: module`, `framework: standard`)
6
10
7
-
The PSModule ecosystem uses a structured instruction system that guides AI agents in making consistent changes across multiple repositories while allowing for project-specific customization.
11
+
**Enterprise Setup:**
12
+
- Source: Dedicated organization or repository within the enterprise
13
+
- Target: All managed repositories or those matching specific criteria
- Target: Repositories adopting the community framework
10
18
11
-
### Two-Tier Hierarchy
19
+
The synchronization process applies to all Copilot configuration types:
20
+
-**Updates**: All files under `organization/` folders are managed by automation and will be overwritten during sync
21
+
-**Preserves**: All files under `repository/` folders are never modified by the sync mechanism
22
+
-**Flexibility**: Organizations can choose their synchronization criteria and automation approachcture
12
23
13
-
The instruction system follows a two-tier hierarchy:
24
+
This specification documents a scalable GitHub Copilot file management architecture designed to provide consistent guidance, prompts, and chat modes across multiple repositories in community organizations and enterprises.
25
+
26
+
## Purpose and Context
27
+
28
+
Modern software organizations require a structured system for managing GitHub Copilot configuration files that enables AI agents to make consistent changes across multiple repositories while allowing for project-specific customization.
29
+
30
+
Due to the absence of native organization-wide configuration support in GitHub that provides a single location for common Copilot configurations, this architecture implements a scalable two-tier approach for managing:
31
+
32
+
-**Instructions**: Guidance and patterns for AI agents
33
+
-**Prompts**: Reusable prompt templates and patterns
34
+
-**Chat modes**: Specialized conversation contexts and behaviors
35
+
36
+
This architecture serves multiple organizational contexts:
37
+
-**Community Organizations**: Open source projects and community frameworks requiring consistent standards across repositories
38
+
-**Enterprises**: Large organizations needing centralized AI assistance standards across teams and projects
39
+
-**Enterprise Profiles**: Addresses the "enterprise profile" challenge by providing repository-level customization within organizational standardsEach Copilot configuration type follows a consistent two-tier management approach:
40
+
41
+
-**Organization tier**: Managed via automation from the organization level
42
+
-**Repository tier**: Managed locally within each repository
43
+
44
+
This design allows organizations to maintain consistency across all managed repositories while preserving flexibility for repository-specific requirements.
45
+
46
+
## Architecture Specification
47
+
48
+
### Design Decision: Legacy File Elimination
49
+
50
+
The file `.github/copilot-instructions.md` is not supported in this architecture. This specification replaces the simplified single-file approach with a structured system that manages all GitHub Copilot configuration files through organization-managed and repository-managed tiers.
51
+
52
+
### Automation and Synchronization
53
+
54
+
All organization-tier Copilot files are automatically synchronized from the organization's `.github` repository to all repositories that have:
55
+
- A custom property named `type`
56
+
- With the value `module`
57
+
58
+
The synchronization process applies to all Copilot configuration types:
59
+
-**Updates**: All files under `organization/` folders are managed by automation and will be overwritten during sync
60
+
-**Preserves**: All files under `repository/` folders are never modified by the sync mechanism
61
+
-**Source**: Organization files originate from the PSModule organization's `.github` repository### Folder Structure Specification
62
+
63
+
The `.github/` folder contains three Copilot configuration directories, each following the two-tier structure:
-**`instructions/organization/main.instructions.md`**: Universal organizational framework guidelines and architectural principles
96
+
-**`instructions/organization/{Language}/main.instructions.md`**: Core style guide and language-specific framework instructions
97
+
-**`instructions/organization/{Language}/{context}.instructions.md`**: Specialized framework patterns for specific scenarios
98
+
99
+
**Repository Files (Repository-Managed)**
100
+
-**`instructions/repository/main.instructions.md`**: Repository-specific context, technology stack information, and project-specific rules
101
+
-**`instructions/repository/{Language}/main.instructions.md`**: Repository-specific language style and patterns that override or extend framework instructions
102
+
-**`instructions/repository/{Language}/{context}.instructions.md`**: Project-specific overrides for specialized scenarios
103
+
104
+
#### Prompts (Reusable Templates)
105
+
106
+
**Organization Files (Organization-Managed)**
107
+
-**`prompts/organization/{name}.prompt.md`**: Standard organization-wide prompt templates for common scenarios
108
+
- Organization prompts provide consistent templates for frequent development tasks
30
109
31
-
Instructions are applied in precedence order, with more specific rules taking precedence:
110
+
**Repository Files (Repository-Managed)**
111
+
-**`prompts/repository/{name}.prompt.md`**: Project-specific prompt templates tailored to repository requirements
112
+
- Repository prompts extend or override organization templates for specialized use cases
32
113
33
-
1.**Framework instructions** provide foundation and universal patterns
34
-
2.**Repository instructions** override and extend framework instructions
35
-
3.**Language-specific instructions** inherit from their main instruction files
36
-
4.**Repository language instructions** take precedence over framework language instructions
114
+
#### Chat Modes (Conversation Contexts)
37
115
38
-
## Usage
116
+
**Organization Files (Organization-Managed)**
117
+
-**`chatmodes/organization/{name}.chatmode.md`**: Standard conversation contexts and specialized AI behaviors
118
+
- Organization chat modes provide consistent interaction patterns across repositories
119
+
120
+
**Repository Files (Repository-Managed)**
121
+
-**`chatmodes/repository/{name}.chatmode.md`**: Project-specific conversation contexts and behaviors
122
+
- Repository chat modes customize AI interactions for specific project needs
123
+
124
+
#### Context File Examples
125
+
For instructions, context-specific files may include:
4.**Repository main instructions** (`instructions/repository/main.instructions.md`) - Project-specific context and overrides
140
+
5.**Repository language instructions** (`instructions/repository/{Language}/main.instructions.md`) - Project-specific language patterns
141
+
6.**Repository context instructions** (`instructions/repository/{Language}/{context}.instructions.md`) - Most specific project-based overrides
142
+
143
+
#### Prompt and Chat Mode Precedence
144
+
145
+
For prompts and chat modes, repository-specific files take precedence over organization files when both exist:
146
+
147
+
-**Organization prompts/chat modes**: Provide default templates and behaviors
148
+
-**Repository prompts/chat modes**: Override or extend organization defaults for project-specific needs
149
+
150
+
This precedence system ensures that repository-specific requirements can override organization-wide patterns while maintaining consistency where no overrides exist.### Migration from Legacy Implementation
151
+
152
+
Repositories transitioning from the legacy `.github/copilot-instructions.md` approach should:
153
+
154
+
1.**Remove** the `.github/copilot-instructions.md` file
155
+
2.**Create** the new folder structure under `.github/` with `instructions/`, `prompts/`, and `chatmodes/` directories
156
+
3.**Distribute** existing content appropriately:
157
+
- Universal organizational patterns → Will be provided via organization sync to `instructions/organization/`
- Prompt templates → `prompts/repository/` (if any existed)
161
+
- Chat configurations → `chatmodes/repository/` (if any existed)
162
+
163
+
Note: Organization files for all Copilot configuration types will be automatically synchronized from the organization level, so manual creation is not necessary.
164
+
165
+
## Implementation Guidelines
39
166
40
167
### For AI Agents
41
168
42
-
When editing files, agents should:
169
+
When processing files in repositories using this architecture, AI agents should:
43
170
44
-
1. Locate the file you intend to edit and note its extension and repository segment (code, docs, workflows, etc.)
45
-
2. Load all matching framework instructions under `/.github/instructions/framework/`, then load the corresponding repository overrides under `/.github/instructions/repo/`
46
-
3. Respect the precedence order: framework → framework language → repository → repository language, applying the most specific rule last
47
-
4. If gaps appear, record them as enhancements and avoid unverified assumptions
48
-
5. After completing work, confirm that updates continue to fit the documented architecture and that any new patterns are captured in the appropriate instruction file
171
+
1.**Verify architecture compliance**: Confirm the absence of `.github/copilot-instructions.md` and presence of the three-folder Copilot structure under `.github/`
5.**Document patterns**: Record new patterns in appropriate files for future enhancement
178
+
6.**Validate changes**: Ensure modifications align with the architectural specification
49
179
50
-
### For Contributors
180
+
### For Repository Contributors
51
181
52
-
- Always consult both framework and repo instructions before editing
53
-
- Follow the `applyTo` glob when determining relevancy; do not assume coverage
54
-
- Document new patterns promptly so they can be promoted to framework guidance when reusable
182
+
Repository maintainers should understand:
55
183
56
-
## File Format
184
+
-**Organization files**: These are automatically synchronized across all Copilot configuration types and should not be manually edited
185
+
-**Repository files**: These are manually maintained and contain project-specific customizations for instructions, prompts, and chat modes
186
+
-**Precedence hierarchy**: Repository files can override organization files for all configuration types
187
+
-**Pattern documentation**: New patterns should be documented promptly in the appropriate scope (organization patterns should be proposed to the organization's central repository)
57
188
189
+
## File Format Specifications
190
+
191
+
### Instructions Format
58
192
All instruction files must follow this format:
59
193
60
194
```yaml
@@ -66,17 +200,37 @@ description: "Brief, actionable description of the instruction's purpose"
Prompt files should follow established GitHub Copilot prompt conventions with clear context and expected outcomes.
205
+
206
+
### Chat Modes Format
207
+
Chat mode files should define conversation contexts, specialized behaviors, and interaction patterns following GitHub Copilot chat mode specifications.
208
+
209
+
## Design Principles
210
+
211
+
This architecture is guided by the following principles:
70
212
71
-
- Honor convention over configuration, context awareness, pipeline friendliness, and cross-platform compatibility
72
-
- Maintain strong typing, clear documentation, robust authentication abstractions, and enterprise GitHub support throughout the ecosystem
73
-
- Expect tight coupling with GitHub Actions, PSModule authentication helpers, structured logging (`LogGroup`), and cross-repo dependencies
74
-
- Validate changes against both local tooling and CI automation
213
+
-**Comprehensive Copilot management**: Unified approach to managing all GitHub Copilot configuration files (instructions, prompts, chat modes)
214
+
-**Separation of concerns**: Organization-level configurations are managed centrally while repository-specific configurations remain under local control
215
+
-**Automation-friendly**: The organization tier supports automated synchronization across all configuration types without affecting repository-managed content
216
+
-**Hierarchical precedence**: More specific configurations override general ones, enabling customization while maintaining consistency
217
+
-**Convention over configuration**: Established patterns and cross-platform compatibility are prioritized
218
+
-**Enterprise integration**: Designed for GitHub enterprise environments with proper authentication, logging, and CI/CD integration
219
+
-**Scalable governance**: Organization-wide consistency without sacrificing project-specific flexibility
75
220
76
-
## Definitions
221
+
## Terminology
77
222
78
-
| Term |Description|
223
+
| Term |Definition|
79
224
| --- | --- |
80
-
|**Framework instructions**| Canonical, reusable rules under `/.github/instructions/framework/` that apply across PSModule repositories |
81
-
|**Repository instructions**| Overrides located under `/.github/instructions/repo/` describing project-specific expectations |
82
-
|**Precedence order**| Evaluation order where the most specific applicable instruction file governs the final decision |
225
+
|**Organization instructions**| Organization-managed instruction files under `.github/instructions/organization/` that provide consistent patterns across all managed repositories |
226
+
|**Repository instructions**| Repository-managed instruction files under `.github/instructions/repository/` that contain project-specific overrides and extensions |
227
+
|**Organization prompts**| Organization-managed prompt templates under `.github/prompts/organization/` that provide standard reusable patterns |
228
+
|**Repository prompts**| Repository-managed prompt templates under `.github/prompts/repository/` that contain project-specific prompt customizations |
229
+
|**Organization chat modes**| Organization-managed conversation contexts under `.github/chatmodes/organization/` that define standard AI interaction patterns |
230
+
|**Repository chat modes**| Repository-managed conversation contexts under `.github/chatmodes/repository/` that define project-specific AI behaviors |
231
+
|**Main instructions**| The primary `main.instructions.md` file at the root of organization or repository instruction folders containing core guidelines for that scope |
232
+
|**Language instructions**| Language or technology-specific instructions contained within `{Language}/` subfolders |
233
+
|**Context instructions**| Specialized instructions for specific file types, folders, or scenarios (e.g., `tests.instructions.md`, `workflows.instructions.md`) |
234
+
|**Precedence hierarchy**| The evaluation order where more specific configuration files override more general ones across all Copilot file types |
235
+
|**Automatic synchronization**| The process by which organization files are updated from a central source to target repositories for all Copilot configuration types |
236
+
|**Managed repository**| A repository that receives automated synchronization based on organizational criteria (custom properties, naming patterns, etc.) |
0 commit comments