Skip to content

[dotnet-port-api] Port harness file memory provider #757

Description

@github-actions

Summary

Port the .NET FileMemoryProvider surface into Go by adding two new harness packages:

  • agent/harness/filestore with public file-store primitives (FileStore, Entry, SearchResult, SearchMatch, LineEdit) plus an in-memory implementation for provider and test use.
  • agent/harness/filememory with a session-scoped file-memory context provider, exported state/options types, file_memory_* tools, memory-index injection, and working-folder state initialization.

This was selected from upstream commit f19a129b55e8ea86624a93227954cf43a0890e8f (microsoft/agent-framework@f19a129) because it adds a user-facing capability and exported API surface that Go did not have. The PR also adds a small compiled example and updates the feature-comparison doc to reflect the new parity.

Ported .NET PRs

Breaking Changes

No.

Tests and Examples

  • Added package tests for agent/harness/filestore
  • Added package tests for agent/harness/filememory
  • Added examples/02-agents/agents/step23_file_memory
  • Ran go test ./agent/harness/filestore ./agent/harness/filememory ./examples/02-agents/agents/step23_file_memory
  • Ran go test ./...

Notes

  • This PR intentionally keeps the port narrow: it adds the file-memory provider and the minimal public file-store abstractions it depends on, but does not also port the separate .NET file-access harness provider.
  • Upstream file-editing helper work around .NET: [BREAKING] Add file editing tools and align FileAccess/FileMemory store API agent-framework#6807 informed the tool behavior, but that broader area was not ported separately here to keep the change reviewable.
  • The in-memory file store is sufficient for the new provider and public API parity; filesystem-backed or remote store implementations can be added later without changing the provider surface.

Generated by .NET to Go API Porting Agent · 1.4K AIC · ⌖ 63.6 AIC · ⊞ 21.7K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-port-api-file-memory-provider-59f46798753a3644.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (500 of 1332 lines)
From 9cf79d0e26a61b76504b210fb8de99f4a7250229 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 24 Jul 2026 06:25:45 +0000
Subject: [PATCH] [dotnet-port-api] Port harness file memory provider

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/harness/filememory/filememory.go        | 491 ++++++++++++++++++
 agent/harness/filememory/filememory_test.go   | 213 ++++++++
 agent/harness/filestore/filestore.go          | 409 +++++++++++++++
 agent/harness/filestore/filestore_test.go     |  87 ++++
 docs/dotnet-go-sdk-feature-comparison.md      |   4 +-
 .../agents/step23_file_memory/main.go         |  56 ++
 6 files changed, 1258 insertions(+), 2 deletions(-)
 create mode 100644 agent/harness/filememory/filememory.go
 create mode 100644 agent/harness/filememory/filememory_test.go
 create mode 100644 agent/harness/filestore/filestore.go
 create mode 100644 agent/harness/filestore/filestore_test.go
 create mode 100644 examples/02-agents/agents/step23_file_memory/main.go

diff --git a/agent/harness/filememory/filememory.go b/agent/harness/filememory/filememory.go
new file mode 100644
index 000000000..6e323234e
--- /dev/null
+++ b/agent/harness/filememory/filememory.go
@@ -0,0 +1,491 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+// Package filememory provides a context provider that exposes session-scoped
+// file-based memory tools to agents.
+package filememory
+
+import (
+	"context"
+	"fmt"
+	"path"
+	"runtime"
+	"slices"
+	"strings"
+	"sync"
+	"weak"
+
+	"github.com/microsoft/agent-framework-go/agent"
+	"github.com/microsoft/agent-framework-go/agent/harness/filestore"
+	"github.com/microsoft/agent-framework-go/message"
+	"github.com/microsoft/agent-framework-go/tool"
+	"github.com/microsoft/agent-framework-go/tool/functool"
+)
+
+const (
+	stateKey          = "fileMemoryProviderState"
+	descriptionSuffix = "_description.md"
+	indexFileName     = "memories.md"
+	maxIndexEn
... (truncated)

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