copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

[FEAT]: Custom Agent Configuration with Context Pre-loading Support

Open pgpbpadilla opened this issue 3 months ago • 1 comments

Describe the feature or problem you'd like to solve

Custom Agent Configuration with Context Pre-loading Support

Proposed solution

Summary

Enable GitHub Copilot CLI to support custom agent configurations with context pre-loading capabilities, similar to Amazon Q Developer CLI's agent system. This would allow developers to create specialized, context-aware agents for different projects, workflows, and domains.

Problem Description

Currently, GitHub Copilot CLI operates as a stateless tool that provides command suggestions and explanations without persistent context or domain specialization. While the tool is excellent for general command-line assistance, developers working on complex projects or specialized domains face several limitations:

Current Limitations

  1. No Persistent Context: Each interaction starts fresh without awareness of project context, previous conversations, or domain-specific requirements
  2. One-Size-Fits-All Approach: No ability to specialize the assistant for different workflows (e.g., AWS operations, Kubernetes management, data science, etc.)
  3. Manual Context Provision: Users must repeatedly provide the same contextual information (project structure, coding standards, environment setup) in each session
  4. Limited Workflow Integration: Cannot leverage project-specific documentation, configuration files, or organizational standards automatically

Real-World Impact

  • AWS DevOps Engineer: Needs agent aware of company's AWS account structure, IAM policies, and infrastructure-as-code patterns
  • Kubernetes Administrator: Requires agent familiar with cluster configuration, custom resources, and operational procedures
  • Data Scientist: Wants agent that understands project's data pipeline, ML frameworks, and analysis patterns
  • Enterprise Developer: Needs agent aware of corporate coding standards, security policies, and approved toolchains

Proposed Solution

Introduce a configuration system that allows users to define custom agents with pre-loaded context, similar to Amazon Q Developer CLI but adapted for GitHub Copilot CLI's command-focused interface.

Core Components

1. Agent Configuration Files

{
  "name": "aws-devops",
  "description": "AWS infrastructure and DevOps operations assistant",
  "prompt": "You are an expert AWS DevOps engineer familiar with our company's cloud infrastructure patterns and security requirements.",
  "resources": [
    "file://README.md",
    "file://docs/aws-architecture.md", 
    "file://.github/workflows/*.yml",
    "file://terraform/**/*.tf"
  ],
  "contextPatterns": [
    "**/*.tf",
    "**/*.yml", 
    "**/Dockerfile*",
    ".aws/config"
  ],
  "settings": {
    "maxContextFiles": 50,
    "preferredShell": "bash",
    "environmentHints": ["AWS_PROFILE", "TERRAFORM_WORKSPACE"]
  }
}

2. Context Pre-loading System

  • Resource Loading: Automatically load specified files and patterns into agent context
  • Smart Indexing: Index common project patterns (README, config files, documentation)
  • Environment Awareness: Detect and include relevant environment variables and tool configurations
  • Update Detection: Refresh context when watched files change

3. Agent Selection Interface

# Use default agent
gh copilot suggest "deploy application to staging"

# Use specific agent  
gh copilot suggest --agent aws-devops "deploy application to staging"

# Set default agent for current directory
gh copilot config set-default-agent aws-devops

# List available agents
gh copilot agent list

# Create new agent interactively
gh copilot agent create

Configuration Locations

# Global agents
~/.config/gh-copilot/agents/
├── aws-devops.json
├── kubernetes-admin.json
└── data-science.json

# Project-specific agents  
./.gh-copilot/
├── agents/
│   └── project-specific.json
└── config.json

Example Use Cases

AWS Infrastructure Agent

{
  "name": "aws-infrastructure", 
  "prompt": "Expert in AWS infrastructure automation using Terraform and CloudFormation",
  "resources": [
    "file://infrastructure/README.md",
    "file://terraform/**/*.tf",
    "file://.aws/config"
  ],
  "contextPatterns": ["**/*.tf", "**/*.yml", "**/buildspec.yml"],
  "environmentHints": ["AWS_PROFILE", "AWS_REGION", "TERRAFORM_WORKSPACE"]
}

Kubernetes Operations Agent

{
  "name": "k8s-ops",
  "prompt": "Kubernetes operations specialist familiar with our cluster configuration and deployment patterns", 
  "resources": [
    "file://k8s/**/*.yaml",
    "file://helm/**/*",
    "file://docs/runbooks/*.md"
  ],
  "contextPatterns": ["**/*.yaml", "**/*.yml", "**/Dockerfile*"],
  "environmentHints": ["KUBECONFIG", "KUBECTL_CONTEXT"]
}

Benefits

For Individual Developers

  • Faster Onboarding: New team members get context-aware assistance immediately
  • Reduced Cognitive Load: No need to repeatedly explain project context
  • Domain Expertise: Specialized agents provide more accurate, relevant suggestions
  • Workflow Efficiency: Context-aware suggestions reduce back-and-forth clarification

for Teams & Organizations

  • Consistent Practices: Agents encode organizational standards and best practices
  • Knowledge Sharing: Senior engineer expertise embedded in agent configurations
  • Onboarding Acceleration: New developers get immediate access to institutional knowledge
  • Compliance: Agents aware of security policies and compliance requirements

Competitive Advantages

  • Differentiates from Amazon Q: GitHub-native integration with repositories, workflows, and ecosystem
  • Builds on Existing Success: Extends proven command suggestion/explanation paradigm
  • IDE Agnostic: Works across all development environments, not just VS Code
  • Enterprise Ready: Supports organizational configuration and knowledge management

Implementation Considerations

Phase 1: Basic Agent Support

  • Agent configuration file format
  • Simple resource loading (local files only)
  • Agent selection via CLI flags
  • Basic context injection

Phase 2: Advanced Context Management

  • Smart file pattern matching
  • Environment variable integration
  • Context refresh and caching
  • Project-specific agent discovery

Phase 3: Enterprise Features

  • Organization-wide agent sharing
  • GitHub repository integration
  • Team collaboration features
  • Advanced security controls

Relationship to Existing Work

This feature request builds upon and complements:

  • Issue #144: "Agent mode similar to Copilot in VSCode" - This proposal extends that concept with persistent, configurable agents
  • Upcoming GitHub Copilot CLI: The new agentic assistant (replacing current tool in Oct 2025) could incorporate this configuration system from the start

Technical Feasibility

Existing Patterns

  • Amazon Q Developer CLI already demonstrates this approach successfully
  • GitHub Copilot already has context injection capabilities in IDE extensions
  • GitHub CLI has established patterns for configuration and extensions

Integration Points

  • Leverage existing GitHub CLI configuration system
  • Reuse GitHub Copilot's context processing pipelines
  • Build on established file watching and indexing patterns

Success Metrics

  • Adoption: Number of custom agents created by users
  • Engagement: Increased session length and command success rates with context-aware agents
  • Satisfaction: User feedback on relevance and accuracy improvements
  • Enterprise Uptake: Organizational adoption and agent sharing patterns

Note: This feature would position GitHub Copilot CLI as the most advanced context-aware command-line AI assistant, combining GitHub's ecosystem integration with the flexibility demonstrated by Amazon Q Developer CLI's agent system.

Example prompts or workflows

No response

Additional context

No response

pgpbpadilla avatar Sep 26 '25 14:09 pgpbpadilla

Please support consuming chatInstructions, chatPromptFiles, and the chatModes (now agentModes?) from VSCode extensions as documented here as well as auto-updating of extensions to allow for centralized, efficient management & sharing.

CraftyCraftress avatar Oct 21 '25 20:10 CraftyCraftress