Merge feature/context-injection into main
This commit is contained in:
@@ -367,6 +367,37 @@ server.tool(
|
||||
}
|
||||
);
|
||||
|
||||
// --- memory_context ---
|
||||
import { gatherContext, DEFAULT_CONTEXT_CONFIG } from '../core/context';
|
||||
|
||||
server.tool(
|
||||
'memory_context',
|
||||
'Get relevant context for a Claude session. Gathers recent activity, project-specific nodes, open tasks, and decisions. Use at session start.',
|
||||
{
|
||||
project: z.string().optional().describe('Project name to filter by (e.g. "cortex")'),
|
||||
query: z.string().optional().describe('Optional semantic search query'),
|
||||
maxTokens: z.number().optional().describe(`Max tokens in output (default ${DEFAULT_CONTEXT_CONFIG.maxTokens})`),
|
||||
maxNodes: z.number().optional().describe(`Max nodes to include (default ${DEFAULT_CONTEXT_CONFIG.maxNodes})`),
|
||||
},
|
||||
async ({ project, query: semanticQuery, maxTokens, maxNodes }) => {
|
||||
const result = await gatherContext({
|
||||
project,
|
||||
semanticQuery,
|
||||
config: {
|
||||
maxTokens: maxTokens ?? DEFAULT_CONTEXT_CONFIG.maxTokens,
|
||||
maxNodes: maxNodes ?? DEFAULT_CONTEXT_CONFIG.maxNodes,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: 'text' as const,
|
||||
text: result.formatted,
|
||||
}],
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// --- memory_summary ---
|
||||
import { getCachedSummary, generateSummary } from '../core/summary';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user