@abarcenas/ai-workflow-template 1.25.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.agents/instructions/agent-skill.instructions.md +18 -20
  2. package/.agents/instructions/agent.instructions.md +111 -570
  3. package/.agents/instructions/ai-prompt-engineering-safety.instructions.md +3 -3
  4. package/.agents/instructions/instructions.instructions.md +6 -7
  5. package/.agents/instructions/memory-bank.instructions.md +72 -18
  6. package/.agents/instructions/memory-schema.instructions.md +75 -0
  7. package/.agents/instructions/prompt.instructions.md +25 -30
  8. package/.agents/skills/conventional-commit/SKILL.md +2 -2
  9. package/.agents/skills/github-issues/SKILL.md +2 -2
  10. package/.agents/skills/memory-search/SKILL.md +69 -0
  11. package/.agents/skills/microsoft-docs/SKILL.md +1 -1
  12. package/.agents/skills/polygot-test-agent/SKILL.md +0 -1
  13. package/.agents/skills/prompt-builder/SKILL.md +15 -14
  14. package/.husky/post-merge +10 -0
  15. package/.husky/pre-commit +2 -0
  16. package/.opencode/agents/architect.agent.md +2 -1
  17. package/.opencode/agents/coder.agent.md +3 -1
  18. package/.opencode/agents/deployer.agent.md +1 -0
  19. package/.opencode/agents/designer.agent.md +2 -1
  20. package/.opencode/agents/e2e-tester.agent.md +1 -0
  21. package/.opencode/agents/implementer.agent.md +2 -1
  22. package/.opencode/agents/orchestrator/feature-pipeline.agent.md +4 -3
  23. package/.opencode/agents/orchestrator/orchestrator.agent.md +4 -3
  24. package/.opencode/agents/orchestrator/tdd-orchestrator.agent.md +8 -4
  25. package/.opencode/agents/researcher.agent.md +1 -0
  26. package/.opencode/agents/reviewer.agent.md +1 -0
  27. package/.opencode/agents/tracker.agent.md +2 -1
  28. package/.opencode/agents/unit-tester.agent.md +1 -0
  29. package/README.md +75 -4
  30. package/memory-bank/.vocabulary.json +52 -0
  31. package/opencode.mcp.example.json +7 -1
  32. package/package.json +18 -3
  33. package/scripts/mcp-memory-server.js +243 -0
  34. package/scripts/memory-cli.js +110 -0
  35. package/scripts/memory-index.js +512 -0
  36. package/scripts/normalize-memory.js +349 -0
  37. package/scripts/validate-memory-schema.js +190 -0
@@ -1,20 +1,20 @@
1
1
  ---
2
- description: "Guidelines for creating custom agent files for GitHub Copilot"
2
+ description: "Guidelines for creating custom agent files for opencode"
3
3
  applyTo: "**/*.agent.md"
4
4
  ---
5
5
 
6
6
  # Custom Agent File Guidelines
7
7
 
8
- Instructions for creating effective and maintainable custom agent files that provide specialized expertise for specific development tasks in GitHub Copilot.
8
+ Instructions for creating effective and maintainable custom agent files that provide specialized expertise for specific development tasks in opencode.
9
9
 
10
10
  ## Project Context
11
11
 
12
- - Target audience: Developers creating custom agents for GitHub Copilot
12
+ - Target audience: Developers creating custom agents for opencode
13
13
  - File format: Markdown with YAML frontmatter
14
14
  - File naming convention: lowercase with hyphens (e.g., `test-specialist.agent.md`)
15
- - Location: `.github/agents/` directory (repository-level) or `agents/` directory (organization/enterprise-level)
15
+ - Location: `.agents/agents/` directory (repository-level) or `.opencode/agents/` directory
16
16
  - Purpose: Define specialized agents with tailored expertise, tools, and instructions for specific tasks
