chore(memory): delete internal/memory (unification slice 5) (#889)

Deletes internal/memory (Manager, builtin.Provider, memory_edit tool) now
that slices 2-4 built the CRUD engine family and its per-turn read/write
seams. Also deletes internal/infrastructure/memory/builtin/provider.go (the
memory_edit adapter over the old package -- its markdown store already
relocated in slice 2), internal/tools/provider/memory (the old tool
registration, redundant with slice 4's memory_create/update/delete/list),
config.Memory.{Provider,ProviderConfig} and the validateMemory rejection
that existed only to complain about Provider, and webui.MemoryStatus/
MemoryProviderHandle plus its dashboard page -- never wired in production
(s.Memory was always nil), confirmed by /api/capabilities always reporting
"memory": false.

Rewrites ARCHITECTURE.md's "Memory engine family" section to describe the
current engine (internal/domain/memory contract, internal/infrastructure/
memory builtin engine + its builtin/ markdown store, the per-turn read seam
in gateway/turn_memory.go, the per-turn write tools in
gateway/turn_memory_tool.go) instead of the deleted Manager. Fixes two
docs/architecture/configuration.md rows that described the deleted
manager's literals and SaveConfig mechanism.
This commit is contained in:
sam authored and GitHub committed 2026-09-19 13:43:16 +10:00
1 parent a18067d85d
commit 04d4d8f1d8
43 files changed
+92 -5619

No files matched your search

-4
View File
@@ -56,7 +56,6 @@ func TestArchiedWiresTypedProvidersAndExecutableConsumers(t *testing.T) {
// root was decomposed; the receiver makes the arg expressions
// carry the b. prefix there.
"toolprovider.NewRegistry(b.toolReg)",
"memorytoolprovider.New(b.memManager)",
"configuredMCPProvider(srv, cfg.WorkDir)",
"capabilityHost.Register(b.providerRegistry)",
// The chat turn builds its toolset from the registry before the
@@ -73,9 +72,6 @@ func TestArchiedWiresTypedProvidersAndExecutableConsumers(t *testing.T) {
if strings.Contains(text.String(), ".RegisterTools(ctx, toolReg)") {
t.Error("composition bypasses the typed provider registry with direct MCP registration")
}
if strings.Contains(text.String(), "memManager.GetToolSchemas()") {
t.Error("composition bypasses the typed memory tool provider")
}
if strings.Contains(text.String(), "NewLoopRunner") {
t.Error("archied constructs a worker-local autonomous runner")
}
@@ -1,76 +0,0 @@
// Package memory adapts the memory manager to the typed tool-provider family.
package memory
import (
"context"
"errors"
corememory "github.com/samcharles93/archie-core/internal/memory"
"github.com/samcharles93/archie-core/internal/plugin"
"github.com/samcharles93/archie-core/internal/tools"
)
// Provider exposes a memory manager's executable tool schemas.
type Provider struct {
manager *corememory.Manager
}
// New creates a memory tool provider.
func New(manager *corememory.Manager) *Provider {
return &Provider{manager: manager}
}
// Manifest declares the adapter's tool capability.
func (p *Provider) Manifest() plugin.Manifest {
return plugin.Manifest{
ID: "memory.tools",
Name: "Memory tools",
Version: "1.0.0",
APIVersion: plugin.HostAPIVersion,
Capabilities: []plugin.CapabilityKind{"tools"},
}
}
// Start is a no-op because the composition root owns memory initialization.
func (p *Provider) Start(ctx context.Context) error {
if err := ctx.Err(); err != nil {
return err
}
if p.manager == nil {
return errors.New("memory tool provider manager is nil")
}
return nil
}
// Discover returns executable memory tools.
func (p *Provider) Discover(ctx context.Context) ([]tools.ToolEntry, error) {
if err := ctx.Err(); err != nil {
return nil, err
}
if p.manager == nil {
return nil, errors.New("memory tool provider manager is nil")
}
return p.manager.GetToolSchemas(), nil
}
// Health reports whether a manager is configured.
func (p *Provider) Health(context.Context) plugin.Health {
if p.manager == nil {
return plugin.Health{
Status: plugin.HealthUnhealthy,
Message: "memory manager is not configured",
}
}
if p.manager.HasShutdown() {
return plugin.Health{
Status: plugin.HealthUnhealthy,
Message: "memory manager is shut down",
}
}
return plugin.Health{Status: plugin.HealthHealthy}
}
// Stop is a no-op because the daemon owns memory shutdown.
func (p *Provider) Stop(context.Context) error {
return nil
}
@@ -1,123 +0,0 @@
package memory
import (
"context"
"testing"
corememory "github.com/samcharles93/archie-core/internal/memory"
"github.com/samcharles93/archie-core/internal/plugin"
"github.com/samcharles93/archie-core/internal/tools"
)
func TestProviderDiscoversExecutableMemoryTools(t *testing.T) {
backend := &fakeMemoryProvider{
available: true,
entries: []tools.ToolEntry{{
Name: "memory_search",
Description: "Search memory",
Schema: tools.JSONSchema{"type": "object"},
}},
result: "remembered",
}
manager, err := corememory.NewManager(backend, nil)
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
if err := manager.Shutdown(); err != nil {
t.Errorf("memory manager shutdown: %v", err)
}
})
provider := New(manager)
if err := provider.Start(context.Background()); err != nil {
t.Fatal(err)
}
entries, err := provider.Discover(context.Background())
if err != nil {
t.Fatal(err)
}
if len(entries) != 1 || entries[0].Name != "memory_search" {
t.Fatalf("Discover() = %v, want memory_search", entryNames(entries))
}
if entries[0].Handler == nil {
t.Fatal("memory tool handler is nil")
}
got, err := entries[0].Handler(context.Background(), map[string]any{"query": "architecture"})
if err != nil {
t.Fatal(err)
}
if got != backend.result {
t.Fatalf("handler result = %v, want %v", got, backend.result)
}
if backend.calledName != "memory_search" || backend.calledArgs["query"] != "architecture" {
t.Fatalf("memory call = %q %#v", backend.calledName, backend.calledArgs)
}
}
func TestProviderLifecycleWithNilManager(t *testing.T) {
provider := New(nil)
if err := provider.Start(context.Background()); err == nil {
t.Fatal("Start() succeeded with nil manager")
}
if _, err := provider.Discover(context.Background()); err == nil {
t.Fatal("Discover() succeeded with nil manager")
}
if got := provider.Health(context.Background()).Status; got != plugin.HealthUnhealthy {
t.Fatalf("Health().Status = %q, want unhealthy", got)
}
if err := provider.Stop(context.Background()); err != nil {
t.Fatalf("Stop() = %v, want no-op", err)
}
}
func TestProviderSatisfiesToolProviderEngine(t *testing.T) {
var _ interface {
plugin.Module
Discover(context.Context) ([]tools.ToolEntry, error)
} = New(nil)
}
type fakeMemoryProvider struct {
available bool
entries []tools.ToolEntry
result any
callErr error
calledName string
calledArgs map[string]any
}
func (p *fakeMemoryProvider) Name() string {
return "fake-memory"
}
func (p *fakeMemoryProvider) IsAvailable() bool {
return p.available
}
func (p *fakeMemoryProvider) Initialize(string) error {
return nil
}
func (p *fakeMemoryProvider) GetToolSchemas() []tools.ToolEntry {
return p.entries
}
func (p *fakeMemoryProvider) HandleToolCall(name string, args map[string]any) (any, error) {
p.calledName = name
p.calledArgs = args
if p.callErr != nil {
return nil, p.callErr
}
return p.result, nil
}
func entryNames(entries []tools.ToolEntry) []string {
names := make([]string, len(entries))
for i, entry := range entries {
names[i] = entry.Name
}
return names
}
var _ corememory.ToolCallProvider = (*fakeMemoryProvider)(nil)