-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
base: main
Are you sure you want to change the base?
feat: ✨ Implement Claude memory tool #8269
Conversation
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.
4 issues found across 18 files
Prompt for AI agents (all 4 issues)
Understand the root cause of the following 4 issues and fix them.
<file name="extensions/cli/src/tools/memory.ts">
<violation number="1" location="extensions/cli/src/tools/memory.ts:130">
Creating a memory file in a new directory always fails: after creating the missing parent directory we throw `Path not found`, so fs.writeFile never runs. Drop the throw so the command can proceed.</violation>
</file>
<file name="core/tools/implementations/memory.ts">
<violation number="1" location="core/tools/implementations/memory.ts:121">
Core memory command handling logic duplicates extensions/cli/src/tools/memory.ts:executeMemoryCommand() and its handlers</violation>
<violation number="2" location="core/tools/implementations/memory.ts:131">
After creating a missing directory, this branch still throws `Path not found`, so the create command always fails for new paths.</violation>
</file>
<file name="extensions/cli/src/tools/index.tsx">
<violation number="1" location="extensions/cli/src/tools/index.tsx:141">
This enables the memory tool for any model containing “claude”, but the feature must be restricted to the specific allowlisted models from the PR description.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
const fullPath = validatePath(args.path, memoryRoot); | ||
|
||
if (!(await exists(fullPath))) { | ||
throw new Error(`Path not found: ${args.path}`); |
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.
Creating a memory file in a new directory always fails: after creating the missing parent directory we throw Path not found
, so fs.writeFile never runs. Drop the throw so the command can proceed.
Prompt for AI agents
Address the following comment on extensions/cli/src/tools/memory.ts at line 130:
<comment>Creating a memory file in a new directory always fails: after creating the missing parent directory we throw `Path not found`, so fs.writeFile never runs. Drop the throw so the command can proceed.</comment>
<file context>
@@ -0,0 +1,416 @@
+ const fullPath = validatePath(args.path, memoryRoot);
+
+ if (!(await exists(fullPath))) {
+ throw new Error(`Path not found: ${args.path}`);
+ }
+
</file context>
const fullPath = validateMemoryPath(pathArg, memoryRoot); | ||
|
||
if (!(await exists(fullPath))) { | ||
throw new Error(`Path not found: ${pathArg}`); |
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.
After creating a missing directory, this branch still throws Path not found
, so the create command always fails for new paths.
Prompt for AI agents
Address the following comment on core/tools/implementations/memory.ts at line 131:
<comment>After creating a missing directory, this branch still throws `Path not found`, so the create command always fails for new paths.</comment>
<file context>
@@ -0,0 +1,342 @@
+ const fullPath = validateMemoryPath(pathArg, memoryRoot);
+
+ if (!(await exists(fullPath))) {
+ throw new Error(`Path not found: ${pathArg}`);
+ }
+
</file context>
}); | ||
} | ||
|
||
return isClaudeModel; |
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.
This enables the memory tool for any model containing “claude”, but the feature must be restricted to the specific allowlisted models from the PR description.
Prompt for AI agents
Address the following comment on extensions/cli/src/tools/index.tsx at line 141:
<comment>This enables the memory tool for any model containing “claude”, but the feature must be restricted to the specific allowlisted models from the PR description.</comment>
<file context>
@@ -106,10 +111,56 @@ function shouldExcludeEditTool(): boolean {
+ });
+ }
+
+ return isClaudeModel;
+ }
+ } catch (error) {
</file context>
return [start, end]; | ||
} | ||
|
||
export const memoryToolImpl: ToolImpl = async (args, extras) => { |
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.
Core memory command handling logic duplicates extensions/cli/src/tools/memory.ts:executeMemoryCommand() and its handlers
Prompt for AI agents
Address the following comment on core/tools/implementations/memory.ts at line 121:
<comment>Core memory command handling logic duplicates extensions/cli/src/tools/memory.ts:executeMemoryCommand() and its handlers</comment>
<file context>
@@ -0,0 +1,342 @@
+ return [start, end];
+}
+
+export const memoryToolImpl: ToolImpl = async (args, extras) => {
+ const command = getStringArg(args, "command") as MemoryCommand;
+ const memoryRoot = await ensureMemoryRoot(extras);
</file context>
Description
The tool is only enabled for the following models:
AI Code Review
@continue-general-review
or@continue-detailed-review
Checklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
Added tests as needed.