Agent System¶
PGA uses a file-based agent system modeled after the GitHub Copilot agent convention. Agents are markdown files that define custom instructions, tool access, and LLM profile preferences for the AI assistant.
Overview¶
There are two types of agent files:
| File | Scope | Purpose |
|---|---|---|
AGENTS.md |
Global | Project-wide instructions that apply to every conversation |
*.agent.md |
Named agent | A specialized agent with its own instructions and tool set |
AGENTS.md — Global Instructions¶
Place an AGENTS.md file at the root of your project to provide global instructions that the AI always follows when working in that directory.
| Text Only | |
|---|---|
1 2 3 4 5 | |
Format¶
AGENTS.md is a plain markdown file. No frontmatter is required (though it's supported).
| Markdown | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
How It Works¶
When you start a chat session (pga chat) from a project directory, PGA:
- Looks for
AGENTS.mdat the project root - Reads its content and includes it in the system prompt sent to the LLM
- The AI follows these instructions throughout the conversation
*.agent.md — Named Agents¶
Named agents are markdown files with YAML frontmatter that define specialized AI behaviors. They live in the agents/ directory.
| Text Only | |
|---|---|
1 2 3 4 5 6 7 | |
File Format¶
| Markdown | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Frontmatter Fields¶
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | Agent name. Defaults to filename (e.g., code-reviewer from code-reviewer.agent.md) |
description |
string |
No | Short description shown when listing agents |
profile |
string |
No | Preferred LLM profile name. Can be overridden by --profile |
tools |
string[] |
No | Whitelist of tools this agent can use. If empty, all tools are available |
disabledTools |
string[] |
No | Tools explicitly blocked for this agent |
metadata |
object |
No | Arbitrary key-value metadata |
Naming Convention¶
The agent name is derived from the filename by removing the .agent.md extension:
| Filename | Agent Name |
|---|---|
code-reviewer.agent.md |
code-reviewer |
test-writer.agent.md |
test-writer |
docs-writer.agent.md |
docs-writer |
Info
If the frontmatter includes a name field, it overrides the filename-derived name.
Agent Discovery¶
PGA searches for agents in these locations (in order):
| Location | Scope |
|---|---|
AGENTS.md |
Global instructions (project root) |
.powergentic/agents/*.agent.md |
Root-level named agents |
.github/agents/*.agent.md |
Alternative location (GitHub convention) |
<subdir>/agents/*.agent.md |
Scoped agents (apply only within <subdir>) |
Skipped Directories¶
During agent discovery, the following directories are automatically skipped:
node_modulesbin,objdist,build.git__pycache__vendor,packages- Any directory starting with
.(except.github)
Scoped Agents¶
Agents can be scoped to specific directories within a project. This is useful in monorepos where different parts of the codebase have different conventions.
Example: Monorepo with Scoped Agents¶
| Text Only | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
How Scoping Works¶
When PGA resolves agents for a given working path:
- Global agent (
AGENTS.md) always applies - Root-level agents (
.powergentic/agents/*.agent.md,.github/agents/*.agent.md) always apply - Scoped agents only apply if the working path is within their scope directory
For example, when working in frontend/src/:
AGENTS.md— applies (global).powergentic/agents/general-assistant.agent.md— applies (root-level)frontend/agents/react-expert.agent.md— applies (scope matches)backend/agents/dotnet-expert.agent.md— does NOT apply (different scope)infrastructure/agents/terraform-expert.agent.md— does NOT apply (different scope)
Using Agents¶
List Available Agents¶
| Bash | |
|---|---|
1 2 | |
Select an Agent at Startup¶
| Bash | |
|---|---|
1 | |
Switch Agents Mid-Session¶
| Bash | |
|---|---|
1 2 | |
Check Current Agent¶
| Bash | |
|---|---|
1 2 3 | |
Tool Filtering¶
Agents can control which tools the AI has access to.
Whitelist (Allow Specific Tools)¶
If tools is specified in the frontmatter, only those tools are available:
| YAML | |
|---|---|
1 2 3 4 5 6 | |
Blacklist (Disable Specific Tools)¶
Use disabledTools to block specific tools while keeping all others:
| YAML | |
|---|---|
1 2 3 4 5 6 | |
Available Tool Names¶
| Tool | Description |
|---|---|
shell_execute |
Execute shell commands |
file_read |
Read file contents |
file_write |
Create or overwrite files |
file_edit |
Edit files via search-and-replace |
file_search |
Search for files by glob pattern |
grep_search |
Search file contents with text/regex |
directory_list |
List directory contents |
git_operations |
Read-only git operations |
web_fetch |
Fetch web page content |
See Tools for full details on each tool.
System Prompt Construction¶
When a chat session starts, PGA builds the system prompt in this order:
- Base system prompt — Default PGA instructions (tool usage guidelines, safety rules)
- Global instructions — Content from
AGENTS.md - Agent instructions — Content from the selected
*.agent.md(if an agent is specified) - Scoped agent instructions — Content from any scoped agents matching the working path
Info
This layered approach means agents extend the global instructions rather than replacing them.
Scaffolding¶
Use pga init to quickly create the agent file structure:
| Bash | |
|---|---|
1 2 | |
This creates:
AGENTS.mdwith a template you can customizeagents/code-reviewer.agent.mdas an example agent
Example Agents¶
Test Writer¶
| Markdown | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
Documentation Writer¶
| Markdown | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Security Auditor¶
| Markdown | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |