Skip to content

cache-memory#812

Merged
pelikhan merged 24 commits intomainfrom
copilot/fix-18c775ac-bd7d-4ce4-8c4f-9c661213375a
Sep 14, 2025
Merged

cache-memory#812
pelikhan merged 24 commits intomainfrom
copilot/fix-18c775ac-bd7d-4ce4-8c4f-9c661213375a

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 13, 2025

Mounting a durable memory on top of github actions cached.

  • Analyzed current cache implementation - Found actions/cache@v5 usage in pkg/workflow/cache.go
  • Identified files needing updates - Need to update generateCacheSteps and generateCacheMemorySteps functions
  • Located test expectations - Need to update compiler_test.go expectations for v4
  • Update cache.go to use v4 - Changed both generateCacheSteps and generateCacheMemorySteps functions
  • Update test expectations - Updated compiler_test.go to expect v4 instead of v5
  • Recompile workflows - Ran make recompile to update all lock files
  • Validate changes - All tests pass and workflows compile correctly
  • Reply to comment - Confirmed fix implementation
  • Merge origin/main - Successfully merged latest changes from main branch
  • Add cache-memory to test-poem - Added cache-memory tool configuration to test-poem.md
  • Update test-poem to use Claude - Changed from custom engine to claude with max-turns 5
  • Add comprehensive cache-memory documentation - Created docs/src/content/docs/reference/cache-memory.md
  • Move cache-memory to tools section - Restructured as built-in tool under tools.cache-memory
  • Add retention-days option - Enables upload-artifact for extended memory persistence
  • Update cache actions to v4 - Updated all cache actions per GitHub recommendation
  • Update cache-memory to use npx - Changed from Docker to npx @modelcontextprotocol/server-memory for improved compatibility
  • Update documentation - Updated cache-memory docs to reflect npx usage and deprecate Docker options
  • Recompile all workflows - All workflows now use npx-based cache-memory configuration
  • Add cache-memory to dev workflow - Added cache-memory tool to dev agentic workflow for persistent memory capabilities

Major Changes

npx MCP Configuration

Switched cache-memory from Docker-based setup to npx for improved compatibility:

  • Command: Now uses npx @modelcontextprotocol/server-memory instead of Docker containers
  • Simplified Setup: No Docker dependency required, works with Node.js/npm available in GitHub runners
  • Faster Startup: No container overhead or image pulling delays
  • Universal Compatibility: Works consistently across all GitHub-hosted runner environments

Tools Section Integration

Moved cache-memory under the tools section as a built-in tool:

tools:
  cache-memory: true  # Simple enable
  # or
  cache-memory:
    key: custom-memory-key
    retention-days: 30

Enhanced Documentation

Added comprehensive documentation at docs/src/content/docs/reference/cache-memory.md covering:

  • Complete usage guide with examples
  • GitHub Actions cache integration details
  • Progressive restore key generation strategy
  • npx setup benefits and compatibility
  • Best practices and troubleshooting

Dev Workflow Enhancement

The dev agentic workflow now includes cache-memory functionality:

  • Persistent Memory: Memory persists across workflow runs using GitHub Actions cache
  • npx Integration: Uses the new npx-based MCP server configuration
  • Claude AI: Works seamlessly with Claude engine and max-turns configuration
  • Progressive Cache Keys: Automatic restore key generation for optimal cache usage

Backward Compatibility

  • Deprecated Docker Options: docker-image field is now ignored but maintained for backward compatibility
  • Cache Key Migration: Existing cache keys continue to work with automatic -${{ github.run_id }} appending
  • Progressive Restore Keys: Automatic generation from cache key splitting on dashes

The implementation provides a more reliable and performant memory persistence solution for agentic workflows while maintaining full backward compatibility with existing configurations.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a top-level frontmatter configuration field "cache-memory" that enables mounting a memory mcp on a folder that will get cached using actions/cache. - top level "cache-memory" field in front matter - use https://www.npmjs.com/package/@modelcontex... Add cache-memory frontmatter field for persistent memory MCP server Sep 13, 2025
Copilot AI requested a review from pelikhan September 13, 2025 15:05
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot

  • default memory should be memory-${{ workflow id }}-${{ run id }}
  • automatically generate recover keys from key, split by -
  • remove restore key option in front matter

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot if the key does not end with -${{ run id }} append it automatically, to simulate the caching behavior.

…ate restore keys

- Change default cache key from memory-mcp-${run_id} to memory-${workflow}-${run_id}
- Automatically generate restore keys by splitting cache key on '-'
- Remove restore-keys option from frontmatter schema
- Update documentation to reflect new behavior

Addresses comment feedback in PR review.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 13, 2025

@copilot

  • default memory should be memory-${{ workflow id }}-${{ run id }}
  • automatically generate recover keys from key, split by -...

Updated the cache-memory implementation per your feedback:

  1. Default key changed to memory-${{ github.workflow }}-${{ github.run_id }}
  2. Automatic restore key generation - restore keys are now auto-generated by progressively splitting the cache key on '-'
  3. Removed restore-keys option from frontmatter schema

For example, a key like custom-memory-project-v1-${{ github.run_id }} automatically generates:

  • custom-memory-project-v1-
  • custom-memory-project-
  • custom-memory-
  • custom-

Changes implemented in commit dd6b3f7.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build662488583/b278/cli.test -test.testlogfile=/tmp/go-build662488583/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot add cache memory to ci doctor agentic workflow

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 13, 2025

@copilot if the key does not end with -${{ run id }} append it automatically, to simulate the caching behavior.

Implemented in commit b28f0f3. Cache keys that don't end with -${{ github.run_id }} now automatically get it appended:

  • custom-memory-keycustom-memory-key-${{ github.run_id }}
  • project-memory-${{ github.run_id }}project-memory-${{ github.run_id }} (unchanged)

Tested with multiple scenarios including boolean settings, custom keys with and without run_id suffix.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build4123005493/b278/cli.test -test.testlogfile=/tmp/go-build4123005493/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot

  • add a test agentic workflow file under pkg/cli/workflows that uses Claude and cache-memory
  • make sure the "recompile" target in the makefile compiles that folder too

…g/cli/workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 13, 2025

@copilot add cache memory to ci doctor agentic workflow

Added cache-memory: true to the ci-doctor agentic workflow. The memory MCP server will now persist investigation findings across CI failure analysis runs. Implemented in commit 8114eb6.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build3143804204/b278/cli.test -test.testlogfile=/tmp/go-build3143804204/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 13, 2025

@copilot

  • add a test agentic workflow file under pkg/cli/workflows that uses Claude and cache-memory
  • make sure the "recompile" target in the makefile compiles that folder too

Created pkg/cli/workflows/test-claude-cache-memory.md - a test workflow that uses Claude engine with cache-memory configuration. The Makefile's recompile target already includes the pkg/cli/workflows directory and successfully compiles the new test workflow. Implemented in commit 8114eb6.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot in the front matter, add support for specifying the docker version sha/ref of the mcp

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review the configuration of the mcp server at https://github.com/modelcontextprotocol/servers/tree/main/src/memory#docker-1 and make sure the generated code is compatible.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot when the cache-memory is enabled, inject the system prompt from https://github.com/modelcontextprotocol/servers/tree/main/src/memory#system-prompt

in the generated prompt file.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 14, 2025

@copilot

  • merge origin/main and add cache-memory to test-poem agentic workflow
  • update test-poem to use claude...

Completed all requested changes:

Merged origin/main - Successfully brought in latest changes including test-poem workflow
Added cache-memory to test-poem - Added tools.cache-memory: true configuration
Updated test-poem to use Claude - Changed from custom engine to engine: claude
Reverted test-safe-output-missing-tool - Removed the cache-memory configuration that was previously added

