Maintain agent memory and state across tools and environments
Unlock the complete study guide.
Bundled into the existing Developing in Agentic AI Systems premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- State, memory, and the boundaries that destroy them
- Passing files between jobs and runs with workflow artifacts
- How long saved state actually survives
- Reading versus deleting an artifact: two different access levels
- Copilot Memory: what is stored, what is re-checked, and who owns it
- Carrying work across sessions, editors, and environments
- Instructions and shared guidance as durable context
- Batching pull request feedback for Copilot cloud agent
- Reading an exam scenario: cues, boundaries, and the tempting wrong answer
What each continuity carrier actually moves, and what ends it
| Carrier | Boundary it crosses | What it carries | What ends or blocks it |
|---|---|---|---|
| Workflow artifact (upload/download-artifact) | Job to job in a run; run to later inspection | Selected files: plans, traces, progress records | Retention expiry, manual deletion by a write-access user, or deleting the workflow run |
| Committed state folder (.github/upgrades/{scenarioId}) | Session to session and environment to environment, as a task-state record | Upgrade stage records and live task progress | Copying only the code changes and leaving that state folder uncommitted |
| Exported session (VS Code Export Chat JSON, CLI /share file) | Person to person and tool to tool | Prompts and responses as a portable saved record; it applies no changes and is not a resumable session | Depends on preserving the exported file |
| Session sync and session history | Device to device for one signed-in user | Local Copilot session history | chat.sessionSync.enabled set to false, an excludeRepositories match, or a policy that disables session sync |
| Native handoff to another Session Target | Session Target to Session Target, such as Copilot to Cloud with Copilot cloud agent | Conversation history and context, but not the previous target's tools, permissions, and models | Requires another supported Session Target; opening the same session in the Agents window instead of the Chat view changes only where you view it, not the target |
| External-session discovery in VS Code | Copilot CLI to VS Code for supported local sessions | A local session, opened for continuation | Hidden until the External filter is applied; discovery covers Copilot sessions associated with a repository and updated within the last seven days |
| Session sharing on GitHub.com | One user's synced session to people with access to the repository | A view of prompts, responses, and file changes | Private unless explicitly shared; sharing grants viewing, not steering or modifying |
| Copilot Memory (repository facts, user preferences) | Feature to feature within a repository or user scope | Facts validated against code, and stated preferences | Repository facts: citations the current branch no longer substantiates. User preferences (Business and Enterprise plans): a different active billing entity. Both: automatic deletion when unused (retention is covered in Implement agent memory strategies) |
| Instruction files (AGENTS.md, *.instructions.md) | Every future session in the repository | Durable project conventions and path-scoped rules | Going stale, or contradicting another instruction file with no guaranteed load order |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
References
- Store and share data from a workflow
- Copilot Memory
- Customize AI responses with custom instructions
- Context engineering guide
- Download workflow artifacts
- REST API endpoints for GitHub Actions artifacts
- Remove workflow artifacts
- Manage Copilot Memory as an administrator
- Manage agent sessions
- Copilot CLI command reference
- Session history
- GitHub Copilot upgrade overview
- Get the best results from Copilot cloud agent
- Add repository custom instructions for GitHub Copilot
- Add custom instructions to Copilot CLI