Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d40b45fd1 | |||
| 05323c9db5 | |||
| c314946204 | |||
| 7eb9f4051c | |||
| 550183bab2 | |||
| 92c4d245c4 | |||
| a2ab45a461 | |||
| 1d68e299dc | |||
| b987789754 |
@@ -10,7 +10,7 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "9.0.3",
|
||||
"version": "9.0.5",
|
||||
"source": "./plugin",
|
||||
"description": "Persistent memory system for Claude Code - context compression across sessions"
|
||||
}
|
||||
|
||||
+2
-20
@@ -3,27 +3,9 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 21, 2025
|
||||
### Nov 3, 2025
|
||||
|
||||
**test-analysis-report.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31743 | 10:36 PM | 🔵 | PR #412 proposes mode system with inheritance and multilingual support | ~523 |
|
||||
|
||||
### Dec 22, 2025
|
||||
|
||||
**test-analysis-report.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31865 | 6:56 PM | ✅ | 開発ドキュメントのクリーンアップをコミット | ~150 |
|
||||
| #31864 | " | ✅ | 計画ドキュメントと分析ファイルの削除 | ~142 |
|
||||
| #31859 | 6:55 PM | ✅ | 計画ドキュメントファイルの削除 | ~109 |
|
||||
| #31855 | 6:53 PM | ✅ | テストスイートの大規模削除とテスト分析レポートの追加 | ~197 |
|
||||
|
||||
### Dec 25, 2025
|
||||
|
||||
**settings.json**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32602 | 8:42 PM | 🔵 | Identified potential settings configuration files | ~224 |
|
||||
| #3366 | 3:40 PM | 🔵 | Claude Mem MCP Search Architecture and Timeline Tool Capabilities | ~438 |
|
||||
</claude-mem-context>
|
||||
@@ -5,30 +5,16 @@
|
||||
|
||||
### Oct 25, 2025
|
||||
|
||||
**changelog.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #2491 | 10:59 PM | 🟣 | Added changelog viewer slash command | ~290 |
|
||||
| #2484 | 6:33 PM | 🔴 | Removed slash commands from incorrect root .claude/commands directory | ~268 |
|
||||
|
||||
### Jan 10, 2026
|
||||
|
||||
**terminal-shortcut.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #2480 | 6:32 PM | 🟣 | Cross-platform terminal shortcut command for claude-mem CLI | ~459 |
|
||||
|
||||
**setup-alias.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #2479 | 6:29 PM | 🟣 | Shell Alias Setup Slash Command | ~423 |
|
||||
|
||||
**version-bump.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #2358 | 1:07 PM | 🟣 | Created version-bump slash command for automated version updates | ~361 |
|
||||
|
||||
### Jan 1, 2026
|
||||
|
||||
**anti-pattern-czar.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35638 | 11:17 PM | 🟣 | Anti-Pattern Czar Custom Command Created | ~583 |
|
||||
| #39054 | 3:45 PM | 🔄 | Development commands removed from root .claude directory | ~249 |
|
||||
| #39053 | " | 🟣 | Added development commands to plugin distribution | ~276 |
|
||||
| #39051 | 3:44 PM | 🔵 | Development commands confirmed in .claude/commands/ | ~315 |
|
||||
| #39049 | " | 🔵 | Development commands located in .claude/commands/ directory | ~293 |
|
||||
</claude-mem-context>
|
||||
@@ -0,0 +1,314 @@
|
||||
# Plan: Cleanup worker-service.ts Unjustified Logic
|
||||
|
||||
**Created:** 2026-01-13
|
||||
**Source:** `docs/reports/nonsense-logic.md`
|
||||
**Target:** `src/services/worker-service.ts` (813 lines)
|
||||
**Goal:** Address 23 identified issues, prioritizing safe deletions first
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (COMPLETED)
|
||||
|
||||
### Evidence Gathered
|
||||
|
||||
**Exit Code Strategy (CLAUDE.md:44-54):**
|
||||
```
|
||||
- Exit 0: Success or graceful shutdown (Windows Terminal closes tabs)
|
||||
- Exit 1: Non-blocking error
|
||||
- Exit 2: Blocking error
|
||||
Philosophy: Exit 0 prevents Windows Terminal tab accumulation
|
||||
```
|
||||
|
||||
**Signal Handler Pattern (ProcessManager.ts:294-317):**
|
||||
- Uses mutable reference object `isShuttingDownRef`
|
||||
- Factory function `createSignalHandler()` returns handler with embedded state
|
||||
- Current implementation has 3-hop indirection
|
||||
|
||||
**MCP Client Pattern (worker-service.ts:157-160, ChromaSync.ts:124-136):**
|
||||
```typescript
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: '1.0.0'
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**Verification Results:**
|
||||
- `runInteractiveSetup` (lines 439-639): **NEVER CALLED** - grep shows only definition
|
||||
- `import * as fs from 'fs'` (line 13): **UNUSED** - no `fs.` usage found
|
||||
- `import { spawn } from 'child_process'` (line 14): **UNUSED** - no `spawn(` calls
|
||||
- `homedir` (line 15): Only used in `runInteractiveSetup` (dead code)
|
||||
- `processPendingQueues` default `= 10`: Never used, all callers pass explicit args
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Safe Deletions (Dead Code & Unused Imports)
|
||||
|
||||
### 1.1 Delete `runInteractiveSetup` Function
|
||||
|
||||
**What:** Delete lines 435-639 (~201 lines)
|
||||
**Why:** Function is defined but never called. Setup happens via `handleCursorCommand()`.
|
||||
**Evidence:** `grep -n "runInteractiveSetup" src/services/worker-service.ts` returns only definition
|
||||
|
||||
**Pattern to follow:** N/A - straight deletion
|
||||
|
||||
**Steps:**
|
||||
1. Read worker-service.ts lines 435-650
|
||||
2. Delete the entire function including section comment (lines 435-639)
|
||||
3. Run `npm run build` to verify no compile errors
|
||||
|
||||
**Verification:**
|
||||
- `grep "runInteractiveSetup" src/` returns nothing
|
||||
- Build succeeds
|
||||
|
||||
### 1.2 Remove Unused Imports
|
||||
|
||||
**What:** Delete lines 13, 14, 17
|
||||
|
||||
**Current (delete these):**
|
||||
```typescript
|
||||
import * as fs from 'fs'; // Line 13 - UNUSED
|
||||
import { spawn } from 'child_process'; // Line 14 - UNUSED
|
||||
import * as readline from 'readline'; // Line 17 - Only in dead code
|
||||
```
|
||||
|
||||
**Keep:**
|
||||
```typescript
|
||||
import { homedir } from 'os'; // Line 15 - DELETE (only in dead code)
|
||||
import { existsSync, writeFileSync, readFileSync, mkdirSync } from 'fs'; // Line 16 - CHECK USAGE
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. After deleting `runInteractiveSetup`, grep for remaining usages:
|
||||
- `grep "homedir" src/services/worker-service.ts`
|
||||
- `grep "readline" src/services/worker-service.ts`
|
||||
- `grep "detectClaudeCode\|findCursorHooksDir\|installCursorHooks\|configureCursorMcp" src/services/worker-service.ts`
|
||||
2. Delete imports with zero usages
|
||||
3. Run `npm run build`
|
||||
|
||||
**Verification:**
|
||||
- No TypeScript unused import warnings
|
||||
- Build succeeds
|
||||
|
||||
### 1.3 Clean Up Cursor Integration Imports
|
||||
|
||||
After deleting `runInteractiveSetup`, some CursorHooksInstaller imports become unused:
|
||||
- `detectClaudeCode` - only in runInteractiveSetup
|
||||
- `findCursorHooksDir` - only in runInteractiveSetup
|
||||
- `installCursorHooks` - only in runInteractiveSetup
|
||||
- `configureCursorMcp` - only in runInteractiveSetup
|
||||
|
||||
**Steps:**
|
||||
1. Grep each import after dead code removal
|
||||
2. Remove any that are now unused
|
||||
3. Keep `updateCursorContextForProject` (re-exported) and `handleCursorCommand` (used in main)
|
||||
|
||||
**Verification:**
|
||||
- `grep "detectClaudeCode\|findCursorHooksDir\|installCursorHooks\|configureCursorMcp" src/services/worker-service.ts` returns nothing
|
||||
- Build succeeds
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Low-Risk Simplifications
|
||||
|
||||
### 2.1 Remove Unused Default Parameter
|
||||
|
||||
**What:** Line 350 - `async processPendingQueues(sessionLimit: number = 10)`
|
||||
**Why:** Default never used. All callers pass explicit args (50 in startup, dynamic in HTTP)
|
||||
|
||||
**Change from:**
|
||||
```typescript
|
||||
async processPendingQueues(sessionLimit: number = 10): Promise<{...}>
|
||||
```
|
||||
|
||||
**Change to:**
|
||||
```typescript
|
||||
async processPendingQueues(sessionLimit: number): Promise<{...}>
|
||||
```
|
||||
|
||||
**Verification:**
|
||||
- Build succeeds
|
||||
- All call sites provide explicit values
|
||||
|
||||
### 2.2 Simplify onRestart Callback
|
||||
|
||||
**Location:** Lines 395-396 (approximate, find exact)
|
||||
**Issue:** `onShutdown` and `onRestart` both call `this.shutdown()`
|
||||
|
||||
**Find pattern:**
|
||||
```typescript
|
||||
onShutdown: () => this.shutdown(),
|
||||
onRestart: () => this.shutdown()
|
||||
```
|
||||
|
||||
**Options:**
|
||||
1. **Keep as-is** if restart semantically differs from shutdown (future-proofing)
|
||||
2. **Add comment** explaining intentional parity
|
||||
3. **Remove onRestart** if never used differently
|
||||
|
||||
**Investigation needed:** Grep for `onRestart` usage in Server.ts to understand contract
|
||||
|
||||
**Steps:**
|
||||
1. Grep `onRestart` in `src/services/server/`
|
||||
2. If Server.ts treats them identically, add clarifying comment
|
||||
3. If different, document why both map to shutdown
|
||||
|
||||
### 2.3 Fix Over-Commented Lines (Sample Only)
|
||||
|
||||
**Strategy:** Do NOT strip all comments. Only remove comments that describe obvious code.
|
||||
|
||||
**Anti-pattern (remove):**
|
||||
```typescript
|
||||
// WHAT: Imports centralized logging utility with structured output
|
||||
// WHY: All worker logs go through this for consistent formatting
|
||||
import { logger } from '../utils/logger.js';
|
||||
```
|
||||
|
||||
**Pattern to follow:** Remove WHAT/WHY on simple imports. Keep architectural comments.
|
||||
|
||||
**Scope:** Sample 5-10 obvious comment removals to demonstrate approach, not exhaustive
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Medium-Risk Improvements
|
||||
|
||||
### 3.1 Simplify Signal Handler Pattern
|
||||
|
||||
**Current (worker-service.ts:180-192 + ProcessManager.ts:294-317):**
|
||||
```typescript
|
||||
// 3-hop indirection with mutable reference
|
||||
const shutdownRef = { value: this.isShuttingDown };
|
||||
const handler = createSignalHandler(() => this.shutdown(), shutdownRef);
|
||||
process.on('SIGTERM', () => {
|
||||
this.isShuttingDown = shutdownRef.value; // Sync back
|
||||
handler('SIGTERM');
|
||||
});
|
||||
```
|
||||
|
||||
**Simplified approach:**
|
||||
```typescript
|
||||
private registerSignalHandlers(): void {
|
||||
const handler = async (signal: string) => {
|
||||
if (this.isShuttingDown) {
|
||||
logger.warn('SYSTEM', `Received ${signal} but shutdown already in progress`);
|
||||
return;
|
||||
}
|
||||
this.isShuttingDown = true;
|
||||
logger.info('SYSTEM', `Received ${signal}, shutting down...`);
|
||||
try {
|
||||
await this.shutdown();
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
logger.error('SYSTEM', 'Error during shutdown', {}, error as Error);
|
||||
process.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
process.on('SIGTERM', () => handler('SIGTERM'));
|
||||
process.on('SIGINT', () => handler('SIGINT'));
|
||||
}
|
||||
```
|
||||
|
||||
**Decision needed:** Does `createSignalHandler` serve other callers? If yes, keep factory but simplify worker usage.
|
||||
|
||||
**Steps:**
|
||||
1. Grep `createSignalHandler` usage across codebase
|
||||
2. If only worker-service uses it, inline and simplify
|
||||
3. If shared, simplify worker's usage while keeping factory
|
||||
|
||||
### 3.2 Unify Dual Initialization Tracking
|
||||
|
||||
**Current (lines 111, 129-130):**
|
||||
```typescript
|
||||
private initializationCompleteFlag: boolean = false;
|
||||
private initializationComplete: Promise<void>;
|
||||
```
|
||||
|
||||
**Recommendation:** Keep both but add clarifying comments:
|
||||
- Promise: For async waiters (HTTP handlers)
|
||||
- Flag: For sync checks (status endpoints)
|
||||
|
||||
**Alternative:** Use Promise with inspection pattern:
|
||||
```typescript
|
||||
private initializationComplete = false;
|
||||
private initializationPromise: Promise<void>;
|
||||
// Flag derived from promise state via finally() callback
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. Add documentation comment explaining dual tracking purpose
|
||||
2. Consider if flag can be derived from promise state instead
|
||||
|
||||
### 3.3 Reduce 5-Minute Timeout
|
||||
|
||||
**Location:** Lines 464-478 (approximate)
|
||||
**Current:** `const timeoutMs = 300000; // 5 minutes`
|
||||
**Recommendation:** Reduce to 30-60 seconds for HTTP handler, keep 5min for MCP init
|
||||
|
||||
**Caution:** MCP initialization can legitimately be slow (ChromaDB, model loading). May need different timeouts per use case.
|
||||
|
||||
**Steps:**
|
||||
1. Find exact line for context inject timeout
|
||||
2. Verify this is separate from MCP init timeout
|
||||
3. Reduce HTTP handler timeout to 30-60 seconds
|
||||
4. Keep MCP init timeout at 5 minutes
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Deferred / Low Priority
|
||||
|
||||
These items are noted but NOT part of this cleanup:
|
||||
|
||||
| Issue | Reason to Defer |
|
||||
|-------|-----------------|
|
||||
| Exit code 0 always | Documented Windows Terminal workaround - intentional |
|
||||
| Re-export for circular import | Works correctly, architectural fix is separate work |
|
||||
| Fallback agent verification | Behavioral change, needs feature design |
|
||||
| MCP version hardcoding | Low impact, separate version management issue |
|
||||
| Empty capabilities | Documentation issue only |
|
||||
| Unsafe `as Error` casts | Common TS pattern, low risk |
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Verification
|
||||
|
||||
### 5.1 Build Verification
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
Expected: No errors
|
||||
|
||||
### 5.2 Test Suite
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
Expected: All tests pass
|
||||
|
||||
### 5.3 Grep for Anti-patterns
|
||||
```bash
|
||||
# Verify dead code removed
|
||||
grep -r "runInteractiveSetup" src/
|
||||
|
||||
# Verify unused imports removed
|
||||
grep "import \* as fs from 'fs'" src/services/worker-service.ts
|
||||
grep "import { spawn }" src/services/worker-service.ts
|
||||
```
|
||||
Expected: No matches
|
||||
|
||||
### 5.4 Runtime Check
|
||||
```bash
|
||||
npm run build-and-sync
|
||||
# Start worker and verify basic operation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Items | Estimated Reduction |
|
||||
|-------|-------|---------------------|
|
||||
| Phase 1 | Dead code + unused imports | ~210 lines |
|
||||
| Phase 2 | Low-risk simplifications | ~5 lines + clarity |
|
||||
| Phase 3 | Medium-risk improvements | ~30 lines |
|
||||
| Total | | ~245 lines (~30% reduction) |
|
||||
|
||||
**Execution Order:** Phase 1 → Phase 2 → Phase 3 → Phase 5 (verification after each)
|
||||
@@ -0,0 +1,356 @@
|
||||
# Execution Plan: Intentional Patterns Validation Actions
|
||||
|
||||
**Created:** 2026-01-13
|
||||
**Source:** `docs/reports/intentional-patterns-validation.md`
|
||||
**Target:** `src/services/worker-service.ts` and related files
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (COMPLETED)
|
||||
|
||||
### Evidence Gathered
|
||||
|
||||
**Files Analyzed:**
|
||||
- `docs/reports/intentional-patterns-validation.md` - Pattern verdicts and recommendations
|
||||
- `docs/reports/nonsense-logic.md` - Original 23 issues identified
|
||||
- `.claude/plans/cleanup-worker-service-nonsense-logic.md` - Existing cleanup plan
|
||||
- `src/services/worker-service.ts` (813 lines) - Current state
|
||||
|
||||
**Current State:**
|
||||
- File has been reduced from 1445 lines to 813 lines in prior refactoring
|
||||
- `runInteractiveSetup` still exists at line 439 (~200 lines of dead code)
|
||||
- Re-export at line 78: `export { updateCursorContextForProject };`
|
||||
- MCP version hardcoded "1.0.0" at line 159
|
||||
- Fallback agents set at lines 144-146 without verification
|
||||
- Unused imports: `fs`, `spawn`, `homedir`, `readline` at lines 13-17
|
||||
|
||||
**Allowed APIs (from validation report):**
|
||||
- Exit code 0 pattern: **KEEP** (documented Windows Terminal workaround)
|
||||
- `as Error` casts: **KEEP** (documented project policy)
|
||||
- Dual init tracking: **KEEP** (serves async + sync callers)
|
||||
- Signal handler ref pattern: **KEEP** (standard JS mutable state sharing)
|
||||
- Empty MCP capabilities: **KEEP** (correct per MCP spec)
|
||||
|
||||
**Actions Required:**
|
||||
| Pattern | Action | Priority |
|
||||
|---------|--------|----------|
|
||||
| Re-export for circular import | Remove (no actual circular dep) | LOW |
|
||||
| Fallback agent without check | Add availability verification | HIGH |
|
||||
| MCP version hardcoded | Update to use package.json | LOW |
|
||||
| Dead code `runInteractiveSetup` | Delete (~200 lines) | HIGH |
|
||||
| Unused imports | Delete | LOW |
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Delete Dead Code (HIGH PRIORITY)
|
||||
|
||||
### 1.1 Delete `runInteractiveSetup` Function
|
||||
|
||||
**What:** Delete lines 435-639 (approximately 200 lines)
|
||||
**File:** `src/services/worker-service.ts`
|
||||
|
||||
**Location confirmed:** Line 439 starts `async function runInteractiveSetup(): Promise<number>`
|
||||
|
||||
**Steps:**
|
||||
1. Read worker-service.ts lines 435-650 to find exact boundaries
|
||||
2. Delete the section comment and entire function
|
||||
3. Run build to verify no compile errors
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
grep -n "runInteractiveSetup" src/services/worker-service.ts
|
||||
# Expected: No output (function deleted)
|
||||
npm run build
|
||||
# Expected: No errors
|
||||
```
|
||||
|
||||
### 1.2 Remove Unused Imports
|
||||
|
||||
**What:** Delete imports only used by dead code
|
||||
**Lines to delete:** 13-17 (check each)
|
||||
|
||||
**Current imports to remove:**
|
||||
```typescript
|
||||
import * as fs from 'fs'; // Line 13 - UNUSED (namespace never accessed)
|
||||
import { spawn } from 'child_process'; // Line 14 - UNUSED (MCP uses StdioClientTransport)
|
||||
import { homedir } from 'os'; // Line 15 - Only in dead code
|
||||
import * as readline from 'readline'; // Line 17 - Only in dead code
|
||||
```
|
||||
|
||||
**Keep:**
|
||||
```typescript
|
||||
import { existsSync, writeFileSync, readFileSync, mkdirSync } from 'fs'; // Line 16 - CHECK
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. After deleting `runInteractiveSetup`, grep each import
|
||||
2. Delete any with zero usages
|
||||
3. Run build to verify
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
grep -n "^import \* as fs" src/services/worker-service.ts
|
||||
grep -n "import { spawn }" src/services/worker-service.ts
|
||||
# Expected: No output
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 1.3 Remove Unused CursorHooksInstaller Imports
|
||||
|
||||
**After deleting dead code, check:**
|
||||
```typescript
|
||||
import {
|
||||
updateCursorContextForProject, // KEEP (re-exported)
|
||||
handleCursorCommand, // KEEP (used in main)
|
||||
detectClaudeCode, // DELETE (only in dead code)
|
||||
findCursorHooksDir, // DELETE (only in dead code)
|
||||
installCursorHooks, // DELETE (only in dead code)
|
||||
configureCursorMcp // DELETE (only in dead code)
|
||||
} from './integrations/CursorHooksInstaller.js';
|
||||
```
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
grep "detectClaudeCode\|findCursorHooksDir\|installCursorHooks\|configureCursorMcp" src/services/worker-service.ts
|
||||
# Expected: Only import line (which gets trimmed)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Fix Fallback Agent Oversight (HIGH PRIORITY)
|
||||
|
||||
### 2.1 Add SDKAgent Availability Check
|
||||
|
||||
**Problem:** Lines 144-146 set Claude SDK as fallback without verifying it's configured
|
||||
```typescript
|
||||
this.geminiAgent.setFallbackAgent(this.sdkAgent);
|
||||
this.openRouterAgent.setFallbackAgent(this.sdkAgent);
|
||||
```
|
||||
|
||||
**Risk:** User chooses Gemini because they lack Claude credentials → transient Gemini error → fallback to Claude SDK → cascading failure
|
||||
|
||||
**Solution Options:**
|
||||
|
||||
**Option A: Add isConfigured() method to SDKAgent**
|
||||
1. Add method to SDKAgent that checks for valid Claude SDK credentials
|
||||
2. Only set fallback if `sdkAgent.isConfigured()` returns true
|
||||
3. Log warning when fallback unavailable
|
||||
|
||||
**Pattern to follow (from SDKAgent.ts constructor):**
|
||||
```typescript
|
||||
// Check if Claude SDK can be initialized
|
||||
public isConfigured(): boolean {
|
||||
// Claude SDK uses subprocess, check if claude command exists
|
||||
try {
|
||||
// Check for ANTHROPIC_API_KEY or claude CLI availability
|
||||
return !!process.env.ANTHROPIC_API_KEY || this.checkClaudeCliAvailable();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Option B: Document limitation (minimal fix)**
|
||||
Add comment explaining the risk:
|
||||
```typescript
|
||||
// NOTE: Fallback to Claude SDK may fail if user lacks Claude credentials
|
||||
// Consider adding availability check in future (Issue #XXX)
|
||||
this.geminiAgent.setFallbackAgent(this.sdkAgent);
|
||||
```
|
||||
|
||||
**Recommended: Option A**
|
||||
|
||||
**Steps:**
|
||||
1. Read SDKAgent.ts to understand initialization pattern
|
||||
2. Add `isConfigured()` method that checks Claude CLI/credentials
|
||||
3. Update worker-service.ts to conditionally set fallback
|
||||
4. Add warning log when fallback unavailable
|
||||
5. Run tests
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
grep -n "isConfigured" src/services/worker/SDKAgent.ts
|
||||
# Expected: Method definition
|
||||
grep -n "setFallbackAgent" src/services/worker-service.ts
|
||||
# Expected: Conditional calls with isConfigured check
|
||||
npm test
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Remove Unnecessary Re-Export (LOW PRIORITY)
|
||||
|
||||
### 3.1 Fix Misleading Re-Export
|
||||
|
||||
**Current (worker-service.ts:77-78):**
|
||||
```typescript
|
||||
// Re-export updateCursorContextForProject for SDK agents
|
||||
export { updateCursorContextForProject };
|
||||
```
|
||||
|
||||
**Issue:** Comment implies avoiding circular import, but investigation found NO circular dependency exists.
|
||||
|
||||
**Import chain:**
|
||||
```
|
||||
CursorHooksInstaller.ts (defines) → worker-service.ts (imports, re-exports) → ResponseProcessor.ts (imports)
|
||||
```
|
||||
|
||||
**ResponseProcessor.ts could import directly from CursorHooksInstaller.ts**
|
||||
|
||||
**Options:**
|
||||
1. **Remove re-export entirely** - Update ResponseProcessor.ts to import from CursorHooksInstaller directly
|
||||
2. **Fix comment** - Update to reflect actual reason (API surface simplification)
|
||||
|
||||
**Recommended: Option 1 (cleaner)**
|
||||
|
||||
**Steps:**
|
||||
1. Update `src/services/worker/agents/ResponseProcessor.ts`:
|
||||
- Change: `import { updateCursorContextForProject } from '../../worker-service.js';`
|
||||
- To: `import { updateCursorContextForProject } from '../../integrations/CursorHooksInstaller.js';`
|
||||
2. Delete re-export from worker-service.ts (lines 77-78)
|
||||
3. Run build to verify
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
grep -n "export { updateCursorContextForProject" src/services/worker-service.ts
|
||||
# Expected: No output
|
||||
grep -n "updateCursorContextForProject" src/services/worker/agents/ResponseProcessor.ts
|
||||
# Expected: Import from CursorHooksInstaller
|
||||
npm run build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Update MCP Version (LOW PRIORITY)
|
||||
|
||||
### 4.1 Use Package Version for MCP Client
|
||||
|
||||
**Current (worker-service.ts:157-160):**
|
||||
```typescript
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: '1.0.0' // Hardcoded, should match package.json (9.0.4)
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**Also affects (from report):**
|
||||
- `src/services/sync/ChromaSync.ts:126-131`
|
||||
- MCP server (separate file)
|
||||
|
||||
**Pattern to follow:**
|
||||
```typescript
|
||||
import { version } from '../../package.json' assert { type: 'json' };
|
||||
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: version
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**Alternative (if JSON import not supported):**
|
||||
```typescript
|
||||
import { readFileSync } from 'fs';
|
||||
const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'));
|
||||
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: pkg.version
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. Check if JSON import assertion works in project
|
||||
2. Update worker-service.ts MCP client initialization
|
||||
3. Update ChromaSync.ts similarly
|
||||
4. Run build to verify
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
grep -n "version: '1.0.0'" src/services/worker-service.ts src/services/sync/ChromaSync.ts
|
||||
# Expected: No output
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 4.2 Add MCP Capabilities Comment
|
||||
|
||||
**Current:**
|
||||
```typescript
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**Add clarifying comment:**
|
||||
```typescript
|
||||
}, {
|
||||
// MCP spec: Clients accept all server capabilities; no declaration needed
|
||||
capabilities: {}
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Verification
|
||||
|
||||
### 5.1 Build Check
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
**Expected:** No TypeScript errors
|
||||
|
||||
### 5.2 Test Suite
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
**Expected:** All tests pass
|
||||
|
||||
### 5.3 Grep for Anti-Patterns
|
||||
```bash
|
||||
# Verify dead code removed
|
||||
grep -r "runInteractiveSetup" src/
|
||||
# Expected: No matches
|
||||
|
||||
# Verify unused imports removed
|
||||
grep "import \* as fs from 'fs'" src/services/worker-service.ts
|
||||
# Expected: No match
|
||||
|
||||
# Verify re-export removed
|
||||
grep "export { updateCursorContextForProject" src/services/worker-service.ts
|
||||
# Expected: No match
|
||||
|
||||
# Verify fallback has check
|
||||
grep -A2 "setFallbackAgent" src/services/worker-service.ts
|
||||
# Expected: Conditional with isConfigured check
|
||||
```
|
||||
|
||||
### 5.4 Runtime Check
|
||||
```bash
|
||||
npm run build-and-sync
|
||||
# Manually verify worker starts and basic operations work
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Description | Lines Changed | Priority |
|
||||
|-------|-------------|---------------|----------|
|
||||
| Phase 1 | Delete dead code + imports | ~200 deleted | HIGH |
|
||||
| Phase 2 | Add fallback verification | ~10 added | HIGH |
|
||||
| Phase 3 | Remove re-export | ~5 changed | LOW |
|
||||
| Phase 4 | Update MCP version | ~3 changed | LOW |
|
||||
| Phase 5 | Verification | N/A | N/A |
|
||||
|
||||
**Execution Order:** Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5
|
||||
|
||||
**Note:** Each phase should be followed by verification (build + test) before proceeding.
|
||||
|
||||
---
|
||||
|
||||
## Patterns Confirmed KEEP (No Action)
|
||||
|
||||
These patterns were validated as intentional:
|
||||
|
||||
1. **Exit code 0 always** - Windows Terminal tab accumulation workaround (commit 222a73da)
|
||||
2. **`as Error` casts** - Documented project policy with anti-pattern detection
|
||||
3. **Dual init tracking** - Promise for async, flag for sync callers
|
||||
4. **Signal handler ref pattern** - Standard JS mutable state sharing
|
||||
5. **Empty MCP capabilities** - Correct per MCP client spec
|
||||
+44
-31
@@ -2,6 +2,50 @@
|
||||
|
||||
All notable changes to claude-mem.
|
||||
|
||||
## [v9.0.4] - 2026-01-10
|
||||
|
||||
## What's New
|
||||
|
||||
This release adds the `/do` and `/make-plan` development commands to the plugin distribution, making them available to all users who install the plugin from the marketplace.
|
||||
|
||||
### Features
|
||||
|
||||
- **Development Commands Now Distributed with Plugin** (#666)
|
||||
- `/do` command - Execute tasks with structured workflow
|
||||
- `/make-plan` command - Create detailed implementation plans
|
||||
- Commands now available at `plugin/commands/` for all users
|
||||
|
||||
### Documentation
|
||||
|
||||
- Revised Arabic README for clarity and corrections (#661)
|
||||
|
||||
### Full Changelog
|
||||
|
||||
https://github.com/thedotmack/claude-mem/compare/v9.0.3...v9.0.4
|
||||
|
||||
## [v9.0.3] - 2026-01-10
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
### Hook Framework JSON Status Output (#655)
|
||||
|
||||
Fixed an issue where the worker service startup wasn't producing proper JSON status output for the Claude Code hook framework. This caused hooks to appear stuck or unresponsive during worker initialization.
|
||||
|
||||
**Changes:**
|
||||
- Added `buildStatusOutput()` function for generating structured JSON status output
|
||||
- Worker now outputs JSON with `status`, `message`, and `continue` fields on stdout
|
||||
- Proper exit code 0 ensures Windows Terminal compatibility (no tab accumulation)
|
||||
- `continue: true` flag ensures Claude Code continues processing after hook execution
|
||||
|
||||
**Technical Details:**
|
||||
- Extracted status output generation into a pure, testable function
|
||||
- Added comprehensive test coverage in `tests/infrastructure/worker-json-status.test.ts`
|
||||
- 23 passing tests covering unit, CLI integration, and hook framework compatibility
|
||||
|
||||
## Housekeeping
|
||||
|
||||
- Removed obsolete error handling baseline file
|
||||
|
||||
## [v9.0.2] - 2026-01-10
|
||||
|
||||
## Bug Fixes
|
||||
@@ -1258,34 +1302,3 @@ Fixed unbounded database growth in the `pending_messages` table by implementing
|
||||
|
||||
**Full Changelog**: https://github.com/thedotmack/claude-mem/compare/v7.3.0...v7.3.1
|
||||
|
||||
## [v7.3.0] - 2025-12-16
|
||||
|
||||
## Features
|
||||
|
||||
- **Table-based search output**: Unified timeline formatting with cleaner, more organized presentation of search results grouped by date and file
|
||||
- **Simplified API**: Removed unused format parameter from MCP search tools for cleaner interface
|
||||
- **Shared formatting utilities**: Extracted common timeline formatting logic into reusable module
|
||||
- **Batch observations endpoint**: Added `/api/observations/batch` endpoint for efficient retrieval of multiple observations by ID array
|
||||
|
||||
## Changes
|
||||
|
||||
- **Default model upgrade**: Changed default model from Haiku to Sonnet for better observation quality
|
||||
- **Removed fake URIs**: Replaced claude-mem:// pseudo-protocol with actual HTTP API endpoints for citations
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Fixed undefined debug function calls in MCP server
|
||||
- Fixed skillPath variable scoping bug in instructions endpoint
|
||||
- Extracted magic numbers to named constants for better code maintainability
|
||||
|
||||
**Full Changelog**: https://github.com/thedotmack/claude-mem/compare/v7.2.4...v7.3.0
|
||||
|
||||
## [v7.2.4] - 2025-12-15
|
||||
|
||||
## What's Changed
|
||||
|
||||
### Documentation
|
||||
- Updated endless mode setup instructions with improved configuration guidance for better user experience
|
||||
|
||||
**Full Changelog**: https://github.com/thedotmack/claude-mem/compare/v7.2.3...v7.2.4
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<p align="center">
|
||||
Official $CMEM Links:
|
||||
<a href="https://bags.fm/2TsmuYUrsctE57VLckZBYEEzdokUF8j8e1GavekWBAGS">Bags.fm</a> •
|
||||
<a href="https://jup.ag/tokens/2TsmuYUrsctE57VLckZBYEEzdokUF8j8e1GavekWBAGS">Jupiter</a> •
|
||||
<a href="https://photon-sol.tinyastro.io/en/lp/6MzFAkWnac6GSK1EdFX93dZeukGfzrFq4UHWarhGSQyd">Photon</a> •
|
||||
<a href="https://dexscreener.com/solana/6mzfakwnac6gsk1edfx93dzeukgfzrfq4uhwarhgsqyd">DEXScreener</a>
|
||||
</p>
|
||||
|
||||
<p align="center">Official CA: 2TsmuYUrsctE57VLckZBYEEzdokUF8j8e1GavekWBAGS (on Solana)</p>
|
||||
|
||||
<h1 align="center">
|
||||
<br>
|
||||
|
||||
+1
-32
@@ -3,36 +3,5 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 12, 2025
|
||||
|
||||
**README.ar.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24246 | 2:43 AM | 🟣 | Comprehensive Translation System Added with 22 Language READMEs | ~386 |
|
||||
|
||||
**README.zh.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24241 | 2:35 AM | ✅ | Internationalized README Files Moved to Dedicated i18n Directory | ~284 |
|
||||
|
||||
### Dec 22, 2025
|
||||
|
||||
**README.ja.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31948 | 8:08 PM | ✅ | Batch Updated All Translation READMEs with Language Navigation | ~400 |
|
||||
|
||||
**README.zh.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31947 | 8:07 PM | ✅ | Added Language Navigation Menu to Chinese Translation README | ~412 |
|
||||
| #31945 | 8:06 PM | 🟣 | Multi-language navigation added to internationalized README files | ~386 |
|
||||
| #31942 | 8:01 PM | 🔵 | Internationalization Documentation Coverage | ~315 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
**README.*.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33540 | 10:55 PM | 🔵 | Grep search found mem-search references in internationalized documentation | ~577 |
|
||||
*No recent activity*
|
||||
</claude-mem-context>
|
||||
+52
-46
@@ -1,5 +1,4 @@
|
||||
🌐 هذه ترجمة آلية. نرحب بالتصحيحات من المجتمع!
|
||||
|
||||
<section dir="rtl">
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
@@ -43,7 +42,8 @@
|
||||
<a href="README.no.md">🇳🇴 Norsk</a>
|
||||
</p>
|
||||
|
||||
<h4 align="center">نظام ضغط الذاكرة المستمرة المبني لـ <a href="https://claude.com/claude-code" target="_blank">Claude Code</a>.</h4>
|
||||
<h4 align="center">أداة إضافية لـ <a href="https://claude.com/claude-code" target="_blank">Claude Code</a> تعمل على أتمتة تسجيل معلومات الجلسات السابقه، وضغطها, ثم حقن السياق ذي الصلة في الجلسات المستقبلية.
|
||||
</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="LICENSE">
|
||||
@@ -80,25 +80,27 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#البدء-السريع">البدء السريع</a> •
|
||||
<a href="#كيف-يعمل">كيف يعمل</a> •
|
||||
<a href="#أدوات-البحث-mcp">أدوات البحث</a> •
|
||||
<a href="#التوثيق">التوثيق</a> •
|
||||
<a href="#الإعدادات">الإعدادات</a> •
|
||||
<a href="#استكشاف-الأخطاء-وإصلاحها">استكشاف الأخطاء وإصلاحها</a> •
|
||||
<a href="#الترخيص">الترخيص</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
يحافظ Claude-Mem بسلاسة على السياق عبر الجلسات من خلال التقاط الملاحظات حول استخدام الأدوات تلقائيًا، وإنشاء ملخصات دلالية، وإتاحتها للجلسات المستقبلية. هذا يمكّن Claude من الحفاظ على استمرارية المعرفة حول المشاريع حتى بعد انتهاء الجلسات أو إعادة الاتصال.
|
||||
<a href="#بداية-سريعة">بداية سريعة</a> •
|
||||
<a href="#كيف-يعمل">كيف يعمل</a> •
|
||||
<a href="#أدوات-البحث-mcp-search-tools">أدوات البحث</a> •
|
||||
<a href="#المستندات">التوثيق</a> •
|
||||
<a href="#الإعدادات">الإعدادات</a> •
|
||||
<a href="#استكشاف-الأخطاء-وإصلاحها">استكشاف الأخطاء وإصلاحها</a> •
|
||||
<a href="#الترخيص-license">الترخيص</a>
|
||||
</p>
|
||||
|
||||
<p align="center" dir="rtl">
|
||||
Claude-Mem هو نظام متطور مصمم لضغط وحفظ الذاكرة لسياق عمل Claude Code. وظيفته الأساسية هي جعل "كلود" يتذكر ما فعله في جلسات العمل السابقة بسلاسة، عبر تسجيل تحركاته، وإنشاء ملخصات ذكية، واستدعائها في الجلسات المستقبلية. هذا يضمن عدم ضياع سياق المشروع حتى لو أغلقت البرنامج وفتحته لاحقاً.
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## البدء السريع
|
||||
## بداية سريعة
|
||||
|
||||
ابدأ جلسة Claude Code جديدة في الطرفية وأدخل الأوامر التالية:
|
||||
للبدء، افتح "Claude Code" في مبنى الأوامر (Terminal) واكتب الأوامر التالية:
|
||||
<div dir="ltr" align="left">
|
||||
|
||||
```
|
||||
> /plugin marketplace add thedotmack/claude-mem
|
||||
@@ -106,24 +108,26 @@
|
||||
> /plugin install claude-mem
|
||||
```
|
||||
|
||||
أعد تشغيل Claude Code. سيظهر السياق من الجلسات السابقة تلقائيًا في الجلسات الجديدة.
|
||||
</div>
|
||||
|
||||
بمجرد إعادة تشغيل Claude Code، سيتم استدعاء السياق من الجلسات السابقة تلقائيا عند الحاجة.
|
||||
|
||||
**الميزات الرئيسية:**
|
||||
|
||||
- 🧠 **ذاكرة مستمرة** - يبقى السياق عبر الجلسات
|
||||
- 📊 **الكشف التدريجي** - استرجاع الذاكرة بطبقات مع رؤية تكلفة الرموز
|
||||
- 🔍 **بحث قائم على المهارات** - استعلم عن تاريخ مشروعك باستخدام مهارة mem-search
|
||||
- 🖥️ **واجهة مستخدم ويب** - بث الذاكرة المباشر على http://localhost:37777
|
||||
- 💻 **مهارة Claude Desktop** - ابحث في الذاكرة من محادثات Claude Desktop
|
||||
- 🔒 **التحكم في الخصوصية** - استخدم وسوم `<private>` لاستبعاد المحتوى الحساس من التخزين
|
||||
- ⚙️ **إعدادات السياق** - تحكم دقيق في السياق الذي يتم حقنه
|
||||
- 🤖 **تشغيل تلقائي** - لا يتطلب تدخلاً يدويًا
|
||||
- 🔗 **الاستشهادات** - رجوع إلى الملاحظات السابقة باستخدام المعرفات (الوصول عبر http://localhost:37777/api/observation/{id} أو عرض الكل في عارض الويب على http://localhost:37777)
|
||||
- 🧪 **قناة تجريبية** - جرّب الميزات التجريبية مثل Endless Mode عبر تبديل الإصدار
|
||||
- 🧠 **ذاكرة مستديمه**: سياق عملك لا ينتهي بانتهاء الجلسة، بل ينتقل معك للجلسة التالية.
|
||||
- 📊 **الكشف التدريجي** (Progressive Disclosure): نظام ذكي يستدعي المعلومات على طبقات، مما يمنحك رؤية واضحة لاستهلاك الـ "Tokens" (التكلفة).
|
||||
- 🔍 **بحث سريع** - استعلم عن سجل مشروعك باستخدام خاصية `mem-search`.
|
||||
- 🖥️ **واجهة مستخدم ويب** - رؤية معلومات الذاكرة مع تحديث فوري عبر المتصفح من خلال الرابط: http://localhost:37777
|
||||
- 💻 **تكامل مع Claude Desktop** - إمكانية البحث في الذاكرة مباشرة من واجهة Claude المكتبية
|
||||
- 🔒 **التحكم في الخصوصية** - دعم وسم `<private>` لمنع النظام من تخزين أي معلومات حساسة.
|
||||
- ⚙️ **إعدادات السياق** - تحكم دقيق في السياق (context) التي سيتم حقنها في سياق المحادثة.
|
||||
- 🤖 **أتمتة كاملة:** - النظام يعمل في الخلفية دون الحاجة لتدخل يدوي منك.
|
||||
- 🔗 **الاستشهادات** - رجوع إلى الملاحظات السابقة باستخدام (http://localhost:37777/api/observation/{id} أو عرض جميع المعلومات على http://localhost:37777)
|
||||
- 🧪 **مزايا التجريبيه** - تجربة مميزات مثل "الوضع اللانهائي" (Endless Mode).
|
||||
|
||||
---
|
||||
|
||||
## التوثيق
|
||||
## المستندات
|
||||
|
||||
📚 **[عرض التوثيق الكامل](docs/)** - تصفح مستندات markdown على GitHub
|
||||
|
||||
@@ -131,7 +135,7 @@
|
||||
|
||||
- **[دليل التثبيت](https://docs.claude-mem.ai/installation)** - البدء السريع والتثبيت المتقدم
|
||||
- **[دليل الاستخدام](https://docs.claude-mem.ai/usage/getting-started)** - كيف يعمل Claude-Mem تلقائيًا
|
||||
- **[أدوات البحث](https://docs.claude-mem.ai/usage/search-tools)** - استعلم عن تاريخ مشروعك باللغة الطبيعية
|
||||
- **[أدوات البحث](https://docs.claude-mem.ai/usage/search-tools)** - استعلم عن سجل مشروعك بلغتك
|
||||
- **[الميزات التجريبية](https://docs.claude-mem.ai/beta-features)** - جرّب الميزات التجريبية مثل Endless Mode
|
||||
|
||||
### أفضل الممارسات
|
||||
@@ -142,9 +146,9 @@
|
||||
### البنية المعمارية
|
||||
|
||||
- **[نظرة عامة](https://docs.claude-mem.ai/architecture/overview)** - مكونات النظام وتدفق البيانات
|
||||
- **[تطور البنية المعمارية](https://docs.claude-mem.ai/architecture-evolution)** - الرحلة من v3 إلى v5
|
||||
- **[بنية الخطافات](https://docs.claude-mem.ai/hooks-architecture)** - كيف يستخدم Claude-Mem خطافات دورة الحياة
|
||||
- **[مرجع الخطافات](https://docs.claude-mem.ai/architecture/hooks)** - شرح 7 سكريبتات خطافات
|
||||
- **[تطور البنية المعمارية](https://docs.claude-mem.ai/architecture-evolution)** - تطور المعمارية من v3 إلى v5
|
||||
- **[بنية برامج الربط (Hooks)](https://docs.claude-mem.ai/hooks-architecture)** - كيف يستخدم Claude-Mem خطافات دورة الحياة
|
||||
- **[مرجع برامج الربط (Hooks)](https://docs.claude-mem.ai/architecture/hooks)** - شرح 7 سكريبتات خطافات
|
||||
- **[خدمة العامل](https://docs.claude-mem.ai/architecture/worker-service)** - HTTP API وإدارة Bun
|
||||
- **[قاعدة البيانات](https://docs.claude-mem.ai/architecture/database)** - مخطط SQLite وبحث FTS5
|
||||
- **[بنية البحث](https://docs.claude-mem.ai/architecture/search-architecture)** - البحث المختلط مع قاعدة بيانات المتجهات Chroma
|
||||
@@ -161,24 +165,23 @@
|
||||
|
||||
**المكونات الأساسية:**
|
||||
|
||||
1. **5 خطافات دورة الحياة** - SessionStart، UserPromptSubmit، PostToolUse، Stop، SessionEnd (6 سكريبتات خطافات)
|
||||
2. **تثبيت ذكي** - فاحص التبعيات المخزنة مؤقتًا (سكريبت ما قبل الخطاف، ليس خطاف دورة حياة)
|
||||
1. **5 برامج ربط (Hooks)** - SessionStart، UserPromptSubmit، PostToolUse، Stop، SessionEnd
|
||||
2. **تثبيت ذكي** - فاحص التبعيات المخزنة مؤقتًا
|
||||
3. **خدمة العامل** - HTTP API على المنفذ 37777 مع واجهة مستخدم عارض الويب و10 نقاط نهاية للبحث، تديرها Bun
|
||||
4. **قاعدة بيانات SQLite** - تخزن الجلسات، الملاحظات، الملخصات
|
||||
5. **مهارة mem-search** - استعلامات اللغة الطبيعية مع الكشف التدريجي
|
||||
6. **قاعدة بيانات المتجهات Chroma** - البحث المختلط الدلالي + الكلمات المفتاحية لاسترجاع السياق الذكي
|
||||
6. **قاعدة بيانات المتجهات Chroma** - البحث الدلالي الهجين + الكلمات المفتاحية لاسترجاع السياق الذكي
|
||||
|
||||
انظر [نظرة عامة على البنية المعمارية](https://docs.claude-mem.ai/architecture/overview) للتفاصيل.
|
||||
|
||||
---
|
||||
|
||||
## مهارة mem-search
|
||||
|
||||
## أدوات البحث (MCP Search Tools)
|
||||
يوفر Claude-Mem بحثًا ذكيًا من خلال مهارة mem-search التي تُستدعى تلقائيًا عندما تسأل عن العمل السابق:
|
||||
|
||||
**كيف يعمل:**
|
||||
- فقط اسأل بشكل طبيعي: *"ماذا فعلنا في الجلسة الأخيرة؟"* أو *"هل أصلحنا هذا الخطأ من قبل؟"*
|
||||
- يستدعي Claude تلقائيًا مهارة mem-search للعثور على السياق ذي الصلة
|
||||
- يستدعي Claude تلقائيًا خاصية mem-search للعثور على السياق ذي الصلة
|
||||
|
||||
**عمليات البحث المتاحة:**
|
||||
|
||||
@@ -193,7 +196,7 @@
|
||||
9. **الجدول الزمني حسب الاستعلام** - البحث عن الملاحظات والحصول على سياق الجدول الزمني حول أفضل تطابق
|
||||
10. **مساعدة API** - الحصول على توثيق API البحث
|
||||
|
||||
**أمثلة على استعلامات اللغة الطبيعية:**
|
||||
**أمثلة على الاستعلامات:**
|
||||
|
||||
```
|
||||
"What bugs did we fix last session?"
|
||||
@@ -219,8 +222,7 @@
|
||||
|
||||
- **Node.js**: 18.0.0 أو أعلى
|
||||
- **Claude Code**: أحدث إصدار مع دعم الإضافات
|
||||
- **Bun**: بيئة تشغيل JavaScript ومدير العمليات (يُثبت تلقائيًا إذا كان مفقودًا)
|
||||
- **uv**: مدير حزم Python للبحث المتجهي (يُثبت تلقائيًا إذا كان مفقودًا)
|
||||
- **Bun & uv**: (يتم تثبيتهما تلقائياً) لإدارة العمليات والبحث المتجه.
|
||||
- **SQLite 3**: للتخزين المستمر (مدمج)
|
||||
|
||||
---
|
||||
@@ -241,7 +243,7 @@
|
||||
|
||||
## استكشاف الأخطاء وإصلاحها
|
||||
|
||||
إذا واجهت مشكلات، صِف المشكلة لـ Claude وستقوم مهارة troubleshoot تلقائيًا بتشخيصها وتوفير الإصلاحات.
|
||||
إذا واجهت مشكلة، اشرحها لـ Claude وسيقوم بتشغيل خاصية troubleshoot لإصلاحها ذاتياً.
|
||||
|
||||
انظر **[دليل استكشاف الأخطاء وإصلاحها](https://docs.claude-mem.ai/troubleshooting)** للمشكلات الشائعة والحلول.
|
||||
|
||||
@@ -250,27 +252,29 @@
|
||||
## تقارير الأخطاء
|
||||
|
||||
أنشئ تقارير أخطاء شاملة باستخدام المولّد الآلي:
|
||||
<div align=left>
|
||||
|
||||
```bash
|
||||
cd ~/.claude/plugins/marketplaces/thedotmack
|
||||
npm run bug-report
|
||||
```
|
||||
</div>
|
||||
|
||||
## المساهمة
|
||||
|
||||
المساهمات مرحب بها! يُرجى:
|
||||
|
||||
1. عمل Fork للمستودع
|
||||
2. إنشاء فرع ميزة
|
||||
1. عمل Fork للمشروع (Repository)
|
||||
2. إنشاء فرع (branch)
|
||||
3. إجراء التغييرات مع الاختبارات
|
||||
4. تحديث التوثيق
|
||||
4. تحديث المستندات عند الحاجه
|
||||
5. تقديم Pull Request
|
||||
|
||||
انظر [دليل التطوير](https://docs.claude-mem.ai/development) لسير عمل المساهمة.
|
||||
|
||||
---
|
||||
|
||||
## الترخيص
|
||||
## الترخيص (License)
|
||||
|
||||
هذا المشروع مرخص بموجب **ترخيص GNU Affero العام الإصدار 3.0** (AGPL-3.0).
|
||||
|
||||
@@ -298,4 +302,6 @@ npm run bug-report
|
||||
|
||||
---
|
||||
|
||||
**مبني باستخدام Claude Agent SDK** | **مدعوم بواسطة Claude Code** | **صُنع باستخدام TypeScript**
|
||||
**مبني باستخدام Claude Agent SDK** | **مدعوم بواسطة Claude Code** | **صُنع باستخدام TypeScript**
|
||||
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
# Anti-Pattern Czar Generalization Analysis
|
||||
|
||||
*Generated: January 10, 2026*
|
||||
|
||||
This report analyzes whether the `/anti-pattern-czar` command and its underlying detector script can be generalized for use in any TypeScript codebase or other programming languages.
|
||||
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
The anti-pattern detection system in claude-mem consists of two components:
|
||||
1. **`/anti-pattern-czar`** - An interactive workflow command for detecting and fixing error handling anti-patterns
|
||||
2. **`detect-error-handling-antipatterns.ts`** - The underlying static analysis script
|
||||
|
||||
**Verdict:** The core detection patterns are highly generalizable to any TypeScript/JavaScript codebase. However, the current implementation has claude-mem-specific hardcoding that would need to be extracted into configuration for broader use.
|
||||
|
||||
---
|
||||
|
||||
## Current Implementation Analysis
|
||||
|
||||
### Detection Methodology
|
||||
|
||||
The script uses **purely regex-based detection** (no AST parsing) with two phases:
|
||||
|
||||
1. **Line-by-Line Pattern Matching** - Scans for known anti-patterns:
|
||||
- `ERROR_STRING_MATCHING` - Fragile `error.message.includes('keyword')` checks
|
||||
- `PARTIAL_ERROR_LOGGING` - Logging `error.message` instead of full error object
|
||||
- `ERROR_MESSAGE_GUESSING` - Multiple `.includes()` chains for error classification
|
||||
- `PROMISE_EMPTY_CATCH` - `.catch(() => {})` handlers
|
||||
- `PROMISE_CATCH_NO_LOGGING` - Promise catches without logging
|
||||
|
||||
2. **Try-Catch Block Analysis** - Brace-depth tracking to identify:
|
||||
- `EMPTY_CATCH` - Catch blocks with no meaningful code
|
||||
- `NO_LOGGING_IN_CATCH` - Catch blocks without logging/throwing
|
||||
- `LARGE_TRY_BLOCK` - More than 10 significant lines (uncertain error source)
|
||||
- `GENERIC_CATCH` - No `instanceof` or error type discrimination
|
||||
- `CATCH_AND_CONTINUE_CRITICAL_PATH` - Logging but not failing in critical code
|
||||
|
||||
### Claude-Mem Specific Elements
|
||||
|
||||
| Element | Location | Generalization Required |
|
||||
|---------|----------|-------------------------|
|
||||
| `CRITICAL_PATHS` array | Lines 24-30 | Extract to config file |
|
||||
| Script path in command | anti-pattern-czar.md | Make path configurable |
|
||||
| Severity thresholds | Line 10 limit | Make configurable |
|
||||
| Directory to scan | `src/` hardcoded | Accept as parameter |
|
||||
| Exclusions | `node_modules`, `dist` | Make configurable |
|
||||
|
||||
---
|
||||
|
||||
## Comparison with Industry Tools
|
||||
|
||||
### ESLint Rules Coverage
|
||||
|
||||
| Anti-Pattern | ESLint Equivalent | Coverage Gap |
|
||||
|--------------|-------------------|--------------|
|
||||
| Empty catch blocks | `no-empty` | Fully covered |
|
||||
| Catch-and-rethrow | `no-useless-catch` | Fully covered |
|
||||
| Floating promises | `@typescript-eslint/no-floating-promises` | Fully covered |
|
||||
| Partial error logging | None | **Gap** |
|
||||
| Error string matching | None | **Gap** |
|
||||
| Error message guessing | None | **Gap** |
|
||||
| Large try blocks | `sonarjs/cognitive-complexity` | Partial |
|
||||
| Critical path continuation | None | **Gap** |
|
||||
|
||||
### Unique Value Proposition
|
||||
|
||||
The claude-mem detector catches patterns that **no standard ESLint rule addresses**:
|
||||
|
||||
1. **Partial Error Logging** - Logging `error.message` loses stack traces
|
||||
2. **Error String Matching** - Fragile `if (error.message.includes('timeout'))` patterns
|
||||
3. **Error Message Guessing** - Chained `.includes()` for error classification
|
||||
4. **Critical Path Continuation** - Logging but continuing in code that should fail
|
||||
|
||||
These patterns represent **real debugging nightmares** that caused hours of investigation in claude-mem's development.
|
||||
|
||||
---
|
||||
|
||||
## Generalization Recommendations
|
||||
|
||||
### Tier 1: Quick Generalization (Configuration)
|
||||
|
||||
Extract hardcoded values to a config file:
|
||||
|
||||
```json
|
||||
{
|
||||
"sourceDir": "src/",
|
||||
"criticalPaths": ["**/services/*.ts", "**/core/*.ts"],
|
||||
"excludeDirs": ["node_modules", "dist", "test"],
|
||||
"largeBlockThreshold": 10,
|
||||
"overrideComment": "// [ANTI-PATTERN IGNORED]:"
|
||||
}
|
||||
```
|
||||
|
||||
**Effort:** 2-4 hours
|
||||
|
||||
### Tier 2: ESLint Plugin (Broader Adoption)
|
||||
|
||||
Convert patterns to ESLint custom rules for standard toolchain integration:
|
||||
|
||||
```javascript
|
||||
// eslint-plugin-error-hygiene
|
||||
module.exports = {
|
||||
rules: {
|
||||
'no-partial-error-logging': { /* ... */ },
|
||||
'no-error-string-matching': { /* ... */ },
|
||||
'no-error-message-guessing': { /* ... */ },
|
||||
'critical-path-must-fail': { /* ... */ }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Advantages:**
|
||||
- Integrates with existing toolchains
|
||||
- IDE integration via ESLint plugins
|
||||
- Auto-fix support possible
|
||||
- Community-standard distribution
|
||||
|
||||
**Effort:** 1-2 weeks
|
||||
|
||||
### Tier 3: Multi-Language Support
|
||||
|
||||
The regex patterns could be adapted for:
|
||||
- **Go** - `defer` with empty recover, error checking patterns
|
||||
- **Python** - `except:` without logging, bare `except Exception:`
|
||||
- **Rust** - `.unwrap()` in production paths, `_` pattern for `Result`
|
||||
|
||||
**Effort:** 1 week per language
|
||||
|
||||
---
|
||||
|
||||
## Architecture for General Use
|
||||
|
||||
```
|
||||
error-pattern-detector/
|
||||
├── config/
|
||||
│ ├── default.json # Sensible defaults
|
||||
│ └── schema.json # Config validation
|
||||
├── patterns/
|
||||
│ ├── typescript/ # TS-specific patterns
|
||||
│ │ ├── empty-catch.ts
|
||||
│ │ ├── partial-logging.ts
|
||||
│ │ └── critical-path.ts
|
||||
│ └── shared/ # Cross-language patterns
|
||||
│ ├── large-try-block.ts
|
||||
│ └── swallowed-errors.ts
|
||||
├── reporters/
|
||||
│ ├── console.ts # CLI output
|
||||
│ ├── json.ts # Machine-readable
|
||||
│ ├── sarif.ts # GitHub/IDE integration
|
||||
│ └── markdown.ts # Report generation
|
||||
├── cli.ts # Entry point
|
||||
└── index.ts # Programmatic API
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## PR #666 Review Context
|
||||
|
||||
The PR review raised a valid concern: the `/anti-pattern-czar` command references a script (`scripts/anti-pattern-test/detect-error-handling-antipatterns.ts`) that only exists in the claude-mem development repository.
|
||||
|
||||
**Options:**
|
||||
|
||||
1. **Keep as development tool** - Don't distribute with plugin (recommended by reviewer)
|
||||
2. **Bundle the detector** - Include the script in the plugin distribution
|
||||
3. **Extract to standalone package** - Publish as `@claude-mem/error-pattern-detector` and depend on it
|
||||
|
||||
Option 3 enables both plugin distribution and community adoption.
|
||||
|
||||
---
|
||||
|
||||
## Conclusions
|
||||
|
||||
### What's Generalizable
|
||||
|
||||
| Component | Generalizability | Notes |
|
||||
|-----------|------------------|-------|
|
||||
| Regex detection patterns | High | Universal to TS/JS |
|
||||
| Brace-depth tracking | High | Works for any curly-brace language |
|
||||
| Override comment syntax | High | Adoptable by any project |
|
||||
| Report formatting | High | Standard markdown output |
|
||||
| 4-step workflow | High | Applicable to any codebase |
|
||||
|
||||
### What's Claude-Mem Specific
|
||||
|
||||
| Component | Specificity | Extraction Effort |
|
||||
|-----------|-------------|-------------------|
|
||||
| Critical path file list | High | Configuration file |
|
||||
| Script location | High | Path parameter |
|
||||
| Severity philosophy | Medium | Documentation |
|
||||
| Exit codes | Low | Already standard |
|
||||
|
||||
### Recommendation
|
||||
|
||||
**Invest in Tier 2 (ESLint Plugin)** - The patterns detected are genuinely unique and valuable. Standard ESLint rules miss these debugging nightmares. An ESLint plugin would:
|
||||
|
||||
1. Enable adoption in any TS/JS project
|
||||
2. Integrate with existing CI/CD pipelines
|
||||
3. Provide IDE feedback in real-time
|
||||
4. Allow community contributions to pattern library
|
||||
5. Create a marketable open-source project
|
||||
|
||||
The name `eslint-plugin-error-hygiene` captures the philosophy: maintaining clean error handling practices to prevent silent failures.
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Short-term:** Extract configuration to enable use in other projects
|
||||
2. **Medium-term:** Create ESLint plugin with AST-based detection (more robust than regex)
|
||||
3. **Long-term:** Multi-language support, SARIF output for security tool integration
|
||||
|
||||
---
|
||||
|
||||
*Report generated by analyzing PR #666 review comments, the anti-pattern-czar.md command, and detect-error-handling-antipatterns.ts implementation.*
|
||||
@@ -0,0 +1,336 @@
|
||||
# Intentional Patterns Validation Report
|
||||
|
||||
**Generated:** 2026-01-13
|
||||
**Purpose:** Validate whether "intentional" patterns in worker-service.ts are truly justified
|
||||
|
||||
---
|
||||
|
||||
## Summary Table
|
||||
|
||||
| Pattern | Verdict | Evidence Quality | Recommendation |
|
||||
|---------|---------|------------------|----------------|
|
||||
| Exit code 0 always | **JUSTIFIED** | HIGH | Keep (well documented) |
|
||||
| Circular import re-export | **UNNECESSARY** | HIGH | Remove (no actual circular dep) |
|
||||
| Fallback agent without check | **OVERSIGHT** | HIGH | Fix (real bug risk) |
|
||||
| MCP version hardcoded | **COSMETIC** | MEDIUM | Update to match package.json |
|
||||
| Empty MCP capabilities | **INTENTIONAL** | LOW | Add documentation comment |
|
||||
| `as Error` casts | **JUSTIFIED** | HIGH | Keep (documented policy) |
|
||||
|
||||
---
|
||||
|
||||
## Pattern 1: Exit Code 0 Always
|
||||
|
||||
### Evidence
|
||||
|
||||
| Category | Details |
|
||||
|----------|---------|
|
||||
| **Locations** | 8 explicit `process.exit(0)` calls in worker-service.ts |
|
||||
| **Documentation** | CLAUDE.md lines 44-54, CHANGELOG v9.0.2 |
|
||||
| **Git History** | Commit 222a73da (Jan 8, 2026) - detailed explanation |
|
||||
| **Tests** | 23 passing tests in `worker-json-status.test.ts` |
|
||||
| **Comments** | 5 detailed comments at each exit point |
|
||||
|
||||
### Justification
|
||||
|
||||
```markdown
|
||||
## Exit Code Strategy (from CLAUDE.md)
|
||||
|
||||
- **Exit 0**: Success or graceful shutdown (Windows Terminal closes tabs)
|
||||
- **Exit 1**: Non-blocking error (stderr shown to user, continues)
|
||||
- **Exit 2**: Blocking error (stderr fed to Claude for processing)
|
||||
|
||||
**Philosophy**: Worker/hook errors exit with code 0 to prevent Windows Terminal
|
||||
tab accumulation. The wrapper/plugin layer handles restart logic.
|
||||
```
|
||||
|
||||
### Commit Evidence
|
||||
|
||||
```
|
||||
commit 222a73da5dc875e666c3dd2c96c9d178dd7b884d
|
||||
Date: Thu Jan 8 15:02:56 2026 -0500
|
||||
|
||||
fix: graceful exit strategy to prevent Windows Terminal tab accumulation (#625)
|
||||
|
||||
Problem:
|
||||
Windows Terminal keeps tabs open when processes exit with code 1, leading
|
||||
to tab accumulation during worker lifecycle operations.
|
||||
|
||||
Solution:
|
||||
Implemented graceful exit strategy using exit code 0 for all expected failure
|
||||
scenarios. The wrapper and plugin handle restart logic.
|
||||
```
|
||||
|
||||
### Verdict: **JUSTIFIED**
|
||||
|
||||
- Real Windows Terminal behavior documented
|
||||
- Comprehensive test coverage validating pattern
|
||||
- Consistent implementation across all exit points
|
||||
- Error status communicated via JSON, not exit code
|
||||
|
||||
### Risk
|
||||
|
||||
- Breaks Unix convention but trades correctness for UX
|
||||
- Shell scripts calling worker commands won't detect errors via `$?`
|
||||
- Mitigated by JSON status output for programmatic consumers
|
||||
|
||||
---
|
||||
|
||||
## Pattern 2: Circular Import Re-Export
|
||||
|
||||
### The Code (worker-service.ts:77-78)
|
||||
|
||||
```typescript
|
||||
// Re-export updateCursorContextForProject for SDK agents
|
||||
export { updateCursorContextForProject };
|
||||
```
|
||||
|
||||
### Import Chain Analyzed
|
||||
|
||||
```
|
||||
CursorHooksInstaller.ts (defines function)
|
||||
↓
|
||||
worker-service.ts (imports, re-exports)
|
||||
↓
|
||||
ResponseProcessor.ts (imports from worker-service.ts)
|
||||
```
|
||||
|
||||
### Actual Circular Dependency: **NONE EXISTS**
|
||||
|
||||
```
|
||||
CursorHooksInstaller.ts → imports nothing from worker-service.ts ✓
|
||||
ResponseProcessor.ts → only imports the re-exported function ✓
|
||||
```
|
||||
|
||||
ResponseProcessor.ts **could** import directly:
|
||||
|
||||
```typescript
|
||||
// Current (via re-export):
|
||||
import { updateCursorContextForProject } from '../../worker-service.js';
|
||||
|
||||
// Alternative (direct - would work fine):
|
||||
import { updateCursorContextForProject } from '../../integrations/CursorHooksInstaller.js';
|
||||
```
|
||||
|
||||
### Verdict: **UNNECESSARY**
|
||||
|
||||
- Comment claims "avoids circular imports" but no circular dependency exists
|
||||
- Likely a precaution during refactoring that became stale
|
||||
- Harmless but misleading
|
||||
|
||||
### Recommendation
|
||||
|
||||
- **Option A**: Remove re-export, update ResponseProcessor.ts import path
|
||||
- **Option B**: Update comment to explain actual reason (e.g., "API surface simplification")
|
||||
|
||||
---
|
||||
|
||||
## Pattern 3: Fallback Agent Without Verification
|
||||
|
||||
### The Code (worker-service.ts:144-146)
|
||||
|
||||
```typescript
|
||||
this.geminiAgent.setFallbackAgent(this.sdkAgent);
|
||||
this.openRouterAgent.setFallbackAgent(this.sdkAgent);
|
||||
```
|
||||
|
||||
### Fallback Trigger Logic
|
||||
|
||||
```typescript
|
||||
// GeminiAgent.ts:284-294
|
||||
if (shouldFallbackToClaude(error) && this.fallbackAgent) {
|
||||
logger.warn('SDK', 'Gemini API failed, falling back to Claude SDK', {...});
|
||||
return this.fallbackAgent.startSession(session, worker);
|
||||
}
|
||||
```
|
||||
|
||||
### Problem Scenario
|
||||
|
||||
1. User chooses Gemini because they **don't have Claude credentials**
|
||||
2. Gemini encounters transient error (429 rate limit, 503 server error)
|
||||
3. Code attempts fallback to Claude SDK
|
||||
4. Claude SDK fails (no credentials) → **cascading failure**
|
||||
5. User sees cryptic error, session lost
|
||||
|
||||
### What's Checked vs What's NOT
|
||||
|
||||
| Check | Implemented |
|
||||
|-------|-------------|
|
||||
| `this.fallbackAgent` is not null | ✅ Yes |
|
||||
| Fallback agent initialized successfully | ❌ No |
|
||||
| Fallback agent has valid credentials | ❌ No |
|
||||
| Fallback agent can make API calls | ❌ No |
|
||||
|
||||
### Verdict: **OVERSIGHT - Real Bug Risk**
|
||||
|
||||
- Documentation claims "seamless fallback"
|
||||
- No health check verifies fallback is functional
|
||||
- Users without Claude credentials face silent failure mode
|
||||
|
||||
### Recommendation
|
||||
|
||||
Add verification at initialization:
|
||||
|
||||
```typescript
|
||||
// Option 1: Verify fallback can initialize
|
||||
if (this.sdkAgent.isConfigured()) {
|
||||
this.geminiAgent.setFallbackAgent(this.sdkAgent);
|
||||
}
|
||||
|
||||
// Option 2: Log warning when fallback unavailable
|
||||
if (!this.sdkAgent.isConfigured()) {
|
||||
logger.warn('WORKER', 'Claude SDK not configured - Gemini fallback disabled');
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Pattern 4: Hardcoded MCP Version "1.0.0"
|
||||
|
||||
### Locations (3 instances)
|
||||
|
||||
| File | Line | Version |
|
||||
|------|------|---------|
|
||||
| worker-service.ts | 157-160 | `1.0.0` |
|
||||
| ChromaSync.ts | 126-131 | `1.0.0` |
|
||||
| mcp-server.ts | 236-245 | `1.0.0` |
|
||||
|
||||
### Version Mismatch
|
||||
|
||||
| Source | Version |
|
||||
|--------|---------|
|
||||
| package.json | `9.0.4` |
|
||||
| MCP SDK | `1.25.1` |
|
||||
| MCP Client/Server instances | `1.0.0` |
|
||||
|
||||
### Does It Matter?
|
||||
|
||||
**Investigation found:**
|
||||
- MCP servers do NOT validate client version
|
||||
- Connections succeed regardless of version value
|
||||
- Version appears to be for logging/debugging only (like HTTP User-Agent)
|
||||
|
||||
### Verdict: **COSMETIC - Low Priority**
|
||||
|
||||
- Functionally doesn't matter
|
||||
- Inconsistent with package version is confusing
|
||||
- Should be updated for cleanliness
|
||||
|
||||
### Recommendation
|
||||
|
||||
```typescript
|
||||
// Update to use package version
|
||||
import { version } from '../../package.json' assert { type: 'json' };
|
||||
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: version // Use actual package version
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Pattern 5: Empty MCP Capabilities
|
||||
|
||||
### The Code
|
||||
|
||||
```typescript
|
||||
{ capabilities: {} } // All 3 MCP client instances
|
||||
```
|
||||
|
||||
### Investigation
|
||||
|
||||
- MCP specification: **Servers** declare capabilities (tools, resources, prompts)
|
||||
- MCP specification: **Clients** don't typically declare capabilities
|
||||
- No validation found in any MCP server
|
||||
- Pattern works correctly
|
||||
|
||||
### Verdict: **INTENTIONAL - Documentation Gap**
|
||||
|
||||
- Empty capabilities is likely correct for clients
|
||||
- MCP SDK documentation doesn't clarify this
|
||||
- Works fine in practice
|
||||
|
||||
### Recommendation
|
||||
|
||||
Add clarifying comment:
|
||||
|
||||
```typescript
|
||||
// MCP spec: Clients accept all server capabilities; no declaration needed
|
||||
{ capabilities: {} }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Pattern 6: `as Error` Casts
|
||||
|
||||
### Locations (8 in worker-service.ts)
|
||||
|
||||
Lines: 236, 314, 317, 339, 393, 469, 636, 796
|
||||
|
||||
### Why It's Used
|
||||
|
||||
TypeScript 4.0+ catch clauses have `unknown` type:
|
||||
|
||||
```typescript
|
||||
try {
|
||||
// ...
|
||||
} catch (error) { // error: unknown (not Error)
|
||||
logger.error('X', 'msg', {}, error as Error); // Cast needed for logger
|
||||
}
|
||||
```
|
||||
|
||||
### Project Documentation
|
||||
|
||||
**File:** `scripts/anti-pattern-test/CLAUDE.md`
|
||||
|
||||
Establishes explicit error handling policy with:
|
||||
- 5 questions before writing try-catch
|
||||
- Forbidden patterns list
|
||||
- Anti-pattern detection script
|
||||
- Critical paths protection
|
||||
|
||||
### Anti-Pattern Detection
|
||||
|
||||
```bash
|
||||
bun run scripts/anti-pattern-test/detect-error-handling-antipatterns.ts
|
||||
```
|
||||
|
||||
Scans for 7 anti-patterns including:
|
||||
- Empty catch blocks
|
||||
- Catch without logging
|
||||
- Generic error handling
|
||||
|
||||
### Verdict: **JUSTIFIED - Documented Policy**
|
||||
|
||||
- Explicit project convention with tooling support
|
||||
- Alternative (type guards) would add verbosity
|
||||
- Logger requires Error type for stack trace
|
||||
- Pre-commit validation enforces consistency
|
||||
|
||||
---
|
||||
|
||||
## Action Items Summary
|
||||
|
||||
| Pattern | Action | Priority |
|
||||
|---------|--------|----------|
|
||||
| Exit code 0 | Keep as-is | N/A |
|
||||
| Circular import re-export | Remove or fix comment | LOW |
|
||||
| Fallback agent | **Add availability check** | **HIGH** |
|
||||
| MCP version | Update to package.json version | LOW |
|
||||
| Empty capabilities | Add documentation comment | LOW |
|
||||
| `as Error` casts | Keep as-is | N/A |
|
||||
|
||||
---
|
||||
|
||||
## Questions for Your Validation
|
||||
|
||||
1. **Exit code 0**: Is the Windows Terminal workaround acceptable, or should we exit non-zero and document that users need to parse JSON status?
|
||||
|
||||
2. **Circular import**: Should we remove the re-export (cleaner) or update the comment to reflect the real reason?
|
||||
|
||||
3. **Fallback agent**: Should we:
|
||||
- A) Add initialization-time verification
|
||||
- B) Document the limitation and keep as-is
|
||||
- C) Allow users to disable fallback behavior
|
||||
|
||||
4. **MCP version**: Worth updating all 3 instances, or leave as cosmetic debt?
|
||||
@@ -0,0 +1,450 @@
|
||||
# Unjustified Logic Report - worker-service.ts
|
||||
|
||||
**Generated:** 2026-01-13
|
||||
**Source:** `src/services/worker-service.ts` (1445 lines)
|
||||
**Status:** Pending Review
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
23 items identified lacking clear justification. Categorized by severity.
|
||||
|
||||
---
|
||||
|
||||
## HIGH SEVERITY
|
||||
|
||||
### 1. Dead Function: `runInteractiveSetup` (~275 lines)
|
||||
|
||||
**Location:** Lines 837-1111
|
||||
|
||||
```typescript
|
||||
async function runInteractiveSetup(): Promise<number> {
|
||||
// ~275 lines of interactive wizard code
|
||||
}
|
||||
```
|
||||
|
||||
**What it does:** Interactive CLI wizard for Cursor setup.
|
||||
|
||||
**Why it's questionable:** Function is defined but **never called** anywhere. Grep shows only the definition. The `main()` switch handles 'cursor' via `handleCursorCommand`, not this function.
|
||||
|
||||
**Justification status:** No justification found. Appears to be dead code from refactoring.
|
||||
|
||||
---
|
||||
|
||||
## MEDIUM SEVERITY
|
||||
|
||||
### 2. 5-Minute Initialization Timeout
|
||||
|
||||
**Location:** Lines 464-478
|
||||
|
||||
```typescript
|
||||
const timeoutMs = 300000; // 5 minutes
|
||||
await Promise.race([this.initializationComplete, timeoutPromise]);
|
||||
```
|
||||
|
||||
**What it does:** Blocks `/api/context/inject` for up to 5 minutes.
|
||||
|
||||
**Why it's questionable:** HTTP request hanging for 5 minutes is extreme.
|
||||
|
||||
**Justification status:** "5 minutes seems excessive but matches MCP init timeout for consistency" - **circular reasoning**.
|
||||
|
||||
---
|
||||
|
||||
### 3. Redundant Signal Handler Synchronization
|
||||
|
||||
**Location:** Lines 412-434
|
||||
|
||||
```typescript
|
||||
const shutdownRef = { value: this.isShuttingDown };
|
||||
const handler = createSignalHandler(() => this.shutdown(), shutdownRef);
|
||||
process.on('SIGTERM', () => {
|
||||
this.isShuttingDown = shutdownRef.value;
|
||||
handler('SIGTERM');
|
||||
});
|
||||
```
|
||||
|
||||
**What it does:** Creates reference object, passes to handler, copies value back.
|
||||
|
||||
**Why it's questionable:** Overly complex. `this.isShuttingDown` could be used directly via closure.
|
||||
|
||||
**Justification status:** "Signal handler needs mutable reference" - but closure would work.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dual Initialization Tracking (Promise + Flag)
|
||||
|
||||
**Location:** Lines 322-326, 633-634
|
||||
|
||||
```typescript
|
||||
private initializationComplete: Promise<void>;
|
||||
private initializationCompleteFlag: boolean = false;
|
||||
```
|
||||
|
||||
**What it does:** Maintains both Promise and boolean for same state.
|
||||
|
||||
**Why it's questionable:** Two sources of truth. Promise could resolve to boolean, or sync code could use a different pattern.
|
||||
|
||||
**Justification status:** Comments explain separately but not why both needed.
|
||||
|
||||
---
|
||||
|
||||
### 5. Over-Commenting (~40% of file)
|
||||
|
||||
**Location:** Throughout
|
||||
|
||||
```typescript
|
||||
// WHAT: Imports centralized logging utility with structured output
|
||||
// WHY: All worker logs go through this for consistent formatting
|
||||
import { logger } from '../utils/logger.js';
|
||||
```
|
||||
|
||||
**What it does:** WHAT/WHY comments on nearly every line.
|
||||
|
||||
**Why it's questionable:** Many describe obvious code. Creates visual noise. `import { logger }` is self-explanatory.
|
||||
|
||||
**Justification status:** No justification for this density.
|
||||
|
||||
---
|
||||
|
||||
### 6. Exit Code 0 Always (Even on Errors)
|
||||
|
||||
**Location:** Lines 1142, 1272-1287, 1417-1420
|
||||
|
||||
```typescript
|
||||
function exitWithStatus(status: 'ready' | 'error', message?: string): never {
|
||||
console.log(JSON.stringify(output));
|
||||
process.exit(0); // Always 0, even on error
|
||||
}
|
||||
```
|
||||
|
||||
**What it does:** Exits 0 regardless of success/failure.
|
||||
|
||||
**Why it's questionable:** Breaks Unix convention. Hides failures from scripts/monitoring.
|
||||
|
||||
**Justification status:** "Windows Terminal keeps tabs open on non-zero exit" - **trades correctness for UI convenience**.
|
||||
|
||||
---
|
||||
|
||||
### 7. Fallback Agent Without Verification
|
||||
|
||||
**Location:** Lines 357-363
|
||||
|
||||
```typescript
|
||||
this.geminiAgent.setFallbackAgent(this.sdkAgent);
|
||||
this.openRouterAgent.setFallbackAgent(this.sdkAgent);
|
||||
```
|
||||
|
||||
**What it does:** Sets Claude SDK as fallback for alternative providers.
|
||||
|
||||
**Why it's questionable:** User may choose Gemini because they DON'T have Claude subscription. Fallback would fail.
|
||||
|
||||
**Justification status:** "If Gemini fails, falls back to Claude SDK (if available)" - doesn't verify availability.
|
||||
|
||||
---
|
||||
|
||||
### 8. Re-Export to Avoid Circular Import
|
||||
|
||||
**Location:** Line 191
|
||||
|
||||
```typescript
|
||||
export { updateCursorContextForProject };
|
||||
```
|
||||
|
||||
**What it does:** Re-exports imported function.
|
||||
|
||||
**Why it's questionable:** Creates odd import path. Masks architectural issue (circular dependency).
|
||||
|
||||
**Justification status:** "Avoids circular imports" - acknowledges architecture problem.
|
||||
|
||||
---
|
||||
|
||||
## LOW SEVERITY
|
||||
|
||||
### 9. Unused Import: `import * as fs`
|
||||
|
||||
**Location:** Line 22
|
||||
|
||||
```typescript
|
||||
import * as fs from 'fs';
|
||||
```
|
||||
|
||||
**What it does:** Imports fs namespace.
|
||||
|
||||
**Why it's questionable:** Namespace never used. Only specific named imports (line 34) are used.
|
||||
|
||||
**Justification status:** Comment claims "Used for file operations" - **false**.
|
||||
|
||||
---
|
||||
|
||||
### 10. Unused Import: `spawn`
|
||||
|
||||
**Location:** Line 26
|
||||
|
||||
```typescript
|
||||
import { spawn } from 'child_process';
|
||||
```
|
||||
|
||||
**What it does:** Imports spawn function.
|
||||
|
||||
**Why it's questionable:** Never used. MCP spawning uses `StdioClientTransport` internally.
|
||||
|
||||
**Justification status:** Comment claims "Worker spawns MCP server" - **misleading**.
|
||||
|
||||
---
|
||||
|
||||
### 11. `onRestart` = `onShutdown` (Identical Callbacks)
|
||||
|
||||
**Location:** Lines 395-396
|
||||
|
||||
```typescript
|
||||
onShutdown: () => this.shutdown(),
|
||||
onRestart: () => this.shutdown()
|
||||
```
|
||||
|
||||
**What it does:** Both callbacks do the exact same thing.
|
||||
|
||||
**Why it's questionable:** Naming implies different behavior.
|
||||
|
||||
**Justification status:** No justification for why restart just calls shutdown.
|
||||
|
||||
---
|
||||
|
||||
### 12. 100ms Magic Number in Recovery Loop
|
||||
|
||||
**Location:** Line 767
|
||||
|
||||
```typescript
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
```
|
||||
|
||||
**What it does:** 100ms delay between session recovery.
|
||||
|
||||
**Why it's questionable:** Why 100ms specifically? Not 50ms or 200ms?
|
||||
|
||||
**Justification status:** "Prevents thundering herd" - purpose explained, value unexplained.
|
||||
|
||||
---
|
||||
|
||||
### 13. Dynamic Import Already Loaded
|
||||
|
||||
**Location:** Lines 709-710
|
||||
|
||||
```typescript
|
||||
const { PendingMessageStore } = await import('./sqlite/PendingMessageStore.js');
|
||||
```
|
||||
|
||||
**What it does:** Dynamic import in `processPendingQueues`.
|
||||
|
||||
**Why it's questionable:** Same import in `initializeBackground` (line 558). Already loaded by auto-recovery call.
|
||||
|
||||
**Justification status:** "Lazy load because method may not be called often" - **misleading**, always called at startup.
|
||||
|
||||
---
|
||||
|
||||
### 14. Defensive Null Check for Race Condition
|
||||
|
||||
**Location:** Lines 663-669
|
||||
|
||||
```typescript
|
||||
if (!session) return;
|
||||
```
|
||||
|
||||
**What it does:** Early returns if session null.
|
||||
|
||||
**Why it's questionable:** Comment admits "Session could be deleted between queue check and processor start" - hints at design issue.
|
||||
|
||||
**Justification status:** Justified, but suggests architecture problem.
|
||||
|
||||
---
|
||||
|
||||
### 15. Eager Broadcaster Init (Before Server)
|
||||
|
||||
**Location:** Lines 347-349
|
||||
|
||||
```typescript
|
||||
this.sseBroadcaster = new SSEBroadcaster();
|
||||
```
|
||||
|
||||
**What it does:** Creates broadcaster in constructor.
|
||||
|
||||
**Why it's questionable:** Comment says "SSE clients can connect before background init" - but server not started yet.
|
||||
|
||||
**Justification status:** Comment is **technically incorrect**.
|
||||
|
||||
---
|
||||
|
||||
### 16. Hardcoded MCP Version
|
||||
|
||||
**Location:** Lines 385-388
|
||||
|
||||
```typescript
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: '1.0.0' // Hardcoded, doesn't match package.json
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**What it does:** Hardcodes version to 1.0.0.
|
||||
|
||||
**Why it's questionable:** Doesn't match actual package version.
|
||||
|
||||
**Justification status:** No justification for specific version.
|
||||
|
||||
---
|
||||
|
||||
### 17. Nullable SearchRoutes After Init Complete
|
||||
|
||||
**Location:** Lines 314, 479-484
|
||||
|
||||
```typescript
|
||||
private searchRoutes: SearchRoutes | null = null;
|
||||
// After awaiting initializationComplete:
|
||||
if (!this.searchRoutes) {
|
||||
res.status(503).json({ error: 'Search routes not initialized' });
|
||||
}
|
||||
```
|
||||
|
||||
**What it does:** Null check after init should be complete.
|
||||
|
||||
**Why it's questionable:** If init succeeded, should never be null.
|
||||
|
||||
**Justification status:** Explains async nature, not why remains nullable after.
|
||||
|
||||
---
|
||||
|
||||
### 18. Complex ESM/CJS Module Detection
|
||||
|
||||
**Location:** Lines 1433-1439
|
||||
|
||||
```typescript
|
||||
const isMainModule = typeof require !== 'undefined' && typeof module !== 'undefined'
|
||||
? require.main === module || !module.parent
|
||||
: import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith('worker-service');
|
||||
```
|
||||
|
||||
**What it does:** Complex conditional for both module systems.
|
||||
|
||||
**Why it's questionable:** File is ESM-only (uses `import`). CJS checks unnecessary.
|
||||
|
||||
**Justification status:** "Works with both ESM and CommonJS" - but file is ESM-only.
|
||||
|
||||
---
|
||||
|
||||
### 19. Self-Questioning Comment
|
||||
|
||||
**Location:** Line 466
|
||||
|
||||
```typescript
|
||||
// REASON: 5 minutes seems excessive but matches MCP init timeout for consistency
|
||||
```
|
||||
|
||||
**What it does:** Comment admits code is questionable.
|
||||
|
||||
**Why it's questionable:** If author thought excessive when writing, deserves investigation.
|
||||
|
||||
**Justification status:** Self-acknowledged as questionable.
|
||||
|
||||
---
|
||||
|
||||
### 20. `homedir` Import (Only Used in Dead Code)
|
||||
|
||||
**Location:** Line 30
|
||||
|
||||
```typescript
|
||||
import { homedir } from 'os';
|
||||
```
|
||||
|
||||
**What it does:** Imports homedir.
|
||||
|
||||
**Why it's questionable:** Only used in `runInteractiveSetup` (dead code).
|
||||
|
||||
**Justification status:** Unused if dead code removed.
|
||||
|
||||
---
|
||||
|
||||
### 21. Unused Default Parameter
|
||||
|
||||
**Location:** Line 702
|
||||
|
||||
```typescript
|
||||
async processPendingQueues(sessionLimit: number = 10)
|
||||
```
|
||||
|
||||
**What it does:** Default of 10.
|
||||
|
||||
**Why it's questionable:** Only call uses 50 (line 639). Default never used.
|
||||
|
||||
**Justification status:** No justification for 10 vs actual usage of 50.
|
||||
|
||||
---
|
||||
|
||||
### 22. Empty Capabilities Object
|
||||
|
||||
**Location:** Line 388
|
||||
|
||||
```typescript
|
||||
}, { capabilities: {} });
|
||||
```
|
||||
|
||||
**What it does:** Passes empty capabilities to MCP client.
|
||||
|
||||
**Why it's questionable:** No explanation of what capabilities exist or why none needed.
|
||||
|
||||
**Justification status:** No justification found.
|
||||
|
||||
---
|
||||
|
||||
### 23. Unsafe `as Error` Casts
|
||||
|
||||
**Location:** Multiple (lines 513, 651, 771, etc.)
|
||||
|
||||
```typescript
|
||||
}, error as Error);
|
||||
```
|
||||
|
||||
**What it does:** Casts unknown to Error.
|
||||
|
||||
**Why it's questionable:** Caught value might not be Error.
|
||||
|
||||
**Justification status:** Common TypeScript pattern, acceptable but potentially unsafe.
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference Table
|
||||
|
||||
| # | Issue | Severity | Action |
|
||||
|---|-------|----------|--------|
|
||||
| 1 | Dead `runInteractiveSetup` (~275 lines) | HIGH | Delete |
|
||||
| 2 | 5-minute timeout | MEDIUM | Reduce to 30s |
|
||||
| 3 | Redundant signal sync | MEDIUM | Simplify |
|
||||
| 4 | Dual init tracking | MEDIUM | Unify |
|
||||
| 5 | Over-commenting | MEDIUM | Reduce |
|
||||
| 6 | Exit 0 always | MEDIUM | Reconsider |
|
||||
| 7 | Fallback without check | MEDIUM | Verify availability |
|
||||
| 8 | Re-export for circular | MEDIUM | Fix architecture |
|
||||
| 9 | Unused `fs` namespace | LOW | Delete |
|
||||
| 10 | Unused `spawn` | LOW | Delete |
|
||||
| 11 | Identical callbacks | LOW | Clarify/merge |
|
||||
| 12 | 100ms magic number | LOW | Document or configure |
|
||||
| 13 | Redundant dynamic import | LOW | Remove |
|
||||
| 14 | Defensive null (design smell) | LOW | Review architecture |
|
||||
| 15 | Early broadcaster init | LOW | Fix comment |
|
||||
| 16 | Hardcoded MCP version | LOW | Use package.json |
|
||||
| 17 | Nullable after init | LOW | Clarify lifecycle |
|
||||
| 18 | CJS checks in ESM | LOW | Remove |
|
||||
| 19 | Self-questioning comment | LOW | Investigate |
|
||||
| 20 | `homedir` in dead code | LOW | Delete with dead code |
|
||||
| 21 | Unused default param | LOW | Remove or document |
|
||||
| 22 | Empty capabilities | LOW | Document |
|
||||
| 23 | Unsafe error casts | LOW | Add type guards |
|
||||
|
||||
---
|
||||
|
||||
## Recommendations
|
||||
|
||||
1. **Immediate:** Delete dead `runInteractiveSetup` function (275 lines, ~19% of file)
|
||||
2. **Immediate:** Remove unused imports (`fs` namespace, `spawn`)
|
||||
3. **Short-term:** Reduce 5-minute timeout to 30 seconds
|
||||
4. **Short-term:** Simplify signal handler pattern
|
||||
5. **Consider:** Reduce comment density to improve readability
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "9.0.3",
|
||||
"version": "9.0.5",
|
||||
"description": "Memory compression system for Claude Code - persist context across sessions",
|
||||
"keywords": [
|
||||
"claude",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "9.0.3",
|
||||
"version": "9.0.5",
|
||||
"description": "Persistent memory system for Claude Code - seamlessly preserve context across sessions",
|
||||
"author": {
|
||||
"name": "Alex Newman"
|
||||
|
||||
+2
-57
@@ -3,64 +3,9 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Nov 10, 2025
|
||||
### Jan 10, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #6276 | 12:58 PM | 🔴 | MCP Configuration Path Missing "plugin/" Directory Component | ~418 |
|
||||
| #6274 | 12:57 PM | 🔵 | Installed MCP Configuration Uses Incorrect Path | ~389 |
|
||||
| #6270 | " | 🔵 | MCP Search Server Enable/Disable Documentation | ~314 |
|
||||
| #6253 | 12:55 PM | 🔵 | MCP Configuration Files Are Identical | ~311 |
|
||||
| #6250 | 12:54 PM | 🔵 | MCP Search Server Connection Failure Reported | ~329 |
|
||||
| #6249 | " | 🔴 | MCP Enable/Disable Implementation Overcomplicated | ~329 |
|
||||
| #6244 | 12:50 PM | 🔴 | MCP search configuration persistence fixed in settings UI | ~378 |
|
||||
| #6225 | 12:44 PM | 🔄 | Renamed MCP Template File from .optional to .template Convention | ~336 |
|
||||
| #6217 | 12:40 PM | ✅ | MCP Documentation Updated to Reference UI Toggle | ~360 |
|
||||
| #6214 | 12:39 PM | ✅ | Repository Cleanup - Removed Temporary Documentation Files | ~321 |
|
||||
| #6201 | 12:28 PM | 🟣 | Created Quick Start Guide for Enabling MCP Search | ~338 |
|
||||
| #6193 | 12:27 PM | 🟣 | Created Optional MCP Configuration File | ~313 |
|
||||
| #6190 | " | 🟣 | Created optional MCP configuration file for user-controlled search server enablement | ~364 |
|
||||
| #6189 | " | 🟣 | Created MCP search server enable/disable documentation | ~307 |
|
||||
| #6183 | 12:26 PM | 🔵 | MCP Search Server Commented Out in Plugin Configuration | ~322 |
|
||||
| #6180 | 12:25 PM | 🔵 | MCP configuration file current state | ~127 |
|
||||
|
||||
### Dec 10, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #23444 | 2:25 PM | 🟣 | Build Pipeline Execution Successful | ~293 |
|
||||
|
||||
### Dec 11, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24055 | 2:55 PM | ✅ | Build Successful with Bun Runtime Shebangs | ~355 |
|
||||
|
||||
### Dec 14, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #26800 | 11:39 PM | ✅ | Version 7.2.3 Build Complete With Worker Restart Fix | ~394 |
|
||||
| #26766 | 11:30 PM | ⚖️ | Root Cause Identified: Missing Post-Install Worker Restart Trigger in Plugin Update Flow | ~604 |
|
||||
| #25815 | 5:31 PM | 🔵 | Comprehensive MCP Server and SKILL.md Structure Analysis | ~575 |
|
||||
| #25813 | " | 🔵 | MCP Server Configuration with Stdio Transport | ~367 |
|
||||
|
||||
### Dec 16, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #27555 | 4:48 PM | ✅ | Version bump committed to main branch | ~242 |
|
||||
| #27554 | " | ✅ | Project built successfully with version 7.3.1 | ~306 |
|
||||
|
||||
### Dec 17, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #28922 | 7:28 PM | 🔵 | Plugin MCP Server Configuration for mem-search | ~245 |
|
||||
|
||||
### Dec 19, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30096 | 8:09 PM | 🔵 | Claude-Mem Plugin Includes MCP Server Configuration | ~246 |
|
||||
| #39048 | 3:44 PM | 🔵 | Plugin directory contains commands folder | ~276 |
|
||||
</claude-mem-context>
|
||||
@@ -0,0 +1,18 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Oct 25, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #2437 | 4:32 PM | 🟣 | Slash Command Files Created for Quick Settings Toggling | ~478 |
|
||||
|
||||
### Jan 10, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #39052 | 3:44 PM | 🟣 | Commands added to plugin distribution | ~268 |
|
||||
| #39050 | " | 🔵 | Plugin commands directory is empty | ~255 |
|
||||
</claude-mem-context>
|
||||
@@ -0,0 +1,92 @@
|
||||
# Bugfix Sprint: 2026-01-10
|
||||
|
||||
## Critical Priority (Blocks Users)
|
||||
|
||||
### #646 - Plugin bricks Claude Code - stdin fstat EINVAL crash
|
||||
- **Impact**: Plugin completely bricks Claude Code on Linux. Users cannot recover without manual config editing.
|
||||
- **Root Cause**: Bun's stdin handling causes fstat EINVAL when reading piped input
|
||||
- **Related Discussion**: Check if this is a Bun upstream issue
|
||||
- [ ] Investigate stdin handling in hook scripts
|
||||
- [ ] Test on Linux with stdin piping
|
||||
- [ ] Implement fix
|
||||
|
||||
### #623 - Crash-recovery loop when memory_session_id not captured
|
||||
- **Impact**: Infinite loop consuming API tokens, growing queue unbounded
|
||||
- **Root Cause**: memory_session_id not captured, causes repeated crash-recovery
|
||||
- [ ] Add null/undefined check for memory_session_id
|
||||
- [ ] Add circuit breaker for crash-recovery attempts
|
||||
|
||||
## High Priority
|
||||
|
||||
### #638 - Worker startup missing JSON output causes hooks to appear stuck
|
||||
- **Impact**: UI appears stuck during worker startup
|
||||
- [ ] Ensure worker startup emits proper JSON status
|
||||
- [ ] Add progress feedback to hook output
|
||||
|
||||
### #641/#609 - CLAUDE.md files in subdirectories
|
||||
- **Impact**: CLAUDE.md files scattered throughout project directories
|
||||
- **Note**: This is a documented feature request that was never implemented (setting exists but doesn't work)
|
||||
- [ ] Implement the `disableSubdirectoryCLAUDEmd` setting properly
|
||||
- [ ] Or change default behavior to not create subdirectory files
|
||||
|
||||
### #635 - JSON parsing error prevents folder context generation
|
||||
- **Impact**: Folder context not generating, breaks context injection
|
||||
- **Root Cause**: String spread instead of array spread
|
||||
- [ ] Fix the JSON parsing logic
|
||||
- [ ] Add proper error handling
|
||||
|
||||
## Medium Priority
|
||||
|
||||
### #582 - Tilde paths create literal ~ directories
|
||||
- **Impact**: Directories named "~" created instead of expanding to home
|
||||
- [ ] Use path expansion for tilde in all path operations
|
||||
- [ ] Audit all path handling code
|
||||
|
||||
### #642/#643 - ChromaDB search fails due to initialization timing
|
||||
- **Impact**: Search fails with JSON parse error
|
||||
- **Note**: #643 is a duplicate of #642
|
||||
- [ ] Fix initialization timing issue
|
||||
- [ ] Add proper async/await handling
|
||||
|
||||
### #626 - HealthMonitor hardcodes ~/.claude path
|
||||
- **Impact**: Fails for users with custom config directories
|
||||
- [ ] Use configurable path instead of hardcoded ~/.claude
|
||||
- [ ] Respect CLAUDE_CONFIG_DIR or similar env var
|
||||
|
||||
### #598 - Too many messages pollute conversation history
|
||||
- **Impact**: Hook messages clutter conversation
|
||||
- [ ] Reduce verbosity of hook messages
|
||||
- [ ] Make message frequency configurable
|
||||
|
||||
## Low Priority (Code Quality)
|
||||
|
||||
### #648 - Empty catch blocks swallow JSON parse errors
|
||||
- [ ] Add proper error logging to catch blocks in SessionSearch.ts
|
||||
|
||||
### #649 - Inconsistent logging in CursorHooksInstaller
|
||||
- [ ] Replace console.log with structured logger
|
||||
- **Note**: 177 console.log calls across 20 files identified
|
||||
|
||||
## Won't Fix / Not a Bug
|
||||
|
||||
### #632 - Feature request for disabling CLAUDE.md in subdirectories
|
||||
- **Note**: Covered by #641 implementation
|
||||
|
||||
### #633 - Help request about Cursor integration
|
||||
- **Note**: Documentation/support issue, not a bug
|
||||
|
||||
### #640 - Arabic README translation
|
||||
- **Note**: Documentation PR, not a bugfix
|
||||
|
||||
### #624 - Beta testing strategy proposal
|
||||
- **Note**: Enhancement proposal, not a bugfix
|
||||
|
||||
## Already Fixed in v9.0.2
|
||||
|
||||
- Windows Terminal tab accumulation (#625/#628)
|
||||
- Windows 11 compatibility - WMIC to PowerShell migration
|
||||
- Claude Code 2.1.1 compatibility + path validation (#614)
|
||||
|
||||
---
|
||||
|
||||
**Recommended Approach**: Fix #646 first (critical blocker), then #623 (crash loop), then work through high priority issues in order of impact.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-mem-plugin",
|
||||
"version": "9.0.2",
|
||||
"version": "9.0.5",
|
||||
"private": true,
|
||||
"description": "Runtime dependencies for claude-mem bundled hooks",
|
||||
"type": "module",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Nov 18, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #11179 | 4:09 AM | 🔵 | Search skill uses unified endpoint but lacks ID-based lookup instructions | ~370 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33558 | 11:05 PM | 🔵 | Current mem-search skill workflow documentation | ~446 |
|
||||
</claude-mem-context>
|
||||
+106
-81
@@ -3,93 +3,118 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Jan 3, 2026
|
||||
### Dec 10, 2025
|
||||
|
||||
**cleanup-duplicates.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36390 | 8:50 PM | 🔄 | Comprehensive Monolith Refactor with Modular Architecture | ~724 |
|
||||
| #36386 | 8:49 PM | ✅ | Committed duplicate observation cleanup script to repository | ~283 |
|
||||
| #36382 | 8:48 PM | 🟣 | Added safety checks to prevent accidental deletion of all observation copies | ~281 |
|
||||
| #36381 | " | 🔴 | Fixed duplicate group creation to use title field and dynamic window seconds | ~282 |
|
||||
| #36380 | " | 🔄 | Improved database connection initialization with explicit readonly handling | ~245 |
|
||||
| #36377 | 8:47 PM | 🔄 | Updated console output to display title instead of text | ~220 |
|
||||
| #36376 | " | 🔵 | Found sample output display also references old text field | ~210 |
|
||||
| #36375 | " | 🔴 | Fixed duplicate group creation to use title field and dynamic time bucket | ~288 |
|
||||
| #36374 | " | 🔵 | Found duplicate group creation still references old text field | ~249 |
|
||||
| #36373 | " | 🔄 | Updated DuplicateGroup interface to use title instead of text | ~192 |
|
||||
| #36372 | 8:46 PM | 🟣 | Implemented composite content hashing using title, subtitle, and narrative | ~301 |
|
||||
| #36371 | " | 🔴 | Fixed SQL query to select actual observation content columns | ~283 |
|
||||
| #36370 | " | 🔄 | Updated ObservationRow interface to use title-based schema fields | ~219 |
|
||||
| #36361 | 8:44 PM | 🟣 | Implemented dynamic fingerprint generation for aggressive mode | ~285 |
|
||||
| #23818 | 10:52 PM | ✅ | Build Script Updated to Bundle Worker CLI with Bun Shebang | ~225 |
|
||||
| #23817 | " | 🔵 | Build Script Handles Hook Bundling; Worker Shebang Currently Uses Node | ~323 |
|
||||
| #23793 | 10:14 PM | 🔄 | Smart Install Script Simplified for Clarity | ~479 |
|
||||
| #23667 | 8:35 PM | 🔵 | Export-Memories Script Structure and Database Query Pattern | ~287 |
|
||||
| #23649 | 8:13 PM | 🔴 | Fixed Sessions Array Type in Export Script | ~189 |
|
||||
| #23648 | " | 🔴 | Applied Type Annotations to Export Script Variables | ~305 |
|
||||
| #23647 | 8:12 PM | 🔴 | Improved Type Safety in Export Script | ~352 |
|
||||
| #23646 | " | 🔴 | Fixed Variable Shadowing in Export Script | ~234 |
|
||||
| #23645 | " | 🔵 | Export Script Has Variable Shadowing Issue | ~234 |
|
||||
| #23644 | 8:11 PM | 🔴 | Added Database Existence Check to Export Script | ~245 |
|
||||
| #23643 | " | 🔵 | Export Script Opens Database Without Existence Check | ~238 |
|
||||
| #23642 | " | 🔴 | Fixed Export Script Hardcoded Port - Now Reads from User Settings | ~244 |
|
||||
| #23641 | " | ✅ | Added Settings Import to Export Script | ~189 |
|
||||
| #23640 | " | 🔵 | Export Script Has Hardcoded Port Parameter | ~213 |
|
||||
| #23639 | " | 🔴 | Fixed Import Script insertSession.run() Call Parameters | ~218 |
|
||||
|
||||
### Dec 11, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24051 | 2:54 PM | 🟣 | Auto-Restart Worker After Marketplace Sync | ~384 |
|
||||
| #24050 | " | ✅ | Build Worker Binary Script Made Executable | ~225 |
|
||||
| #24049 | 2:53 PM | 🟣 | Windows Binary Build Script Created | ~362 |
|
||||
| #24048 | " | ✅ | MCP Server Shebang Updated to Bun Runtime | ~342 |
|
||||
| #24047 | " | ✅ | Hook Scripts Shebang Updated to Bun Runtime | ~305 |
|
||||
| #24046 | " | ✅ | Worker Service Shebang Updated to Bun Runtime | ~306 |
|
||||
| #24045 | 2:52 PM | 🔵 | Sync Marketplace Script Analysis for Auto-Restart Integration | ~366 |
|
||||
| #24043 | " | 🔵 | Build Script Analysis for Phase 4 Updates | ~380 |
|
||||
| #23922 | 1:34 PM | 🔵 | Three Node Shebangs Found in Build Configuration | ~349 |
|
||||
| #23917 | 1:33 PM | 🔵 | Worker Service Build Configuration Current State | ~365 |
|
||||
|
||||
### Dec 12, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24639 | 10:46 PM | 🔴 | Enhanced UV Detection to Support Fresh Installs Before PATH Reload | ~326 |
|
||||
| #24638 | " | 🔴 | Enhanced Bun Detection to Support Fresh Installs Before PATH Reload | ~338 |
|
||||
| #24637 | " | 🔵 | Bun Installation Detection Using spawnSync | ~288 |
|
||||
| #24636 | " | 🔵 | Duplicate Smart Install Scripts in Project Structure | ~288 |
|
||||
|
||||
### Dec 14, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #26768 | 11:31 PM | 🔵 | Build Script Generates Empty plugin/package.json Without Postinstall Hook | ~492 |
|
||||
| #26767 | " | 🔵 | Build Script Generates Empty Plugin Package.json Without Postinstall Hook | ~523 |
|
||||
| #26766 | 11:30 PM | ⚖️ | Root Cause Identified: Missing Post-Install Worker Restart Trigger in Plugin Update Flow | ~604 |
|
||||
| #26765 | " | 🔵 | Explore Agent Confirms Root Cause: No Proactive Worker Restart After Plugin Updates | ~613 |
|
||||
| #25815 | 5:31 PM | 🔵 | Comprehensive MCP Server and SKILL.md Structure Analysis | ~575 |
|
||||
| #25809 | 5:30 PM | 🔵 | Build System Architecture Using esbuild for Component Bundling | ~484 |
|
||||
|
||||
### Dec 16, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #27725 | 5:45 PM | 🔵 | Export script uses hybrid search API to export observations, sessions, summaries, and prompts | ~335 |
|
||||
| #27705 | 5:38 PM | ✅ | Switched import-memories.ts from better-sqlite3 to bun:sqlite | ~212 |
|
||||
|
||||
### Dec 17, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #29052 | 10:02 PM | 🔵 | Sync Script Manages Multiple Plugin Installation Locations | ~394 |
|
||||
|
||||
### Dec 18, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #29565 | 5:28 PM | ✅ | Output File Changed from code.yaml to code.json | ~234 |
|
||||
| #29564 | " | 🔄 | Script Refactored to Generate JSON Instead of YAML | ~332 |
|
||||
|
||||
### Dec 19, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30109 | 8:11 PM | 🔵 | RAGTIME Script Uses Agent SDK Without Plugin Loading | ~490 |
|
||||
| #30076 | 8:05 PM | 🔵 | RAGTIME Script Uses Agent SDK Query Function for Email Processing | ~389 |
|
||||
|
||||
### Dec 20, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30340 | 3:42 PM | 🔄 | Relocated simple ragtime.ts to ragtime folder | ~219 |
|
||||
| #30337 | 3:40 PM | 🔵 | Simplified Ragtime Runner in Scripts Directory | ~456 |
|
||||
| #30256 | 3:18 PM | 🔵 | Plugin Path Resolution Strategy | ~386 |
|
||||
| #30250 | 3:17 PM | 🟣 | RAGTIME Email Investigation Runner Implemented | ~503 |
|
||||
|
||||
### Dec 26, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32983 | 11:04 PM | 🟣 | Complete build and deployment pipeline executed | ~260 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33261 | 2:58 PM | 🔄 | Build script cleanup removes obsolete worker-wrapper and worker-cli build steps | ~335 |
|
||||
|
||||
### Dec 30, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34460 | 2:23 PM | 🔵 | Build System Architecture Using ESBuild | ~492 |
|
||||
|
||||
### Jan 4, 2026
|
||||
|
||||
**discord-release-notify.js**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36933 | 2:27 AM | ✅ | Discord release notification sent for v8.5.8 | ~228 |
|
||||
|
||||
**export-memories.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36924 | 2:25 AM | ✅ | Merged fix/pr-538-followups branch into main with comprehensive updates | ~481 |
|
||||
| #36914 | 2:24 AM | 🔵 | Recent commit 4d0a10c fixed multiple GitHub issues | ~365 |
|
||||
| #36847 | 1:45 AM | 🔵 | Export Script Type Import Pattern | ~433 |
|
||||
| #36827 | 1:03 AM | ✅ | Branch diff shows 1,293 insertions and 98 deletions across 15 files | ~464 |
|
||||
| #36825 | 1:00 AM | 🔵 | Export Script Contains Duplicate Type Definitions | ~579 |
|
||||
| #36770 | 12:42 AM | 🔵 | Export Script Type Duplication Analysis Complete | ~555 |
|
||||
| #36760 | 12:34 AM | ✅ | Created Issue #531 Report: Export Script Type Duplication | ~430 |
|
||||
| #36758 | " | 🔵 | Issue #531 Root Cause - 73 Lines of Duplicated Export Type Definitions | ~529 |
|
||||
| #36752 | 12:32 AM | 🔵 | Export Script Type Definitions Found | ~368 |
|
||||
|
||||
**smart-install.js**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36843 | 1:44 AM | 🔵 | Smart Install Script Structure and Path Detection Logic | ~538 |
|
||||
| #36829 | 1:40 AM | 🔵 | PR #542 Review Analysis - Multi-Issue Fix Validation | ~562 |
|
||||
| #36809 | 12:56 AM | 🟣 | GitHub Issue #527 Anti-Pattern Verification Complete - All Checks Passed | ~495 |
|
||||
| #36808 | " | 🟣 | Verified Windows Path Arrays Remain Unmodified | ~435 |
|
||||
| #36807 | " | 🟣 | Final Verification Confirms Complete Apple Silicon Homebrew Implementation | ~430 |
|
||||
| #36806 | 12:55 AM | 🟣 | Verified Apple Silicon Paths Only in Non-Windows Arrays | ~411 |
|
||||
| #36805 | " | 🟣 | Verified No Architecture Detection in Source File Implementation | ~374 |
|
||||
| #36803 | " | 🟣 | Source File Syntax Validation Passed | ~301 |
|
||||
| #36801 | 12:54 AM | 🟣 | Verified Source File Homebrew Path Count | ~283 |
|
||||
| #36795 | 12:52 AM | 🟣 | GitHub Issue #527 Completed - Apple Silicon Homebrew Path Support | ~550 |
|
||||
| #36793 | 12:51 AM | 🟣 | GitHub Issue #527 Source File Updates Complete | ~452 |
|
||||
| #36792 | 12:50 AM | 🟣 | Added Apple Silicon Homebrew Path for UV Detection | ~391 |
|
||||
| #36791 | " | 🟣 | Added Apple Silicon Homebrew Path for Bun Detection | ~399 |
|
||||
| #36772 | 12:42 AM | 🔵 | Smart Install Script Path Arrays Analysis Complete | ~448 |
|
||||
| #36761 | 12:36 AM | ✅ | Created Implementation Plans for Four GitHub Issues | ~507 |
|
||||
| #36721 | 12:15 AM | 🔵 | Issue #527 UV Homebrew Path Missing on Apple Silicon | ~492 |
|
||||
| #36719 | " | 🔵 | Issue #527 uv Homebrew Detection Missing on Apple Silicon Macs | ~526 |
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**regenerate-claude-md.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38086 | 10:42 PM | ✅ | Merged PR with comprehensive CLAUDE.md documentation system | ~478 |
|
||||
| #38050 | 9:46 PM | 🔵 | CLAUDE.md Regeneration Script for Bulk Folder Context Updates | ~599 |
|
||||
| #38005 | 9:03 PM | 🔵 | Comprehensive exploration of PR review items completed | ~438 |
|
||||
| #37994 | 9:01 PM | 🔵 | Understanding regenerate-claude-md.ts script architecture | ~436 |
|
||||
| #37991 | 9:00 PM | 🔵 | Located regenerate-claude-md.ts script | ~238 |
|
||||
| #37974 | 8:33 PM | 🔵 | CLAUDE.md regeneration script fails with Bun protocol error | ~216 |
|
||||
|
||||
**build-hooks.js**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37547 | 4:47 PM | ✅ | Issue #557 Analysis Report Created for Plugin Startup Failure | ~491 |
|
||||
|
||||
### Jan 6, 2026
|
||||
|
||||
**build-hooks.js**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38108 | 12:15 AM | 🔵 | Complete Windows Zombie Port Bug Technical Deep Dive | ~935 |
|
||||
|
||||
**smart-install.js**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38104 | 12:14 AM | 🔵 | Windows Compatibility Issues Documented Across 56 Memory Entries | ~509 |
|
||||
| #36765 | 12:41 AM | 🔵 | Smart Install Script Path Detection Logic | ~405 |
|
||||
</claude-mem-context>
|
||||
+6
-1
@@ -25,7 +25,6 @@
|
||||
| #23075 | 6:26 PM | ✅ | Deleted Expired Announcement Code from user-message-hook.ts | ~354 |
|
||||
| #23074 | " | ✅ | Replaced Verbose Manual Mode Help with Error in cleanup-hook.ts | ~222 |
|
||||
| #23073 | " | ✅ | Removed cwd from cleanup-hook Debug Logging | ~177 |
|
||||
| #23072 | " | ✅ | Simplified SessionEndInput Interface in cleanup-hook.ts | ~236 |
|
||||
|
||||
### Dec 10, 2025
|
||||
|
||||
@@ -97,4 +96,10 @@
|
||||
| #38173 | 7:25 PM | 🔵 | Standard Hook Response Pattern for Non-SessionStart Hooks | ~343 |
|
||||
| #38172 | 7:22 PM | 🔵 | Claude Code Hook Output Architecture Clarified - Exit Code Pattern is Correct for User-Only Display | ~523 |
|
||||
| #38170 | 7:21 PM | 🔵 | User-Message-Hook TypeScript Source Shows Exit Code 1 Strategy for User-Only Display | ~203 |
|
||||
|
||||
### Jan 9, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38783 | 4:59 PM | 🔵 | Standard Hook Response Pattern | ~263 |
|
||||
</claude-mem-context>
|
||||
@@ -6,6 +6,10 @@
|
||||
* Maintains MCP protocol handling and tool schemas
|
||||
*/
|
||||
|
||||
// Version injected at build time by esbuild define
|
||||
declare const __DEFAULT_PACKAGE_VERSION__: string;
|
||||
const packageVersion = typeof __DEFAULT_PACKAGE_VERSION__ !== 'undefined' ? __DEFAULT_PACKAGE_VERSION__ : '0.0.0-dev';
|
||||
|
||||
// Import logger first
|
||||
import { logger } from '../utils/logger.js';
|
||||
|
||||
@@ -236,11 +240,11 @@ NEVER fetch full details without filtering first. 10x token savings.`,
|
||||
const server = new Server(
|
||||
{
|
||||
name: 'mcp-search-server',
|
||||
version: '1.0.0',
|
||||
version: packageVersion,
|
||||
},
|
||||
{
|
||||
capabilities: {
|
||||
tools: {},
|
||||
tools: {}, // Exposes tools capability (handled by ListToolsRequestSchema and CallToolRequestSchema)
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
+59
-10
@@ -3,17 +3,66 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Jan 7, 2026
|
||||
### Nov 3, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38467 | 10:29 PM | ⚖️ | Log Level Audit Strategy: Tighten ERROR Messages for Runtime Issue Discovery | ~464 |
|
||||
| #38449 | 10:26 PM | 🔵 | ChromaSync Error Handling: Throw After ERROR Log Pattern | ~452 |
|
||||
| #38437 | 10:24 PM | 🔵 | Claude-mem core functionality and logging patterns identified | ~710 |
|
||||
| #38432 | " | 🔵 | ChromaSync class architecture and fail-fast design pattern | ~508 |
|
||||
| #38431 | " | 🔵 | ERROR-Level Logging Used Across 21 Source Files | ~480 |
|
||||
| #38425 | " | ⚖️ | Log Level Architecture: Fail-Critical Over Fail-Fast for Chroma | ~467 |
|
||||
| #38418 | 10:22 PM | 🔵 | ChromaDB Operates as Optional Subsystem with Graceful Degradation | ~586 |
|
||||
| #38416 | " | 🔵 | ChromaDB Is Critical Not Optional - Log Audit Findings Challenged | ~405 |
|
||||
| #38202 | 7:38 PM | 🔵 | ChromaSync Service Architecture | ~516 |
|
||||
| #3465 | 6:26 PM | ⚖️ | PR preparation for hybrid search feature ready for submission | ~521 |
|
||||
| #3460 | 6:18 PM | ✅ | Suppressed stderr output from Chroma MCP transport | ~231 |
|
||||
| #3350 | 3:33 PM | ✅ | Document splitting strategy improves semantic search precision by vectorizing field-level content | ~701 |
|
||||
| #3346 | " | 🟣 | ChromaSync service provides automatic real-time vector database synchronization | ~699 |
|
||||
| #3345 | " | 🟣 | Completed ChromaDB hybrid search integration with semantic search across all content types | ~762 |
|
||||
| #3323 | 3:01 PM | 🟣 | Integrated user prompt backfill into ChromaSync.backfill() | ~257 |
|
||||
| #3322 | " | 🟣 | Implemented real-time user prompt sync to ChromaDB | ~275 |
|
||||
| #3321 | " | ✅ | Added StoredUserPrompt interface to ChromaSync | ~179 |
|
||||
|
||||
### Nov 4, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #3645 | 3:03 PM | 🔵 | Observation Counter Removal Validated Safe for Chroma Integration | ~504 |
|
||||
| #3643 | " | 🔵 | Chroma Document ID Structure and Granular Field Splitting | ~410 |
|
||||
| #3642 | " | 🔵 | Observation Counter Independence from Chroma Import Process | ~440 |
|
||||
|
||||
### Nov 11, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #6992 | 6:28 PM | ⚖️ | Comprehensive Windows Issue Investigation and Fix Strategy | ~631 |
|
||||
| #6986 | 6:26 PM | 🔵 | ChromaSync UVX Connection Configuration Analysis | ~333 |
|
||||
| #6953 | 5:49 PM | 🔵 | ChromaSync Relies on uvx Python Package Runner Instead of npx | ~326 |
|
||||
| #6952 | 5:48 PM | 🔵 | ChromaSync Uses uvx Command for MCP Server on All Platforms | ~368 |
|
||||
|
||||
### Dec 5, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #20401 | 7:18 PM | 🔵 | ChromaSync service synchronizes observations and summaries to vector database for semantic search | ~521 |
|
||||
|
||||
### Dec 13, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25190 | 8:04 PM | 🔴 | Enhanced close() Method to Terminate Transport Subprocess | ~417 |
|
||||
| #25189 | 8:03 PM | 🔄 | Store Transport Reference in ensureConnection Method | ~284 |
|
||||
| #25188 | " | 🔄 | Added Transport Reference to ChromaSync Class | ~268 |
|
||||
| #25187 | " | 🔵 | ChromaSync Has close() Method But May Not Be Called | ~277 |
|
||||
| #25186 | " | 🔵 | ChromaSync Process Spawning via StdioClientTransport | ~355 |
|
||||
| #25117 | 7:39 PM | 🟣 | Automatic Collection Migration for Embedding Function Changes | ~493 |
|
||||
| #25116 | " | 🔄 | Collection Name Changed to Lazy Initialization | ~126 |
|
||||
| #25115 | " | 🔵 | ChromaSync Service Current Implementation Analysis | ~454 |
|
||||
| #25092 | 7:20 PM | 🟣 | ChromaSync Now Reads Embedding Function from Settings | ~394 |
|
||||
| #25090 | 7:19 PM | 🔵 | Located Hardcoded Embedding Function in ChromaSync | ~345 |
|
||||
|
||||
### Dec 17, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #28547 | 4:49 PM | 🔴 | Fixed Windows subprocess zombie process issue in ChromaSync | ~368 |
|
||||
| #28546 | " | ✅ | Added child_process import to ChromaSync | ~215 |
|
||||
| #28545 | 4:48 PM | 🟣 | Subprocess PID Extraction for Windows Process Management | ~385 |
|
||||
| #28544 | " | ✅ | Child Process PID Tracking Added to ChromaSync | ~239 |
|
||||
| #28543 | " | 🔵 | ChromaSync Service Architecture | ~337 |
|
||||
| #28542 | " | 🟣 | Windows Console Window Hiding for Chroma MCP Transport | ~308 |
|
||||
| #28468 | 4:25 PM | 🔵 | ChromaSync Fail-Fast MCP Vector Database Integration | ~501 |
|
||||
</claude-mem-context>
|
||||
@@ -18,6 +18,10 @@ import { USER_SETTINGS_PATH } from '../../shared/paths.js';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
|
||||
// Version injected at build time by esbuild define
|
||||
declare const __DEFAULT_PACKAGE_VERSION__: string;
|
||||
const packageVersion = typeof __DEFAULT_PACKAGE_VERSION__ !== 'undefined' ? __DEFAULT_PACKAGE_VERSION__ : '0.0.0-dev';
|
||||
|
||||
interface ChromaDocument {
|
||||
id: string;
|
||||
document: string;
|
||||
@@ -123,9 +127,10 @@ export class ChromaSync {
|
||||
|
||||
this.transport = new StdioClientTransport(transportOptions);
|
||||
|
||||
// Empty capabilities object: this client only calls Chroma tools, doesn't expose any
|
||||
this.client = new Client({
|
||||
name: 'claude-mem-chroma-sync',
|
||||
version: '1.0.0'
|
||||
version: packageVersion
|
||||
}, {
|
||||
capabilities: {}
|
||||
});
|
||||
|
||||
@@ -10,16 +10,15 @@
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { spawn } from 'child_process';
|
||||
import { homedir } from 'os';
|
||||
import { existsSync, writeFileSync, readFileSync, mkdirSync } from 'fs';
|
||||
import * as readline from 'readline';
|
||||
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
||||
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
||||
import { getWorkerPort, getWorkerHost } from '../shared/worker-utils.js';
|
||||
import { logger } from '../utils/logger.js';
|
||||
|
||||
// Version injected at build time by esbuild define
|
||||
declare const __DEFAULT_PACKAGE_VERSION__: string;
|
||||
const packageVersion = typeof __DEFAULT_PACKAGE_VERSION__ !== 'undefined' ? __DEFAULT_PACKAGE_VERSION__ : '0.0.0-dev';
|
||||
|
||||
// Infrastructure imports
|
||||
import {
|
||||
writePidFile,
|
||||
@@ -45,11 +44,7 @@ import { Server } from './server/Server.js';
|
||||
// Integration imports
|
||||
import {
|
||||
updateCursorContextForProject,
|
||||
handleCursorCommand,
|
||||
detectClaudeCode,
|
||||
findCursorHooksDir,
|
||||
installCursorHooks,
|
||||
configureCursorMcp
|
||||
handleCursorCommand
|
||||
} from './integrations/CursorHooksInstaller.js';
|
||||
|
||||
// Service layer imports
|
||||
@@ -74,9 +69,6 @@ import { SearchRoutes } from './worker/http/routes/SearchRoutes.js';
|
||||
import { SettingsRoutes } from './worker/http/routes/SettingsRoutes.js';
|
||||
import { LogsRoutes } from './worker/http/routes/LogsRoutes.js';
|
||||
|
||||
// Re-export updateCursorContextForProject for SDK agents
|
||||
export { updateCursorContextForProject };
|
||||
|
||||
/**
|
||||
* Build JSON status output for hook framework communication.
|
||||
* This is a pure function extracted for testability.
|
||||
@@ -141,9 +133,8 @@ export class WorkerService {
|
||||
this.sseBroadcaster = new SSEBroadcaster();
|
||||
this.sdkAgent = new SDKAgent(this.dbManager, this.sessionManager);
|
||||
this.geminiAgent = new GeminiAgent(this.dbManager, this.sessionManager);
|
||||
this.geminiAgent.setFallbackAgent(this.sdkAgent);
|
||||
this.openRouterAgent = new OpenRouterAgent(this.dbManager, this.sessionManager);
|
||||
this.openRouterAgent.setFallbackAgent(this.sdkAgent);
|
||||
|
||||
this.paginationHelper = new PaginationHelper(this.dbManager);
|
||||
this.settingsManager = new SettingsManager(this.dbManager);
|
||||
this.sessionEventBroadcaster = new SessionEventBroadcaster(this.sseBroadcaster, this);
|
||||
@@ -154,9 +145,10 @@ export class WorkerService {
|
||||
});
|
||||
|
||||
// Initialize MCP client
|
||||
// Empty capabilities object: this client only calls tools, doesn't expose any
|
||||
this.mcpClient = new Client({
|
||||
name: 'worker-search-proxy',
|
||||
version: '1.0.0'
|
||||
version: packageVersion
|
||||
}, { capabilities: {} });
|
||||
|
||||
// Initialize HTTP server with core routes
|
||||
@@ -432,212 +424,6 @@ export class WorkerService {
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Interactive Setup Wizard
|
||||
// ============================================================================
|
||||
|
||||
async function runInteractiveSetup(): Promise<number> {
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
const question = (prompt: string): Promise<string> => {
|
||||
return new Promise(resolve => rl.question(prompt, resolve));
|
||||
};
|
||||
|
||||
console.log(`
|
||||
╔══════════════════════════════════════════════════════════════════╗
|
||||
║ Claude-Mem Cursor Setup Wizard ║
|
||||
║ ║
|
||||
║ This wizard will guide you through setting up claude-mem ║
|
||||
║ for use with Cursor IDE. ║
|
||||
╚══════════════════════════════════════════════════════════════════╝
|
||||
`);
|
||||
|
||||
try {
|
||||
console.log('Step 1: Checking environment...\n');
|
||||
|
||||
const hasClaudeCode = await detectClaudeCode();
|
||||
const settingsPath = path.join(homedir(), '.claude-mem', 'settings.json');
|
||||
let settings: Record<string, unknown> = {};
|
||||
|
||||
if (existsSync(settingsPath)) {
|
||||
try {
|
||||
settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
||||
} catch (error) {
|
||||
logger.debug('SETUP', 'Corrupt settings file, starting fresh', { path: settingsPath }, error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
const currentProvider = settings['CLAUDE_MEM_PROVIDER'] as string || (hasClaudeCode ? 'claude-sdk' : 'none');
|
||||
|
||||
if (hasClaudeCode) {
|
||||
console.log('Claude Code detected\n');
|
||||
} else {
|
||||
console.log('Claude Code not detected\n');
|
||||
}
|
||||
|
||||
console.log(`Current provider: ${currentProvider}\n`);
|
||||
|
||||
console.log('Step 2: Choose AI Provider\n');
|
||||
if (hasClaudeCode) {
|
||||
console.log(' [1] Claude SDK (Recommended - uses your Claude Code subscription)');
|
||||
} else {
|
||||
console.log(' [1] Claude SDK (requires Claude Code subscription)');
|
||||
}
|
||||
console.log(' [2] Gemini (1500 free requests/day)');
|
||||
console.log(' [3] OpenRouter (100+ models, some free)');
|
||||
console.log(' [4] Keep current settings\n');
|
||||
|
||||
const providerChoice = await question('Enter choice [1-4]: ');
|
||||
|
||||
if (providerChoice === '1') {
|
||||
settings['CLAUDE_MEM_PROVIDER'] = 'claude-sdk';
|
||||
mkdirSync(path.dirname(settingsPath), { recursive: true });
|
||||
writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
||||
console.log('\nClaude SDK configured!\n');
|
||||
} else if (providerChoice === '2') {
|
||||
console.log('\nConfiguring Gemini...\n');
|
||||
console.log(' Get your free API key at: https://aistudio.google.com/apikey\n');
|
||||
|
||||
const apiKey = await question('Enter your Gemini API key: ');
|
||||
if (apiKey.trim()) {
|
||||
settings['CLAUDE_MEM_PROVIDER'] = 'gemini';
|
||||
settings['CLAUDE_MEM_GEMINI_API_KEY'] = apiKey.trim();
|
||||
mkdirSync(path.dirname(settingsPath), { recursive: true });
|
||||
writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
||||
console.log('\nGemini configured successfully!\n');
|
||||
} else {
|
||||
console.log('\nNo API key provided. You can add it later in ~/.claude-mem/settings.json\n');
|
||||
}
|
||||
} else if (providerChoice === '3') {
|
||||
console.log('\nConfiguring OpenRouter...\n');
|
||||
console.log(' Get your API key at: https://openrouter.ai/keys\n');
|
||||
|
||||
const apiKey = await question('Enter your OpenRouter API key: ');
|
||||
if (apiKey.trim()) {
|
||||
settings['CLAUDE_MEM_PROVIDER'] = 'openrouter';
|
||||
settings['CLAUDE_MEM_OPENROUTER_API_KEY'] = apiKey.trim();
|
||||
mkdirSync(path.dirname(settingsPath), { recursive: true });
|
||||
writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
||||
console.log('\nOpenRouter configured successfully!\n');
|
||||
} else {
|
||||
console.log('\nNo API key provided. You can add it later in ~/.claude-mem/settings.json\n');
|
||||
}
|
||||
} else {
|
||||
console.log('\nKeeping current settings.\n');
|
||||
}
|
||||
|
||||
console.log('Step 3: Choose installation scope\n');
|
||||
console.log(' [1] Project (current directory only) - Recommended');
|
||||
console.log(' [2] User (all projects for current user)');
|
||||
console.log(' [3] Skip hook installation\n');
|
||||
|
||||
const scopeChoice = await question('Enter choice [1-3]: ');
|
||||
|
||||
let installTarget: string | null = null;
|
||||
if (scopeChoice === '1') {
|
||||
installTarget = 'project';
|
||||
} else if (scopeChoice === '2') {
|
||||
installTarget = 'user';
|
||||
} else {
|
||||
console.log('\nSkipping hook installation.\n');
|
||||
}
|
||||
|
||||
if (installTarget) {
|
||||
console.log(`Step 4: Installing Cursor hooks (${installTarget})...\n`);
|
||||
|
||||
const cursorHooksDir = findCursorHooksDir();
|
||||
if (!cursorHooksDir) {
|
||||
console.error('Could not find cursor-hooks directory');
|
||||
console.error(' Make sure you ran npm run build first.');
|
||||
rl.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
const installResult = await installCursorHooks(cursorHooksDir, installTarget as 'project' | 'user');
|
||||
if (installResult !== 0) {
|
||||
rl.close();
|
||||
return installResult;
|
||||
}
|
||||
|
||||
console.log('\nStep 5: Configuring MCP server for memory search...\n');
|
||||
const mcpResult = configureCursorMcp(installTarget as 'project' | 'user');
|
||||
if (mcpResult !== 0) {
|
||||
console.warn('MCP configuration failed, but hooks are installed.');
|
||||
console.warn(' You can manually configure MCP later.\n');
|
||||
} else {
|
||||
console.log('');
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\nStep 6: Starting claude-mem worker...\n');
|
||||
|
||||
const port = getWorkerPort();
|
||||
const alreadyRunning = await waitForHealth(port, 1000);
|
||||
|
||||
if (alreadyRunning) {
|
||||
console.log('Worker is already running!\n');
|
||||
} else {
|
||||
console.log(' Starting worker in background...');
|
||||
|
||||
const pid = spawnDaemon(__filename, port);
|
||||
if (pid === undefined) {
|
||||
console.error('Failed to start worker');
|
||||
rl.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
writePidFile({ pid, port, startedAt: new Date().toISOString() });
|
||||
|
||||
const healthy = await waitForHealth(port, getPlatformTimeout(30000));
|
||||
if (!healthy) {
|
||||
removePidFile();
|
||||
console.error('Worker failed to start');
|
||||
rl.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
console.log('Worker started successfully!\n');
|
||||
}
|
||||
|
||||
console.log(`
|
||||
╔══════════════════════════════════════════════════════════════════╗
|
||||
║ Setup Complete! ║
|
||||
╚══════════════════════════════════════════════════════════════════╝
|
||||
|
||||
What's installed:
|
||||
- Cursor hooks - Automatically capture sessions
|
||||
- Context injection - Past work injected into new chats
|
||||
- MCP search server - Ask "what did I work on last week?"
|
||||
|
||||
Next steps:
|
||||
1. Restart Cursor to load the hooks and MCP server
|
||||
2. Start chatting - your sessions will be remembered!
|
||||
3. Use natural language to search: "find where I fixed the auth bug"
|
||||
|
||||
Useful commands:
|
||||
npm run cursor:status Check installation status
|
||||
npm run worker:status Check worker status
|
||||
npm run worker:logs View worker logs
|
||||
|
||||
Memory viewer:
|
||||
http://localhost:${port}
|
||||
|
||||
Documentation:
|
||||
https://docs.claude-mem.ai/cursor
|
||||
`);
|
||||
|
||||
rl.close();
|
||||
return 0;
|
||||
} catch (error) {
|
||||
rl.close();
|
||||
console.error(`\nSetup failed: ${(error as Error).message}`);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// CLI Entry Point
|
||||
// ============================================================================
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
import { logger } from '../../../utils/logger.js';
|
||||
import { parseObservations, parseSummary, type ParsedObservation, type ParsedSummary } from '../../../sdk/parser.js';
|
||||
import { updateCursorContextForProject } from '../../worker-service.js';
|
||||
import { updateCursorContextForProject } from '../../integrations/CursorHooksInstaller.js';
|
||||
import { updateFolderClaudeMdFiles } from '../../../utils/claude-md-utils.js';
|
||||
import { getWorkerPort } from '../../../shared/worker-utils.js';
|
||||
import type { ActiveSession } from '../../worker-types.js';
|
||||
|
||||
@@ -3,85 +3,5 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 7, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #21829 | 11:05 PM | 🔄 | Massive refactor adds 8,671 lines and removes 5,585 lines across 60 files | ~619 |
|
||||
| #21824 | 10:59 PM | 🔵 | SessionEventBroadcaster methods called 7 times across SessionRoutes and SessionCompletionHandler | ~398 |
|
||||
| #21822 | " | 🔵 | SessionEventBroadcaster instantiated in WorkerService and injected into routes and handlers | ~372 |
|
||||
| #21816 | 10:58 PM | 🔵 | SessionEventBroadcaster provides semantic SSE event broadcasting | ~398 |
|
||||
| #21807 | 10:49 PM | ⚖️ | KISS Audit Identified 587 Lines of Ceremonial Complexity | ~699 |
|
||||
| #21796 | 10:46 PM | 🔵 | SessionEventBroadcaster Duplicates Processing Status Updates | ~388 |
|
||||
| #21743 | 10:16 PM | 🟣 | Created SessionEventBroadcaster for Semantic Session Event Broadcasting | ~514 |
|
||||
|
||||
### Dec 8, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #22107 | 6:47 PM | 🔵 | SessionEventBroadcaster Has observation_queued But No observation_completed Event | ~429 |
|
||||
| #22049 | 6:04 PM | 🔵 | broadcastProcessingStatus method synchronizes queue state across six system components | ~477 |
|
||||
| #22043 | 6:02 PM | 🔵 | SessionEventBroadcaster provides semantic event broadcasting with SSE and processing status updates | ~449 |
|
||||
| #22036 | 6:00 PM | 🔵 | Found processing_status tracking across UI, hooks, and event systems | ~312 |
|
||||
|
||||
### Dec 11, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #23962 | 1:59 PM | 🔵 | Services Layer Implements Full Backend Architecture | ~490 |
|
||||
|
||||
### Dec 20, 2025
|
||||
|
||||
**session-events.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30609 | 5:01 PM | 🔄 | Phase 4: Eliminated Over-Engineering in Hook/Worker System | ~504 |
|
||||
| #30567 | 4:56 PM | 🟣 | Session Event Broadcasting Utilities | ~313 |
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30593 | 4:59 PM | 🔄 | Deleted SessionEventBroadcaster Class File | ~298 |
|
||||
| #30548 | 4:53 PM | 🔵 | SessionEventBroadcaster SSE Notification Layer | ~338 |
|
||||
|
||||
### Dec 25, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32597 | 8:40 PM | 🔵 | Identified session completion mechanism and potential method discrepancy | ~470 |
|
||||
| #32580 | 8:22 PM | 🔵 | Grep for resetStuckMessages and processing | ~242 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33439 | 10:15 PM | 🔄 | Extended Session ID Renaming to Additional Codebase Components | ~352 |
|
||||
| #33328 | 3:10 PM | 🟣 | Merged centralized logger and session continuity diagnostics to main | ~397 |
|
||||
| #33280 | 3:07 PM | 🔄 | Logger coverage refactor for background services | ~428 |
|
||||
|
||||
### Dec 30, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34550 | 4:53 PM | 🔵 | Phase 2 Review Reveals Critical Incomplete Error Handling | ~577 |
|
||||
|
||||
### Dec 31, 2025
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34558 | 2:32 PM | 🔵 | Code Quality Fix Plan Created for Seven Identified Issues | ~629 |
|
||||
|
||||
### Jan 2, 2026
|
||||
|
||||
**SessionEventBroadcaster.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35951 | 4:42 PM | 🔵 | Multi-Layer Service Architecture Discovery | ~395 |
|
||||
*No recent activity*
|
||||
</claude-mem-context>
|
||||
@@ -3,57 +3,95 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Jan 4, 2026
|
||||
### Dec 5, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37327 | 11:44 PM | ✅ | Cleaned Up Auto-Generated CLAUDE.md Files | ~352 |
|
||||
| #37326 | " | ✅ | Staged All Changes for Commit | ~386 |
|
||||
| #37325 | " | ✅ | Staged PR #554 Implementation Files | ~373 |
|
||||
| #37324 | " | ✅ | Cleaned Up Auto-Generated CLAUDE.md Files | ~392 |
|
||||
| #37323 | " | ✅ | Cleanup Completed - 31 Auto-Generated CLAUDE.md Files Deleted | ~411 |
|
||||
| #37286 | 11:07 PM | ✅ | Phase 1 Settings Patch Applied Successfully | ~249 |
|
||||
| #37282 | 11:06 PM | ✅ | Phase 1 Settings Patch Created | ~284 |
|
||||
| #37280 | " | 🔵 | Feature Branch Missing FOLDER_CLAUDEMD_ENABLED Setting | ~251 |
|
||||
| #37272 | 11:02 PM | ✅ | Phase 1 Verification Complete - All Checks Pass | ~275 |
|
||||
| #37270 | " | 🔵 | Settings Routes Already Include FOLDER_CLAUDEMD_ENABLED | ~333 |
|
||||
| #37267 | 11:00 PM | ✅ | Added CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED to Settings Validation | ~284 |
|
||||
| #37266 | 10:59 PM | 🟣 | Added FOLDER_CLAUDEMD_ENABLED to Settings Routes Handler | ~329 |
|
||||
| #37259 | 10:32 PM | ⚖️ | Implementation Plan Created for PR #554 Enhancements | ~621 |
|
||||
| #37258 | 10:31 PM | ⚖️ | Comprehensive Implementation Plan Created for PR #554 Review Fixes | ~722 |
|
||||
| #37257 | 10:29 PM | 🔵 | Regenerate Script and Settings Infrastructure Analyzed | ~563 |
|
||||
| #37255 | " | 🔵 | Folder CLAUDE.md Integration Flow Mapped | ~550 |
|
||||
| #20734 | 9:08 PM | 🔵 | SearchRoutes Context Injection Endpoint with Dynamic Import | ~614 |
|
||||
| #20548 | 8:21 PM | 🔵 | Context generator imported from services directory in worker | ~334 |
|
||||
| #20547 | " | 🔵 | Context injection route implementation in SearchRoutes.ts | ~289 |
|
||||
|
||||
### Jan 5, 2026
|
||||
### Dec 7, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37947 | 8:10 PM | 🔵 | Context injection generates formatted context via generateContext function | ~332 |
|
||||
| #37838 | 6:55 PM | 🔵 | Complete Hook Architecture Technical Specification | ~704 |
|
||||
| #37836 | 6:54 PM | 🔵 | Worker Service HTTP API Architecture and Hook Integration Pattern | ~639 |
|
||||
| #37702 | 6:01 PM | 🔵 | Codebase uses path.join() exclusively with known anchors, no project root resolution pattern exists | ~489 |
|
||||
| #37701 | " | 🔵 | Complete cwd data flow traced from hooks through observation processing | ~447 |
|
||||
| #37694 | 5:55 PM | 🔵 | Sessions initialized via SessionManager.initializeSession() with cwd from request body | ~361 |
|
||||
| #37440 | 1:13 AM | 🔵 | Comprehensive Analysis of Settings and Hard-Coded Limit | ~389 |
|
||||
| #37435 | " | 🔵 | Settings Validation Limits CLAUDE_MEM_CONTEXT_OBSERVATIONS to 1-200 | ~307 |
|
||||
| #37421 | 1:06 AM | 🔵 | Identified by-file API endpoint usage across codebase | ~406 |
|
||||
| #37408 | 12:58 AM | 🔵 | SearchRoutes API Architecture with Worktree Support | ~543 |
|
||||
| #37391 | 12:48 AM | ✅ | Staged 23 CLAUDE.md files with mix of new and modified content | ~400 |
|
||||
| #37390 | 12:47 AM | ✅ | Regenerated 23 CLAUDE.md files in budapest workspace | ~365 |
|
||||
| #21742 | 10:16 PM | 🔵 | SessionRoutes Analysis: Identified 10+ Scattered Broadcast Calls | ~540 |
|
||||
|
||||
### Jan 7, 2026
|
||||
### Dec 8, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38467 | 10:29 PM | ⚖️ | Log Level Audit Strategy: Tighten ERROR Messages for Runtime Issue Discovery | ~464 |
|
||||
| #38456 | 10:26 PM | 🔵 | happyPathError Inline Fallback: Missing CWD When Queueing Observations | ~463 |
|
||||
| #38453 | " | 🔵 | Generator Exit Patterns: Distinguishing Aborts from Unexpected Failures | ~454 |
|
||||
| #38437 | 10:24 PM | 🔵 | Claude-mem core functionality and logging patterns identified | ~710 |
|
||||
| #38431 | " | 🔵 | ERROR-Level Logging Used Across 21 Source Files | ~480 |
|
||||
| #38405 | 10:07 PM | ⚖️ | DEBUG Log Level Analysis - One Message Requires WARN Promotion | ~819 |
|
||||
| #38404 | 10:06 PM | ⚖️ | Log Level Audit Analysis - WARN to ERROR Promotion Criteria Established | ~769 |
|
||||
| #38372 | 9:43 PM | 🔵 | Logging Anti-Pattern Found: Critical Errors Logged as DEBUG Instead of ERROR | ~464 |
|
||||
| #38356 | 9:16 PM | 🔴 | Fixed AbortController Leak During Crash Recovery | ~384 |
|
||||
| #38354 | 9:10 PM | 🔵 | Provider Selection Architecture and Default Settings Location | ~478 |
|
||||
| #38351 | 9:09 PM | 🔵 | AbortController Replacement Without Abort Confirmed at Line 191 | ~434 |
|
||||
| #22301 | 9:44 PM | 🔵 | Privacy Validation in Observation Processing | ~399 |
|
||||
| #22296 | 9:43 PM | 🔵 | SessionRoutes HTTP Endpoints and SDK Agent Lifecycle | ~442 |
|
||||
| #22222 | 8:29 PM | 🔵 | Found waiting logic in SessionRoutes but it may not be working correctly | ~359 |
|
||||
| #22005 | 5:40 PM | 🔵 | handleObservationsByClaudeId Current Implementation | ~443 |
|
||||
| #22004 | " | 🔵 | Legacy Observation Handling Pattern Identified | ~337 |
|
||||
| #22003 | " | 🔵 | SessionRoutes Architecture Confirmed | ~354 |
|
||||
| #21969 | 5:22 PM | 🟣 | Worker Routes Pass tool_use_id to SessionManager Queue | ~290 |
|
||||
| #21968 | " | ✅ | Worker Endpoint Extracts toolUseId from Observation Request | ~243 |
|
||||
| #21962 | 5:21 PM | 🟣 | Implemented handleGetObservationsForToolUse Endpoint Handler | ~325 |
|
||||
| #21961 | " | 🟣 | Added GET Endpoint for Fetching Observations by Tool Use ID | ~272 |
|
||||
| #21951 | 5:18 PM | 🔵 | Worker SessionRoutes Architecture and Endpoints Reviewed | ~418 |
|
||||
| #21948 | 5:09 PM | 🟣 | Implemented PreToolUse Endpoint Handler | ~334 |
|
||||
| #21947 | 5:07 PM | 🟣 | Added PreToolUse Route Registration | ~287 |
|
||||
|
||||
### Dec 9, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #23143 | 6:42 PM | ✅ | Updated Skip Tools Logic to Use USER_SETTINGS_PATH Constant | ~150 |
|
||||
| #23142 | " | ✅ | Fixed Settings Path Import in SessionRoutes | ~148 |
|
||||
| #23140 | 6:41 PM | 🟣 | Implemented Skip Tools Filtering in Observations Endpoint | ~386 |
|
||||
| #23138 | " | ✅ | Added SettingsDefaultsManager and Paths Imports to SessionRoutes | ~222 |
|
||||
| #23136 | " | 🔵 | SessionRoutes handleObservationsByClaudeId Handler Structure | ~329 |
|
||||
| #23007 | 4:02 PM | 🔵 | Settings Write Implementation Using Nested Schema | ~398 |
|
||||
| #22859 | 2:28 PM | 🔴 | Fixed Python Version Validation to Support 3.10+ | ~322 |
|
||||
| #22854 | 2:27 PM | 🔵 | Located Python Version Validation Regex in SettingsRoutes | ~316 |
|
||||
|
||||
### Dec 10, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #23593 | 5:52 PM | 🔵 | SearchRoutes Handler Pattern | ~268 |
|
||||
| #23588 | 5:51 PM | 🔵 | Search Routes HTTP API Integration | ~281 |
|
||||
|
||||
### Dec 14, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #26253 | 8:31 PM | 🔵 | SearchRoutes Confirms Context Endpoints Use generateContext, Search Uses SearchManager | ~397 |
|
||||
| #25689 | 4:23 PM | 🔵 | SessionRoutes queueSummarize receives messages but doesn't persist them to database | ~496 |
|
||||
|
||||
### Dec 15, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #27043 | 6:04 PM | 🔵 | Subagent confirms no version switcher UI exists, only orphaned backend infrastructure | ~539 |
|
||||
| #27041 | 6:03 PM | 🔵 | Branch switching code isolated to two backend files, no frontend UI components | ~473 |
|
||||
| #27037 | 6:02 PM | 🔵 | Branch switching functionality exists in SettingsRoutes with UI switcher removal intent | ~463 |
|
||||
|
||||
### Dec 16, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #27414 | 3:25 PM | 🔵 | Batch Observations Endpoint Already Implemented | ~330 |
|
||||
|
||||
### Dec 19, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30077 | 8:05 PM | 🔵 | SessionRoutes HTTP API Manages SDK Agent Lifecycle and Message Queue | ~516 |
|
||||
|
||||
### Dec 26, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32949 | 10:55 PM | 🔵 | Complete settings persistence flow for Xiaomi MIMO v2 Flash model | ~320 |
|
||||
| #32939 | 10:53 PM | 🔵 | Settings API routes handle model configuration persistence | ~288 |
|
||||
|
||||
### Dec 30, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34491 | 2:28 PM | 🔵 | SessionRoutes Implements Multi-Provider Agent Management | ~635 |
|
||||
</claude-mem-context>
|
||||
@@ -1,344 +0,0 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'bun:test';
|
||||
import { execSync, spawn } from 'child_process';
|
||||
import { mkdirSync, writeFileSync, existsSync, rmSync, readFileSync, chmodSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { tmpdir, homedir } from 'os';
|
||||
|
||||
/**
|
||||
* Tests for Cursor Hook Script Outputs
|
||||
*
|
||||
* These tests validate that hook scripts produce the correct JSON output
|
||||
* required by Cursor's hook system.
|
||||
*
|
||||
* Critical requirements:
|
||||
* - beforeSubmitPrompt hooks MUST output {"continue": true}
|
||||
* - stop hooks MUST output valid JSON (usually {} or {"followup_message": "..."})
|
||||
*
|
||||
* If these outputs are wrong, Cursor will block prompts or fail silently.
|
||||
*/
|
||||
|
||||
// Skip these tests if jq is not installed (required by the scripts)
|
||||
function hasJq(): boolean {
|
||||
try {
|
||||
execSync('which jq', { stdio: 'pipe' });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip these tests on Windows (bash scripts)
|
||||
function isUnix(): boolean {
|
||||
return process.platform !== 'win32';
|
||||
}
|
||||
|
||||
const describeOrSkip = (hasJq() && isUnix()) ? describe : describe.skip;
|
||||
|
||||
describeOrSkip('Cursor Hook Script Outputs', () => {
|
||||
let tempDir: string;
|
||||
let cursorHooksDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
// Create unique temp directory for each test
|
||||
tempDir = join(tmpdir(), `cursor-hook-output-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
||||
mkdirSync(tempDir, { recursive: true });
|
||||
|
||||
// Find cursor-hooks directory
|
||||
cursorHooksDir = join(process.cwd(), 'cursor-hooks');
|
||||
if (!existsSync(cursorHooksDir)) {
|
||||
throw new Error('cursor-hooks directory not found');
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Clean up temp directory
|
||||
try {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
} catch {
|
||||
// Ignore cleanup errors
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Run a hook script with input and return the output
|
||||
*/
|
||||
function runHookScript(scriptName: string, input: object): string {
|
||||
const scriptPath = join(cursorHooksDir, scriptName);
|
||||
|
||||
if (!existsSync(scriptPath)) {
|
||||
throw new Error(`Script not found: ${scriptPath}`);
|
||||
}
|
||||
|
||||
// Make sure script is executable
|
||||
chmodSync(scriptPath, 0o755);
|
||||
|
||||
const result = execSync(`bash "${scriptPath}"`, {
|
||||
input: JSON.stringify(input),
|
||||
cwd: tempDir,
|
||||
env: {
|
||||
...process.env,
|
||||
HOME: homedir(), // Ensure HOME is set for ~/.claude-mem access
|
||||
},
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
describe('session-init.sh (beforeSubmitPrompt)', () => {
|
||||
it('outputs {"continue": true} for valid input', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-conv-123',
|
||||
prompt: 'Hello world',
|
||||
workspace_roots: [tempDir]
|
||||
};
|
||||
|
||||
const output = runHookScript('session-init.sh', input);
|
||||
const parsed = JSON.parse(output);
|
||||
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('outputs {"continue": true} even with empty input', () => {
|
||||
const output = runHookScript('session-init.sh', {});
|
||||
const parsed = JSON.parse(output);
|
||||
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('outputs {"continue": true} even with invalid JSON-like input', () => {
|
||||
const input = {
|
||||
conversation_id: null,
|
||||
workspace_roots: null
|
||||
};
|
||||
|
||||
const output = runHookScript('session-init.sh', input);
|
||||
const parsed = JSON.parse(output);
|
||||
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('output is valid JSON', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-123',
|
||||
prompt: 'Test prompt'
|
||||
};
|
||||
|
||||
const output = runHookScript('session-init.sh', input);
|
||||
|
||||
// Should not throw
|
||||
expect(() => JSON.parse(output)).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('context-inject.sh (beforeSubmitPrompt)', () => {
|
||||
it('outputs {"continue": true} for valid input', () => {
|
||||
const input = {
|
||||
workspace_roots: [tempDir]
|
||||
};
|
||||
|
||||
const output = runHookScript('context-inject.sh', input);
|
||||
const parsed = JSON.parse(output);
|
||||
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('outputs {"continue": true} even with empty input', () => {
|
||||
const output = runHookScript('context-inject.sh', {});
|
||||
const parsed = JSON.parse(output);
|
||||
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('output is valid JSON', () => {
|
||||
const output = runHookScript('context-inject.sh', {});
|
||||
|
||||
expect(() => JSON.parse(output)).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('session-summary.sh (stop)', () => {
|
||||
it('outputs valid JSON for typical input', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-conv-456',
|
||||
workspace_roots: [tempDir],
|
||||
status: 'completed'
|
||||
};
|
||||
|
||||
const output = runHookScript('session-summary.sh', input);
|
||||
|
||||
// Should be valid JSON
|
||||
expect(() => JSON.parse(output)).not.toThrow();
|
||||
});
|
||||
|
||||
it('outputs empty object {} when nothing to report', () => {
|
||||
const input = {
|
||||
// No conversation_id - should exit early with {}
|
||||
};
|
||||
|
||||
const output = runHookScript('session-summary.sh', input);
|
||||
const parsed = JSON.parse(output);
|
||||
|
||||
expect(parsed).toEqual({});
|
||||
});
|
||||
|
||||
it('output is valid JSON even with minimal input', () => {
|
||||
const output = runHookScript('session-summary.sh', {});
|
||||
|
||||
expect(() => JSON.parse(output)).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('save-observation.sh (afterMCPExecution)', () => {
|
||||
it('exits cleanly with no output for valid MCP input', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-conv-789',
|
||||
hook_event_name: 'afterMCPExecution',
|
||||
tool_name: 'Bash',
|
||||
tool_input: { command: 'ls' },
|
||||
result_json: { output: 'file1.txt' },
|
||||
workspace_roots: [tempDir]
|
||||
};
|
||||
|
||||
// This script should exit with 0 and produce no output
|
||||
const scriptPath = join(cursorHooksDir, 'save-observation.sh');
|
||||
const result = execSync(`bash "${scriptPath}"`, {
|
||||
input: JSON.stringify(input),
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Should be empty or just whitespace
|
||||
expect(result.trim()).toBe('');
|
||||
});
|
||||
|
||||
it('exits cleanly for shell execution input', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-conv-101',
|
||||
hook_event_name: 'afterShellExecution',
|
||||
command: 'ls -la',
|
||||
output: 'file1.txt\nfile2.txt',
|
||||
workspace_roots: [tempDir]
|
||||
};
|
||||
|
||||
const scriptPath = join(cursorHooksDir, 'save-observation.sh');
|
||||
const result = execSync(`bash "${scriptPath}"`, {
|
||||
input: JSON.stringify(input),
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Should be empty or just whitespace
|
||||
expect(result.trim()).toBe('');
|
||||
});
|
||||
|
||||
it('exits cleanly with no session_id', () => {
|
||||
const input = {
|
||||
hook_event_name: 'afterMCPExecution',
|
||||
tool_name: 'Bash'
|
||||
// No conversation_id or generation_id
|
||||
};
|
||||
|
||||
const scriptPath = join(cursorHooksDir, 'save-observation.sh');
|
||||
const result = execSync(`bash "${scriptPath}"`, {
|
||||
input: JSON.stringify(input),
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Should exit cleanly
|
||||
expect(result.trim()).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('save-file-edit.sh (afterFileEdit)', () => {
|
||||
it('exits cleanly with valid file edit input', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-conv-edit',
|
||||
file_path: '/path/to/file.ts',
|
||||
edits: [
|
||||
{ old_string: 'old code', new_string: 'new code' }
|
||||
],
|
||||
workspace_roots: [tempDir]
|
||||
};
|
||||
|
||||
const scriptPath = join(cursorHooksDir, 'save-file-edit.sh');
|
||||
const result = execSync(`bash "${scriptPath}"`, {
|
||||
input: JSON.stringify(input),
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Should be empty or just whitespace
|
||||
expect(result.trim()).toBe('');
|
||||
});
|
||||
|
||||
it('exits cleanly with no file_path', () => {
|
||||
const input = {
|
||||
conversation_id: 'test-conv-edit',
|
||||
edits: []
|
||||
// No file_path - should exit early
|
||||
};
|
||||
|
||||
const scriptPath = join(cursorHooksDir, 'save-file-edit.sh');
|
||||
const result = execSync(`bash "${scriptPath}"`, {
|
||||
input: JSON.stringify(input),
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Should exit cleanly
|
||||
expect(result.trim()).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('script error handling', () => {
|
||||
it('session-init.sh never outputs error to stdout', () => {
|
||||
// Even with completely broken input, should still output valid JSON
|
||||
const scriptPath = join(cursorHooksDir, 'session-init.sh');
|
||||
|
||||
// Pass invalid input that might cause jq errors
|
||||
const result = execSync(`echo '{}' | bash "${scriptPath}"`, {
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Output should still be valid JSON with continue: true
|
||||
const parsed = JSON.parse(result.trim());
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('context-inject.sh never outputs error to stdout', () => {
|
||||
const scriptPath = join(cursorHooksDir, 'context-inject.sh');
|
||||
|
||||
const result = execSync(`echo '{}' | bash "${scriptPath}"`, {
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
const parsed = JSON.parse(result.trim());
|
||||
expect(parsed.continue).toBe(true);
|
||||
});
|
||||
|
||||
it('session-summary.sh never outputs error to stdout', () => {
|
||||
const scriptPath = join(cursorHooksDir, 'session-summary.sh');
|
||||
|
||||
const result = execSync(`echo '{}' | bash "${scriptPath}"`, {
|
||||
cwd: tempDir,
|
||||
encoding: 'utf-8',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Should be valid JSON
|
||||
expect(() => JSON.parse(result.trim())).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -81,23 +81,19 @@ describe('Version Consistency', () => {
|
||||
expect(matches!.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should have version injected into built mcp-server.cjs', () => {
|
||||
it('should have built mcp-server.cjs', () => {
|
||||
const mcpServerPath = path.join(projectRoot, 'plugin/scripts/mcp-server.cjs');
|
||||
|
||||
|
||||
// Skip if file doesn't exist (e.g., before first build)
|
||||
if (!existsSync(mcpServerPath)) {
|
||||
console.log('⚠️ mcp-server.cjs not found - run npm run build first');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// mcp-server.cjs doesn't use __DEFAULT_PACKAGE_VERSION__ - it's a search server
|
||||
// that doesn't need to expose version info. Just verify it exists and is built.
|
||||
const mcpServerContent = readFileSync(mcpServerPath, 'utf-8');
|
||||
|
||||
// Check for the version string in the minified code
|
||||
const versionPattern = new RegExp(`"${rootVersion.replace(/\./g, '\\.')}"`, 'g');
|
||||
const matches = mcpServerContent.match(versionPattern);
|
||||
|
||||
expect(matches).toBeTruthy();
|
||||
expect(matches!.length).toBeGreaterThan(0);
|
||||
expect(mcpServerContent.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should validate version format is semver compliant', () => {
|
||||
|
||||
+1
-100
@@ -5,106 +5,7 @@
|
||||
|
||||
### Dec 5, 2025
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #20670 | 8:48 PM | 🔵 | Full Lifecycle Integration Test Analysis | ~428 |
|
||||
| #20664 | 8:46 PM | 🔵 | Test Suite Verification Complete | ~238 |
|
||||
| #20651 | 8:43 PM | 🟣 | Comprehensive Test Suite Merged | ~312 |
|
||||
| #20447 | 7:39 PM | 🟣 | Full Lifecycle Integration Test Suite Created | ~665 |
|
||||
|
||||
### Dec 7, 2025
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #21829 | 11:05 PM | 🔄 | Massive refactor adds 8,671 lines and removes 5,585 lines across 60 files | ~619 |
|
||||
|
||||
### Dec 8, 2025
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #22081 | 6:28 PM | ✅ | Clean Test Suite Execution Without Integration Tests | ~399 |
|
||||
| #22080 | 6:27 PM | ✅ | Full Test Suite Execution Results | ~456 |
|
||||
| #22039 | 6:01 PM | 🔵 | Discovered comprehensive TypeScript test suite with 11 test files | ~355 |
|
||||
|
||||
### Dec 9, 2025
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #22606 | 11:33 AM | 🔵 | Hardcoded port 37777 found across multiple codebase locations | ~371 |
|
||||
|
||||
### Dec 11, 2025
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24076 | 3:16 PM | 🔵 | 45 files modified with nearly equal additions and deletions during Bun migration | ~443 |
|
||||
| #23951 | 1:45 PM | 🔄 | Integration Test Updated to Use Dynamic Port Configuration | ~272 |
|
||||
| #23933 | 1:36 PM | 🔵 | Comprehensive Port 37777 References Across Documentation and Code | ~427 |
|
||||
|
||||
### Dec 12, 2025
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24318 | 5:48 PM | 🟣 | Phase 6 Complete: Comprehensive Bun Worker Testing Passed | ~486 |
|
||||
| #24317 | 5:47 PM | 🔵 | Test Suite Passes with 42 Tests Across 7 Files | ~326 |
|
||||
| #24126 | 12:27 AM | 🟣 | Comprehensive Bun Runtime Migration Statistics | ~287 |
|
||||
|
||||
### Dec 13, 2025
|
||||
|
||||
**hook-execution-environments.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25551 | 11:32 PM | 🟣 | Enhanced error handling system merged into main branch | ~471 |
|
||||
| #25521 | 11:05 PM | 🟣 | Hook Execution Environment Tests Created | ~529 |
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25518 | 10:37 PM | 🔵 | Integration Test Coverage Analyzed | ~502 |
|
||||
| #25499 | 10:30 PM | 🔵 | Full Test Suite Passes with 52 Tests | ~350 |
|
||||
|
||||
### Dec 14, 2025
|
||||
|
||||
**context-inject-early.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25595 | 2:33 PM | ✅ | PR #310 merged into main branch | ~292 |
|
||||
|
||||
### Dec 18, 2025
|
||||
|
||||
**hook-execution-environments.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #29603 | 5:37 PM | 🔵 | Full Test Suite Results - 120/121 Tests Passing | ~424 |
|
||||
|
||||
### Dec 20, 2025
|
||||
|
||||
**hook-execution-environments.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #30494 | 4:43 PM | 🔵 | Test Suite Status with Bun Path Resolution Failures | ~330 |
|
||||
|
||||
### Dec 21, 2025
|
||||
|
||||
**hook-execution-environments.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31371 | 6:08 PM | ✅ | Removed Five Incomplete Test Files | ~180 |
|
||||
|
||||
**full-lifecycle.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31370 | 6:07 PM | ✅ | Removed 9 Mock-Based Test Files | ~286 |
|
||||
|
||||
### Dec 22, 2025
|
||||
|
||||
**context-inject-early.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31855 | 6:53 PM | ✅ | テストスイートの大規模削除とテスト分析レポートの追加 | ~197 |
|
||||
| #20721 | 9:02 PM | 🔵 | Full Lifecycle Integration Test Suite | ~563 |
|
||||
</claude-mem-context>
|
||||
@@ -35,6 +35,8 @@ const EXCLUDED_PATTERNS = [
|
||||
/integrations\/.*Installer\.ts$/, // CLI installer commands (console.log for interactive installation output)
|
||||
/SettingsDefaultsManager\.ts$/, // Must use console.log to avoid circular dependency with logger
|
||||
/user-message-hook\.ts$/, // Deprecated - kept for reference only, not registered in hooks.json
|
||||
/cli\/hook-command\.ts$/, // CLI hook command uses console.log/error for hook protocol output
|
||||
/cli\/handlers\/user-message\.ts$/, // User message handler uses console.error for user-visible context
|
||||
];
|
||||
|
||||
// Files that should always use logger (core business logic)
|
||||
|
||||
+1
-38
@@ -3,42 +3,5 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Jan 3, 2026
|
||||
|
||||
**server.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36583 | 9:57 PM | 🟣 | Server Test Suite Created | ~485 |
|
||||
|
||||
**error-handler.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36581 | 9:57 PM | 🟣 | ErrorHandler Test Suite Created for Phase 6 | ~444 |
|
||||
|
||||
### Jan 4, 2026
|
||||
|
||||
**error-handler.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36841 | 1:43 AM | 🔵 | Error Handler Testing with Custom Error Classes | ~445 |
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38078 | 9:54 PM | ✅ | CLAUDE.md Documentation Cleanup - 1,233 Lines Removed Across 18 Files | ~590 |
|
||||
|
||||
**server.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38018 | 9:14 PM | 🟣 | Added comprehensive test coverage for worktree detection and projectRoot path resolution | ~450 |
|
||||
| #37758 | 6:25 PM | ⚖️ | Integration Test Design for Four Critical Testing Gaps | ~729 |
|
||||
| #37710 | 6:11 PM | 🔵 | Test Audit: server.test.ts Integration Tests with Minimal Mocking for HTTP Server | ~582 |
|
||||
|
||||
**error-handler.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37629 | 5:36 PM | 🔵 | Comprehensive Testing Patterns Documentation Generated | ~629 |
|
||||
| #37625 | 5:35 PM | 🔵 | Bun Test Pattern for Error Classes and Mock Restoration | ~573 |
|
||||
*No recent activity*
|
||||
</claude-mem-context>
|
||||
Reference in New Issue
Block a user