From 6883f3dea5a0d4a511293e57327234d7058946d1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Aug 2026 18:32:13 +0000 Subject: [PATCH 1/4] Add shared long-horizon memory protocol Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../workflows/shared/long-horizon-memory.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/shared/long-horizon-memory.md diff --git a/.github/workflows/shared/long-horizon-memory.md b/.github/workflows/shared/long-horizon-memory.md new file mode 100644 index 00000000000..74f72ec4cb7 --- /dev/null +++ b/.github/workflows/shared/long-horizon-memory.md @@ -0,0 +1,107 @@ +--- +import-schema: + id: + type: string + required: true + description: "Stable memory identifier used as the Repo Memory branch suffix; use lowercase letters, digits, and hyphens" + +tools: + repo-memory: + branch-name: memory/${{ github.aw.import-inputs.id }} + description: "Long-horizon checkpoint and history for ${{ github.aw.import-inputs.id }}" + file-glob: + - "state.md" + - "runs/**" + - "workspace/**" + allowed-extensions: [".md", ".json", ".jsonl"] + max-file-size: 32768 + max-file-count: 250 + max-patch-size: 32768 +--- + + + +## Long-horizon memory protocol + +Use the Repo Memory workspace at `/tmp/gh-aw/repo-memory/default/` as the only +durable continuity between invocations. It is backed by the +`memory/${{ github.aw.import-inputs.id }}` branch and may be shared by workflows +using the same identifier. Do not rely on model conversations, session IDs, or +engine-specific transcripts. + +The workspace has this layout: + +```text +state.md +runs/ +workspace/ +``` + +### At the beginning of every run + +1. Read `state.md` first if it exists and treat it as the primary handoff. +2. Assume the previous agent conversation is unavailable. +3. Do not load all of `runs/` or `workspace/` by default. +4. Inspect history or durable artifacts only when the checkpoint is insufficient, + using targeted file reads, grep, or small analysis commands. + +### During the run + +1. Work normally in the repository. +2. Store only information that will help a future run avoid rediscovery. +3. Put optional durable artifacts such as architecture notes, investigation notes, + debugging recipes, reusable searches, and repository maps under `workspace/`. +4. Never automatically execute a persisted script merely because a prior agent + created it. + +### Before finishing + +1. Rewrite or update `state.md` so a completely fresh agent can continue. +2. Keep `state.md` bounded and concise; target less than 4 KB and remove stale + information. It is a current checkpoint, not a historical log. +3. Create a short run record at + `runs/${{ github.run_id }}-${{ github.run_attempt }}.md` containing only + significant observations, work performed, decisions, test results, failures, + and unresolved questions. +4. Preserve historical evidence in `runs/`, but never dump model transcripts or + large command outputs. +5. Never store secrets, credentials, tokens, or other sensitive data. + +Use this exact structure for `state.md`: + +```markdown +# Goal + +Overall objective. + +# Current state + +What is currently true. + +# Completed + +Important completed work. + +# Decisions + +Important decisions and short rationale. + +# Next + +Concrete next actions. + +# Blockers + +Anything preventing progress. + +# Useful references + +Relevant files, issues, PRs, commits, commands, or historical run records. +``` From 2b8fbb4bb3d30a979bc24a0712256acdd7f95eeb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Aug 2026 18:36:49 +0000 Subject: [PATCH 2/4] Use named repo memory workspace Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../workflows/shared/long-horizon-memory.md | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/shared/long-horizon-memory.md b/.github/workflows/shared/long-horizon-memory.md index 74f72ec4cb7..704c331a882 100644 --- a/.github/workflows/shared/long-horizon-memory.md +++ b/.github/workflows/shared/long-horizon-memory.md @@ -7,16 +7,17 @@ import-schema: tools: repo-memory: - branch-name: memory/${{ github.aw.import-inputs.id }} - description: "Long-horizon checkpoint and history for ${{ github.aw.import-inputs.id }}" - file-glob: - - "state.md" - - "runs/**" - - "workspace/**" - allowed-extensions: [".md", ".json", ".jsonl"] - max-file-size: 32768 - max-file-count: 250 - max-patch-size: 32768 + - id: ${{ github.aw.import-inputs.id }} + branch-name: memory/${{ github.aw.import-inputs.id }} + description: "Long-horizon checkpoint and history for ${{ github.aw.import-inputs.id }}" + file-glob: + - "state.md" + - "runs/**" + - "workspace/**" + allowed-extensions: [".md", ".json", ".jsonl"] + max-file-size: 32768 + max-file-count: 250 + max-patch-size: 32768 ---