Skip to main content

Endpoint

POST /api/v1/memory/rescan
Triggers a background task to re-scan the repository and rebuild the project memory map. This is useful when you’ve made significant structural changes to your codebase or want to refresh the AI’s understanding of your project.

Authentication

Requires a valid JWT token in cookies (obtained via GitHub OAuth).

Query Parameters

repo
string
required
Repository in owner/repo format (must be connected to your account)

Response

status
string
Always returns rescan_started on success
repo
string
Repository full name that was rescanned

What Gets Rescanned

The rescan process performs the following operations:
  1. File Tree Analysis: Scans the entire repository structure on the default branch
  2. README Parsing: Extracts architecture notes and conventions from README files
  3. Configuration Analysis: Analyzes build configs, package managers, and tooling
  4. Framework Detection: Identifies web frameworks, ORMs, and key dependencies
  5. Memory Extraction: Uses Claude to extract architectural patterns and conventions
  6. Memory Storage: Stores extracted knowledge in Mem0 with appropriate scoping
The rescan runs asynchronously in the background. Existing memories are preserved unless they’re superseded by new scans. The process typically takes 30-60 seconds for medium-sized repositories.

Example Request

curl -X POST "https://your-backend.railway.app/api/v1/memory/rescan?repo=myorg/backend" \
  -H "Cookie: access_token=your_jwt_token"

Example Response

{
  "status": "rescan_started",
  "repo": "myorg/backend"
}

When to Use Rescan

After major refactoring or reorganizing your directory structure, rescan ensures the AI has the latest project layout.
If you’ve updated architectural documentation, conventions, or coding standards in your README or docs, rescan picks up the changes.
When adopting new frameworks, ORMs, or significant dependencies, rescan helps the AI understand the new patterns.
If the initial repo scan failed or was interrupted, you can manually trigger a rescan.
If you suspect the AI has outdated or incorrect information about your project, rescan refreshes the knowledge base.

Error Responses

{
  "detail": "repo must be owner/repo"
}

Monitoring Rescan Progress

To check if the rescan completed, use the memory stats endpoint:
curl "https://your-backend.railway.app/api/v1/memory/stats?repo=myorg/backend" \
  -H "Cookie: access_token=your_jwt_token"
Compare the total count before and after rescanning to verify new memories were created.

Memory Stats

View memory statistics by type

Project Map

View the extracted project knowledge

List Memories

Browse all memories for debugging

Build docs developers (and LLMs) love