Add the memory port with loop recall injection and the memory_write tool (N3 WP5) #34

Merged
weichen merged 1 commits from feature/n3-memory-wp5 into main 2026-10-07 16:22:14 +00:00
Owner

Why: the completion doc assigns the Memory port to the library; memory recall today is a product-side interface assertion with no library surface, AgentSpec.MemoryScope has no consumer, and the model has no write-back path.

What: runtime/memory package (Entry/RecallQuery/Store + deterministic [记忆] block render, expiry/empty pruning); loop Config.Memory/MemoryScope with per-request injection into the request copy (never persisted, never accumulates); memory_write tool registered at Run start with fail-closed validation.

Evidence: GOWORK=off go vet + go test -count=1 ./... green.

Impact: opt-in only; nil port is byte-identical.

Refs: Agent-System-Documents#43 (N3 plan WP5)

Why: the completion doc assigns the Memory port to the library; memory recall today is a product-side interface assertion with no library surface, AgentSpec.MemoryScope has no consumer, and the model has no write-back path. What: runtime/memory package (Entry/RecallQuery/Store + deterministic [记忆] block render, expiry/empty pruning); loop Config.Memory/MemoryScope with per-request injection into the request copy (never persisted, never accumulates); memory_write tool registered at Run start with fail-closed validation. Evidence: GOWORK=off go vet + go test -count=1 ./... green. Impact: opt-in only; nil port is byte-identical. Refs: Agent-System-Documents#43 (N3 plan WP5)
weichen added 1 commit 2026-10-07 16:05:51 +00:00
Add the memory port with loop recall injection and the memory_write tool (N3 WP5)
ci / vet-and-test (pull_request) Successful in 49s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
bdb45c3c2c
Why: the completion doc assigns the Memory port to the library; today
memory recall is a product-side interface assertion with no library
surface, AgentSpec.MemoryScope has no consumer, and the model has no
write-back path.
Evidence: GOWORK=off go vet + go test -count=1 ./... green;
TestLoopInjectsMemoryAndRegistersWrite (recall block lands after the
system section, memory_write executes through the loop),
TestEmptyRecallInjectsNothing (empty recall changes nothing),
TestBlockRenderOrderingAndCaps (deterministic order, expiry/empty
pruning), TestWriteToolValidation (fail-closed scope/type/content).
Impact: new opt-in Config.Memory/MemoryScope; nil port keeps behavior
byte-identical; injection is request-scoped (never persisted, never
accumulates) and deterministic ([记忆] text shape preserved for the
product migration).
Refs: Agent-System-Documents#43 (N3 plan WP5)
weichen merged commit 0e03cc2144 into main 2026-10-07 16:22:14 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Native#34