Skip to content

Commit f041713

Browse files
committed
Add comprehensive CLAUDE.md for AI assistants
This file provides AI assistants with essential context about: - Repository purpose (documentation/issue tracking, not source code) - GitHub Copilot CLI architecture and key features - Development workflows and conventions - How to work with issues and documentation - Quick reference for common scenarios The guide emphasizes that this is a public docs repository, with detailed information extracted from the comprehensive changelog and README to help AI assistants provide accurate, helpful guidance.
1 parent 0d2c9de commit f041713

File tree

1 file changed

+350
-0
lines changed

1 file changed

+350
-0
lines changed

CLAUDE.md

Lines changed: 350 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
1+
# CLAUDE.md - AI Assistant Guide for GitHub Copilot CLI Repository
2+
3+
## 🎯 Repository Overview
4+
5+
**IMPORTANT:** This is the **public documentation and issue tracking repository** for GitHub Copilot CLI. The actual source code is maintained separately and distributed as the npm package `@github/copilot`.
6+
7+
This repository serves as:
8+
- Public documentation and README
9+
- Issue tracking and community feedback
10+
- Feature request management
11+
- Release changelog documentation
12+
13+
**What this repository IS NOT:**
14+
- Source code repository (no src/ or lib/ directories)
15+
- Build/test infrastructure
16+
- Package distribution point
17+
18+
## 📁 Repository Structure
19+
20+
```
21+
/home/user/copilot-cli/
22+
├── README.md # User-facing documentation (installation, usage)
23+
├── changelog.md # Comprehensive version history (primary source of architectural info)
24+
├── LICENSE.md # Pre-release license terms
25+
└── .github/
26+
├── ISSUE_TEMPLATE/
27+
│ ├── bug_report.yml # Structured bug report template
28+
│ └── feature_request.yml # Feature request template
29+
└── workflows/
30+
├── triage-issues.yml # Auto-labels new issues
31+
├── close-single-word-issues.yml # Auto-closes invalid issues
32+
├── stale-issues.yml # 365-day stale issue management
33+
├── feature-request-comment.yml # Acknowledges feature requests
34+
└── [other issue management workflows]
35+
```
36+
37+
## 🏗️ GitHub Copilot CLI Architecture
38+
39+
While the source code isn't in this repository, understanding the architecture is crucial for assisting users:
40+
41+
### Core Concepts
42+
43+
**Agentic Architecture:**
44+
- Built on GitHub's "agentic harness" - an AI agent system
45+
- Plans and executes complex multi-step tasks
46+
- Tool-based design pattern (agent calls tools, user approves)
47+
- Preview-first approach: nothing executes without user confirmation
48+
49+
**Technology Stack:**
50+
- Node.js v22+ (minimum requirement)
51+
- npm v10+
52+
- Cross-platform: Linux, macOS, Windows
53+
- Shell support: Bash, PowerShell v6+
54+
55+
### Tool System
56+
57+
The CLI uses a tool-calling architecture where the AI can invoke:
58+
59+
**Built-in Tools:**
60+
- File operations: read, write, edit, glob, grep
61+
- Shell command execution (with permission system)
62+
- Git operations
63+
- Web fetch and search
64+
65+
**GitHub MCP Server Tools** (default, limited set since v0.0.350):
66+
```
67+
Code: get_file_contents, search_code, search_repositories
68+
Git: list_branches, list_commits, get_commit
69+
Issues: get_issue, list_issues, get_issue_comments, search_issues
70+
PRs: pull_request_read, list_pull_requests, search_pull_requests
71+
Workflows: list_workflows, list_workflow_runs, get_workflow_run,
72+
get_job_logs, get_workflow_run_logs
73+
Users: user_search
74+
```
75+
76+
**Custom MCP Servers:**
77+
- Extensible via `~/.copilot/mcp-config.json`
78+
- Support for third-party MCP servers
79+
80+
### Permission System
81+
82+
Sophisticated path-based permission model:
83+
- Per-path read/write permissions
84+
- Whitelist/blacklist for tools via `--allow-tool`, `--deny-tool`
85+
- Glob pattern matching for tool rules
86+
- Smart heuristics to minimize permission prompts
87+
88+
### Configuration Files
89+
90+
**~/.copilot/config** - User preferences:
91+
```json
92+
{
93+
"log_level": "none|error|warning|info|debug|all|default",
94+
"show_banner": boolean,
95+
"screen_reader": boolean,
96+
"model": "string"
97+
}
98+
```
99+
100+
**~/.copilot/mcp-config.json** - MCP server configuration:
101+
```json
102+
{
103+
"mcpServers": {
104+
"server-name": {
105+
"command": "command-string",
106+
"env": {
107+
"VAR_NAME": "${REFERENCE}"
108+
}
109+
}
110+
}
111+
}
112+
```
113+
114+
**~/.copilot/agents/** - Custom agent definitions
115+
**.github/agents/** - Repository-level agents (v0.0.353+)
116+
117+
### Slash Commands
118+
119+
Internal commands use `/` prefix:
120+
- `/login` - Authentication
121+
- `/model [model]` - Model selection (Sonnet 4.5, Sonnet 4, Haiku 4.5, GPT-5)
122+
- `/mcp add|list|remove` - MCP server management
123+
- `/cwd [path]` - Change working directory
124+
- `/clear` - Clear session
125+
- `/usage` - Usage statistics
126+
- `/terminal-setup` - Configure terminal
127+
- `/feedback` - Submit feedback
128+
- `/user list|show|switch` - User management
129+
- `/agent <agent>` - Invoke custom agent (v0.0.353+)
130+
- `/delegate` - Async task delegation (creates PR, v0.0.353+)
131+
- `/exit`, `/quit` - Exit CLI
132+
133+
### Authentication
134+
135+
Multiple methods (in order of precedence):
136+
1. OAuth Device Flow (primary)
137+
2. Personal Access Token via `GH_TOKEN` or `GITHUB_TOKEN`
138+
3. GitHub CLI (`gh`) authentication
139+
4. GitHub Enterprise via `GH_HOST` environment variable
140+
141+
### Key Features
142+
143+
**Input Patterns:**
144+
- Natural language prompts
145+
- `@file.png` - Include files/images in context
146+
- `!command` - Direct shell execution
147+
- Multi-line input support (Kitty protocol)
148+
149+
**Session Management:**
150+
- Persistent sessions with resume (`--resume`, `--continue`)
151+
- Session state: `~/.copilot/session-state/`
152+
- Timeline-based conversation UI
153+
154+
**Advanced Capabilities:**
155+
- Parallel tool execution (v0.0.349+)
156+
- Async task delegation (v0.0.353+)
157+
- Token-by-token streaming (v0.0.348+)
158+
- Image support via @-mentions (v0.0.333+)
159+
- Custom agents (v0.0.353+)
160+
161+
## 🔧 Working with This Repository
162+
163+
### Issue Management
164+
165+
**Automated Workflows:**
166+
- New issues auto-labeled as "triage"
167+
- Single-word issues auto-closed
168+
- Stale issues closed after 365 days
169+
- Feature requests get acknowledgment comment
170+
- "More info needed" workflow
171+
- "Unable to reproduce" handling
172+
173+
**When Helping with Issues:**
174+
1. Check if it's a duplicate (search existing issues)
175+
2. Verify it's about the Copilot CLI (not VS Code, GitHub.com, etc.)
176+
3. Request minimal reproducible examples
177+
4. Reference changelog.md for version-specific behavior
178+
5. Note platform differences (Windows vs Linux vs macOS)
179+
6. Check if it's resolved in newer versions
180+
181+
### Documentation Updates
182+
183+
**README.md:**
184+
- Installation and prerequisites
185+
- Quick start guide
186+
- Feature overview
187+
- Links to official docs
188+
189+
**changelog.md:**
190+
- Most detailed source of product information
191+
- Documents every release (v0.0.X format)
192+
- Contains architectural decisions and breaking changes
193+
- Reference this for historical context
194+
195+
### Pull Requests for This Repo
196+
197+
When creating PRs for documentation:
198+
1. Update README.md for user-facing changes
199+
2. Keep changelog.md accurate (typically maintained by maintainers)
200+
3. Ensure cross-platform accuracy (Windows paths, shell syntax)
201+
4. Link to related issues
202+
5. Preview markdown rendering
203+
204+
## 📝 Conventions for AI Assistants
205+
206+
### When Working with Issues
207+
208+
**DO:**
209+
- Read the full issue and all comments before responding
210+
- Check changelog.md for relevant version information
211+
- Ask clarifying questions if the issue is vague
212+
- Provide workarounds while bugs are being fixed
213+
- Reference specific versions (e.g., "fixed in v0.0.350")
214+
- Consider cross-platform implications
215+
- Link to official documentation when relevant
216+
217+
**DON'T:**
218+
- Make promises about implementation timelines
219+
- Attempt to access or modify source code (it's not here)
220+
- Assume features without checking changelog
221+
- Provide solutions that bypass security/permission systems
222+
- Recommend outdated installation methods
223+
224+
### When Explaining the Product
225+
226+
**Key Points to Emphasize:**
227+
1. **Preview-First:** All actions require user confirmation
228+
2. **Terminal-Native:** No context switching required
229+
3. **GitHub Integration:** Deep integration with GitHub services
230+
4. **Extensible:** MCP servers for custom tools
231+
5. **Cross-Platform:** Works on Linux, macOS, Windows
232+
6. **Agentic:** Plans and executes multi-step tasks
233+
7. **Premium Requests:** Each interaction counts toward quota
234+
235+
### Common User Confusion Points
236+
237+
**"It's not working":**
238+
- Check Node.js version (v22+ required)
239+
- Verify active Copilot subscription
240+
- Check organization/enterprise policy settings
241+
- Try `copilot --version` to verify installation
242+
- Check `~/.copilot/config` for log level
243+
244+
**Authentication Issues:**
245+
- Order of precedence: OAuth > PAT > gh CLI
246+
- PAT needs "Copilot Requests" permission
247+
- GHE users need `GH_HOST` set
248+
- `/login` command for re-authentication
249+
250+
**Permission Prompts:**
251+
- Expected behavior for security
252+
- Can use `--allow-tool` / `--deny-tool` flags
253+
- Can grant persistent path permissions
254+
- Smart heuristics added in v0.0.351
255+
256+
**MCP Server Confusion:**
257+
- Default GitHub MCP server is bundled
258+
- Limited tool set by default (v0.0.350+)
259+
- Custom servers need `~/.copilot/mcp-config.json`
260+
- Check MCP server compatibility
261+
262+
## 🚀 Development Workflow for This Repository
263+
264+
### Branch Strategy
265+
266+
- Main branch: Production documentation
267+
- Feature branches: For documentation updates
268+
- PR-based workflow with review
269+
270+
### Git Commands
271+
272+
When working with this repository:
273+
274+
```bash
275+
# Check current branch
276+
git status
277+
278+
# Create feature branch
279+
git checkout -b docs/update-description
280+
281+
# Commit changes
282+
git add CLAUDE.md
283+
git commit -m "Add comprehensive CLAUDE.md for AI assistants"
284+
285+
# Push to remote
286+
git push -u origin docs/update-description
287+
```
288+
289+
### Commit Message Style
290+
291+
Based on recent commits in changelog:
292+
- Clear, descriptive summaries
293+
- Reference specific features or fixes
294+
- Use present tense: "Add feature" not "Added feature"
295+
- Examples:
296+
- "Update changelog for custom agents and /delegate command"
297+
- "Fix formatting of changelog entry for clarity"
298+
- "Update README with new authentication methods"
299+
300+
## 📚 Reference Information
301+
302+
### Key Files to Check
303+
304+
1. **changelog.md** - Most comprehensive product information
305+
2. **README.md** - Installation and basic usage
306+
3. **.github/ISSUE_TEMPLATE/** - Valid issue formats
307+
4. **LICENSE.md** - Legal terms and restrictions
308+
309+
### External Resources
310+
311+
- [Official Documentation](https://docs.github.com/copilot/concepts/agents/about-copilot-cli)
312+
- [npm Package](https://www.npmjs.com/package/@github/copilot)
313+
- [Copilot Plans](https://github.com/features/copilot/plans)
314+
- [Model Context Protocol](https://modelcontextprotocol.io/)
315+
316+
### Version History Highlights
317+
318+
- **v0.0.353** - Custom agents, /delegate command for async tasks
319+
- **v0.0.350** - Limited GitHub MCP server tools by default, bundled dependencies
320+
- **v0.0.349** - Parallel tool execution
321+
- **v0.0.348** - Token-by-token streaming, bundled node-pty
322+
- **v0.0.342** - New session state format, GHE support via GH_HOST
323+
- **v0.0.333** - Image support via @-mentions, ! for shell execution
324+
- **v0.0.329** - Glob patterns for tool allow/deny rules
325+
326+
## ⚠️ Important Reminders
327+
328+
1. **This is NOT the source code repository** - Direct users to file issues, not to expect code changes here
329+
2. **Changelog is authoritative** - Use it as primary reference for features and behavior
330+
3. **Cross-platform considerations** - Windows behaves differently (PowerShell vs bash)
331+
4. **Subscription required** - Copilot subscription needed, premium requests tracked
332+
5. **Pre-release software** - Expect frequent updates and changes
333+
6. **Security model** - Permission system is fundamental, don't suggest bypasses
334+
7. **GitHub context** - Deeply integrated with GitHub, not a general-purpose CLI tool
335+
336+
## 🎯 Quick Decision Tree for AI Assistants
337+
338+
**User asks about installation/usage →** Reference README.md
339+
**User reports a bug →** Check if duplicate, ask for repro, reference changelog for version info
340+
**User asks about features →** Check changelog.md for feature availability and version
341+
**User has authentication issues →** Guide through auth methods in order of precedence
342+
**User wants to extend functionality →** Explain MCP servers and custom agents
343+
**User asks about source code →** Clarify this is docs repo, source is private
344+
**User asks about specific version behavior →** Reference changelog.md for that version
345+
**Documentation needs updating →** Create PR with clear description and rationale
346+
347+
---
348+
349+
**Last Updated:** 2025-12-04 (for repository state at commit 0d2c9de)
350+
**For Questions:** File an issue in this repository or check official documentation

0 commit comments

Comments
 (0)