claude-flow-novice 2.18.39 → 2.19.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/.claude/agents/SHARED_PROTOCOL.md +25 -1
- package/.claude/agents/cfn-dev-team/dev-ops/fly-io-specialist.md +418 -0
- package/.claude/agents/cfn-dev-team/developers/database/mem0-specialist.md +579 -0
- package/.claude/agents/cfn-dev-team/developers/database/memgraph-specialist.md +722 -0
- package/.claude/agents/cfn-dev-team/documentation/pseudocode.md +1 -1
- package/.claude/agents/cfn-dev-team/documentation/specification-agent.md +1 -1
- package/.claude/agents/cfn-dev-team/testers/tester.md +35 -0
- package/.claude/commands/{cfn-ruvector → cfn-codesearch}/cfn-codebase-reindex.md +4 -4
- package/.claude/commands/{cfn-ruvector → cfn-codesearch}/cfn-codebase-search.md +7 -7
- package/.claude/commands/{cfn-ruvector → cfn-codesearch}/cfn-detect-stale-docs.md +3 -3
- package/.claude/commands/{cfn-ruvector-search.md → cfn-codesearch-search.md} +7 -7
- package/.claude/commands/cfn-fix-errors.md +1 -1
- package/.claude/commands/cfn-loop-task.md +291 -291
- package/.claude/skills/{bulk-add-ruvector-instructions.sh → bulk-add-codesearch-instructions.sh} +12 -12
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/AGENT_INTEGRATION_PATTERNS.md +20 -20
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/AGENT_LIFECYCLE_INTEGRATION.md +11 -11
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/Cargo.toml +9 -4
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/EXTRACTION_EXAMPLES.md +6 -6
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/IMMEDIATE_ACTION_REQUIRED.md +9 -9
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/README.md +7 -7
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SCHEMA_V2_IMPLEMENTATION.md +1 -1
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SECURITY_IMPLEMENTATION.md +3 -3
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SECURITY_TESTING_COMPLETION.md +4 -4
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SKILL.md +31 -31
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/analyze-agent-failures.sh +11 -11
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/cfn-integration.sh +27 -27
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/index-code.sh +11 -11
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/index_all.sh +2 -2
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/ingest-agent-transcript.sh +10 -10
- package/.claude/skills/{cfn-local-ruvector-accelerator/init-local-ruvector.sh → cfn-codesearch/init-local-codesearch.sh} +16 -16
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/project-structure.md +10 -10
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/query-local.sh +6 -6
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/index.rs +233 -4
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/init.rs +18 -18
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/query.rs +64 -3
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/embeddings.rs +19 -5
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/lib.rs +6 -4
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/main.rs +35 -25
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/paths.rs +19 -13
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/query_v2.rs +3 -4
- package/.claude/skills/cfn-codesearch/src/store_pgvector.rs +301 -0
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/store_v2.rs +12 -1
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/test-agent-lifecycle-integration.sh +6 -6
- package/.claude/skills/{cfn-local-ruvector-accelerator/test-local-ruvector.sh → cfn-codesearch/test-local-codesearch.sh} +7 -7
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/test_query_api.sh +2 -2
- package/.claude/skills/cfn-epic-creator/SKILL.md +110 -2
- package/.claude/skills/cfn-epic-creator/invoke.sh +120 -1
- package/.claude/skills/cfn-mdap-context-injection/SKILL.md +2 -2
- package/.claude/skills/cfn-mdap-context-injection/inject.sh +21 -21
- package/package.json +11 -11
- package/readme/feature-status.md +405 -0
- package/.claude/agents/docker-ts-fixer.md +0 -65
- /package/.claude/agents/cfn-dev-team/{testing → testers}/test-validation-agent.md +0 -0
- /package/.claude/{agents/cfn-dev-team/utility → cfn-extras/agents}/context-curator.md +0 -0
- /package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-docker-expert.md +0 -0
- /package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-loops-cli-expert.md +0 -0
- /package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-redis-operations.md +0 -0
- /package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-system-expert.md +0 -0
- /package/.claude/{agents/csuite → cfn-extras/agents/custom-agents}/cto-agent.md +0 -0
- /package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/trigger-dev-expert.md +0 -0
- /package/.claude/{agents/cfn-dev-team/coordinators → cfn-extras/agents/deprecated-coordinators}/consensus-builder.md +0 -0
- /package/.claude/{agents/cfn-dev-team/coordinators → cfn-extras/agents/deprecated-coordinators}/multi-sprint-coordinator.md +0 -0
- /package/.claude/{agents → cfn-extras/agents/docker-team}/docker-coordinators/cfn-docker-v3-coordinator.md +0 -0
- /package/.claude/{agents/cfn-dev-team/dev-ops → cfn-extras/agents}/kubernetes-specialist.md +0 -0
- /package/.claude/{agents/cfn-dev-team/architecture → cfn-extras/agents}/planner.md +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/.claude/hooks/SessionStart-cfn-build-ruvector.sh +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/Cargo.toml.backup +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SECURITY_FINDINGS_SUMMARY.txt +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/EXECUTIVE_SUMMARY.txt +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/PHASE_4_QUERY_API.md +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/RUST_AST_EXTRACTOR_IMPLEMENTATION.md +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/TRANSACTION_MANAGEMENT.md +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/VALIDATION_FINDINGS.txt +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/embeddings_manager.py.backup +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/epic-ast-indexer.json +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/index/index.bin +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/index/metadata.json +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/index-code.sh.backup +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/query-agent-patterns.sh +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/requirements.txt +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/search_engine_v2.py.backup +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/sqlite_store.py.backup +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/cleanup.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/export.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/find.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/index_ast.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/index_modified.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/migration.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/mod.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/refs.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/reset.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/stats.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/extractors/mod.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/extractors/rust.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/extractors/rust_placeholder.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/extractors/text_fallback.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/extractors/typescript.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/extractors/typescript_full.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/main.rs.backup +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/migration.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/migration_backup.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/migration_tx.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/migration_v2.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/path_validator.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/query_api.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/schema_v2.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/search_engine.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/security_tests.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/sqlite_store.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/store_v2_backup.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/store_v2_fixed.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/store_v2_tx.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/test_schema.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/transaction_tests.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/test_ast_indexing.rs +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/test_schema.sql +0 -0
- /package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/test_schema_v2.sql +0 -0
package/.claude/skills/{bulk-add-ruvector-instructions.sh → bulk-add-codesearch-instructions.sh}
RENAMED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -eu
|
|
3
3
|
|
|
4
|
-
# Add
|
|
4
|
+
# Add CodeSearch instructions to all agent profiles with Post-Edit Pipeline
|
|
5
5
|
|
|
6
6
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
7
|
AGENT_DIR="${SCRIPT_DIR}/../agents/cfn-dev-team"
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# CodeSearch instruction block to add
|
|
10
10
|
RUVECTOR_BLOCK='
|
|
11
|
-
# IMPORTANT:
|
|
11
|
+
# IMPORTANT: CodeSearch Semantic Search (Before Making Changes)
|
|
12
12
|
# Before implementing any changes, ALWAYS query the codebase for similar patterns:
|
|
13
13
|
# /codebase-search "relevant search terms for your task" --top 5
|
|
14
14
|
# /codebase-search "error pattern or issue you'\''re fixing" --top 3
|
|
15
15
|
# Also query past errors and learnings:
|
|
16
|
-
# ./.claude/skills/cfn-
|
|
17
|
-
# ./.claude/skills/cfn-
|
|
16
|
+
# ./.claude/skills/cfn-codesearch-codebase-index/query-error-patterns.sh --task-description "Your task description"
|
|
17
|
+
# ./.claude/skills/cfn-codesearch-codebase-index/query-learnings.sh --task-description "Your task description" --category PATTERN
|
|
18
18
|
# This prevents duplicated work and leverages existing solutions.'
|
|
19
19
|
|
|
20
20
|
# Function to add instructions after post-edit pipeline section
|
|
21
|
-
|
|
21
|
+
add_codesearch_instructions() {
|
|
22
22
|
local file="$1"
|
|
23
23
|
local temp_file=$(mktemp)
|
|
24
24
|
|
|
25
|
-
# Check if file already has
|
|
26
|
-
if grep -q "
|
|
27
|
-
echo "⚠️ $(basename "$file") already has
|
|
25
|
+
# Check if file already has CodeSearch instructions
|
|
26
|
+
if grep -q "CodeSearch Semantic Search" "$file"; then
|
|
27
|
+
echo "⚠️ $(basename "$file") already has CodeSearch instructions"
|
|
28
28
|
rm -f "$temp_file"
|
|
29
29
|
return 0
|
|
30
30
|
fi
|
|
@@ -41,7 +41,7 @@ add_ruvector_instructions() {
|
|
|
41
41
|
{print}
|
|
42
42
|
' "$file" > "$temp_file"
|
|
43
43
|
mv "$temp_file" "$file"
|
|
44
|
-
echo "✅ Added
|
|
44
|
+
echo "✅ Added CodeSearch to $(basename "$file")"
|
|
45
45
|
return 1
|
|
46
46
|
else
|
|
47
47
|
rm -f "$temp_file"
|
|
@@ -50,7 +50,7 @@ add_ruvector_instructions() {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
# Process all agent files recursively
|
|
53
|
-
echo "🔄 Adding
|
|
53
|
+
echo "🔄 Adding CodeSearch instructions to agent profiles..."
|
|
54
54
|
echo ""
|
|
55
55
|
|
|
56
56
|
updated=0
|
|
@@ -64,7 +64,7 @@ while IFS= read -r -d '' agent_file; do
|
|
|
64
64
|
continue
|
|
65
65
|
fi
|
|
66
66
|
|
|
67
|
-
if
|
|
67
|
+
if add_codesearch_instructions "$agent_file"; then
|
|
68
68
|
((skipped++)) || true
|
|
69
69
|
else
|
|
70
70
|
((updated++)) || true
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Agent Integration Patterns for AST-Aware
|
|
1
|
+
# Agent Integration Patterns for AST-Aware CodeSearch
|
|
2
2
|
|
|
3
|
-
This document describes how agents can integrate with the AST-aware
|
|
3
|
+
This document describes how agents can integrate with the AST-aware CodeSearch indexer to achieve sub-50ms query performance for code intelligence tasks.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The AST-Aware
|
|
7
|
+
The AST-Aware CodeSearch Accelerator provides:
|
|
8
8
|
- Entity-based indexing (functions, structs, traits, etc.)
|
|
9
9
|
- Reference tracking (calls, imports, type usage)
|
|
10
10
|
- Vector embeddings for semantic search
|
|
@@ -15,11 +15,11 @@ The AST-Aware RuVector Accelerator provides:
|
|
|
15
15
|
### 1. Agent Setup
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
# Initialize
|
|
19
|
-
./target/release/local-
|
|
18
|
+
# Initialize CodeSearch in the project
|
|
19
|
+
./target/release/local-codesearch init
|
|
20
20
|
|
|
21
21
|
# Index the codebase
|
|
22
|
-
./target/release/local-
|
|
22
|
+
./target/release/local-codesearch index --path . --types rs,ts,tsx,js,jsx --force
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### 2. Query Patterns
|
|
@@ -28,7 +28,7 @@ The AST-Aware RuVector Accelerator provides:
|
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
# Find all functions that use the `Album` type
|
|
31
|
-
./target/release/local-
|
|
31
|
+
./target/release/local-codesearch find --kind function --uses-type Album
|
|
32
32
|
|
|
33
33
|
# Example SQL query behind the scenes:
|
|
34
34
|
SELECT e.* FROM entities e
|
|
@@ -40,10 +40,10 @@ WHERE e.kind = 'function' AND tu.type_name = 'Album';
|
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
# Find all functions that call `create_album`
|
|
43
|
-
./target/release/local-
|
|
43
|
+
./target/release/local-codesearch refs --target create_album --kind calls
|
|
44
44
|
|
|
45
45
|
# Exclude calls within the same module
|
|
46
|
-
./target/release/local-
|
|
46
|
+
./target/release/local-codesearch refs --target create_album --kind calls --exclude-module src/album/
|
|
47
47
|
|
|
48
48
|
# Example SQL query:
|
|
49
49
|
SELECT r.* FROM refs r
|
|
@@ -56,16 +56,16 @@ WHERE e.name = 'create_album' AND r.ref_kind = 'call'
|
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
58
|
# Step 1: Find all references to a function
|
|
59
|
-
./target/release/local-
|
|
59
|
+
./target/release/local-codesearch refs --target function_name
|
|
60
60
|
|
|
61
61
|
# Step 2: Find all implementations of a trait
|
|
62
|
-
./target/release/local-
|
|
62
|
+
./target/release/local-codesearch find --kind impl --implements Trait
|
|
63
63
|
|
|
64
64
|
# Step 3: Find types used in a module
|
|
65
|
-
./target/release/local-
|
|
65
|
+
./target/release/local-codesearch find --file-path src/module/ --kind struct
|
|
66
66
|
|
|
67
67
|
# Step 4: Verify no breaks after refactoring
|
|
68
|
-
./target/release/local-
|
|
68
|
+
./target/release/local-codesearch query "broken reference error" --threshold 0.9
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
### 3. Programmatic Integration
|
|
@@ -73,8 +73,8 @@ WHERE e.name = 'create_album' AND r.ref_kind = 'call'
|
|
|
73
73
|
Agents can integrate using the Rust API directly:
|
|
74
74
|
|
|
75
75
|
```rust
|
|
76
|
-
use
|
|
77
|
-
use
|
|
76
|
+
use local_codesearch::store_v2::StoreV2;
|
|
77
|
+
use local_codesearch::query_api::QueryEngine;
|
|
78
78
|
|
|
79
79
|
let store = StoreV2::new(&db_path)?;
|
|
80
80
|
let query_engine = QueryEngine::new(store);
|
|
@@ -238,18 +238,18 @@ Based on the current implementation:
|
|
|
238
238
|
|
|
239
239
|
```bash
|
|
240
240
|
# Check database health
|
|
241
|
-
./target/release/local-
|
|
241
|
+
./target/release/local-codesearch stats --detailed
|
|
242
242
|
|
|
243
243
|
# Rebuild index
|
|
244
|
-
./target/release/local-
|
|
244
|
+
./target/release/local-codesearch index --force
|
|
245
245
|
|
|
246
246
|
# Query optimization
|
|
247
|
-
sqlite3 .
|
|
247
|
+
sqlite3 .codesearch/index.db "EXPLAIN QUERY PLAN SELECT ..."
|
|
248
248
|
|
|
249
249
|
# Check embeddings
|
|
250
|
-
./target/release/local-
|
|
250
|
+
./target/release/local-codesearch query "test query" --format json
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
## Conclusion
|
|
254
254
|
|
|
255
|
-
The AST-Aware
|
|
255
|
+
The AST-Aware CodeSearch Accelerator provides a powerful foundation for agent-driven code intelligence. By leveraging entity-based indexing and structured queries, agents can achieve sub-50ms response times for complex code analysis tasks.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CodeSearch Agent Lifecycle Integration
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
The
|
|
5
|
+
The CodeSearch Agent Lifecycle Integration automatically captures and indexes agent execution data, enabling semantic search over historical agent decisions, tool usage patterns, and failure recovery strategies.
|
|
6
6
|
|
|
7
7
|
## Architecture
|
|
8
8
|
|
|
@@ -108,7 +108,7 @@ Search historical agent data for guidance on current tasks.
|
|
|
108
108
|
|
|
109
109
|
## Integration with cfn-subagent-stop.sh
|
|
110
110
|
|
|
111
|
-
The subagent stop hook automatically triggers
|
|
111
|
+
The subagent stop hook automatically triggers CodeSearch ingestion:
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
114
|
# cfn-subagent-stop.sh (excerpt)
|
|
@@ -121,8 +121,8 @@ if awk "BEGIN {exit !($AGENT_CONFIDENCE < 0.70)}"; then
|
|
|
121
121
|
AGENT_SUCCESS="false"
|
|
122
122
|
fi
|
|
123
123
|
|
|
124
|
-
# Call
|
|
125
|
-
./.claude/skills/cfn-local-
|
|
124
|
+
# Call CodeSearch ingestion
|
|
125
|
+
./.claude/skills/cfn-local-codesearch-accelerator/ingest-agent-transcript.sh \
|
|
126
126
|
--transcript "$TRANSCRIPT_ARCHIVE" \
|
|
127
127
|
--agent-id "$AGENT_ID" \
|
|
128
128
|
--agent-type "$AGENT_TYPE" \
|
|
@@ -283,9 +283,9 @@ sqlite3 "$DB_PATH" "DELETE FROM agent_failure_patterns WHERE occurrence_count <
|
|
|
283
283
|
|
|
284
284
|
### Log Management
|
|
285
285
|
|
|
286
|
-
|
|
287
|
-
- `.artifacts/logs/
|
|
288
|
-
- `.artifacts/logs/
|
|
286
|
+
CodeSearch ingestion logs are written to:
|
|
287
|
+
- `.artifacts/logs/codesearch-ingestion.log` - Transcript ingestion events
|
|
288
|
+
- `.artifacts/logs/codesearch-failure-analysis.log` - Failure pattern analysis
|
|
289
289
|
- `.artifacts/logs/subagent-lifecycle.log` - Hook execution logs
|
|
290
290
|
|
|
291
291
|
Rotate logs periodically:
|
|
@@ -305,14 +305,14 @@ tail -f .artifacts/logs/subagent-lifecycle.log
|
|
|
305
305
|
|
|
306
306
|
Verify script exists and is executable:
|
|
307
307
|
```bash
|
|
308
|
-
ls -l .claude/skills/cfn-local-
|
|
308
|
+
ls -l .claude/skills/cfn-local-codesearch-accelerator/ingest-agent-transcript.sh
|
|
309
309
|
```
|
|
310
310
|
|
|
311
311
|
### No patterns found
|
|
312
312
|
|
|
313
313
|
Run failure analysis manually:
|
|
314
314
|
```bash
|
|
315
|
-
./.claude/skills/cfn-local-
|
|
315
|
+
./.claude/skills/cfn-local-codesearch-accelerator/analyze-agent-failures.sh --days 30
|
|
316
316
|
```
|
|
317
317
|
|
|
318
318
|
Check database tables exist:
|
|
@@ -337,5 +337,5 @@ Run with broader query:
|
|
|
337
337
|
|
|
338
338
|
- Analysis document: `docs/RUVECTOR_INTEGRATION_ANALYSIS.md`
|
|
339
339
|
- Subagent hooks: `.claude/hooks/cfn-subagent-*.sh`
|
|
340
|
-
-
|
|
340
|
+
- CodeSearch accelerator: `.claude/skills/cfn-local-codesearch-accelerator/`
|
|
341
341
|
- Lifecycle database: `.claude/skills/cfn-redis-coordination/data/cfn-loop.db`
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
[package]
|
|
2
|
-
name = "
|
|
3
|
-
version = "0.
|
|
2
|
+
name = "codesearch"
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
|
|
6
6
|
[dependencies]
|
|
7
|
-
# Database
|
|
7
|
+
# Database - SQLite for metadata (entities, refs, fast SQL queries)
|
|
8
8
|
rusqlite = { version = "0.31", features = ["bundled", "vtab"] }
|
|
9
|
+
# Database - PostgreSQL/pgvector for embeddings (fast vector search)
|
|
10
|
+
tokio-postgres = { version = "0.7", features = ["with-chrono-0_4", "with-serde_json-1"] }
|
|
11
|
+
deadpool-postgres = { version = "0.12" }
|
|
12
|
+
# pgvector type support for postgres
|
|
13
|
+
pgvector = { version = "0.4", features = ["postgres"] }
|
|
9
14
|
# Vector operations
|
|
10
15
|
ndarray = { version = "0.15", features = ["rayon"], default-features = false }
|
|
11
16
|
# Serialization
|
|
12
17
|
serde = { version = "1.0", features = ["derive"] }
|
|
13
18
|
serde_json = "1.0"
|
|
14
19
|
# CLI
|
|
15
|
-
clap = { version = "4.4", features = ["derive"] }
|
|
20
|
+
clap = { version = "4.4", features = ["derive", "env"] }
|
|
16
21
|
anyhow = "1.0"
|
|
17
22
|
# File system
|
|
18
23
|
walkdir = "2.4"
|
package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/EXTRACTION_EXAMPLES.md
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CodeSearch Extraction Examples
|
|
2
2
|
|
|
3
3
|
This document demonstrates what the TypeScript/JavaScript and text-based fallback extractors capture from different file types.
|
|
4
4
|
|
|
@@ -207,7 +207,7 @@ setup_environment
|
|
|
207
207
|
|
|
208
208
|
## Indexing Results
|
|
209
209
|
|
|
210
|
-
When you run `local-
|
|
210
|
+
When you run `local-codesearch index`, the system:
|
|
211
211
|
|
|
212
212
|
1. **Scans** all files in the project
|
|
213
213
|
2. **Routes** files to appropriate extractors based on extension
|
|
@@ -279,9 +279,9 @@ Complete project indexing (10,000 files): ~30-50 seconds depending on file types
|
|
|
279
279
|
|
|
280
280
|
After indexing:
|
|
281
281
|
|
|
282
|
-
1. **Query** using `local-
|
|
283
|
-
2. **Export** results using `local-
|
|
284
|
-
3. **Analyze** dependencies using `local-
|
|
285
|
-
4. **Monitor** with `local-
|
|
282
|
+
1. **Query** using `local-codesearch query`
|
|
283
|
+
2. **Export** results using `local-codesearch export`
|
|
284
|
+
3. **Analyze** dependencies using `local-codesearch refs`
|
|
285
|
+
4. **Monitor** with `local-codesearch stats`
|
|
286
286
|
|
|
287
287
|
See the main README for detailed usage instructions.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# IMMEDIATE ACTION REQUIRED:
|
|
1
|
+
# IMMEDIATE ACTION REQUIRED: CodeSearch Data Loss Vulnerability
|
|
2
2
|
|
|
3
3
|
**Date**: 2025-12-11
|
|
4
4
|
**Severity**: 🔴 **CRITICAL**
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## Executive Summary
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The CodeSearch indexing system has a **critical data loss vulnerability** when operating with a centralized database shared across multiple projects. Reindexing one project can **accidentally delete data from other projects** with identical relative file paths.
|
|
12
12
|
|
|
13
13
|
**Impact**: ALL projects sharing common file names (e.g., `main.rs`, `lib.rs`, `index.ts`) are at risk.
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ The RuVector indexing system has a **critical data loss vulnerability** when ope
|
|
|
17
17
|
## Vulnerability Details
|
|
18
18
|
|
|
19
19
|
### Root Cause
|
|
20
|
-
- Centralized database location: `~/.local/share/
|
|
20
|
+
- Centralized database location: `~/.local/share/codesearch/index_v2.db`
|
|
21
21
|
- File paths stored as **relative paths** (e.g., `src/main.rs`)
|
|
22
22
|
- DELETE query lacks project discriminator: `DELETE FROM entities WHERE file_path = ?`
|
|
23
23
|
|
|
@@ -25,14 +25,14 @@ The RuVector indexing system has a **critical data loss vulnerability** when ope
|
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
# Setup
|
|
28
|
-
cd ~/project-a && local-
|
|
28
|
+
cd ~/project-a && local-codesearch index src/
|
|
29
29
|
# → Stores entities with file_path="src/main.rs"
|
|
30
30
|
|
|
31
|
-
cd ~/project-b && local-
|
|
31
|
+
cd ~/project-b && local-codesearch index src/
|
|
32
32
|
# → Stores entities with file_path="src/main.rs"
|
|
33
33
|
|
|
34
34
|
# Trigger bug
|
|
35
|
-
cd ~/project-a && local-
|
|
35
|
+
cd ~/project-a && local-codesearch index --force src/
|
|
36
36
|
# → DELETE FROM entities WHERE file_path = 'src/main.rs'
|
|
37
37
|
# → Deletes BOTH project-a AND project-b entities!
|
|
38
38
|
```
|
|
@@ -43,7 +43,7 @@ cd ~/project-a && local-ruvector index --force src/
|
|
|
43
43
|
|
|
44
44
|
## Affected Operations
|
|
45
45
|
|
|
46
|
-
### 1. Reindexing Files (`local-
|
|
46
|
+
### 1. Reindexing Files (`local-codesearch index --force`)
|
|
47
47
|
- **Risk**: Deletes all entities with matching relative path across ALL projects
|
|
48
48
|
- **Detection**: Silent (no errors, no warnings)
|
|
49
49
|
- **Recovery**: Requires full reindex of affected projects
|
|
@@ -66,7 +66,7 @@ cd ~/project-a && local-ruvector index --force src/
|
|
|
66
66
|
# Edit src/paths.rs:
|
|
67
67
|
|
|
68
68
|
pub fn get_database_path(project_root: &Path) -> Result<PathBuf> {
|
|
69
|
-
Ok(project_root.join(".
|
|
69
|
+
Ok(project_root.join(".codesearch").join("index_v2.db"))
|
|
70
70
|
}
|
|
71
71
|
```
|
|
72
72
|
|
|
@@ -222,7 +222,7 @@ git revert <commit-hash>
|
|
|
222
222
|
|
|
223
223
|
# 2. Redeploy previous version
|
|
224
224
|
cargo build --release
|
|
225
|
-
./target/release/local-
|
|
225
|
+
./target/release/local-codesearch --version
|
|
226
226
|
|
|
227
227
|
# 3. Document issue and replan fix
|
|
228
228
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Local
|
|
1
|
+
# Local CodeSearch Accelerator
|
|
2
2
|
|
|
3
3
|
Fast local semantic code search with multi-project isolation.
|
|
4
4
|
|
|
@@ -6,18 +6,18 @@ Fast local semantic code search with multi-project isolation.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Initialize
|
|
9
|
-
./target/release/local-
|
|
9
|
+
./target/release/local-codesearch init
|
|
10
10
|
|
|
11
11
|
# Index a project
|
|
12
|
-
./target/release/local-
|
|
12
|
+
./target/release/local-codesearch index --path . --types rs,ts,js
|
|
13
13
|
|
|
14
14
|
# Query patterns
|
|
15
|
-
./target/release/local-
|
|
15
|
+
./target/release/local-codesearch query "authentication middleware"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
- Centralized SQLite database at `~/.local/share/
|
|
20
|
+
- Centralized SQLite database at `~/.local/share/codesearch/index_v2.db`
|
|
21
21
|
- Multi-project isolation with secure path validation
|
|
22
22
|
- OpenAI embeddings for semantic search
|
|
23
23
|
- No Docker or PostgreSQL required
|
|
@@ -56,7 +56,7 @@ FOREIGN KEY (entity_id) REFERENCES entities_v2(id) ON DELETE RESTRICT
|
|
|
56
56
|
|
|
57
57
|
| Command | Description |
|
|
58
58
|
|---------|-------------|
|
|
59
|
-
| `init` | Initialize
|
|
59
|
+
| `init` | Initialize CodeSearch in project |
|
|
60
60
|
| `index` | Index code files |
|
|
61
61
|
| `query` | Search patterns semantically |
|
|
62
62
|
| `find` | Structured entity queries |
|
|
@@ -68,7 +68,7 @@ FOREIGN KEY (entity_id) REFERENCES entities_v2(id) ON DELETE RESTRICT
|
|
|
68
68
|
## Architecture
|
|
69
69
|
|
|
70
70
|
```
|
|
71
|
-
~/.local/share/
|
|
71
|
+
~/.local/share/codesearch/
|
|
72
72
|
index_v2.db # Centralized SQLite database
|
|
73
73
|
embeddings/ # Cached embeddings
|
|
74
74
|
cache/ # Query cache
|
package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SCHEMA_V2_IMPLEMENTATION.md
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Schema v2 Implementation - AST-Aware
|
|
1
|
+
# Schema v2 Implementation - AST-Aware CodeSearch Accelerator
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
Successfully transformed flat pattern-based schema (v1) to structured entity/reference schema (v2) for AST-aware code indexing and search.
|
package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/SECURITY_IMPLEMENTATION.md
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Security Implementation for AST-Aware
|
|
1
|
+
# Security Implementation for AST-Aware CodeSearch Accelerator
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
This document describes the comprehensive security controls implemented for the AST-Aware
|
|
4
|
+
This document describes the comprehensive security controls implemented for the AST-Aware CodeSearch Accelerator to protect against path traversal attacks, resource exhaustion, and malicious inputs.
|
|
5
5
|
|
|
6
6
|
## Confidence Score: 0.92
|
|
7
7
|
|
|
@@ -180,6 +180,6 @@ with security_context(base_path, operation) as (validator, monitor):
|
|
|
180
180
|
|
|
181
181
|
## Conclusion
|
|
182
182
|
|
|
183
|
-
The AST-Aware
|
|
183
|
+
The AST-Aware CodeSearch Accelerator now includes comprehensive security controls that protect against the most common attack vectors. The implementation follows security best practices and includes thorough testing to ensure effectiveness.
|
|
184
184
|
|
|
185
185
|
**Confidence Score: 0.92** - High confidence in the security implementation with room for minor improvements in monitoring and alerting.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
## Executive Summary
|
|
12
12
|
|
|
13
|
-
A production-ready security test suite has been created to validate multi-project isolation in
|
|
13
|
+
A production-ready security test suite has been created to validate multi-project isolation in CodeSearch's centralized SQLite database. The suite consists of **10 comprehensive tests** that collectively detect and prevent the critical cross-project data deletion vulnerability documented in the security audits.
|
|
14
14
|
|
|
15
15
|
**Key Achievement**: All 8 required tests plus 2 bonus integration tests implemented with full documentation and helper infrastructure.
|
|
16
16
|
|
|
@@ -223,7 +223,7 @@ Tests use:
|
|
|
223
223
|
|
|
224
224
|
### Run All Tests:
|
|
225
225
|
```bash
|
|
226
|
-
cd /mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-local-
|
|
226
|
+
cd /mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-local-codesearch-accelerator
|
|
227
227
|
cargo test --test test_multi_project_safety --release
|
|
228
228
|
```
|
|
229
229
|
|
|
@@ -351,7 +351,7 @@ Implementing this test suite provides:
|
|
|
351
351
|
|
|
352
352
|
**Total New Code**: 762 lines
|
|
353
353
|
**Total Documentation**: 1400+ lines
|
|
354
|
-
**Absolute Path Prefix**: `/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-local-
|
|
354
|
+
**Absolute Path Prefix**: `/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-local-codesearch-accelerator/`
|
|
355
355
|
|
|
356
356
|
---
|
|
357
357
|
|
|
@@ -379,7 +379,7 @@ Implementing this test suite provides:
|
|
|
379
379
|
|
|
380
380
|
## Conclusion
|
|
381
381
|
|
|
382
|
-
A comprehensive, production-ready security test suite has been created to validate and enforce multi-project isolation in
|
|
382
|
+
A comprehensive, production-ready security test suite has been created to validate and enforce multi-project isolation in CodeSearch. The suite tests all critical vulnerabilities identified in the security audits and provides binary pass/fail validation for security fixes.
|
|
383
383
|
|
|
384
384
|
**Status**: Ready for implementation validation
|
|
385
385
|
**Quality**: Production-ready
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "MANDATORY: Query
|
|
2
|
+
name: codesearch-code-search
|
|
3
|
+
description: "MANDATORY: Query CodeSearch BEFORE using grep, glob, find, or search. Performs 400x faster semantic and structural code search via SQL on indexed codebase. Use for finding functions, classes, patterns, callers, and implementations. Agents MUST query CodeSearch first; grep is only allowed after CodeSearch returns zero results."
|
|
4
4
|
allowed-tools: Bash, Read, SlashCommand
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# CodeSearch Local Semantic Code Search
|
|
8
8
|
|
|
9
9
|
## MANDATORY: QUERY RUVECTOR BEFORE GREP/GLOB
|
|
10
10
|
|
|
11
|
-
**This is a PROTOCOL REQUIREMENT, not a suggestion. Failure to query
|
|
11
|
+
**This is a PROTOCOL REQUIREMENT, not a suggestion. Failure to query CodeSearch first is a violation.**
|
|
12
12
|
|
|
13
13
|
### WHY THIS IS MANDATORY
|
|
14
|
-
-
|
|
14
|
+
- CodeSearch SQL: 0.002s | grep: 0.8s (400x slower)
|
|
15
15
|
- Agents using grep first waste tokens and time
|
|
16
|
-
- Index already exists at `~/.local/share/
|
|
16
|
+
- Index already exists at `~/.local/share/codesearch/index_v2.db`
|
|
17
17
|
|
|
18
18
|
### ALWAYS USE RUVECTOR FIRST
|
|
19
19
|
```bash
|
|
20
20
|
# Exact name lookup - 0.002s
|
|
21
|
-
sqlite3 ~/.local/share/
|
|
21
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT file_path, line_number FROM entities WHERE name = 'MyFunction';"
|
|
22
22
|
|
|
23
23
|
# Fuzzy search - 0.004s
|
|
24
|
-
sqlite3 ~/.local/share/
|
|
24
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT file_path, line_number FROM entities WHERE name LIKE '%Store%' LIMIT 10;"
|
|
25
25
|
|
|
26
26
|
# Semantic search
|
|
27
27
|
/codebase-search "authentication middleware pattern"
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
### GREP IS ONLY ALLOWED WHEN:
|
|
31
|
-
-
|
|
31
|
+
- CodeSearch query returned zero results AND project confirmed not indexed
|
|
32
32
|
- Searching literal strings (error messages, comments, config values)
|
|
33
33
|
- Explicit user request for grep
|
|
34
34
|
|
|
35
35
|
### FOR CONCEPTUAL QUESTIONS:
|
|
36
|
-
- "Where is X implemented?" →
|
|
37
|
-
- "Find similar patterns" →
|
|
38
|
-
- "How is feature Y built?" →
|
|
36
|
+
- "Where is X implemented?" → CodeSearch semantic search
|
|
37
|
+
- "Find similar patterns" → CodeSearch embeddings
|
|
38
|
+
- "How is feature Y built?" → CodeSearch first, then read files
|
|
39
39
|
|
|
40
40
|
## Quick Commands
|
|
41
41
|
|
|
@@ -43,24 +43,24 @@ sqlite3 ~/.local/share/ruvector/index_v2.db "SELECT file_path, line_number FROM
|
|
|
43
43
|
```bash
|
|
44
44
|
# Natural language search
|
|
45
45
|
/codebase-search "authentication middleware pattern"
|
|
46
|
-
/cfn-
|
|
46
|
+
/cfn-codesearch-search "error handling in API routes"
|
|
47
47
|
|
|
48
48
|
# CLI direct (global install preferred)
|
|
49
|
-
local-
|
|
49
|
+
local-codesearch query "user login flow" --max-results 5
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### Structural Search (V2 - SQL on AST)
|
|
53
53
|
```bash
|
|
54
54
|
# Find all callers of a function
|
|
55
|
-
sqlite3 ~/.local/share/
|
|
55
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db \
|
|
56
56
|
"SELECT * FROM refs WHERE target_name = 'MyFunction';"
|
|
57
57
|
|
|
58
58
|
# Find all functions in a file
|
|
59
|
-
sqlite3 ~/.local/share/
|
|
59
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db \
|
|
60
60
|
"SELECT name, line_number FROM entities WHERE file_path LIKE '%myfile.rs' AND kind = 'function';"
|
|
61
61
|
|
|
62
62
|
# Find entities by project (multi-project isolation)
|
|
63
|
-
sqlite3 ~/.local/share/
|
|
63
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db \
|
|
64
64
|
"SELECT COUNT(*) FROM entities WHERE project_root = '/path/to/project';"
|
|
65
65
|
```
|
|
66
66
|
|
|
@@ -69,13 +69,13 @@ sqlite3 ~/.local/share/ruvector/index_v2.db \
|
|
|
69
69
|
**Global install (recommended for multi-project use):**
|
|
70
70
|
```bash
|
|
71
71
|
# From claude-flow-novice project
|
|
72
|
-
./scripts/install-
|
|
72
|
+
./scripts/install-codesearch-global.sh
|
|
73
73
|
|
|
74
74
|
# Verify
|
|
75
|
-
local-
|
|
75
|
+
local-codesearch --version
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
This installs to `~/.local/bin/local-
|
|
78
|
+
This installs to `~/.local/bin/local-codesearch` for access from any project.
|
|
79
79
|
|
|
80
80
|
## Prerequisites
|
|
81
81
|
|
|
@@ -90,7 +90,7 @@ echo 'export OPENAI_API_KEY="sk-..."' >> ~/.bashrc
|
|
|
90
90
|
source ~/.bashrc
|
|
91
91
|
|
|
92
92
|
# Option 3: Inline with command
|
|
93
|
-
OPENAI_API_KEY="sk-..." ./local-
|
|
93
|
+
OPENAI_API_KEY="sk-..." ./local-codesearch index --path /project
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
**Verify key is set:**
|
|
@@ -102,42 +102,42 @@ echo $OPENAI_API_KEY # Should show your key (not empty)
|
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
104
|
# Index a project (first time or full rebuild)
|
|
105
|
-
local-
|
|
105
|
+
local-codesearch index --path /path/to/project --types rs,ts,py
|
|
106
106
|
|
|
107
107
|
# Incremental update (after code changes)
|
|
108
108
|
/codebase-reindex
|
|
109
109
|
|
|
110
110
|
# Check index stats
|
|
111
|
-
sqlite3 ~/.local/share/
|
|
111
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT project_root, COUNT(*) FROM entities GROUP BY project_root;"
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
## Key Features
|
|
115
115
|
|
|
116
116
|
- **Multi-project isolation**: Index multiple projects in single database without data collision
|
|
117
117
|
- **Non-destructive**: Indexing one project never deletes data from other projects
|
|
118
|
-
- **Centralized storage**: `~/.local/share/
|
|
118
|
+
- **Centralized storage**: `~/.local/share/codesearch/index_v2.db`
|
|
119
119
|
- **Dual search**: V1 semantic (embeddings) + V2 structural (SQL on AST)
|
|
120
120
|
- **Fast**: Rust binary with SQLite backend
|
|
121
121
|
|
|
122
122
|
## Database Location
|
|
123
123
|
```
|
|
124
|
-
~/.local/share/
|
|
124
|
+
~/.local/share/codesearch/index_v2.db
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
## For Agents (MANDATORY PROTOCOL)
|
|
128
128
|
|
|
129
|
-
**DO NOT use grep/glob until you have queried
|
|
129
|
+
**DO NOT use grep/glob until you have queried CodeSearch. This is enforced.**
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
|
-
# STEP 1: Query
|
|
132
|
+
# STEP 1: Query CodeSearch FIRST (required)
|
|
133
133
|
/codebase-search "relevant search terms" --top 5
|
|
134
134
|
# Or SQL:
|
|
135
|
-
sqlite3 ~/.local/share/
|
|
135
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT file_path, line_number FROM entities WHERE name LIKE '%keyword%';"
|
|
136
136
|
|
|
137
137
|
# STEP 2: Query past errors/patterns
|
|
138
|
-
./.claude/skills/cfn-local-
|
|
138
|
+
./.claude/skills/cfn-local-codesearch-accelerator/query-agent-patterns.sh "description"
|
|
139
139
|
|
|
140
|
-
# STEP 3: Only if
|
|
140
|
+
# STEP 3: Only if CodeSearch returns nothing, then use grep
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
**Violation of this protocol wastes tokens and time.
|
|
143
|
+
**Violation of this protocol wastes tokens and time. CodeSearch exists to prevent duplicated work.**
|