The test-poem workflow now uses Claude AI with persistent memory via cache-memory integration, while test-safe-output-missing-tool has been restored to its original state. All workflows recompiled successfully.

Changes in commit 5479fc8

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build412364973/b278/cli.test -test.testlogfile=/tmp/go-build412364973/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title cache-memory Cache-memory implementation with workflow updates and origin/main merge Sep 14, 2025
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot update test poem:

set engine max-turns to 5
set on push copilot/* trigger

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 14, 2025

@copilot update test poem:

set engine max-turns to 5...

Updated test-poem workflow configuration per your request:

Set engine max-turns to 5 - Added max-turns: 5 to the engine configuration object
Set on push copilot/ trigger* - Changed from multiple triggers to push.branches: ['copilot/*']

The workflow now properly limits Claude conversations to 5 turns and triggers only on pushes to copilot branches. Updated documentation reflects the new trigger behavior and max-turns configuration.

Commit: 68b12d0

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build3610627047/b278/cli.test -test.testlogfile=/tmp/go-build3610627047/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot use npx to configure cache-memory mcp.

See https://github.com/modelcontextprotocol/servers/tree/main/src/memory#npx

Copilot AI changed the title Cache-memory implementation with workflow updates and origin/main merge Cache-memory implementation with workflow updates, max-turns configuration, and origin/main merge Sep 14, 2025
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 14, 2025

@copilot use npx to configure cache-memory mcp.

See https://github.com/modelcontextprotocol/servers/tree/main/src/memory#npx

Updated cache-memory MCP configuration to use npx instead of Docker per the official documentation. Changes in commit 2ede422:

  • Switched to npx: Now uses npx @modelcontextprotocol/server-memory command
  • Simplified setup: No Docker dependency required, works with Node.js/npm available in GitHub runners
  • Updated file paths: Changed to /tmp/cache-memory/memory.json for direct file storage
  • Deprecated docker-image: Field is now ignored with backward compatibility
  • Updated documentation: Reflected npx usage and benefits in cache-memory docs
  • Recompiled workflows: All workflows now use the new npx-based configuration

The new MCP configuration:

"memory": {
  "command": "npx",
  "args": ["@modelcontextprotocol/server-memory"],
  "env": {"MEMORY_FILE_PATH": "/tmp/cache-memory/memory.json"}
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build2215799403/b278/cli.test -test.testlogfile=/tmp/go-build2215799403/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build1409989283/b278/cli.test -test.testlogfile=/tmp/go-build1409989283/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build2210363200/b278/cli.test -test.testlogfile=/tmp/go-build2210363200/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Cache-memory implementation with workflow updates, max-turns configuration, and origin/main merge Cache-memory implementation with npx MCP configuration, workflow updates, and max-turns configuration Sep 14, 2025
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot add cache-memory to dev agentic workflow

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 14, 2025

@copilot add cache-memory to dev agentic workflow

Added cache-memory tool to dev agentic workflow. The workflow now includes persistent memory capabilities using npx @modelcontextprotocol/server-memory and GitHub Actions cache. Commit: ac20161

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build3681008693/b278/cli.test -test.testlogfile=/tmp/go-build3681008693/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Cache-memory implementation with npx MCP configuration, workflow updates, and max-turns configuration Cache-memory implementation with npx MCP configuration, workflow updates, max-turns configuration, and dev workflow integration Sep 14, 2025
@pelikhan pelikhan changed the title Cache-memory implementation with npx MCP configuration, workflow updates, max-turns configuration, and dev workflow integration cache-memory Sep 14, 2025
@pelikhan pelikhan merged commit cdb1d0f into main Sep 14, 2025
12 checks passed
@pelikhan pelikhan deleted the copilot/fix-18c775ac-bd7d-4ce4-8c4f-9c661213375a branch September 14, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants