You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: server/src/cli/mcp/server.ts
+28-6Lines changed: 28 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,28 @@ import {
9
9
WriteTaskMemoryRequestShape,
10
10
}from'../../services/memory/schemas.js';
11
11
12
+
constLIST_NOTES_DESCRIPTION=[
13
+
'List note summaries for browsing and narrowing the ChatCrystal knowledge base.',
14
+
'Use this when you need paginated notes filtered by tag or title/summary keyword.',
15
+
'Use search_knowledge instead for semantic relevance ranking, and get_note when you already have an id and need the full note body.',
16
+
'Returns note metadata and summaries, not full note content.',
17
+
].join(' ');
18
+
19
+
constRECALL_FOR_TASK_DESCRIPTION=[
20
+
'Retrieve reusable task memories before starting substantive coding work.',
21
+
'Use this at the beginning of implementation, debugging, migration, configuration, investigation, refactor, or optimization tasks to load project-scoped memories first and optional global lessons second.',
22
+
'Use mode="debug" when the user reports an error, failing command, regression, or incident; include error_signatures and related_files when available.',
23
+
'Use search_knowledge instead for ad hoc semantic note search that is not tied to the current task.',
24
+
'This tool is read-only and returns ranked memories plus optional related-note context without writing anything.',
25
+
].join(' ');
26
+
27
+
constVALIDATE_TASK_MEMORY_DESCRIPTION=[
28
+
'Dry-run validation for a candidate task memory before calling write_task_memory.',
29
+
'Use this after meaningful work and before persisting a lesson to check whether the candidate is durable, specific, reusable, and shaped like a high-quality ChatCrystal note.',
30
+
'It has no side effects and never writes to the knowledge base.',
31
+
'Returns acceptance, rejection reason, warnings, and materialized note fields so agents can revise the candidate or skip weak work logs.',
'Preflight a task memory candidate without side effects. Use this before write_task_memory when available. Returns materialized ChatCrystal note fields, acceptance, reason, and warnings.',
]).describe('Kind of work being performed. Use debug for failures; choose the closest non-debug category for planned work.'),
23
+
project_key: z.string().optional().describe('Stable project identifier used to prioritize project-scoped memories, such as a repository or workspace key.'),
24
+
project_dir: z.string().optional().describe('Absolute project directory when known; helps ChatCrystal match memories to the right local workspace.'),
25
+
cwd: z.string().optional().describe('Current working directory of the agent session.'),
26
+
branch: z.string().optional().describe('Current VCS branch when relevant to the task.'),
27
+
files_touched: z.array(z.string()).optional().describe('Files already touched or expected to be touched; improves project memory matching.'),
28
+
error_signatures: z.array(z.string()).optional().describe('Concrete errors, stack traces, failing commands, or symptoms. Most useful with debug tasks.'),
29
29
source_agent: SourceAgentSchema.optional(),
30
30
});
31
31
32
32
constRecallTaskSchema=TaskBaseSchema.extend({
33
-
related_files: z.array(z.string()).optional(),
33
+
related_files: z.array(z.string()).optional().describe('Additional files related to the task but not necessarily modified.'),
project_limit: z.number().int().nonnegative().default(5).describe('Maximum number of project-scoped memories to return first.'),
43
+
global_limit: z.number().int().nonnegative().default(3).describe('Maximum number of cross-project/global lessons to append after project memories.'),
44
+
include_relations: z.boolean().default(true).describe('Whether to include related-note context for returned memories.'),
45
45
}asconst;
46
46
47
47
exportconstRecallForTaskRequestShape={
48
-
mode: z.enum(['task','debug']).default('task'),
48
+
mode: z.enum(['task','debug']).default('task').describe('Use task for normal work and debug when the task starts from an error, failing test, or incident.'),
title: z.string().optional().describe('Specific note title. Prefer the durable lesson over a generic task name.'),
60
+
summary: z.string().min(1).describe('Concrete summary of what was learned or decided, written so it remains useful in a later session.'),
61
+
outcome_type: z.enum(['pitfall','fix','pattern','decision']).describe('Primary kind of reusable memory being saved.'),
62
+
pitfalls: z.array(z.string()).optional().describe('Mistakes, traps, or failure modes future agents should avoid.'),
63
+
root_cause: z.string().optional().describe('Underlying cause of the problem when the memory is about a fix or pitfall.'),
64
+
resolution: z.string().optional().describe('Specific fix or action that resolved the issue.'),
65
+
reusable_patterns: z.array(z.string()).optional().describe('Generalizable implementation, debugging, migration, or configuration patterns.'),
66
+
decisions: z.array(z.string()).optional().describe('Durable design, product, architecture, or process decisions made during the task.'),
67
+
key_conclusions: z.array(z.string()).optional().describe('Important takeaways that should be recalled before similar future work.'),
68
68
code_snippets: z.array(
69
69
z.object({
70
-
language: z.string(),
71
-
code: z.string(),
72
-
description: z.string(),
70
+
language: z.string().describe('Programming or markup language for the snippet.'),
71
+
code: z.string().describe('Minimal code, command, config, or query that illustrates the reusable lesson.'),
72
+
description: z.string().describe('Why this snippet matters and when to reuse it.'),
73
73
}),
74
-
).optional(),
75
-
files_touched: z.array(z.string()).optional(),
76
-
error_signatures: z.array(z.string()).optional(),
77
-
tags: z.array(z.string()).optional(),
74
+
).optional().describe('Small snippets that make the memory actionable without copying large files.'),
75
+
files_touched: z.array(z.string()).optional().describe('Files that provide useful provenance for the memory.'),
76
+
error_signatures: z.array(z.string()).optional().describe('Exact errors or symptoms that should trigger this memory in future debug recall.'),
77
+
tags: z.array(z.string()).optional().describe('Short tags for retrieval, such as framework, subsystem, source tool, or failure type.'),
78
78
}asconst;
79
79
80
80
exportconstWriteTaskMemoryRequestShape={
81
-
mode: z.enum(['auto','manual']),
82
-
source_run_key: z.string().optional(),
83
-
scope: z.enum(['project','global']).optional(),
81
+
mode: z.enum(['auto','manual']).describe('Use auto for agent-generated writebacks and manual for explicit user-curated memories.'),
82
+
source_run_key: z.string().optional().describe('Idempotency key for auto writebacks; required in auto mode to avoid duplicate memory receipts.'),
83
+
scope: z.enum(['project','global']).optional().describe('Store as project memory by default; global is reserved for broadly reusable manual lessons.'),
84
84
task: NormalizedTaskSchema,
85
-
memory: z.object(WriteTaskMemoryPayloadShape),
85
+
memory: z.object(WriteTaskMemoryPayloadShape).describe('Candidate ChatCrystal note content to validate or persist as reusable task memory.'),
0 commit comments