Skip to main content

F4: GitHub Agentic OS

The .github folder has evolved from a CI/CD config directory into a full agentic operating system for AI coding assistants. This module explains the 7 primitives, 4-layer architecture, and how FrootAI solution plays leverage them. For terminology, see the AI Glossary.

Evolutionโ€‹

What started as a single copilot-instructions.md file in 2021 is now a composable OS with 7 primitives across 4 layers โ€” instructions, prompt files, agents, skills, hooks, workflows, and plugins.

The 4-Layer Architectureโ€‹

LayerRolePrimitivesAlways Loaded?
1. Always-On ContextBackground knowledge injected into every requestInstructions (.instructions.md)โœ… Yes
2. On-Demand CapabilitiesActivated when the user or agent invokes themPrompt Files (.prompt.md), Agents (.agent.md), Skills (SKILL.md)โŒ On demand
3. EnforcementGuardrails and automation that fire on eventsHooks (hooks.json)โœ… On trigger
4. DistributionPackaging and sharing of primitivesPlugins (plugin.json), Workflows (.yml)โŒ On install

:::info Mental Model Think of it like an operating system:

Traditional OS.github Agentic OS
Environment variablescopilot-instructions.md
Shell scripts.prompt.md files
Applications.agent.md agents
System calls / APIsSKILL.md skills
Kernel hooks / drivershooks.json
Package managerplugin.json
Cron jobs / servicesAgentic workflows (.yml)
:::

The 7 Primitivesโ€‹

1. Instructions (.instructions.md) โ€” Always-On Contextโ€‹

Markdown files with YAML frontmatter that inject domain knowledge into every Copilot interaction matching an applyTo glob pattern.

---
description: "Python best practices for this project"
applyTo: "**/*.py"
---
# Python Guidelines
- Use type hints on all function signatures
- Prefer `pathlib.Path` over `os.path`
- Use `httpx` instead of `requests` for async HTTP

Key rules:

  • copilot-instructions.md is the most expensive file โ€” loaded on every request. Keep it under 150 lines.
  • Use applyTo globs to scope instructions to relevant files only
  • Knowledge-only โ€” describe what, not how to behave

2. Prompt Files (.prompt.md) โ€” Reusable Promptsโ€‹

Pre-authored prompts that users invoke explicitly. Support #variables for dynamic inputs.

---
description: "Generate unit tests for a module"
---
Write comprehensive unit tests for #selection using pytest.
Include edge cases, error conditions, and mock external dependencies.
Target 90% branch coverage.

3. Custom Agents (.agent.md) โ€” Specialized AI Teammatesโ€‹

Agents are personas with specific expertise, tool access, and model preferences.

---
description: "Security reviewer for OWASP LLM Top 10"
tools: ["codebase", "terminal", "githubRepo"]
model: ["gpt-4o", "gpt-4o-mini"]
waf: ["security"]
plays: ["01-enterprise-rag", "10-content-moderation"]
---
# FAI Security Reviewer
You are a security expert specializing in AI application security...

FrootAI pattern: Every solution play has a builder โ†’ reviewer โ†’ tuner agent triad.

4. Skills (SKILL.md) โ€” Multi-Step Proceduresโ€‹

Skills teach agents how to perform complex, multi-step tasks. Each skill lives in its own folder.

skills/
โ””โ”€โ”€ deploy-to-azure/
โ””โ”€โ”€ SKILL.md # 150+ lines of step-by-step instructions

Key rules:

  • Skill name (folder) must be lowercase-hyphen
  • SKILL.md must be 150+ lines with detailed steps
  • Folder name must match the name field in frontmatter

5. Hooks (hooks.json) โ€” Event-Driven Enforcementโ€‹

Hooks fire scripts on specific Copilot events. They enforce guardrails automatically.

{
"version": 1,
"hooks": [
{
"event": "SessionStart",
"script": "node .github/hooks/validate-env.js",
"description": "Verify required environment variables on session start"
}
]
}

Available events: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, SubagentStart, SubagentStop, Stop

:::warning Never Use PreToolUse Hooks PreToolUse hooks spawn a process on every single tool call โ€” adding ~5 seconds of latency each time. A typical Copilot session makes 50+ tool calls. That's 4+ minutes of pure overhead. Use SessionStart for validation and PostToolUse for auditing instead. :::

6. Agentic Workflows (.yml)โ€‹

GitHub Actions workflows that run AI agents in CI/CD โ€” e.g., automated code review on pull requests using .agent.md agents.

7. Plugins (plugin.json)โ€‹

Bundles of primitives (agents + skills + instructions) packaged for sharing across projects. Include name, version (semver), author, license, and a primitives manifest.

File Naming Conventionโ€‹

All primitives follow lowercase-hyphen naming:

PrimitivePatternExample
Agentkebab-case.agent.mdfai-rag-architect.agent.md
Instructionkebab-case.instructions.mdpython-waf.instructions.md
Skillkebab-case/SKILL.mddeploy-to-azure/SKILL.md
Hookkebab-case/hooks.jsonsecrets-scanner/hooks.json
Pluginkebab-case/plugin.jsonenterprise-rag/plugin.json

Play 101 Golden Template Structureโ€‹

Every FrootAI solution play follows this canonical layout:

solution-play-NN/
โ”œโ”€โ”€ agent.md # DevKit: root orchestrator
โ”œโ”€โ”€ .github/
โ”‚ โ”œโ”€โ”€ copilot-instructions.md # under 150 lines, knowledge ONLY
โ”‚ โ”œโ”€โ”€ agents/ # builder / reviewer / tuner triad
โ”‚ โ”œโ”€โ”€ instructions/ # Domain-specific context
โ”‚ โ”œโ”€โ”€ prompts/ # test / review / deploy / evaluate
โ”‚ โ”œโ”€โ”€ skills/ # 150+ line multi-step procedures
โ”‚ โ”œโ”€โ”€ hooks/ # SessionStart guardrails only
โ”‚ โ””โ”€โ”€ workflows/ # CI/CD pipelines
โ”œโ”€โ”€ config/ # TuneKit: openai.json, guardrails.json
โ”œโ”€โ”€ infra/ # AVM Bicep (Azure plays only)
โ”œโ”€โ”€ evaluation/ # Eval pipeline (AI plays)
โ””โ”€โ”€ spec/ # SpecKit: fai-manifest.json + README

FrootAI's FAI Protocol Integrationโ€‹

FrootAI extends the Agentic OS with the FAI Protocol โ€” a wiring layer connecting primitives across plays. fai-manifest.json declares which agents, skills, and hooks a play uses. fai-context.json provides lightweight context blocks (WAF alignment, compatible plays). Shared primitives at the repo root can be wired into multiple plays โ€” one fai-rag-architect.agent.md serves Play 01, 21, and 28.

Key Takeawaysโ€‹

  1. 7 primitives, 4 layers โ€” each primitive has one job; compose them for complex behavior
  2. Instructions are expensive โ€” copilot-instructions.md loads on every request; keep it lean
  3. Agents are cheap โ€” they only load when invoked; create specialized agents freely
  4. Hooks are dangerous โ€” PreToolUse adds ~5s per tool call; stick to SessionStart
  5. Plugins enable sharing โ€” package your primitives for reuse across projects

โ† F3: AI Glossary | Next: Explore Solution Plays โ†’