Skip to content

fix(projects): normalize project names to lowercase to prevent duplicate entries #136

@durandv

Description

@durandv

Pre-flight Checks

  • I have searched existing issues and this is not a duplicate
  • I understand this issue needs status:approved before a PR can be opened

Bug Description

Engram sometimes detects the project name with the first letter uppercase and other times lowercase, creating two separate project entries in the database (e.g., energizados and Energizados). Although Engram occasionally detects this inconsistency internally and normalizes the name, it's not consistent — resulting in split memory: observations saved under one casing are invisible when searching under the other.

Steps to Reproduce

  1. Start a session in a project directory (e.g., /home/user/develop/bid/energizados)
  2. Save several observations — project is stored as energizados
  3. Start a new session in the same directory
  4. Engram detects the project as Energizados (capital E)
  5. Run mem_stats or mem_context — two separate projects now appear: energizados and Energizados
  6. Observations from one project are not visible when querying the other

Expected Behavior

Project names should always be normalized to lowercase (or consistently to a single canonical form) so the same directory always maps to the same project entry, regardless of how the name was detected.

Actual Behavior

Two projects exist in the database for the same working directory: energizados and Energizados. Memory is fragmented between the two.

Operating System

Linux

Agent / Client

Claude Code

Shell

zsh

Relevant Logs

> engram 1.11.0 — An elephant never forgets

26  sessions
19  observations
49  prompts
 2  projects

Projects
• energizados
• Energizados

Additional Context

A simple fix would be to normalize all project names to lowercase at ingestion time (both on write and on lookup). Alternatively, a merge/dedup utility (mem_merge_projects) could consolidate existing duplicate entries for existing users affected by this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions