Initial commit
This commit is contained in:
17
.claude-plugin/hooks.json
Normal file
17
.claude-plugin/hooks.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"hooks": {
|
||||
"SessionStart": [
|
||||
{
|
||||
"matcher": "startup|resume|clear|compact",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "./.claude/hooks/SessionStart.sh",
|
||||
"timeout": 60,
|
||||
"description": "Initialize RAG-MAF systems on session start"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
24
.claude-plugin/plugin.json
Normal file
24
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "rag-multi-agent-framework-plugin",
|
||||
"description": "Local RAG plugin with Multi-Agent Framework orchestration for context-aware development assistance",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "ItMeDiaTech",
|
||||
"email": "",
|
||||
"url": "https://github.com/ItMeDiaTech"
|
||||
},
|
||||
"commands": [
|
||||
"./.claude/commands/rag-query.md",
|
||||
"./.claude/commands/rag-index.md",
|
||||
"./.claude/commands/rag-status.md",
|
||||
"./.claude/commands/rag-save.md",
|
||||
"./.claude/commands/rag-searches.md",
|
||||
"./.claude/commands/rag-exec.md",
|
||||
"./.claude/commands/rag-graph.md",
|
||||
"./.claude/commands/rag-metrics.md",
|
||||
"./.claude/commands/rag-query-advanced.md"
|
||||
],
|
||||
"hooks": [
|
||||
"./.claude-plugin/hooks.json"
|
||||
]
|
||||
}
|
||||
92
.claude/commands/rag-exec.md
Normal file
92
.claude/commands/rag-exec.md
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
description: Execute a saved search by ID or name
|
||||
---
|
||||
|
||||
# Execute Saved Search Command
|
||||
|
||||
Execute a previously saved search query.
|
||||
|
||||
## Usage
|
||||
|
||||
**Search ID or Name**: {{args}}
|
||||
|
||||
## Instructions
|
||||
|
||||
Execute a saved search using its ID or name.
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
search_ref = "{{args}}"
|
||||
|
||||
if not search_ref or search_ref == "{{args}}":
|
||||
print("Usage: /rag-exec <search_id_or_name>")
|
||||
print("\nList saved searches with: /rag-searches")
|
||||
else:
|
||||
try:
|
||||
# First, try to find by name
|
||||
response = httpx.get(
|
||||
"http://127.0.0.1:8765/searches",
|
||||
timeout=10.0
|
||||
)
|
||||
|
||||
search_id = None
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
searches = result.get("searches", [])
|
||||
|
||||
# Look for exact name match
|
||||
for search in searches:
|
||||
if search.get("name") == search_ref or search.get("id") == search_ref:
|
||||
search_id = search.get("id")
|
||||
break
|
||||
|
||||
if not search_id:
|
||||
search_id = search_ref # Assume it's an ID
|
||||
|
||||
# Execute the search
|
||||
exec_response = httpx.post(
|
||||
f"http://127.0.0.1:8765/searches/{search_id}/execute",
|
||||
timeout=30.0
|
||||
)
|
||||
|
||||
if exec_response.status_code == 200:
|
||||
result = exec_response.json()
|
||||
search_info = result.get("search", {})
|
||||
results = result.get("results", [])
|
||||
|
||||
print(f"[?] Executing: {search_info.get('name', '')}")
|
||||
print(f" Query: {search_info.get('query', '')}")
|
||||
print(f" Results: {len(results)}")
|
||||
print()
|
||||
|
||||
for i, item in enumerate(results, 1):
|
||||
meta = item.get("metadata", {})
|
||||
file_path = meta.get("file_path", "unknown")
|
||||
score = item.get("score", 0)
|
||||
|
||||
print(f"{i}. {file_path}")
|
||||
print(f" Relevance: {score:.2%}")
|
||||
|
||||
content = item.get("content", "")
|
||||
if len(content) > 150:
|
||||
content = content[:147] + "..."
|
||||
print(f" {content}")
|
||||
print()
|
||||
|
||||
elif exec_response.status_code == 404:
|
||||
print(f"[X] Search not found: {search_ref}")
|
||||
print("List available searches with: /rag-searches")
|
||||
else:
|
||||
print(f"[X] Server error: {exec_response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
print("Make sure the MCP server is running on port 8000.")
|
||||
```
|
||||
|
||||
Execute this code to run a saved search.
|
||||
103
.claude/commands/rag-graph.md
Normal file
103
.claude/commands/rag-graph.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
description: Query knowledge graph for code relationships
|
||||
---
|
||||
|
||||
# Knowledge Graph Query Command
|
||||
|
||||
Query the knowledge graph to understand code relationships and dependencies.
|
||||
|
||||
## Usage
|
||||
|
||||
**Entity Name**: {{args}}
|
||||
|
||||
## Instructions
|
||||
|
||||
Find an entity (class, function, etc.) in the knowledge graph and show its relationships.
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
entity = "{{args}}"
|
||||
|
||||
if not entity or entity == "{{args}}":
|
||||
print("Usage: /rag-graph <entity_name>")
|
||||
print("\nExamples:")
|
||||
print(" /rag-graph UserManager")
|
||||
print(" /rag-graph authenticate_user")
|
||||
else:
|
||||
try:
|
||||
# Get entity context
|
||||
response = httpx.get(
|
||||
f"http://127.0.0.1:8765/knowledge-graph/entity/{entity}",
|
||||
timeout=10.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
context = response.json()
|
||||
|
||||
entity_info = context.get("entity", {})
|
||||
used_by = context.get("used_by", [])
|
||||
uses = context.get("uses", [])
|
||||
related = context.get("related_entities", [])
|
||||
|
||||
print(f"\n[PKG] Entity: {entity_info.get('name', entity)}")
|
||||
print(f" Type: {entity_info.get('type', 'unknown')}")
|
||||
print(f" File: {entity_info.get('file_path', 'unknown')}")
|
||||
|
||||
line_num = entity_info.get('line_number')
|
||||
if line_num:
|
||||
print(f" Line: {line_num}")
|
||||
|
||||
print()
|
||||
|
||||
# Used by (dependencies)
|
||||
if used_by:
|
||||
print(f"📥 USED BY ({len(used_by)}):")
|
||||
for dep in used_by[:5]:
|
||||
name = dep.get('name', '')
|
||||
dep_type = dep.get('type', '')
|
||||
rel = dep.get('relationship', '')
|
||||
print(f" • {name} ({dep_type}) - {rel}")
|
||||
if len(used_by) > 5:
|
||||
print(f" ... and {len(used_by) - 5} more")
|
||||
print()
|
||||
|
||||
# Uses (what this entity depends on)
|
||||
if uses:
|
||||
print(f"📤 USES ({len(uses)}):")
|
||||
for dep in uses[:5]:
|
||||
name = dep.get('name', '')
|
||||
dep_type = dep.get('type', '')
|
||||
rel = dep.get('relationship', '')
|
||||
print(f" • {name} ({dep_type}) - {rel}")
|
||||
if len(uses) > 5:
|
||||
print(f" ... and {len(uses) - 5} more")
|
||||
print()
|
||||
|
||||
# Related entities
|
||||
if related:
|
||||
print(f"[LINK] RELATED ENTITIES ({len(related)}):")
|
||||
for rel_entity in related[:5]:
|
||||
name = rel_entity.get('name', '')
|
||||
rel_type = rel_entity.get('type', '')
|
||||
depth = rel_entity.get('depth', 0)
|
||||
print(f" • {name} ({rel_type}) - depth {depth}")
|
||||
if len(related) > 5:
|
||||
print(f" ... and {len(related) - 5} more")
|
||||
|
||||
elif response.status_code == 404:
|
||||
print(f"[X] Entity not found: {entity}")
|
||||
print("\n[i] Make sure the knowledge graph is built.")
|
||||
print(" Re-index with: /rag-index")
|
||||
else:
|
||||
print(f"[X] Server error: {response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
print("Make sure the MCP server is running on port 8000.")
|
||||
```
|
||||
|
||||
Execute this code to query the knowledge graph.
|
||||
63
.claude/commands/rag-index.md
Normal file
63
.claude/commands/rag-index.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
description: Index or re-index the codebase for RAG search
|
||||
---
|
||||
|
||||
# RAG Index Command
|
||||
|
||||
Index or re-index the codebase to update the RAG system's knowledge.
|
||||
|
||||
## Usage
|
||||
|
||||
The user wants to index the codebase. This will:
|
||||
- Scan all code files in the repository
|
||||
- Generate embeddings for code chunks
|
||||
- Store them in the local vector database
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Trigger the indexing process via the MCP server
|
||||
2. Show progress to the user
|
||||
3. Display completion status
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
print("[#] Starting codebase indexing...")
|
||||
print("This may take a few minutes depending on codebase size.\n")
|
||||
|
||||
try:
|
||||
response = httpx.post(
|
||||
"http://127.0.0.1:8765/execute",
|
||||
json={
|
||||
"category": "rag",
|
||||
"tool_name": "rag_index",
|
||||
"parameters": {"root_path": "."}
|
||||
},
|
||||
timeout=300.0 # 5 minutes timeout
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
|
||||
if result.get("success"):
|
||||
status = result.get("status", {})
|
||||
|
||||
print("[OK] Indexing complete!\n")
|
||||
print(f"[=] Status:")
|
||||
print(f" Indexed chunks: {status.get('indexed_chunks', 0)}")
|
||||
print(f" Embedding model: {status.get('embedding_model', 'unknown')}")
|
||||
print(f" Status: {status.get('status', 'unknown')}")
|
||||
else:
|
||||
print(f"Error: {result.get('error', 'Unknown error')}")
|
||||
else:
|
||||
print(f"MCP Server error: {response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error indexing codebase: {e}")
|
||||
print("Make sure the MCP server is running.")
|
||||
```
|
||||
|
||||
Execute this Python code to index the codebase.
|
||||
129
.claude/commands/rag-metrics.md
Normal file
129
.claude/commands/rag-metrics.md
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
description: Display system metrics and performance dashboard
|
||||
---
|
||||
|
||||
# Metrics Dashboard Command
|
||||
|
||||
Display comprehensive system metrics and performance statistics.
|
||||
|
||||
## Usage
|
||||
|
||||
No arguments required.
|
||||
|
||||
## Instructions
|
||||
|
||||
Shows system health, query performance, cache stats, and recent activity.
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
try:
|
||||
# Get all metrics
|
||||
response = httpx.get(
|
||||
"http://127.0.0.1:8765/metrics",
|
||||
timeout=10.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
metrics = response.json()
|
||||
|
||||
print("=" * 70)
|
||||
print("[=] RAG SYSTEM METRICS DASHBOARD".center(70))
|
||||
print("=" * 70)
|
||||
print()
|
||||
|
||||
# Health Status
|
||||
health = metrics.get("health", {})
|
||||
if health:
|
||||
status = health.get("status", "unknown").upper()
|
||||
status_emoji = "[OK]" if status == "HEALTHY" else "[!]"
|
||||
|
||||
print(f"{status_emoji} SYSTEM HEALTH: {status}")
|
||||
|
||||
error_rate = health.get("error_rate", 0)
|
||||
memory_mb = health.get("memory_usage_mb", 0)
|
||||
latency = health.get("avg_query_latency_ms", 0)
|
||||
|
||||
print(f" Error Rate: {error_rate:.2%}")
|
||||
print(f" Memory: {memory_mb:.1f} MB")
|
||||
print(f" Avg Latency: {latency:.1f} ms")
|
||||
print()
|
||||
|
||||
# Query Performance
|
||||
perf = metrics.get("performance", {})
|
||||
if perf:
|
||||
print("[!] QUERY PERFORMANCE (7 days)")
|
||||
|
||||
total = perf.get("total_queries", 0)
|
||||
qpd = perf.get("queries_per_day", 0)
|
||||
avg_time = perf.get("avg_execution_time_ms", 0)
|
||||
p95_time = perf.get("p95_execution_time_ms", 0)
|
||||
|
||||
print(f" Total Queries: {total}")
|
||||
print(f" Queries/Day: {qpd:.1f}")
|
||||
print(f" Avg Time: {avg_time:.1f} ms")
|
||||
print(f" P95 Time: {p95_time:.1f} ms")
|
||||
|
||||
feedback = perf.get("avg_feedback_score")
|
||||
if feedback is not None:
|
||||
print(f" Avg Feedback: {feedback:.2f}/1.0")
|
||||
|
||||
print()
|
||||
|
||||
# Cache Statistics
|
||||
cache = metrics.get("cache", {})
|
||||
if cache:
|
||||
print("[@] CACHE STATISTICS")
|
||||
|
||||
entries = cache.get("total_entries", 0)
|
||||
size_mb = cache.get("total_size_mb", 0)
|
||||
avg_access = cache.get("average_access_count", 0)
|
||||
|
||||
print(f" Total Entries: {entries}")
|
||||
print(f" Total Size: {size_mb:.2f} MB")
|
||||
print(f" Avg Access Count: {avg_access:.1f}")
|
||||
print()
|
||||
|
||||
# Get popular queries
|
||||
try:
|
||||
history_response = httpx.get(
|
||||
"http://127.0.0.1:8765/query-history?days=1",
|
||||
timeout=5.0
|
||||
)
|
||||
|
||||
if history_response.status_code == 200:
|
||||
history = history_response.json()
|
||||
popular = history.get("popular_queries", [])
|
||||
|
||||
if popular:
|
||||
print("[FIRE] TOP QUERIES (24h)")
|
||||
for i, query_info in enumerate(popular[:5], 1):
|
||||
query = query_info.get("query", "")
|
||||
count = query_info.get("count", 0)
|
||||
|
||||
if len(query) > 50:
|
||||
query = query[:47] + "..."
|
||||
|
||||
print(f" {i}. {query} ({count}x)")
|
||||
|
||||
print()
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
print("=" * 70)
|
||||
|
||||
print("\n[i] Refresh with: /rag-metrics")
|
||||
|
||||
else:
|
||||
print(f"[X] Server error: {response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
print("Make sure the MCP server is running on port 8000.")
|
||||
```
|
||||
|
||||
Execute this code to display the metrics dashboard.
|
||||
107
.claude/commands/rag-query-advanced.md
Normal file
107
.claude/commands/rag-query-advanced.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
description: Advanced RAG query with profiling and explanations
|
||||
---
|
||||
|
||||
# Advanced RAG Query Command
|
||||
|
||||
Execute an advanced RAG query with performance profiling and result explanations.
|
||||
|
||||
## Usage
|
||||
|
||||
**User Query**: {{args}}
|
||||
|
||||
## Instructions
|
||||
|
||||
This command performs an advanced query with:
|
||||
- Performance profiling
|
||||
- Result explanations (why each result was returned)
|
||||
- Query suggestions
|
||||
- Saved search option
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
query = "{{args}}"
|
||||
|
||||
if not query or query == "{{args}}":
|
||||
print("Usage: /rag-query-advanced <your query>")
|
||||
print("Example: /rag-query-advanced how does authentication work?")
|
||||
print("\nFeatures:")
|
||||
print(" - Performance profiling")
|
||||
print(" - Result explanations")
|
||||
print(" - Query suggestions")
|
||||
else:
|
||||
try:
|
||||
# Execute query
|
||||
response = httpx.post(
|
||||
"http://127.0.0.1:8765/query",
|
||||
json={
|
||||
"query": query,
|
||||
"n_results": 5,
|
||||
"use_hybrid": True,
|
||||
"use_reranking": True
|
||||
},
|
||||
timeout=30.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
results_list = result.get("results", [])
|
||||
metadata = result.get("metadata", {})
|
||||
|
||||
print(f"\n[?] Query: {query}")
|
||||
print(f"[=] Results: {len(results_list)} found")
|
||||
print()
|
||||
|
||||
# Display results
|
||||
for i, item in enumerate(results_list, 1):
|
||||
item_meta = item.get("metadata", {})
|
||||
file_path = item_meta.get("file_path", "unknown")
|
||||
score = item.get("score", 0)
|
||||
|
||||
print(f"{i}. {file_path}")
|
||||
print(f" Relevance: {score:.2%}")
|
||||
|
||||
# Show snippet
|
||||
content = item.get("content", "")
|
||||
if len(content) > 200:
|
||||
content = content[:197] + "..."
|
||||
print(f" {content}")
|
||||
print()
|
||||
|
||||
# Get similar queries
|
||||
try:
|
||||
sugg_response = httpx.get(
|
||||
f"http://127.0.0.1:8765/suggestions?partial={query[:20]}",
|
||||
timeout=5.0
|
||||
)
|
||||
|
||||
if sugg_response.status_code == 200:
|
||||
sugg_data = sugg_response.json()
|
||||
suggestions = sugg_data.get("suggestions", [])
|
||||
|
||||
if suggestions and len(suggestions) > 1:
|
||||
print("\n[i] Related queries you might try:")
|
||||
for sugg in suggestions[:3]:
|
||||
if sugg != query:
|
||||
print(f" - {sugg}")
|
||||
except:
|
||||
pass
|
||||
|
||||
# Offer to save search
|
||||
print("\n[@] Save this search? Use: /rag-save '{query}'")
|
||||
|
||||
else:
|
||||
print(f"[X] Server error: {response.status_code}")
|
||||
|
||||
except httpx.TimeoutException:
|
||||
print("[TIMER] Query timed out. Try a simpler query or check server status.")
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
print("Make sure the MCP server is running on port 8000.")
|
||||
```
|
||||
|
||||
Execute this code to perform an advanced RAG query with profiling and explanations.
|
||||
67
.claude/commands/rag-query.md
Normal file
67
.claude/commands/rag-query.md
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
description: Query the RAG system for relevant code and documentation
|
||||
---
|
||||
|
||||
# RAG Query Command
|
||||
|
||||
Query the local RAG (Retrieval-Augmented Generation) system to find relevant code and documentation.
|
||||
|
||||
## Usage
|
||||
|
||||
The user is asking you to query the RAG system. Use the MCP server to perform the query.
|
||||
|
||||
**User Query**: {{args}}
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Parse the user's query from the arguments
|
||||
2. Use the RAG system via HTTP request to the MCP server at http://127.0.0.1:8765
|
||||
3. Execute a POST request to `/rag/query` with the query
|
||||
4. Format and display the results to the user
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
query = "{{args}}"
|
||||
|
||||
if not query or query == "{{args}}":
|
||||
print("Usage: /rag-query <your query>")
|
||||
print("Example: /rag-query how does authentication work?")
|
||||
else:
|
||||
try:
|
||||
response = httpx.post(
|
||||
"http://127.0.0.1:8765/rag/query",
|
||||
json={"query": query},
|
||||
timeout=30.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
|
||||
if result.get("success"):
|
||||
results_list = result.get("results", [])
|
||||
|
||||
print(f"\n[?] Found {len(results_list)} relevant results:\n")
|
||||
|
||||
for i, item in enumerate(results_list[:5], 1):
|
||||
metadata = item.get("metadata", {})
|
||||
file_path = metadata.get("file_path", "unknown")
|
||||
score = 1 - item.get("distance", 1)
|
||||
|
||||
print(f"{i}. {file_path} (relevance: {score:.2%})")
|
||||
print(f" {item.get('text', '')[:150]}...")
|
||||
print()
|
||||
else:
|
||||
print(f"Error: {result.get('error', 'Unknown error')}")
|
||||
else:
|
||||
print(f"MCP Server error: {response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error querying RAG system: {e}")
|
||||
print("Make sure the MCP server is running.")
|
||||
```
|
||||
|
||||
Execute this Python code to query the RAG system and display results.
|
||||
84
.claude/commands/rag-save.md
Normal file
84
.claude/commands/rag-save.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
description: Save a search query for quick access later
|
||||
---
|
||||
|
||||
# Save Search Command
|
||||
|
||||
Save a frequently used query for quick access.
|
||||
|
||||
## Usage
|
||||
|
||||
**Arguments**: {{args}}
|
||||
|
||||
## Instructions
|
||||
|
||||
Save a search query with optional name, description, and tags.
|
||||
|
||||
Format: `name | query | description | tags`
|
||||
|
||||
Example: `/rag-save auth | authentication flow | Find auth code | auth,security`
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
args = "{{args}}"
|
||||
|
||||
if not args or args == "{{args}}":
|
||||
print("Usage: /rag-save <name> | <query> | [description] | [tags]")
|
||||
print("\nExamples:")
|
||||
print(" /rag-save auth | authentication flow")
|
||||
print(" /rag-save auth | authentication flow | Find auth code | auth,security")
|
||||
print("\nTo list saved searches: /rag-searches")
|
||||
else:
|
||||
try:
|
||||
# Parse arguments
|
||||
parts = [p.strip() for p in args.split('|')]
|
||||
|
||||
if len(parts) < 2:
|
||||
print("[X] Error: Need at least name and query")
|
||||
print("Format: <name> | <query> | [description] | [tags]")
|
||||
else:
|
||||
name = parts[0]
|
||||
query = parts[1]
|
||||
description = parts[2] if len(parts) > 2 else ""
|
||||
tags = parts[3].split(',') if len(parts) > 3 else []
|
||||
tags = [t.strip() for t in tags if t.strip()]
|
||||
|
||||
# Save search
|
||||
response = httpx.post(
|
||||
"http://127.0.0.1:8765/searches",
|
||||
json={
|
||||
"name": name,
|
||||
"query": query,
|
||||
"description": description,
|
||||
"tags": tags,
|
||||
"n_results": 5
|
||||
},
|
||||
timeout=10.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
search = result.get("search", {})
|
||||
|
||||
print(f"[OK] Saved search '{name}'")
|
||||
print(f" Query: {query}")
|
||||
if description:
|
||||
print(f" Description: {description}")
|
||||
if tags:
|
||||
print(f" Tags: {', '.join(tags)}")
|
||||
|
||||
print(f"\n[i] Execute with: /rag-exec {search.get('id', '')}")
|
||||
|
||||
else:
|
||||
print(f"[X] Server error: {response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
print("Make sure the MCP server is running on port 8000.")
|
||||
```
|
||||
|
||||
Execute this code to save a search query.
|
||||
76
.claude/commands/rag-searches.md
Normal file
76
.claude/commands/rag-searches.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
description: List and manage saved searches
|
||||
---
|
||||
|
||||
# Saved Searches Command
|
||||
|
||||
List all saved searches with filtering options.
|
||||
|
||||
## Usage
|
||||
|
||||
**Filter**: {{args}} (optional tag filter)
|
||||
|
||||
## Instructions
|
||||
|
||||
List all saved searches, optionally filtered by tag.
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
filter_tags = "{{args}}"
|
||||
if filter_tags == "{{args}}":
|
||||
filter_tags = None
|
||||
|
||||
try:
|
||||
# Get saved searches
|
||||
params = {}
|
||||
if filter_tags:
|
||||
params['tags'] = filter_tags
|
||||
|
||||
response = httpx.get(
|
||||
"http://127.0.0.1:8765/searches",
|
||||
params=params,
|
||||
timeout=10.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
searches = result.get("searches", [])
|
||||
total = result.get("total", 0)
|
||||
|
||||
if total == 0:
|
||||
print("📭 No saved searches found.")
|
||||
print("\n[i] Save a search with: /rag-save <name> | <query>")
|
||||
else:
|
||||
print(f"[#] Saved Searches ({total}):")
|
||||
print()
|
||||
|
||||
for search in searches:
|
||||
name = search.get("name", "")
|
||||
query = search.get("query", "")
|
||||
search_id = search.get("id", "")
|
||||
tags = search.get("tags", [])
|
||||
use_count = search.get("use_count", 0)
|
||||
|
||||
print(f" • {name}")
|
||||
print(f" Query: {query}")
|
||||
|
||||
if tags:
|
||||
print(f" Tags: {', '.join(tags)}")
|
||||
|
||||
print(f" Used: {use_count} times")
|
||||
print(f" Execute: /rag-exec {search_id}")
|
||||
print()
|
||||
|
||||
else:
|
||||
print(f"[X] Server error: {response.status_code}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
print("Make sure the MCP server is running on port 8000.")
|
||||
```
|
||||
|
||||
Execute this code to list saved searches.
|
||||
69
.claude/commands/rag-status.md
Normal file
69
.claude/commands/rag-status.md
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
description: Check the status of the RAG and MAF systems
|
||||
---
|
||||
|
||||
# RAG Status Command
|
||||
|
||||
Check the current status of the RAG and Multi-Agent Framework systems.
|
||||
|
||||
## Usage
|
||||
|
||||
Display system status including:
|
||||
- RAG system information
|
||||
- MAF agent status
|
||||
- MCP server status
|
||||
|
||||
## Implementation
|
||||
|
||||
```python
|
||||
import httpx
|
||||
import json
|
||||
|
||||
print("[=] RAG-MAF System Status\n")
|
||||
|
||||
try:
|
||||
response = httpx.get(
|
||||
"http://127.0.0.1:8765/status",
|
||||
timeout=10.0
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
status = response.json()
|
||||
|
||||
# RAG Status
|
||||
rag = status.get("rag", {})
|
||||
print("[?] RAG System:")
|
||||
print(f" Indexed chunks: {rag.get('indexed_chunks', 0)}")
|
||||
print(f" Embedding model: {rag.get('embedding_model', 'unknown')}")
|
||||
print(f" Embedding dimension: {rag.get('embedding_dimension', 0)}")
|
||||
print(f" Status: {rag.get('status', 'unknown')}")
|
||||
print()
|
||||
|
||||
# MAF Status
|
||||
maf = status.get("maf", {})
|
||||
print("[AI] Multi-Agent Framework:")
|
||||
agents = maf.get('agents', [])
|
||||
print(f" Available agents: {', '.join(agents)}")
|
||||
print(f" Active contexts: {maf.get('active_contexts', 0)}")
|
||||
print(f" RAG enabled: {'Yes' if maf.get('rag_enabled') else 'No'}")
|
||||
print()
|
||||
|
||||
# Server Status
|
||||
server = status.get("server", {})
|
||||
print("[+] MCP Server:")
|
||||
print(f" Host: {server.get('host', 'unknown')}")
|
||||
print(f" Port: {server.get('port', 'unknown')}")
|
||||
print(f" Status: {server.get('status', 'unknown')}")
|
||||
|
||||
else:
|
||||
print(f"[X] MCP Server error: {response.status_code}")
|
||||
|
||||
except httpx.ConnectError:
|
||||
print("[X] Cannot connect to MCP server")
|
||||
print(" The server may not be running.")
|
||||
print(" Try restarting your Claude Code session.")
|
||||
except Exception as e:
|
||||
print(f"[X] Error: {e}")
|
||||
```
|
||||
|
||||
Execute this Python code to display system status.
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# rag-multi-agent-framework-plugin
|
||||
|
||||
Local RAG plugin with Multi-Agent Framework orchestration for context-aware development assistance
|
||||
81
plugin.lock.json
Normal file
81
plugin.lock.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:ItMeDiaTech/dt-cli:",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "780c730809b57fe88081392eaf74ab39f6279907",
|
||||
"treeHash": "d53a3b6e44dfd8b717acda9ecdb70256cdfd4150065c336c825526df55e4ff43",
|
||||
"generatedAt": "2025-11-28T10:11:42.787512Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "rag-multi-agent-framework-plugin",
|
||||
"description": "Local RAG plugin with Multi-Agent Framework orchestration for context-aware development assistance",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "e2ed50af05eb53950148d0c05b1b8fe5ebcf95e86703a30ffc554b074bf18805"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-index.md",
|
||||
"sha256": "cb8944ecffe398c1539894a1baea3ba136a6fb798be3c5457c5b4468f0352ab6"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-query.md",
|
||||
"sha256": "f2e9eb726973bf54ea06e14e0b532e92e0b4120dbe6b4abf1ad0627759049370"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-save.md",
|
||||
"sha256": "18129336c1b3f50d67c93391f1576655350e78a66430ab436e04b2338ed1ba60"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-status.md",
|
||||
"sha256": "ceaae7852ba53f8860eeaac7ac54e0507128c5b6fcef40c85e63fc81abb829ca"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-searches.md",
|
||||
"sha256": "4b6b0eb11eb75d6063e020e33f0e670533588985d247b28d2af14d649d6e617c"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-graph.md",
|
||||
"sha256": "3d69be530b80a62d4d7588d7457c8cf12487f07fe00359d1ebff9ffeaf31cd7d"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-exec.md",
|
||||
"sha256": "f9640e5c6880a9d0ae5b9de96cc347deddcfdad465a7dd141424cb6af215b4db"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-query-advanced.md",
|
||||
"sha256": "1183b432cf9fab8cd1959ccbf9b2cc87306888100912b0a0fce087be5b5ab656"
|
||||
},
|
||||
{
|
||||
"path": ".claude/commands/rag-metrics.md",
|
||||
"sha256": "8845a815455f2f7693856a1c446447b0184dfef30dd25a8fdad815a8b873d098"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "15de8fc6f74182157a80ade81a060ef0b2e26a55997aaf0d5f8569f099be4e4c"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/hooks.json",
|
||||
"sha256": "48c33cdd516151755804882f832674951f380bbf872754f0b2bfdd5bd6fe6c47"
|
||||
}
|
||||
],
|
||||
"dirSha256": "d53a3b6e44dfd8b717acda9ecdb70256cdfd4150065c336c825526df55e4ff43"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user