Skip to content

[Feature]: Cross-project indexing and retrieval for microservices architecture #425

@evander-wang

Description

@evander-wang

Problem Statement

I work with a microservices architecture where multiple backend services call each other, along with frontend admin dashboards and mobile clients. I need to index all projects
into a unified knowledge graph for end-to-end code understanding.

However, the current design has significant limitations:

1. Path Resolution Failure

The current design stores only relative paths (path field) in graph nodes. When the working directory changes, file lookups fail because paths are relative to the indexing
directory.

2. No Project Context

There's no way to identify which project a code node belongs to. This makes it impossible to:

  • Filter queries by project
  • Understand which service owns a particular function/class
  • Trace code across project boundaries

3. No Cross-Service Call Tracing (Critical for Microservices)

When I query a function that calls another microservice, I cannot automatically follow that call to the target service's implementation. For example:

# In order-service
def create_order(user_id):
    # Calls user-service
    user = user_client.get_user(user_id)  # ← Where is this implemented?
    ...

Currently, there's no way to:

  • Know that user_client.get_user() is a call to user-service
  • Automatically query user-service for the get_user implementation
  • Understand the complete request flow across services

This makes it extremely difficult to:

  • Onboard new developers to understand system architecture
  • Debug issues that span multiple services

Refer Pr: #302

Proposed Solution

Add two new fields to ALL graph nodes:

  • absolute_path (string): Absolute file path for reliable file access regardless of working directory
  • project_name (string): Project identifier for filtering and cross-project queries

Schema Change

Before (Current):

(:Function {path: "src/api/handler.go", name: "GetUser"})
  • Cannot locate file from different directory
  • No project context

After (Proposed):

(:Function {
  path: "src/api/handler.go",                              // relative path (display)
  absolute_path: "/projects/user-service/src/api/handler.go",  // for file access
  project_name: "user-service"                             // for filtering & tracing
})

Design Decisions

  1. Retain path field - For backward compatibility and display purposes
  2. Add absolute_path - Enables file access from any working directory
  3. Add project_name - Enables project-scoped queries and cross-service tracing

Capability Scope

  • Query/Retrieval: Cross-project (Need end-to-end visibility across services)
  • Edit/Write: Single-project only (Safety - prevent accidental cross-project modifications)

Alternatives Considered

No response

Feature Category

Graph Schema

Priority/Impact

High - Would significantly improve my workflow

Use Case

Scenario 1: Microservices Cross-Service Query

I have multiple backend microservices that call each other:

  • user-service (Go)
  • order-service (Python)
  • payment-service (Go)
  • notification-service (Python)

Example Flow:

order-service.create_order()
    └── calls → user-service.get_user()
    └── calls → payment-service.process_payment()
                    └── calls → notification-service.send_receipt()

Current Behavior:
When I query create_order in order-service, I see:

def create_order(user_id):
    user = user_client.get_user(user_id)      # ← Dead end, don't know where this goes
    payment = payment_client.process_payment() # ← Dead end
    ...

Desired Behavior:
When I query create_order, the system can:

  1. Identify that user_client.get_user() calls user-service
  2. Automatically query user-service for get_user implementation
  3. Return the complete call chain

This dramatically speeds up understanding how the system works, especially for:

  • New developer onboarding - understand request flow quickly
  • Debugging - trace issues across service boundaries
  • Impact analysis - see what happens when changing an API

Scenario 2: End-to-End Full Stack Query

  • backend-api (Go, Python)
  • admin-web (Vue, TypeScript)
  • mobile-app (Flutter, Dart)

Query:

cgr query "Find all usages of GetUserProfile API"

This enables true full-stack understanding in a single query.

Examples

No response

Additional Context

No response

Contribution

  • I'm willing to implement this feature and submit a PR
  • I can help with testing
  • I can help with documentation

Checklist

  • I have searched existing issues and PRs to ensure this hasn't been requested
  • This feature aligns with the project's goals

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions