A comprehensive integration framework for using Gemini CLI and GitHub Copilot CLI as collaborative agents with Claude Code. This project enables multi-AI perspectives, consensus-based decision making, and specialized expertise for development tasks, code reviews, data analysis, and research.
- π€ Research Agentic CLI Integration
- π Overview
β οΈ Important: Before You Begin- β¨ Features
- π Quick Start
- π Project Structure
- π» Usage
- π Agent Descriptions
- π Context Templates
- π§ Advanced Usage
- π‘ Best Practices
- π§ Troubleshooting
- π Documentation
- πΌ Examples
- π€ Contributing
- π Future Enhancements
- π Resources
- π License
- π¬ Support
This project integrates two powerful agentic CLI tools:
- π Gemini CLI - Development guidance, code reviews, and best practices analysis
- π GitHub Copilot CLI - Data analysis, experiment design, and GitHub workflow automation
These tools work alongside Claude Code to provide:
- π― Multiple AI perspectives on complex decisions
- π§ Specialized expertise for different domains
- π€ Consensus-building for high-confidence recommendations
- π Automated workflows and research assistance
β‘ Critical Prerequisites:
Before using any agents in this project, you MUST complete the following steps:
Both Gemini CLI and Copilot CLI must be installed globally on your system:
# Install Gemini CLI
npm install -g gemini-cli
# Install Copilot CLI
npm install -g @github/copilot
# Verify installations
gemini --version
copilot --versionEach tool requires authentication before use:
# Option 1: Using API Key (Free Tier / Personal Use)
export GOOGLE_API_KEY="your-api-key-here"
# Option 2: Using PRO Subscription
gemini
# Inside Gemini prompt, authenticate:
/auth
# Follow the authentication flowGet your API key: Google AI Studio
# Login with GitHub account (requires active Copilot subscription)
copilot auth login
# Verify authentication
copilot -p "Test authentication" --allow-all-toolsSubscription required: GitHub Copilot
Test both tools before using the agents:
# Test Gemini CLI
gemini "Hello, can you confirm you're working?"
# Test Copilot CLI
copilot -p "Hello, can you confirm you're working?" --allow-all-toolsπ¨ If either test fails, DO NOT proceed with agent usage. Complete the installation and authentication steps first.
- π― Multi-Agent Coordination: Research orchestrator that coordinates Gemini and Copilot agents
- π§ Specialized Agents: Focused expertise in code review, data analysis, experiment design
- π Reusable Templates: 50+ context templates for common tasks
- π Comprehensive Documentation: Setup guides, usage examples, best practices
- π Flexible Integration: Works seamlessly with Claude Code's Bash and Task tools
- π€ Multi-Model Support: Leverage Claude Sonnet 4.5, GPT-5, or Gemini 2.5 Pro based on task requirements
- β Node.js 22.x or higher
- β npm 10.x or higher
- β Claude Code environment
- π Google API key or Vertex AI credentials (for Gemini CLI)
- π³ GitHub Copilot subscription (for Copilot CLI)
- π₯ Install Tools
# Install Gemini CLI
npm install -g gemini-cli
# Install Copilot CLI
npm install -g @github/copilot- π Authenticate
# Gemini CLI - Set API key
export GOOGLE_API_KEY="your-api-key-here"
# or use your PRO subscription credentials
gemini
# inside Gemini prompt, follow instructions to authenticate
/auth
# Copilot CLI - Login with GitHub
copilot auth login- β Verify Installation
# Test Gemini CLI
gemini "Hello, can you confirm you're working?"
# Test Copilot CLI
copilot -p "Hello, can you confirm you're working?" --allow-all-toolsFor detailed setup instructions, see:
research-agentic-cli-integration/
βββ agents/ # π Agent definition files
β βββ gemini-integration.md # π Gemini CLI integration agent
β βββ copilot-integration.md # π Copilot CLI integration agent
β βββ research-orchestrator.md # π― Multi-agent orchestration
βββ gemini-cli/ # π Gemini CLI resources
β βββ context-templates/ # π Reusable prompt templates
β β βββ code-review-context.md
β β βββ best-practices-context.md
β β βββ development-guidance-context.md
β βββ SETUP.md # βοΈ Installation & configuration guide
βββ copilot-cli/ # π Copilot CLI resources
β βββ context-templates/ # π Reusable prompt templates
β β βββ data-analysis-context.md
β β βββ experiment-design-context.md
β βββ SETUP.md # βοΈ Installation & configuration guide
βββ todos/ # π Task tracking and improvements
βββ IDEA.md # π‘ Project vision and concept
βββ PLAN.md # π
Implementation milestones
βββ README.md # π This file
# From Claude Code, using Bash tool
# β οΈ IMPORTANT: Always include --include-directories flag
nvm use 22 && gemini --include-directories /work/agents -o json "Review @src/auth/login.ts for security vulnerabilities"# From Claude Code, using Bash tool
nvm use 22 && copilot --model claude-sonnet-4.5 -p "Analyze user engagement trends in @data/metrics.csv" --allow-tool 'read'The research orchestrator coordinates both agents for comprehensive analysis:
# Claude Code invokes orchestrator agent
# Orchestrator determines which tool(s) to use
# Results are consolidated into unified recommendationsExample scenarios:
- π Code + Data Analysis: Gemini reviews code quality, Copilot analyzes performance logs
- ποΈ Architecture Decisions: Both agents provide perspectives, Claude synthesizes consensus
- π§ͺ Experiment Design + Validation: Copilot designs experiment, Gemini validates technical feasibility
# Step 1: Gemini reviews code quality (note --include-directories flag)
nvm use 22 && gemini --include-directories $(pwd) -o json "Review @src/auth/*.ts for security and best practices" > gemini-review.json
# Step 2: Claude Code parses results and presents findings# Step 1: Copilot analyzes data
nvm use 22 && copilot --model claude-sonnet-4.5 -p "Analyze performance metrics in @data/api-logs.csv. Identify optimization opportunities." --allow-tool 'read' > analysis.txt
# Step 2: Gemini reviews code for optimization (include workspace directory)
nvm use 22 && gemini --include-directories $(pwd) -o json "Review @src/api/*.ts for performance bottlenecks identified in analysis.txt" > gemini-perf.json
# Step 3: Claude Code consolidates and prioritizes recommendations# Get perspectives from different models on same question
nvm use 22 && copilot --model claude-sonnet-4.5 -p "Should we use microservices or monolith? @docs/requirements.md" --allow-all-tools > claude-perspective.txt
nvm use 22 && copilot --model gpt-5 -p "Should we use microservices or monolith? @docs/requirements.md" --allow-all-tools > gpt-perspective.txt
nvm use 22 && gemini --include-directories $(pwd) "Should we use microservices or monolith? @docs/requirements.md" > gemini-perspective.txt
# Claude Code compares all three perspectives and builds consensusPurpose: Development guidance, code reviews, best practices analysis
Best For:
- π Security audits
- β Code quality reviews
- π Best practices validation
- ποΈ Architectural decisions
- π‘ Development guidance
Invocation Example:
nvm use 22 && gemini --include-directories $(pwd) -o json "Audit @src/auth/ for OWASP Top 10 vulnerabilities"See agents/gemini-integration.md for full documentation.
Purpose: Data analysis, experiment design, GitHub automation
Best For:
- π Statistical analysis
- π§ͺ Experiment design and A/B testing
- π GitHub repository operations
- π€ Multi-model perspectives
- π Data visualization recommendations
Invocation Example:
nvm use 22 && copilot --model claude-sonnet-4.5 -p "Analyze @data/sales.csv for trends and seasonality" --allow-tool 'read'See agents/copilot-integration.md for full documentation.
Purpose: Coordinate multiple agents for comprehensive analysis
Best For:
- π Complex decisions requiring multiple perspectives
- ποΈ High-stakes architectural choices
- π Comprehensive project analysis
- π€ Consensus-building workflows
Features:
- π― Task routing (determines which agent(s) to invoke)
- β‘ Parallel or sequential invocation
- π¦ Output consolidation
- π€ Consensus analysis (agreement vs divergent perspectives)
See agents/research-orchestrator.md for full documentation.
Reusable prompt templates for common tasks:
- π Code Review - Comprehensive code quality, security, and performance reviews
- β Best Practices - Language and framework best practices audits
- π‘ Development Guidance - Architectural decisions and technical guidance
Located in: gemini-cli/context-templates/
- π Data Analysis - Statistical analysis, trend detection, anomaly identification
- π§ͺ Experiment Design - A/B testing, experimental methodology, sample size calculation
Located in: copilot-cli/context-templates/
Each template includes:
- π Template structure
- π‘ 10+ detailed examples
- π Usage patterns
- β Best practices
- π Notes and tips
Create reusable commands in .gemini/commands/:
# .gemini/commands/security-audit.toml
[command]
name = "security-audit"
description = "Security audit of codebase"
prompt = """
Perform security audit of @src/ for OWASP Top 10:
1. Injection vulnerabilities
2. Authentication flaws
3. Sensitive data exposure
4. XXE
5. Broken access control
...
Output: JSON with severity levels
"""
output_format = "json"Usage: gemini security-audit
Create specialized agents in AGENTS.md:
## data-scientist
You are a data scientist specializing in statistical analysis.
### Focus
- Statistical significance testing
- Confidence intervals
- P-values
- Visualization recommendations
### Output
- Summary statistics
- Statistical tests
- RecommendationsUsage: copilot --agent data-scientist -p "Analyze @data/experiment.csv"
Extend capabilities with Model Context Protocol servers:
// ~/.copilot/mcp-config.json
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION_STRING": "postgresql://..."
}
}
}
}- π Use JSON Output: For Gemini CLI, use
-o jsonfor structured parsing - π€ Specify Models: For Copilot CLI, choose model based on task (Claude for analysis, GPT for creativity)
- π Tool Permissions: Use minimal permissions, expand as needed
- π Context Management: Use
@filesyntax explicitly for precise context - π° Cost Awareness: Monitor API usage, especially with auto-approval modes
- β Validate Results: Cross-check AI recommendations, especially for critical decisions
- π Document Interactions: Track agent invocations and outcomes in
todos/
"API key not found"
export GOOGLE_API_KEY="your-key"
echo $GOOGLE_API_KEY # Verify it's set"Context too large"
- Use specific file references with
@file - Leverage
.geminiignore - Break analysis into smaller chunks
"Not authenticated"
copilot auth login"Tool blocked by permissions"
copilot --allow-tool 'read' -p "Your prompt"
# Or for all tools:
copilot --allow-all-tools -p "Your prompt"See setup guides for comprehensive troubleshooting:
- π Gemini CLI Setup
- π Copilot CLI Setup
- π‘ IDEA.md - Project vision and concept
- π PLAN.md - Implementation milestones and timeline
- βοΈ Gemini CLI Setup - Installation and configuration
- βοΈ Copilot CLI Setup - Installation and configuration
- π Agent Definitions - Detailed agent documentation
- π Context Templates - Reusable prompts
- β TESTING-RESULTS.md - Validation results and findings
# 1. Gemini performs security audit (include workspace directory)
nvm use 22 && gemini --include-directories $(pwd) -o json "Audit @src/auth/ @src/api/ for security vulnerabilities. Focus on OWASP Top 10. Output JSON." > security-audit.json
# 2. Claude Code parses and categorizes findings
# 3. Presents prioritized list with file:line references# 1. Copilot designs experiment
nvm use 22 && copilot --model gpt-5 -p "Design A/B test for new checkout flow. Current conversion: 3.5%, Target: 5%, Duration: 2 weeks. Include sample size calc." --allow-all-tools > experiment-design.txt
# 2. Gemini validates technical implementation (include workspace)
nvm use 22 && gemini --include-directories $(pwd) "Review experiment design in experiment-design.txt. Assess technical feasibility for NestJS app in @src/checkout/. Flag risks." > feasibility.txt
# 3. Copilot analyzes test results (after test runs)
nvm use 22 && copilot --model claude-sonnet-4.5 -p "Analyze A/B test results @data/ab-test.csv. Calculate statistical significance, confidence intervals, recommendation." --allow-tool 'read' > results-analysis.txt
# 4. Claude Code consolidates into comprehensive report# Parallel invocation for multiple perspectives
nvm use 22 && gemini --include-directories $(pwd) "Analyze @src/ and recommend architecture: microservices vs modular monolith vs serverless. Context: 5-dev team, 50k users, growth to 200k in 12mo." > gemini-arch.txt &
nvm use 22 && copilot --model claude-sonnet-4.5 -p "Recommend architecture for growing NestJS app: microservices vs modular monolith. Team: 5 devs, Users: 50k->200k. Research industry trends." --allow-all-tools > copilot-arch.txt &
nvm use 22 && copilot --model gpt-5 -p "Suggest creative hybrid architecture approaches between microservices and monolith for 5-dev team with growth trajectory." --allow-all-tools > gpt-arch.txt &
wait
# Claude Code compares all three perspectives and synthesizes recommendationThis is a research project for integrating agentic CLI tools with Claude Code. Contributions welcome:
- π New Context Templates: Add templates for additional use cases
- βοΈ Custom Commands: Share useful Gemini commands in
.gemini/commands/ - π Custom Agents: Share Copilot agent configurations
- π Integration Patterns: Document successful workflows
- π Bug Reports: Report issues in
todos/
- π Additional domain-specific context templates
- βοΈ Custom commands library for common tasks
- π CI/CD integration patterns
- π° Cost tracking and optimization
- π€ Automated agent selection based on task classification
- π³οΈ Multi-agent voting system
- π Performance analytics dashboard
- πΎ Caching strategies for cost optimization
- π§ ML-based task routing
- π₯ Team collaboration features
- π Integration with additional agentic tools
- π’ Enterprise deployment guides
See PLAN.md for detailed roadmap.
- π Documentation: https://github.com/google-gemini/gemini-cli
- π API Docs: https://ai.google.dev/docs
- βοΈ Vertex AI: https://cloud.google.com/vertex-ai/docs
- π Documentation: https://github.com/features/copilot/cli
- π GitHub Copilot: https://docs.github.com/en/copilot
- π MCP Protocol: https://modelcontextprotocol.io
- π Documentation: https://claude.com/claude-code
- π οΈ Agent SDK: https://github.com/anthropics/claude-agent-sdk
This project is part of the broader agents repository. See repository root for license information.
For issues and questions:
- π Internal: Document in
todos/directory - π Gemini CLI: https://github.com/google-gemini/gemini-cli/issues
- π Copilot CLI: https://github.com/cli/cli/issues
- π€ Claude Code: https://github.com/anthropics/claude-code/issues
Status: β Infrastructure complete | π§ͺ Testing phase complete | π Ready for production Last Updated: 2025-11-20 Version: 1.0.0