-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: ✨ Implement Claude memory tool #8269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chezsmithy
wants to merge
11
commits into
continuedev:main
Choose a base branch
from
chezsmithy:codex/implement-memory-tool-in-cli-and-core
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,178
−38
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4e538dd
Ensure memory directories are created
chezsmithy 64b2b71
feat: :bug: Update tool seeding for converse API
chezsmithy 978a330
fix: :sparkles: Additional changes and fixes
chezsmithy f133d92
fix: :bug: fix cubic recommendations
chezsmithy 4c8916a
Merge branch 'main' into codex/implement-memory-tool-in-cli-and-core
chezsmithy f193bb3
fix: :art: Prettier fixes
chezsmithy 5c8b683
fix: add non-null assertions to memory tool test parameters
chezsmithy 5c5d326
fix: correct memory tool test expectation for directory creation
chezsmithy 76b08eb
fix: :art: Prettier fixes
chezsmithy 10d1a88
fix: add GITHUB_TOKEN to CLI workflow to avoid rate limiting
chezsmithy 7b2f2eb
fix: add GITHUB_TOKEN to setup-packages to prevent exit 143
chezsmithy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| import { Tool } from "../.."; | ||
| import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; | ||
|
|
||
| const COMMAND_OPTIONS = [ | ||
| "view", | ||
| "create", | ||
| "insert", | ||
| "str_replace", | ||
| "delete", | ||
| "rename", | ||
| ]; | ||
|
|
||
| export const memoryTool: Tool = { | ||
| type: "function", | ||
| displayTitle: "Memory", | ||
| wouldLikeTo: | ||
| "manage persistent memories using the {{{ command }}} command at {{{ path }}}", | ||
| isCurrently: | ||
| "managing persistent memories using the {{{ command }}} command at {{{ path }}}", | ||
| hasAlready: | ||
| "managed persistent memories using the {{{ command }}} command at {{{ path }}}", | ||
| readonly: false, | ||
| group: BUILT_IN_GROUP_NAME, | ||
| function: { | ||
| name: BuiltInToolNames.Memory, | ||
| type: "memory_20250818", | ||
| description: "Anthropic claude memory tool", | ||
| parameters: { | ||
| type: "object", | ||
| required: ["command"], | ||
| properties: { | ||
| command: { | ||
| type: "string", | ||
| enum: COMMAND_OPTIONS, | ||
| description: | ||
| "The memory operation to perform: view, create, insert, str_replace, delete, or rename.", | ||
| }, | ||
| path: { | ||
| type: "string", | ||
| description: | ||
| "Path within the /memories namespace targeted by the command. Must begin with /memories.", | ||
| }, | ||
| view_range: { | ||
| type: "array", | ||
| description: | ||
| "Optional [start, end] line range (1-indexed, inclusive) when viewing a memory file. Use -1 for end to read to EOF.", | ||
| items: { type: "number" }, | ||
| }, | ||
| file_text: { | ||
| type: "string", | ||
| description: "Content to write when creating a new memory file.", | ||
| }, | ||
| insert_line: { | ||
| type: "number", | ||
| description: | ||
| "0-based line number where insert_text should be added when using the insert command.", | ||
| }, | ||
| insert_text: { | ||
| type: "string", | ||
| description: "Text to insert when using the insert command.", | ||
| }, | ||
| old_str: { | ||
| type: "string", | ||
| description: | ||
| "Existing text to replace when using the str_replace command. Must appear exactly once.", | ||
| }, | ||
| new_str: { | ||
| type: "string", | ||
| description: | ||
| "Replacement text to use when the str_replace command is invoked.", | ||
| }, | ||
| old_path: { | ||
| type: "string", | ||
| description: "Existing path to rename when using the rename command.", | ||
| }, | ||
| new_path: { | ||
| type: "string", | ||
| description: "New path to rename to when using the rename command.", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| systemMessageDescription: { | ||
| prefix: `To manage long-term memories stored under /memories, use the ${BuiltInToolNames.Memory} tool. Always provide a command (view, create, insert, str_replace, delete, or rename) and paths that begin with /memories. For example, to view the index file you could respond with:`, | ||
| exampleArgs: [ | ||
| ["command", "view"], | ||
| ["path", "/memories/index.md"], | ||
| ], | ||
| }, | ||
| defaultToolPolicy: "allowedWithoutPermission", | ||
| toolCallIcon: "ArchiveBoxIcon", | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model memory tool support logic duplicates packages/openai-adapters/src/apis/Bedrock.ts:supportsMemoryTool() function. This duplication introduces a maintenance risk, as updates to the list of supported models might not be synchronized across both files, leading to inconsistent behavior.
Prompt for AI agents