cccmemory 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/ConversationMemory.d.ts +231 -0
- package/dist/ConversationMemory.d.ts.map +1 -0
- package/dist/ConversationMemory.js +357 -0
- package/dist/ConversationMemory.js.map +1 -0
- package/dist/cache/QueryCache.d.ts +215 -0
- package/dist/cache/QueryCache.d.ts.map +1 -0
- package/dist/cache/QueryCache.js +294 -0
- package/dist/cache/QueryCache.js.map +1 -0
- package/dist/cli/commands.d.ts +9 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +954 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/help.d.ts +16 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +361 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +30 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +111 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/context/ContextInjector.d.ts +38 -0
- package/dist/context/ContextInjector.d.ts.map +1 -0
- package/dist/context/ContextInjector.js +235 -0
- package/dist/context/ContextInjector.js.map +1 -0
- package/dist/documentation/CodeAnalyzer.d.ts +29 -0
- package/dist/documentation/CodeAnalyzer.d.ts.map +1 -0
- package/dist/documentation/CodeAnalyzer.js +122 -0
- package/dist/documentation/CodeAnalyzer.js.map +1 -0
- package/dist/documentation/ConversationAnalyzer.d.ts +19 -0
- package/dist/documentation/ConversationAnalyzer.d.ts.map +1 -0
- package/dist/documentation/ConversationAnalyzer.js +157 -0
- package/dist/documentation/ConversationAnalyzer.js.map +1 -0
- package/dist/documentation/CrossReferencer.d.ts +67 -0
- package/dist/documentation/CrossReferencer.d.ts.map +1 -0
- package/dist/documentation/CrossReferencer.js +247 -0
- package/dist/documentation/CrossReferencer.js.map +1 -0
- package/dist/documentation/DocumentationGenerator.d.ts +22 -0
- package/dist/documentation/DocumentationGenerator.d.ts.map +1 -0
- package/dist/documentation/DocumentationGenerator.js +57 -0
- package/dist/documentation/DocumentationGenerator.js.map +1 -0
- package/dist/documentation/MarkdownFormatter.d.ts +26 -0
- package/dist/documentation/MarkdownFormatter.d.ts.map +1 -0
- package/dist/documentation/MarkdownFormatter.js +301 -0
- package/dist/documentation/MarkdownFormatter.js.map +1 -0
- package/dist/documentation/types.d.ts +176 -0
- package/dist/documentation/types.d.ts.map +1 -0
- package/dist/documentation/types.js +5 -0
- package/dist/documentation/types.js.map +1 -0
- package/dist/embeddings/ConfigManager.d.ts +46 -0
- package/dist/embeddings/ConfigManager.d.ts.map +1 -0
- package/dist/embeddings/ConfigManager.js +177 -0
- package/dist/embeddings/ConfigManager.js.map +1 -0
- package/dist/embeddings/EmbeddingConfig.d.ts +39 -0
- package/dist/embeddings/EmbeddingConfig.d.ts.map +1 -0
- package/dist/embeddings/EmbeddingConfig.js +132 -0
- package/dist/embeddings/EmbeddingConfig.js.map +1 -0
- package/dist/embeddings/EmbeddingGenerator.d.ts +51 -0
- package/dist/embeddings/EmbeddingGenerator.d.ts.map +1 -0
- package/dist/embeddings/EmbeddingGenerator.js +157 -0
- package/dist/embeddings/EmbeddingGenerator.js.map +1 -0
- package/dist/embeddings/EmbeddingProvider.d.ts +34 -0
- package/dist/embeddings/EmbeddingProvider.d.ts.map +1 -0
- package/dist/embeddings/EmbeddingProvider.js +6 -0
- package/dist/embeddings/EmbeddingProvider.js.map +1 -0
- package/dist/embeddings/ModelRegistry.d.ts +48 -0
- package/dist/embeddings/ModelRegistry.d.ts.map +1 -0
- package/dist/embeddings/ModelRegistry.js +170 -0
- package/dist/embeddings/ModelRegistry.js.map +1 -0
- package/dist/embeddings/VectorStore.d.ts +114 -0
- package/dist/embeddings/VectorStore.d.ts.map +1 -0
- package/dist/embeddings/VectorStore.js +393 -0
- package/dist/embeddings/VectorStore.js.map +1 -0
- package/dist/embeddings/providers/OllamaEmbeddings.d.ts +38 -0
- package/dist/embeddings/providers/OllamaEmbeddings.d.ts.map +1 -0
- package/dist/embeddings/providers/OllamaEmbeddings.js +125 -0
- package/dist/embeddings/providers/OllamaEmbeddings.js.map +1 -0
- package/dist/embeddings/providers/OpenAIEmbeddings.d.ts +40 -0
- package/dist/embeddings/providers/OpenAIEmbeddings.d.ts.map +1 -0
- package/dist/embeddings/providers/OpenAIEmbeddings.js +129 -0
- package/dist/embeddings/providers/OpenAIEmbeddings.js.map +1 -0
- package/dist/embeddings/providers/TransformersEmbeddings.d.ts +38 -0
- package/dist/embeddings/providers/TransformersEmbeddings.d.ts.map +1 -0
- package/dist/embeddings/providers/TransformersEmbeddings.js +115 -0
- package/dist/embeddings/providers/TransformersEmbeddings.js.map +1 -0
- package/dist/handoff/SessionHandoffStore.d.ts +80 -0
- package/dist/handoff/SessionHandoffStore.d.ts.map +1 -0
- package/dist/handoff/SessionHandoffStore.js +314 -0
- package/dist/handoff/SessionHandoffStore.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +27 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +157 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/memory/WorkingMemoryStore.d.ts +83 -0
- package/dist/memory/WorkingMemoryStore.d.ts.map +1 -0
- package/dist/memory/WorkingMemoryStore.js +318 -0
- package/dist/memory/WorkingMemoryStore.js.map +1 -0
- package/dist/memory/types.d.ts +192 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +8 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/parsers/CodexConversationParser.d.ts +51 -0
- package/dist/parsers/CodexConversationParser.d.ts.map +1 -0
- package/dist/parsers/CodexConversationParser.js +301 -0
- package/dist/parsers/CodexConversationParser.js.map +1 -0
- package/dist/parsers/ConversationParser.d.ts +286 -0
- package/dist/parsers/ConversationParser.d.ts.map +1 -0
- package/dist/parsers/ConversationParser.js +795 -0
- package/dist/parsers/ConversationParser.js.map +1 -0
- package/dist/parsers/DecisionExtractor.d.ts +144 -0
- package/dist/parsers/DecisionExtractor.d.ts.map +1 -0
- package/dist/parsers/DecisionExtractor.js +434 -0
- package/dist/parsers/DecisionExtractor.js.map +1 -0
- package/dist/parsers/GitIntegrator.d.ts +156 -0
- package/dist/parsers/GitIntegrator.d.ts.map +1 -0
- package/dist/parsers/GitIntegrator.js +348 -0
- package/dist/parsers/GitIntegrator.js.map +1 -0
- package/dist/parsers/MistakeExtractor.d.ts +151 -0
- package/dist/parsers/MistakeExtractor.d.ts.map +1 -0
- package/dist/parsers/MistakeExtractor.js +460 -0
- package/dist/parsers/MistakeExtractor.js.map +1 -0
- package/dist/parsers/RequirementsExtractor.d.ts +166 -0
- package/dist/parsers/RequirementsExtractor.d.ts.map +1 -0
- package/dist/parsers/RequirementsExtractor.js +338 -0
- package/dist/parsers/RequirementsExtractor.js.map +1 -0
- package/dist/realtime/ConversationWatcher.d.ts +87 -0
- package/dist/realtime/ConversationWatcher.d.ts.map +1 -0
- package/dist/realtime/ConversationWatcher.js +204 -0
- package/dist/realtime/ConversationWatcher.js.map +1 -0
- package/dist/realtime/IncrementalParser.d.ts +83 -0
- package/dist/realtime/IncrementalParser.d.ts.map +1 -0
- package/dist/realtime/IncrementalParser.js +232 -0
- package/dist/realtime/IncrementalParser.js.map +1 -0
- package/dist/realtime/LiveExtractor.d.ts +72 -0
- package/dist/realtime/LiveExtractor.d.ts.map +1 -0
- package/dist/realtime/LiveExtractor.js +288 -0
- package/dist/realtime/LiveExtractor.js.map +1 -0
- package/dist/search/SemanticSearch.d.ts +121 -0
- package/dist/search/SemanticSearch.d.ts.map +1 -0
- package/dist/search/SemanticSearch.js +823 -0
- package/dist/search/SemanticSearch.js.map +1 -0
- package/dist/storage/BackupManager.d.ts +58 -0
- package/dist/storage/BackupManager.d.ts.map +1 -0
- package/dist/storage/BackupManager.js +223 -0
- package/dist/storage/BackupManager.js.map +1 -0
- package/dist/storage/ConversationStorage.d.ts +341 -0
- package/dist/storage/ConversationStorage.d.ts.map +1 -0
- package/dist/storage/ConversationStorage.js +792 -0
- package/dist/storage/ConversationStorage.js.map +1 -0
- package/dist/storage/DeletionService.d.ts +70 -0
- package/dist/storage/DeletionService.d.ts.map +1 -0
- package/dist/storage/DeletionService.js +253 -0
- package/dist/storage/DeletionService.js.map +1 -0
- package/dist/storage/GlobalIndex.d.ts +133 -0
- package/dist/storage/GlobalIndex.d.ts.map +1 -0
- package/dist/storage/GlobalIndex.js +310 -0
- package/dist/storage/GlobalIndex.js.map +1 -0
- package/dist/storage/SQLiteManager.d.ts +114 -0
- package/dist/storage/SQLiteManager.d.ts.map +1 -0
- package/dist/storage/SQLiteManager.js +636 -0
- package/dist/storage/SQLiteManager.js.map +1 -0
- package/dist/storage/migrations.d.ts +54 -0
- package/dist/storage/migrations.d.ts.map +1 -0
- package/dist/storage/migrations.js +285 -0
- package/dist/storage/migrations.js.map +1 -0
- package/dist/storage/schema.sql +436 -0
- package/dist/tools/ToolDefinitions.d.ts +946 -0
- package/dist/tools/ToolDefinitions.d.ts.map +1 -0
- package/dist/tools/ToolDefinitions.js +937 -0
- package/dist/tools/ToolDefinitions.js.map +1 -0
- package/dist/tools/ToolHandlers.d.ts +791 -0
- package/dist/tools/ToolHandlers.d.ts.map +1 -0
- package/dist/tools/ToolHandlers.js +3262 -0
- package/dist/tools/ToolHandlers.js.map +1 -0
- package/dist/types/ToolTypes.d.ts +824 -0
- package/dist/types/ToolTypes.d.ts.map +1 -0
- package/dist/types/ToolTypes.js +6 -0
- package/dist/types/ToolTypes.js.map +1 -0
- package/dist/utils/Logger.d.ts +70 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +131 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/McpConfig.d.ts +54 -0
- package/dist/utils/McpConfig.d.ts.map +1 -0
- package/dist/utils/McpConfig.js +136 -0
- package/dist/utils/McpConfig.js.map +1 -0
- package/dist/utils/ProjectMigration.d.ts +82 -0
- package/dist/utils/ProjectMigration.d.ts.map +1 -0
- package/dist/utils/ProjectMigration.js +416 -0
- package/dist/utils/ProjectMigration.js.map +1 -0
- package/dist/utils/constants.d.ts +75 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +105 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/safeJson.d.ts +37 -0
- package/dist/utils/safeJson.d.ts.map +1 -0
- package/dist/utils/safeJson.js +48 -0
- package/dist/utils/safeJson.js.map +1 -0
- package/dist/utils/sanitization.d.ts +45 -0
- package/dist/utils/sanitization.d.ts.map +1 -0
- package/dist/utils/sanitization.js +153 -0
- package/dist/utils/sanitization.js.map +1 -0
- package/dist/utils/worktree.d.ts +15 -0
- package/dist/utils/worktree.d.ts.map +1 -0
- package/dist/utils/worktree.js +86 -0
- package/dist/utils/worktree.js.map +1 -0
- package/package.json +98 -0
- package/scripts/changelog-check.sh +62 -0
- package/scripts/check-node.js +17 -0
- package/scripts/dev-config.js +56 -0
- package/scripts/postinstall.js +117 -0
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Handlers - Implementation of all 22 tools for the cccmemory MCP server.
|
|
3
|
+
*
|
|
4
|
+
* This class provides the implementation for all MCP (Model Context Protocol) tools
|
|
5
|
+
* that allow Claude to interact with conversation history and memory.
|
|
6
|
+
*
|
|
7
|
+
* Tools are organized into categories:
|
|
8
|
+
* - Indexing: index_conversations
|
|
9
|
+
* - Search: search_conversations, searchDecisions, search_mistakes
|
|
10
|
+
* - File Context: check_before_modify, get_file_evolution
|
|
11
|
+
* - History: get_tool_history, link_commits_to_conversations
|
|
12
|
+
* - Discovery: find_similar_sessions, get_requirements
|
|
13
|
+
* - Recall: recall_and_apply
|
|
14
|
+
* - Documentation: generate_documentation
|
|
15
|
+
* - Migration: discover_old_conversations, migrate_project
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const handlers = new ToolHandlers(memory, db, '/path/to/projects');
|
|
20
|
+
* const result = await handlers.indexConversations({
|
|
21
|
+
* project_path: '/Users/me/my-project'
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import { ConversationMemory } from "../ConversationMemory.js";
|
|
26
|
+
import type { SQLiteManager } from "../storage/SQLiteManager.js";
|
|
27
|
+
import type * as Types from "../types/ToolTypes.js";
|
|
28
|
+
/**
|
|
29
|
+
* Pagination Patterns:
|
|
30
|
+
*
|
|
31
|
+
* This codebase uses two different pagination patterns based on data source:
|
|
32
|
+
*
|
|
33
|
+
* 1. SQL-based pagination (fetch+1):
|
|
34
|
+
* - Fetch limit+1 records from database
|
|
35
|
+
* - hasMore = results.length > limit
|
|
36
|
+
* - Slice to limit if hasMore is true
|
|
37
|
+
* - Use case: Single-database SQL queries (searchMistakes, linkCommitsToConversations)
|
|
38
|
+
* - Advantage: Efficient, minimal data transfer
|
|
39
|
+
*
|
|
40
|
+
* 2. In-memory pagination (slice):
|
|
41
|
+
* - Fetch all needed results (or limit+offset)
|
|
42
|
+
* - Slice to get paginated subset: results.slice(offset, offset + limit)
|
|
43
|
+
* - has_more = offset + limit < results.length
|
|
44
|
+
* - Use case: Semantic search, cross-project aggregation
|
|
45
|
+
* - Advantage: Allows sorting/filtering before pagination
|
|
46
|
+
*
|
|
47
|
+
* Both patterns are correct and optimized for their respective use cases.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Tool handlers for the cccmemory MCP server.
|
|
51
|
+
*
|
|
52
|
+
* Provides methods for indexing, searching, and managing conversation history.
|
|
53
|
+
*/
|
|
54
|
+
export declare class ToolHandlers {
|
|
55
|
+
private memory;
|
|
56
|
+
private db;
|
|
57
|
+
private migration;
|
|
58
|
+
private lastAutoIndex;
|
|
59
|
+
private autoIndexPromise;
|
|
60
|
+
private readonly AUTO_INDEX_COOLDOWN;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new ToolHandlers instance.
|
|
63
|
+
*
|
|
64
|
+
* @param memory - ConversationMemory instance for core operations
|
|
65
|
+
* @param db - SQLiteManager for database access
|
|
66
|
+
* @param projectsDir - Optional directory for storing project data
|
|
67
|
+
*/
|
|
68
|
+
constructor(memory: ConversationMemory, db: SQLiteManager, projectsDir?: string);
|
|
69
|
+
private resolveProjectPath;
|
|
70
|
+
private resolveOptionalProjectPath;
|
|
71
|
+
private inferProjectPathFromMessages;
|
|
72
|
+
/**
|
|
73
|
+
* Automatically run incremental indexing if cooldown has expired.
|
|
74
|
+
* Uses a mutex (autoIndexPromise) to coalesce concurrent calls and prevent stampede.
|
|
75
|
+
* This ensures search results include recent conversations without
|
|
76
|
+
* requiring manual indexing.
|
|
77
|
+
*/
|
|
78
|
+
private maybeAutoIndex;
|
|
79
|
+
/**
|
|
80
|
+
* Index conversation history for a project.
|
|
81
|
+
*
|
|
82
|
+
* Parses conversation files from Claude Code's conversation history, extracts
|
|
83
|
+
* decisions, mistakes, and requirements, links git commits, and generates
|
|
84
|
+
* semantic embeddings for search.
|
|
85
|
+
*
|
|
86
|
+
* @param args - Indexing arguments:
|
|
87
|
+
* - `project_path`: Path to the project (defaults to cwd)
|
|
88
|
+
* - `session_id`: Optional specific session to index
|
|
89
|
+
* - `include_thinking`: Include thinking blocks (default: false)
|
|
90
|
+
* - `enable_git`: Enable git integration (default: true)
|
|
91
|
+
* - `exclude_mcp_conversations`: Exclude MCP tool conversations (default: 'self-only')
|
|
92
|
+
* - `exclude_mcp_servers`: List of specific MCP servers to exclude
|
|
93
|
+
*
|
|
94
|
+
* @returns Result containing:
|
|
95
|
+
* - `success`: Whether indexing succeeded
|
|
96
|
+
* - `stats`: Counts of conversations, messages, decisions, etc.
|
|
97
|
+
* - `indexed_folders`: List of folders that were indexed
|
|
98
|
+
* - `database_path`: Path to the SQLite database
|
|
99
|
+
* - `embeddings_generated`: Whether embeddings were created
|
|
100
|
+
* - `embedding_error`: Error message if embeddings failed
|
|
101
|
+
* - `message`: Human-readable status message
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const result = await handlers.indexConversations({
|
|
106
|
+
* project_path: '/Users/me/my-project',
|
|
107
|
+
* enable_git: true,
|
|
108
|
+
* exclude_mcp_conversations: 'self-only'
|
|
109
|
+
* });
|
|
110
|
+
* console.error(result.message); // "Indexed 5 conversation(s) with 245 messages..."
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
indexConversations(args: Record<string, unknown>): Promise<Types.IndexConversationsResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Helper method to filter MCP conversations from parse results.
|
|
116
|
+
* Extracted to be usable in both the main indexConversations and project-specific indexing.
|
|
117
|
+
*/
|
|
118
|
+
private filterMcpConversationsHelper;
|
|
119
|
+
/**
|
|
120
|
+
* Search conversation history using natural language queries.
|
|
121
|
+
*
|
|
122
|
+
* Uses semantic search with embeddings if available, otherwise falls back
|
|
123
|
+
* to full-text search. Returns relevant messages with context and similarity scores.
|
|
124
|
+
*
|
|
125
|
+
* @param args - Search arguments:
|
|
126
|
+
* - `query`: Natural language search query (required)
|
|
127
|
+
* - `limit`: Maximum number of results (default: 10)
|
|
128
|
+
* - `date_range`: Optional [start_timestamp, end_timestamp] filter
|
|
129
|
+
*
|
|
130
|
+
* @returns Search results containing:
|
|
131
|
+
* - `query`: The search query used
|
|
132
|
+
* - `results`: Array of matching messages with:
|
|
133
|
+
* - `conversation_id`: Conversation containing the message
|
|
134
|
+
* - `message_id`: Message identifier
|
|
135
|
+
* - `timestamp`: When the message was created
|
|
136
|
+
* - `similarity`: Relevance score (0-1)
|
|
137
|
+
* - `snippet`: Text excerpt from the message
|
|
138
|
+
* - `git_branch`: Git branch at the time
|
|
139
|
+
* - `message_type`: Type of message
|
|
140
|
+
* - `role`: Message role (user/assistant)
|
|
141
|
+
* - `total_found`: Number of results returned
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* const result = await handlers.searchConversations({
|
|
146
|
+
* query: 'authentication bug fix',
|
|
147
|
+
* limit: 5
|
|
148
|
+
* });
|
|
149
|
+
* result.results.forEach(r => {
|
|
150
|
+
* console.error(`${r.similarity.toFixed(2)}: ${r.snippet}`);
|
|
151
|
+
* });
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
searchConversations(args: Record<string, unknown>): Promise<Types.SearchConversationsResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Find decisions made about a specific topic, file, or component.
|
|
157
|
+
*
|
|
158
|
+
* Searches through extracted decisions to find relevant architectural choices,
|
|
159
|
+
* technical decisions, and their rationale. Shows alternatives considered and
|
|
160
|
+
* rejected approaches.
|
|
161
|
+
*
|
|
162
|
+
* @param args - Decision search arguments:
|
|
163
|
+
* - `query`: Topic or keyword to search for (required)
|
|
164
|
+
* - `file_path`: Optional filter for decisions related to a specific file
|
|
165
|
+
* - `limit`: Maximum number of results (default: 10)
|
|
166
|
+
*
|
|
167
|
+
* @returns Decision search results containing:
|
|
168
|
+
* - `query`: The search query used
|
|
169
|
+
* - `file_path`: File filter if applied
|
|
170
|
+
* - `decisions`: Array of matching decisions with:
|
|
171
|
+
* - `decision_id`: Decision identifier
|
|
172
|
+
* - `decision_text`: The decision that was made
|
|
173
|
+
* - `rationale`: Why this decision was made
|
|
174
|
+
* - `alternatives_considered`: Other options that were considered
|
|
175
|
+
* - `rejected_reasons`: Why alternatives were rejected
|
|
176
|
+
* - `context`: Context in which the decision was made
|
|
177
|
+
* - `related_files`: Files affected by this decision
|
|
178
|
+
* - `related_commits`: Git commits implementing this decision
|
|
179
|
+
* - `timestamp`: When the decision was made
|
|
180
|
+
* - `similarity`: Relevance score
|
|
181
|
+
* - `total_found`: Number of decisions returned
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const result = await handlers.getDecisions({
|
|
186
|
+
* query: 'database',
|
|
187
|
+
* file_path: 'src/storage/SQLiteManager.ts',
|
|
188
|
+
* limit: 5
|
|
189
|
+
* });
|
|
190
|
+
* result.decisions.forEach(d => {
|
|
191
|
+
* console.error(`Decision: ${d.decision_text}`);
|
|
192
|
+
* console.error(`Rationale: ${d.rationale}`);
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
getDecisions(args: Record<string, unknown>): Promise<Types.GetDecisionsResponse>;
|
|
197
|
+
/**
|
|
198
|
+
* Check important context before modifying a file.
|
|
199
|
+
*
|
|
200
|
+
* Shows recent changes, related decisions, commits, and past mistakes to avoid
|
|
201
|
+
* when working on a file. Use this before making significant changes to understand
|
|
202
|
+
* the file's history and context.
|
|
203
|
+
*
|
|
204
|
+
* @param args - Check arguments:
|
|
205
|
+
* - `file_path`: Path to the file you want to modify (required)
|
|
206
|
+
*
|
|
207
|
+
* @returns Context information containing:
|
|
208
|
+
* - `file_path`: The file being checked
|
|
209
|
+
* - `warning`: Warning message if important context found
|
|
210
|
+
* - `recent_changes`: Recent edits and commits to this file
|
|
211
|
+
* - `edits`: Recent file edits with timestamps and conversation IDs
|
|
212
|
+
* - `commits`: Recent git commits affecting this file
|
|
213
|
+
* - `related_decisions`: Decisions that affect this file
|
|
214
|
+
* - `mistakes_to_avoid`: Past mistakes related to this file
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const context = await handlers.checkBeforeModify({
|
|
219
|
+
* file_path: 'src/storage/SQLiteManager.ts'
|
|
220
|
+
* });
|
|
221
|
+
* console.error(context.warning);
|
|
222
|
+
* console.error(`${context.related_decisions.length} decisions affect this file`);
|
|
223
|
+
* console.error(`${context.mistakes_to_avoid.length} mistakes to avoid`);
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
checkBeforeModify(args: Record<string, unknown>): Promise<Types.CheckBeforeModifyResponse>;
|
|
227
|
+
/**
|
|
228
|
+
* Show complete timeline of changes to a file.
|
|
229
|
+
*
|
|
230
|
+
* Returns a chronological timeline of all edits, commits, and related decisions
|
|
231
|
+
* for a specific file across all conversations and git history.
|
|
232
|
+
*
|
|
233
|
+
* @param args - Evolution arguments:
|
|
234
|
+
* - `file_path`: Path to the file (required)
|
|
235
|
+
* - `include_decisions`: Include related decisions (default: true)
|
|
236
|
+
* - `include_commits`: Include git commits (default: true)
|
|
237
|
+
*
|
|
238
|
+
* @returns File evolution timeline containing:
|
|
239
|
+
* - `file_path`: The file being analyzed
|
|
240
|
+
* - `total_edits`: Total number of edits to this file
|
|
241
|
+
* - `timeline`: Chronological array of events (most recent first):
|
|
242
|
+
* - `type`: Event type ('edit', 'commit', or 'decision')
|
|
243
|
+
* - `timestamp`: When the event occurred
|
|
244
|
+
* - `data`: Event-specific data (conversation_id, commit hash, decision text, etc.)
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* const evolution = await handlers.getFileEvolution({
|
|
249
|
+
* file_path: 'src/index.ts',
|
|
250
|
+
* include_decisions: true,
|
|
251
|
+
* include_commits: true
|
|
252
|
+
* });
|
|
253
|
+
* console.error(`${evolution.total_edits} edits across ${evolution.timeline.length} events`);
|
|
254
|
+
* evolution.timeline.forEach(event => {
|
|
255
|
+
* console.error(`${event.timestamp}: ${event.type}`);
|
|
256
|
+
* });
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
getFileEvolution(args: Record<string, unknown>): Promise<Types.GetFileEvolutionResponse>;
|
|
260
|
+
/**
|
|
261
|
+
* Link git commits to the conversations where they were made or discussed.
|
|
262
|
+
*
|
|
263
|
+
* Finds git commits that are associated with specific conversations, showing
|
|
264
|
+
* which code changes were made during which conversations. Helps answer "WHY
|
|
265
|
+
* was this code changed?"
|
|
266
|
+
*
|
|
267
|
+
* @param args - Link arguments:
|
|
268
|
+
* - `query`: Optional search query for commit messages
|
|
269
|
+
* - `conversation_id`: Optional filter for specific conversation
|
|
270
|
+
* - `limit`: Maximum number of commits (default: 20)
|
|
271
|
+
*
|
|
272
|
+
* @returns Commit links containing:
|
|
273
|
+
* - `query`: Search query if provided
|
|
274
|
+
* - `conversation_id`: Conversation filter if provided
|
|
275
|
+
* - `commits`: Array of linked commits with:
|
|
276
|
+
* - `hash`: Short commit hash (7 chars)
|
|
277
|
+
* - `full_hash`: Full commit hash
|
|
278
|
+
* - `message`: Commit message
|
|
279
|
+
* - `author`: Commit author
|
|
280
|
+
* - `timestamp`: When commit was made
|
|
281
|
+
* - `branch`: Git branch
|
|
282
|
+
* - `files_changed`: List of files changed
|
|
283
|
+
* - `conversation_id`: Conversation where this was discussed/made
|
|
284
|
+
* - `total_found`: Number of commits returned
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const links = await handlers.linkCommitsToConversations({
|
|
289
|
+
* query: 'fix authentication',
|
|
290
|
+
* limit: 10
|
|
291
|
+
* });
|
|
292
|
+
* links.commits.forEach(c => {
|
|
293
|
+
* console.error(`${c.hash}: ${c.message}`);
|
|
294
|
+
* console.error(` Conversation: ${c.conversation_id}`);
|
|
295
|
+
* });
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
linkCommitsToConversations(args: Record<string, unknown>): Promise<Types.LinkCommitsToConversationsResponse>;
|
|
299
|
+
/**
|
|
300
|
+
* Find past mistakes to avoid repeating them.
|
|
301
|
+
*
|
|
302
|
+
* Searches through extracted mistakes to find documented errors, bugs, and
|
|
303
|
+
* wrong approaches. Shows what went wrong and how it was corrected.
|
|
304
|
+
*
|
|
305
|
+
* @param args - Mistake search arguments:
|
|
306
|
+
* - `query`: Search query for mistakes (required)
|
|
307
|
+
* - `mistake_type`: Optional filter by type (logic_error, wrong_approach, misunderstanding, tool_error, syntax_error)
|
|
308
|
+
* - `limit`: Maximum number of results (default: 10)
|
|
309
|
+
*
|
|
310
|
+
* @returns Mistake search results containing:
|
|
311
|
+
* - `query`: Search query used
|
|
312
|
+
* - `mistake_type`: Type filter if applied
|
|
313
|
+
* - `mistakes`: Array of matching mistakes with:
|
|
314
|
+
* - `mistake_id`: Mistake identifier
|
|
315
|
+
* - `mistake_type`: Type of mistake
|
|
316
|
+
* - `what_went_wrong`: Description of the mistake
|
|
317
|
+
* - `correction`: How it was fixed
|
|
318
|
+
* - `user_correction_message`: User's correction message if available
|
|
319
|
+
* - `files_affected`: List of files involved
|
|
320
|
+
* - `timestamp`: When the mistake occurred
|
|
321
|
+
* - `total_found`: Number of mistakes returned
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const mistakes = await handlers.searchMistakes({
|
|
326
|
+
* query: 'database transaction',
|
|
327
|
+
* mistake_type: 'logic_error',
|
|
328
|
+
* limit: 5
|
|
329
|
+
* });
|
|
330
|
+
* mistakes.mistakes.forEach(m => {
|
|
331
|
+
* console.error(`${m.mistake_type}: ${m.what_went_wrong}`);
|
|
332
|
+
* console.error(`Fix: ${m.correction}`);
|
|
333
|
+
* });
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
searchMistakes(args: Record<string, unknown>): Promise<Types.SearchMistakesResponse>;
|
|
337
|
+
/**
|
|
338
|
+
* Look up requirements and constraints for a component or feature.
|
|
339
|
+
*
|
|
340
|
+
* Finds documented requirements, dependencies, performance constraints, and
|
|
341
|
+
* compatibility requirements that affect a component or feature.
|
|
342
|
+
*
|
|
343
|
+
* @param args - Requirements search arguments:
|
|
344
|
+
* - `component`: Component or feature name (required)
|
|
345
|
+
* - `type`: Optional filter by requirement type (dependency, performance, compatibility, business)
|
|
346
|
+
*
|
|
347
|
+
* @returns Requirements results containing:
|
|
348
|
+
* - `component`: Component searched
|
|
349
|
+
* - `type`: Type filter if applied
|
|
350
|
+
* - `requirements`: Array of matching requirements with:
|
|
351
|
+
* - `requirement_id`: Requirement identifier
|
|
352
|
+
* - `type`: Requirement type
|
|
353
|
+
* - `description`: Requirement description
|
|
354
|
+
* - `rationale`: Why this requirement exists
|
|
355
|
+
* - `affects_components`: List of affected components
|
|
356
|
+
* - `timestamp`: When requirement was documented
|
|
357
|
+
* - `total_found`: Number of requirements returned
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* const reqs = await handlers.getRequirements({
|
|
362
|
+
* component: 'authentication',
|
|
363
|
+
* type: 'security'
|
|
364
|
+
* });
|
|
365
|
+
* reqs.requirements.forEach(r => {
|
|
366
|
+
* console.error(`${r.type}: ${r.description}`);
|
|
367
|
+
* console.error(`Rationale: ${r.rationale}`);
|
|
368
|
+
* });
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
getRequirements(args: Record<string, unknown>): Promise<Types.GetRequirementsResponse>;
|
|
372
|
+
/**
|
|
373
|
+
* Query history of tool uses (bash commands, file edits, reads, etc.) with pagination and filtering.
|
|
374
|
+
*
|
|
375
|
+
* Shows what tools were used during conversations and their results. Useful
|
|
376
|
+
* for understanding what commands were run, what files were edited, and
|
|
377
|
+
* whether operations succeeded or failed.
|
|
378
|
+
*
|
|
379
|
+
* @param args - Tool history arguments:
|
|
380
|
+
* - `tool_name`: Optional filter by tool name (Bash, Edit, Write, Read)
|
|
381
|
+
* - `file_path`: Optional filter by file path
|
|
382
|
+
* - `limit`: Maximum number of results (default: 20)
|
|
383
|
+
* - `offset`: Skip N results for pagination (default: 0)
|
|
384
|
+
* - `include_content`: Include tool content in response (default: false for security, set true to include)
|
|
385
|
+
* - `max_content_length`: Maximum characters per content field (default: 500)
|
|
386
|
+
* - `date_range`: Filter by timestamp range [start, end]
|
|
387
|
+
* - `conversation_id`: Filter by specific conversation
|
|
388
|
+
* - `errors_only`: Show only failed tool uses (default: false)
|
|
389
|
+
*
|
|
390
|
+
* @returns Tool history containing:
|
|
391
|
+
* - `tool_name`: Tool filter if applied
|
|
392
|
+
* - `file_path`: File filter if applied
|
|
393
|
+
* - `tool_uses`: Array of tool uses (may have truncated content)
|
|
394
|
+
* - `total_found`: Number of results returned in this page
|
|
395
|
+
* - `total_in_database`: Total matching records in database
|
|
396
|
+
* - `has_more`: Whether more results exist beyond current page
|
|
397
|
+
* - `offset`: Current offset position
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* // Get first page of Bash commands
|
|
402
|
+
* const page1 = await handlers.getToolHistory({
|
|
403
|
+
* tool_name: 'Bash',
|
|
404
|
+
* limit: 20,
|
|
405
|
+
* offset: 0
|
|
406
|
+
* });
|
|
407
|
+
*
|
|
408
|
+
* // Get metadata only (no content)
|
|
409
|
+
* const metadata = await handlers.getToolHistory({
|
|
410
|
+
* include_content: false,
|
|
411
|
+
* limit: 50
|
|
412
|
+
* });
|
|
413
|
+
*
|
|
414
|
+
* // Get errors from last 24 hours
|
|
415
|
+
* const errors = await handlers.getToolHistory({
|
|
416
|
+
* errors_only: true,
|
|
417
|
+
* date_range: [Date.now() - 86400000, Date.now()]
|
|
418
|
+
* });
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
getToolHistory(args: Record<string, unknown>): Promise<Types.GetToolHistoryResponse>;
|
|
422
|
+
/**
|
|
423
|
+
* Find conversations that dealt with similar topics or problems.
|
|
424
|
+
*
|
|
425
|
+
* Searches across all conversations to find ones that discussed similar topics,
|
|
426
|
+
* allowing you to learn from past work on similar problems.
|
|
427
|
+
*
|
|
428
|
+
* @param args - Similarity search arguments:
|
|
429
|
+
* - `query`: Description of the topic or problem (required)
|
|
430
|
+
* - `limit`: Maximum number of sessions (default: 5)
|
|
431
|
+
*
|
|
432
|
+
* @returns Similar sessions containing:
|
|
433
|
+
* - `query`: Search query used
|
|
434
|
+
* - `sessions`: Array of similar conversation sessions with:
|
|
435
|
+
* - `conversation_id`: Session identifier
|
|
436
|
+
* - `project_path`: Project path for this session
|
|
437
|
+
* - `first_message_at`: When the conversation started
|
|
438
|
+
* - `message_count`: Number of messages in the conversation
|
|
439
|
+
* - `git_branch`: Git branch at the time
|
|
440
|
+
* - `relevance_score`: Similarity score to the query
|
|
441
|
+
* - `relevant_messages`: Sample of relevant messages from this session
|
|
442
|
+
* - `total_found`: Number of sessions returned
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* const similar = await handlers.findSimilarSessions({
|
|
447
|
+
* query: 'implementing user authentication with JWT',
|
|
448
|
+
* limit: 3
|
|
449
|
+
* });
|
|
450
|
+
* similar.sessions.forEach(s => {
|
|
451
|
+
* console.error(`Session ${s.conversation_id} (${s.message_count} messages)`);
|
|
452
|
+
* console.error(`Relevance: ${s.relevance_score.toFixed(2)}`);
|
|
453
|
+
* console.error(`Messages: ${s.relevant_messages.length} relevant`);
|
|
454
|
+
* });
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
findSimilarSessions(args: Record<string, unknown>): Promise<Types.FindSimilarSessionsResponse>;
|
|
458
|
+
/**
|
|
459
|
+
* Recall relevant context and format for application to current work.
|
|
460
|
+
*
|
|
461
|
+
* This is a comprehensive context retrieval tool that searches across multiple
|
|
462
|
+
* data sources (conversations, decisions, mistakes, file changes, commits) and
|
|
463
|
+
* returns actionable suggestions for applying historical context to current work.
|
|
464
|
+
*
|
|
465
|
+
* @param args - Recall arguments:
|
|
466
|
+
* - `query`: What you're working on or need context for (required)
|
|
467
|
+
* - `context_types`: Types to recall (default: all types)
|
|
468
|
+
* - Options: "conversations", "decisions", "mistakes", "file_changes", "commits"
|
|
469
|
+
* - `file_path`: Optional filter for file-specific context
|
|
470
|
+
* - `date_range`: Optional [start_timestamp, end_timestamp] filter
|
|
471
|
+
* - `limit`: Maximum items per context type (default: 5)
|
|
472
|
+
*
|
|
473
|
+
* @returns Recalled context containing:
|
|
474
|
+
* - `query`: Search query used
|
|
475
|
+
* - `context_summary`: High-level summary of what was found
|
|
476
|
+
* - `recalled_context`: Structured context data:
|
|
477
|
+
* - `conversations`: Relevant past conversations
|
|
478
|
+
* - `decisions`: Related decisions with rationale
|
|
479
|
+
* - `mistakes`: Past mistakes to avoid
|
|
480
|
+
* - `file_changes`: File modification history
|
|
481
|
+
* - `commits`: Related git commits
|
|
482
|
+
* - `application_suggestions`: Actionable suggestions for applying this context
|
|
483
|
+
* - `total_items_found`: Total number of context items found
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```typescript
|
|
487
|
+
* const context = await handlers.recallAndApply({
|
|
488
|
+
* query: 'refactoring database connection pooling',
|
|
489
|
+
* context_types: ['decisions', 'mistakes', 'commits'],
|
|
490
|
+
* file_path: 'src/database/pool.ts',
|
|
491
|
+
* limit: 5
|
|
492
|
+
* });
|
|
493
|
+
* console.error(context.context_summary);
|
|
494
|
+
* context.application_suggestions.forEach(s => console.error(`- ${s}`));
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
recallAndApply(args: Record<string, unknown>): Promise<Types.RecallAndApplyResponse>;
|
|
498
|
+
/**
|
|
499
|
+
* Generate comprehensive project documentation by combining codebase analysis
|
|
500
|
+
* with conversation history.
|
|
501
|
+
*
|
|
502
|
+
* Creates documentation that shows WHAT exists in the code (via CODE-GRAPH-RAG-MCP)
|
|
503
|
+
* and WHY it was built that way (via conversation history). Requires CODE-GRAPH-RAG-MCP
|
|
504
|
+
* to be indexed first.
|
|
505
|
+
*
|
|
506
|
+
* @param args - Documentation generation arguments:
|
|
507
|
+
* - `project_path`: Path to the project (defaults to cwd)
|
|
508
|
+
* - `session_id`: Optional specific session to include
|
|
509
|
+
* - `scope`: Documentation scope (default: 'full')
|
|
510
|
+
* - 'full': Everything (architecture, decisions, quality)
|
|
511
|
+
* - 'architecture': Module structure and dependencies
|
|
512
|
+
* - 'decisions': Decision log with rationale
|
|
513
|
+
* - 'quality': Code quality insights
|
|
514
|
+
* - `module_filter`: Optional filter for specific module path (e.g., 'src/auth')
|
|
515
|
+
*
|
|
516
|
+
* @returns Documentation result containing:
|
|
517
|
+
* - `success`: Whether generation succeeded
|
|
518
|
+
* - `project_path`: Project that was documented
|
|
519
|
+
* - `scope`: Scope of documentation generated
|
|
520
|
+
* - `documentation`: Generated markdown documentation
|
|
521
|
+
* - `statistics`: Summary statistics:
|
|
522
|
+
* - `modules`: Number of modules documented
|
|
523
|
+
* - `decisions`: Number of decisions included
|
|
524
|
+
* - `mistakes`: Number of mistakes documented
|
|
525
|
+
* - `commits`: Number of commits referenced
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```typescript
|
|
529
|
+
* const doc = await handlers.generateDocumentation({
|
|
530
|
+
* project_path: '/Users/me/my-project',
|
|
531
|
+
* scope: 'full',
|
|
532
|
+
* module_filter: 'src/auth'
|
|
533
|
+
* });
|
|
534
|
+
* console.error(doc.documentation); // Markdown documentation
|
|
535
|
+
* console.error(`Documented ${doc.statistics.modules} modules`);
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
generateDocumentation(args: Record<string, unknown>): Promise<Types.GenerateDocumentationResponse>;
|
|
539
|
+
/**
|
|
540
|
+
* Discover old conversation folders that might contain conversation history
|
|
541
|
+
* for the current project.
|
|
542
|
+
*
|
|
543
|
+
* Searches through stored conversation folders to find potential matches for
|
|
544
|
+
* the current project path. Useful when project paths have changed (e.g., after
|
|
545
|
+
* moving or renaming a project directory).
|
|
546
|
+
*
|
|
547
|
+
* @param args - Discovery arguments:
|
|
548
|
+
* - `current_project_path`: Current project path (defaults to cwd)
|
|
549
|
+
*
|
|
550
|
+
* @returns Discovery results containing:
|
|
551
|
+
* - `success`: Whether discovery succeeded
|
|
552
|
+
* - `current_project_path`: Current project path searched for
|
|
553
|
+
* - `candidates`: Array of potential matches sorted by score:
|
|
554
|
+
* - `folder_name`: Name of the conversation folder
|
|
555
|
+
* - `folder_path`: Full path to the folder
|
|
556
|
+
* - `stored_project_path`: Original project path stored in conversations
|
|
557
|
+
* - `score`: Match score (higher is better match)
|
|
558
|
+
* - `stats`: Folder statistics:
|
|
559
|
+
* - `conversations`: Number of conversations in folder
|
|
560
|
+
* - `messages`: Number of messages in folder
|
|
561
|
+
* - `files`: Number of .jsonl files
|
|
562
|
+
* - `last_activity`: Timestamp of last activity
|
|
563
|
+
* - `message`: Human-readable status message
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```typescript
|
|
567
|
+
* const discovery = await handlers.discoverOldConversations({
|
|
568
|
+
* current_project_path: '/Users/me/projects/my-app'
|
|
569
|
+
* });
|
|
570
|
+
* console.error(discovery.message);
|
|
571
|
+
* discovery.candidates.forEach(c => {
|
|
572
|
+
* console.error(`Score ${c.score}: ${c.folder_name}`);
|
|
573
|
+
* console.error(` Original path: ${c.stored_project_path}`);
|
|
574
|
+
* console.error(` Stats: ${c.stats.conversations} conversations, ${c.stats.files} files`);
|
|
575
|
+
* });
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
discoverOldConversations(args: Record<string, unknown>): Promise<Types.DiscoverOldConversationsResponse>;
|
|
579
|
+
/**
|
|
580
|
+
* Migrate or merge conversation history from an old project path to a new one.
|
|
581
|
+
*
|
|
582
|
+
* Use this when a project has been moved or renamed to bring the conversation
|
|
583
|
+
* history along. Supports two modes: 'migrate' (move all files) or 'merge'
|
|
584
|
+
* (combine with existing files).
|
|
585
|
+
*
|
|
586
|
+
* @param args - Migration arguments:
|
|
587
|
+
* - `source_folder`: Source folder containing old conversations (required)
|
|
588
|
+
* - `old_project_path`: Original project path in the conversations (required)
|
|
589
|
+
* - `new_project_path`: New project path to update to (required)
|
|
590
|
+
* - `dry_run`: Preview changes without applying them (default: false)
|
|
591
|
+
* - `mode`: Migration mode (default: 'migrate')
|
|
592
|
+
* - 'migrate': Move all files from source to target
|
|
593
|
+
* - 'merge': Combine source files with existing target files
|
|
594
|
+
*
|
|
595
|
+
* @returns Migration result containing:
|
|
596
|
+
* - `success`: Whether migration succeeded
|
|
597
|
+
* - `source_folder`: Source folder path
|
|
598
|
+
* - `target_folder`: Target folder path (where files were copied)
|
|
599
|
+
* - `files_copied`: Number of files copied/migrated
|
|
600
|
+
* - `database_updated`: Whether database was updated with new paths
|
|
601
|
+
* - `backup_created`: Whether backup was created (always true for non-dry-run)
|
|
602
|
+
* - `message`: Human-readable status message
|
|
603
|
+
*
|
|
604
|
+
* @example
|
|
605
|
+
* ```typescript
|
|
606
|
+
* // First, preview with dry run
|
|
607
|
+
* const preview = await handlers.migrateProject({
|
|
608
|
+
* source_folder: '/path/to/old/conversations',
|
|
609
|
+
* old_project_path: '/old/path/to/project',
|
|
610
|
+
* new_project_path: '/new/path/to/project',
|
|
611
|
+
* dry_run: true
|
|
612
|
+
* });
|
|
613
|
+
* console.error(preview.message); // "Dry run: Would migrate X files..."
|
|
614
|
+
*
|
|
615
|
+
* // Then, execute the migration
|
|
616
|
+
* const result = await handlers.migrateProject({
|
|
617
|
+
* source_folder: '/path/to/old/conversations',
|
|
618
|
+
* old_project_path: '/old/path/to/project',
|
|
619
|
+
* new_project_path: '/new/path/to/project',
|
|
620
|
+
* dry_run: false,
|
|
621
|
+
* mode: 'migrate'
|
|
622
|
+
* });
|
|
623
|
+
* console.error(`Migrated ${result.files_copied} files`);
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
migrateProject(args: Record<string, unknown>): Promise<Types.MigrateProjectResponse>;
|
|
627
|
+
/**
|
|
628
|
+
* Forget conversations by topic/keywords.
|
|
629
|
+
*
|
|
630
|
+
* Searches for conversations matching the provided keywords and optionally deletes them.
|
|
631
|
+
* Creates automatic backup before deletion.
|
|
632
|
+
*
|
|
633
|
+
* @param args - Arguments:
|
|
634
|
+
* - `keywords`: Array of keywords/topics to search for
|
|
635
|
+
* - `project_path`: Path to the project (defaults to cwd)
|
|
636
|
+
* - `confirm`: Must be true to actually delete (default: false for preview)
|
|
637
|
+
*
|
|
638
|
+
* @returns Result containing:
|
|
639
|
+
* - `success`: Whether operation succeeded
|
|
640
|
+
* - `preview_mode`: Whether this was a preview (confirm=false)
|
|
641
|
+
* - `conversations_found`: Number of conversations matching keywords
|
|
642
|
+
* - `conversations_deleted`: Number of conversations actually deleted
|
|
643
|
+
* - `messages_deleted`: Number of messages deleted
|
|
644
|
+
* - `decisions_deleted`: Number of decisions deleted
|
|
645
|
+
* - `mistakes_deleted`: Number of mistakes deleted
|
|
646
|
+
* - `backup_path`: Path to backup file (if deletion occurred)
|
|
647
|
+
* - `conversation_summaries`: List of conversations with basic info
|
|
648
|
+
* - `message`: Human-readable status message
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```typescript
|
|
652
|
+
* // Preview what would be deleted
|
|
653
|
+
* const preview = await handlers.forgetByTopic({
|
|
654
|
+
* keywords: ['authentication', 'redesign'],
|
|
655
|
+
* confirm: false
|
|
656
|
+
* });
|
|
657
|
+
*
|
|
658
|
+
* // Actually delete after reviewing preview
|
|
659
|
+
* const result = await handlers.forgetByTopic({
|
|
660
|
+
* keywords: ['authentication', 'redesign'],
|
|
661
|
+
* confirm: true
|
|
662
|
+
* });
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
forgetByTopic(args: unknown): Promise<Types.ForgetByTopicResponse>;
|
|
666
|
+
/**
|
|
667
|
+
* Search for all context related to a specific file.
|
|
668
|
+
*
|
|
669
|
+
* Combines discussions, decisions, and mistakes related to a file
|
|
670
|
+
* in one convenient query.
|
|
671
|
+
*
|
|
672
|
+
* @param args - Search arguments with file_path
|
|
673
|
+
* @returns Combined file context from all sources
|
|
674
|
+
*/
|
|
675
|
+
searchByFile(args: Record<string, unknown>): Promise<Types.SearchByFileResponse>;
|
|
676
|
+
/**
|
|
677
|
+
* List recent conversation sessions.
|
|
678
|
+
*
|
|
679
|
+
* Provides an overview of recent sessions with basic stats.
|
|
680
|
+
*
|
|
681
|
+
* @param args - Query arguments with limit/offset
|
|
682
|
+
* @returns List of recent sessions with summaries
|
|
683
|
+
*/
|
|
684
|
+
listRecentSessions(args: Record<string, unknown>): Promise<Types.ListRecentSessionsResponse>;
|
|
685
|
+
/**
|
|
686
|
+
* Index all projects (Claude Code + Codex).
|
|
687
|
+
*
|
|
688
|
+
* Discovers and indexes all projects from both Claude Code and Codex,
|
|
689
|
+
* registering them in a global index for cross-project search.
|
|
690
|
+
*
|
|
691
|
+
* @param args - Indexing arguments
|
|
692
|
+
* @returns Summary of all indexed projects
|
|
693
|
+
*/
|
|
694
|
+
indexAllProjects(args: Record<string, unknown>): Promise<Types.IndexAllProjectsResponse>;
|
|
695
|
+
/**
|
|
696
|
+
* Search across all indexed projects.
|
|
697
|
+
*
|
|
698
|
+
* @param args - Search arguments
|
|
699
|
+
* @returns Search results from all projects
|
|
700
|
+
*/
|
|
701
|
+
searchAllConversations(args: Record<string, unknown>): Promise<Types.SearchAllConversationsResponse>;
|
|
702
|
+
/**
|
|
703
|
+
* Get decisions from all indexed projects.
|
|
704
|
+
*
|
|
705
|
+
* @param args - Query arguments
|
|
706
|
+
* @returns Decisions from all projects
|
|
707
|
+
*/
|
|
708
|
+
getAllDecisions(args: Record<string, unknown>): Promise<Types.GetAllDecisionsResponse>;
|
|
709
|
+
/**
|
|
710
|
+
* Search mistakes across all indexed projects.
|
|
711
|
+
*
|
|
712
|
+
* @param args - Search arguments
|
|
713
|
+
* @returns Mistakes from all projects
|
|
714
|
+
*/
|
|
715
|
+
searchAllMistakes(args: Record<string, unknown>): Promise<Types.SearchAllMistakesResponse>;
|
|
716
|
+
/**
|
|
717
|
+
* Store a fact, decision, or context in working memory.
|
|
718
|
+
*
|
|
719
|
+
* @param args - Remember arguments with key, value, context, tags, ttl
|
|
720
|
+
* @returns The stored memory item
|
|
721
|
+
*/
|
|
722
|
+
remember(args: Record<string, unknown>): Promise<Types.RememberResponse>;
|
|
723
|
+
/**
|
|
724
|
+
* Recall a specific memory item by key.
|
|
725
|
+
*
|
|
726
|
+
* @param args - Recall arguments with key
|
|
727
|
+
* @returns The recalled memory item or null
|
|
728
|
+
*/
|
|
729
|
+
recall(args: Record<string, unknown>): Promise<Types.RecallResponse>;
|
|
730
|
+
/**
|
|
731
|
+
* Search working memory semantically.
|
|
732
|
+
*
|
|
733
|
+
* @param args - Search arguments with query
|
|
734
|
+
* @returns Relevant memory items
|
|
735
|
+
*/
|
|
736
|
+
recallRelevant(args: Record<string, unknown>): Promise<Types.RecallRelevantResponse>;
|
|
737
|
+
/**
|
|
738
|
+
* List all items in working memory.
|
|
739
|
+
*
|
|
740
|
+
* @param args - List arguments with optional tags filter
|
|
741
|
+
* @returns All memory items
|
|
742
|
+
*/
|
|
743
|
+
listMemory(args: Record<string, unknown>): Promise<Types.ListMemoryResponse>;
|
|
744
|
+
/**
|
|
745
|
+
* Remove a memory item by key.
|
|
746
|
+
*
|
|
747
|
+
* @param args - Forget arguments with key
|
|
748
|
+
* @returns Success status
|
|
749
|
+
*/
|
|
750
|
+
forget(args: Record<string, unknown>): Promise<Types.ForgetResponse>;
|
|
751
|
+
/**
|
|
752
|
+
* Prepare a handoff document from the current session.
|
|
753
|
+
* Captures decisions, active files, pending tasks, and working memory.
|
|
754
|
+
*
|
|
755
|
+
* @param args - Handoff preparation arguments
|
|
756
|
+
* @returns The prepared handoff document
|
|
757
|
+
*/
|
|
758
|
+
prepareHandoff(args: Record<string, unknown>): Promise<Types.PrepareHandoffResponse>;
|
|
759
|
+
/**
|
|
760
|
+
* Resume from a handoff in a new session.
|
|
761
|
+
* Loads context from a previous session for continuity.
|
|
762
|
+
*
|
|
763
|
+
* @param args - Resume arguments
|
|
764
|
+
* @returns The resumed handoff context
|
|
765
|
+
*/
|
|
766
|
+
resumeFromHandoff(args: Record<string, unknown>): Promise<Types.ResumeFromHandoffResponse>;
|
|
767
|
+
/**
|
|
768
|
+
* List available handoffs for a project.
|
|
769
|
+
*
|
|
770
|
+
* @param args - List arguments
|
|
771
|
+
* @returns List of available handoffs
|
|
772
|
+
*/
|
|
773
|
+
listHandoffs(args: Record<string, unknown>): Promise<Types.ListHandoffsResponse>;
|
|
774
|
+
/**
|
|
775
|
+
* Get context to inject at the start of a new conversation.
|
|
776
|
+
* Combines handoffs, decisions, working memory, and file history.
|
|
777
|
+
*
|
|
778
|
+
* @param args - Context injection arguments
|
|
779
|
+
* @returns Structured context for injection
|
|
780
|
+
*/
|
|
781
|
+
getStartupContext(args: Record<string, unknown>): Promise<Types.GetStartupContextResponse>;
|
|
782
|
+
/**
|
|
783
|
+
* Inject relevant context based on the first message in a new conversation.
|
|
784
|
+
* Returns formatted markdown context for direct use.
|
|
785
|
+
*
|
|
786
|
+
* @param args - Injection arguments
|
|
787
|
+
* @returns Formatted context string
|
|
788
|
+
*/
|
|
789
|
+
injectRelevantContext(args: Record<string, unknown>): Promise<Types.InjectRelevantContextResponse>;
|
|
790
|
+
}
|
|
791
|
+
//# sourceMappingURL=ToolHandlers.d.ts.map
|