Skip to main content

F4: The .github Agentic OS β€” GitHub Copilot's 7 Primitives

Duration: 45–60 minutes | Level: Deep-Dive Part of: 🌱 FROOT Foundations Layer Prerequisites: O2 (AI Agents), O3 (MCP, Tools & Function Calling) Last Updated: March 2026


Table of Contents​


F4.1 Why .github Is No Longer Just a Folder​

GitHub Copilot's .github folder has evolved from a single copilot-instructions.md file into a full agentic operating system β€” 7 composable primitives across 4 layers that turn any repository into an agent-native workspace.

This is not a future roadmap. This is happening now. Every AI-first team needs to understand and adopt these primitives to stay competitive.

The Mental Model​

Think of .github as your repository's operating system for AI agents:

Traditional OS.github Agentic OS
Kernel (always running)Instructions (always-on context)
Applications (user-launched)Prompt Files (slash commands)
Services (background processes)Custom Agents (specialist personas)
Libraries (shared code)Skills (self-contained logic)
Security policiesHooks (lifecycle enforcement)
Cron jobs / systemdAgentic Workflows (AI-driven CI)
Package managerPlugins (bundle + distribute)

F4.2 The 4-Layer Architecture​

The 7 primitives are organized into 4 layers, each serving a distinct purpose:

LayerPrimitivesTriggerScope
1. Always-OnInstructionsEvery prompt (automatic)Passive context
2. On-DemandPrompts, Agents, SkillsUser or agent invokesActive capabilities
3. EnforcementHooks, WorkflowsLifecycle eventsGuardrails + automation
4. DistributionPluginsPackage + publishShare across repos

F4.3 Layer 1 β€” Always-On Context (Instructions)​

Primitive 1: Instructions​

Files: .github/copilot-instructions.md + .github/instructions/*.instructions.md

Instructions are passive memory β€” they apply to every prompt automatically without the user asking. Copilot reads these before generating any response.

Use for: Coding standards, framework rules, repo conventions, architectural constraints.

Single File (Legacy)​

<!-- .github/copilot-instructions.md -->
You are working on an Azure-based RAG pipeline.
Always use Managed Identity. Never hardcode secrets.
Use config/*.json for all AI parameters.

Modular Files (Modern)​

.github/instructions/
β”œβ”€β”€ azure-coding.instructions.md # Azure SDK patterns, managed identity
β”œβ”€β”€ rag-patterns.instructions.md # Chunking, retrieval, anti-hallucination
└── security.instructions.md # Secrets, PII, access control

Why modular? Different files apply to different parts of the codebase. Copilot loads only the relevant instructions based on the file being edited, reducing noise and improving accuracy.

Best Practices​

DoDon't
Keep instructions short and specificWrite essays β€” agents lose focus
Use bullet points and rulesUse vague guidance ("be careful")
Reference specific files (config/openai.json)Reference abstract concepts
Update when patterns changeSet and forget

F4.4 Layer 2 β€” On-Demand Capabilities​

Primitive 2: Prompt Files​

Files: .github/prompts/*.prompt.md

Prompt files are slash commands β€” manually invoked by the user or another agent. They define a specific task with context and steps.

<!-- .github/prompts/deploy.prompt.md -->
# Deploy to Azure

## Steps
1. Validate config files exist
2. Run az bicep build to validate template
3. Deploy infrastructure
4. Run smoke test

Invocation: Type /deploy in Copilot Chat β†’ Copilot reads and executes the prompt.

Use for: /security-review, /release-notes, /changelog, /deploy, /test, /evaluate

Primitive 3: Custom Agents​

Files: .github/agents/*.agent.md

Custom agents are specialist personas with their own identity, tools, and MCP server bindings. Agents can be chained via handoffs:

planning agent β†’ implementation agent β†’ review agent
<!-- .github/agents/builder.agent.md -->
# Builder Agent

You are the implementation agent for this solution.

## Your Tools
- FrootAI MCP Server (frootai-mcp)
- Azure CLI
- Python runtime

## Your MCP Servers
{"servers": {"frootai": {"command": "npx", "args": ["frootai-mcp"]}}}

## Rules
- Use values from config files, never hardcode
- Hand off to reviewer.agent.md when done

Key difference from instructions: Instructions are passive (always on). Agents are active (invoked for specific tasks) and have their own tool bindings.

Primitive 4: Skills​

Files: .github/skills/<name>/SKILL.md

Skills are self-contained folders with instructions + scripts + references. They're progressively loaded β€” Copilot reads the description first, loads the full instructions only when relevant.

.github/skills/
β”œβ”€β”€ deploy-azure/
β”‚ β”œβ”€β”€ SKILL.md # Description + prerequisites + references
β”‚ └── deploy.sh # Executable script
β”œβ”€β”€ evaluate/
β”‚ β”œβ”€β”€ SKILL.md
β”‚ └── eval.py
└── tune/
β”œβ”€β”€ SKILL.md
└── tune-config.sh

Use for: Repeatable runbooks, incident triage, IaC risk analysis, deployment procedures.

Progressive loading: Copilot reads SKILL.md header first. If the user's question matches the skill's domain, Copilot loads the full content. This saves tokens and reduces noise.


F4.5 Layer 3 β€” Enforcement & Automation​

Primitive 5: Hooks​

Files: .github/hooks/*.json

Hooks are deterministic shell commands triggered at lifecycle events. They enforce policies before, during, and after tool execution.

Three lifecycle events:

EventWhenUse Case
preToolUseBefore a tool executesApprove or deny tool executions. Policy gates.
postToolUseAfter a tool completesAudit logging, notifications.
errorOccurredWhen a tool failsSuggest troubleshooting, auto-recover.
{
"hooks": [
{
"event": "preToolUse",
"match": { "toolName": "write_file", "pathPattern": "**/*.env" },
"action": "deny_if_contains",
"patterns": ["api_key", "secret", "password"],
"message": "BLOCKED: Detected secrets. Use Key Vault."
}
]
}

Why hooks are critical: They make the AI agent safe by default. Without hooks, an agent can write secrets to code, modify guardrails, or deploy to production. With hooks, you enforce policies deterministically β€” no LLM judgment involved.

Primitive 6: Agentic Workflows​

Files: .github/workflows/*.md (compiled to YAML GitHub Actions)

Agentic workflows are natural language automation that compiles to GitHub Actions. They define AI-driven CI/CD pipelines.

<!-- .github/workflows/ai-review.md -->
# AI Code Review

## Trigger
On pull request to main branch.

## Steps
1. Validate TuneKit configs
2. Run evaluation pipeline
3. Post review summary as PR comment
4. Block merge if critical issues found

Key insight: The .md file is the source of truth β€” it's human-readable and AI-editable. It compiles to YAML for GitHub Actions.

Use for: PR review automation, deployment pipelines, scheduled maintenance, issue triage.

Permissions: Always read-only unless explicitly elevated. Principle of least privilege.


F4.6 Layer 4 β€” Distribution (Plugins)​

Primitive 7: Plugins​

Plugins bundle agents + skills + commands into a distributable package. Two distribution modes:

ModeHowExample
Self-hostedHost on your own repoTeam shares internal agent stacks
MarketplaceList in GitHub MarketplacePublic distribution, discoverability
{
"plugin": "frootai-enterprise-rag",
"version": "1.0.0",
"agents": ["builder", "reviewer", "tuner"],
"skills": ["deploy-azure", "evaluate", "tune"],
"prompts": ["deploy", "test", "review", "evaluate"],
"hooks": ["guardrails"],
"mcp_servers": ["frootai"]
}

plugin.json declares what's inside. Consumers install the plugin β†’ get all agents, skills, prompts, and hooks preconfigured.

FrootAI ships plugin.json in every solution play. Each of the 20 plays has a full manifest declaring all agentic OS files, DevKit, TuneKit, MCP server bindings, tags, complexity, and status. Browse them at github.com/gitpavleenbali/frootai/tree/main/solution-plays.


F4.7 FrootAI's Implementation β€” 19 Files per Solution Play​

FrootAI is the first ecosystem to ship production-ready .github agentic OS folders for 20 AI solution plays. Here's the complete structure:

solution-plays/01-enterprise-rag/
β”œβ”€β”€ .github/
β”‚ β”œβ”€β”€ copilot-instructions.md # Layer 1
β”‚ β”œβ”€β”€ instructions/
β”‚ β”‚ β”œβ”€β”€ azure-coding.instructions.md # Coding standards
β”‚ β”‚ β”œβ”€β”€ rag-patterns.instructions.md # RAG-specific rules
β”‚ β”‚ └── security.instructions.md # Security conventions
β”‚ β”œβ”€β”€ prompts/
β”‚ β”‚ β”œβ”€β”€ deploy.prompt.md # /deploy
β”‚ β”‚ β”œβ”€β”€ test.prompt.md # /test
β”‚ β”‚ β”œβ”€β”€ review.prompt.md # /review
β”‚ β”‚ └── evaluate.prompt.md # /evaluate
β”‚ β”œβ”€β”€ agents/
β”‚ β”‚ β”œβ”€β”€ builder.agent.md # Implementation
β”‚ β”‚ β”œβ”€β”€ reviewer.agent.md # Code review
β”‚ β”‚ └── tuner.agent.md # TuneKit verification
β”‚ β”œβ”€β”€ skills/
β”‚ β”‚ β”œβ”€β”€ deploy-azure/SKILL.md # Azure deployment
β”‚ β”‚ β”œβ”€β”€ evaluate/SKILL.md # Quality evaluation
β”‚ β”‚ └── tune/SKILL.md # Config validation
β”‚ β”œβ”€β”€ hooks/
β”‚ β”‚ └── guardrails.json # Policy enforcement
β”‚ └── workflows/
β”‚ β”œβ”€β”€ ai-review.md # PR review automation
β”‚ └── ai-deploy.md # Deployment automation

19 files Γ— 20 plays = 380 agentic OS files.

Agent Chain (per play)​


F4.8 Decision Guide β€” When to Use What​

I want to...Use this primitiveLayer
Set coding standards for the whole repoInstructions (.instructions.md)1
Create a repeatable task (deploy, test)Prompt File (.prompt.md)2
Create a specialist AI personaCustom Agent (.agent.md)2
Package a runbook with scriptsSkill (SKILL.md + scripts)2
Block dangerous tool actionsHook (guardrails.json)3
Automate PR reviews or deploymentsAgentic Workflow (.md β†’ Actions)3
Share agent stacks across reposPlugin (plugin.json)4

Layering Strategy​

Start here β†’ Layer 1 (Instructions)
↓ Need slash commands? β†’ Layer 2 (Prompts)
↓ Need specialist agents? β†’ Layer 2 (Agents + Skills)
↓ Need safety enforcement? β†’ Layer 3 (Hooks)
↓ Need CI/CD automation? β†’ Layer 3 (Workflows)
↓ Need to share across repos? β†’ Layer 4 (Plugins)

F4.9 Building Your Own .github Agentic OS​

Step 1: Start with Instructions (5 minutes)​

Create .github/copilot-instructions.md:

You are working on [PROJECT NAME].
Framework: [e.g., Python FastAPI + Azure]
Always use managed identity. Never hardcode secrets.
Follow the patterns in docs/architecture.md.

Step 2: Add Modular Instructions (10 minutes)​

Create .github/instructions/ with domain-specific files.

Step 3: Add Prompt Files (15 minutes)​

Create .github/prompts/ for common tasks: deploy, test, review.

Step 4: Add Agents (20 minutes)​

Create .github/agents/ with specialist personas for your codebase.

Step 5: Add Skills (20 minutes)​

Create .github/skills/ with self-contained runbooks.

Step 6: Add Hooks (10 minutes)​

Create .github/hooks/guardrails.json with preToolUse policies.

Step 7: Add Workflows (15 minutes)​

Create .github/workflows/ with AI-driven CI/CD.

Total time: ~95 minutes for a complete .github agentic OS.

Or use FrootAI: run FrootAI: Initialize DevKit β†’ get all 19 files instantly.


Key Takeaways​

  1. The .github folder is now an operating system β€” 7 primitives, 4 layers, one repo.
  2. Layer 1 (Instructions) is the foundation β€” always start here. Passive memory that applies to every prompt.
  3. Layer 2 (Prompts, Agents, Skills) adds on-demand power β€” specialist personas, slash commands, self-contained logic.
  4. Layer 3 (Hooks, Workflows) adds safety β€” deterministic enforcement and AI-driven CI/CD.
  5. Layer 4 (Plugins) enables distribution β€” share agent stacks across repos and marketplace.
  6. Agent chaining (builder β†’ reviewer β†’ tuner) creates quality gates that catch issues before production.
  7. Hooks are non-negotiable β€” preToolUse gates prevent secrets in code, policy violations, and unsafe operations.
  8. FrootAI ships 380 files β€” 19 per solution play Γ— 20 plays. Ready-to-use .github agentic OS for 20 AI solutions.

Next: O2: AI Agents & Agent Framework for deep agent architecture | O3: MCP, Tools & Function Calling for MCP server patterns