github / github/copilot-cli

Feature Request: Local auto-memory (agent-initiated, no remote storage)

未关闭
#2,930 2 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
area:context-memory
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

## Problem

Organizations with security concerns about remote data storage disable [Copilot Memory](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/copilot-memory) (which is off by default for enterprise/org-managed subscriptions). This leaves Copilot CLI with **no way to accumulate knowledge across sessions** — every session starts from scratch unless the user manually maintains instruction files.

Existing feature requests (#446, #667, #1912) focus on session persistence or user-driven memory. This request is specifically about **agent-initiated, local-only memory** — where the agent autonomously decides what is worth remembering and writes it to local files, similar to how [Claude Code auto memory](https://code.claude.com/docs/en/memory) works.

## Proposed Feature

A local auto-memory system where Copilot CLI:

1. **Autonomously writes learnings** during sessions — build commands discovered, conventions learned, user corrections, debugging insights, architecture notes
2. **Stores memory locally** in a per-project directory (e.g., `~/.copilot/projects//memory/`), not on GitHub servers
3. **Auto-loads memory** into future sessions so accumulated knowledge persists
4. **Uses plain markdown files** that users can audit, edit, or delete at any time

### How Claude Code does this (reference implementation)

Claude Code's auto memory is a good reference for what this could look like:

- **Storage**: `~/.claude/projects//memory/` — one directory per git repo
- **Structure**: A `MEMORY.md` index file + topic files (`debugging.md`, `api-conventions.md`, etc.)
- **Loading**: First 200 lines / 25KB of `MEMORY.md` loaded at session start; topic files read on demand
- **Agent-initiated**: The agent decides what to save based on whether the information would be useful in a future conversation — no explicit "remember this" needed
- **Editable**: Users can view, edit, or delete any memory file. Claude Code provides a `/memory` command to browse them.

### Key design principles

- **Local-only**: No data leaves the machine. This addresses the security concerns that cause organizations to disable remote Copilot Memory.
- **Per-project scoping**: Memories are tied to a git repository, so different projects don't pollute each other.
- **Agent-initiated**: The agent writes notes for itself without the user having to explicitly say "remember this." When the user corrects the agent or the agent discovers something useful (e.g., "this project uses pnpm, not npm"), it saves that automatically.
- **Complementary to custom instructions**: CLAUDE.md / `.github/copilot-instructions.md` are what the *user* writes for the agent. Auto memory is what the *agent* writes for itself.
- **Transparent**: Plain markdown, easily auditable, with a command to browse/edit (e.g., `/memory`).

## Why this matters

- **Organizations that disable remote Copilot Memory** have no alternative today. Custom instructions are manual and user-maintained — they don't capture what the agent learns during work.
- **Reduces repetitive corrections**: If a user corrects the agent ("use pnpm, not npm"), the agent should remember that for next time without the user having to add it to an instructions file.
- **Improves over time**: The agent gets better at working in a specific codebase as it accumulates project-specific knowledge.
- **No security trade-off**: All data stays on the local machine. Organizations don't have to choose between memory and data security.

## Relationship to existing features

| Feature | Who writes | Storage | Auto-initiated |
|---|---|---|---|
| `.github/copilot-instructions.md` | User | Repo (committed) | No |
| Copilot Memory (remote) | Agent | GitHub servers | Yes |
| **This proposal (local auto-memory)** | **Agent** | **Local filesystem** | **Yes** |

This feature would fill the gap for users/orgs that want agent-initiated memory but cannot or choose not to use remote storage.

贡献指南

打开贡献指南

调研方向

尚未确定任何实现文件或测试。首先检查现有的 Copilot Memory 行为以及相关请求 #446、#667 和 #1912,然后将提议的 ~/.copilot/projects//memory/ 布局与 MEMORY.md 和 .github/copilot-instructions.md 进行比较。完成的标准是:为本地、按项目划分、由 agent 发起的记忆确定一致认可的设计并完成实现,同时采用透明的 Markdown 存储和会话加载。

由索引模型根据 Issue 内容生成。

评估

领域
ai, cli
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。