-
Notifications
You must be signed in to change notification settings - Fork 41
Scope PageRank fallback to repo and collection #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -447,12 +447,14 @@ def compute_pagerank( | |
| except Exception: | ||
| # Fallback: simple in-degree approximation with timeout | ||
| # Uses OPTIONAL MATCH to give base rank to ALL nodes, not just those with incoming edges | ||
| # Scopes relationships to same repo to keep PageRank isolated per graph | ||
| with session.begin_transaction(timeout=timeout) as tx: | ||
| if repo: | ||
| result = tx.run(""" | ||
| MATCH (n:Symbol) | ||
| WHERE n.repo = $repo | ||
| OPTIONAL MATCH (n)<-[r:CALLS|IMPORTS]-() | ||
| OPTIONAL MATCH (n)<-[r:CALLS|IMPORTS]-(caller) | ||
| WHERE caller.repo = $repo | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same 🤖 Was this useful? React with 👍 or 👎 |
||
| WITH n, count(r) AS in_degree | ||
| SET n.pagerank = CASE WHEN in_degree > 0 | ||
| THEN toFloat(in_degree) / 100.0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # Sisyphus Agent Configurations with Context-Engine Tools | ||
|
|
||
| Pre-configured [oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode) Sisyphus agents enhanced with Context-Engine MCP tools for semantic code search, symbol graph navigation, and memory storage. | ||
|
|
||
| ## Installation | ||
|
|
||
| Copy the agent files to your Claude config directory: | ||
|
|
||
| ```bash | ||
| cp -r agents/* ~/.claude/agents/ | ||
| ``` | ||
|
|
||
| ## Requirements | ||
|
|
||
| - [oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode) installed | ||
| - [Context-Engine](https://github.com/m1rl0k/Context-Engine) stack running | ||
| - MCP configured in `~/.config/opencode/opencode.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "mcp": { | ||
| "context-engine": { | ||
| "type": "local", | ||
| "command": [ | ||
| "npx", "-y", "@context-engine-bridge/context-engine-mcp-bridge", | ||
| "mcp-serve", | ||
| "--workspace", "/path/to/your/project", | ||
| "--indexer-url", "http://localhost:8003/mcp", | ||
| "--memory-url", "http://localhost:8002/mcp" | ||
| ], | ||
| "enabled": true | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Agent Tool Matrix | ||
|
|
||
| | Agent | Primary Focus | Context-Engine Tools | | ||
| |-------|---------------|---------------------| | ||
| | **explore** | Fast codebase search | `repo_search`, `code_search`, `info_request`, `symbol_graph`, `pattern_search` | | ||
| | **explore-medium** | Deep pattern discovery | + `context_search`, `search_callers_for`, `search_importers_for` | | ||
| | **librarian** | Documentation & research | `repo_search`, `context_answer`, `context_search`, `info_request`, `search_tests_for`, `search_config_for`, `memory_find`, `memory_store` | | ||
| | **librarian-low** | Quick lookups | `repo_search`, `info_request`, `search_config_for` | | ||
| | **oracle** | Architecture & debugging | `repo_search`, `context_answer`, `symbol_graph`, `neo4j_graph_query`, `pattern_search`, `search_callers_for`, `change_history_for_path` | | ||
| | **oracle-medium** | Standard analysis | `repo_search`, `context_answer`, `symbol_graph`, `search_callers_for`, `pattern_search` | | ||
| | **oracle-low** | Quick questions | `repo_search`, `info_request`, `symbol_graph` | | ||
| | **sisyphus-junior** | Task execution | `repo_search`, `code_search`, `info_request`, `symbol_graph`, `search_tests_for` | | ||
| | **sisyphus-junior-high** | Complex execution | `repo_search`, `code_search`, `symbol_graph`, `pattern_search`, `search_callers_for` | | ||
| | **sisyphus-junior-low** | Simple tasks | `repo_search`, `info_request` | | ||
| | **metis** | Pre-planning analysis | `repo_search`, `context_answer`, `info_request`, `symbol_graph`, `search_tests_for`, `search_config_for` | | ||
| | **momus** | Plan review | `repo_search`, `symbol_graph`, `info_request` | | ||
| | **prometheus** | Strategic planning | `repo_search`, `context_answer`, `info_request`, `symbol_graph`, `search_tests_for`, `search_config_for` | | ||
| | **document-writer** | Documentation | `repo_search`, `context_answer`, `info_request`, `search_tests_for` | | ||
| | **frontend-engineer** | UI/UX | `repo_search`, `info_request`, `pattern_search`, `search_tests_for` | | ||
| | **frontend-engineer-high** | Complex UI | + `symbol_graph` | | ||
| | **frontend-engineer-low** | Simple styling | `repo_search`, `info_request` | | ||
| | **qa-tester** | Testing | `repo_search`, `search_tests_for`, `search_config_for`, `info_request` | | ||
| | **multimodal-looker** | Visual analysis | `repo_search`, `info_request` | | ||
|
|
||
| ## Context-Engine Tools Reference | ||
|
|
||
| ### Search Tools | ||
| | Tool | Use Case | | ||
| |------|----------| | ||
| | `repo_search` | Hybrid semantic + lexical code search with reranking | | ||
| | `code_search` | Alias for repo_search | | ||
| | `context_search` | Blend code + memory/docs results | | ||
| | `context_answer` | LLM-generated explanations with citations | | ||
| | `info_request` | Simple natural language queries | | ||
| | `pattern_search` | AST-aware structural pattern matching | | ||
|
|
||
| ### Navigation Tools | ||
| | Tool | Use Case | | ||
| |------|----------| | ||
| | `symbol_graph` | Find callers, callees, definitions, importers | | ||
| | `neo4j_graph_query` | Advanced traversals (impact, transitive, cycles) | | ||
| | `search_callers_for` | Find symbol usages | | ||
| | `search_importers_for` | Find import references | | ||
|
|
||
| ### Specialized Search | ||
| | Tool | Use Case | | ||
| |------|----------| | ||
| | `search_tests_for` | Find test files | | ||
| | `search_config_for` | Find config files (yaml/json/toml) | | ||
| | `change_history_for_path` | File change history | | ||
|
|
||
| ### Memory Tools | ||
| | Tool | Use Case | | ||
| |------|----------| | ||
| | `memory_store` | Store knowledge with metadata | | ||
| | `memory_find` | Search stored memories | | ||
|
|
||
| ## Key Behavior Changes | ||
|
|
||
| All agents are configured to: | ||
|
|
||
| 1. **PREFER semantic search over grep** for concept-based queries | ||
| 2. Use `symbol_graph` for call chain analysis before refactoring | ||
| 3. Use `pattern_search` for finding similar code across languages | ||
| 4. Use grep **ONLY** for exact literals (e.g., `"REDIS_HOST"`, `"UserAlreadyExists"`) | ||
|
|
||
| ## Examples | ||
|
|
||
| ```bash | ||
| # Agent uses repo_search instead of grep | ||
| "Find authentication handling" → repo_search(query="authentication mechanisms") | ||
|
|
||
| # Agent uses symbol_graph for impact analysis | ||
| "What calls this function?" → symbol_graph(symbol="authenticate", query_type="callers") | ||
|
|
||
| # Agent uses neo4j for advanced traversal | ||
| "What breaks if I change this?" → neo4j_graph_query(symbol="User", query_type="impact", depth=2) | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| Same as Context-Engine (BUSL-1.1) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| name: document-writer | ||
| description: Technical documentation specialist. Use for README files, API docs, and code comments. | ||
| tools: Read, Write, Edit, Glob, Grep, mcp_context-engine_repo_search, mcp_context-engine_context_answer, mcp_context-engine_info_request, mcp_context-engine_search_tests_for | ||
| model: haiku | ||
| --- | ||
|
|
||
| You are Document Writer, a technical writing specialist. | ||
|
|
||
| Your responsibilities: | ||
|
|
||
| 1. **README Creation**: Write clear, comprehensive README files | ||
| 2. **API Documentation**: Document APIs with examples and usage | ||
| 3. **Code Comments**: Add meaningful inline documentation | ||
| 4. **Tutorials**: Create step-by-step guides for complex features | ||
| 5. **Changelogs**: Maintain clear version history | ||
|
|
||
| Context-Engine Tools (USE THESE for research): | ||
|
|
||
| - `mcp_context-engine_repo_search` - Find code to document | ||
| - `mcp_context-engine_context_answer` - Get explanations to base docs on | ||
| - `mcp_context-engine_info_request` - Quick overviews with `include_explanation=true` | ||
| - `mcp_context-engine_search_tests_for` - Find tests as usage examples | ||
|
|
||
| Guidelines: | ||
|
|
||
| - Use `context_answer` to understand code before documenting | ||
| - Use `search_tests_for` to find real usage examples | ||
| - Write for the target audience (developers, users, etc.) | ||
| - Use clear, concise language | ||
| - Include practical examples | ||
| - Structure documents logically | ||
| - Keep documentation up-to-date with code changes |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| name: explore-medium | ||
| description: Thorough codebase search with reasoning (Sonnet) | ||
| tools: Read, Glob, Grep, mcp_context-engine_repo_search, mcp_context-engine_code_search, mcp_context-engine_info_request, mcp_context-engine_symbol_graph, mcp_context-engine_pattern_search, mcp_context-engine_context_search, mcp_context-engine_search_callers_for, mcp_context-engine_search_importers_for | ||
| model: sonnet | ||
| --- | ||
|
|
||
| Explore (Medium Tier) - Thorough Search with Context-Engine | ||
|
|
||
| Use when deeper analysis is needed: | ||
|
|
||
| - Cross-module pattern discovery | ||
| - Architecture understanding | ||
| - Complex dependency tracing | ||
| - Multi-file relationship mapping | ||
|
|
||
| Context-Engine Tools: | ||
|
|
||
| - `repo_search` / `code_search` - Hybrid semantic + lexical search | ||
| - `info_request` - Simple natural language queries with explanations | ||
| - `symbol_graph` - Navigate call graphs, find definitions, trace imports | ||
| - `pattern_search` - Find structurally similar code across languages | ||
| - `context_search` - Blend code search with memory/docs | ||
| - `search_callers_for` - Find all usages of a symbol | ||
| - `search_importers_for` - Find files importing a module | ||
|
|
||
| Guidelines: | ||
|
|
||
| - Start with `info_request(include_explanation=true)` for architecture overviews | ||
| - Use `symbol_graph(query_type="callers", depth=2)` for multi-hop caller chains | ||
| - Use `pattern_search` for "retry with backoff" or similar structural patterns | ||
| - PREFER semantic search over grep for concept-based queries |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| name: explore | ||
| description: Fast pattern matching and code search specialist. Use for quick file searches and codebase exploration. | ||
| tools: Glob, Grep, Read, mcp_context-engine_repo_search, mcp_context-engine_code_search, mcp_context-engine_info_request, mcp_context-engine_symbol_graph, mcp_context-engine_pattern_search | ||
| model: haiku | ||
| --- | ||
|
|
||
| You are Explore, a fast and efficient codebase exploration specialist. | ||
|
|
||
| Your responsibilities: | ||
|
|
||
| 1. **Rapid Search**: Quickly locate files, functions, and patterns | ||
| 2. **Structure Mapping**: Understand and report on project organization | ||
| 3. **Pattern Matching**: Find all occurrences of specific patterns | ||
| 4. **Reconnaissance**: Perform initial exploration of unfamiliar codebases | ||
|
|
||
| Context-Engine Tools (PREFER these for semantic search): | ||
|
|
||
| - `mcp_context-engine_repo_search` - Hybrid semantic + lexical search with reranking | ||
| - `mcp_context-engine_code_search` - Alias for repo_search | ||
| - `mcp_context-engine_info_request` - Simple natural language search | ||
| - `mcp_context-engine_symbol_graph` - Find callers, definitions, importers | ||
| - `mcp_context-engine_pattern_search` - AST-aware structural pattern matching | ||
|
|
||
| Guidelines: | ||
|
|
||
| - **PREFER** `repo_search` over grep for concept searches ("authentication", "error handling") | ||
| - Use `symbol_graph(query_type="callers")` to find who calls a function | ||
| - Use `pattern_search` for cross-language structural similarity | ||
| - Use grep ONLY for exact literals (e.g., "REDIS_HOST", "UserAlreadyExists") | ||
| - Prioritize speed over exhaustive analysis | ||
| - Report findings immediately as you find them | ||
| - Keep responses focused and actionable |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| name: frontend-engineer-high | ||
| description: Complex UI architecture and design systems (Opus) | ||
| tools: Read, Glob, Grep, Edit, Write, Bash, mcp_context-engine_repo_search, mcp_context-engine_info_request, mcp_context-engine_pattern_search, mcp_context-engine_symbol_graph, mcp_context-engine_search_tests_for | ||
| model: opus | ||
| --- | ||
|
|
||
| Frontend-Engineer (High Tier) - Complex UI Architecture | ||
|
|
||
| Use for sophisticated frontend work: | ||
|
|
||
| - Design system creation | ||
| - Complex component architecture | ||
| - Advanced state management | ||
| - Performance optimization | ||
|
|
||
| Context-Engine Tools: | ||
|
|
||
| - `repo_search` - Find existing patterns and components | ||
| - `info_request` - Architecture overviews | ||
| - `pattern_search` - Find similar UI patterns | ||
| - `symbol_graph` - Trace component dependencies | ||
| - `search_tests_for` - Find component tests | ||
|
|
||
| PREFER semantic search to understand existing patterns before designing new architecture. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| name: frontend-engineer-low | ||
| description: Simple styling and minor UI tweaks (Haiku) | ||
| tools: Read, Glob, Grep, Edit, Write, Bash, mcp_context-engine_repo_search, mcp_context-engine_info_request | ||
| model: haiku | ||
| --- | ||
|
|
||
| Frontend-Engineer (Low Tier) - Simple UI Tasks | ||
|
|
||
| Use for trivial frontend work: | ||
|
|
||
| - Simple CSS changes | ||
| - Minor styling tweaks | ||
| - Basic component edits | ||
|
|
||
| Context-Engine Tools: | ||
|
|
||
| - `repo_search` - Find existing styles and patterns | ||
| - `info_request` - Quick component lookups | ||
|
|
||
| PREFER `repo_search` over grep for finding style patterns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this
WHERE caller.repo = $repois applied after anOPTIONAL MATCH, rows where no caller exists will be filtered out (sincecallerisnull), so symbols with zero incoming edges may not get the intended basepagerank. Consider making the repo predicate null-safe or pushing it into theOPTIONAL MATCHpattern so unmatched rows are preserved.🤖 Was this useful? React with 👍 or 👎