Skip to content

Smarter project identification for cross-repo work #1

Description

@kunickiaj

Problem

When working in repo A (e.g., greenroom) but editing files in repo B (e.g., opencode-mem), memories get tagged with the cwd project (A) instead of the actual project being worked on (B).

Proposed Solution: File Path Heuristics

Track which repo's files are touched during a session and use that to determine the actual project:

  1. Extract all file paths from tool.execute.after events (read/write/edit tools)
  2. Group by git repo root (find nearest .git parent)
  3. If dominant repo ≠ cwd, update session's project to dominant repo

Why this approach?

  • Reliable signal - File operations are concrete actions, not ambiguous text
  • Already available - We capture tool.execute.after events with file paths
  • Low complexity - Count paths and pick the dominant repo
  • Works across languages/topics - Doesn't depend on naming conventions

Alternative considered: Keyword analysis

  • Scan prompts for project-specific keywords
  • Rejected: too ambiguous, needs keyword list maintenance, false positives when discussing other projects

Implementation Location

Likely in plugin_ingest.py or during session finalization.

Context

This came up when fixing the message extraction bug while cwd was greenroom but all file edits were in opencode-mem. Had to manually SQL update 16 sessions to fix the project tag.

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