17
- - Official documentation: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/create-custom-agents
17
+ - Official documentation: [opencode.ai](https://opencode.ai)
18
18
 
19
19
  ## Required Frontmatter
20
20
 
@@ -24,10 +24,7 @@ Every agent file must include YAML frontmatter with the following fields:
24
24
  ---
25
25
  description: "Brief description of the agent purpose and capabilities"
26
26
  name: "Agent Display Name"
27
- tools: ["read", "edit", "search"]
28
- model: "Claude Sonnet 4.5"
29
- target: "vscode"
30
- infer: true
27
+ tools: ["Read", "Edit", "Grep"]
31
28
  ---
32
29
  ```
33
30
 
@@ -41,224 +38,18 @@ infer: true
41
38
 
42
39
  #### **name** (OPTIONAL)
43
40
 
44
- - Display name for the agent in the UI
41
+ - Display name for the agent
45
42
  - If omitted, defaults to filename (without `.md` or `.agent.md`)
46
43
  - Use title case and be descriptive
47
44
  - Example: `'Testing Specialist'`
48
45
 
49
46
  #### **tools** (OPTIONAL)
50
47
 
51
- - List of tool names or aliases the agent can use
52
- - Supports comma-separated string or YAML array format
48
+ - List of tool names the agent can use
49
+ - Supports YAML array format
53
50
  - If omitted, agent has access to all available tools
54
51
  - See "Tool Configuration" section below for details
55
52
 
56
- #### **model** (STRONGLY RECOMMENDED)
57
-
58
- - Specifies which AI model the agent should use
59
- - Supported in VS Code, JetBrains IDEs, Eclipse, and Xcode
60
- - Example: `'Claude Sonnet 4.5'`, `'gpt-4'`, `'gpt-4o'`
61
- - Choose based on agent complexity and required capabilities
62
-
63
- #### **target** (OPTIONAL)
64
-
65
- - Specifies target environment: `'vscode'` or `'github-copilot'`
66
- - If omitted, agent is available in both environments
67
- - Use when agent has environment-specific features
68
-
69
- #### **infer** (OPTIONAL)
70
-
71
- - Boolean controlling whether Copilot can automatically use this agent based on context
72
- - Default: `true` if omitted
73
- - Set to `false` to require manual agent selection
74
-
75
- #### **metadata** (OPTIONAL, GitHub.com only)
76
-
77
- - Object with name-value pairs for agent annotation
78
- - Example: `metadata: { category: 'testing', version: '1.0' }`
79
- - Not supported in VS Code
80
-
81
- #### **mcp-servers** (OPTIONAL, Organization/Enterprise only)
82
-
83
- - Configure MCP servers available only to this agent
84
- - Only supported for organization/enterprise level agents
85
- - See "MCP Server Configuration" section below
86
-
87
- #### **handoffs** (OPTIONAL, VS Code only)
88
-
89
- - Enable guided sequential workflows that transition between agents with suggested next steps
90
- - List of handoff configurations, each specifying a target agent and optional prompt
91
- - After a chat response completes, handoff buttons appear allowing users to move to the next agent
92
- - Only supported in VS Code (version 1.106+)
93
- - See "Handoffs Configuration" section below for details
94
-
95
- ## Handoffs Configuration
96
-
97
- Handoffs enable you to create guided sequential workflows that transition seamlessly between custom agents. This is useful for orchestrating multi-step development workflows where users can review and approve each step before moving to the next one.
98
-
99
- ### Common Handoff Patterns
100
-
101
- - **Planning → Implementation**: Generate a plan in a planning agent, then hand off to an implementation agent to start coding
102
- - **Implementation → Review**: Complete implementation, then switch to a code review agent to check for quality and security issues
103
- - **Write Failing Tests → Write Passing Tests**: Generate failing tests, then hand off to implement the code that makes those tests pass
104
- - **Research → Documentation**: Research a topic, then transition to a documentation agent to write guides
105
-
106
- ### Handoff Frontmatter Structure
107
-
108
- Define handoffs in the agent file's YAML frontmatter using the `handoffs` field:
109
-
110
- ```yaml
111
- ---
112
- description: "Brief description of the agent"
113
- name: "Agent Name"
114
- tools: ["search", "read"]
115
- handoffs:
116
- - label: Start Implementation
117
- agent: implementation
118
- prompt: "Now implement the plan outlined above."
119
- send: false
120
- - label: Code Review
121
- agent: code-review
122
- prompt: "Please review the implementation for quality and security issues."
123
- send: false
124
- ---
125
- ```
126
-
127
- ### Handoff Properties
128
-
129
- Each handoff in the list must include the following properties:
130
-
131
- | Property | Type | Required | Description |
132
- | -------- | ------- | -------- | ---------------------------------------------------------------------------------- |
133
- | `label` | string | Yes | The display text shown on the handoff button in the chat interface |
134
- | `agent` | string | Yes | The target agent identifier to switch to (name or filename without `.agent.md`) |
135
- | `prompt` | string | No | The prompt text to pre-fill in the target agent's chat input |
136
- | `send` | boolean | No | If `true`, automatically submits the prompt to the target agent (default: `false`) |
137
-
138
- ### Handoff Behavior
139
-
140
- - **Button Display**: Handoff buttons appear as interactive suggestions after a chat response completes
141
- - **Context Preservation**: When users select a handoff button, they switch to the target agent with conversation context maintained
142
- - **Pre-filled Prompt**: If a `prompt` is specified, it appears pre-filled in the target agent's chat input
143
- - **Manual vs Auto**: When `send: false`, users must review and manually send the pre-filled prompt; when `send: true`, the prompt is automatically submitted
144
-
145
- ### Handoff Configuration Guidelines
146
-
147
- #### When to Use Handoffs
148
-
149
- - **Multi-step workflows**: Breaking down complex tasks across specialized agents
150
- - **Quality gates**: Ensuring review steps between implementation phases
151
- - **Guided processes**: Directing users through a structured development process
152
- - **Skill transitions**: Moving from planning/design to implementation/testing specialists
153
-
154
- #### Best Practices
155
-
156
- - **Clear Labels**: Use action-oriented labels that clearly indicate the next step
157
- - ✅ Good: "Start Implementation", "Review for Security", "Write Tests"
158
- - ❌ Avoid: "Next", "Go to agent", "Do something"
159
-
160
- - **Relevant Prompts**: Provide context-aware prompts that reference the completed work
161
- - ✅ Good: `'Now implement the plan outlined above.'`
162
- - ❌ Avoid: Generic prompts without context
163
-
164
- - **Selective Use**: Don't create handoffs to every possible agent; focus on logical workflow transitions
165
- - Limit to 2-3 most relevant next steps per agent
166
- - Only add handoffs for agents that naturally follow in the workflow
167
-
168
- - **Agent Dependencies**: Ensure target agents exist before creating handoffs
169
- - Handoffs to non-existent agents will be silently ignored
170
- - Test handoffs to verify they work as expected
171
-
172
- - **Prompt Content**: Keep prompts concise and actionable
173
- - Refer to work from the current agent without duplicating content
174
- - Provide any necessary context the target agent might need
175
-
176
- ### Example: Complete Workflow
177
-
178
- Here's an example of three agents with handoffs creating a complete workflow:
179
-
180
- **Planning Agent** (`planner.agent.md`):
181
-
182
- ```yaml
183
- ---
184
- description: 'Generate an implementation plan for new features or refactoring'
185
- name: 'Planner'
186
- tools: ['search', 'read']
187
- handoffs:
188
- - label: Implement Plan
189
- agent: implementer
190
- prompt: 'Implement the plan outlined above.'
191
- send: false
192
- ---
193
- # Planner Agent
194
- You are a planning specialist. Your task is to:
195
- 1. Analyze the requirements
196
- 2. Break down the work into logical steps
197
- 3. Generate a detailed implementation plan
198
- 4. Identify testing requirements
199
-
200
- Do not write any code - focus only on planning.
201
- ```
202
-
203
- **Implementation Agent** (`implementer.agent.md`):
204
-
205
- ```yaml
206
- ---
207
- description: 'Implement code based on a plan or specification'
208
- name: 'Implementer'
209
- tools: ['read', 'edit', 'search', 'execute']
210
- handoffs:
211
- - label: Review Implementation
212
- agent: reviewer
213
- prompt: 'Please review this implementation for code quality, security, and adherence to best practices.'
214
- send: false
215
- ---
216
- # Implementer Agent
217
- You are an implementation specialist. Your task is to:
218
- 1. Follow the provided plan or specification
219
- 2. Write clean, maintainable code
220
- 3. Include appropriate comments and documentation
221
- 4. Follow project coding standards
222
-
223
- Implement the solution completely and thoroughly.
224
- ```
225
-
226
- **Review Agent** (`reviewer.agent.md`):
227
-
228
- ```yaml
229
- ---
230
- description: 'Review code for quality, security, and best practices'
231
- name: 'Reviewer'
232
- tools: ['read', 'search']
233
- handoffs:
234
- - label: Back to Planning
235
- agent: planner
236
- prompt: 'Review the feedback above and determine if a new plan is needed.'
237
- send: false
238
- ---
239
- # Code Review Agent
240
- You are a code review specialist. Your task is to:
241
- 1. Check code quality and maintainability
242
- 2. Identify security issues and vulnerabilities
243
- 3. Verify adherence to project standards
244
- 4. Suggest improvements
245
-
246
- Provide constructive feedback on the implementation.
247
- ```
248
-
249
- This workflow allows a developer to:
250
-
251
- 1. Start with the Planner agent to create a detailed plan
252
- 2. Hand off to the Implementer agent to write code based on the plan
253
- 3. Hand off to the Reviewer agent to check the implementation
254
- 4. Optionally hand off back to planning if significant issues are found
255
-
256
- ### Version Compatibility
257
-
258
- - **VS Code**: Handoffs are supported in VS Code 1.106 and later
259
- - **GitHub.com**: Not currently supported; agent transition workflows use different mechanisms
260
- - **Other IDEs**: Limited or no support; focus on VS Code implementations for maximum compatibility
261
-
262
53
  ## Tool Configuration
263
54
 
264
55
  ### Tool Specification Strategies
@@ -273,13 +64,13 @@ tools: ["*"]
273
64
  **Enable specific tools**:
274
65
 
275
66
  ```yaml
276
- tools: ["read", "edit", "search", "execute"]
67
+ tools: ["Read", "Edit", "Grep", "Bash"]
277
68
  ```
278
69
 
279
70
  **Enable MCP server tools**:
280
71
 
281
72
  ```yaml
282
- tools: ["read", "edit", "github/*", "playwright/navigate"]
73
+ tools: ["Read", "Edit", "github/*", "playwright/navigate"]
283
74
  ```
284
75
 
285
76
  **Disable all tools**:
@@ -288,52 +79,45 @@ tools: ["read", "edit", "github/*", "playwright/navigate"]
288
79
  tools: []
289
80
  ```
290
81
 
291
- ### Standard Tool Aliases
292
-
293
- All aliases are case-insensitive:
82
+ ### Standard opencode Tools
294
83
 
295
- | Alias | Alternative Names | Category | Description |
296
- | --------- | ------------------------------------ | ---------------- | ------------------------------------------- |
297
- | `execute` | shell, Bash, powershell | Shell execution | Execute commands in appropriate shell |
298
- | `read` | Read, NotebookRead, view | File reading | Read file contents |
299
- | `edit` | Edit, MultiEdit, Write, NotebookEdit | File editing | Edit and modify files |
300
- | `search` | Grep, Glob, search | Code search | Search for files or text in files |
301
- | `agent` | custom-agent, Task | Agent invocation | Invoke other custom agents |
302
- | `web` | WebSearch, WebFetch | Web access | Fetch web content and search |
303
- | `todo` | TodoWrite | Task management | Create and manage task lists (VS Code only) |
84
+ All tool names are case-sensitive:
304
85
 
305
- ### Built-in MCP Server Tools
306
-
307
- **GitHub MCP Server**:
308
-
309
- ```yaml
310
- tools: ['github/*'] # All GitHub tools
311
- tools: ['github/get_file_contents', 'github/search_repositories'] # Specific tools
312
- ```
86
+ | Tool | Category | Description |
87
+ | ------------- | ---------------- | --------------------------------------------- |
88
+ | `Bash` | Shell execution | Execute shell commands in the terminal |
89
+ | `Read` | File reading | Read file contents |
90
+ | `Write` | File editing | Write or create new files |
91
+ | `Edit` | File editing | Modify existing files via string replacement |
92
+ | `Grep` | Code search | Search file contents using regular expressions |
93
+ | `Glob` | File search | Find files by glob patterns |
94
+ | `Task` | Sub-agent | Invoke other agents with subtasks |
95
+ | `TodoWrite` | Task management | Create and manage task items for tracking |
96
+ | `Skill` | Skill loader | Load specialized skill instructions |
97
+ | `WebFetch` | Web access | Fetch and read web content |
98
+ | `WebSearch` | Web access | Search the web (requires configured MCP) |
313
99
 
314
- - All read-only tools available by default
315
- - Token scoped to source repository
100
+ ### MCP Server Tools
316
101
 
317
- **Playwright MCP Server**:
102
+ MCP servers configured in `opencode.json` are available as tools:
318
103
 
319
104
  ```yaml
320
- tools: ['playwright/*'] # All Playwright tools
321
- tools: ['playwright/navigate', 'playwright/screenshot'] # Specific tools
105
+ tools: ['github/*'] # All GitHub MCP tools
106
+ tools: ['playwright/navigate'] # Specific Playwright MCP tool
322
107
  ```
323
108
 
324
- - Configured to access localhost only
325
- - Useful for browser automation and testing
109
+ The `tools` entry format for MCP tools is `server-name/tool-name`, matching the MCP server name in your `opencode.json` configuration.
326
110
 
327
111
  ### Tool Selection Best Practices
328
112
 
329
113
  - **Principle of Least Privilege**: Only enable tools necessary for the agent's purpose
330
- - **Security**: Limit `execute` access unless explicitly required
114
+ - **Security**: Limit `Bash` access unless explicitly required
331
115
  - **Focus**: Fewer tools = clearer agent purpose and better performance
332
116
  - **Documentation**: Comment why specific tools are required for complex configurations
333
117
 
334
118
  ## Sub-Agent Invocation (Agent Orchestration)
335
119
 
336
- Agents can invoke other agents using the **agent invocation tool** (the `agent` tool) to orchestrate multi-step workflows.
120
+ Agents can invoke other agents using the **`Task` tool** to orchestrate multi-step workflows.
337
121
 
338
122
  The recommended approach is **prompt-based orchestration**:
339
123
 
@@ -343,21 +127,21 @@ The recommended approach is **prompt-based orchestration**:
343
127
 
344
128
  ### How It Works
345
129
 
346
- 1. Enable agent invocation by including `agent` in the orchestrator's tools list:
130
+ 1. Enable agent invocation by including `Task` in the orchestrator's tools list:
347
131
 
348
132
  ```yaml
349
- tools: ["read", "edit", "search", "agent"]
133
+ tools: ["Read", "Edit", "Grep", "Task"]
350
134
  ```
351
135
 
352
136
  2. For each step, invoke a sub-agent by providing:
353
137
 
354
138
  - **Agent name** (the identifier users select/invoke)
355
139
  - **Agent spec path** (the `.agent.md` file to read and follow)
356
- - **Minimal shared context** (e.g., `basePath`, `projectName`, `logFile`)
140
+ - **Minimal shared context** (e.g., base path, project name, log file)
357
141
 
358
142
  ### Prompt Pattern (Recommended)
359
143
 
360
- Use a consistent “wrapper prompt” for every step so sub-agents behave predictably:
144
+ Use a consistent "wrapper prompt" for every step so sub-agents behave predictably:
361
145
 
362
146
  ```text
363
147
  This phase must be performed as the agent "<AGENT_NAME>" defined in "<AGENT_SPEC_PATH>".
@@ -384,20 +168,20 @@ Optional: if you need a lightweight, structured wrapper for traceability, embed
384
168
 
385
169
  For maintainable orchestrators, document these structural elements:
386
170
 
387
- - **Dynamic parameters**: what values are extracted from the user (e.g., `projectName`, `fileName`, `basePath`).
388
- - **Sub-agent registry**: a list/table mapping each step to `agentName` + `agentSpecPath`.
171
+ - **Dynamic parameters**: what values are extracted from the user (e.g., project name, file name, base path).
172
+ - **Sub-agent registry**: a list/table mapping each step to agent name + agent spec path.
389
173
  - **Step ordering**: explicit sequence (Step 1 → Step N).
390
174
  - **Trigger conditions** (optional but recommended): define when a step runs vs is skipped.
391
175
  - **Logging strategy** (optional but recommended): a single log/report file updated after each step.
392
176
 
393
- Avoid embedding orchestration “code” (JavaScript, Python, etc.) inside the orchestrator prompt; prefer deterministic, tool-driven coordination.
177
+ Avoid embedding orchestration "code" (JavaScript, Python, etc.) inside the orchestrator prompt; prefer deterministic, tool-driven coordination.
394
178
 
395
179
  ### Basic Pattern
396
180
 
397
181
  Structure each step invocation with:
398
182
 
399
183
  1. **Step description**: Clear one-line purpose (used for logs and traceability)
400
- 2. **Agent identity**: `agentName` + `agentSpecPath`
184
+ 2. **Agent identity**: agent name + agent spec path
401
185
  3. **Context**: A small, explicit set of variables (paths, IDs, environment name)
402
186
  4. **Expected outputs**: Files to create/update and where they should be written
403
187
  5. **Return summary**: Ask the sub-agent to return a short, structured summary
@@ -407,24 +191,24 @@ Structure each step invocation with:
407
191
  ```text
408
192
  Step 1: Transform raw input data
409
193
  Agent: data-processor
410
- Spec: .github/agents/data-processor.agent.md
411
- Context: projectName=${projectName}, basePath=${basePath}
412
- Input: ${basePath}/raw/
413
- Output: ${basePath}/processed/
414
- Expected: write ${basePath}/processed/summary.md
194
+ Spec: .agents/agents/data-processor.agent.md
195
+ Context: projectName, basePath
196
+ Input: basePath/raw/
197
+ Output: basePath/processed/
198
+ Expected: write basePath/processed/summary.md
415
199
 
416
200
  Step 2: Analyze processed data (depends on Step 1 output)
417
201
  Agent: data-analyst
418
- Spec: .github/agents/data-analyst.agent.md
419
- Context: projectName=${projectName}, basePath=${basePath}
420
- Input: ${basePath}/processed/
421
- Output: ${basePath}/analysis/
422
- Expected: write ${basePath}/analysis/report.md
202
+ Spec: .agents/agents/data-analyst.agent.md
203
+ Context: projectName, basePath
204
+ Input: basePath/processed/
205
+ Output: basePath/analysis/
206
+ Expected: write basePath/analysis/report.md
423
207
  ```
424
208
 
425
209
  ### Key Points
426
210
 
427
- - **Pass variables in prompts**: Use `${variableName}` for all dynamic values
211
+ - **Pass variables in prompts**: Use clear descriptions for all dynamic values
428
212
  - **Keep prompts focused**: Clear, specific tasks for each sub-agent
429
213
  - **Return summaries**: Each sub-agent should report what it accomplished
430
214
  - **Sequential execution**: Run steps in order when dependencies exist between outputs/inputs
@@ -432,13 +216,13 @@ Expected: write ${basePath}/analysis/report.md
432
216
 
433
217
  ### ⚠️ Tool Availability Requirement
434
218
 
435
- **Critical**: If a sub-agent requires specific tools (e.g., `edit`, `execute`, `search`), the orchestrator must include those tools in its own `tools` list. Sub-agents cannot access tools that aren't available to their parent orchestrator.
219
+ **Critical**: If a sub-agent requires specific tools (e.g., `Edit`, `Bash`, `Grep`), the orchestrator must include those tools in its own `tools` list. Sub-agents cannot access tools that aren't available to their parent orchestrator.
436
220
 
437
221
  **Example**:
438
222
 
439
223
  ```yaml
440
224
  # If your sub-agents need to edit files, execute commands, or search code
441
- tools: ["read", "edit", "search", "execute", "agent"]
225
+ tools: ["Read", "Edit", "Grep", "Bash", "Task"]
442
226
  ```
443
227
 
444
228
  The orchestrator's tool permissions act as a ceiling for all invoked sub-agents. Plan your tool list carefully to ensure all sub-agents have the tools they need.
@@ -489,10 +273,10 @@ Agents can define dynamic parameters to extract values from user input and use t
489
273
  **Examples**:
490
274
 
491
275
  - Extract project name from user prompt
492
- - Capture certification name for pipeline processing
276
+ - Capture feature name for pipeline processing
493
277
  - Identify file paths or directories
494
278
  - Extract configuration options
495
- - Parse feature names or module identifiers
279
+ - Parse module identifiers
496
280
 
497
281
  ### Variable Declaration Pattern
498
282
 
@@ -537,22 +321,6 @@ Use this information to contextualize all subsequent tasks.
537
321
 
538
322
  Automatically extract variables from the user's natural language input:
539
323
 
540
- ```javascript
541
- // Example: Extract certification name from user input
542
- const userInput = "Process My Certification";
543
-
544
- // Extract key information
545
- const certificationName = extractCertificationName(userInput);
546
- // Result: "My Certification"
547
-
548
- const basePath = `certifications/${certificationName}`;
549
- // Result: "certifications/My Certification"
550
- ```
551
-
552
- #### 3. **Contextual Variable Resolution**
553
-
554
- Use file context or workspace information to derive variables:
555
-
556
324
  ```markdown
557
325
  ## Variable Resolution Strategy
558
326
 
@@ -565,51 +333,44 @@ Use file context or workspace information to derive variables:
565
333
 
566
334
  ### Using Variables in Agent Prompts
567
335
 
568
- #### Variable Substitution in Instructions
569
-
570
- Use template variables in agent prompts to make them dynamic:
336
+ Describe variables in agent prompts to make them dynamic:
571
337
 
572
338
  ```markdown
573
339
  # Agent Name
574
340
 
575
341
  ## Dynamic Parameters
576
342
 
577
- - **Project Name**: ${projectName}
578
- - **Base Path**: ${basePath}
579
- - **Output Directory**: ${outputDir}
343
+ - **Project Name**: The name of the project being worked on
344
+ - **Base Path**: Root directory for the project files
345
+ - **Output Directory**: Where results should be written
580
346
 
581
347
  ## Your Mission
582
348
 
583
- Process the **${projectName}** project located at `${basePath}`.
349
+ Process the project based on the provided parameters.
584
350
 
585
351
  ## Process Steps
586
352
 
587
- 1. Read input from: `${basePath}/input/`
353
+ 1. Read input from the base path
588
354
  2. Process files according to project configuration
589
- 3. Write results to: `${outputDir}/`
355
+ 3. Write results to the output directory
590
356
  4. Generate summary report
591
-
592
- ## Quality Standards
593
-
594
- - Maintain project-specific coding standards for **${projectName}**
595
- - Follow directory structure: `${basePath}/[structure]`
596
357
  ```
597
358
 
598
359
  #### Passing Variables to Sub-Agents
599
360
 
600
- When invoking a sub-agent, pass all context through substituted variables in the prompt. Prefer passing **paths and identifiers**, not entire file contents.
361
+ When invoking a sub-agent, pass all context through descriptive instructions in the prompt. Prefer passing **paths and identifiers**, not entire file contents.
601
362
 
602
363
  Example (prompt template):
603
364
 
604
365
  ```text
605
- This phase must be performed as the agent "documentation-writer" defined in ".github/agents/documentation-writer.agent.md".
366
+ This phase must be performed as the agent "documentation-writer" defined in ".agents/agents/documentation-writer.agent.md".
606
367
 
607
368
  IMPORTANT:
608
369
  - Read and apply the entire .agent.md spec.
609
- - Project: "${projectName}"
610
- - Base path: "projects/${projectName}"
611
- - Input: "projects/${projectName}/src/"
612
- - Output: "projects/${projectName}/docs/"
370
+ - Project: [project name]
371
+ - Base path: [base path]
372
+ - Input: [input path]
373
+ - Output: [output path]
613
374
 
614
375
  Task:
615
376
  1. Read source files under the input path.
@@ -618,111 +379,38 @@ Task:
618
379
  4. Return a concise summary (files created/updated, key decisions, issues).
619
380
  ```
620
381
 
621
- The sub-agent receives all necessary context embedded in the prompt. Variables are resolved before sending the prompt, so the sub-agent works with concrete paths and values, not variable placeholders.
382
+ The sub-agent receives all necessary context embedded in the prompt.
622
383
 
623
384
  ### Real-World Example: Code Review Orchestrator
624
385
 
625
386
  Example of a simple orchestrator that validates code through multiple specialized agents:
626
387
 
627
388
  1. Determine shared context:
628
-
629
- - `repositoryName`, `prNumber`
630
- - `basePath` (e.g., `projects/${repositoryName}/pr-${prNumber}`)
389
+ - Repository name, PR number
390
+ - Base path
631
391
 
632
392
  2. Invoke specialized agents sequentially (each agent reads its own `.agent.md` spec):
633
393
 
634
394
  ```text
635
395
  Step 1: Security Review
636
396
  Agent: security-reviewer
637
- Spec: .github/agents/security-reviewer.agent.md
638
- Context: repositoryName=${repositoryName}, prNumber=${prNumber}, basePath=projects/${repositoryName}/pr-${prNumber}
639
- Output: projects/${repositoryName}/pr-${prNumber}/security-review.md
397
+ Spec: .agents/agents/security-reviewer.agent.md
398
+ Context: repository name, PR number, base path
399
+ Output: security-review.md
640
400
 
641
401
  Step 2: Test Coverage
642
402
  Agent: test-coverage
643
- Spec: .github/agents/test-coverage.agent.md
644
- Context: repositoryName=${repositoryName}, prNumber=${prNumber}, basePath=projects/${repositoryName}/pr-${prNumber}
645
- Output: projects/${repositoryName}/pr-${prNumber}/coverage-report.md
403
+ Spec: .agents/agents/test-coverage.agent.md
404
+ Context: repository name, PR number, base path
405
+ Output: coverage-report.md
646
406
 
647
407
  Step 3: Aggregate
648
408
  Agent: review-aggregator
649
- Spec: .github/agents/review-aggregator.agent.md
650
- Context: repositoryName=${repositoryName}, prNumber=${prNumber}, basePath=projects/${repositoryName}/pr-${prNumber}
651
- Output: projects/${repositoryName}/pr-${prNumber}/final-review.md
652
- ```
653
-
654
- #### Example: Conditional Step Orchestration (Code Review)
655
-
656
- This example shows a more complete orchestration with **pre-flight checks**, **conditional steps**, and **required vs optional** behavior.
657
-
658
- **Dynamic parameters (inputs):**
659
-
660
- - `repositoryName`, `prNumber`
661
- - `basePath` (e.g., `projects/${repositoryName}/pr-${prNumber}`)
662
- - `logFile` (e.g., `${basePath}/.review-log.md`)
663
-
664
- **Pre-flight checks (recommended):**
665
-
666
- - Verify expected folders/files exist (e.g., `${basePath}/changes/`, `${basePath}/reports/`).
667
- - Detect high-level characteristics that influence step triggers (e.g., repo language, presence of `package.json`, `pom.xml`, `requirements.txt`, test folders).
668
- - Log the findings once at the start.
669
-
670
- **Step trigger conditions:**
671
-
672
- | Step | Status | Trigger Condition | On Failure |
673
- | ---------------------- | ------------ | ----------------------------------------------------------------- | ------------- |
674
- | 1: Security Review | **Required** | Always run | Stop pipeline |
675
- | 2: Dependency Audit | Optional | If a dependency manifest exists (`package.json`, `pom.xml`, etc.) | Continue |
676
- | 3: Test Coverage Check | Optional | If test projects/files are present | Continue |
677
- | 4: Performance Checks | Optional | If perf-sensitive code changed OR a perf config exists | Continue |
678
- | 5: Aggregate & Verdict | **Required** | Always run if Step 1 completed | Stop pipeline |
679
-
680
- **Execution flow (natural language):**
681
-
682
- 1. Initialize `basePath` and create/update `logFile`.
683
- 2. Run pre-flight checks and record them.
684
- 3. Execute Step 1 → N sequentially.
685
- 4. For each step:
686
-
687
- - If trigger condition is false: mark as **SKIPPED** and continue.
688
- - Otherwise: invoke the sub-agent using the wrapper prompt and capture its summary.
689
- - Mark as **SUCCESS** or **FAILED**.
690
- - If the step is **Required** and failed: stop the pipeline and write a failure summary.
691
-
692
- 5. End with a final summary section (overall status, artifacts, next actions).
693
-
694
- **Sub-agent invocation prompt (example):**
695
-
696
- ```text
697
- This phase must be performed as the agent "security-reviewer" defined in ".github/agents/security-reviewer.agent.md".
698
-
699
- IMPORTANT:
700
- - Read and apply the entire .agent.md spec.
701
- - Work on repository "${repositoryName}" PR "${prNumber}".
702
- - Base path: "${basePath}".
703
-
704
- Task:
705
- 1. Review the changes under "${basePath}/changes/".
706
- 2. Write findings to "${basePath}/reports/security-review.md".
707
- 3. Return a short summary with: critical findings, recommended fixes, files created/modified.
708
- ```
709
-
710
- **Logging format (example):**
711
-
712
- ```markdown
713
- ## Step 2: Dependency Audit
714
-
715
- **Status:** ✅ SUCCESS / ⚠️ SKIPPED / ❌ FAILED
716
- **Trigger:** package.json present
717
- **Started:** 2026-01-16T10:30:15Z
718
- **Completed:** 2026-01-16T10:31:05Z
719
- **Duration:** 00:00:50
720
- **Artifacts:** reports/dependency-audit.md
721
- **Summary:** [brief agent summary]
409
+ Spec: .agents/agents/review-aggregator.agent.md
410
+ Context: repository name, PR number, base path
411
+ Output: final-review.md
722
412
  ```
723
413
 
724
- This pattern applies to any orchestration scenario: extract variables, call sub-agents with clear context, await results.
725
-
726
414
  ### Variable Best Practices
727
415
 
728
416
  #### 1. **Clear Documentation**
@@ -737,123 +425,40 @@ Always document what variables are expected:
737
425
 
738
426
  ## Optional Variables
739
427
 
740
- - **mode**: Processing mode - quick/standard/detailed (enum, default: standard)
741
- - **outputFormat**: Output format - markdown/json/html (enum, default: markdown)
428
+ - **mode**: Processing mode - quick/standard/detailed (string, default: standard)
429
+ - **outputFormat**: Output format - markdown/json/html (string, default: markdown)
742
430
 
743
431
  ## Derived Variables
744
432
 
745
- - **outputDir**: Automatically set to ${basePath}/output
746
- - **logFile**: Automatically set to ${basePath}/.log.md
433
+ - **outputDir**: Automatically set based on base path
434
+ - **logFile**: Automatically set for session tracking
747
435
  ```
748
436
 
749
437
  #### 2. **Consistent Naming**
750
438
 
751
439
  Use consistent variable naming conventions:
752
440
 
753
- ```javascript
754
- // Good: Clear, descriptive naming
755
- const variables = {
756
- projectName, // What project to work on
757
- basePath, // Where project files are located
758
- outputDirectory, // Where to save results
759
- processingMode, // How to process (detail level)
760
- configurationPath, // Where config files are
761
- };
762
-
763
- // Avoid: Ambiguous or inconsistent
764
- const bad_variables = {
765
- name, // Too generic
766
- path, // Unclear which path
767
- mode, // Too short
768
- config, // Too vague
769
- };
770
- ```
771
-
772
- #### 3. **Validation and Constraints**
773
-
774
- Document valid values and constraints:
775
-
776
441
  ```markdown
777
- ## Variable Constraints
778
-
779
- **projectName**:
780
-
781
- - Type: string (alphanumeric, hyphens, underscores allowed)
782
- - Length: 1-100 characters
783
- - Required: yes
784
- - Pattern: `/^[a-zA-Z0-9_-]+$/`
785
-
786
- **processingMode**:
787
-
788
- - Type: enum
789
- - Valid values: "quick" (< 5min), "standard" (5-15min), "detailed" (15+ min)
790
- - Default: "standard"
791
- - Required: no
792
- ```
793
-
794
- ## MCP Server Configuration (Organization/Enterprise Only)
795
-
796
- MCP servers extend agent capabilities with additional tools. Only supported for organization and enterprise-level agents.
797
-
798
- ### Configuration Format
799
-
800
- ```yaml
801
- ---
802
- name: my-custom-agent
803
- description: "Agent with MCP integration"
804
- tools: ["read", "edit", "custom-mcp/tool-1"]
805
- mcp-servers:
806
- custom-mcp:
807
- type: "local"
808
- command: "some-command"
809
- args: ["--arg1", "--arg2"]
810
- tools: ["*"]
811
- env:
812
- ENV_VAR_NAME: ${{ secrets.API_KEY }}
813
- ---
814
- ```
815
-
816
- ### MCP Server Properties
817
-
818
- - **type**: Server type (`'local'` or `'stdio'`)
819
- - **command**: Command to start the MCP server
820
- - **args**: Array of command arguments
821
- - **tools**: Tools to enable from this server (`["*"]` for all)
822
- - **env**: Environment variables (supports secrets)
823
-
824
- ### Environment Variables and Secrets
825
-
826
- Secrets must be configured in repository settings under "copilot" environment.
827
-
828
- **Supported syntax**:
829
-
830
- ```yaml
831
- env:
832
- # Environment variable only
833
- VAR_NAME: COPILOT_MCP_ENV_VAR_VALUE
834
-
835
- # Variable with header
836
- VAR_NAME: $COPILOT_MCP_ENV_VAR_VALUE
837
- VAR_NAME: ${COPILOT_MCP_ENV_VAR_VALUE}
838
-
839
- # GitHub Actions-style (YAML only)
840
- VAR_NAME: ${{ secrets.COPILOT_MCP_ENV_VAR_VALUE }}
841
- VAR_NAME: ${{ var.COPILOT_MCP_ENV_VAR_VALUE }}
442
+ # Good: Clear, descriptive naming
443
+ - projectName # What project to work on
444
+ - basePath # Where project files are located
445
+ - outputDir # Where to save results
446
+ - processingMode # How to process (detail level)
447
+
448
+ # Avoid: Ambiguous or inconsistent
449
+ - name # Too generic
450
+ - path # Unclear which path
451
+ - mode # Too short
452
+ - config # Too vague
842
453
  ```
843
454
 
844
455
  ## File Organization and Naming
845
456
 
846
457
  ### Repository-Level Agents
847
458
 
848
- - Location: `.github/agents/`
459
+ - Location: `.agents/agents/` or `.opencode/agents/`
849
460
  - Scope: Available only in the specific repository
850
- - Access: Uses repository-configured MCP servers
851
-
852
- ### Organization/Enterprise-Level Agents
853
-
854
- - Location: `.github-private/agents/` (then move to `agents/` root)
855
- - Scope: Available across all repositories in org/enterprise
856
- - Access: Can configure dedicated MCP servers
461
+ - Access: Uses repository-configured MCP servers from `opencode.json`
857
462
 
858
463
  ### Naming Conventions
859
464
 
@@ -862,41 +467,6 @@ env:
862
467
  - Filename becomes default agent name (if `name` not specified)
863
468
  - Allowed characters: `.`, `-`, `_`, `a-z`, `A-Z`, `0-9`
864
469
 
865
- ## Agent Processing and Behavior
866
-
867
- ### Versioning
868
-
869
- - Based on Git commit SHAs for the agent file
870
- - Create branches/tags for different agent versions
871
- - Instantiated using latest version for repository/branch
872
- - PR interactions use same agent version for consistency
873
-
874
- ### Name Conflicts
875
-
876
- Priority (highest to lowest):
877
-
878
- 1. Repository-level agent
879
- 2. Organization-level agent
880
- 3. Enterprise-level agent
881
-
882
- Lower-level configurations override higher-level ones with the same name.
883
-
884
- ### Tool Processing
885
-
886
- - `tools` list filters available tools (built-in and MCP)
887
- - No tools specified = all tools enabled
888
- - Empty list (`[]`) = all tools disabled
889
- - Specific list = only those tools enabled
890
- - Unrecognized tool names are ignored (allows environment-specific tools)
891
-
892
- ### MCP Server Processing Order
893
-
894
- 1. Out-of-the-box MCP servers (e.g., GitHub MCP)
895
- 2. Custom agent MCP configuration (org/enterprise only)
896
- 3. Repository-level MCP configurations
897
-
898
- Each level can override settings from previous levels.
899
-
900
470
  ## Agent Creation Checklist
901
471
 
902
472
  ### Frontmatter
@@ -905,9 +475,6 @@ Each level can override settings from previous levels.
905
475
  - [ ] `description` wrapped in single quotes
906
476
  - [ ] `name` specified (optional but recommended)
907
477
  - [ ] `tools` configured appropriately (or intentionally omitted)
908
- - [ ] `model` specified for optimal performance
909
- - [ ] `target` set if environment-specific
910
- - [ ] `infer` set to `false` if manual selection required
911
478
 
912
479
  ### Prompt Content
913
480
 
@@ -924,7 +491,7 @@ Each level can override settings from previous levels.
924
491
  ### File Structure
925
492
 
926
493
  - [ ] Filename follows lowercase-with-hyphens convention
927
- - [ ] File placed in correct directory (`.github/agents/` or `agents/`)
494
+ - [ ] File placed in correct directory (`.agents/agents/` or `.opencode/agents/`)
928
495
  - [ ] Filename uses only allowed characters
929
496
  - [ ] File extension is `.agent.md`
930
497
 
@@ -948,25 +515,25 @@ Each level can override settings from previous levels.
948
515
  ### Implementation Planner
949
516
 
950
517
  **Purpose**: Create detailed technical plans and specifications
951
- **Tools**: Limited to `['read', 'search', 'edit']`
518
+ **Tools**: Limited to `['Read', 'Grep', 'Write']`
952
519
  **Approach**: Analyze requirements, create documentation, avoid implementation
953
520
 
954
521
  ### Code Reviewer
955
522
 
956
523
  **Purpose**: Review code quality and provide feedback
957
- **Tools**: `['read', 'search']` only
524
+ **Tools**: `['Read', 'Grep']` only
958
525
  **Approach**: Analyze, suggest improvements, no direct modifications
959
526
 
960
527
  ### Refactoring Specialist
961
528
 
962
529
  **Purpose**: Improve code structure and maintainability
963
- **Tools**: `['read', 'search', 'edit']`
530
+ **Tools**: `['Read', 'Grep', 'Edit']`
964
531
  **Approach**: Analyze patterns, propose refactorings, implement safely
965
532
 
966
533
  ### Security Auditor
967
534
 
968
535
  **Purpose**: Identify security issues and vulnerabilities
969
- **Tools**: `['read', 'search', 'web']`
536
+ **Tools**: `['Read', 'Grep', 'WebFetch']`
970
537
  **Approach**: Scan code, check against OWASP, report findings
971
538
 
972
539
  ## Common Mistakes to Avoid
@@ -982,7 +549,7 @@ Each level can override settings from previous levels.
982
549
 
983
550
  - ❌ Granting excessive tool access unnecessarily
984
551
  - ❌ Missing required tools for agent's purpose
985
- - ❌ Not using tool aliases consistently
552
+ - ❌ Using tool aliases from other platforms instead of opencode tool names
986
553
  - ❌ Forgetting MCP server namespace (`server-name/tool`)
987
554
 
988
555
  ### Prompt Content Problems
@@ -997,7 +564,7 @@ Each level can override settings from previous levels.
997
564
  ### Organizational Issues
998
565
 
999
566
  - ❌ Filename doesn't reflect agent purpose
1000
- - ❌ Wrong directory (confusing repo vs org level)
567
+ - ❌ Wrong directory (using `.github/agents/` instead of `.agents/agents/`)
1001
568
  - ❌ Using spaces or special characters in filename
1002
569
  - ❌ Duplicate agent names causing conflicts
1003
570
 
@@ -1006,8 +573,8 @@ Each level can override settings from previous levels.
1006
573
  ### Manual Testing
1007
574
 
1008
575
  1. Create the agent file with proper frontmatter
1009
- 2. Reload VS Code or refresh GitHub.com
1010
- 3. Select the agent from the dropdown in Copilot Chat
576
+ 2. Open opencode in your terminal or editor
577
+ 3. Invoke the agent by referencing its name
1011
578
  4. Test with representative user queries
1012
579
  5. Verify tool access works as expected
1013
580
  6. Confirm output meets expectations
@@ -1018,7 +585,7 @@ Each level can override settings from previous levels.
1018
585
  - Verify MCP server connectivity (if configured)
1019
586
  - Check agent behavior with missing context
1020
587
  - Test error handling and edge cases
1021
- - Validate agent switching and handoffs
588
+ - Validate agent switching and task delegation
1022
589
 
1023
590
  ### Quality Checks
1024
591
 
@@ -1032,37 +599,11 @@ Each level can override settings from previous levels.
1032
599
 
1033
600
  ### Official Documentation
1034
601
 
1035
- - [Creating Custom Agents](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/create-custom-agents)
1036
- - [Custom Agents Configuration](https://docs.github.com/en/copilot/reference/custom-agents-configuration)
1037
- - [Custom Agents in VS Code](https://code.visualstudio.com/docs/copilot/customization/custom-agents)
1038
- - [MCP Integration](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp)
1039
-
1040
- ### Community Resources
1041
-
1042
- - [Awesome Copilot Agents Collection](https://github.com/github/awesome-copilot/tree/main/agents)
1043
- - [Customization Library Examples](https://docs.github.com/en/copilot/tutorials/customization-library/custom-agents)
1044
- - [Your First Custom Agent Tutorial](https://docs.github.com/en/copilot/tutorials/customization-library/custom-agents/your-first-custom-agent)
602
+ - [opencode.ai Documentation](https://opencode.ai)
1045
603
 
1046
604
  ### Related Files
1047
605
 
1048
606
  - [Prompt Files Guidelines](./prompt.instructions.md) - For creating prompt files
1049
607
  - [Instructions Guidelines](./instructions.instructions.md) - For creating instruction files
1050
-
1051
- ## Version Compatibility Notes
1052
-
1053
- ### GitHub.com (Coding Agent)
1054
-
1055
- - ✅ Fully supports all standard frontmatter properties
1056
- - ✅ Repository and org/enterprise level agents
1057
- - ✅ MCP server configuration (org/enterprise)
1058
- - ❌ Does not support `model`, `argument-hint`, `handoffs` properties
1059
-
1060
- ### VS Code / JetBrains / Eclipse / Xcode
1061
-
1062
- - ✅ Supports `model` property for AI model selection
1063
- - ✅ Supports `argument-hint` and `handoffs` properties
1064
- - ✅ User profile and workspace-level agents
1065
- - ❌ Cannot configure MCP servers at repository level
1066
- - ⚠️ Some properties may behave differently
1067
-
1068
- When creating agents for multiple environments, focus on common properties and test in all target environments. Use `target` property to create environment-specific agents when necessary.
608
+ - [Skill Guidelines](./agent-skill.instructions.md) - For creating skill files
609
+ - [Task Implementation Guidelines](./task-implementation.instructions.md) - For structured implementation workflow