Agentic Memory: How GitHub Copilot Agents Now Share What They Learn

GitHub Copilot is evolving from a single assistant into an ecosystem of agents that handle coding, code review, security, debugging, and deployment. The critical enabler for this multi-agent future is persistent, shared memory. Without it, every agent session starts from scratch, wasting the context gained from previous interactions across your development workflow.

Cross-agent memory lets GitHub Copilot recall and apply lessons learned from one task to another, automatically, without requiring explicit user instructions. If the Copilot coding agent discovers how a repository handles database connections while fixing a vulnerability, Copilot code review can later use that knowledge to flag inconsistent patterns in new pull requests. Similarly, if code review notes that certain files must change together, the coding agent will proactively keep them synchronized when generating new code.

The real problem: Memory validity, not retrieval

The hard part of building this system wasn't fetching information—it was ensuring that stored knowledge stays true as code evolves across branches and time. A logging convention observed in one branch might be superseded, changed, or never merged at all. Agents need to act only on information that is valid for the current task and code state.

A traditional offline curation service—deduplicating facts, resolving conflicts, tracking branch status, expiring stale data—would have worked, but at GitHub's scale it introduces significant engineering complexity and LLM costs, and still requires reconciliation at read time. The team instead pursued a simpler, more efficient model built on real-time verification.

Just-in-time verification with citations

The design insight is that information retrieval is asymmetric: it's hard to solve, but easy to verify. Rather than curating memories offline, GitHub stores each memory with citations: precise references to code locations supporting the fact. When an agent encounters a stored memory during a session, it checks those citations in real time to confirm the information is still accurate and relevant to the current branch. This verification involves only a handful of straightforward read operations and adds no noticeable latency in testing.

Memory creation as a tool call

Agents create memories through a dedicated tool, invoked when they observe something with actionable implications for future tasks.

A flow chart showing how Copilot agents store learnings worth remembering as they carry out their tasks.
How Copilot agents store learnings worth remembering as they carry out their tasks.

Consider Copilot code review spotting a rule during a pull request: API version tracking must stay in sync across three files—src/client/sdk/constants.ts, server/routes/api.go, and docs/api-reference.md:

export const API_VERSION = "v2.1.4";
const APIVersion = "v2.1.4"
Version: v2.1.4

The review agent then calls the memory storage tool to record the invariant:

{
  subject: "API version synchronization", 
  fact: "API version must match between client SDK, server routes, and documentation.",
  citations: ["src/client/sdk/constants.ts:12", "server/routes/api.go:8", "docs/api-reference.md:37"], 
  reason: "If the API version is not kept properly synchronized, the integration can fail or exhibit subtle bugs. Remembering these locations will help ensure they are kept syncronized in future updates."
}

The payoff comes later. When any agent updates the API version in one of those locations, it sees the memory and knows to update the other two, preventing versioning mismatches that break integrations. And when a less experienced developer submits a pull request touching only one file, Copilot code review flags the gap and suggests the missing edits—silently transferring knowledge from a senior engineer to a new contributor.

Retrieval, verification, and scoping

When an agent starts a new session for a repository, it receives the most recent memories for that repository as part of its prompt. Future releases will add a search tool and weighted prioritization.

How Copilot enriches agent prompts with memories from previous tasks.

Before applying any memory, the agent is prompted to verify its accuracy by checking the cited code. If the current code contradicts the memory or citations point to nonexistent locations, the agent is encouraged to store a corrected version. When the citations hold and the memory proves useful, the agent re-stores it to refresh its timestamp.

Memories are tightly scoped for privacy. They can only be created in response to actions in a repository by users with write access, and can only be used in tasks on that same repository by users with read access. Like the source code itself, memories do not leave the repository they describe.

Agents learning from each other

The system's full value appears when Copilot agents share knowledge across their respective workflows:

  1. Copilot code review discovers a logging convention during a PR: log files named app-YYYYMMDD.log, using Winston with format: timestamp, error code, user ID.
  2. Copilot coding agent, later implementing a new microservice, sees and verifies the memory and automatically applies the same logging format.
  3. Copilot CLI, during a debugging session, retrieves the correct log file and locates relevant timestamps using the format learned by the code review agent.

Each agent contributes to and consumes the same evolving repository knowledge, reducing context re-establishment across every agentic workflow.

Testing the system

GitHub's biggest risk was that outdated, incorrect, or maliciously injected memories would degrade agent performance. To stress-test resilience, they deliberately seeded repositories with adversarial memories—facts contradicting the codebase, with citations pointing to irrelevant or nonexistent code. Across all test cases, agents consistently verified citations, discovered contradictions, and stored corrected versions. The memory pool self-healed, and the citation mechanism prevented misleading memories from taking hold.

In a more realistic simulation, the team ran agents on historical tasks to organically populate the memory database, deliberately overrepresenting memories from abandoned or unmerged branches. Running Copilot code review on the evaluation pull requests, memory usage delivered a 3% increase in precision and a 4% increase in recall.

Real developer impact

The ultimate validation came from A/B tests on the first two agents to ship with memory:

  • Copilot coding agent: pull request merge rate rose 7% (90% with memories vs. 83% without), meaning developers get desired results more often.
  • Copilot code review: positive feedback on comments rose 2% (77% with memories vs. 75% without), indicating improved automated review quality.
  • Both increases were highly statistically significant (p-value <0.00001).

Repository-scoped memory is now available on an opt-in basis in Copilot CLI, Copilot coding agent, and Copilot code review. GitHub is iterating on memory generation, curation, and prioritization as it prepares a wider rollout. By allowing validated information to persist across agentic workflows, cross-agent memory lets each interaction with Copilot make the next one more effective.