Skip to content

Treat Git worktrees as one logical EntireContext project #247

Description

@teslamint

Summary

ec init creates a separate EntireContext project for each Git worktree. This fragments decision memory and prevents worktree sessions from using the main checkout context by default.

Reproduction

  1. Run ec init in the main checkout.
  2. Create or enter a linked Git worktree.
  3. Run ec init in the worktree.
  4. Run ec status in both directories.

Observed in the resume repository:

  • Main checkout: project resume, with existing session and turn history.
  • Worktree: project t3code-754baa7d, with zero sessions and zero turns after initialization.

Current behavior

  • find_git_root() uses git rev-parse --show-toplevel, which returns the worktree root.
  • get_db(repo_path) stores data at <repo_path>/.entirecontext/db/local.db.
  • Session and decision hooks resolve the same worktree-specific root.
  • No ec link command or automatic canonical-project resolution exists.

Expected behavior

All linked worktrees should share one logical EntireContext project and decision corpus, while each session retains its own:

  • workspace path
  • branch or worktree identity
  • session and turn metadata

The logical project should be keyed by the Git common directory, or an equivalent stable repository identity, not by --show-toplevel.

Proposed direction

  1. Resolve a canonical project identity from git rev-parse --git-common-dir.
  2. Store workspace path, branch, and worktree Git directory as session-scoped fields.
  3. Migrate existing per-worktree projects only after collision and attribution checks.
  4. Keep a backup or read-only copy of existing worktree databases during migration.
  5. Show the logical project and active workspace separately in ec status.

Safety note

Do not solve this by symlinking or copying local.db; that can mix project identity and workspace attribution.

Temporary workaround

Use the main project explicitly from another checkout, for example: ec search --global --repo resume query.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions