Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(tools): register memory tools and add group:memory

Jiang Bohand9cd79f84728
diff --git a/src/agent/tools.ts b/src/agent/tools.ts
index 287bda45be..6578a238d0 100644
--- a/src/agent/tools.ts
+++ b/src/agent/tools.ts
@@ -6,6 +6,7 @@ import { createExecTool } from "./tools/exec.js";
import { createProcessTool } from "./tools/process.js";
import { createGlobTool } from "./tools/glob.js";
import { createWebFetchTool, createWebSearchTool } from "./tools/web/index.js";
+import { createMemoryTools } from "./tools/memory/index.js";
import { filterTools } from "./tools/policy.js";
export function resolveModel(options: AgentOptions) {
@@ -19,11 +20,24 @@ export function resolveModel(options: AgentOptions) {
return getModel("kimi-coding", "kimi-k2-thinking");
}
+/** Options for creating tools */
+export interface CreateToolsOptions {
+ cwd: string;
+ /** Profile ID for memory tools (optional) */
+ profileId?: string;
+ /** Base directory for profiles (optional) */
+ profileBaseDir?: string;
+}
+
/**
* Create all available tools.
* This returns the full set before policy filtering.
*/
-export function createAllTools(cwd: string): AgentTool<any>[] {
+export function createAllTools(options: CreateToolsOptions | string): AgentTool<any>[] {
+ // Support legacy string argument for backwards compatibility
+ const opts: CreateToolsOptions = typeof options === "string" ? { cwd: options } : options;
+ const { cwd, profileId, profileBaseDir } = opts;
+
const baseTools = createCodingTools(cwd).filter(
(tool) => tool.name !== "bash",
) as AgentTool<any>[];
@@ -34,7 +48,7 @@ export function createAllTools(cwd: string): AgentTool<any>[] {
const webFetchTool = createWebFetchTool();
const webSearchTool = createWebSearchTool();
- return [
+ const tools: AgentTool<any>[] = [
...baseTools,
execTool as AgentTool<any>,
processTool as AgentTool<any>,
@@ -42,6 +56,17 @@ export function createAllTools(cwd: string): AgentTool<any>[] {
webFetchTool as AgentTool<any>,
webSearchTool as AgentTool<any>,
];
+
+ // Add memory tools if profileId is provided
+ if (profileId) {
+ const memoryTools = createMemoryTools({
+ profileId,
+ baseDir: profileBaseDir,
+ });
+ tools.push(...memoryTools);
+ }
+
+ return tools;
}
/**
@@ -56,8 +81,12 @@ export function createAllTools(cwd: string): AgentTool<any>[] {
export function resolveTools(options: AgentOptions): AgentTool<any>[] {
const cwd = options.cwd ?? process.cwd();
- // Create all tools
- const allTools = createAllTools(cwd);
+ // Create all tools (including memory tools if profileId is provided)
+ const allTools = createAllTools({
+ cwd,
+ profileId: options.profileId,
+ profileBaseDir: options.profileBaseDir,
+ });
// Apply policy filtering
const filtered = filterTools(allTools, {
@@ -71,8 +100,20 @@ export function resolveTools(options: AgentOptions): AgentTool<any>[] {
/**
* Get all available tool names (for debugging/listing).
+ * Note: Memory tools require profileId, so they are not included by default.
*/
export function getAllToolNames(cwd?: string): string[] {
- const tools = createAllTools(cwd ?? process.cwd());
+ const tools = createAllTools({ cwd: cwd ?? process.cwd() });
+ return tools.map((t) => t.name);
+}
+
+/**
+ * Get all available tool names including memory tools (for debugging/listing).
+ */
+export function getAllToolNamesWithMemory(cwd?: string, profileId?: string): string[] {
+ const tools = createAllTools({
+ cwd: cwd ?? process.cwd(),
+ profileId: profileId ?? "test-profile",
+ });
return tools.map((t) => t.name);
}
diff --git a/src/agent/tools/groups.ts b/src/agent/tools/groups.ts
index a9e09f5a33..a886b22b08 100644
--- a/src/agent/tools/groups.ts
+++ b/src/agent/tools/groups.ts
@@ -32,6 +32,9 @@ export const TOOL_GROUPS: Record<string, string[]> = {
// Web tools
"group:web": ["web_search", "web_fetch"],
+ // Memory tools (requires profileId)
+ "group:memory": ["memory_get", "memory_set", "memory_delete", "memory_list"],
+
// All core tools
"group:core": [
"read",