fix: Use dynamic project name detection for ChromaDB collections and observations (#142)

* fix: Use dynamic project name detection instead of hardcoded values

Fixes #140

Previously, the worker process used hardcoded "claude-mem" for:
- ChromaSync instantiation in DatabaseManager
- ChromaDB collection naming in search-server

This caused all observations to be tagged with "claude-mem" regardless
of the actual project being worked on.

Now both services use getCurrentProjectName() to dynamically detect the
project based on the worker's current working directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Simplify viewer UI overflow CSS to enable scrolling

- Remove overcomplicated nested overflow containers
- Use explicit 100vh for layout height
- Add overflow: hidden to main-col to constrain feed
- Keep simple overflow-y: auto on feed element
- Fix issue where feed content wouldn't scroll

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2025-11-20 20:37:57 -05:00
committed by GitHub
parent 0787e47b1a
commit b62e93577c
5 changed files with 57 additions and 45 deletions
File diff suppressed because one or more lines are too long
+7 -2
View File
@@ -289,17 +289,21 @@
box-sizing: border-box;
}
html {
height: 100%;
}
body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
background: var(--color-bg-primary);
color: var(--color-text-primary);
font-size: 14px;
overflow: hidden;
}
.full-height-flex-layout {
display: flex;
height: 100%;
height: 100vh;
position: relative;
}
@@ -307,6 +311,7 @@
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.sidebar {
+2 -2
View File
@@ -17,13 +17,13 @@ import { basename } from 'path';
import { SessionSearch } from '../services/sqlite/SessionSearch.js';
import { SessionStore } from '../services/sqlite/SessionStore.js';
import { ObservationSearchResult, SessionSummarySearchResult, UserPromptSearchResult } from '../services/sqlite/types.js';
import { VECTOR_DB_DIR } from '../shared/paths.js';
import { VECTOR_DB_DIR, getCurrentProjectName } from '../shared/paths.js';
// Initialize search instances
let search: SessionSearch;
let store: SessionStore;
let chromaClient: Client | null = null;
const COLLECTION_NAME = 'cm__claude-mem';
const COLLECTION_NAME = `cm__${getCurrentProjectName()}`;
try {
search = new SessionSearch();
+4 -2
View File
@@ -12,6 +12,7 @@ import { SessionStore } from '../sqlite/SessionStore.js';
import { SessionSearch } from '../sqlite/SessionSearch.js';
import { ChromaSync } from '../sync/ChromaSync.js';
import { logger } from '../../utils/logger.js';
import { getCurrentProjectName } from '../../shared/paths.js';
import type { DBSession } from '../worker-types.js';
export class DatabaseManager {
@@ -27,8 +28,9 @@ export class DatabaseManager {
this.sessionStore = new SessionStore();
this.sessionSearch = new SessionSearch();
// Initialize ChromaSync
this.chromaSync = new ChromaSync('claude-mem');
// Initialize ChromaSync with actual project name
const projectName = getCurrentProjectName();
this.chromaSync = new ChromaSync(projectName);
// Start background backfill (fire-and-forget, with error logging)
this.chromaSync.ensureBackfilled().catch((error) => {
+7 -2
View File
@@ -289,17 +289,21 @@
box-sizing: border-box;
}
html {
height: 100%;
}
body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
background: var(--color-bg-primary);
color: var(--color-text-primary);
font-size: 14px;
overflow: hidden;
}
.full-height-flex-layout {
display: flex;
height: 100%;
height: 100vh;
position: relative;
}
@@ -307,6 +311,7 @@
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.sidebar {