Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

feat(routing): make GitHub Copilot CLI a first-class routing target (#1040)

Jean Vetorello569f250d31fa
diff --git a/AGENTS.md b/AGENTS.md
index 8d20ace2..af4bea1b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -73,7 +73,7 @@ install or refresh work.
If you're about to write a durable project rule ("always X", "never
Y", "all PRs must ..."), write it in the project's canonical agent instruction file.
Many projects use CLAUDE.md for Claude Code and
-AGENTS.md for Codex / OpenCode / OpenCode 2 / Cursor / Gemini CLI / Grok Build CLI / Kimi Code / Kiro CLI / Command Code,
+AGENTS.md for Codex / OpenCode / OpenCode 2 / Cursor / Gemini CLI / Grok Build CLI / Kimi Code / Kiro CLI / Command Code / GitHub Copilot CLI,
but if the project says one file is canonical, use that file.
Claude Code loads `CLAUDE.md` and does not read `AGENTS.md`. In a project
@@ -95,7 +95,7 @@ latest binary's recommended copy:
- **From the agent** (no terminal needed): ask "refresh the ai-memory
routing in this project". The agent calls `memory_install_self_routing`,
picks the right filename for itself (Claude Code -> `CLAUDE.md`; Codex /
- OpenCode / OpenCode 2 / Cursor / Gemini / Grok -> `AGENTS.md`; Kimi Code / Kiro CLI / Command Code -> `AGENTS.md`),
+ OpenCode / OpenCode 2 / Cursor / Gemini / Grok -> `AGENTS.md`; Kimi Code / Kiro CLI / Command Code / Copilot CLI -> `AGENTS.md`),
uses its Write / Edit tool to replace or append the returned
`markered_block` while preserving
non-ai-memory user content, then writes or updates each returned
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1aeed472..611adaf9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
and the existing SessionStart hook delivers the workstream context. The
first managed launch auto-wires Copilot's hooks and MCP, and `doctor` now
counts its local sessions. Verified against Copilot CLI 1.0.92. (#1040)
+- GitHub Copilot CLI is now a first-class routing target:
+ `install-skills --agent copilot-cli` (and `install-instructions
+ --skills-agent copilot-cli`) writes the managed Agent Skills to the
+ repository's `.github/skills` or, globally, to `$COPILOT_HOME/skills`
+ (default `~/.copilot/skills`); `memory_install_self_routing` returns
+ `copilot_cli` filename and skill-root hints; the routing snippet, the
+ routing-install skill, and the MCP instructions name Copilot CLI with
+ `AGENTS.md`; and `uninstall` sweeps both Copilot roots, removing only
+ marker-bearing ai-memory skills. (#1040)
## [2.6.0] - 2026-10-07
diff --git a/crates/ai-memory-cli/src/cli.rs b/crates/ai-memory-cli/src/cli.rs
index d308ab32..97aea660 100644
--- a/crates/ai-memory-cli/src/cli.rs
+++ b/crates/ai-memory-cli/src/cli.rs
@@ -1757,6 +1757,9 @@ pub enum InstallSkillsAgent {
Devin,
/// Grok Build CLI's `.grok/skills` directory.
Grok,
+ /// GitHub Copilot CLI's `.github/skills` (project) or
+ /// `$COPILOT_HOME/skills` (global, default `~/.copilot/skills`) directory.
+ CopilotCli,
/// Hermes Agent's `.hermes/skills` directory.
Hermes,
/// Install into both Claude Code and `.agents` skill directories.
diff --git a/crates/ai-memory-cli/src/commands/install_skills.rs b/crates/ai-memory-cli/src/commands/install_skills.rs
index d3a7a33a..69aa00b4 100644
--- a/crates/ai-memory-cli/src/commands/install_skills.rs
+++ b/crates/ai-memory-cli/src/commands/install_skills.rs
@@ -4,8 +4,8 @@ use std::fs;
use std::path::{Path, PathBuf};
use ai_memory_core::routing_skills::{
- AGENTS_SKILL_DIR, CLAUDE_SKILL_DIR, DEVIN_SKILL_DIR, GROK_SKILL_DIR, HERMES_SKILL_DIR,
- MANAGED_MARKER, MANAGED_SKILLS, ManagedSkill, SKILLS_DIR,
+ AGENTS_SKILL_DIR, CLAUDE_SKILL_DIR, COPILOT_SKILL_DIR, DEVIN_SKILL_DIR, GITHUB_SKILL_DIR,
+ GROK_SKILL_DIR, HERMES_SKILL_DIR, MANAGED_MARKER, MANAGED_SKILLS, ManagedSkill, SKILLS_DIR,
};
use anyhow::{Context, Result, bail};
@@ -89,17 +89,22 @@ fn resolve_target_roots_from_env(args: &InstallSkillsArgs) -> Result<Vec<TargetR
let cwd = std::env::current_dir().context("getting CWD for install-skills target")?;
let home = home_dir();
let appdata = std::env::var_os("APPDATA").map(PathBuf::from);
- let grok_home = (args.scope == InstallSkillsScope::Global
- && args.agent == InstallSkillsAgent::Grok)
- .then(install_mcp::grok_home)
- .transpose()?;
+ // Grok and Copilot CLI relocate their whole config home, global skills
+ // included, through GROK_HOME / COPILOT_HOME.
+ let agent_home = match (args.scope, args.agent) {
+ (InstallSkillsScope::Global, InstallSkillsAgent::Grok) => Some(install_mcp::grok_home()?),
+ (InstallSkillsScope::Global, InstallSkillsAgent::CopilotCli) => Some(
+ install_mcp::copilot_home_in(std::env::var_os("COPILOT_HOME"))?,
+ ),
+ _ => None,
+ };
let claude_config_dir = claude_config_dir(std::env::var_os("CLAUDE_CONFIG_DIR"));
resolve_target_roots_for_platform(
args,
&cwd,
home.as_deref(),
appdata.as_deref(),
- grok_home.as_deref(),
+ agent_home.as_deref(),
claude_config_dir.as_deref(),
SkillHostPlatform::current(),
)
@@ -119,7 +124,7 @@ fn resolve_target_roots_for_platform(
cwd: &Path,
home: Option<&Path>,
appdata: Option<&Path>,
- grok_home: Option<&Path>,
+ agent_home: Option<&Path>,
claude_config_dir: Option<&Path>,
platform: SkillHostPlatform,
) -> Result<Vec<TargetRoot>> {
@@ -135,7 +140,7 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
claude_config_dir,
platform,
)?]
@@ -147,7 +152,7 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
claude_config_dir,
platform,
)?]
@@ -159,7 +164,7 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
claude_config_dir,
platform,
)?]
@@ -171,7 +176,19 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
+ claude_config_dir,
+ platform,
+ )?]
+ }
+ InstallSkillsAgent::CopilotCli => {
+ vec![agent_root(
+ args.scope,
+ SkillRootKind::CopilotCli,
+ cwd,
+ home,
+ appdata,
+ agent_home,
claude_config_dir,
platform,
)?]
@@ -183,7 +200,7 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
claude_config_dir,
platform,
)?]
@@ -195,7 +212,7 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
claude_config_dir,
platform,
)?,
@@ -205,7 +222,7 @@ fn resolve_target_roots_for_platform(
cwd,
home,
appdata,
- grok_home,
+ agent_home,
claude_config_dir,
platform,
)?,
@@ -237,6 +254,7 @@ enum SkillRootKind {
Agents,
Devin,
Grok,
+ CopilotCli,
Hermes,
}
@@ -247,7 +265,7 @@ fn agent_root(
cwd: &Path,
home: Option<&Path>,
appdata: Option<&Path>,
- grok_home: Option<&Path>,
+ agent_home: Option<&Path>,
claude_config_dir: Option<&Path>,
platform: SkillHostPlatform,
) -> Result<PathBuf> {
@@ -261,10 +279,10 @@ fn agent_root(
}
if scope == InstallSkillsScope::Global
- && kind == SkillRootKind::Grok
- && let Some(grok_home) = grok_home
+ && matches!(kind, SkillRootKind::Grok | SkillRootKind::CopilotCli)
+ && let Some(agent_home) = agent_home
{
- return Ok(grok_home.join(SKILLS_DIR));
+ return Ok(agent_home.join(SKILLS_DIR));
}
// Claude Code relocates its whole config dir under $CLAUDE_CONFIG_DIR;
@@ -288,6 +306,12 @@ fn agent_root(
SkillRootKind::Agents => AGENTS_SKILL_DIR,
SkillRootKind::Devin => DEVIN_SKILL_DIR,
SkillRootKind::Grok => GROK_SKILL_DIR,
+ // Copilot CLI reads project skills from the repository's `.github`
+ // and personal skills from `~/.copilot`.
+ SkillRootKind::CopilotCli => match scope {
+ InstallSkillsScope::Project => GITHUB_SKILL_DIR,
+ InstallSkillsScope::Global => COPILOT_SKILL_DIR,
+ },
SkillRootKind::Hermes => HERMES_SKILL_DIR,
};
Ok(base.join(agent_dir).join(SKILLS_DIR))
@@ -546,6 +570,52 @@ mod tests {
assert_eq!(root_names(&roots), ["/custom/grok/skills"]);
}
+ #[test]
+ fn copilot_cli_skill_roots_split_project_github_and_global_copilot_home() {
+ let cwd = Path::new("/repo");
+ let home = Path::new("/home/alice");
+ let project = resolve_target_roots(
+ &args(InstallSkillsScope::Project, InstallSkillsAgent::CopilotCli),
+ cwd,
+ Some(home),
+ )
+ .unwrap();
+ assert_eq!(root_names(&project), ["/repo/.github/skills"]);
+
+ let global = resolve_target_roots(
+ &args(InstallSkillsScope::Global, InstallSkillsAgent::CopilotCli),
+ cwd,
+ Some(home),
+ )
+ .unwrap();
+ assert_eq!(root_names(&global), ["/home/alice/.copilot/skills"]);
+
+ let relocated = resolve_target_roots_for_platform(
+ &args(InstallSkillsScope::Global, InstallSkillsAgent::CopilotCli),
+ cwd,
+ Some(home),
+ None,
+ Some(Path::new("/custom/copilot")),
+ None,
+ SkillHostPlatform::Other,
+ )
+ .unwrap();
+ assert_eq!(root_names(&relocated), ["/custom/copilot/skills"]);
+
+ // COPILOT_HOME never moves project skills out of the repository.
+ let project_relocated = resolve_target_roots_for_platform(
+ &args(InstallSkillsScope::Project, InstallSkillsAgent::CopilotCli),
+ cwd,
+ Some(home),
+ None,
+ Some(Path::new("/custom/copilot")),
+ None,
+ SkillHostPlatform::Other,
+ )
+ .unwrap();
+ assert_eq!(root_names(&project_relocated), ["/repo/.github/skills"]);
+ }
+
#[test]
fn global_claude_skill_root_uses_injected_claude_config_dir() {
let roots = resolve_target_roots_for_platform(
diff --git a/crates/ai-memory-cli/src/commands/uninstall.rs b/crates/ai-memory-cli/src/commands/uninstall.rs
index 87c9aa99..f0d7defc 100644
--- a/crates/ai-memory-cli/src/commands/uninstall.rs
+++ b/crates/ai-memory-cli/src/commands/uninstall.rs
@@ -17,8 +17,8 @@ use crate::commands::path_util::{
use crate::commands::{data_purge, install_hooks, install_mcp, openclaw_plugin};
use crate::config::Config;
use ai_memory_core::routing_skills::{
- AGENTS_SKILL_DIR, CLAUDE_SKILL_DIR, DEVIN_SKILL_DIR, GROK_SKILL_DIR, MANAGED_MARKER,
- MANAGED_SKILLS, SKILLS_DIR,
+ AGENTS_SKILL_DIR, CLAUDE_SKILL_DIR, COPILOT_SKILL_DIR, DEVIN_SKILL_DIR, GITHUB_SKILL_DIR,
+ GROK_SKILL_DIR, MANAGED_MARKER, MANAGED_SKILLS, SKILLS_DIR,
};
use ai_memory_core::{MARKER_END, MARKER_START, find_marker_line};
use anyhow::{Context, Result};
@@ -486,11 +486,13 @@ fn build_plan(args: &UninstallArgs, data_dir: &Path) -> anyhow::Result<Vec<Plann
let cwd = std::env::current_dir().context("getting CWD for skill removal")?;
let appdata = std::env::var_os("APPDATA").map(PathBuf::from);
let grok_home = install_mcp::grok_home().ok();
+ let copilot_home = install_mcp::copilot_home_in(std::env::var_os("COPILOT_HOME")).ok();
for root in skill_roots(
&cwd,
home.as_deref(),
appdata.as_deref(),
grok_home.as_deref(),
+ copilot_home.as_deref(),
claude_config_dir.as_deref(),
) {
for skill in MANAGED_SKILLS {
@@ -529,13 +531,15 @@ fn skill_roots(
home: Option<&Path>,
appdata: Option<&Path>,
grok_home: Option<&Path>,
+ copilot_home: Option<&Path>,
claude_config_dir: Option<&Path>,
) -> Vec<PathBuf> {
- let mut roots = Vec::with_capacity(10);
+ let mut roots = Vec::with_capacity(12);
push_unique_skill_root(&mut roots, cwd.join(CLAUDE_SKILL_DIR).join(SKILLS_DIR));
push_unique_skill_root(&mut roots, cwd.join(AGENTS_SKILL_DIR).join(SKILLS_DIR));
push_unique_skill_root(&mut roots, cwd.join(DEVIN_SKILL_DIR).join(SKILLS_DIR));
push_unique_skill_root(&mut roots, cwd.join(GROK_SKILL_DIR).join(SKILLS_DIR));
+ push_unique_skill_root(&mut roots, cwd.join(GITHUB_SKILL_DIR).join(SKILLS_DIR));
if let Some(home) = home {
push_unique_skill_root(&mut roots, home.join(CLAUDE_SKILL_DIR).join(SKILLS_DIR));
push_unique_skill_root(&mut roots, home.join(AGENTS_SKILL_DIR).join(SKILLS_DIR));
@@ -544,6 +548,10 @@ fn skill_roots(
.map(Path::to_path_buf)
.unwrap_or_else(|| home.join(GROK_SKILL_DIR));
push_unique_skill_root(&mut roots, grok_root.join(SKILLS_DIR));
+ let copilot_root = copilot_home
+ .map(Path::to_path_buf)
+ .unwrap_or_else(|| home.join(COPILOT_SKILL_DIR));
+ push_unique_skill_root(&mut roots, copilot_root.join(SKILLS_DIR));
}
// Windows global Devin installs live under %APPDATA%\devin\skills, not
// $HOME/.devin/skills — sweep it too or uninstall orphans those skills.
@@ -1482,17 +1490,17 @@ mod tests {
let home = Path::new("/home/alice");
let appdata = Path::new("C:/Users/Alice/AppData/Roaming");
- let roots = skill_roots(cwd, Some(home), Some(appdata), None, None);
+ let roots = skill_roots(cwd, Some(home), Some(appdata), None, None, None);
assert!(
roots.contains(&appdata.join("devin").join(SKILLS_DIR)),
"{roots:?}"
);
- let without = skill_roots(cwd, Some(home), None, None, None);
+ let without = skill_roots(cwd, Some(home), None, None, None, None);
assert_eq!(
without.len(),
- 8,
- "no phantom root when APPDATA is unset (claude/agents/devin/grok × project+global)"
+ 10,
+ "no phantom root when APPDATA is unset (claude/agents/devin/grok/copilot × project+global)"
);
assert!(
without.contains(&cwd.join(GROK_SKILL_DIR).join(SKILLS_DIR)),
@@ -1514,6 +1522,7 @@ mod tests {
Some(Path::new("/home/alice")),
None,
None,
+ None,
Some(Path::new("/stores/claude")),
);
assert!(
@@ -1534,6 +1543,7 @@ mod tests {
None,
Some(Path::new("/custom/grok")),
None,
+ None,
);
assert!(
roots.contains(&PathBuf::from("/custom/grok/skills")),
@@ -1542,6 +1552,71 @@ mod tests {
assert!(!roots.contains(&PathBuf::from("/home/alice/.grok/skills")));
}
+ /// `.github/skills` is usually committed team content, so sweeping it must
+ /// only ever plan the deletion of ai-memory's own marker-bearing files.
+ #[test]
+ fn github_skill_root_sweep_spares_unmanaged_same_name_skills() {
+ let tmp = tempfile::tempdir().unwrap();
+ let skill = MANAGED_SKILLS[0];
+ let user = tmp
+ .path()
+ .join("user/.github/skills")
+ .join(skill.relative_path);
+ std::fs::create_dir_all(user.parent().unwrap()).unwrap();
+ std::fs::write(&user, "---\nname: team-skill\n---\nteam-authored\n").unwrap();
+ let mut plan = Vec::new();
+ push_generated_delete(&mut plan, user.clone(), DeleteKind::ManagedSkill);
+ assert!(
+ plan.is_empty(),
+ "an unmanaged skill must never be planned: {plan:?}"
+ );
+
+ let managed = tmp
+ .path()
+ .join("ours/.github/skills")
+ .join(skill.relative_path);
+ std::fs::create_dir_all(managed.parent().unwrap()).unwrap();
+ std::fs::write(&managed, skill.content).unwrap();
+ push_generated_delete(&mut plan, managed.clone(), DeleteKind::ManagedSkill);
+ assert_eq!(plan.len(), 1, "the managed control must be planned");
+ }
+
+ /// `install-skills --agent copilot-cli` writes `.github/skills` in the
+ /// project and `$COPILOT_HOME/skills` globally; uninstall must sweep both.
+ #[test]
+ fn skill_roots_sweep_copilot_cli_project_and_relocated_home() {
+ let roots = skill_roots(
+ Path::new("/repo"),
+ Some(Path::new("/home/alice")),
+ None,
+ None,
+ Some(Path::new("/custom/copilot")),
+ None,
+ );
+ assert!(
+ roots.contains(&PathBuf::from("/repo/.github/skills")),
+ "{roots:?}"
+ );
+ assert!(
+ roots.contains(&PathBuf::from("/custom/copilot/skills")),
+ "{roots:?}"
+ );
+ assert!(!roots.contains(&PathBuf::from("/home/alice/.copilot/skills")));
+
+ let default_home = skill_roots(
+ Path::new("/repo"),
+ Some(Path::new("/home/alice")),
+ None,
+ None,
+ None,
+ None,
+ );
+ assert!(
+ default_home.contains(&PathBuf::from("/home/alice/.copilot/skills")),
+ "{default_home:?}"
+ );
+ }
+
#[test]
fn strip_instructions_round_trips_with_install_append() {
let original = "# Title\n";
diff --git a/crates/ai-memory-core/src/routing_skills.rs b/crates/ai-memory-core/src/routing_skills.rs
index 51113526..f8512355 100644
--- a/crates/ai-memory-core/src/routing_skills.rs
+++ b/crates/ai-memory-core/src/routing_skills.rs
@@ -14,6 +14,11 @@ pub const AGENTS_SKILL_DIR: &str = ".agents";
pub const DEVIN_SKILL_DIR: &str = ".devin";
/// Grok Build CLI Agent Skill directory below a project or home root.
pub const GROK_SKILL_DIR: &str = ".grok";
+/// GitHub Copilot CLI project Agent Skill directory below a repository root.
+pub const GITHUB_SKILL_DIR: &str = ".github";
+/// GitHub Copilot CLI personal Agent Skill directory below the home root, used
+/// when `COPILOT_HOME` does not relocate it.
+pub const COPILOT_SKILL_DIR: &str = ".copilot";
/// Hermes Agent Skill directory below a project or home root.
pub const HERMES_SKILL_DIR: &str = ".hermes";
/// Leaf directory that contains individual Agent Skill directories.
diff --git a/crates/ai-memory-core/src/routing_skills/ai-memory-routing-install/SKILL.md b/crates/ai-memory-core/src/routing_skills/ai-memory-routing-install/SKILL.md
index e46d3beb..b805fca9 100644
--- a/crates/ai-memory-core/src/routing_skills/ai-memory-routing-install/SKILL.md
+++ b/crates/ai-memory-core/src/routing_skills/ai-memory-routing-install/SKILL.md
@@ -38,6 +38,7 @@ Project-local targets:
- `.claude/skills/<skill>/SKILL.md` for Claude-compatible installs.
- `.agents/skills/<skill>/SKILL.md` for cross-client installs.
- `.grok/skills/<skill>/SKILL.md` for Grok Build CLI installs.
+- `.github/skills/<skill>/SKILL.md` for GitHub Copilot CLI installs.
Global targets:
@@ -45,11 +46,13 @@ Global targets:
- `~/.agents/skills/<skill>/SKILL.md` for cross-client installs.
- `$GROK_HOME/skills/<skill>/SKILL.md` for Grok Build CLI installs (default:
`~/.grok/skills/<skill>/SKILL.md`).
+- `$COPILOT_HOME/skills/<skill>/SKILL.md` for GitHub Copilot CLI installs
+ (default: `~/.copilot/skills/<skill>/SKILL.md`).
Use platform-aware path joining. Do not build paths by string concatenation.
## Refresh guidance
-For an agent-side refresh, call the install-routing tool (pass `compact: true` if the target file already uses the compact snippet or if managed Agent Skills handle detailed routing). Its returned `target_hints` are authoritative for skill roots: choose the right instruction filename from `agent_filenames`, write the markered block with the agent's file-edit tool, and write each managed skill file below the selected hint using its `relative_path`. Claude Code normally uses `CLAUDE.md` and `.claude/skills`; Codex, OpenCode, Cursor, Gemini CLI, and AGENTS-aware clients normally use `AGENTS.md` and `.agents/skills`; Grok Build CLI uses `AGENTS.md` and `.grok/skills` unless the project says otherwise.
+For an agent-side refresh, call the install-routing tool (pass `compact: true` if the target file already uses the compact snippet or if managed Agent Skills handle detailed routing). Its returned `target_hints` are authoritative for skill roots: choose the right instruction filename from `agent_filenames`, write the markered block with the agent's file-edit tool, and write each managed skill file below the selected hint using its `relative_path`. Claude Code normally uses `CLAUDE.md` and `.claude/skills`; Codex, OpenCode, Cursor, Gemini CLI, and AGENTS-aware clients normally use `AGENTS.md` and `.agents/skills`; Grok Build CLI uses `AGENTS.md` and `.grok/skills`; GitHub Copilot CLI uses `AGENTS.md` and `.github/skills` unless the project says otherwise.
For a CLI refresh, prefer the canonical install command. The snippet and skills must be updated from the same core-owned assets so they do not drift.
diff --git a/crates/ai-memory-core/src/routing_snippet.rs b/crates/ai-memory-core/src/routing_snippet.rs
index 1178989e..702c0c2b 100644
--- a/crates/ai-memory-core/src/routing_snippet.rs
+++ b/crates/ai-memory-core/src/routing_snippet.rs
@@ -101,7 +101,7 @@ install or refresh work.
If you're about to write a durable project rule ("always X", "never
Y", "all PRs must ..."), write it in the project's canonical agent instruction file.
Many projects use CLAUDE.md for Claude Code and
-AGENTS.md for Codex / OpenCode / OpenCode 2 / Cursor / Gemini CLI / Grok Build CLI / Kimi Code / Kiro CLI / Command Code,
+AGENTS.md for Codex / OpenCode / OpenCode 2 / Cursor / Gemini CLI / Grok Build CLI / Kimi Code / Kiro CLI / Command Code / GitHub Copilot CLI,
but if the project says one file is canonical, use that file.
Claude Code loads `CLAUDE.md` and does not read `AGENTS.md`. In a project
@@ -123,7 +123,7 @@ latest binary's recommended copy:
- **From the agent** (no terminal needed): ask "refresh the ai-memory
routing in this project". The agent calls `memory_install_self_routing`,
picks the right filename for itself (Claude Code -> `CLAUDE.md`; Codex /
- OpenCode / OpenCode 2 / Cursor / Gemini / Grok -> `AGENTS.md`; Kimi Code / Kiro CLI / Command Code -> `AGENTS.md`),
+ OpenCode / OpenCode 2 / Cursor / Gemini / Grok -> `AGENTS.md`; Kimi Code / Kiro CLI / Command Code / Copilot CLI -> `AGENTS.md`),
uses its Write / Edit tool to replace or append the returned
`markered_block` while preserving
non-ai-memory user content, then writes or updates each returned
diff --git a/crates/ai-memory-mcp/src/server.rs b/crates/ai-memory-mcp/src/server.rs
index da039c57..481a48d9 100644
--- a/crates/ai-memory-mcp/src/server.rs
+++ b/crates/ai-memory-mcp/src/server.rs
@@ -381,7 +381,8 @@ should be proposed from a completed session, or at explicit wrap-up \
CLAUDE.md / AGENTS.md'. Returns the managed routing package: the \
slim markered snippet (`markered_block`), filename hints, \
`managed_skills` payloads, `target_hints` for `.claude/skills`, \
- `.agents/skills`, `.devin/skills`, `.grok/skills`, `.hermes/skills`, and Devin's Windows global \
+ `.agents/skills`, `.devin/skills`, `.grok/skills`, `.github/skills` (GitHub Copilot CLI), \
+ `.hermes/skills`, and Devin's Windows global \
`%APPDATA%\\devin\\skills` root, and overwrite guidance. Use your own Write/Edit \
tool to replace only the ai-memory marker block in the rules file, \
then write each managed skill under the selected skill root. Only \
@@ -6079,7 +6080,8 @@ impl AiMemoryServer {
`agent_filenames` for rules-file targets, `managed_skills` for \
Agent Skill files, and `target_hints` for project/global \
`.claude/skills`, `.agents/skills`, `.devin/skills`, `.grok/skills`, \
- `.hermes/skills`, `$GROK_HOME/skills` (default `~/.grok/skills`), and Devin Windows global roots. \
+ `.github/skills`, `.hermes/skills`, `$GROK_HOME/skills` (default `~/.grok/skills`), \
+ `$COPILOT_HOME/skills` (default `~/.copilot/skills`), and Devin Windows global roots. \
Use when the user asks to install or refresh ai-memory routing in this project. \
Pass `compact: true` to return the compact routing block that delegates \
to installed Agent Skills, or when refreshing a file that already uses the compact snippet. \
@@ -6132,6 +6134,7 @@ impl AiMemoryServer {
"kimi_code": "AGENTS.md",
"command_code": "AGENTS.md",
"grok": "AGENTS.md",
+ "copilot_cli": "AGENTS.md",
"default": "AGENTS.md"
},
"managed_skills": managed_skills,
@@ -6141,6 +6144,7 @@ impl AiMemoryServer {
"agents": ".agents/skills",
"devin": ".devin/skills",
"grok": ".grok/skills",
+ "copilot_cli": ".github/skills",
"hermes": ".hermes/skills"
},
"global": {
@@ -6151,6 +6155,7 @@ impl AiMemoryServer {
"non_windows": "~/.devin/skills"
},
"grok": "$GROK_HOME/skills (default: ~/.grok/skills)",
+ "copilot_cli": "$COPILOT_HOME/skills (default: ~/.copilot/skills)",
"hermes": "~/.hermes/skills"
}
},
@@ -6165,7 +6170,7 @@ impl AiMemoryServer {
"If the target file already uses the compact routing block (or if managed Agent Skills handle detailed routing), call memory_install_self_routing with compact: true so the compact format is preserved.",
"If the file doesn't exist, create it with just the markered_block (plus a trailing newline).",
"If the file exists but has no ai-memory markers, append the markered_block with one blank line of separation from existing content.",
- "Install each managed_skills item under the selected skill root from target_hints using its relative_path, for example .claude/skills/<relative_path>, .agents/skills/<relative_path>, .devin/skills/<relative_path>, .grok/skills/<relative_path>, $GROK_HOME/skills/<relative_path> (default ~/.grok/skills), or %APPDATA%\\devin\\skills\\<relative_path> on Windows global Devin installs.",
+ "Install each managed_skills item under the selected skill root from target_hints using its relative_path, for example .claude/skills/<relative_path>, .agents/skills/<relative_path>, .devin/skills/<relative_path>, .grok/skills/<relative_path>, $GROK_HOME/skills/<relative_path> (default ~/.grok/skills), .github/skills/<relative_path> or $COPILOT_HOME/skills/<relative_path> (default ~/.copilot/skills) for GitHub Copilot CLI, or %APPDATA%\\devin\\skills\\<relative_path> on Windows global Devin installs.",
"Existing skill files containing the managed marker <!-- ai-memory-managed: routing-skill --> may be replaced; unmanaged same-name skills must not be overwritten unless the human explicitly forces replacement."
]
});
@@ -8551,6 +8556,17 @@ mod tests {
}
}
+ #[test]
+ fn installed_prompt_surface_routes_copilot_cli_to_agents_md() {
+ let installed = installed_ai_memory_prompt_surface();
+ assert!(
+ installed.contains("GitHub Copilot CLI")
+ && installed.contains("Copilot CLI -> `AGENTS.md`")
+ && installed.contains(".github/skills"),
+ "installed snippet and managed skills must route Copilot CLI to AGENTS.md and .github/skills"
+ );
+ }
+
#[test]
fn installed_prompt_surface_routes_grok_to_agents_md() {
let installed = installed_ai_memory_prompt_surface();
@@ -8978,6 +8994,12 @@ mod tests {
&& routing_install_content.contains("~/.grok/skills"),
"routing-install skill must treat target_hints as authoritative and include Grok roots"
);
+ assert!(
+ routing_install_content.contains(".github/skills")
+ && routing_install_content.contains("$COPILOT_HOME/skills")
+ && routing_install_content.contains("~/.copilot/skills"),
+ "routing-install skill must include GitHub Copilot CLI roots"
+ );
assert_eq!(
response["target_hints"]["project"]["claude_code"]
@@ -9047,6 +9069,22 @@ mod tests {
response["agent_filenames"]["grok"].as_str().unwrap(),
"AGENTS.md"
);
+ assert_eq!(
+ response["target_hints"]["project"]["copilot_cli"]
+ .as_str()
+ .unwrap(),
+ ".github/skills"
+ );
+ assert_eq!(
+ response["target_hints"]["global"]["copilot_cli"]
+ .as_str()
+ .unwrap(),
+ "$COPILOT_HOME/skills (default: ~/.copilot/skills)"
+ );
+ assert_eq!(
+ response["agent_filenames"]["copilot_cli"].as_str().unwrap(),
+ "AGENTS.md"
+ );
let notes = response["notes"]
.as_array()
@@ -9102,8 +9140,10 @@ mod tests {
&& desc.contains(".agents/skills")
&& desc.contains(".devin/skills")
&& desc.contains(".grok/skills")
- && desc.contains("$GROK_HOME/skills"),
- "tool description must name Claude, .agents, Devin, and Grok skill targets; got: {desc}"
+ && desc.contains("$GROK_HOME/skills")
+ && desc.contains(".github/skills")
+ && desc.contains("$COPILOT_HOME/skills"),
+ "tool description must name Claude, .agents, Devin, Grok, and Copilot CLI skill targets; got: {desc}"
);
assert!(
desc.contains("preserve non-ai-memory user content"),
diff --git a/docs/install.md b/docs/install.md
index d7623812..b96a0855 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -2394,7 +2394,7 @@ Linux, and macOS. This does not rewrite line endings in user-authored files.
|---|---|
| `--no-skills` | Refresh only the markered instruction block. |
| `--skills-scope <scope>` | Choose project-local or user-global skill roots. Values: `project`, `global`. Defaults to `project`. |
-| `--skills-agent <agent>` | Choose `.claude/skills`, `.agents/skills`, `.devin/skills`, `.grok/skills`, or both Claude/Agents roots. Values: `claude-code`, `agents`, `devin`, `grok`, `both`. By default, `CLAUDE.md` targets imply `claude-code`, `AGENTS.md` targets imply `agents`, and both instruction files imply `both`. |
+| `--skills-agent <agent>` | Choose `.claude/skills`, `.agents/skills`, `.devin/skills`, `.grok/skills`, GitHub Copilot CLI's `.github/skills`, or both Claude/Agents roots. Values: `claude-code`, `agents`, `devin`, `grok`, `copilot-cli`, `both`. By default, `CLAUDE.md` targets imply `claude-code`, `AGENTS.md` targets imply `agents`, and both instruction files imply `both`. |
| `--skills-target-dir <dir>` | Write managed skill directories below an explicit root instead of inferring from scope and agent. |
| `--skills-force` | Replace unmanaged same-name skills during `install-instructions`; without it, they are left untouched and the command exits with an actionable error. |
@@ -2406,6 +2406,7 @@ ai-memory install-skills
ai-memory install-skills --scope global --agent agents
ai-memory install-skills --scope global --agent devin
ai-memory install-skills --scope global --agent grok
+ai-memory install-skills --scope global --agent copilot-cli
ai-memory install-skills --agent both --print
ai-memory install-skills --target-dir .custom/skills --force
```
@@ -2415,17 +2416,17 @@ ai-memory install-skills --target-dir .custom/skills --force
| Flag | Meaning |
|---|---|
| `--scope <scope>` | Install into this project or the current user's global skill roots. Values: `project`, `global`. Defaults to `project`. |
-| `--agent <agent>` | Install into Claude Code's skill root, the cross-agent skill root, Devin's skill root, Grok's skill root, or both Claude/Agents roots. Values: `claude-code`, `agents`, `devin`, `grok`, `both`. Defaults to `claude-code`. |
+| `--agent <agent>` | Install into Claude Code's skill root, the cross-agent skill root, Devin's skill root, Grok's skill root, GitHub Copilot CLI's skill root, or both Claude/Agents roots. Values: `claude-code`, `agents`, `devin`, `grok`, `copilot-cli`, `both`. Defaults to `claude-code`. |
| `--target-dir <dir>` | Write managed skill directories below an explicit root; `--scope` and `--agent` are ignored. |
| `--print` | Print target paths and `SKILL.md` contents without writing files. |
| `--force` | Replace unmanaged same-name skills; without it, user-authored same-name skills are preserved. |
Default skill target roots:
-| Scope | `--agent claude-code` | `--agent agents` | `--agent devin` | `--agent grok` |
-|---|---|---|---|---|
-| `project` | `.claude/skills` | `.agents/skills` | `.devin/skills` | `.grok/skills` |
-| `global` | `~/.claude/skills` | `~/.agents/skills` | Windows: `%APPDATA%\devin\skills`; non-Windows: `~/.devin/skills` | `$GROK_HOME/skills` (default `~/.grok/skills`) |
+| Scope | `--agent claude-code` | `--agent agents` | `--agent devin` | `--agent grok` | `--agent copilot-cli` |
+|---|---|---|---|---|---|
+| `project` | `.claude/skills` | `.agents/skills` | `.devin/skills` | `.grok/skills` | `.github/skills` |
+| `global` | `~/.claude/skills` | `~/.agents/skills` | Windows: `%APPDATA%\devin\skills`; non-Windows: `~/.devin/skills` | `$GROK_HOME/skills` (default `~/.grok/skills`) | `$COPILOT_HOME/skills` (default `~/.copilot/skills`) |
Each managed skill is written as `<root>/<skill-name>/SKILL.md`.
diff --git a/docs/mcp-install.md b/docs/mcp-install.md
index 82db8ff0..14515f04 100644
--- a/docs/mcp-install.md
+++ b/docs/mcp-install.md
@@ -1443,8 +1443,9 @@ managed routing package. The `memory_install_self_routing` tool is read-only:
it returns the slim markered instruction block, marker strings, agent filename
hints, managed skill payloads (`name`, `description`, `relative_path`,
`content`), and authoritative project/global target hints for `.claude/skills`,
-`.agents/skills`, `.grok/skills`, and `$GROK_HOME/skills` (default
-`~/.grok/skills`), plus overwrite guidance. Agents should use their own file
+`.agents/skills`, `.grok/skills`, `$GROK_HOME/skills` (default
+`~/.grok/skills`), GitHub Copilot CLI's `.github/skills` and
+`$COPILOT_HOME/skills` (default `~/.copilot/skills`), plus overwrite guidance. Agents should use their own file
editing tools to write those artifacts while preserving unrelated user content.
If the model doesn't see any of those tools, the MCP registration
diff --git a/docs/support-matrix.md b/docs/support-matrix.md
index b16390db..bfff0e56 100644
--- a/docs/support-matrix.md
+++ b/docs/support-matrix.md
@@ -34,7 +34,7 @@
| Kimi Code | Supported | MCP config (`url` entry in `~/.kimi-code/mcp.json`) + lifecycle hooks (`[[hooks]]` in `~/.kimi-code/config.toml`, 10 events including subagent start/stop and `PostToolUseFailure` for tool-failure capture); both paths honor `$KIMI_CODE_HOME`. Handoffs inject via `UserPromptSubmit` stdout (Kimi Code discards `SessionStart` hook stdout); `ai-memory run kimi` adds managed workstream resume. |
| Kiro CLI | Supported | MCP config uses `install-mcp --client kiro-cli` (alias `kiro`) and Kiro's Bedrock-compatible schema flavor. `install-hooks --agent kiro-cli` merges v2 hooks into existing agent configs; the explicit `--agent kiro-cli-v3` target writes the incompatible standalone v3 registration. Both preserve unrelated entries, honor `$KIRO_HOME`, enforce capture exclusions, and inject pending handoffs at session start. Kiro has no true SessionEnd hook; use `ai-memory finalize-session --agent kiro-cli`, with `--session-id <uuid>` for concurrent sessions, unless it is an interactive session launched with `ai-memory run kiro`, which finalizes it automatically when it exits if the run can tie the session to itself (see [`docs/managed-workstreams.md`](managed-workstreams.md)). `ai-memory run kiro` manages v2; add `--v3`, `--mode`, or `--agent-engine v3` for version-safe v3 resume. |
| Pool | Hooks-only | Poolside Agent CLI (`pool`). Lifecycle-hook capture via `install-hooks --agent pool` (alias `poolside`): Pool reads project-scoped hooks from the repo-root `.poolside/settings.yaml`, so ai-memory stages the scripts and prints a ready-to-paste `hooks:` snippet rather than writing committed project files; native commands enforce capture exclusions. Five Claude-shaped events (`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `Stop`) and no true session-end — `Stop` is a turn boundary, so run `ai-memory finalize-session --agent pool` after the final turn. `SessionStart` stdout injection is not demonstrated, so capture works but handoff injection does not — recover handoffs via MCP `memory_handoff_list` then `memory_handoff_accept` with that `handoff_id`. No first-party `install-mcp` client and no managed workstream (`ai-memory run pool`) are claimed: Pool's native session-store contract is not demonstrated (see [`docs/managed-harness-contributions.md`](managed-harness-contributions.md)). Verified against Poolside CLI v1.0.16. |
-| GitHub Copilot CLI | Supported | MCP config (`install-mcp --client copilot-cli` → `$COPILOT_HOME/mcp-config.json`, root `mcpServers`, `type: "http"`) + lifecycle hooks: `install-hooks --agent copilot-cli` writes `$COPILOT_HOME/hooks/ai-memory.json` (`COPILOT_HOME` defaults to `~/.copilot`). Configured with PascalCase event names, so Copilot sends the VS Code/Claude-compatible payload (`session_id`, `cwd`, `tool_name`, `tool_input`, `tool_result`) and native commands enforce capture exclusions; 10 events, Claude Code's nine plus `PostToolUseFailure`. Entries are flat with no `matcher`, because Copilot rejects it on `SessionStart`/`Stop`/`SessionEnd` and subagent events. The `SessionStart` hook delivers the prior session's handoff through Copilot's top-level `additionalContext`. `--scope project` is intentionally unsupported: Copilot's repository hook files (`.github/hooks/*.json`) are versioned and shared with the team and the cloud agent, so they cannot carry this machine's absolute executable and data-dir paths. `ai-memory run copilot` (alias `copilot-cli`) adds managed workstream resume: a generated `--session-id` for a fresh session, `--resume=<id>` to return, and visible-history import from `$COPILOT_HOME/session-state/<uuid>/events.jsonl` (see [`docs/managed-workstreams.md`](managed-workstreams.md)). The bare `--client copilot` alias of `install-mcp` keeps meaning VS Code Copilot. |
+| GitHub Copilot CLI | Supported | MCP config (`install-mcp --client copilot-cli` → `$COPILOT_HOME/mcp-config.json`, root `mcpServers`, `type: "http"`) + lifecycle hooks: `install-hooks --agent copilot-cli` writes `$COPILOT_HOME/hooks/ai-memory.json` (`COPILOT_HOME` defaults to `~/.copilot`). Configured with PascalCase event names, so Copilot sends the VS Code/Claude-compatible payload (`session_id`, `cwd`, `tool_name`, `tool_input`, `tool_result`) and native commands enforce capture exclusions; 10 events, Claude Code's nine plus `PostToolUseFailure`. Entries are flat with no `matcher`, because Copilot rejects it on `SessionStart`/`Stop`/`SessionEnd` and subagent events. The `SessionStart` hook delivers the prior session's handoff through Copilot's top-level `additionalContext`. Routing: Copilot CLI loads `AGENTS.md`, and `install-skills --agent copilot-cli` (or `install-instructions --skills-agent copilot-cli`) writes the managed Agent Skills to `.github/skills` (project) or `$COPILOT_HOME/skills` (global); `memory_install_self_routing` returns the same `copilot_cli` hints. `--scope project` is intentionally unsupported: Copilot's repository hook files (`.github/hooks/*.json`) are versioned and shared with the team and the cloud agent, so they cannot carry this machine's absolute executable and data-dir paths. `ai-memory run copilot` (alias `copilot-cli`) adds managed workstream resume: a generated `--session-id` for a fresh session, `--resume=<id>` to return, and visible-history import from `$COPILOT_HOME/session-state/<uuid>/events.jsonl` (see [`docs/managed-workstreams.md`](managed-workstreams.md)). The bare `--client copilot` alias of `install-mcp` keeps meaning VS Code Copilot. |
| VS Code Copilot | MCP-only | `.vscode/mcp.json` for Copilot agent mode; no lifecycle hooks (Copilot does not expose them yet). |
| Zed | MCP-only | Native remote MCP under `context_servers` in Zed's user `settings.json`; no lifecycle hooks or managed-workstream support. |
| Muse Code | MCP-only | `install-mcp --client muse` merges a native streamable-HTTP entry with bearer `headers` into the snake_case `mcp_servers` map of `~/.config/muse/settings.json`, preserving sibling servers. The writer adds the mandatory `"schema_version": 1` when absent (without it every `muse` command fails at startup) and never rewrites an existing value, and it sets `"mode": "optional"` because Muse's default `required` aborts the whole run when the server is unreachable. Skills need no extra step: Muse reads `~/.agents/skills`, which `install-skills` already writes. Lifecycle capture and managed workstreams are not claimed — Muse documents a hook surface, but the output contract of its `SessionStart` event is not specified. |
diff --git a/docs/usage.md b/docs/usage.md
index 0ca3cb28..aabbf07e 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -335,7 +335,10 @@ exists, both when both exist, or creates `CLAUDE.md` when neither exists. Use
instruction target unless you override it: `CLAUDE.md` implies
`.claude/skills`, `AGENTS.md` implies `.agents/skills`, and both files imply
both skill roots. For Grok Build CLI, select `--skills-agent grok` so skills
-install under its `.grok/skills` root; for Hermes Agent, `--skills-agent hermes`
+install under its `.grok/skills` root; for GitHub Copilot CLI, select
+`--skills-agent copilot-cli` so skills install under `.github/skills` (project)
+or `$COPILOT_HOME/skills` (global, default `~/.copilot/skills`); for Hermes
+Agent, `--skills-agent hermes`
installs under `.hermes/skills` (project) or `~/.hermes/skills` (global).
When a project keeps `AGENTS.md` as its canonical instruction file, give it a
@@ -354,6 +357,7 @@ ai-memory install-skills
ai-memory install-skills --scope global --agent agents
ai-memory install-skills --scope global --agent devin
ai-memory install-skills --scope global --agent grok
+ai-memory install-skills --scope global --agent copilot-cli
ai-memory install-skills --scope global --agent hermes
ai-memory install-skills --agent both --print
ai-memory install-skills --target-dir .custom/skills --force
@@ -363,13 +367,20 @@ For Devin, project-local skills are installed under `.devin/skills`. Global
Devin installs use `%APPDATA%\devin\skills` on Windows and `~/.devin/skills`
on non-Windows systems. For Grok Build CLI, project-local skills go under
`.grok/skills` and global under `$GROK_HOME/skills` (default
-`~/.grok/skills`).
+`~/.grok/skills`). For GitHub Copilot CLI, project-local skills go under the
+repository's `.github/skills` and global under `$COPILOT_HOME/skills` (default
+`~/.copilot/skills`); Copilot CLI already loads `AGENTS.md`, so it shares the
+`AGENTS.md` instruction target.
Project-local skill roots are `.claude/skills` for Claude-compatible installs,
`.agents/skills` for cross-client installs, `.devin/skills` for Devin, and
-`.grok/skills` for Grok. Global Claude/Agents roots are `~/.claude/skills` and
-`~/.agents/skills`; global Devin roots are platform-specific as described
-above; global Grok is `$GROK_HOME/skills` (default `~/.grok/skills`).
+`.grok/skills` for Grok, and `.github/skills` for GitHub Copilot CLI. Global
+Claude/Agents roots are `~/.claude/skills` and `~/.agents/skills`; global Devin
+roots are platform-specific as described above; global Grok is
+`$GROK_HOME/skills` (default `~/.grok/skills`); global Copilot CLI is
+`$COPILOT_HOME/skills` (default `~/.copilot/skills`). `uninstall` sweeps both
+Copilot CLI roots and removes only files carrying the ai-memory managed marker,
+so team-authored skills in `.github/skills` are never touched.
`--target-dir` points at an explicit skill root and bypasses scope/agent
inference. `--print` previews target paths and `SKILL.md` contents. `--force`
allows replacement of unmanaged same-name skills; without it, user-authored