Skip to content

GitHub Copilot Memory facts are not injected into the system message on session.create (only on session.resume) #1562

Description

@kashish2508

Package: @github/copilot-sdk

Summary
Memory facts stored for a repo are embedded inline into the first turn's
system message when a session is started via client.resumeSession(), but
NOT when started via client.createSession(). There is no public SDK API
to query stored memory facts or to opt memory injection into a new session.

Repro

  1. Repo with stored Copilot Memory facts (e.g. 20 facts).
  2. Start a fresh session with client.createSession(config).
  3. Send any user prompt.
  4. Inspect the system.message event content — facts are absent.
  5. In a separate run, start with client.resumeSession(existingId, config)
    on a different existing session for the same repo.
  6. The system.message content now includes a memory block (~13KB delta
    in our case: 35,090 chars vs 48,213 chars).

Expected
One of:
(a) Memory facts injected on createSession too.
(b) An explicit config flag (e.g. eagerMemoryLoad: true) to opt in.
(c) Public docs describing exactly when memory injection happens so
consumers can build supported workarounds.

Current workaround
createSession → wait for session.tools_updated → disconnect →
resumeSession on the same ID. Works but adds an extra RPC round-trip
and depends on the resume side-effect behavior continuing as-is.

Why this matters
Users with --new-session semantics still expect their stored memory
facts to be available on turn 1. Otherwise memory is unusable in
short-lived CLI/CI runs.

Activity

  1. github-actions commented on Jun 3, 2026

    @github-actions
    Contributor

    Investigation Findings

    Thanks for the detailed report. I investigated the relevant SDK code paths and the JSON-RPC layer.

    What I looked at

    • nodejs/src/client.ts — createSession() (line 1018) and resumeSession() (line 1225) implementations
    • nodejs/src/types.ts — SessionConfig type, including skipEmbeddingRetrieval and embeddingCacheStorage
    • nodejs/src/generated/rpc.ts — wire-level parameter types for session.create and session.resume

    What I found

    The SDK faithfully proxies both calls to the Copilot CLI via JSON-RPC (session.create and session.resume respectively). The decision of when to inject memory facts into the system message is entirely CLI-side behavior.

    Key observations:

    1. session.create accepts a skipEmbeddingRetrieval parameter (exposed in the SDK as config.skipEmbeddingRetrieval), confirming the CLI can load memory/embeddings on fresh sessions — but this controls embedding retrieval, not long-term memory fact injection.
    2. There is no SDK-level flag to request eager memory loading on session.create.
    3. The fact that session.resume triggers memory injection while session.create does not is an asymmetry that appears unintentional — the CLI is presumably loading persisted session context (including memory facts) as part of the resume path, but not seeding them on fresh sessions.
    4. The workaround you described (create → wait for session.tools_updated → disconnect → resume same ID) proves the CLI has the capability; it's just not triggered for fresh sessions.

    Verdict: Bug

    Memory facts should be available on turn 1 of a fresh session for any repo that has stored facts — the current behavior makes long-term memory unusable in short-lived CLI/CI workflows. The discrepancy between createSession and resumeSession appears to be an unintentional gap in the CLI's memory-loading logic, not a deliberate design choice. Labeled accordingly.

    A proper fix would be for the CLI to apply the same memory injection logic to session.create as it does to session.resume. An optional SDK-level config flag (e.g. eagerMemoryLoad: true) could serve as an interim API while the fix is implemented.

    Generated by Bug Handler for issue #1562 · ● 3.5M · ◷

  2. fzamel3333-ai commented on Jun 6, 2026

    @fzamel3333-ai
  3. patniko commented on Jun 9, 2026

    @patniko
    Contributor

    We don't have formal support for memory in the SDK, but some work is being done on this front. Relabeled as an enhancement while we look at getting it out.

  4. patniko commented on Sep 8, 2026

    @patniko
    Contributor

    Closing as fixed after verification against the current public SDK sources and bundled behavior.

    Public evidence

    The reported behavior/request is implemented at the current SDK baseline, so this issue is being closed as completed.

    Public SDK baseline: github/copilot-sdk d5c9d06d8c41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions