Skip to content

Artifact bootstrap is a no-op across clone paths (project name derived from absolute repo path) #885

Description

@moofone

Artifact bootstrap is a no-op across clone paths (project name is derived from the absolute repo path)

Problem

cbm_project_name_from_path derives the project name from the full normalized repo path. Two clones of the same repository at different paths therefore get different project names.

The shared artifact DB (.codebase-memory/graph.db.zst) is keyed by the exporter's project name. When a teammate bootstraps from it (try_artifact_bootstrap in src/mcp/mcp.c), the imported DB contains rows only under the exporter's project, so the importer:

In other words, artifact bootstrap currently only helps when the importing machine uses the same absolute repo path as the exporter — which is rarely true across teammates. This was discovered while benchmarking #867 (see "Explicitly deferred" there).

Scope

Pre-existing and independent of the #868/#869/#870 stack — those PRs make bootstrap cheap when the project names line up (same path, CI caches, container images with fixed paths). This issue tracks making the team-sharing case work too.

Possible directions (not prescriptive)

  1. Key the artifact by a path-independent identity (e.g. repo basename + first-commit hash), and map it to the local project name at import.
  2. Rewrite the project column during cbm_artifact_import (the importer knows its own project name at import time).
  3. Store the exporter's project name in artifact.json and translate on read.

(2) looks smallest: import already byte-copies into a fresh cache DB, so an UPDATE ... SET project = ? over the copied rows right after the copy is contained and needs no schema/metadata changes.

Refs #867. Happy to take this on as a follow-up PR once the #868#870 stack settles, if the direction above (or another you prefer) sounds right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority/normalStandard review queue; useful PR with ordinary maintainer urgency.stability/performanceServer crashes, OOM, hangs, high CPU/memory

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions