This repository serves as a reference implementation for the Recursive Artifact Framework (RAF).
RAF is an architectural pattern for Agentic AI that decouples an agent's Identity (Shell), Logic (Brain), and Memory (State). It is designed to run natively within GitHub Copilot (VS Code & Web) by leveraging the "Context Window" as a processing unit and the file system as long-term storage.
In the era of "1,000 Simultaneous Experiments," software is no longer just a tool; it is an employee. To manage this digital workforce, we cannot rely on ephemeral chat history. We must rely on persistent, self-maintaining artifacts.
The Golden Rule: Nullius in Verba ("Take nobody's word for it"). If a decision, rule, or architectural state exists only in the chat window, it does not exist. Agents must write their state to disk [Source: Conversation History].
Every agent in this framework acts as a system composed of three mandatory files. An agent cannot exist as a standalone entity.
| Component | File Extension | Role | Analogy |
|---|---|---|---|
| The Definition | *.agent.md |
The Controller: Defines identity, tools, and handoffs. It loads the Brain and Memory. | The "Job Description" & ID Badge. |
| The Instructions | *.instructions.md |
The Brain: The "Objective Function." Contains immutable rules, negative constraints, and style guides. | The "Employee Handbook" & SOPs. |
| The Design | *.design.md |
The Memory: The "State." Persists scope, architectural decisions, and the maintenance log. | The "Project Whiteboard" & Memory. |
To ensure auto-discovery by GitHub Copilot and VS Code, artifacts must reside in specific directories.
.
├── .github/
│ ├── agents/ # [The Shells] Executable Agent Profiles
│ │ ├── agent-architect.agent.md
│ │ ├── documentation-agent.agent.md
│ │ └── sql-optimizer.agent.md
│ │
│ ├── instructions/ # [The Brains] Scoped Logic & Rules
│ │ ├── copilot.instructions.md # Global axioms (apply to ALL)
│ │ ├── docs.instructions.md # Scoped to documentation
│ │ └── sql.instructions.md # Scoped to SQL files
│ │
│ └── design/ # [The Memories] State & Architecture
│ ├── agents.design.md # Meta-design for the framework itself
│ ├── docs.design.md # Documentation Diátaxis structure
│ └── schema.design.md # Database schema state
│
└── src/ # Application Source Code
Location: .github/agents/
This file allows the user to invoke the agent using @agent-name in Copilot Chat. It utilizes the Recursive Mandate to load its own context.
Key Features:
- Handoffs: Defines valid transitions to other agents (e.g., Planner -> Builder).
- Tooling: Explicitly lists MCP tools (e.g., filesystem, database access).
---
name: agent-architect
description: Designs and scaffolds new agent capabilities.
tools: [read, edit, search]
handoffs:
- label: Implement Design
agent: code-implementer
---
You are the Agent Architect.
1. Load your Brain: #file:.github/instructions/agent-arch.instructions.md
2. Load your Memory: #file:.github/design/agents.design.mdLocation: .github/instructions/
These files define the Objective Function of the agent. They use YAML frontmatter to strictly scope rules to specific files, preventing context pollution.
Key Features:
applyTo: Glob patterns that trigger these rules automatically when relevant files are open.- Axiomatic Logic: Binary rules (Do/Don't) rather than vague suggestions.
---
applyTo:
- "**/*.ts"
- ".github/agents/*.agent.md"
---
# Architectural Axioms
- NEVER hardcode secrets.
- ALWAYS update the associated .design.md file when changing architecture.Location: .github/design/
This is the Persistence Layer. Since LLM context windows are finite, agents must offload "long-term memory" to these files.
Key Features:
- Scope: Explicitly lists what the agent owns and ignores.
- Maintenance Log: A chronological history of why changes were made, written by the agent itself.
Used when creating a new feature or agent.
- User: Invokes
@agent-architectwith a high-level goal. - Architect:
- Creates a new
.design.mdfile to define the "Platonic Ideal" of the solution. - Creates a
.instructions.mdfile to define the constraints. - Creates the
.agent.mdshell to link them.
- Creates a new
- Result: A fully formed "Employee" ready to work.
The primary maintenance loop for all agents.
- Read: The agent reads its
.instructions.mdto understand how to act. - Check: The agent reads its
.design.mdto understand the current state. - Act: The agent modifies code in
src/. - Reflect: The agent MUST update its
.design.mdfile to reflect the changes it just made (e.g., "AddedgetUsermethod to API interface").
Orchestrating multiple agents.
- Scenario: You are in
planning-modeand the design is complete. - Action: Click the "Start Implementation" handoff button defined in the agent's frontmatter.
- Result: Context is transferred to the
implementation-agent, which automatically loads thecoding.instructions.mdand the recently updatedfeature.design.md.
This framework supports Model Context Protocol (MCP) servers to give agents capability beyond text editing.
- Read/Write: The framework uses the
filesystemMCP server to allow agents to create their own instruction files. - External Data: Agents can be configured to query database schemas or API specs via MCP before writing code.
- Clone this repository.
- Install GitHub Copilot Extension in VS Code.
- Enable Custom Instructions: Ensure
github.copilot.chat.codeGeneration.useInstructionFilesis set totruein VS Code settings. - Sync Settings: (Optional) Enable Settings Sync for "Prompts and Instructions" to share agent behaviors across devices.
This framework implements the agentic design principles described in the "Recursive Artifact Framework" and complies with GitHub Copilot's v1.106+ custom agent specifications.
