Repository navigation
feat(harness): make workspace memory recall guidance configurable - #4250
Open
shanuo0312 wants to merge 1 commit into
Open
shanuo0312 wants to merge 1 commit into
shanuo0312 wants to merge 1 commit into
Conversation
Add MemoryConfig.Builder.recallInstructions(String) so applications can replace or omit the Memory Recall guidance in the workspace system prompt while keeping memory tools, MEMORY.md injection, and flush/consolidation. null keeps the current default, blank text omits only the recall section, and nonblank text replaces the section body under the existing heading. HarnessAgent passes the setting to WorkspaceContextMiddleware, so declared and general-purpose subagents inherit it. Disabled memory tools still suppress recall guidance so the model is not instructed to use unavailable capabilities. Fixes agentscope-ai#4160
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the configurable workspace-memory recall guidance change.
No open issues 🎉
What changed in this PR
Adds configurable workspace-memory recall guidance to Harness, addressing #4160 without changing default behavior, memory tools, or background memory processing.
Changes:
- Adds
MemoryConfig.Builder.recallInstructions(String):nullpreserves defaults, blank text omits the section, and nonblank text replaces its body. - Wires the setting into workspace context, including inherited configuration for declared and general-purpose subagents.
- Adds regression tests and matching English/Chinese documentation explaining behavior and limitations.
Verification: The PR reports successful full Java verification and documentation checks. These were not rerun here.
| File | Description |
|---|---|
docs/dev/zh/docs/harness/memory.md |
Documents configuration examples and limitations in Chinese. |
docs/dev/en/docs/harness/memory.md |
Documents configuration examples and limitations in English. |
agentscope-harness/src/test/java/io/agentscope/harness/agent/middleware/WorkspaceContextMiddlewareMemoryPromptTest.java |
Tests custom and blank guidance, memory retention, and disabled-tools precedence. |
agentscope-harness/src/test/java/io/agentscope/harness/agent/memory/MemoryConfigTest.java |
Tests defaults and preservation of configured recall text. |
agentscope-harness/src/test/java/io/agentscope/harness/agent/HarnessAgentTest.java |
Tests rendered guidance, retained tools, and subagent inheritance. |
agentscope-harness/src/main/java/io/agentscope/harness/agent/middleware/WorkspaceContextMiddleware.java |
Applies default, omitted, or replacement recall guidance. |
agentscope-harness/src/main/java/io/agentscope/harness/agent/memory/MemoryConfig.java |
Adds the recall-instructions configuration API and Javadoc. |
agentscope-harness/src/main/java/io/agentscope/harness/agent/HarnessAgent.java |
Passes recall configuration to middleware and updates API documentation. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is by an automated agent, not a human.
Summary
Fixes #4160. Adds an opt-in way to configure the Harness workspace-memory recall guidance without changing memory tool availability.
MemoryConfig.Builder.recallInstructions(String):null(default) keeps the built-in## Memory Recallguidance, so existing agents are unchanged.memory_search/memory_get/memory_save/thread_search,MEMORY.mdinjection, and flush/consolidation.## Memory Recallheading, letting applications require a search only when the request actually depends on prior-session facts.WorkspaceContextMiddlewareapplies the override, andHarnessAgentpasses it fromMemoryConfig, including to declared and general-purpose subagents. When memory tools are disabled the recall section is still suppressed, because the guidance would refer to unavailable tools.Verification
mvn -B -T1C clean verify— full reactor, 114 modules: BUILD SUCCESS (harness: 1,844 tests, 0 failures/errors, 36 skipped).npm test(20/20),npm run validate,npm run broken-links— all pass.Limitations
MEMORY.mdis already injected per call).Related: #4219 proposes a similar setting; this implementation is independent.