diff --git a/01-setup-and-first-steps/README.md b/01-setup-and-first-steps/README.md index 59af743b..41553300 100644 --- a/01-setup-and-first-steps/README.md +++ b/01-setup-and-first-steps/README.md @@ -436,14 +436,15 @@ That's it for getting started! As you become comfortable, you can explore additi | Command | What It Does | |---------|--------------| | `/clear` | Abandons the current session (no history saved) and starts a fresh conversation | -| `/compact` | Summarize conversation to reduce context usage | +| `/compact` | Summarize conversation to reduce context usage (optionally add focus instructions, e.g. `/compact focus on the bug list`) | | `/context` | Show context window token usage and visualization | | `/keep-alive` | Prevent your system from sleeping while Copilot CLI is active — handy for long-running tasks on a laptop | +| `/memory [on\|off\|show]` | Enable, disable, or view persistent memory — facts and preferences remembered across all sessions | | `/new` | Ends the current session (saving it to history for search/resume) and starts a fresh conversation. | | `/resume` | Switch to a different session (optionally specify session ID or name) | | `/rename` | Rename the current session (omit the name to auto-generate one) | | `/rewind` | Open a timeline picker to roll back to any earlier point in the conversation | -| `/usage` | Display session usage metrics and statistics | +| `/usage` | Display session usage metrics and statistics, including quota progress bars | | `/session` | Show session info and workspace summary; use `/session delete`, `/session delete `, or `/session delete-all` to remove sessions | | `/share` | Export session as a markdown file, GitHub gist, or self-contained HTML file | diff --git a/02-context-conversations/README.md b/02-context-conversations/README.md index b9710f22..2c2c5153 100644 --- a/02-context-conversations/README.md +++ b/02-context-conversations/README.md @@ -351,6 +351,29 @@ copilot > /session delete-all # Deletes all sessions (use with care!) ``` +### Persistent Memory Across Sessions + +Sessions save your conversation history, but **memory** goes one step further and lets Copilot CLI remember preferences and facts *across all sessions*, not just within a single one. + +```bash +copilot + +> /memory show +# Shows what Copilot CLI currently remembers about you and your project + +> /memory on +# Enables memory (on by default if your account supports it) + +> /memory off +# Disables memory (useful if you prefer a fresh slate each time) +``` + +For example, if you tell Copilot CLI "I always prefer pytest for Python testing", it can remember that preference and apply it automatically in future sessions. All without you having to repeat it. + +> 💡 **Memory vs. Sessions**: Sessions save the *conversation history* so you can resume a specific task. Memory saves *preferences and context* that apply across all your work. Think of sessions as project notebooks and memory as your personal notepad. + +> 🔒 **Privacy note**: Memory is scoped either to your user account (visible to you across all repos) or to a specific repository (shared with collaborators). The CLI tells you which scope applies whenever it stores something. + ### Check and Manage Context As you add files and conversation, Copilot CLI's [context window](../GLOSSARY.md#context-window) fills up. Several commands are available to help you stay in control: @@ -588,6 +611,17 @@ copilot # Your key findings and decisions are preserved ``` +You can also give `/compact` optional focus instructions to shape what gets prioritized in the summary: + +```bash +copilot + +> /compact focus on the list of bugs we found and decisions made +# Summarizes history, keeping bug list and decisions prominent +``` + +> 💡 **When to use focus instructions**: If your conversation covered many topics, focus instructions help `/compact` retain the parts most relevant to your next steps so you don't lose the thread. + #### Context Efficiency Tips | Situation | Action | Why | @@ -881,9 +915,10 @@ copilot --add-dir /path/to/directory 1. **`@` syntax** gives Copilot CLI context about files, directories, and images 2. **Multi-turn conversations** build on each other as context accumulates 3. **Sessions auto-save**: name them at startup with `--name`, resume by name with `--resume=`, or use `--continue` to pick up the most recent session -4. **Context windows** have limits: manage them with `/clear`, `/compact`, `/context`, `/new`, and `/rewind` -5. **Permission flags** (`--add-dir`, `--allow-all`) control multi-directory access. Use them wisely! -6. **Image references** (`@screenshot.png`) help debug UI issues visually +4. **Context windows** have limits: manage them with `/clear`, `/compact`, `/context`, `/new`, and `/rewind`. Use `/compact focus on ` to shape what gets kept in the summary +5. **Persistent memory** (`/memory`) lets Copilot CLI remember preferences and facts across *all* sessions — not just the current one +6. **Permission flags** (`--add-dir`, `--allow-all`) control multi-directory access. Use them wisely! +7. **Image references** (`@screenshot.png`) help debug UI issues visually > 📚 **Official Documentation**: [Use Copilot CLI](https://docs.github.com/copilot/how-tos/copilot-cli/use-copilot-cli) for the complete reference on context, sessions, and working with files. diff --git a/GLOSSARY.md b/GLOSSARY.md index e1da765c..72fff8bb 100644 --- a/GLOSSARY.md +++ b/GLOSSARY.md @@ -76,6 +76,12 @@ Model Context Protocol. A standard for connecting AI assistants to external data --- +### Memory (Copilot CLI) + +A feature that lets Copilot CLI remember facts and preferences *across all sessions*, not just within a single one. Unlike session history (which saves a specific conversation), memory persists globally and is applied automatically in future sessions. Managed with the `/memory` slash command (`/memory on`, `/memory off`, `/memory show`). Memory can be scoped to your user account (visible across all repositories) or to a specific repository (shared with collaborators). + +--- + ## N ### npx