From 89fce5222015ab9594b5f351b405bd158b7e7584 Mon Sep 17 00:00:00 2001 From: Morabbin Date: Wed, 24 Jun 2026 11:31:05 +0100 Subject: [PATCH 1/3] Document memory configuration in Java SDK README Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- java/README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/java/README.md b/java/README.md index 7c7209bc8e..9e46c74fe8 100644 --- a/java/README.md +++ b/java/README.md @@ -120,6 +120,36 @@ public class CopilotSDK { } ``` +## Memory + +Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `createSession` and `resumeSession`. + +```java +import com.github.copilot.rpc.MemoryConfiguration; +import com.github.copilot.rpc.ResumeSessionConfig; +import com.github.copilot.rpc.SessionConfig; + +// Enable memory for a new session +var session = client.createSession(new SessionConfig() + .setModel("gpt-5") + .setMemory(new MemoryConfiguration().setEnabled(true)) +).get(); + +// Disable memory for a new session +var sessionNoMemory = client.createSession(new SessionConfig() + .setModel("gpt-5") + .setMemory(new MemoryConfiguration().setEnabled(false)) +).get(); + +// Configure memory while resuming +var resumed = client.resumeSession(sessionId, new ResumeSessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setMemory(new MemoryConfiguration().setEnabled(true)) +).get(); +``` + +When `memory` is left unset, no memory configuration is sent and the runtime default applies. In the default `CopilotClientMode.COPILOT_CLI` the SDK leaves `memory` unset so the runtime applies its own default, while `CopilotClientMode.EMPTY` defaults `memory` to disabled unless you set it explicitly. + ## Try it with JBang You can run the SDK without setting up a full Java project, by using [JBang](https://www.jbang.dev/). @@ -274,4 +304,3 @@ mvn jacoco:prepare-agent@wire-up-coverage-instrumentation antrun:run@print-test- ## License MIT — see [LICENSE](LICENSE) for details. - From e8d1a5a22bf05b1474d58356993d6ff4a7563ca7 Mon Sep 17 00:00:00 2001 From: Morabbin Date: Wed, 24 Jun 2026 11:39:44 +0100 Subject: [PATCH 2/3] Fix Java memory README example handlers and import Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- java/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/README.md b/java/README.md index 9e46c74fe8..3bcf287b7a 100644 --- a/java/README.md +++ b/java/README.md @@ -126,17 +126,20 @@ Sessions can opt into persistent memory, allowing the agent to read and write me ```java import com.github.copilot.rpc.MemoryConfiguration; +import com.github.copilot.rpc.PermissionHandler; import com.github.copilot.rpc.ResumeSessionConfig; import com.github.copilot.rpc.SessionConfig; // Enable memory for a new session var session = client.createSession(new SessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) .setModel("gpt-5") .setMemory(new MemoryConfiguration().setEnabled(true)) ).get(); // Disable memory for a new session var sessionNoMemory = client.createSession(new SessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) .setModel("gpt-5") .setMemory(new MemoryConfiguration().setEnabled(false)) ).get(); From 190e1217b47c2a3191f150a731f0292903bf2908 Mon Sep 17 00:00:00 2001 From: Morabbin Date: Wed, 24 Jun 2026 12:41:47 +0100 Subject: [PATCH 3/3] Add Copilot Memory docs links across SDK READMEs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/README.md | 1 + go/README.md | 1 + java/README.md | 25 +++++++++++++------------ nodejs/README.md | 1 + python/README.md | 1 + rust/README.md | 1 + 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/dotnet/README.md b/dotnet/README.md index 567b1c33bb..f433959b74 100644 --- a/dotnet/README.md +++ b/dotnet/README.md @@ -419,6 +419,7 @@ When enabled, sessions emit compaction events: ## Memory Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `CreateSessionAsync` and `ResumeSessionAsync`. +For more background, see [About GitHub Copilot Memory](https://docs.github.com/en/copilot/concepts/agents/copilot-memory). ```csharp var session = await client.CreateSessionAsync(new SessionConfig diff --git a/go/README.md b/go/README.md index b89a763186..0dc69f99c1 100644 --- a/go/README.md +++ b/go/README.md @@ -511,6 +511,7 @@ information across turns. Provide a `MemoryConfiguration` on session create or r when omitted, the runtime default applies. In the default `ModeCopilotCli` client mode the SDK leaves `Memory` unset so the runtime applies its own default, while `ModeEmpty` defaults `Memory` to disabled unless you set it explicitly. +For more background, see [About GitHub Copilot Memory](https://docs.github.com/en/copilot/concepts/agents/copilot-memory). ```go // Enable memory for a session diff --git a/java/README.md b/java/README.md index 3bcf287b7a..27ec052e78 100644 --- a/java/README.md +++ b/java/README.md @@ -120,9 +120,22 @@ public class CopilotSDK { } ``` +## Try it with JBang + +You can run the SDK without setting up a full Java project, by using [JBang](https://www.jbang.dev/). + +See the full source of [`jbang-example.java`](jbang-example.java) for a complete example with more features like session idle handling and usage info events. + +Or run it directly from the repository: + +```bash +jbang https://github.com/github/copilot-sdk/blob/main/java/jbang-example.java +``` + ## Memory Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `createSession` and `resumeSession`. +For more background, see [About GitHub Copilot Memory](https://docs.github.com/en/copilot/concepts/agents/copilot-memory). ```java import com.github.copilot.rpc.MemoryConfiguration; @@ -153,18 +166,6 @@ var resumed = client.resumeSession(sessionId, new ResumeSessionConfig() When `memory` is left unset, no memory configuration is sent and the runtime default applies. In the default `CopilotClientMode.COPILOT_CLI` the SDK leaves `memory` unset so the runtime applies its own default, while `CopilotClientMode.EMPTY` defaults `memory` to disabled unless you set it explicitly. -## Try it with JBang - -You can run the SDK without setting up a full Java project, by using [JBang](https://www.jbang.dev/). - -See the full source of [`jbang-example.java`](jbang-example.java) for a complete example with more features like session idle handling and usage info events. - -Or run it directly from the repository: - -```bash -jbang https://github.com/github/copilot-sdk/blob/main/java/jbang-example.java -``` - ## Using experimental APIs Some SDK APIs are marked as experimental with `@CopilotExperimental`. These APIs may change or be removed in future versions without notice. diff --git a/nodejs/README.md b/nodejs/README.md index bc91cd793b..7d9a3eee9f 100644 --- a/nodejs/README.md +++ b/nodejs/README.md @@ -684,6 +684,7 @@ information across turns. Provide a `memory` configuration on session create or when omitted, the runtime default applies. In the default `"copilot-cli"` client mode the SDK leaves `memory` unset so the runtime applies its own default, while `"empty"` mode defaults `memory` to disabled unless you set it explicitly. +For more background, see [About GitHub Copilot Memory](https://docs.github.com/en/copilot/concepts/agents/copilot-memory). ```typescript // Enable memory for a session diff --git a/python/README.md b/python/README.md index fd7b9389aa..e802457bc1 100644 --- a/python/README.md +++ b/python/README.md @@ -505,6 +505,7 @@ When enabled, sessions emit compaction events: ## Memory Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `create_session` and `resume_session`. +For more background, see [About GitHub Copilot Memory](https://docs.github.com/en/copilot/concepts/agents/copilot-memory). ```python async with await client.create_session( diff --git a/rust/README.md b/rust/README.md index 9bf1fddd90..6d92224088 100644 --- a/rust/README.md +++ b/rust/README.md @@ -574,6 +574,7 @@ The CLI emits `session.compaction_start` / `session.compaction_complete` events ### Memory Configure the runtime memory feature for a session: +For more background, see [About GitHub Copilot Memory](https://docs.github.com/en/copilot/concepts/agents/copilot-memory). ```rust,ignore use github_copilot_sdk::types::{MemoryConfiguration, SessionConfig};