claude-code-workflow 6.3.26 → 6.3.28
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/.claude/CLAUDE.md +7 -1
- package/.claude/agents/action-planning-agent.md +1 -0
- package/.claude/agents/cli-discuss-agent.md +391 -0
- package/.claude/agents/cli-execution-agent.md +2 -0
- package/.claude/agents/cli-explore-agent.md +2 -1
- package/.claude/agents/cli-lite-planning-agent.md +1 -0
- package/.claude/agents/cli-planning-agent.md +1 -0
- package/.claude/agents/code-developer.md +1 -0
- package/.claude/agents/conceptual-planning-agent.md +2 -0
- package/.claude/agents/context-search-agent.md +1 -0
- package/.claude/agents/debug-explore-agent.md +2 -0
- package/.claude/agents/doc-generator.md +1 -0
- package/.claude/agents/issue-plan-agent.md +2 -1
- package/.claude/agents/issue-queue-agent.md +2 -1
- package/.claude/agents/memory-bridge.md +2 -0
- package/.claude/agents/test-context-search-agent.md +2 -0
- package/.claude/agents/test-fix-agent.md +1 -0
- package/.claude/agents/ui-design-agent.md +2 -0
- package/.claude/agents/universal-executor.md +1 -0
- package/.claude/commands/issue/execute.md +141 -163
- package/.claude/commands/workflow/lite-lite-lite.md +798 -0
- package/.claude/commands/workflow/multi-cli-plan.md +510 -0
- package/.claude/skills/ccw/SKILL.md +262 -372
- package/.claude/skills/ccw/command.json +547 -0
- package/.claude/skills/ccw-help/SKILL.md +46 -107
- package/.claude/skills/ccw-help/command.json +511 -0
- package/.claude/skills/skill-tuning/SKILL.md +303 -0
- package/.claude/skills/skill-tuning/phases/actions/action-abort.md +164 -0
- package/.claude/skills/skill-tuning/phases/actions/action-analyze-requirements.md +406 -0
- package/.claude/skills/skill-tuning/phases/actions/action-apply-fix.md +206 -0
- package/.claude/skills/skill-tuning/phases/actions/action-complete.md +195 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-agent.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-context.md +243 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-dataflow.md +318 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-docs.md +299 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-memory.md +269 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-token-consumption.md +200 -0
- package/.claude/skills/skill-tuning/phases/actions/action-gemini-analysis.md +322 -0
- package/.claude/skills/skill-tuning/phases/actions/action-generate-report.md +228 -0
- package/.claude/skills/skill-tuning/phases/actions/action-init.md +149 -0
- package/.claude/skills/skill-tuning/phases/actions/action-propose-fixes.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-verify.md +222 -0
- package/.claude/skills/skill-tuning/phases/orchestrator.md +377 -0
- package/.claude/skills/skill-tuning/phases/state-schema.md +378 -0
- package/.claude/skills/skill-tuning/specs/category-mappings.json +284 -0
- package/.claude/skills/skill-tuning/specs/dimension-mapping.md +212 -0
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +318 -0
- package/.claude/skills/skill-tuning/specs/quality-gates.md +263 -0
- package/.claude/skills/skill-tuning/specs/skill-authoring-principles.md +189 -0
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +1537 -0
- package/.claude/skills/skill-tuning/templates/diagnosis-report.md +153 -0
- package/.claude/skills/skill-tuning/templates/fix-proposal.md +204 -0
- package/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json +421 -0
- package/.claude/workflows/cli-tools-usage.md +0 -41
- package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +3 -1
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/data-aggregator.d.ts +2 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
- package/ccw/dist/core/data-aggregator.js +5 -2
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/lite-scanner.d.ts +2 -1
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +295 -6
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +5 -5
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/session-routes.js +166 -48
- package/ccw/dist/core/routes/session-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +87 -0
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.js +2 -2
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/scripts/IMPLEMENTATION-SUMMARY.md +226 -0
- package/ccw/scripts/QUICK-REFERENCE.md +135 -0
- package/ccw/scripts/README-memory-embedder.md +157 -0
- package/ccw/scripts/__pycache__/memory_embedder.cpython-313.pyc +0 -0
- package/ccw/scripts/__pycache__/test_memory_embedder.cpython-313-pytest-8.4.2.pyc +0 -0
- package/ccw/scripts/memory-embedder-example.ts +184 -0
- package/ccw/scripts/memory_embedder.py +428 -0
- package/ccw/scripts/test_memory_embedder.py +245 -0
- package/ccw/src/core/auth/csrf-middleware.ts +3 -1
- package/ccw/src/core/data-aggregator.ts +7 -2
- package/ccw/src/core/lite-scanner.ts +440 -6
- package/ccw/src/core/routes/codexlens/config-handlers.ts +12 -9
- package/ccw/src/core/routes/session-routes.ts +201 -48
- package/ccw/src/core/routes/system-routes.ts +102 -0
- package/ccw/src/core/server.ts +2 -2
- package/ccw/src/templates/dashboard-css/01-base.css +8 -0
- package/ccw/src/templates/dashboard-css/02-session.css +81 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +2442 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +157 -0
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +23 -0
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +38 -4
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +38 -13
- package/ccw/src/templates/dashboard-js/components/navigation.js +24 -4
- package/ccw/src/templates/dashboard-js/i18n.js +194 -6
- package/ccw/src/templates/dashboard-js/views/api-settings.js +32 -0
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +44 -3
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +303 -31
- package/ccw/src/templates/dashboard-js/views/history.js +44 -6
- package/ccw/src/templates/dashboard-js/views/home.js +1 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +54 -7
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +1817 -4
- package/ccw/src/templates/dashboard.html +5 -0
- package/package.json +2 -1
- package/.claude/skills/ccw/index/command-capabilities.json +0 -127
- package/.claude/skills/ccw/index/intent-rules.json +0 -136
- package/.claude/skills/ccw/index/workflow-chains.json +0 -451
- package/.claude/skills/ccw/phases/actions/bugfix.md +0 -218
- package/.claude/skills/ccw/phases/actions/coupled.md +0 -194
- package/.claude/skills/ccw/phases/actions/docs.md +0 -93
- package/.claude/skills/ccw/phases/actions/full.md +0 -154
- package/.claude/skills/ccw/phases/actions/issue.md +0 -201
- package/.claude/skills/ccw/phases/actions/rapid.md +0 -104
- package/.claude/skills/ccw/phases/actions/review-fix.md +0 -84
- package/.claude/skills/ccw/phases/actions/tdd.md +0 -66
- package/.claude/skills/ccw/phases/actions/ui.md +0 -79
- package/.claude/skills/ccw/phases/orchestrator.md +0 -435
- package/.claude/skills/ccw/specs/intent-classification.md +0 -336
- package/.claude/skills/ccw-help/index/all-agents.json +0 -82
- package/.claude/skills/ccw-help/index/all-commands.json +0 -882
- package/.claude/skills/ccw-help/index/by-category.json +0 -914
- package/.claude/skills/ccw-help/index/by-use-case.json +0 -896
- package/.claude/skills/ccw-help/index/command-relationships.json +0 -160
- package/.claude/skills/ccw-help/index/essential-commands.json +0 -112
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Memory Embedder
|
|
2
|
+
|
|
3
|
+
Bridge CCW to CodexLens semantic search by generating and searching embeddings for memory chunks.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Generate embeddings** for memory chunks using CodexLens's jina-embeddings-v2-base-code (768 dim)
|
|
8
|
+
- **Semantic search** across all memory types (core_memory, workflow, cli_history)
|
|
9
|
+
- **Status tracking** to monitor embedding progress
|
|
10
|
+
- **Batch processing** for efficient embedding generation
|
|
11
|
+
- **Restore commands** included in search results
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install numpy codexlens[semantic]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### 1. Check Status
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python scripts/memory_embedder.py status <db_path>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Example output:
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"total_chunks": 150,
|
|
31
|
+
"embedded_chunks": 100,
|
|
32
|
+
"pending_chunks": 50,
|
|
33
|
+
"by_type": {
|
|
34
|
+
"core_memory": {"total": 80, "embedded": 60, "pending": 20},
|
|
35
|
+
"workflow": {"total": 50, "embedded": 30, "pending": 20},
|
|
36
|
+
"cli_history": {"total": 20, "embedded": 10, "pending": 10}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Generate Embeddings
|
|
42
|
+
|
|
43
|
+
Embed all unembedded chunks:
|
|
44
|
+
```bash
|
|
45
|
+
python scripts/memory_embedder.py embed <db_path>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Embed specific source:
|
|
49
|
+
```bash
|
|
50
|
+
python scripts/memory_embedder.py embed <db_path> --source-id CMEM-20250101-120000
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Re-embed all chunks (force):
|
|
54
|
+
```bash
|
|
55
|
+
python scripts/memory_embedder.py embed <db_path> --force
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Adjust batch size (default 8):
|
|
59
|
+
```bash
|
|
60
|
+
python scripts/memory_embedder.py embed <db_path> --batch-size 16
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Example output:
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"success": true,
|
|
67
|
+
"chunks_processed": 50,
|
|
68
|
+
"chunks_failed": 0,
|
|
69
|
+
"elapsed_time": 12.34
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 3. Semantic Search
|
|
74
|
+
|
|
75
|
+
Basic search:
|
|
76
|
+
```bash
|
|
77
|
+
python scripts/memory_embedder.py search <db_path> "authentication flow"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Advanced search:
|
|
81
|
+
```bash
|
|
82
|
+
python scripts/memory_embedder.py search <db_path> "rate limiting" \
|
|
83
|
+
--top-k 5 \
|
|
84
|
+
--min-score 0.5 \
|
|
85
|
+
--type workflow
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Example output:
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"success": true,
|
|
92
|
+
"matches": [
|
|
93
|
+
{
|
|
94
|
+
"source_id": "WFS-20250101-auth",
|
|
95
|
+
"source_type": "workflow",
|
|
96
|
+
"chunk_index": 2,
|
|
97
|
+
"content": "Implemented JWT-based authentication...",
|
|
98
|
+
"score": 0.8542,
|
|
99
|
+
"restore_command": "ccw session resume WFS-20250101-auth"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Database Path
|
|
106
|
+
|
|
107
|
+
The database is located in CCW's storage directory:
|
|
108
|
+
|
|
109
|
+
- **Windows**: `%USERPROFILE%\.ccw\projects\<project-id>\core-memory\core_memory.db`
|
|
110
|
+
- **Linux/Mac**: `~/.ccw/projects/<project-id>/core-memory/core_memory.db`
|
|
111
|
+
|
|
112
|
+
Find your project's database:
|
|
113
|
+
```bash
|
|
114
|
+
ccw memory list # Shows project path
|
|
115
|
+
# Then look in: ~/.ccw/projects/<hashed-path>/core-memory/core_memory.db
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Integration with CCW
|
|
119
|
+
|
|
120
|
+
This script is designed to be called from CCW's TypeScript code:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { execSync } from 'child_process';
|
|
124
|
+
|
|
125
|
+
// Embed chunks
|
|
126
|
+
const result = execSync(
|
|
127
|
+
`python scripts/memory_embedder.py embed ${dbPath}`,
|
|
128
|
+
{ encoding: 'utf-8' }
|
|
129
|
+
);
|
|
130
|
+
const { success, chunks_processed } = JSON.parse(result);
|
|
131
|
+
|
|
132
|
+
// Search
|
|
133
|
+
const searchResult = execSync(
|
|
134
|
+
`python scripts/memory_embedder.py search ${dbPath} "${query}" --top-k 10`,
|
|
135
|
+
{ encoding: 'utf-8' }
|
|
136
|
+
);
|
|
137
|
+
const { matches } = JSON.parse(searchResult);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Performance
|
|
141
|
+
|
|
142
|
+
- **Embedding speed**: ~8 chunks/second (batch size 8)
|
|
143
|
+
- **Search speed**: ~0.1-0.5 seconds for 1000 chunks
|
|
144
|
+
- **Model loading**: ~0.8 seconds (cached after first use)
|
|
145
|
+
|
|
146
|
+
## Source Types
|
|
147
|
+
|
|
148
|
+
- `core_memory`: Strategic architectural context
|
|
149
|
+
- `workflow`: Session-based development history
|
|
150
|
+
- `cli_history`: Command execution logs
|
|
151
|
+
|
|
152
|
+
## Restore Commands
|
|
153
|
+
|
|
154
|
+
Search results include restore commands:
|
|
155
|
+
|
|
156
|
+
- **core_memory/cli_history**: `ccw memory export <source_id>`
|
|
157
|
+
- **workflow**: `ccw session resume <source_id>`
|
|
Binary file
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Using Memory Embedder from TypeScript
|
|
3
|
+
*
|
|
4
|
+
* This shows how to integrate the Python memory embedder script
|
|
5
|
+
* into CCW's TypeScript codebase.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
|
|
11
|
+
interface EmbedResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
chunks_processed: number;
|
|
14
|
+
chunks_failed: number;
|
|
15
|
+
elapsed_time: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface SearchMatch {
|
|
19
|
+
source_id: string;
|
|
20
|
+
source_type: 'core_memory' | 'workflow' | 'cli_history';
|
|
21
|
+
chunk_index: number;
|
|
22
|
+
content: string;
|
|
23
|
+
score: number;
|
|
24
|
+
restore_command: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface SearchResult {
|
|
28
|
+
success: boolean;
|
|
29
|
+
matches: SearchMatch[];
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface StatusResult {
|
|
34
|
+
total_chunks: number;
|
|
35
|
+
embedded_chunks: number;
|
|
36
|
+
pending_chunks: number;
|
|
37
|
+
by_type: Record<string, { total: number; embedded: number; pending: number }>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get path to memory embedder script
|
|
42
|
+
*/
|
|
43
|
+
function getEmbedderScript(): string {
|
|
44
|
+
return join(__dirname, 'memory_embedder.py');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Execute memory embedder command
|
|
49
|
+
*/
|
|
50
|
+
function execEmbedder(args: string[]): string {
|
|
51
|
+
const script = getEmbedderScript();
|
|
52
|
+
const command = `python "${script}" ${args.join(' ')}`;
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
return execSync(command, {
|
|
56
|
+
encoding: 'utf-8',
|
|
57
|
+
maxBuffer: 10 * 1024 * 1024 // 10MB buffer
|
|
58
|
+
});
|
|
59
|
+
} catch (error: any) {
|
|
60
|
+
// Try to parse error output as JSON
|
|
61
|
+
if (error.stdout) {
|
|
62
|
+
return error.stdout;
|
|
63
|
+
}
|
|
64
|
+
throw new Error(`Embedder failed: ${error.message}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generate embeddings for memory chunks
|
|
70
|
+
*/
|
|
71
|
+
export function embedChunks(
|
|
72
|
+
dbPath: string,
|
|
73
|
+
options: {
|
|
74
|
+
sourceId?: string;
|
|
75
|
+
batchSize?: number;
|
|
76
|
+
force?: boolean;
|
|
77
|
+
} = {}
|
|
78
|
+
): EmbedResult {
|
|
79
|
+
const args = ['embed', `"${dbPath}"`];
|
|
80
|
+
|
|
81
|
+
if (options.sourceId) {
|
|
82
|
+
args.push('--source-id', options.sourceId);
|
|
83
|
+
}
|
|
84
|
+
if (options.batchSize) {
|
|
85
|
+
args.push('--batch-size', String(options.batchSize));
|
|
86
|
+
}
|
|
87
|
+
if (options.force) {
|
|
88
|
+
args.push('--force');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const output = execEmbedder(args);
|
|
92
|
+
return JSON.parse(output);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Search memory chunks semantically
|
|
97
|
+
*/
|
|
98
|
+
export function searchMemory(
|
|
99
|
+
dbPath: string,
|
|
100
|
+
query: string,
|
|
101
|
+
options: {
|
|
102
|
+
topK?: number;
|
|
103
|
+
minScore?: number;
|
|
104
|
+
sourceType?: 'core_memory' | 'workflow' | 'cli_history';
|
|
105
|
+
} = {}
|
|
106
|
+
): SearchResult {
|
|
107
|
+
const args = ['search', `"${dbPath}"`, `"${query}"`];
|
|
108
|
+
|
|
109
|
+
if (options.topK) {
|
|
110
|
+
args.push('--top-k', String(options.topK));
|
|
111
|
+
}
|
|
112
|
+
if (options.minScore !== undefined) {
|
|
113
|
+
args.push('--min-score', String(options.minScore));
|
|
114
|
+
}
|
|
115
|
+
if (options.sourceType) {
|
|
116
|
+
args.push('--type', options.sourceType);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const output = execEmbedder(args);
|
|
120
|
+
return JSON.parse(output);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get embedding status
|
|
125
|
+
*/
|
|
126
|
+
export function getEmbeddingStatus(dbPath: string): StatusResult {
|
|
127
|
+
const args = ['status', `"${dbPath}"`];
|
|
128
|
+
const output = execEmbedder(args);
|
|
129
|
+
return JSON.parse(output);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// Example Usage
|
|
134
|
+
// ============================================================================
|
|
135
|
+
|
|
136
|
+
async function exampleUsage() {
|
|
137
|
+
const dbPath = join(process.env.HOME || '', '.ccw/projects/myproject/core-memory/core_memory.db');
|
|
138
|
+
|
|
139
|
+
// 1. Check status
|
|
140
|
+
console.log('Checking embedding status...');
|
|
141
|
+
const status = getEmbeddingStatus(dbPath);
|
|
142
|
+
console.log(`Total chunks: ${status.total_chunks}`);
|
|
143
|
+
console.log(`Embedded: ${status.embedded_chunks}`);
|
|
144
|
+
console.log(`Pending: ${status.pending_chunks}`);
|
|
145
|
+
|
|
146
|
+
// 2. Generate embeddings if needed
|
|
147
|
+
if (status.pending_chunks > 0) {
|
|
148
|
+
console.log('\nGenerating embeddings...');
|
|
149
|
+
const embedResult = embedChunks(dbPath, { batchSize: 16 });
|
|
150
|
+
console.log(`Processed: ${embedResult.chunks_processed}`);
|
|
151
|
+
console.log(`Time: ${embedResult.elapsed_time}s`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// 3. Search for relevant memories
|
|
155
|
+
console.log('\nSearching for authentication-related memories...');
|
|
156
|
+
const searchResult = searchMemory(dbPath, 'authentication flow', {
|
|
157
|
+
topK: 5,
|
|
158
|
+
minScore: 0.5
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
if (searchResult.success) {
|
|
162
|
+
console.log(`Found ${searchResult.matches.length} matches:`);
|
|
163
|
+
for (const match of searchResult.matches) {
|
|
164
|
+
console.log(`\n- ${match.source_id} (score: ${match.score})`);
|
|
165
|
+
console.log(` Type: ${match.source_type}`);
|
|
166
|
+
console.log(` Restore: ${match.restore_command}`);
|
|
167
|
+
console.log(` Content: ${match.content.substring(0, 100)}...`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 4. Search specific source type
|
|
172
|
+
console.log('\nSearching workflows only...');
|
|
173
|
+
const workflowSearch = searchMemory(dbPath, 'API implementation', {
|
|
174
|
+
sourceType: 'workflow',
|
|
175
|
+
topK: 3
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
console.log(`Found ${workflowSearch.matches.length} workflow matches`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Run example if executed directly
|
|
182
|
+
if (require.main === module) {
|
|
183
|
+
exampleUsage().catch(console.error);
|
|
184
|
+
}
|