fix: entity detection prefers git repo directory names over README content - #158
fix: entity detection prefers git repo directory names over README content#158tavaresgmg wants to merge 1 commit into
Conversation
…ntent When `mempalace init` targets a folder of git repositories, the entity detector now uses directory names as high-confidence project candidates instead of surfacing generic words like "Code", "Typescript", "Node" scraped from README files. Changes: - Add detect_directory_projects() that scans for immediate child dirs containing .git (directories or worktree files) - Add base_dir parameter to detect_entities() to merge directory-based projects with content-based detection - Add 50+ common tech/programming stopwords to prevent false positives - Update onboarding.py to surface directory-detected projects during init - Add 29 tests covering all new functionality Closes MemPalace#97
PR Review: fix: entity detection prefers git repo directory names over README contentExecutive Summary
Affected Areas: Business Impact: Users running Flow Changes: Ratings
PR Health
Medium Priority Issues🎨 #1: Unused
|
|
This conflicts with main. The entity detection improvements are being addressed in #507 (NLP providers). If there are specific fixes not covered there, a rebased focused PR would be welcome. |
Summary
Fixes #97 —
mempalace initon a folder of git repositories now detects repo directory names as project candidates instead of surfacing generic words scraped from README files.Problem: Running
mempalace init <folder-of-repos>where the folder contains ~40 sibling git repositories produces useless entity suggestions like "Code (21x), Typescript (10x), Node (5x)" instead of the actual repo names (acme-dashboard,acme-chess, etc.).Root cause:
detect_entities()only scans file content for capitalized proper nouns. Directory names — the strongest signal for project identity — are completely ignored.Changes
detect_directory_projects(project_dir)— new function that scans for immediate child directories containing.git(supports both directories and worktree files) and returns them as high-confidence (0.95) project entitiesdetect_entities(file_paths, base_dir=None)— newbase_dirparameter triggers directory-based detection and merges results with content-based detection (deduplicating by name)Code,Typescript,Node,Plugin,Icon,React,Docker, etc.) that appear capitalized in READMEs but are not real entitiesonboarding.pyupdated —_auto_detect()now returns both detected people and directory-detected projects, andrun_onboarding()presents them separately during the interactive flowentity_detector.py __main__now passesbase_dirtodetect_entities()Test plan
tests/test_entity_detector.py(all passing)detect_directory_projects: finds git repos, skips non-git/hidden/SKIP_DIRS, handles worktrees, returns empty for nonexistent dirsdetect_entitieswithbase_dir: includes directory projects, merges without duplicates, sorted by confidencescore_entity/classify_entity: person and project signal detection verifiedscan_for_detection: prose files found,.gitskipped, fallback to readable filestest_dialect.pyunrelated to this PR)ruff checkandruff formatclean