claude-flow-novice 2.18.40 → 2.19.1
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/AGENT_LIFECYCLE.md +1 -1
- package/.claude/agents/SHARED_PROTOCOL.md +33 -5
- package/.claude/agents/cfn-dev-team/analysts/analyst.md +4 -4
- package/.claude/agents/cfn-dev-team/analysts/root-cause-analyst.md +4 -4
- package/.claude/agents/cfn-dev-team/architecture/api-designer-persona.md +4 -4
- package/.claude/agents/cfn-dev-team/architecture/base-template-generator.md +4 -4
- package/.claude/agents/cfn-dev-team/architecture/goal-planner.md +4 -4
- package/.claude/agents/cfn-dev-team/architecture/system-architect.md +4 -4
- package/.claude/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +4 -4
- package/.claude/agents/cfn-dev-team/coordinators/handoff-coordinator.md +4 -4
- package/.claude/agents/cfn-dev-team/dev-ops/devops-engineer.md +4 -4
- package/.claude/agents/cfn-dev-team/dev-ops/docker-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/dev-ops/fly-io-specialist.md +418 -0
- package/.claude/agents/cfn-dev-team/dev-ops/github-commit-agent.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/api-gateway-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/backend-developer.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/data/data-engineer.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/database/database-architect.md +4 -4
- 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/developers/database/supabase-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/frontend/mobile-dev.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/frontend/ui-designer.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/graphql-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/developers/rust-developer.md +4 -4
- package/.claude/agents/cfn-dev-team/documentation/agent-type-guidelines.md +4 -4
- package/.claude/agents/cfn-dev-team/documentation/api-documentation.md +4 -4
- package/.claude/agents/cfn-dev-team/documentation/pseudocode.md +5 -5
- package/.claude/agents/cfn-dev-team/documentation/specification-agent.md +5 -5
- package/.claude/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +4 -4
- package/.claude/agents/cfn-dev-team/product-owners/cto-agent.md +4 -4
- package/.claude/agents/cfn-dev-team/product-owners/power-user-persona.md +4 -4
- package/.claude/agents/cfn-dev-team/product-owners/product-owner.md +4 -4
- package/.claude/agents/cfn-dev-team/reviewers/code-reviewer.md +4 -4
- package/.claude/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +4 -4
- package/.claude/agents/cfn-dev-team/reviewers/quality/cyclomatic-complexity-reducer.md +4 -4
- package/.claude/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +4 -4
- package/.claude/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +4 -4
- package/.claude/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/api-testing-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/contract-tester.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/e2e/playwright-tester.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/integration-tester.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/interaction-tester.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/load-testing-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/mutation-testing-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/playwright-tester.md +4 -4
- package/.claude/agents/cfn-dev-team/{testing → testers}/test-validation-agent.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/tester.md +39 -4
- package/.claude/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +4 -4
- package/.claude/agents/cfn-dev-team/testers/validation/validation-production-validator.md +4 -4
- package/.claude/agents/cfn-dev-team/utility/agent-builder.md +7 -7
- package/.claude/agents/cfn-dev-team/utility/memory-leak-specialist.md +4 -4
- package/.claude/agents/cfn-dev-team/utility/researcher.md +4 -4
- package/.claude/agents/cfn-dev-team/utility/z-ai-specialist.md +4 -4
- package/.claude/agents/custom/claude-code-expert.md +1 -1
- package/.claude/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/.claude/{agents/cfn-dev-team/utility → cfn-extras/agents}/context-curator.md +4 -4
- package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-docker-expert.md +4 -4
- package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-redis-operations.md +1 -1
- package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-system-expert.md +4 -4
- package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/trigger-dev-expert.md +4 -4
- package/.claude/{agents/cfn-dev-team/coordinators → cfn-extras/agents/deprecated-coordinators}/consensus-builder.md +4 -4
- package/.claude/{agents/cfn-dev-team/coordinators → cfn-extras/agents/deprecated-coordinators}/multi-sprint-coordinator.md +4 -4
- package/.claude/{agents → cfn-extras/agents/docker-team}/docker-coordinators/cfn-docker-v3-coordinator.md +1 -1
- package/.claude/{agents/cfn-dev-team/dev-ops → cfn-extras/agents}/kubernetes-specialist.md +4 -4
- package/.claude/{agents/cfn-dev-team/architecture → cfn-extras/agents}/planner.md +4 -4
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/QUICKSTART.md +1 -1
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/README.md +19 -19
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/SKILL.md +7 -7
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/TDD_COORDINATOR_OVERVIEW.md +3 -3
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/TEST_RESULTS.md +3 -3
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/coordinate-generation.sh +19 -19
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/example-fix-scenario.md +4 -4
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/example-usage.sh +1 -1
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/feedback-logger.sh +5 -5
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/fix-existing-code-v2.sh +2 -2
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/fix-existing-code.sh +10 -10
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/pattern-examples.md +3 -3
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/query-patterns.sh +9 -9
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/tdd-coordinator.sh +8 -8
- package/.claude/cfn-extras/skills/cfn-cerebras-coordinator/test-tdd-coordinator.sh +1 -1
- package/.claude/commands/README.md +1 -1
- package/.claude/commands/{cfn-ruvector → cfn-codesearch}/cfn-codebase-reindex.md +6 -6
- package/.claude/commands/{cfn-ruvector → cfn-codesearch}/cfn-codebase-search.md +8 -8
- package/.claude/commands/{cfn-ruvector → cfn-codesearch}/cfn-detect-stale-docs.md +3 -3
- package/.claude/commands/cfn-codesearch-search.md +36 -0
- package/.claude/commands/cfn-fix-errors.md +1 -1
- package/.claude/commands/cfn-loop-task.md +66 -2
- package/.claude/commands/cfn-update-search-index.md +2 -2
- package/.claude/hooks/cfn-SessionStart-cfn-build-codesearch.sh +24 -0
- package/.claude/hooks/cfn-bash-search-hook.sh +6 -6
- package/.claude/hooks/cfn-smart-search-hook.sh +15 -15
- package/.claude/hooks/cfn-subagent-stop.sh +9 -9
- package/.claude/hooks/post-commit-codebase-index +14 -14
- package/.claude/skills/{bulk-add-ruvector-instructions.sh → bulk-add-codesearch-instructions.sh} +14 -14
- 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 +12 -12
- 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_FINDINGS_SUMMARY.txt +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 +5 -5
- package/.claude/skills/cfn-codesearch/SKILL.md +143 -0
- 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 +29 -29
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/EXECUTIVE_SUMMARY.txt +1 -1
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/PHASE_4_QUERY_API.md +24 -24
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/RUST_AST_EXTRACTOR_IMPLEMENTATION.md +7 -7
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/TRANSACTION_MANAGEMENT.md +1 -1
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/docs/VALIDATION_FINDINGS.txt +1 -1
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/epic-ast-indexer.json +8 -8
- 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/cleanup.rs +1 -1
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/index.rs +238 -9
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/index_ast.rs +3 -3
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/init.rs +19 -19
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/cli/migration.rs +5 -5
- 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/cli/reset.rs +5 -5
- 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 +37 -27
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/migration_v2.rs +1 -1
- package/.claude/skills/cfn-codesearch/src/paths.rs +37 -0
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/query_v2.rs +3 -4
- package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/src/search_engine.rs +3 -3
- 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-knowledge-base/lib/playbook/SKILL.md +1 -1
- package/.claude/skills/cfn-mdap-context-injection/SKILL.md +2 -2
- package/.claude/skills/cfn-mdap-context-injection/inject.sh +23 -23
- package/CLAUDE.md +3 -3
- package/package.json +11 -11
- package/readme/feature-status.md +411 -0
- package/.claude/agents/docker-ts-fixer.md +0 -65
- package/.claude/commands/cfn-ruvector-search.md +0 -36
- package/.claude/hooks/cfn-SessionStart-cfn-build-ruvector.sh +0 -24
- package/.claude/skills/cfn-local-ruvector-accelerator/.claude/hooks/SessionStart-cfn-build-ruvector.sh +0 -13
- package/.claude/skills/cfn-local-ruvector-accelerator/SKILL.md +0 -143
- package/.claude/skills/cfn-local-ruvector-accelerator/src/paths.rs +0 -31
- /package/.claude/{agents/custom → cfn-extras/agents/custom-agents}/cfn-loops-cli-expert.md +0 -0
- /package/.claude/{agents/csuite → cfn-extras/agents/custom-agents}/cto-agent.md +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}/embeddings_manager.py.backup +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/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_modified.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/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/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/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
|
@@ -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:
|
|
@@ -335,7 +335,7 @@ Run with broader query:
|
|
|
335
335
|
|
|
336
336
|
## References
|
|
337
337
|
|
|
338
|
-
- Analysis document: `docs/
|
|
338
|
+
- Analysis document: `docs/CODESEARCH_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.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
SECURITY VALIDATION REPORT - EXECUTIVE SUMMARY
|
|
2
2
|
==============================================
|
|
3
3
|
|
|
4
|
-
Project:
|
|
4
|
+
Project: CodeSearch V2 Multi-Project Isolation
|
|
5
5
|
Audit Date: 2025-12-11
|
|
6
6
|
Confidence Score: 0.80 (pending critical fixes)
|
|
7
7
|
|
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
|
|
|
@@ -135,7 +135,7 @@ Enables:
|
|
|
135
135
|
- Path collision scenario: Two projects with same relative filename
|
|
136
136
|
- Impact: All projects sharing common filenames (main.rs, lib.rs, etc.)
|
|
137
137
|
|
|
138
|
-
**
|
|
138
|
+
**CODESEARCH_ISOLATION_AUDIT.md:**
|
|
139
139
|
- Multi-project attack vectors
|
|
140
140
|
- Path-based isolation weaknesses
|
|
141
141
|
- Transaction and consistency issues
|
|
@@ -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
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
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
|
+
allowed-tools: Bash, Read, SlashCommand
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CodeSearch Local Semantic Code Search
|
|
8
|
+
|
|
9
|
+
## MANDATORY: QUERY CODESEARCH BEFORE GREP/GLOB
|
|
10
|
+
|
|
11
|
+
**This is a PROTOCOL REQUIREMENT, not a suggestion. Failure to query CodeSearch first is a violation.**
|
|
12
|
+
|
|
13
|
+
### WHY THIS IS MANDATORY
|
|
14
|
+
- CodeSearch SQL: 0.002s | grep: 0.8s (400x slower)
|
|
15
|
+
- Agents using grep first waste tokens and time
|
|
16
|
+
- Index already exists at `~/.local/share/codesearch/index_v2.db`
|
|
17
|
+
|
|
18
|
+
### ALWAYS USE CODESEARCH FIRST
|
|
19
|
+
```bash
|
|
20
|
+
# Exact name lookup - 0.002s
|
|
21
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT file_path, line_number FROM entities WHERE name = 'MyFunction';"
|
|
22
|
+
|
|
23
|
+
# Fuzzy search - 0.004s
|
|
24
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT file_path, line_number FROM entities WHERE name LIKE '%Store%' LIMIT 10;"
|
|
25
|
+
|
|
26
|
+
# Semantic search
|
|
27
|
+
/codebase-search "authentication middleware pattern"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### GREP IS ONLY ALLOWED WHEN:
|
|
31
|
+
- CodeSearch query returned zero results AND project confirmed not indexed
|
|
32
|
+
- Searching literal strings (error messages, comments, config values)
|
|
33
|
+
- Explicit user request for grep
|
|
34
|
+
|
|
35
|
+
### FOR CONCEPTUAL QUESTIONS:
|
|
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
|
+
|
|
40
|
+
## Quick Commands
|
|
41
|
+
|
|
42
|
+
### Semantic Search (V1 - Embeddings)
|
|
43
|
+
```bash
|
|
44
|
+
# Natural language search
|
|
45
|
+
/codebase-search "authentication middleware pattern"
|
|
46
|
+
/cfn-codesearch-search "error handling in API routes"
|
|
47
|
+
|
|
48
|
+
# CLI direct (global install preferred)
|
|
49
|
+
local-codesearch query "user login flow" --max-results 5
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Structural Search (V2 - SQL on AST)
|
|
53
|
+
```bash
|
|
54
|
+
# Find all callers of a function
|
|
55
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db \
|
|
56
|
+
"SELECT * FROM refs WHERE target_name = 'MyFunction';"
|
|
57
|
+
|
|
58
|
+
# Find all functions in a file
|
|
59
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db \
|
|
60
|
+
"SELECT name, line_number FROM entities WHERE file_path LIKE '%myfile.rs' AND kind = 'function';"
|
|
61
|
+
|
|
62
|
+
# Find entities by project (multi-project isolation)
|
|
63
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db \
|
|
64
|
+
"SELECT COUNT(*) FROM entities WHERE project_root = '/path/to/project';"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
**Global install (recommended for multi-project use):**
|
|
70
|
+
```bash
|
|
71
|
+
# From claude-flow-novice project
|
|
72
|
+
./scripts/install-codesearch-global.sh
|
|
73
|
+
|
|
74
|
+
# Verify
|
|
75
|
+
local-codesearch --version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This installs to `~/.local/bin/local-codesearch` for access from any project.
|
|
79
|
+
|
|
80
|
+
## Prerequisites
|
|
81
|
+
|
|
82
|
+
**OPENAI_API_KEY is REQUIRED for indexing.** Indexing will fail without a valid key.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Option 1: Export before running
|
|
86
|
+
export OPENAI_API_KEY="sk-..."
|
|
87
|
+
|
|
88
|
+
# Option 2: Add to shell profile (~/.bashrc or ~/.zshrc)
|
|
89
|
+
echo 'export OPENAI_API_KEY="sk-..."' >> ~/.bashrc
|
|
90
|
+
source ~/.bashrc
|
|
91
|
+
|
|
92
|
+
# Option 3: Inline with command
|
|
93
|
+
OPENAI_API_KEY="sk-..." ./local-codesearch index --path /project
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Verify key is set:**
|
|
97
|
+
```bash
|
|
98
|
+
echo $OPENAI_API_KEY # Should show your key (not empty)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Index Management
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Index a project (first time or full rebuild)
|
|
105
|
+
local-codesearch index --path /path/to/project --types rs,ts,py
|
|
106
|
+
|
|
107
|
+
# Incremental update (after code changes)
|
|
108
|
+
/codebase-reindex
|
|
109
|
+
|
|
110
|
+
# Check index stats
|
|
111
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT project_root, COUNT(*) FROM entities GROUP BY project_root;"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Key Features
|
|
115
|
+
|
|
116
|
+
- **Multi-project isolation**: Index multiple projects in single database without data collision
|
|
117
|
+
- **Non-destructive**: Indexing one project never deletes data from other projects
|
|
118
|
+
- **Centralized storage**: `~/.local/share/codesearch/index_v2.db`
|
|
119
|
+
- **Dual search**: V1 semantic (embeddings) + V2 structural (SQL on AST)
|
|
120
|
+
- **Fast**: Rust binary with SQLite backend
|
|
121
|
+
|
|
122
|
+
## Database Location
|
|
123
|
+
```
|
|
124
|
+
~/.local/share/codesearch/index_v2.db
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## For Agents (MANDATORY PROTOCOL)
|
|
128
|
+
|
|
129
|
+
**DO NOT use grep/glob until you have queried CodeSearch. This is enforced.**
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# STEP 1: Query CodeSearch FIRST (required)
|
|
133
|
+
/codebase-search "relevant search terms" --top 5
|
|
134
|
+
# Or SQL:
|
|
135
|
+
sqlite3 ~/.local/share/codesearch/index_v2.db "SELECT file_path, line_number FROM entities WHERE name LIKE '%keyword%';"
|
|
136
|
+
|
|
137
|
+
# STEP 2: Query past errors/patterns
|
|
138
|
+
./.claude/skills/cfn-codesearch/query-agent-patterns.sh "description"
|
|
139
|
+
|
|
140
|
+
# STEP 3: Only if CodeSearch returns nothing, then use grep
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Violation of this protocol wastes tokens and time. CodeSearch exists to prevent duplicated work.**
|
package/.claude/skills/{cfn-local-ruvector-accelerator → cfn-codesearch}/analyze-agent-failures.sh
RENAMED
|
@@ -20,7 +20,7 @@ set -euo pipefail
|
|
|
20
20
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
21
|
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo ".")
|
|
22
22
|
DB_PATH="${PROJECT_ROOT}/.claude/skills/cfn-redis-coordination/data/cfn-loop.db"
|
|
23
|
-
LOG_PATH="${PROJECT_ROOT}/.artifacts/logs/
|
|
23
|
+
LOG_PATH="${PROJECT_ROOT}/.artifacts/logs/codesearch-failure-analysis.log"
|
|
24
24
|
|
|
25
25
|
# Ensure log directory exists
|
|
26
26
|
mkdir -p "$(dirname "$LOG_PATH")"
|
|
@@ -50,7 +50,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
50
50
|
esac
|
|
51
51
|
done
|
|
52
52
|
|
|
53
|
-
echo "[
|
|
53
|
+
echo "[CodeSearch] Analyzing agent failures from last $DAYS days" | tee -a "$LOG_PATH"
|
|
54
54
|
|
|
55
55
|
# ============================================================================
|
|
56
56
|
# Query Failed Agents
|
|
@@ -73,12 +73,12 @@ EOF
|
|
|
73
73
|
)
|
|
74
74
|
|
|
75
75
|
if [ -z "$FAILED_AGENTS" ]; then
|
|
76
|
-
echo "[
|
|
76
|
+
echo "[CodeSearch] No failures found in last $DAYS days" | tee -a "$LOG_PATH"
|
|
77
77
|
exit 0
|
|
78
78
|
fi
|
|
79
79
|
|
|
80
80
|
FAILURE_COUNT=$(echo "$FAILED_AGENTS" | wc -l)
|
|
81
|
-
echo "[
|
|
81
|
+
echo "[CodeSearch] Found $FAILURE_COUNT failed agent executions" | tee -a "$LOG_PATH"
|
|
82
82
|
|
|
83
83
|
# ============================================================================
|
|
84
84
|
# Extract Failure Patterns
|
|
@@ -150,7 +150,7 @@ SET
|
|
|
150
150
|
WHERE id = '$EXISTING_ID';
|
|
151
151
|
SQL_EOF
|
|
152
152
|
|
|
153
|
-
echo "[
|
|
153
|
+
echo "[CodeSearch] Updated pattern: $EXISTING_ID (count: $NEW_COUNT)" | tee -a "$LOG_PATH"
|
|
154
154
|
|
|
155
155
|
else
|
|
156
156
|
# Create new pattern
|
|
@@ -177,13 +177,13 @@ VALUES (
|
|
|
177
177
|
SQL_EOF
|
|
178
178
|
|
|
179
179
|
PATTERNS_CREATED=$((PATTERNS_CREATED + 1))
|
|
180
|
-
echo "[
|
|
180
|
+
echo "[CodeSearch] Created pattern: $PATTERN_ID ($AGENT_TYPE / $FAILURE_MODE)" | tee -a "$LOG_PATH"
|
|
181
181
|
fi
|
|
182
182
|
fi
|
|
183
183
|
fi
|
|
184
184
|
done
|
|
185
185
|
|
|
186
|
-
echo "[
|
|
186
|
+
echo "[CodeSearch] Created $PATTERNS_CREATED new failure patterns" | tee -a "$LOG_PATH"
|
|
187
187
|
|
|
188
188
|
# ============================================================================
|
|
189
189
|
# Identify High-Impact Patterns
|
|
@@ -205,7 +205,7 @@ EOF
|
|
|
205
205
|
|
|
206
206
|
if [ -n "$HIGH_IMPACT" ]; then
|
|
207
207
|
echo "" | tee -a "$LOG_PATH"
|
|
208
|
-
echo "[
|
|
208
|
+
echo "[CodeSearch] High-impact failure patterns (>= $MIN_OCCURRENCES occurrences):" | tee -a "$LOG_PATH"
|
|
209
209
|
echo "$HIGH_IMPACT" | while IFS='|' read -r TYPE MODE COUNT CAUSE; do
|
|
210
210
|
echo " - $TYPE / $MODE: $COUNT occurrences" | tee -a "$LOG_PATH"
|
|
211
211
|
echo " Cause: $(echo "$CAUSE" | head -c 80)..." | tee -a "$LOG_PATH"
|
|
@@ -220,7 +220,7 @@ fi
|
|
|
220
220
|
# and extract their approaches as recovery strategies
|
|
221
221
|
|
|
222
222
|
echo "" | tee -a "$LOG_PATH"
|
|
223
|
-
echo "[
|
|
223
|
+
echo "[CodeSearch] Searching for recovery strategies..." | tee -a "$LOG_PATH"
|
|
224
224
|
|
|
225
225
|
RECOVERIES_FOUND=0
|
|
226
226
|
|
|
@@ -259,14 +259,14 @@ SQL_EOF
|
|
|
259
259
|
fi
|
|
260
260
|
done
|
|
261
261
|
|
|
262
|
-
echo "[
|
|
262
|
+
echo "[CodeSearch] Identified $RECOVERIES_FOUND recovery strategies" | tee -a "$LOG_PATH"
|
|
263
263
|
|
|
264
264
|
# ============================================================================
|
|
265
265
|
# Summary Report
|
|
266
266
|
# ============================================================================
|
|
267
267
|
|
|
268
268
|
echo "" | tee -a "$LOG_PATH"
|
|
269
|
-
echo "[
|
|
269
|
+
echo "[CodeSearch] Failure Analysis Summary:" | tee -a "$LOG_PATH"
|
|
270
270
|
echo " - Analyzed: $FAILURE_COUNT failed agents" | tee -a "$LOG_PATH"
|
|
271
271
|
echo " - New patterns: $PATTERNS_CREATED" | tee -a "$LOG_PATH"
|
|
272
272
|
echo " - Recovery strategies: $RECOVERIES_FOUND" | tee -a "$LOG_PATH"
|