Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Summary: Add engine.agent frontmatter field

Successfully implemented the ability to explicitly specify the agent ID via engine.agent frontmatter field, which is passed to the Copilot CLI --agent flag. The --agent flag is exclusively controlled by engine.agent. Agent imports remain functional as a separate orthogonal feature for importing markdown content.

✅ All Requirements Met

  • Added frontmatter field engine.agent = agentid
  • --agent flag exclusively controlled by engine.agent
  • Agent imports work for markdown content (orthogonal feature)
  • Feature only supported for copilot engine
  • All tests pass (fmt, lint, test-unit)
  • Workflows updated to use explicit engine.agent
  • Schema documentation updated

Implementation Details

Core Changes

  1. pkg/workflow/engine.go: Added Agent string field to EngineConfig struct
  2. pkg/workflow/engine.go: Updated ExtractEngineConfig() to parse engine.agent from frontmatter
  3. pkg/workflow/copilot_engine_execution.go: --agent flag only set by engine.agent
  4. pkg/parser/import_processor.go: Agent imports still work for importing markdown content (AgentFile field populated)
  5. pkg/parser/schemas/main_workflow_schema.json: Added agent field to engine configuration schema
  6. docs/src/content/docs/reference/frontmatter-full.md: Regenerated documentation to include agent field

Test Updates

  • TestCopilotEngineWithAgentFromEngineConfig - validates engine.agent sets --agent flag
  • TestCopilotEngineWithAgentFromImports - validates agent imports do NOT set --agent flag
  • TestCopilotEngineAgentOnlyFromEngineConfig - validates only engine.agent controls the flag
  • TestAgentImportWithToolsArray - validates agent import detection still works
  • TestMultipleAgentImportsError - validates error on multiple agent imports
  • ✅ All hash consistency tests pass

Migrated Workflows

Updated 3 workflows to explicitly use engine.agent:

  • glossary-maintainer.mdengine.agent: technical-doc-writer
  • hourly-ci-cleaner.mdengine.agent: ci-cleaner
  • technical-doc-writer.mdengine.agent: technical-doc-writer

Feature Clarification: Two Orthogonal Features

1. engine.agent - Controls --agent Flag (New)

engine:
  id: copilot
  agent: my-custom-agent  # Exclusively controls --agent flag

2. Agent Imports - Import Markdown Content (Existing)

imports:
  - .github/agents/my-agent.md  # Imports markdown only, does NOT set --agent

Key Point: These are orthogonal features:

  • engine.agent exclusively controls the --agent flag passed to Copilot CLI
  • Agent imports import markdown content from .github/agents/ files
  • Agent imports do NOT set the --agent flag

Usage Examples

Using engine.agent with agent import

engine:
  id: copilot
  agent: my-agent  # Controls --agent flag
imports:
  - .github/agents/my-agent.md  # Imports instructions/markdown

Using engine.agent without imports

engine:
  id: copilot
  agent: my-agent  # Agent must exist in Copilot CLI

Using agent import without engine.agent

engine: copilot
imports:
  - .github/agents/my-agent.md  # Only imports markdown, no --agent flag

Migration Required

⚠️ Workflows that previously relied on agent imports to set the --agent flag must add explicit engine.agent:

# Before: imports set --agent flag automatically (old behavior)
engine: copilot
imports:
  - .github/agents/ci-fixer.agent.md

# After: explicit engine.agent required for --agent flag
engine:
  id: copilot
  agent: ci-fixer  # Now required to set --agent flag
imports:
  - .github/agents/ci-fixer.agent.md  # Still imports markdown

Validation Status

All checks passing:

  • Code formatting (go fmt, prettier)
  • Linting (golangci-lint)
  • Unit tests (agent flag control)
  • Integration tests (agent imports)
  • Hash consistency tests
  • Schema validation
  • Workflow compilation

Notes

  • Feature is copilot engine only as specified
  • --agent flag is exclusively controlled by engine.agent
  • Agent imports work independently for markdown content
  • AgentFile field still populated from imports (for other engine types like Claude/Codex that use agent content differently)
  • Clear separation between agent ID (engine.agent) and agent content (imports)
Original prompt

Add a frontmatter field

engine.agent = agentid

That specifies the agent id to pass to copilot --agent flag.

Remove special support in imports to infer the agent value.

This feature is only supported for copilot.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@github-actions
Copy link
Contributor

🔍 PR Triage Results

Category: feature | Risk: low | Priority: 45/100

Scores Breakdown

  • Impact: 35/50 - New feature - medium-high impact
  • Urgency: 0/30 - Recent PR
  • Quality: 10/20 - Draft PR - needs finalization

📋 Recommended Action: BATCH REVIEW

This PR is suitable for batch review with similar PRs. Consider grouping with other feature PRs for efficient processing.


Triaged by PR Triage Agent on 2026-01-30

AI generated by PR Triage Agent

Copilot AI changed the title [WIP] Add frontmatter field to specify agent id Add explicit engine.agent field, remove automatic agent inference from imports Jan 30, 2026
Copilot AI requested a review from pelikhan January 30, 2026 18:32
@pelikhan
Copy link
Contributor

@copilot update main json schema

Copy link
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot update main json schema

Updated. Regenerated documentation from schema in commit 816fea2.

@pelikhan pelikhan marked this pull request as ready for review January 30, 2026 19:24
@pelikhan
Copy link
Contributor

@copilot the engine.agentic and tbe agent import at separate orthogonal features

Both features are now supported as separate orthogonal ways to specify agent:
1. engine.agent - explicit agent ID (takes priority when both specified)
2. Agent imports - importing .github/agents/*.md files (auto-detected)

This restores the original agent import detection that was incorrectly removed.

Co-authored-by: pelikhan <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot the engine.agentic and tbe agent import at separate orthogonal features

Fixed in commit ebc9268. Both features are now orthogonal:

  1. engine.agent - Explicit agent ID (new, takes priority)
  2. Agent imports - Importing .github/agents/*.md files (existing, still works)

The agent import detection code has been restored. Both methods work independently, with engine.agent taking priority when both are specified.

Copilot AI changed the title Add explicit engine.agent field, remove automatic agent inference from imports Add explicit engine.agent field as orthogonal feature to agent imports Jan 30, 2026
@pelikhan
Copy link
Contributor

@copilot --agent only controlled by engine.agent

Agent imports now only import markdown content and do NOT set the --agent flag.
The --agent flag is exclusively controlled by the engine.agent field.

Updated workflows to explicitly specify engine.agent since imports no longer set the flag.

Co-authored-by: pelikhan <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 31, 2026

@copilot --agent only controlled by engine.agent

Fixed in commit 2eec812. The --agent flag is now exclusively controlled by engine.agent. Agent imports only import markdown content and do not set the flag.

Copilot AI changed the title Add explicit engine.agent field as orthogonal feature to agent imports Add explicit engine.agent field for Copilot CLI agent specification Jan 31, 2026
@pelikhan pelikhan merged commit 97ff533 into main Jan 31, 2026
119 of 120 checks passed
@pelikhan pelikhan deleted the copilot/add-agent-id-frontmatter branch January 31, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants