Compare commits
415 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 23f30d35b9 | |||
| c6f932988a | |||
| d9a30cc7d4 | |||
| 50eeed97e7 | |||
| 5f28550551 | |||
| a6a843f871 | |||
| 2db9d0e383 | |||
| 0a26bb18bf | |||
| bd11ccf12e | |||
| c2c3e3069c | |||
| 7966c6cba9 | |||
| e4e735d3ff | |||
| 780cc3894e | |||
| 8d46c00dd8 | |||
| 4ab601fc9f | |||
| 097035de6c | |||
| e788fd3676 | |||
| 44cdbec173 | |||
| 91b48a6481 | |||
| 40daf8f3fa | |||
| 7e57b6e02d | |||
| ea683a4e6c | |||
| 5d79bb7a7a | |||
| 2180d31ee6 | |||
| 75dd8e3174 | |||
| 149f548667 | |||
| b88251bc8b | |||
| b2e3a7e668 | |||
| b1cfc85333 | |||
| ca8421611c | |||
| eea4f599c0 | |||
| b446f2630e | |||
| 224567f980 | |||
| 2b31792f06 | |||
| 613f0e9795 | |||
| f1162ed4a4 | |||
| 8039ada222 | |||
| df36ce68df | |||
| f24251118e | |||
| d2e926fbf7 | |||
| 854bf922a4 | |||
| e975555896 | |||
| 8d6581ea13 | |||
| 59169a221d | |||
| b1498c321b | |||
| 62b1618fbd | |||
| ab2dbb7dc7 | |||
| be474ea595 | |||
| cd31eaf572 | |||
| 51719d23a4 | |||
| 81013e1310 | |||
| 6d1f17adee | |||
| ddc25372c1 | |||
| 28f35f3ec7 | |||
| 0a40c4c596 | |||
| cef15011c2 | |||
| 7bf792b467 | |||
| 55e0e323b9 | |||
| 02f7c3c9d0 | |||
| 209db9f11a | |||
| be6437c46f | |||
| a94ddc504f | |||
| 12a3330b78 | |||
| dbad24b81b | |||
| a2046f018e | |||
| 454e9c5870 | |||
| 2f337dab13 | |||
| 42adfe29c8 | |||
| 8287ad960a | |||
| aa6090c04b | |||
| 327dd44992 | |||
| 0e11d4812a | |||
| 676a3d175e | |||
| 34358ab33d | |||
| 5ccaf40ad0 | |||
| 51abe5d1ff | |||
| 2dea824cc0 | |||
| 055888e181 | |||
| 67ba17cc8a | |||
| e1ef14dbcc | |||
| 685d54f2cb | |||
| 490f36099f | |||
| f9ff2b22f2 | |||
| 0ac4c7b8a9 | |||
| 47f6f0f239 | |||
| c27314f896 | |||
| 1b68c55763 | |||
| ed313db742 | |||
| f435ae32ce | |||
| 548d3677f0 | |||
| b0e0bd23c9 | |||
| 2bd5e981bc | |||
| 5de728612e | |||
| 64019ee28d | |||
| 6cad77328b | |||
| 26ac35ad40 | |||
| 31514d1943 | |||
| 52ea452010 | |||
| c469e0acc3 | |||
| f05f9ca735 | |||
| 1d76f93304 | |||
| 05e904e613 | |||
| 095f6fde47 | |||
| 1130bbc090 | |||
| 76f984ce7c | |||
| 6535ad597f | |||
| 40f81b4d2b | |||
| 54ca601e8f | |||
| de549cac05 | |||
| 83d474b13d | |||
| 9480ef06ab | |||
| c099e8eb27 | |||
| 1325f05432 | |||
| cfd19ae232 | |||
| cb6ff8738b | |||
| 81ebb8b6c0 | |||
| 9bdd00ea5a | |||
| 6f35e543ca | |||
| ee61270e1b | |||
| e902b74267 | |||
| 3eb6d9ea8e | |||
| 98d87d7573 | |||
| f7fea1f779 | |||
| 1f834863a7 | |||
| e4846a2046 | |||
| 0dda593c45 | |||
| 1bfb473c19 | |||
| 3f01baebfe | |||
| 46b61857ab | |||
| 0b214a59a1 | |||
| 77579669f2 | |||
| 2c5c99c0c7 | |||
| a3f9e7f638 | |||
| 4e67393d27 | |||
| cb0933a908 | |||
| af95461a70 | |||
| 79b3a61ac8 | |||
| a9e3b659d3 | |||
| af9584a174 | |||
| 63827c9dcb | |||
| 809175612c | |||
| 06d9ef24f1 | |||
| f37a1fd6dc | |||
| badcd0e0be | |||
| 22683f6910 | |||
| 7ffa1b06ee | |||
| 418e38ee46 | |||
| 6ac5507e4e | |||
| 9bcef1774d | |||
| edecfdb5bc | |||
| 74670c00a6 | |||
| bd9b02f364 | |||
| 05b615c858 | |||
| e13562e4cb | |||
| c7f7f87321 | |||
| 11532a36fb | |||
| 121f673328 | |||
| f5b69df11a | |||
| 7cc27d45a4 | |||
| 9c20f4142c | |||
| 7b7a92e35a | |||
| 33ab7ba747 | |||
| 1b9f601c41 | |||
| b2ddf59db4 | |||
| a0d737ba51 | |||
| db207807cb | |||
| 1d090b33f5 | |||
| 700aae8a31 | |||
| fbdff0b178 | |||
| 018549c3c7 | |||
| 63e8755be5 | |||
| c8aaa79ab6 | |||
| 194e44f52a | |||
| efd47a9586 | |||
| f1ecf5bc68 | |||
| 719079581a | |||
| f8d8de53e8 | |||
| baa37eba07 | |||
| 8933343433 | |||
| e4e1d3fb92 | |||
| dac989c697 | |||
| 5969d670d0 | |||
| 39990f2818 | |||
| 8dfcb5e612 | |||
| 4d91053f8c | |||
| ff503d08a7 | |||
| 0ee8c00c5f | |||
| d4e122a1f8 | |||
| 5508194189 | |||
| ded11645e3 | |||
| 7afbba4c3f | |||
| bf439043cf | |||
| 24ce746b91 | |||
| 98920bd860 | |||
| fbcbdfca62 | |||
| 6ae8890092 | |||
| c113e23001 | |||
| b58a61c0b3 | |||
| 936080d710 | |||
| 10675f7125 | |||
| 39e4aa1976 | |||
| 5dffb1ebb0 | |||
| 56df2c45e5 | |||
| 4c719d776a | |||
| da1d2cd36a | |||
| 7ed1e576b2 | |||
| 8030c44af4 | |||
| 2f935a56b9 | |||
| 830d7a2b23 | |||
| 5cbe0a38ca | |||
| c477ded1b5 | |||
| 3040ea8a97 | |||
| 9ad640a5c4 | |||
| 109fb1b506 | |||
| 55e13047e4 | |||
| 75a0f2e981 | |||
| d935229711 | |||
| 91e1d5baad | |||
| 8de8afbab8 | |||
| 75df2e52c1 | |||
| 40e699209f | |||
| 256ebcead0 | |||
| 44bfb74932 | |||
| 97c84a3963 | |||
| b493c2d6b0 | |||
| 4ea03b0597 | |||
| 7b08c94bdb | |||
| 92f7c7dfd9 | |||
| 358215a92f | |||
| 867513dc79 | |||
| 583a76b150 | |||
| 2a62a94b09 | |||
| 05d65ed797 | |||
| 1e04f82fe2 | |||
| 596f0ad16c | |||
| 296bf195ce | |||
| ba0793127c | |||
| 06711cfb20 | |||
| 8628e4024d | |||
| 1b912020ea | |||
| 3093f80196 | |||
| 6b67b3df63 | |||
| e9fee163a9 | |||
| e24ad77ab5 | |||
| c56e0ae7f8 | |||
| ed9ffe76a7 | |||
| 0622ebf534 | |||
| 63b0105d05 | |||
| 3ad53733e8 | |||
| 403913a0fc | |||
| 9f2a237aaf | |||
| b967772897 | |||
| e19617a065 | |||
| 9bd56c993c | |||
| f62b5d248c | |||
| 711f5455df | |||
| e36efff00d | |||
| 486bae633b | |||
| 228a006953 | |||
| 2d40afe7ef | |||
| ff55b6e4e0 | |||
| e2de295c41 | |||
| ea38601564 | |||
| 9fd32ad44b | |||
| dd753184db | |||
| e8097caed7 | |||
| eb7e37dcf1 | |||
| f24bba21e9 | |||
| 1a1297c12a | |||
| af308ea5c8 | |||
| 6382d6f9c7 | |||
| 1ae6c5708c | |||
| 93bad99d79 | |||
| 9c68a3ba3d | |||
| 117710d449 | |||
| b07130acc6 | |||
| bb96092d74 | |||
| 9907df1db8 | |||
| ab3d4ca865 | |||
| e424d85a93 | |||
| e5a133b3da | |||
| 15e9473533 | |||
| 20333e6214 | |||
| 5d1ee20076 | |||
| 576d407c00 | |||
| 3eb0154d58 | |||
| 80663fff97 | |||
| 27aa98c269 | |||
| 9789a1969c | |||
| d333c7dc08 | |||
| edfc1a403f | |||
| ad37629f0a | |||
| 7be19b20cd | |||
| 5b2eb9f599 | |||
| ede75b1c5b | |||
| cdb0e823aa | |||
| a35190b7bf | |||
| 4b180d8d66 | |||
| 61615ddc0f | |||
| 0ecb387f58 | |||
| 3840a1734d | |||
| ca990e8d53 | |||
| c9010c5c58 | |||
| 2ea716a017 | |||
| 4e4ad32f97 | |||
| faa1360f33 | |||
| 64dc50f3fb | |||
| 1ac35b5d56 | |||
| 1dd456a6ca | |||
| be01694383 | |||
| b8b88d998c | |||
| bf4d9421e0 | |||
| 67f9d631bd | |||
| 311d62cc02 | |||
| 46a75c4d98 | |||
| fececc4e51 | |||
| d0b4c7ee59 | |||
| e6af8d207a | |||
| 75b9930ee4 | |||
| 86b1d7fad9 | |||
| 2aab998b62 | |||
| 6b22017721 | |||
| 34aef1aa18 | |||
| d00762d1f7 | |||
| 400f08c20d | |||
| 18c7f1cd76 | |||
| 74506dd4e6 | |||
| 0f72356cb1 | |||
| 121fb24705 | |||
| 867c658f4f | |||
| 0704355a7f | |||
| 6930a38997 | |||
| e218dc5947 | |||
| 7e1c13c6c2 | |||
| e87701228d | |||
| d6751e0f07 | |||
| b04a041c2d | |||
| 8218fcb17b | |||
| 86bdb036bd | |||
| eefc2eaf0f | |||
| ebed56674e | |||
| ce4cab0a23 | |||
| 9913820366 | |||
| 640053d727 | |||
| aaf00829d3 | |||
| 094f5ab1b4 | |||
| a0380fe1f7 | |||
| 9864410eb8 | |||
| 450b2135b6 | |||
| a58a22cc6a | |||
| 0c9b8826c9 | |||
| 74f6b75db2 | |||
| b8821f5ea3 | |||
| 8f1a260d96 | |||
| a69613b4e0 | |||
| e7cae825bd | |||
| 486570d2b8 | |||
| ce576db0dc | |||
| 53f6f57420 | |||
| 814d2f6c03 | |||
| 006ff40175 | |||
| aedee33ca9 | |||
| 6ee6e21eb5 | |||
| add5d62cec | |||
| fa604849fe | |||
| 34004904e7 | |||
| 4df9f61347 | |||
| 14ca7cf7d6 | |||
| 57a60c1309 | |||
| bef825c0d8 | |||
| 93354e7a3e | |||
| f173a32fa3 | |||
| 7566b8c650 | |||
| 2eaef1f586 | |||
| 1341e93fca | |||
| 06864b0199 | |||
| a16b25275e | |||
| abffce6424 | |||
| c948a7778b | |||
| bd1fe5995f | |||
| 6791069bca | |||
| 3e6add90de | |||
| 8dd4d15b1f | |||
| 2a83e530e9 | |||
| e5d763860c | |||
| 9e4b401f9b | |||
| 2c304eafad | |||
| 70d6ac9daf | |||
| 5b3804ac08 | |||
| d3331d1e22 | |||
| bd619229b2 | |||
| 182097ef1c | |||
| 0b7ecedcd7 | |||
| da01e4bba0 | |||
| 7c3bfadd5e | |||
| a8bb625513 | |||
| bab8f554bd | |||
| c1b5b2a783 | |||
| 67651669a1 | |||
| ae454cfc01 | |||
| fa218b0d71 | |||
| c29d91a9c4 | |||
| e6ae017609 | |||
| 901cff909e | |||
| 5c8e2dcfcc | |||
| 47dec9cf4d | |||
| 3d40b45fd1 | |||
| 05323c9db5 | |||
| c314946204 | |||
| 7eb9f4051c | |||
| 550183bab2 | |||
| 92c4d245c4 | |||
| a2ab45a461 | |||
| 1d68e299dc | |||
| b987789754 |
@@ -1,8 +1,6 @@
|
||||
<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 |
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "9.0.3",
|
||||
"version": "10.4.0",
|
||||
"source": "./plugin",
|
||||
"description": "Persistent memory system for Claude Code - context compression across sessions"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "10.2.5",
|
||||
"description": "Persistent memory system for Claude Code - seamlessly preserve context across sessions",
|
||||
"author": {
|
||||
"name": "Alex Newman"
|
||||
},
|
||||
"repository": "https://github.com/thedotmack/claude-mem",
|
||||
"license": "AGPL-3.0",
|
||||
"keywords": [
|
||||
"memory",
|
||||
"context",
|
||||
"persistence",
|
||||
"hooks",
|
||||
"mcp"
|
||||
]
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 21, 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 |
|
||||
</claude-mem-context>
|
||||
@@ -1,34 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Oct 25, 2025
|
||||
|
||||
**changelog.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #2491 | 10:59 PM | 🟣 | Added changelog viewer slash command | ~290 |
|
||||
|
||||
**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 |
|
||||
</claude-mem-context>
|
||||
@@ -1,299 +0,0 @@
|
||||
# Plan: Fix 81 Test Failures from Incomplete Logger Mocks
|
||||
|
||||
## Problem Summary
|
||||
|
||||
**Root Cause**: NOT circular dependency (which is handled gracefully), but **incomplete logger mocks** that pollute across test files when Bun runs tests in alphabetical order.
|
||||
|
||||
When `tests/context/` runs before `tests/utils/`, the incomplete mocks replace the real logger module globally, causing subsequent tests to fail with `TypeError: logger.formatTool is not a function`.
|
||||
|
||||
## Phase 0: Documentation Discovery (COMPLETED)
|
||||
|
||||
### Sources Consulted
|
||||
- `src/utils/logger.ts` - Full logger interface (lines 136, 289-373)
|
||||
- `tests/context/context-builder.test.ts` - Mock pattern (lines 22-29)
|
||||
- `tests/context/observation-compiler.test.ts` - Mock pattern (lines 4-10)
|
||||
- `tests/server/server.test.ts` - Mock pattern (lines 4-11)
|
||||
- `tests/server/error-handler.test.ts` - Mock pattern (lines 5-12)
|
||||
- `tests/worker/agents/response-processor.test.ts` - Mock pattern (lines 32-39)
|
||||
|
||||
### Logger Methods (Complete List)
|
||||
All 11 methods that must be in any logger mock:
|
||||
1. `formatTool(toolName: string, toolInput?: any): string` (line 136)
|
||||
2. `debug(component, message, context?, data?): void` (line 289)
|
||||
3. `info(component, message, context?, data?): void` (line 293)
|
||||
4. `warn(component, message, context?, data?): void` (line 297)
|
||||
5. `error(component, message, context?, data?): void` (line 301)
|
||||
6. `dataIn(component, message, context?, data?): void` (line 308)
|
||||
7. `dataOut(component, message, context?, data?): void` (line 315)
|
||||
8. `success(component, message, context?, data?): void` (line 322)
|
||||
9. `failure(component, message, context?, data?): void` (line 329)
|
||||
10. `timing(component, message, durationMs, context?): void` (line 336)
|
||||
11. `happyPathError<T>(message, context?): T` (line 362)
|
||||
|
||||
### Files Requiring Updates
|
||||
1. `tests/context/observation-compiler.test.ts` (lines 4-10)
|
||||
2. `tests/context/context-builder.test.ts` (lines 22-29)
|
||||
3. `tests/server/server.test.ts` (lines 4-11)
|
||||
4. `tests/server/error-handler.test.ts` (lines 5-12)
|
||||
5. `tests/worker/agents/response-processor.test.ts` (lines 32-39)
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Create Shared Logger Mock Utility
|
||||
|
||||
### Objective
|
||||
Create a reusable complete logger mock to avoid duplication and ensure consistency.
|
||||
|
||||
### Implementation
|
||||
|
||||
**Create new file**: `tests/test-utils/mock-logger.ts`
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Complete logger mock for tests.
|
||||
* Includes ALL logger methods to prevent mock pollution across test files.
|
||||
*/
|
||||
import { mock } from 'bun:test';
|
||||
|
||||
export function createMockLogger() {
|
||||
return {
|
||||
logger: {
|
||||
// Core logging methods
|
||||
debug: mock(() => {}),
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
|
||||
// Data flow logging
|
||||
dataIn: mock(() => {}),
|
||||
dataOut: mock(() => {}),
|
||||
|
||||
// Status logging
|
||||
success: mock(() => {}),
|
||||
failure: mock(() => {}),
|
||||
|
||||
// Performance logging
|
||||
timing: mock(() => {}),
|
||||
|
||||
// Tool formatting - returns string
|
||||
formatTool: mock((toolName: string, _toolInput?: any) => toolName),
|
||||
|
||||
// Error helper - returns the message
|
||||
happyPathError: mock((message: string, _context?: any) => message),
|
||||
},
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] File created at `tests/test-utils/mock-logger.ts`
|
||||
- [ ] All 11 logger methods included
|
||||
- [ ] `formatTool` returns string (not void)
|
||||
- [ ] `happyPathError` returns the message (not void)
|
||||
- [ ] File compiles without errors: `bunx tsc --noEmit tests/test-utils/mock-logger.ts`
|
||||
|
||||
### Anti-Patterns to Avoid
|
||||
- ❌ Don't forget `formatTool` - it returns a string, not void
|
||||
- ❌ Don't forget `happyPathError` - it's generic and returns the message
|
||||
- ❌ Don't use `() => {}` for methods that return values
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Update Affected Test Files
|
||||
|
||||
### Objective
|
||||
Replace incomplete logger mocks with the complete shared mock.
|
||||
|
||||
### Files to Update (5 total)
|
||||
|
||||
#### 2.1 `tests/context/observation-compiler.test.ts`
|
||||
|
||||
**Current (lines 4-10)**:
|
||||
```typescript
|
||||
mock.module('../../src/utils/logger.js', () => ({
|
||||
logger: {
|
||||
debug: mock(() => {}),
|
||||
failure: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
**Replace with**:
|
||||
```typescript
|
||||
import { createMockLogger } from '../test-utils/mock-logger.js';
|
||||
|
||||
mock.module('../../src/utils/logger.js', () => createMockLogger());
|
||||
```
|
||||
|
||||
#### 2.2 `tests/context/context-builder.test.ts`
|
||||
|
||||
**Current (lines 22-29)**:
|
||||
```typescript
|
||||
mock.module('../../src/utils/logger.js', () => ({
|
||||
logger: {
|
||||
debug: mock(() => {}),
|
||||
failure: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
info: mock(() => {}),
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
**Replace with**:
|
||||
```typescript
|
||||
import { createMockLogger } from '../test-utils/mock-logger.js';
|
||||
|
||||
mock.module('../../src/utils/logger.js', () => createMockLogger());
|
||||
```
|
||||
|
||||
#### 2.3 `tests/server/server.test.ts`
|
||||
|
||||
**Current (lines 4-11)**:
|
||||
```typescript
|
||||
mock.module('../../src/utils/logger.js', () => ({
|
||||
logger: {
|
||||
info: () => {},
|
||||
debug: () => {},
|
||||
warn: () => {},
|
||||
error: () => {},
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
**Replace with**:
|
||||
```typescript
|
||||
import { createMockLogger } from '../test-utils/mock-logger.js';
|
||||
|
||||
mock.module('../../src/utils/logger.js', () => createMockLogger());
|
||||
```
|
||||
|
||||
#### 2.4 `tests/server/error-handler.test.ts`
|
||||
|
||||
**Current (lines 5-12)**:
|
||||
```typescript
|
||||
mock.module('../../src/utils/logger.js', () => ({
|
||||
logger: {
|
||||
info: () => {},
|
||||
debug: () => {},
|
||||
warn: () => {},
|
||||
error: () => {},
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
**Replace with**:
|
||||
```typescript
|
||||
import { createMockLogger } from '../test-utils/mock-logger.js';
|
||||
|
||||
mock.module('../../src/utils/logger.js', () => createMockLogger());
|
||||
```
|
||||
|
||||
#### 2.5 `tests/worker/agents/response-processor.test.ts`
|
||||
|
||||
**Current (lines 32-39)**:
|
||||
```typescript
|
||||
mock.module('../../../src/utils/logger.js', () => ({
|
||||
logger: {
|
||||
info: () => {},
|
||||
debug: () => {},
|
||||
warn: () => {},
|
||||
error: () => {},
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
**Replace with**:
|
||||
```typescript
|
||||
import { createMockLogger } from '../../test-utils/mock-logger.js';
|
||||
|
||||
mock.module('../../../src/utils/logger.js', () => createMockLogger());
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] All 5 files updated with import statement
|
||||
- [ ] All 5 files use `createMockLogger()` instead of inline mock
|
||||
- [ ] Import paths are correct (relative to each file's location)
|
||||
- [ ] Each file still has `mock.module` BEFORE the module imports it mocks
|
||||
|
||||
### Anti-Patterns to Avoid
|
||||
- ❌ Don't place import AFTER the mock.module call
|
||||
- ❌ Don't use wrong relative path (../test-utils vs ../../test-utils)
|
||||
- ❌ Don't forget the .js extension in imports
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Verification
|
||||
|
||||
### Objective
|
||||
Confirm all 81 failures are fixed.
|
||||
|
||||
### Test Commands
|
||||
|
||||
```bash
|
||||
# 1. Run individual test groups first
|
||||
bun test tests/context/
|
||||
bun test tests/server/
|
||||
bun test tests/utils/
|
||||
bun test tests/shared/
|
||||
bun test tests/worker/
|
||||
|
||||
# 2. Run full suite
|
||||
bun test
|
||||
|
||||
# 3. Verify specific test counts
|
||||
# Expected: 733+ tests pass (was 652 before)
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] `bun test tests/context/` - all pass
|
||||
- [ ] `bun test tests/server/` - all pass
|
||||
- [ ] `bun test tests/utils/` - all pass (including 56 formatTool tests)
|
||||
- [ ] `bun test tests/shared/` - all pass (including 27 settings tests)
|
||||
- [ ] `bun test` - 730+ tests pass, 0 failures
|
||||
- [ ] No `TypeError: logger.formatTool is not a function` errors
|
||||
|
||||
### Anti-Pattern Grep Checks
|
||||
|
||||
```bash
|
||||
# Check no incomplete logger mocks remain
|
||||
grep -r "logger: {" tests/ --include="*.ts" | grep -v mock-logger
|
||||
|
||||
# Verify all test files use createMockLogger
|
||||
grep -r "createMockLogger" tests/ --include="*.ts"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Commit
|
||||
|
||||
### Commit Message
|
||||
|
||||
```
|
||||
fix(tests): complete logger mocks to prevent cross-test pollution
|
||||
|
||||
The 81 test failures were caused by incomplete logger mocks that
|
||||
polluted the module cache when tests ran in alphabetical order.
|
||||
|
||||
Changes:
|
||||
- Create shared mock-logger.ts with all 11 logger methods
|
||||
- Update 5 test files to use complete mock
|
||||
- Fix TypeError: logger.formatTool is not a function
|
||||
|
||||
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
||||
|
||||
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Files Changed | Purpose |
|
||||
|-------|--------------|---------|
|
||||
| 1 | 1 new file | Create shared mock utility |
|
||||
| 2 | 5 files | Update to use shared mock |
|
||||
| 3 | 0 files | Verification only |
|
||||
| 4 | 0 files | Commit |
|
||||
|
||||
**Total**: 6 files changed, fixing all 81 test failures.
|
||||
@@ -1,7 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
*No recent activity*
|
||||
</claude-mem-context>
|
||||
@@ -0,0 +1,371 @@
|
||||
# Comprehensive Claude-Mem Installer with @clack/prompts
|
||||
|
||||
## Overview
|
||||
|
||||
Build a beautiful, animated CLI installer for claude-mem using `@clack/prompts` (v1.0.1). Distributable via `npx claude-mem-installer` and `curl -fsSL https://install.cmem.ai | bash`. Replaces the need for users to manually clone, build, configure settings, and start the worker.
|
||||
|
||||
**Worktree**: `feat/animated-installer` at `.claude/worktrees/animated-installer`
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation & API Reference
|
||||
|
||||
### Allowed APIs (@clack/prompts v1.0.1, ESM-only)
|
||||
|
||||
| API | Signature | Use Case |
|
||||
|-----|-----------|----------|
|
||||
| `intro(title?)` | `void` | Opening banner |
|
||||
| `outro(message?)` | `void` | Completion message |
|
||||
| `cancel(message?)` | `void` | User cancelled |
|
||||
| `isCancel(value)` | `boolean` | Check if user pressed Ctrl+C |
|
||||
| `text(opts)` | `Promise<string \| symbol>` | API key input, port, data dir |
|
||||
| `password(opts)` | `Promise<string \| symbol>` | API key input (masked) |
|
||||
| `select(opts)` | `Promise<Value \| symbol>` | Provider, model, auth method |
|
||||
| `multiselect(opts)` | `Promise<Value[] \| symbol>` | IDE selection, observation types |
|
||||
| `confirm(opts)` | `Promise<boolean \| symbol>` | Enable Chroma, start worker |
|
||||
| `spinner()` | `SpinnerResult` | Installing deps, building, starting worker |
|
||||
| `progress(opts)` | `ProgressResult` | Multi-step installation progress |
|
||||
| `tasks(tasks[])` | `Promise<void>` | Sequential install steps |
|
||||
| `group(prompts, opts)` | `Promise<Results>` | Chain prompts with shared results |
|
||||
| `note(message, title)` | `void` | Display settings summary, next steps |
|
||||
| `log.info/success/warn/error(msg)` | `void` | Status messages |
|
||||
| `box(message, title, opts)` | `void` | Welcome box, completion summary |
|
||||
|
||||
### Anti-Patterns
|
||||
- Do NOT use `require()` — package is ESM-only
|
||||
- Do NOT call prompts without TTY check first — hangs indefinitely in non-TTY
|
||||
- Do NOT forget `isCancel()` check after every prompt (or use `group()` with `onCancel`)
|
||||
- Do NOT use `chalk` — use `picocolors` (clack's dep) for consistency
|
||||
- `text()` has no numeric mode — validate manually for port numbers
|
||||
- `spinner.stop()` does not accept status codes — use `spinner.error()` for failures
|
||||
|
||||
### Distribution Patterns
|
||||
- **npx**: `package.json` `bin` field → `"./dist/index.js"`, file needs `#!/usr/bin/env node`
|
||||
- **curl|bash**: Shell bootstrap downloads JS, runs `node script.js` directly (preserves TTY)
|
||||
- **esbuild**: Bundle to single ESM file, `platform: 'node'`, `banner` for shebang
|
||||
|
||||
### Key Source Files to Reference
|
||||
- Settings defaults: `src/shared/SettingsDefaultsManager.ts` (lines 73-125)
|
||||
- Settings validation: `src/services/server/SettingsRoutes.ts`
|
||||
- Worker startup: `src/services/worker-service.ts` (lines 337-359)
|
||||
- Health check: `src/services/infrastructure/HealthMonitor.ts`
|
||||
- Plugin registration: `plugin/.claude-plugin/plugin.json`, `.claude-plugin/marketplace.json`
|
||||
- Marketplace sync: `scripts/sync-marketplace.cjs`
|
||||
- Cursor integration: `src/services/integrations/CursorHooksInstaller.ts`
|
||||
- Existing OpenClaw installer: `install/public/openclaw.sh` (reference for logic, not code to copy)
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Project Scaffolding
|
||||
|
||||
**Goal**: Set up the installer package structure with build tooling.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **Create directory structure** in the worktree:
|
||||
```
|
||||
installer/
|
||||
├── src/
|
||||
│ ├── index.ts # Entry point with TTY guard
|
||||
│ ├── steps/
|
||||
│ │ ├── welcome.ts # intro + version check
|
||||
│ │ ├── dependencies.ts # bun, uv, git checks
|
||||
│ │ ├── ide-selection.ts # IDE picker + registration
|
||||
│ │ ├── provider.ts # AI provider + API key
|
||||
│ │ ├── settings.ts # Additional settings config
|
||||
│ │ ├── install.ts # Clone, build, register plugin
|
||||
│ │ ├── worker.ts # Start worker + health check
|
||||
│ │ └── complete.ts # Summary + next steps
|
||||
│ └── utils/
|
||||
│ ├── system.ts # OS detection, command runner
|
||||
│ ├── dependencies.ts # bun/uv/git install helpers
|
||||
│ └── settings-writer.ts # Write ~/.claude-mem/settings.json
|
||||
├── build.mjs # esbuild config
|
||||
├── package.json # bin, type: module, deps
|
||||
└── tsconfig.json
|
||||
```
|
||||
|
||||
2. **Create `package.json`**:
|
||||
```json
|
||||
{
|
||||
"name": "claude-mem-installer",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"bin": { "claude-mem-installer": "./dist/index.js" },
|
||||
"files": ["dist"],
|
||||
"scripts": {
|
||||
"build": "node build.mjs",
|
||||
"dev": "node build.mjs && node dist/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.1",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.24.0",
|
||||
"typescript": "^5.7.0",
|
||||
"@types/node": "^22.0.0"
|
||||
},
|
||||
"engines": { "node": ">=18.0.0" }
|
||||
}
|
||||
```
|
||||
|
||||
3. **Create `build.mjs`**:
|
||||
- esbuild bundle: `entryPoints: ['src/index.ts']`, `format: 'esm'`, `platform: 'node'`, `target: 'node18'`
|
||||
- Banner: `#!/usr/bin/env node`
|
||||
- Output: `dist/index.js`
|
||||
|
||||
4. **Create `tsconfig.json`**:
|
||||
- `module: "ESNext"`, `target: "ES2022"`, `moduleResolution: "bundler"`
|
||||
|
||||
5. **Run `npm install`** in installer/ directory
|
||||
|
||||
### Verification
|
||||
- [ ] `node build.mjs` succeeds
|
||||
- [ ] `dist/index.js` exists with shebang
|
||||
- [ ] `node dist/index.js` runs (even if empty installer)
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Entry Point + Welcome Screen
|
||||
|
||||
**Goal**: Create the main entry point with TTY detection and a beautiful welcome screen.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`src/index.ts`** — Entry point:
|
||||
- TTY guard: if `!process.stdin.isTTY`, print error directing user to `npx claude-mem-installer`, exit 1
|
||||
- Import and call `runInstaller()` from steps
|
||||
- Top-level catch → `p.cancel()` + exit 1
|
||||
|
||||
2. **`src/steps/welcome.ts`** — Welcome step:
|
||||
- `p.intro()` with styled title using picocolors: `" claude-mem installer "`
|
||||
- Display version info via `p.log.info()`
|
||||
- Check if already installed (detect `~/.claude-mem/settings.json` and `~/.claude/plugins/marketplaces/thedotmack/`)
|
||||
- If upgrade detected, `p.confirm()`: "claude-mem is already installed. Upgrade?"
|
||||
- `p.select()` for install mode: Fresh Install vs Upgrade vs Configure Only
|
||||
|
||||
3. **`src/utils/system.ts`** — System utilities:
|
||||
- `detectOS()`: returns 'macos' | 'linux' | 'windows'
|
||||
- `commandExists(cmd)`: checks if command is in PATH
|
||||
- `runCommand(cmd, args)`: executes shell command, returns { stdout, stderr, exitCode }
|
||||
- `expandHome(path)`: resolves `~` to home directory
|
||||
|
||||
### Verification
|
||||
- [ ] Running `node dist/index.js` shows intro banner
|
||||
- [ ] Ctrl+C triggers cancel message
|
||||
- [ ] Non-TTY (piped) shows error and exits
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Dependency Checks
|
||||
|
||||
**Goal**: Check and install required dependencies (Bun, uv, git, Node.js version).
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`src/steps/dependencies.ts`** — Dependency checker:
|
||||
- Use `p.tasks()` to check each dependency sequentially with animated spinners:
|
||||
- **Node.js**: Verify >= 18.0.0 via `process.version`
|
||||
- **git**: `commandExists('git')`, show install instructions per OS if missing
|
||||
- **Bun**: Check PATH + common locations (`~/.bun/bin/bun`, `/usr/local/bin/bun`, `/opt/homebrew/bin/bun`). Min version 1.1.14. Offer to auto-install from `https://bun.sh/install`
|
||||
- **uv**: Check PATH + common locations (`~/.local/bin/uv`, `~/.cargo/bin/uv`). Offer to auto-install from `https://astral.sh/uv/install.sh`
|
||||
- For missing deps: `p.confirm()` to auto-install, or show manual instructions
|
||||
- After install attempts, re-verify each dep
|
||||
|
||||
2. **`src/utils/dependencies.ts`** — Install helpers:
|
||||
- `installBun()`: downloads and runs bun install script
|
||||
- `installUv()`: downloads and runs uv install script
|
||||
- `findBinary(name, extraPaths[])`: searches PATH + known locations
|
||||
- `checkVersion(binary, minVersion)`: parses `--version` output
|
||||
|
||||
### Verification
|
||||
- [ ] Shows green checkmarks for found dependencies
|
||||
- [ ] Shows yellow warnings for missing deps with install option
|
||||
- [ ] Auto-install actually installs bun/uv when confirmed
|
||||
- [ ] Fails gracefully if git is missing (can't auto-install)
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: IDE Selection & Provider Configuration
|
||||
|
||||
**Goal**: Let user choose IDEs and configure AI provider with API keys.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`src/steps/ide-selection.ts`** — IDE picker:
|
||||
- `p.multiselect()` with options:
|
||||
- Claude Code (default selected, hint: "recommended")
|
||||
- Cursor
|
||||
- Windsurf (hint: "coming soon", disabled: true)
|
||||
- For Claude Code: explain plugin will be registered via marketplace
|
||||
- For Cursor: explain hooks will be installed via CursorHooksInstaller pattern
|
||||
- Store selections for later installation steps
|
||||
|
||||
2. **`src/steps/provider.ts`** — AI provider configuration:
|
||||
- `p.select()` for provider:
|
||||
- **Claude** (hint: "recommended — uses your Claude subscription")
|
||||
- **Gemini** (hint: "free tier available")
|
||||
- **OpenRouter** (hint: "free models available")
|
||||
- **If Claude selected**:
|
||||
- `p.select()` for auth method: "CLI (Max Plan subscription)" vs "API Key"
|
||||
- If API key: `p.password()` for key input
|
||||
- **If Gemini selected**:
|
||||
- `p.password()` for API key (required)
|
||||
- `p.select()` for model: gemini-2.5-flash-lite (default), gemini-2.5-flash, gemini-3-flash-preview
|
||||
- `p.confirm()` for rate limiting (default: true)
|
||||
- **If OpenRouter selected**:
|
||||
- `p.password()` for API key (required)
|
||||
- `p.text()` for model (default: `xiaomi/mimo-v2-flash:free`)
|
||||
- Validate API keys where possible (non-empty, format check)
|
||||
|
||||
### Verification
|
||||
- [ ] Multiselect allows picking multiple IDEs
|
||||
- [ ] Provider selection shows correct follow-up prompts
|
||||
- [ ] API keys are masked during input
|
||||
- [ ] Cancel at any step triggers graceful exit
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Settings Configuration
|
||||
|
||||
**Goal**: Configure additional settings with sensible defaults.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`src/steps/settings.ts`** — Settings wizard:
|
||||
- `p.confirm()`: "Use default settings?" (recommended) — if yes, skip detailed config
|
||||
- If customizing, use `p.group()` for:
|
||||
- **Worker port**: `p.text()` with default 37777, validate 1024-65535
|
||||
- **Data directory**: `p.text()` with default `~/.claude-mem`
|
||||
- **Context observations**: `p.text()` with default 50, validate 1-200
|
||||
- **Log level**: `p.select()` — DEBUG, INFO (default), WARN, ERROR
|
||||
- **Python version**: `p.text()` with default 3.13
|
||||
- **Chroma vector search**: `p.confirm()` (default: true)
|
||||
- If yes, `p.select()` mode: local (default) vs remote
|
||||
- If remote: `p.text()` for host, port, `p.confirm()` for SSL
|
||||
- Show settings summary via `p.note()` before proceeding
|
||||
|
||||
2. **`src/utils/settings-writer.ts`** — Write settings:
|
||||
- Build flat key-value settings object matching SettingsDefaultsManager schema
|
||||
- Merge with existing settings if upgrading (preserve user customizations)
|
||||
- Write to `~/.claude-mem/settings.json`
|
||||
- Create `~/.claude-mem/` directory if it doesn't exist
|
||||
|
||||
### Verification
|
||||
- [ ] Default settings mode skips all detailed prompts
|
||||
- [ ] Custom settings validates all inputs
|
||||
- [ ] Settings file written matches SettingsDefaultsManager schema exactly
|
||||
- [ ] Existing settings preserved on upgrade
|
||||
|
||||
---
|
||||
|
||||
## Phase 6: Installation Execution
|
||||
|
||||
**Goal**: Clone repo, build plugin, register with IDEs, start worker.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`src/steps/install.ts`** — Installation runner:
|
||||
- Use `p.tasks()` for visual progress:
|
||||
- **"Cloning claude-mem repository"**: `git clone --depth 1 https://github.com/thedotmack/claude-mem.git` to temp dir
|
||||
- **"Installing dependencies"**: `npm install` in cloned repo
|
||||
- **"Building plugin"**: `npm run build` in cloned repo
|
||||
- **"Registering plugin"**: Copy plugin files to `~/.claude/plugins/marketplaces/thedotmack/`
|
||||
- Create marketplace.json, plugin.json structure
|
||||
- Register in `~/.claude/plugins/known_marketplaces.json`
|
||||
- Add to `~/.claude/plugins/installed_plugins.json`
|
||||
- Enable in `~/.claude/settings.json` under `enabledPlugins`
|
||||
- **"Installing dependencies"** (in marketplace dir): `npm install`
|
||||
- For Cursor (if selected):
|
||||
- **"Configuring Cursor hooks"**: Run Cursor hooks installer logic
|
||||
- Write hooks.json to `~/.cursor/` or project-level `.cursor/`
|
||||
- Configure MCP in `.cursor/mcp.json`
|
||||
|
||||
2. **`src/steps/worker.ts`** — Worker startup:
|
||||
- Use `p.spinner()` for worker startup:
|
||||
- Start worker: `bun plugin/scripts/worker-service.cjs` (from marketplace dir)
|
||||
- Write PID file to `~/.claude-mem/worker.pid`
|
||||
- Two-stage health check (copy pattern from OpenClaw installer):
|
||||
- Stage 1: Poll `/api/health` — spinner message: "Starting worker service..."
|
||||
- Stage 2: Poll `/api/readiness` — spinner message: "Initializing database..."
|
||||
- Budget: 30 attempts, 1 second apart
|
||||
- On success: `spinner.stop("Worker running on port {port}")`
|
||||
- On failure: `spinner.error("Worker failed to start")`, show log path
|
||||
|
||||
### Verification
|
||||
- [ ] Plugin files exist at `~/.claude/plugins/marketplaces/thedotmack/`
|
||||
- [ ] known_marketplaces.json updated
|
||||
- [ ] installed_plugins.json updated
|
||||
- [ ] settings.json has enabledPlugins entry
|
||||
- [ ] Worker responds to `/api/health` with 200
|
||||
- [ ] Worker responds to `/api/readiness` with 200
|
||||
|
||||
---
|
||||
|
||||
## Phase 7: Completion & Summary
|
||||
|
||||
**Goal**: Show success screen with configuration summary and next steps.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`src/steps/complete.ts`** — Completion screen:
|
||||
- `p.note()` with configuration summary:
|
||||
- Provider + model
|
||||
- IDEs configured
|
||||
- Data directory
|
||||
- Worker port
|
||||
- Chroma enabled/disabled
|
||||
- `p.note()` with next steps:
|
||||
- "Open Claude Code and start a conversation — memory is automatic!"
|
||||
- "View your memories: http://localhost:{port}"
|
||||
- "Search past work: use /mem-search in Claude Code"
|
||||
- If Cursor: "Open Cursor — hooks are active in your projects"
|
||||
- `p.outro()` with styled completion message
|
||||
|
||||
### Verification
|
||||
- [ ] Summary accurately reflects chosen settings
|
||||
- [ ] URLs use correct port from settings
|
||||
- [ ] Next steps are relevant to selected IDEs
|
||||
|
||||
---
|
||||
|
||||
## Phase 8: curl|bash Bootstrap Script
|
||||
|
||||
**Goal**: Create the shell bootstrap script for `curl -fsSL https://install.cmem.ai | bash`.
|
||||
|
||||
### Tasks
|
||||
|
||||
1. **`install/public/install.sh`** — Bootstrap script:
|
||||
- Check for Node.js >= 18 (required to run the installer)
|
||||
- Download bundled installer JS to temp file
|
||||
- Execute with `node` directly (preserves TTY for @clack/prompts)
|
||||
- Cleanup temp file on exit (trap)
|
||||
- Support `--non-interactive` flag passthrough
|
||||
- Support `--provider=X --api-key=Y` flag passthrough
|
||||
|
||||
2. **Update `install/vercel.json`** to serve `install.sh` alongside `openclaw.sh`
|
||||
|
||||
### Verification
|
||||
- [ ] `curl -fsSL https://install.cmem.ai | bash` downloads and runs installer
|
||||
- [ ] Interactive prompts work after curl download
|
||||
- [ ] Temp file cleaned up on success and failure
|
||||
- [ ] Flags pass through correctly
|
||||
|
||||
---
|
||||
|
||||
## Phase 9: Final Verification
|
||||
|
||||
### Checks
|
||||
- [ ] `npm run build` in installer/ produces single-file `dist/index.js`
|
||||
- [ ] `node dist/index.js` runs full wizard flow
|
||||
- [ ] Fresh install on clean system works end-to-end
|
||||
- [ ] Upgrade path preserves existing settings
|
||||
- [ ] Ctrl+C at any step exits cleanly
|
||||
- [ ] Non-TTY shows error message
|
||||
- [ ] All settings written match SettingsDefaultsManager.ts defaults schema
|
||||
- [ ] Worker health check succeeds after install
|
||||
- [ ] Plugin appears in Claude Code plugin list
|
||||
- [ ] grep for deprecated/non-existent APIs returns 0 results
|
||||
- [ ] No `require()` calls in source (ESM-only)
|
||||
- [ ] No `chalk` imports (use picocolors)
|
||||
@@ -1,262 +0,0 @@
|
||||
# CLAUDE.md Path Validation Bug Fix
|
||||
|
||||
## Problem Summary
|
||||
|
||||
Claude-Mem 9.0's distributed CLAUDE.md feature has a **critical path validation bug** that creates invalid directories when Claude SDK agent outputs non-path strings in file tracking XML tags (`<files_read>`, `<files_modified>`).
|
||||
|
||||
### Root Cause
|
||||
|
||||
In `src/utils/claude-md-utils.ts:234-239`:
|
||||
```typescript
|
||||
if (projectRoot && !path.isAbsolute(filePath)) {
|
||||
absoluteFilePath = path.join(projectRoot, filePath);
|
||||
}
|
||||
```
|
||||
|
||||
- `path.isAbsolute('~/.claude-mem/logs')` returns `false` (Node.js doesn't recognize `~`)
|
||||
- Code joins: `path.join(projectRoot, '~/.claude-mem/logs')` → `/project/~/.claude-mem/logs`
|
||||
- `mkdirSync` creates literal directories
|
||||
|
||||
### Invalid Directories Currently in Repo
|
||||
|
||||
```
|
||||
./~/ ← literal tilde directory
|
||||
./PR #610 on thedotmack/ ← GitHub PR reference
|
||||
./git diff for src/ ← git command text
|
||||
./https:/code.claude.com/docs/en/ ← URL
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Add Path Validation Function
|
||||
|
||||
**File:** `src/utils/claude-md-utils.ts`
|
||||
|
||||
Add new validation function after the imports (around line 16):
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Validate that a file path is safe for CLAUDE.md generation.
|
||||
* Rejects tilde paths, URLs, command-like strings, and paths with invalid chars.
|
||||
*
|
||||
* @param filePath - The file path to validate
|
||||
* @param projectRoot - Optional project root for boundary checking
|
||||
* @returns true if path is valid for CLAUDE.md processing
|
||||
*/
|
||||
function isValidPathForClaudeMd(filePath: string, projectRoot?: string): boolean {
|
||||
// Reject empty or whitespace-only
|
||||
if (!filePath || !filePath.trim()) return false;
|
||||
|
||||
// Reject tilde paths (Node.js doesn't expand ~)
|
||||
if (filePath.startsWith('~')) return false;
|
||||
|
||||
// Reject URLs
|
||||
if (filePath.startsWith('http://') || filePath.startsWith('https://')) return false;
|
||||
|
||||
// Reject paths with spaces (likely command text or PR references)
|
||||
if (filePath.includes(' ')) return false;
|
||||
|
||||
// Reject paths with # (GitHub issue/PR references)
|
||||
if (filePath.includes('#')) return false;
|
||||
|
||||
// If projectRoot provided, ensure resolved path stays within project
|
||||
if (projectRoot) {
|
||||
const resolved = path.resolve(projectRoot, filePath);
|
||||
const normalizedRoot = path.resolve(projectRoot);
|
||||
if (!resolved.startsWith(normalizedRoot + path.sep) && resolved !== normalizedRoot) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 2: Integrate Validation in updateFolderClaudeMdFiles
|
||||
|
||||
**File:** `src/utils/claude-md-utils.ts`
|
||||
|
||||
Modify the file path loop in `updateFolderClaudeMdFiles` (around line 232):
|
||||
|
||||
```typescript
|
||||
for (const filePath of filePaths) {
|
||||
if (!filePath || filePath === '') continue;
|
||||
|
||||
// VALIDATE PATH BEFORE PROCESSING
|
||||
if (!isValidPathForClaudeMd(filePath, projectRoot)) {
|
||||
logger.debug('FOLDER_INDEX', 'Skipping invalid file path', {
|
||||
filePath,
|
||||
reason: 'Failed path validation'
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
// ... rest of existing logic unchanged
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 3: Add Unit Tests
|
||||
|
||||
**File:** `tests/utils/claude-md-utils.test.ts`
|
||||
|
||||
Add new test block after existing tests:
|
||||
|
||||
```typescript
|
||||
describe('path validation in updateFolderClaudeMdFiles', () => {
|
||||
it('should reject tilde paths', async () => {
|
||||
const fetchMock = mock(() => Promise.resolve({ ok: true } as Response));
|
||||
global.fetch = fetchMock;
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['~/.claude-mem/logs/worker.log'],
|
||||
'test-project',
|
||||
37777,
|
||||
tempDir
|
||||
);
|
||||
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reject URLs', async () => {
|
||||
const fetchMock = mock(() => Promise.resolve({ ok: true } as Response));
|
||||
global.fetch = fetchMock;
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['https://example.com/file.ts'],
|
||||
'test-project',
|
||||
37777,
|
||||
tempDir
|
||||
);
|
||||
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reject paths with spaces', async () => {
|
||||
const fetchMock = mock(() => Promise.resolve({ ok: true } as Response));
|
||||
global.fetch = fetchMock;
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['PR #610 on thedotmack/CLAUDE.md'],
|
||||
'test-project',
|
||||
37777,
|
||||
tempDir
|
||||
);
|
||||
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reject paths with hash symbols', async () => {
|
||||
const fetchMock = mock(() => Promise.resolve({ ok: true } as Response));
|
||||
global.fetch = fetchMock;
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['issue#123/file.ts'],
|
||||
'test-project',
|
||||
37777,
|
||||
tempDir
|
||||
);
|
||||
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reject path traversal outside project', async () => {
|
||||
const fetchMock = mock(() => Promise.resolve({ ok: true } as Response));
|
||||
global.fetch = fetchMock;
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['../../../etc/passwd'],
|
||||
'test-project',
|
||||
37777,
|
||||
tempDir
|
||||
);
|
||||
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should accept valid relative paths', async () => {
|
||||
const apiResponse = {
|
||||
content: [{ text: '| #123 | 4:30 PM | 🔵 | Test | ~100 |' }]
|
||||
};
|
||||
const fetchMock = mock(() => Promise.resolve({
|
||||
ok: true,
|
||||
json: () => Promise.resolve(apiResponse)
|
||||
} as Response));
|
||||
global.fetch = fetchMock;
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['src/utils/logger.ts'],
|
||||
'test-project',
|
||||
37777,
|
||||
tempDir
|
||||
);
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Phase 4: Update .gitignore
|
||||
|
||||
**File:** `.gitignore`
|
||||
|
||||
Add at end of file:
|
||||
|
||||
```gitignore
|
||||
# Prevent literal tilde directories (path validation bug artifacts)
|
||||
~*/
|
||||
|
||||
# Prevent other malformed path directories
|
||||
http*/
|
||||
https*/
|
||||
```
|
||||
|
||||
### Phase 5: Clean Up Invalid Directories
|
||||
|
||||
**Command sequence:**
|
||||
```bash
|
||||
rm -rf "~/."
|
||||
rm -rf "PR #610 on thedotmack"
|
||||
rm -rf "git diff for src"
|
||||
rm -rf "https:"
|
||||
```
|
||||
|
||||
### Phase 6: Verify and Commit
|
||||
|
||||
1. Run test suite: `npm test`
|
||||
2. Run build: `npm run build`
|
||||
3. Verify no invalid directories remain
|
||||
4. Commit with message: `fix: Add path validation to CLAUDE.md distribution to prevent invalid directory creation`
|
||||
|
||||
---
|
||||
|
||||
## Files Modified
|
||||
|
||||
| File | Change |
|
||||
|------|--------|
|
||||
| `src/utils/claude-md-utils.ts` | Add `isValidPathForClaudeMd()` function + integrate in loop |
|
||||
| `tests/utils/claude-md-utils.test.ts` | Add 6 new path validation tests |
|
||||
| `.gitignore` | Add `~*/`, `http*/`, `https*/` patterns |
|
||||
|
||||
## Files Deleted
|
||||
|
||||
| Path | Reason |
|
||||
|------|--------|
|
||||
| `~/` (directory tree) | Invalid literal tilde directory |
|
||||
| `PR #610 on thedotmack/` | Invalid PR reference directory |
|
||||
| `git diff for src/` | Invalid git command directory |
|
||||
| `https:/` | Invalid URL directory |
|
||||
|
||||
---
|
||||
|
||||
## Risk Assessment
|
||||
|
||||
**Low Risk:**
|
||||
- Validation is additive (only skips invalid paths, doesn't change valid path handling)
|
||||
- Existing tests remain unchanged
|
||||
- Fire-and-forget design means failures are logged but don't break hooks
|
||||
|
||||
**Testing Coverage:**
|
||||
- 6 new unit tests covering all rejection cases
|
||||
- Existing 27 tests verify valid path behavior unchanged
|
||||
@@ -1,516 +0,0 @@
|
||||
# Fix CLAUDE.md Worktree Bug - Implementation Plan
|
||||
|
||||
## Problem Statement
|
||||
|
||||
CLAUDE.md files are being written to the wrong directory when using git worktrees. The worker service writes files relative to its own `process.cwd()` instead of the project's working directory (`cwd`) from the observation.
|
||||
|
||||
**Reproduction scenario:**
|
||||
1. Start Claude Code in `budapest` worktree → worker starts with `cwd=budapest`
|
||||
2. Run Claude Code in `~/Scripts/claude-mem/` (main repo)
|
||||
3. Observations created with relative file paths (e.g., `src/utils/foo.ts`)
|
||||
4. `updateFolderClaudeMdFiles` writes to `budapest/src/utils/CLAUDE.md` instead of main repo
|
||||
|
||||
## Root Cause Analysis
|
||||
|
||||
The `cwd` (project root path) IS captured and stored:
|
||||
- `SessionRoutes.ts:309,403` - receives `cwd` from hooks
|
||||
- `PendingMessageStore.ts:70` - stores `cwd` in database
|
||||
- `SDKAgent.ts:295` - passes `cwd` to prompt builder
|
||||
|
||||
But `cwd` is NOT passed to file writing:
|
||||
- `ResponseProcessor.ts:222-225` - calls `updateFolderClaudeMdFiles(allFilePaths, session.project, port)` without `cwd`
|
||||
- `claude-md-utils.ts:219` - uses `path.dirname(filePath)` which produces relative paths
|
||||
- Relative paths resolve against worker's `process.cwd()`, not project root
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation & API Inventory
|
||||
|
||||
### Allowed APIs (from codebase analysis)
|
||||
|
||||
**File: `src/utils/claude-md-utils.ts`**
|
||||
```typescript
|
||||
export async function updateFolderClaudeMdFiles(
|
||||
filePaths: string[],
|
||||
project: string,
|
||||
port: number
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
**File: `src/sdk/parser.ts`**
|
||||
```typescript
|
||||
export interface ParsedObservation {
|
||||
type: string;
|
||||
title: string | null;
|
||||
subtitle: string | null;
|
||||
facts: string[];
|
||||
narrative: string | null;
|
||||
concepts: string[];
|
||||
files_read: string[];
|
||||
files_modified: string[];
|
||||
// NOTE: Does NOT include cwd
|
||||
}
|
||||
```
|
||||
|
||||
**File: `src/services/worker-types.ts`**
|
||||
```typescript
|
||||
export interface PendingMessage {
|
||||
type: 'observation' | 'summarize';
|
||||
tool_name?: string;
|
||||
tool_input?: unknown;
|
||||
tool_response?: unknown;
|
||||
prompt_number?: number;
|
||||
cwd?: string; // <-- Source of project root
|
||||
last_assistant_message?: string;
|
||||
}
|
||||
```
|
||||
|
||||
**File: `src/shared/paths.ts`** - Path utilities
|
||||
```typescript
|
||||
import path from 'path';
|
||||
// Standard pattern: path.join(baseDir, relativePath)
|
||||
```
|
||||
|
||||
### Anti-Patterns to Avoid
|
||||
|
||||
1. **DO NOT** add `cwd` to `ParsedObservation` - it comes from message, not agent response
|
||||
2. **DO NOT** use `process.cwd()` for project-specific paths
|
||||
3. **DO NOT** assume file paths are absolute - they are relative from agent response
|
||||
4. **DO NOT** modify the parser - file paths come from agent XML output
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Add `projectRoot` Parameter to `updateFolderClaudeMdFiles`
|
||||
|
||||
### What to implement
|
||||
|
||||
Modify the function signature to accept an optional `projectRoot` parameter for resolving relative paths to absolute paths.
|
||||
|
||||
### Files to modify
|
||||
|
||||
**File: `src/utils/claude-md-utils.ts`**
|
||||
|
||||
**Location: Lines 206-210 (function signature)**
|
||||
|
||||
Current:
|
||||
```typescript
|
||||
export async function updateFolderClaudeMdFiles(
|
||||
filePaths: string[],
|
||||
project: string,
|
||||
port: number
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
New:
|
||||
```typescript
|
||||
export async function updateFolderClaudeMdFiles(
|
||||
filePaths: string[],
|
||||
project: string,
|
||||
port: number,
|
||||
projectRoot?: string
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
**Location: Lines 215-228 (folder extraction logic)**
|
||||
|
||||
Current:
|
||||
```typescript
|
||||
const folderPaths = new Set<string>();
|
||||
for (const filePath of filePaths) {
|
||||
if (!filePath || filePath === '') continue;
|
||||
const folderPath = path.dirname(filePath);
|
||||
if (folderPath && folderPath !== '.' && folderPath !== '/') {
|
||||
if (isProjectRoot(folderPath)) {
|
||||
logger.debug('FOLDER_INDEX', 'Skipping project root CLAUDE.md', { folderPath });
|
||||
continue;
|
||||
}
|
||||
folderPaths.add(folderPath);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
New:
|
||||
```typescript
|
||||
const folderPaths = new Set<string>();
|
||||
for (const filePath of filePaths) {
|
||||
if (!filePath || filePath === '') continue;
|
||||
|
||||
// Resolve relative paths to absolute using projectRoot
|
||||
let absoluteFilePath = filePath;
|
||||
if (projectRoot && !path.isAbsolute(filePath)) {
|
||||
absoluteFilePath = path.join(projectRoot, filePath);
|
||||
}
|
||||
|
||||
const folderPath = path.dirname(absoluteFilePath);
|
||||
if (folderPath && folderPath !== '.' && folderPath !== '/') {
|
||||
if (isProjectRoot(folderPath)) {
|
||||
logger.debug('FOLDER_INDEX', 'Skipping project root CLAUDE.md', { folderPath });
|
||||
continue;
|
||||
}
|
||||
folderPaths.add(folderPath);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Documentation references
|
||||
|
||||
- Pattern for `path.isAbsolute()`: Standard Node.js path module
|
||||
- Pattern for `path.join(base, relative)`: Used throughout `src/shared/paths.ts`
|
||||
|
||||
### Verification checklist
|
||||
|
||||
1. [ ] `grep -n "updateFolderClaudeMdFiles" src/utils/claude-md-utils.ts` shows new signature
|
||||
2. [ ] `grep -n "path.isAbsolute" src/utils/claude-md-utils.ts` confirms new check added
|
||||
3. [ ] `grep -n "projectRoot" src/utils/claude-md-utils.ts` shows parameter usage
|
||||
4. [ ] Existing callers still compile (optional param is backward compatible)
|
||||
|
||||
### Anti-pattern guards
|
||||
|
||||
- **DO NOT** make `projectRoot` required - breaks existing callers
|
||||
- **DO NOT** use `process.cwd()` as default - defeats purpose of fix
|
||||
- **DO NOT** modify the API endpoint format - path resolution is caller's responsibility
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Pass `cwd` from Message to `updateFolderClaudeMdFiles`
|
||||
|
||||
### What to implement
|
||||
|
||||
Extract `cwd` from the original messages being processed and pass it to `updateFolderClaudeMdFiles`.
|
||||
|
||||
### Challenge
|
||||
|
||||
The `syncAndBroadcastObservations` function receives `ParsedObservation[]` which does NOT include `cwd`. The `cwd` is in the original `PendingMessage` but is consumed during prompt generation.
|
||||
|
||||
### Solution
|
||||
|
||||
Add `projectRoot` parameter to `syncAndBroadcastObservations` and `processAgentResponse`, sourced from `session` or passed through from message processing.
|
||||
|
||||
### Files to modify
|
||||
|
||||
**File: `src/services/worker/agents/ResponseProcessor.ts`**
|
||||
|
||||
**Step 1: Update `processAgentResponse` signature (lines 46-55)**
|
||||
|
||||
Current:
|
||||
```typescript
|
||||
export async function processAgentResponse(
|
||||
text: string,
|
||||
session: ActiveSession,
|
||||
dbManager: DatabaseManager,
|
||||
sessionManager: SessionManager,
|
||||
worker: WorkerRef | undefined,
|
||||
discoveryTokens: number,
|
||||
originalTimestamp: number | null,
|
||||
agentName: string
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
New:
|
||||
```typescript
|
||||
export async function processAgentResponse(
|
||||
text: string,
|
||||
session: ActiveSession,
|
||||
dbManager: DatabaseManager,
|
||||
sessionManager: SessionManager,
|
||||
worker: WorkerRef | undefined,
|
||||
discoveryTokens: number,
|
||||
originalTimestamp: number | null,
|
||||
agentName: string,
|
||||
projectRoot?: string
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
**Step 2: Pass `projectRoot` to `syncAndBroadcastObservations` (line 101-109)**
|
||||
|
||||
Current:
|
||||
```typescript
|
||||
await syncAndBroadcastObservations(
|
||||
observations,
|
||||
result,
|
||||
session,
|
||||
dbManager,
|
||||
worker,
|
||||
discoveryTokens,
|
||||
agentName
|
||||
);
|
||||
```
|
||||
|
||||
New:
|
||||
```typescript
|
||||
await syncAndBroadcastObservations(
|
||||
observations,
|
||||
result,
|
||||
session,
|
||||
dbManager,
|
||||
worker,
|
||||
discoveryTokens,
|
||||
agentName,
|
||||
projectRoot
|
||||
);
|
||||
```
|
||||
|
||||
**Step 3: Update `syncAndBroadcastObservations` signature (lines 153-161)**
|
||||
|
||||
Current:
|
||||
```typescript
|
||||
async function syncAndBroadcastObservations(
|
||||
observations: ParsedObservation[],
|
||||
result: StorageResult,
|
||||
session: ActiveSession,
|
||||
dbManager: DatabaseManager,
|
||||
worker: WorkerRef | undefined,
|
||||
discoveryTokens: number,
|
||||
agentName: string
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
New:
|
||||
```typescript
|
||||
async function syncAndBroadcastObservations(
|
||||
observations: ParsedObservation[],
|
||||
result: StorageResult,
|
||||
session: ActiveSession,
|
||||
dbManager: DatabaseManager,
|
||||
worker: WorkerRef | undefined,
|
||||
discoveryTokens: number,
|
||||
agentName: string,
|
||||
projectRoot?: string
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
**Step 4: Update `updateFolderClaudeMdFiles` call (lines 222-229)**
|
||||
|
||||
Current:
|
||||
```typescript
|
||||
if (allFilePaths.length > 0) {
|
||||
updateFolderClaudeMdFiles(
|
||||
allFilePaths,
|
||||
session.project,
|
||||
getWorkerPort()
|
||||
).catch(error => {
|
||||
logger.warn('FOLDER_INDEX', 'CLAUDE.md update failed (non-critical)', { project: session.project }, error as Error);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
New:
|
||||
```typescript
|
||||
if (allFilePaths.length > 0) {
|
||||
updateFolderClaudeMdFiles(
|
||||
allFilePaths,
|
||||
session.project,
|
||||
getWorkerPort(),
|
||||
projectRoot
|
||||
).catch(error => {
|
||||
logger.warn('FOLDER_INDEX', 'CLAUDE.md update failed (non-critical)', { project: session.project }, error as Error);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Verification checklist
|
||||
|
||||
1. [ ] `grep -n "projectRoot" src/services/worker/agents/ResponseProcessor.ts` shows parameter throughout
|
||||
2. [ ] `grep -n "processAgentResponse" src/services/worker/*.ts` to find all callers
|
||||
3. [ ] TypeScript compiles without errors
|
||||
|
||||
### Anti-pattern guards
|
||||
|
||||
- **DO NOT** extract `cwd` from `ParsedObservation` - it doesn't have one
|
||||
- **DO NOT** store `cwd` on session globally - messages may come from different cwds (edge case)
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Update Agent Callers to Pass `cwd`
|
||||
|
||||
### What to implement
|
||||
|
||||
Update SDKAgent, GeminiAgent, and OpenRouterAgent to pass `message.cwd` to `processAgentResponse`.
|
||||
|
||||
### Files to modify
|
||||
|
||||
**File: `src/services/worker/SDKAgent.ts`**
|
||||
|
||||
Find the `processAgentResponse` call and add the `projectRoot` parameter from `message.cwd`.
|
||||
|
||||
**Pattern to follow (from SDKAgent.ts:289-296):**
|
||||
```typescript
|
||||
const obsPrompt = buildObservationPrompt({
|
||||
id: 0,
|
||||
tool_name: message.tool_name!,
|
||||
tool_input: JSON.stringify(message.tool_input),
|
||||
tool_output: JSON.stringify(message.tool_response),
|
||||
created_at_epoch: Date.now(),
|
||||
cwd: message.cwd // <-- This is available
|
||||
});
|
||||
```
|
||||
|
||||
**Challenge:** `processAgentResponse` is called after the SDK response, not in the message loop. Need to track `lastCwd` from messages.
|
||||
|
||||
**Solution:** Store `lastCwd` from messages being processed and pass to `processAgentResponse`.
|
||||
|
||||
**File: `src/services/worker/GeminiAgent.ts`** - Same pattern
|
||||
**File: `src/services/worker/OpenRouterAgent.ts`** - Same pattern
|
||||
|
||||
### Implementation pattern for each agent
|
||||
|
||||
Add tracking variable:
|
||||
```typescript
|
||||
let lastCwd: string | undefined;
|
||||
```
|
||||
|
||||
In message loop, capture cwd:
|
||||
```typescript
|
||||
if (message.cwd) {
|
||||
lastCwd = message.cwd;
|
||||
}
|
||||
```
|
||||
|
||||
In `processAgentResponse` call:
|
||||
```typescript
|
||||
await processAgentResponse(
|
||||
responseText,
|
||||
session,
|
||||
this.dbManager,
|
||||
this.sessionManager,
|
||||
worker,
|
||||
discoveryTokens,
|
||||
originalTimestamp,
|
||||
'SDK', // or 'Gemini' or 'OpenRouter'
|
||||
lastCwd
|
||||
);
|
||||
```
|
||||
|
||||
### Verification checklist
|
||||
|
||||
1. [ ] `grep -n "lastCwd" src/services/worker/SDKAgent.ts` shows tracking
|
||||
2. [ ] `grep -n "lastCwd" src/services/worker/GeminiAgent.ts` shows tracking
|
||||
3. [ ] `grep -n "lastCwd" src/services/worker/OpenRouterAgent.ts` shows tracking
|
||||
4. [ ] `grep -n "processAgentResponse.*lastCwd" src/services/worker/` shows all calls updated
|
||||
|
||||
### Anti-pattern guards
|
||||
|
||||
- **DO NOT** use `session.cwd` - sessions can have messages from multiple cwds
|
||||
- **DO NOT** default to `process.cwd()` - defeats the fix
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Update Tests
|
||||
|
||||
### What to implement
|
||||
|
||||
Update existing tests and add new tests for the `projectRoot` functionality.
|
||||
|
||||
### Files to modify
|
||||
|
||||
**File: `tests/utils/claude-md-utils.test.ts`**
|
||||
|
||||
Add test cases for:
|
||||
1. Relative paths with `projectRoot` resolve correctly
|
||||
2. Absolute paths ignore `projectRoot`
|
||||
3. Missing `projectRoot` maintains backward compatibility
|
||||
|
||||
### Test pattern to copy
|
||||
|
||||
From `tests/utils/claude-md-utils.test.ts:245-266` (folder deduplication test):
|
||||
```typescript
|
||||
it('should deduplicate folders from multiple files', async () => {
|
||||
mockFetch.mockResolvedValue({
|
||||
ok: true,
|
||||
json: () => Promise.resolve({ content: [{ text: mockApiResponse }] })
|
||||
});
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['/project/src/utils/file1.ts', '/project/src/utils/file2.ts'],
|
||||
'test-project',
|
||||
37777
|
||||
);
|
||||
|
||||
// Should only call API once for the deduplicated folder
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
```
|
||||
|
||||
### New test to add
|
||||
|
||||
```typescript
|
||||
it('should resolve relative paths using projectRoot', async () => {
|
||||
mockFetch.mockResolvedValue({
|
||||
ok: true,
|
||||
json: () => Promise.resolve({ content: [{ text: mockApiResponse }] })
|
||||
});
|
||||
|
||||
await updateFolderClaudeMdFiles(
|
||||
['src/utils/file.ts'], // relative path
|
||||
'test-project',
|
||||
37777,
|
||||
'/home/user/my-project' // projectRoot
|
||||
);
|
||||
|
||||
// Should write to absolute path /home/user/my-project/src/utils/CLAUDE.md
|
||||
expect(mockWriteClaudeMd).toHaveBeenCalledWith(
|
||||
'/home/user/my-project/src/utils',
|
||||
expect.any(String)
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### Verification checklist
|
||||
|
||||
1. [ ] `bun test tests/utils/claude-md-utils.test.ts` passes
|
||||
2. [ ] New test case for `projectRoot` exists and passes
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Final Verification
|
||||
|
||||
### Verification commands
|
||||
|
||||
```bash
|
||||
# 1. Confirm new parameter exists
|
||||
grep -n "projectRoot" src/utils/claude-md-utils.ts
|
||||
grep -n "projectRoot" src/services/worker/agents/ResponseProcessor.ts
|
||||
grep -n "lastCwd" src/services/worker/SDKAgent.ts
|
||||
|
||||
# 2. Confirm path.isAbsolute check added
|
||||
grep -n "path.isAbsolute" src/utils/claude-md-utils.ts
|
||||
|
||||
# 3. Confirm all agents updated
|
||||
grep -n "processAgentResponse.*lastCwd" src/services/worker/*.ts
|
||||
|
||||
# 4. Run tests
|
||||
bun test tests/utils/claude-md-utils.test.ts
|
||||
|
||||
# 5. Build and verify no TypeScript errors
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Anti-pattern grep checks
|
||||
|
||||
```bash
|
||||
# Should NOT find process.cwd() in updateFolderClaudeMdFiles path logic
|
||||
grep -n "process.cwd" src/utils/claude-md-utils.ts
|
||||
|
||||
# Should NOT find cwd in ParsedObservation interface
|
||||
grep -A 10 "interface ParsedObservation" src/sdk/parser.ts | grep cwd
|
||||
```
|
||||
|
||||
### Manual testing
|
||||
|
||||
1. Start worker in one directory
|
||||
2. Run Claude Code in a different directory (worktree)
|
||||
3. Make a code change that creates an observation
|
||||
4. Verify CLAUDE.md is written to the correct project directory
|
||||
|
||||
---
|
||||
|
||||
## Summary of Changes
|
||||
|
||||
| File | Change |
|
||||
|------|--------|
|
||||
| `src/utils/claude-md-utils.ts` | Add `projectRoot` param, resolve relative paths |
|
||||
| `src/services/worker/agents/ResponseProcessor.ts` | Pass `projectRoot` through call chain |
|
||||
| `src/services/worker/SDKAgent.ts` | Track `lastCwd`, pass to `processAgentResponse` |
|
||||
| `src/services/worker/GeminiAgent.ts` | Track `lastCwd`, pass to `processAgentResponse` |
|
||||
| `src/services/worker/OpenRouterAgent.ts` | Track `lastCwd`, pass to `processAgentResponse` |
|
||||
| `tests/utils/claude-md-utils.test.ts` | Add tests for `projectRoot` behavior |
|
||||
@@ -1,252 +0,0 @@
|
||||
# Plan: Fix Stale Session Resume Crash
|
||||
|
||||
## Problem Summary
|
||||
|
||||
The worker crashes repeatedly with "Claude Code process exited with code 1" when attempting to resume into a stale/non-existent SDK session.
|
||||
|
||||
**Root Cause:** In `SDKAgent.ts:94`, the resume parameter is passed whenever `memorySessionId` exists in the database, regardless of whether this is an INIT prompt or CONTINUATION prompt. When a worker restarts or re-initializes a session, it loads a stale `memorySessionId` from a previous SDK session and tries to resume into a session that no longer exists in Claude's context.
|
||||
|
||||
**Evidence from logs:**
|
||||
```
|
||||
[17:30:21.773] Starting SDK query {
|
||||
hasRealMemorySessionId=true, ← DB has old memorySessionId
|
||||
resume_parameter=5439891b-..., ← Trying to resume with it
|
||||
lastPromptNumber=1 ← But this is a NEW SDK session!
|
||||
}
|
||||
[17:30:24.450] Generator failed {error=Claude Code process exited with code 1}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (COMPLETED)
|
||||
|
||||
### Allowed APIs (from subagent research)
|
||||
|
||||
**V1 SDK API (currently used):**
|
||||
```typescript
|
||||
// From @anthropic-ai/claude-agent-sdk
|
||||
function query(options: {
|
||||
prompt: string | AsyncIterable<SDKUserMessage>;
|
||||
options: {
|
||||
model: string;
|
||||
resume?: string; // SESSION ID - only use for CONTINUATION
|
||||
disallowedTools?: string[];
|
||||
abortController?: AbortController;
|
||||
pathToClaudeCodeExecutable?: string;
|
||||
}
|
||||
}): AsyncIterable<SDKMessage>
|
||||
```
|
||||
|
||||
**Resume Parameter Rules (from docs/context/agent-sdk-v2-preview.md and SESSION_ID_ARCHITECTURE.md):**
|
||||
- `resume` should only be used when continuing an existing SDK conversation
|
||||
- For INIT prompts (first prompt in a fresh SDK session), no resume parameter should be passed
|
||||
- Session ID is captured from first SDK message and stored for subsequent prompts
|
||||
|
||||
### Anti-Patterns to Avoid
|
||||
- Passing `resume` parameter with INIT prompts (causes crash)
|
||||
- Using `contentSessionId` for resume (contaminates user session)
|
||||
- Assuming memorySessionId validity without checking prompt context
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Fix the Resume Parameter Logic
|
||||
|
||||
### What to Implement
|
||||
|
||||
Modify `src/services/worker/SDKAgent.ts` line 94 to check BOTH conditions:
|
||||
1. `hasRealMemorySessionId` - memorySessionId exists and is non-null
|
||||
2. `session.lastPromptNumber > 1` - this is a CONTINUATION, not an INIT prompt
|
||||
|
||||
### Current Code (line 89-99):
|
||||
```typescript
|
||||
const queryResult = query({
|
||||
prompt: messageGenerator,
|
||||
options: {
|
||||
model: modelId,
|
||||
// Resume with captured memorySessionId (null on first prompt, real ID on subsequent)
|
||||
...(hasRealMemorySessionId && { resume: session.memorySessionId }),
|
||||
disallowedTools,
|
||||
abortController: session.abortController,
|
||||
pathToClaudeCodeExecutable: claudePath
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Fixed Code:
|
||||
```typescript
|
||||
const queryResult = query({
|
||||
prompt: messageGenerator,
|
||||
options: {
|
||||
model: modelId,
|
||||
// Only resume if BOTH: (1) we have a memorySessionId AND (2) this isn't the first prompt
|
||||
// On worker restart, memorySessionId may exist from a previous SDK session but we
|
||||
// need to start fresh since the SDK context was lost
|
||||
...(hasRealMemorySessionId && session.lastPromptNumber > 1 && { resume: session.memorySessionId }),
|
||||
disallowedTools,
|
||||
abortController: session.abortController,
|
||||
pathToClaudeCodeExecutable: claudePath
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Also Update the Comment at Line 66-68:
|
||||
```typescript
|
||||
// CRITICAL: Only resume if:
|
||||
// 1. memorySessionId exists (was captured from a previous SDK response)
|
||||
// 2. lastPromptNumber > 1 (this is a continuation within the same SDK session)
|
||||
// On worker restart or crash recovery, memorySessionId may exist from a previous
|
||||
// SDK session but we must NOT resume because the SDK context was lost.
|
||||
// NEVER use contentSessionId for resume - that would inject messages into the user's transcript!
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] `grep "hasRealMemorySessionId && session.lastPromptNumber > 1" src/services/worker/SDKAgent.ts` returns the fix
|
||||
- [ ] Build succeeds: `npm run build`
|
||||
- [ ] No TypeScript errors
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Add Logging for Debugging
|
||||
|
||||
### What to Implement
|
||||
|
||||
Enhance the alignment log at line 81-85 to clearly indicate when resume is skipped due to INIT prompt:
|
||||
|
||||
```typescript
|
||||
// Debug-level alignment logs for detailed tracing
|
||||
if (session.lastPromptNumber > 1) {
|
||||
const willResume = hasRealMemorySessionId;
|
||||
logger.debug('SDK', `[ALIGNMENT] Resume Decision | contentSessionId=${session.contentSessionId} | memorySessionId=${session.memorySessionId} | prompt#=${session.lastPromptNumber} | hasRealMemorySessionId=${hasRealMemorySessionId} | willResume=${willResume} | resumeWith=${willResume ? session.memorySessionId : 'NONE'}`);
|
||||
} else {
|
||||
// INIT prompt - never resume even if memorySessionId exists (stale from previous session)
|
||||
const hasStaleMemoryId = hasRealMemorySessionId;
|
||||
logger.debug('SDK', `[ALIGNMENT] First Prompt (INIT) | contentSessionId=${session.contentSessionId} | prompt#=${session.lastPromptNumber} | hasStaleMemoryId=${hasStaleMemoryId} | action=START_FRESH | Will capture new memorySessionId from SDK response`);
|
||||
if (hasStaleMemoryId) {
|
||||
logger.warn('SDK', `Skipping resume for INIT prompt despite existing memorySessionId=${session.memorySessionId} - SDK context was lost (worker restart or crash recovery)`);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] Build succeeds: `npm run build`
|
||||
- [ ] Log message appears when running with stale session scenario
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Add Unit Tests
|
||||
|
||||
### What to Implement
|
||||
|
||||
Create tests in `tests/sdk-agent-resume.test.ts` following patterns from `tests/session_id_usage_validation.test.ts`:
|
||||
|
||||
```typescript
|
||||
import { describe, it, expect, beforeEach, afterEach, mock } from 'bun:test';
|
||||
|
||||
describe('SDKAgent Resume Parameter Logic', () => {
|
||||
describe('hasRealMemorySessionId check', () => {
|
||||
it('should NOT pass resume parameter when lastPromptNumber === 1 even if memorySessionId exists', () => {
|
||||
// Scenario: Worker restart with stale memorySessionId
|
||||
const session = {
|
||||
memorySessionId: 'stale-session-id-from-previous-run',
|
||||
lastPromptNumber: 1, // INIT prompt
|
||||
};
|
||||
|
||||
const hasRealMemorySessionId = !!session.memorySessionId;
|
||||
const shouldResume = hasRealMemorySessionId && session.lastPromptNumber > 1;
|
||||
|
||||
expect(hasRealMemorySessionId).toBe(true); // memorySessionId exists
|
||||
expect(shouldResume).toBe(false); // but should NOT resume
|
||||
});
|
||||
|
||||
it('should pass resume parameter when lastPromptNumber > 1 AND memorySessionId exists', () => {
|
||||
// Scenario: Normal continuation within same SDK session
|
||||
const session = {
|
||||
memorySessionId: 'valid-session-id',
|
||||
lastPromptNumber: 2, // CONTINUATION prompt
|
||||
};
|
||||
|
||||
const hasRealMemorySessionId = !!session.memorySessionId;
|
||||
const shouldResume = hasRealMemorySessionId && session.lastPromptNumber > 1;
|
||||
|
||||
expect(hasRealMemorySessionId).toBe(true);
|
||||
expect(shouldResume).toBe(true);
|
||||
});
|
||||
|
||||
it('should NOT pass resume parameter when memorySessionId is null', () => {
|
||||
// Scenario: Fresh session, no captured ID yet
|
||||
const session = {
|
||||
memorySessionId: null,
|
||||
lastPromptNumber: 1,
|
||||
};
|
||||
|
||||
const hasRealMemorySessionId = !!session.memorySessionId;
|
||||
const shouldResume = hasRealMemorySessionId && session.lastPromptNumber > 1;
|
||||
|
||||
expect(hasRealMemorySessionId).toBe(false);
|
||||
expect(shouldResume).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Documentation Reference
|
||||
- Pattern: `tests/session_id_usage_validation.test.ts` lines 1-50 for test structure
|
||||
- Mock pattern: `tests/worker/agents/response-processor.test.ts` for session mocking
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] Tests pass: `bun test tests/sdk-agent-resume.test.ts`
|
||||
- [ ] Test file follows project conventions
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Build and Deploy
|
||||
|
||||
### What to Implement
|
||||
|
||||
1. Build the plugin: `npm run build-and-sync`
|
||||
2. Verify worker restarts with fix applied
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] `npm run build-and-sync` succeeds
|
||||
- [ ] Worker health check passes: `curl http://localhost:37777/api/health`
|
||||
- [ ] No "Claude Code process exited with code 1" errors in logs after restart
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Final Verification
|
||||
|
||||
### Verification Commands
|
||||
|
||||
```bash
|
||||
# 1. Verify fix is in place
|
||||
grep -n "hasRealMemorySessionId && session.lastPromptNumber > 1" src/services/worker/SDKAgent.ts
|
||||
|
||||
# 2. Verify no crashes in recent logs
|
||||
tail -100 ~/.claude-mem/logs/claude-mem-$(date +%Y-%m-%d).log | grep -c "exited with code 1"
|
||||
|
||||
# 3. Run tests
|
||||
bun test tests/sdk-agent-resume.test.ts
|
||||
|
||||
# 4. Check for anti-patterns (should return 0 results)
|
||||
grep -n "hasRealMemorySessionId && { resume" src/services/worker/SDKAgent.ts
|
||||
```
|
||||
|
||||
### Success Criteria
|
||||
- [ ] Fix in place at SDKAgent.ts:94
|
||||
- [ ] Zero "exited with code 1" errors related to stale resume
|
||||
- [ ] All tests pass
|
||||
- [ ] Worker stable for 10+ minutes without crash loop
|
||||
|
||||
---
|
||||
|
||||
## Files to Modify
|
||||
|
||||
1. `src/services/worker/SDKAgent.ts` - Fix resume logic (Phase 1 & 2)
|
||||
2. `tests/sdk-agent-resume.test.ts` - New test file (Phase 3)
|
||||
|
||||
## Estimated Complexity
|
||||
|
||||
- **Phase 1**: Low - Single line change with updated condition
|
||||
- **Phase 2**: Low - Enhanced logging
|
||||
- **Phase 3**: Medium - New test file following existing patterns
|
||||
- **Phase 4-5**: Low - Standard build/verify process
|
||||
@@ -1,298 +0,0 @@
|
||||
# Folder CLAUDE.md Generator
|
||||
|
||||
## CORE DIRECTIVE (NON-NEGOTIABLE)
|
||||
|
||||
**EXTEND THE EXISTING CURSOR RULES TIMELINE GENERATION SYSTEM TO ALSO WRITE CLAUDE.MD FILES**
|
||||
|
||||
- DO NOT create new services
|
||||
- DO NOT create new orchestrators
|
||||
- DO NOT create new HTTP routes
|
||||
- DO NOT create new database query functions
|
||||
- EXTEND existing functions to add folder-level output
|
||||
|
||||
---
|
||||
|
||||
## Approved Directives (From Planning Conversation)
|
||||
|
||||
### Trigger Mechanism
|
||||
- Observation save triggers folder CLAUDE.md regeneration **INLINE**
|
||||
- NO batching
|
||||
- NO debouncing
|
||||
- NO Set-based queuing
|
||||
- NO session-end hook
|
||||
- Synchronous: `observation.save()` → update folder CLAUDE.md files → done
|
||||
|
||||
### Tag Strategy
|
||||
- Wrap ONLY auto-generated content with `<claude-mem-context>` tags
|
||||
- Everything outside tags is untouched (user's manual content preserved)
|
||||
- If tags are deleted, just regenerate them
|
||||
- NO backup system
|
||||
- NO manual content markers
|
||||
|
||||
### Git Behavior
|
||||
- CLAUDE.md files SHOULD be committed (intentional)
|
||||
- `<claude-mem-context>` tag is searchable fingerprint for GitHub analytics
|
||||
- NO .gitignore for these files
|
||||
|
||||
### Phasing
|
||||
- **Phase 1**: CLAUDE.md generation only (THIS PLAN)
|
||||
- **Phase 2**: IDE symlinks (FUTURE)
|
||||
|
||||
### REJECTED
|
||||
- Cross-folder linking — NO
|
||||
- Semantic grouping — deferred enhancement only
|
||||
- Team sync — future phase
|
||||
|
||||
### DEFERRED
|
||||
- Priority weighting by observation type
|
||||
- IDE-specific template refinements
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (COMPLETED)
|
||||
|
||||
### Existing APIs to USE (Not Rebuild)
|
||||
|
||||
| Function | Location | Purpose |
|
||||
|----------|----------|---------|
|
||||
| `findByFile(filePath, options)` | `src/services/sqlite/SessionSearch.ts:342` | Query observations by folder prefix (already supports LIKE wildcards) |
|
||||
| `updateCursorContextForProject()` | `src/services/integrations/CursorHooksInstaller.ts:98` | Write context files after observation save |
|
||||
| `writeContextFile()` | `src/utils/cursor-utils.ts:97` | Atomic file write with temp file + rename |
|
||||
| `extractFirstFile()` | `src/shared/timeline-formatting.ts` | Extract file paths from JSON arrays |
|
||||
| `groupByDate()` | `src/shared/timeline-formatting.ts` | Group items chronologically |
|
||||
| `formatTime()`, `formatDate()` | `src/shared/timeline-formatting.ts` | Time formatting |
|
||||
|
||||
### Existing Integration Points
|
||||
|
||||
| Location | What Happens | Extension Point |
|
||||
|----------|--------------|-----------------|
|
||||
| `ResponseProcessor.ts:266` | Calls `updateCursorContextForProject()` after summary save | Add folder CLAUDE.md update here |
|
||||
| `CursorHooksInstaller.ts:98` | `updateCursorContextForProject()` fetches context and writes file | Add sibling function for folder updates |
|
||||
|
||||
### Anti-Patterns to AVOID
|
||||
- Creating `FolderIndexOrchestrator.ts` — NO
|
||||
- Creating `FolderTimelineCompiler.ts` — NO
|
||||
- Creating `FolderDiscovery.ts` — NO
|
||||
- Creating `ClaudeMdGenerator.ts` — NO
|
||||
- Creating `FolderIndexRoutes.ts` — NO
|
||||
- Adding new HTTP endpoints — NO
|
||||
- Adding new settings in `SettingsDefaultsManager.ts` — NO (use sensible defaults inline)
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Extend CursorHooksInstaller
|
||||
|
||||
### What to Implement
|
||||
|
||||
Add ONE new function to `src/services/integrations/CursorHooksInstaller.ts`:
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Update CLAUDE.md files for folders touched by an observation.
|
||||
* Called inline after observation save, similar to updateCursorContextForProject.
|
||||
*/
|
||||
export async function updateFolderClaudeMd(
|
||||
workspacePath: string,
|
||||
filesModified: string[],
|
||||
filesRead: string[],
|
||||
project: string,
|
||||
port: number
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
### Implementation Pattern (Copy From)
|
||||
|
||||
Follow the EXACT pattern of `updateCursorContextForProject()` at line 98:
|
||||
1. Extract unique folder paths from filesModified and filesRead
|
||||
2. For each folder, fetch timeline via existing `/api/search/file?files=<folderPath>` endpoint
|
||||
3. Format as simple timeline (reuse existing formatters)
|
||||
4. Write to `<folder>/CLAUDE.md` preserving content outside `<claude-mem-context>` tags
|
||||
|
||||
### Tag Preservation Logic
|
||||
|
||||
```typescript
|
||||
function replaceTaggedContent(existingContent: string, newContent: string): string {
|
||||
const startTag = '<claude-mem-context>';
|
||||
const endTag = '</claude-mem-context>';
|
||||
|
||||
// If no existing content, wrap new content in tags
|
||||
if (!existingContent) {
|
||||
return `${startTag}\n${newContent}\n${endTag}`;
|
||||
}
|
||||
|
||||
// If existing has tags, replace only tagged section
|
||||
const startIdx = existingContent.indexOf(startTag);
|
||||
const endIdx = existingContent.indexOf(endTag);
|
||||
|
||||
if (startIdx !== -1 && endIdx !== -1) {
|
||||
return existingContent.substring(0, startIdx) +
|
||||
`${startTag}\n${newContent}\n${endTag}` +
|
||||
existingContent.substring(endIdx + endTag.length);
|
||||
}
|
||||
|
||||
// If no tags exist, append tagged content at end
|
||||
return existingContent + `\n\n${startTag}\n${newContent}\n${endTag}`;
|
||||
}
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] Function added to CursorHooksInstaller.ts
|
||||
- [ ] Uses existing `findByFile` endpoint (no new database queries)
|
||||
- [ ] Preserves content outside `<claude-mem-context>` tags
|
||||
- [ ] Atomic writes (temp file + rename)
|
||||
- [ ] Build passes: `npm run build`
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Hook Into ResponseProcessor
|
||||
|
||||
### What to Implement
|
||||
|
||||
Add call to `updateFolderClaudeMd()` in `src/services/worker/agents/ResponseProcessor.ts`, right after the existing `updateCursorContextForProject()` call at line 266.
|
||||
|
||||
### Code Location
|
||||
|
||||
In `syncAndBroadcastSummary()` function, after line 269:
|
||||
|
||||
```typescript
|
||||
// EXISTING: Update Cursor context file for registered projects (fire-and-forget)
|
||||
updateCursorContextForProject(session.project, getWorkerPort()).catch(error => {
|
||||
logger.warn('CURSOR', 'Context update failed (non-critical)', { project: session.project }, error as Error);
|
||||
});
|
||||
|
||||
// NEW: Update folder CLAUDE.md files for touched folders (fire-and-forget)
|
||||
// Extract file paths from the saved observations
|
||||
updateFolderClaudeMd(
|
||||
workspacePath, // From registry lookup
|
||||
filesModified, // From observations
|
||||
filesRead, // From observations
|
||||
session.project,
|
||||
getWorkerPort()
|
||||
).catch(error => {
|
||||
logger.warn('FOLDER_INDEX', 'CLAUDE.md update failed (non-critical)', { project: session.project }, error as Error);
|
||||
});
|
||||
```
|
||||
|
||||
### Data Flow
|
||||
1. `processAgentResponse()` saves observations → gets back `observationIds`
|
||||
2. Fetch observation records to get `files_read` and `files_modified`
|
||||
3. Pass to `updateFolderClaudeMd()`
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] Call added to ResponseProcessor.ts
|
||||
- [ ] Fire-and-forget pattern (non-blocking, errors logged)
|
||||
- [ ] Uses existing observation data (no new queries)
|
||||
- [ ] Build passes: `npm run build`
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Timeline Formatting
|
||||
|
||||
### What to Implement
|
||||
|
||||
Create a minimal timeline formatter for CLAUDE.md output. This can be:
|
||||
1. A simple function in CursorHooksInstaller.ts, OR
|
||||
2. Reuse existing `ResultFormatter.formatSearchResults()` from `src/services/worker/search/ResultFormatter.ts`
|
||||
|
||||
### Output Format
|
||||
|
||||
```markdown
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
<claude-mem-context>
|
||||
|
||||
### 2026-01-04
|
||||
|
||||
| Time | Type | Title |
|
||||
|------|------|-------|
|
||||
| 4:30pm | feature | Added folder index support |
|
||||
| 3:15pm | bugfix | Fixed file path handling |
|
||||
|
||||
### 2026-01-03
|
||||
|
||||
| Time | Type | Title |
|
||||
|------|------|-------|
|
||||
| 11:00am | refactor | Cleaned up cursor utils |
|
||||
|
||||
</claude-mem-context>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
- Compact format (time, type emoji, title only)
|
||||
- Grouped by date
|
||||
- Limited to last N days or observations (sensible default: 10)
|
||||
- NO token counts
|
||||
- NO file columns (redundant - we're IN the folder)
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] Formatter produces clean markdown
|
||||
- [ ] Output is concise (not verbose)
|
||||
- [ ] Grouped by date
|
||||
- [ ] Build passes: `npm run build`
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Verification
|
||||
|
||||
### Functional Tests
|
||||
|
||||
1. **Manual Test**:
|
||||
- Start worker: `npm run dev`
|
||||
- Create a test observation touching `src/services/sqlite/`
|
||||
- Verify `src/services/sqlite/CLAUDE.md` is created/updated
|
||||
- Verify `<claude-mem-context>` tags are present
|
||||
- Verify manual content outside tags is preserved
|
||||
|
||||
2. **Build Check**:
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
3. **Grep for Anti-Patterns**:
|
||||
```bash
|
||||
# Should find NOTHING
|
||||
grep -r "FolderIndexOrchestrator" src/
|
||||
grep -r "FolderTimelineCompiler" src/
|
||||
grep -r "FolderDiscovery" src/
|
||||
grep -r "ClaudeMdGenerator" src/
|
||||
grep -r "FolderIndexRoutes" src/
|
||||
```
|
||||
|
||||
4. **Grep for Correct Implementation**:
|
||||
```bash
|
||||
# Should find the new function
|
||||
grep -r "updateFolderClaudeMd" src/
|
||||
```
|
||||
|
||||
### Tag Preservation Test
|
||||
|
||||
1. Create `src/test-folder/CLAUDE.md` with manual content:
|
||||
```markdown
|
||||
# My Notes
|
||||
This is manual content I wrote.
|
||||
```
|
||||
|
||||
2. Trigger observation save touching files in `src/test-folder/`
|
||||
|
||||
3. Verify result:
|
||||
```markdown
|
||||
# My Notes
|
||||
This is manual content I wrote.
|
||||
|
||||
<claude-mem-context>
|
||||
### 2026-01-04
|
||||
| Time | Type | Title |
|
||||
...
|
||||
</claude-mem-context>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
This is a **~100 line change** spread across 2 files:
|
||||
1. `CursorHooksInstaller.ts` — Add `updateFolderClaudeMd()` function (~60 lines)
|
||||
2. `ResponseProcessor.ts` — Add call to the new function (~10 lines)
|
||||
|
||||
NO new files. NO new services. NO new routes. Just extending existing patterns.
|
||||
@@ -1,378 +0,0 @@
|
||||
# Folder CLAUDE.md Refactor - Extract to Shared Utils
|
||||
|
||||
## CORE DIRECTIVE
|
||||
|
||||
**DECOUPLE FOLDER CLAUDE.MD WRITING FROM CURSOR INTEGRATION**
|
||||
|
||||
The current implementation incorrectly couples folder-level CLAUDE.md generation to Cursor-specific registry lookups. The file paths from observations are already absolute - no workspace registry lookup is needed.
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (COMPLETED)
|
||||
|
||||
### Current Implementation Location
|
||||
|
||||
| Function | Location | Lines | Purpose |
|
||||
|----------|----------|-------|---------|
|
||||
| `updateFolderClaudeMd` | CursorHooksInstaller.ts | 128-199 | Orchestrates folder CLAUDE.md updates |
|
||||
| `formatTimelineForClaudeMd` | CursorHooksInstaller.ts | 221-295 | Parses API response to markdown |
|
||||
| `replaceTaggedContent` | CursorHooksInstaller.ts | 300-321 | Preserves user content outside tags |
|
||||
| `writeFolderClaudeMd` | CursorHooksInstaller.ts | 326-353 | Atomic file write |
|
||||
|
||||
### Integration Point
|
||||
|
||||
**File:** `src/services/worker/agents/ResponseProcessor.ts:274-298`
|
||||
|
||||
Current (problematic) code:
|
||||
```typescript
|
||||
const registry = readCursorRegistry();
|
||||
const registryEntry = registry[session.project];
|
||||
|
||||
if (registryEntry && (filesModified.length > 0 || filesRead.length > 0)) {
|
||||
updateFolderClaudeMd(
|
||||
registryEntry.workspacePath, // <-- PROBLEM: Needs Cursor registry
|
||||
filesModified,
|
||||
filesRead,
|
||||
session.project,
|
||||
getWorkerPort()
|
||||
).catch(error => { ... });
|
||||
}
|
||||
```
|
||||
|
||||
### The Problem
|
||||
|
||||
1. `filesModified` and `filesRead` already contain **absolute paths**
|
||||
2. We don't need `workspacePath` - just extract folder from file path directly
|
||||
3. Cursor registry is only populated when Cursor hooks are installed
|
||||
4. This makes folder CLAUDE.md a Cursor-only feature (unintended)
|
||||
|
||||
### Project Utils Pattern
|
||||
|
||||
**From `src/utils/cursor-utils.ts:97-122`:**
|
||||
- Pure functions with paths as parameters
|
||||
- Atomic write pattern: temp file + rename
|
||||
- `mkdirSync(dir, { recursive: true })` for directory creation
|
||||
|
||||
### Related Utils
|
||||
|
||||
**`src/utils/tag-stripping.ts`** - Handles *stripping* tags (input filtering)
|
||||
- `stripMemoryTagsFromJson()` - removes `<claude-mem-context>` content
|
||||
- `stripMemoryTagsFromPrompt()` - removes `<private>` content
|
||||
|
||||
Our `replaceTaggedContent` handles *preserving/replacing* (output writing) - complementary, not duplicative.
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Create Shared Utils File
|
||||
|
||||
### What to Implement
|
||||
|
||||
Create `src/utils/claude-md-utils.ts` with extracted and simplified functions.
|
||||
|
||||
### File Structure
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* CLAUDE.md File Utilities
|
||||
*
|
||||
* Shared utilities for writing folder-level CLAUDE.md files with
|
||||
* auto-generated context sections. Preserves user content outside
|
||||
* <claude-mem-context> tags.
|
||||
*/
|
||||
|
||||
import { existsSync, readFileSync, writeFileSync, renameSync, mkdirSync } from 'fs';
|
||||
import path from 'path';
|
||||
import { logger } from './logger.js';
|
||||
|
||||
/**
|
||||
* Replace tagged content in existing file, preserving content outside tags.
|
||||
*
|
||||
* Handles three cases:
|
||||
* 1. No existing content → wraps new content in tags
|
||||
* 2. Has existing tags → replaces only tagged section
|
||||
* 3. No tags in existing content → appends tagged content at end
|
||||
*/
|
||||
export function replaceTaggedContent(existingContent: string, newContent: string): string {
|
||||
// Copy from CursorHooksInstaller.ts:300-321
|
||||
}
|
||||
|
||||
/**
|
||||
* Write CLAUDE.md file to folder with atomic writes.
|
||||
* Creates directory structure if needed.
|
||||
*
|
||||
* @param folderPath - Absolute path to the folder
|
||||
* @param newContent - Content to write inside tags
|
||||
*/
|
||||
export function writeClaudeMdToFolder(folderPath: string, newContent: string): void {
|
||||
// Simplified from writeFolderClaudeMd - no workspacePath needed
|
||||
// Copy atomic write pattern from CursorHooksInstaller.ts:326-353
|
||||
}
|
||||
|
||||
/**
|
||||
* Format timeline text from API response to compact CLAUDE.md format.
|
||||
*
|
||||
* @param timelineText - Raw API response text
|
||||
* @returns Formatted markdown with date headers and compact table
|
||||
*/
|
||||
export function formatTimelineForClaudeMd(timelineText: string): string {
|
||||
// Copy from CursorHooksInstaller.ts:221-295
|
||||
}
|
||||
```
|
||||
|
||||
### Key Simplification
|
||||
|
||||
**OLD `writeFolderClaudeMd` signature:**
|
||||
```typescript
|
||||
async function writeFolderClaudeMd(
|
||||
workspacePath: string, // <-- REMOVE
|
||||
folderPath: string,
|
||||
newContent: string
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
**NEW `writeClaudeMdToFolder` signature:**
|
||||
```typescript
|
||||
export function writeClaudeMdToFolder(
|
||||
folderPath: string, // Must be absolute path
|
||||
newContent: string
|
||||
): void // Sync is fine, atomic anyway
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] File created at `src/utils/claude-md-utils.ts`
|
||||
- [ ] `replaceTaggedContent` exported and handles all 3 cases
|
||||
- [ ] `writeClaudeMdToFolder` exported with atomic writes
|
||||
- [ ] `formatTimelineForClaudeMd` exported
|
||||
- [ ] Build passes: `npm run build`
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Create Folder Index Service Function
|
||||
|
||||
### What to Implement
|
||||
|
||||
Create a new orchestrating function that replaces `updateFolderClaudeMd`. This should NOT be in CursorHooksInstaller - it's a general feature.
|
||||
|
||||
**Option A:** Add to `src/utils/claude-md-utils.ts` (keeps it simple)
|
||||
**Option B:** Create `src/services/folder-index-service.ts` (follows service pattern)
|
||||
|
||||
Recommend **Option A** for simplicity - it's just one function.
|
||||
|
||||
### New Function
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Update CLAUDE.md files for folders containing the given files.
|
||||
* Fetches timeline from worker API and writes formatted content.
|
||||
*
|
||||
* @param filePaths - Array of absolute file paths (modified or read)
|
||||
* @param project - Project identifier for API query
|
||||
* @param port - Worker API port
|
||||
*/
|
||||
export async function updateFolderClaudeMdFiles(
|
||||
filePaths: string[],
|
||||
project: string,
|
||||
port: number
|
||||
): Promise<void> {
|
||||
// Extract unique folder paths from file paths
|
||||
const folderPaths = new Set<string>();
|
||||
for (const filePath of filePaths) {
|
||||
if (!filePath || filePath === '') continue;
|
||||
const folderPath = path.dirname(filePath);
|
||||
if (folderPath && folderPath !== '.' && folderPath !== '/') {
|
||||
folderPaths.add(folderPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (folderPaths.size === 0) return;
|
||||
|
||||
logger.debug('FOLDER_INDEX', 'Updating CLAUDE.md files', {
|
||||
project,
|
||||
folderCount: folderPaths.size
|
||||
});
|
||||
|
||||
// Process each folder
|
||||
for (const folderPath of folderPaths) {
|
||||
try {
|
||||
// Fetch timeline via existing API
|
||||
const response = await fetch(
|
||||
`http://127.0.0.1:${port}/api/search/by-file?filePath=${encodeURIComponent(folderPath)}&limit=10&project=${encodeURIComponent(project)}`
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
logger.warn('FOLDER_INDEX', 'Failed to fetch timeline', { folderPath, status: response.status });
|
||||
continue;
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
if (!result.content?.[0]?.text) {
|
||||
logger.debug('FOLDER_INDEX', 'No content for folder', { folderPath });
|
||||
continue;
|
||||
}
|
||||
|
||||
const formatted = formatTimelineForClaudeMd(result.content[0].text);
|
||||
writeClaudeMdToFolder(folderPath, formatted);
|
||||
|
||||
logger.debug('FOLDER_INDEX', 'Updated CLAUDE.md', { folderPath });
|
||||
} catch (error) {
|
||||
logger.warn('FOLDER_INDEX', 'Failed to update CLAUDE.md', { folderPath }, error as Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] `updateFolderClaudeMdFiles` function added
|
||||
- [ ] Takes only `filePaths`, `project`, `port` (no workspacePath)
|
||||
- [ ] Extracts folder paths from absolute file paths
|
||||
- [ ] Uses `writeClaudeMdToFolder` for atomic writes
|
||||
- [ ] Build passes: `npm run build`
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Update ResponseProcessor Integration
|
||||
|
||||
### What to Implement
|
||||
|
||||
Simplify the call site in `src/services/worker/agents/ResponseProcessor.ts`.
|
||||
|
||||
### Current Code (lines 274-298)
|
||||
```typescript
|
||||
// Update folder CLAUDE.md files for touched folders (fire-and-forget)
|
||||
const filesModified: string[] = [];
|
||||
const filesRead: string[] = [];
|
||||
|
||||
for (const obs of observations) {
|
||||
filesModified.push(...(obs.files_modified || []));
|
||||
filesRead.push(...(obs.files_read || []));
|
||||
}
|
||||
|
||||
// Get workspace path from project registry
|
||||
const registry = readCursorRegistry();
|
||||
const registryEntry = registry[session.project];
|
||||
|
||||
if (registryEntry && (filesModified.length > 0 || filesRead.length > 0)) {
|
||||
updateFolderClaudeMd(
|
||||
registryEntry.workspacePath,
|
||||
filesModified,
|
||||
filesRead,
|
||||
session.project,
|
||||
getWorkerPort()
|
||||
).catch(error => {
|
||||
logger.warn('FOLDER_INDEX', 'CLAUDE.md update failed (non-critical)', { project: session.project }, error as Error);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### New Code
|
||||
```typescript
|
||||
// Update folder CLAUDE.md files for touched folders (fire-and-forget)
|
||||
const allFilePaths: string[] = [];
|
||||
for (const obs of observations) {
|
||||
allFilePaths.push(...(obs.files_modified || []));
|
||||
allFilePaths.push(...(obs.files_read || []));
|
||||
}
|
||||
|
||||
if (allFilePaths.length > 0) {
|
||||
updateFolderClaudeMdFiles(
|
||||
allFilePaths,
|
||||
session.project,
|
||||
getWorkerPort()
|
||||
).catch(error => {
|
||||
logger.warn('FOLDER_INDEX', 'CLAUDE.md update failed (non-critical)', { project: session.project }, error as Error);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Import Changes
|
||||
|
||||
**Remove:**
|
||||
```typescript
|
||||
import { updateFolderClaudeMd, readCursorRegistry } from '../../integrations/CursorHooksInstaller.js';
|
||||
```
|
||||
|
||||
**Add:**
|
||||
```typescript
|
||||
import { updateFolderClaudeMdFiles } from '../../../utils/claude-md-utils.js';
|
||||
```
|
||||
|
||||
**Keep (if still needed for Cursor context):**
|
||||
```typescript
|
||||
import { updateCursorContextForProject } from '../../worker-service.js';
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] Import updated to use `claude-md-utils.ts`
|
||||
- [ ] `readCursorRegistry` import removed (if no longer needed)
|
||||
- [ ] Call site simplified - no registry lookup
|
||||
- [ ] Fire-and-forget pattern preserved
|
||||
- [ ] Build passes: `npm run build`
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Clean Up CursorHooksInstaller
|
||||
|
||||
### What to Implement
|
||||
|
||||
Remove the extracted functions from `src/services/integrations/CursorHooksInstaller.ts`.
|
||||
|
||||
### Functions to Remove
|
||||
- `updateFolderClaudeMd` (lines 128-199)
|
||||
- `formatTimelineForClaudeMd` (lines 221-295)
|
||||
- `replaceTaggedContent` (lines 300-321)
|
||||
- `writeFolderClaudeMd` (lines 326-353)
|
||||
|
||||
### Verification Checklist
|
||||
- [ ] All 4 functions removed from CursorHooksInstaller.ts
|
||||
- [ ] No dangling references to removed functions
|
||||
- [ ] CursorHooksInstaller still exports what it needs for Cursor integration
|
||||
- [ ] Build passes: `npm run build`
|
||||
- [ ] Grep shows no references to old function locations
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Verification
|
||||
|
||||
### Build Check
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Anti-Pattern Grep (should find NOTHING in CursorHooksInstaller)
|
||||
```bash
|
||||
grep -n "updateFolderClaudeMd\|formatTimelineForClaudeMd\|replaceTaggedContent\|writeFolderClaudeMd" src/services/integrations/CursorHooksInstaller.ts
|
||||
```
|
||||
|
||||
### Correct Location Grep (should find in claude-md-utils)
|
||||
```bash
|
||||
grep -rn "updateFolderClaudeMdFiles\|writeClaudeMdToFolder\|formatTimelineForClaudeMd" src/utils/
|
||||
```
|
||||
|
||||
### Integration Check
|
||||
```bash
|
||||
grep -n "updateFolderClaudeMdFiles" src/services/worker/agents/ResponseProcessor.ts
|
||||
```
|
||||
|
||||
### No Cursor Registry Dependency
|
||||
```bash
|
||||
grep -n "readCursorRegistry" src/services/worker/agents/ResponseProcessor.ts
|
||||
# Should return nothing (or only for Cursor context, not folder index)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
**~150 lines moved** from CursorHooksInstaller.ts to claude-md-utils.ts with simplification:
|
||||
|
||||
| Before | After |
|
||||
|--------|-------|
|
||||
| 4 functions in CursorHooksInstaller | 4 functions in claude-md-utils |
|
||||
| Requires Cursor registry lookup | Works with absolute paths directly |
|
||||
| `updateFolderClaudeMd(workspacePath, ...)` | `updateFolderClaudeMdFiles(filePaths, ...)` |
|
||||
| Coupled to Cursor integration | Independent utility |
|
||||
|
||||
**Files Changed:**
|
||||
1. `src/utils/claude-md-utils.ts` - NEW (create)
|
||||
2. `src/services/worker/agents/ResponseProcessor.ts` - UPDATE (simplify call site)
|
||||
3. `src/services/integrations/CursorHooksInstaller.ts` - UPDATE (remove extracted functions)
|
||||
@@ -1,186 +0,0 @@
|
||||
# Plan: Change Folder CLAUDE.md to Timeline Format
|
||||
|
||||
## Goal
|
||||
|
||||
Replace the simple table format in folder-level CLAUDE.md files with the timeline format used by search results.
|
||||
|
||||
## Current vs Target Format
|
||||
|
||||
### Current Format (Simple)
|
||||
```markdown
|
||||
# Recent Activity
|
||||
|
||||
### Recent
|
||||
|
||||
| Time | Type | Title |
|
||||
|------|------|-------|
|
||||
| 6:33pm | feature | Multiple CLAUDE.md files generated |
|
||||
| 6:32pm | feature | CLAUDE.md file successfully generated |
|
||||
```
|
||||
|
||||
### Target Format (Timeline)
|
||||
```markdown
|
||||
# Recent Activity
|
||||
|
||||
### Jan 4, 2026
|
||||
|
||||
**src/services/worker/agents/ResponseProcessor.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37110 | 6:35 PM | 🔴 | Folder CLAUDE.md updates moved from summary | ~85 |
|
||||
| #37109 | " | ✅ | ResponseProcessor.ts modified | ~92 |
|
||||
|
||||
**General**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37108 | 6:33 PM | 🟣 | Multiple CLAUDE.md files generated | ~78 |
|
||||
```
|
||||
|
||||
## Key Changes
|
||||
|
||||
1. **Group by date** - Use `### Jan 4, 2026` instead of `### Recent`
|
||||
2. **Group by file within each date** - Add `**filename**` headers
|
||||
3. **Expand columns** - Add ID and Read columns: `| ID | Time | T | Title | Read |`
|
||||
4. **Use type emojis** - Use `🔴` `🟣` `✅` etc. instead of text
|
||||
5. **Show ditto marks** - Use `"` for repeated times
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Refactor formatTimelineForClaudeMd
|
||||
|
||||
**File:** `src/utils/claude-md-utils.ts`
|
||||
|
||||
**Tasks:**
|
||||
|
||||
1. Add imports from shared utilities:
|
||||
```typescript
|
||||
import { formatDate, formatTime, extractFirstFile, estimateTokens, groupByDate } from '../shared/timeline-formatting.js';
|
||||
import { ModeManager } from '../services/domain/ModeManager.js';
|
||||
```
|
||||
|
||||
2. Replace `formatTimelineForClaudeMd()` (lines 78-151) with new implementation that:
|
||||
- Parses API response to extract full observation data (id, time, type emoji, title, files)
|
||||
- Groups observations by date using `groupByDate()`
|
||||
- Within each date, groups by file using a Map
|
||||
- Renders file sections with `**filename**` headers
|
||||
- Uses search table format: `| ID | Time | T | Title | Read |`
|
||||
- Uses ditto marks for repeated times
|
||||
|
||||
**Pattern to Copy From:** `src/services/worker/search/ResultFormatter.ts` lines 56-108
|
||||
|
||||
**Key APIs:**
|
||||
- `groupByDate(items, getDate)` - from `src/shared/timeline-formatting.ts:104-127`
|
||||
- `formatTime(epoch)` - from `src/shared/timeline-formatting.ts:46-53`
|
||||
- `formatDate(epoch)` - from `src/shared/timeline-formatting.ts:59-66`
|
||||
- `extractFirstFile(filesModified, cwd)` - from `src/shared/timeline-formatting.ts:81-84`
|
||||
- `estimateTokens(text)` - from `src/shared/timeline-formatting.ts:89-92`
|
||||
- `ModeManager.getInstance().getTypeIcon(type)` - from `src/services/domain/ModeManager.ts`
|
||||
|
||||
**Verification:**
|
||||
1. Run `npm run build` - no errors
|
||||
2. Restart worker: `npm run worker:restart`
|
||||
3. Make a test edit to trigger observation
|
||||
4. Check generated CLAUDE.md files for new format
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Parse Full Observation Data from API
|
||||
|
||||
**Context:** The current regex parsing extracts only time, type emoji, and title. Need to also extract:
|
||||
- Observation ID (for `#123` column)
|
||||
- File path (from files_modified in API response, for grouping)
|
||||
- Token estimate (for `Read` column)
|
||||
|
||||
**Challenge:** The current API returns formatted text, not structured data. We need to:
|
||||
1. Parse the existing text format more thoroughly, OR
|
||||
2. Use a different API endpoint that returns JSON
|
||||
|
||||
**Decision Point:** Check what data the `/api/search/by-file` endpoint returns. If it returns structured JSON with observations, use that. Otherwise, enhance parsing.
|
||||
|
||||
**Investigation Required:**
|
||||
- Read `src/services/worker/http/routes/SearchRoutes.ts` to see by-file response format
|
||||
- Determine if we can access raw observation data or just formatted text
|
||||
|
||||
**Verification:**
|
||||
- Confirm API response structure
|
||||
- Update parsing to extract all needed fields
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Integrate File-Based Grouping
|
||||
|
||||
**File:** `src/utils/claude-md-utils.ts`
|
||||
|
||||
**Tasks:**
|
||||
|
||||
1. Create helper to group by file:
|
||||
```typescript
|
||||
function groupByFile(observations: ParsedObservation[]): Map<string, ParsedObservation[]> {
|
||||
const byFile = new Map<string, ParsedObservation[]>();
|
||||
for (const obs of observations) {
|
||||
const file = obs.file || 'General';
|
||||
if (!byFile.has(file)) byFile.set(file, []);
|
||||
byFile.get(file)!.push(obs);
|
||||
}
|
||||
return byFile;
|
||||
}
|
||||
```
|
||||
|
||||
2. Render with file sections:
|
||||
```typescript
|
||||
for (const [file, fileObs] of resultsByFile) {
|
||||
lines.push(`**${file}**`);
|
||||
lines.push(`| ID | Time | T | Title | Read |`);
|
||||
lines.push(`|----|------|---|-------|------|`);
|
||||
// render rows with ditto marks
|
||||
}
|
||||
```
|
||||
|
||||
**Pattern to Copy From:** `ResultFormatter.formatSearchResults()` lines 60-108
|
||||
|
||||
**Verification:**
|
||||
- Generated CLAUDE.md shows file grouping
|
||||
- Files are displayed as relative paths when possible
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Final Verification
|
||||
|
||||
**Checklist:**
|
||||
|
||||
1. **Build passes:** `npm run build`
|
||||
2. **Worker restarts cleanly:** `npm run worker:restart`
|
||||
3. **Format matches target:**
|
||||
- Date headers: `### Jan 4, 2026`
|
||||
- File sections: `**filename**`
|
||||
- Table columns: `| ID | Time | T | Title | Read |`
|
||||
- Type emojis: `🔴` `🟣` `✅` not text
|
||||
- Ditto marks: `"` for repeated times
|
||||
4. **Anti-pattern checks:**
|
||||
- No hardcoded type maps (use ModeManager)
|
||||
- No invented APIs
|
||||
- Reuses existing formatters from shared utils
|
||||
5. **Graceful degradation:** Empty results still show `*No recent activity*`
|
||||
|
||||
---
|
||||
|
||||
## Files to Modify
|
||||
|
||||
| File | Change |
|
||||
|------|--------|
|
||||
| `src/utils/claude-md-utils.ts` | Replace `formatTimelineForClaudeMd()` with timeline format |
|
||||
|
||||
## Files to Read (Patterns to Copy)
|
||||
|
||||
| File | Pattern |
|
||||
|------|---------|
|
||||
| `src/services/worker/search/ResultFormatter.ts:56-108` | Date/file grouping logic |
|
||||
| `src/shared/timeline-formatting.ts` | All formatting utilities |
|
||||
| `src/services/domain/ModeManager.ts` | Type icon lookup |
|
||||
|
||||
## Anti-Patterns to Avoid
|
||||
|
||||
- ❌ Creating new hardcoded type→emoji maps (use ModeManager)
|
||||
- ❌ Parsing dates manually (use shared formatters)
|
||||
- ❌ Skipping the existing groupByDate utility
|
||||
- ❌ Not handling ditto marks for repeated times
|
||||
@@ -1,144 +0,0 @@
|
||||
# Plan: Address PR #610 Review Issues
|
||||
|
||||
## Overview
|
||||
This plan addresses the issues identified in the PR review for PR #610 "fix: Update hooks for Claude Code 2.1.0/1 - SessionStart no longer shows user messages".
|
||||
|
||||
## Phase 0: Verification and Discovery
|
||||
|
||||
### 0.1 Verify Test Failure
|
||||
- **File**: `tests/hook-constants.test.ts`
|
||||
- **Issue**: Lines 61-63 test for `HOOK_EXIT_CODES.USER_MESSAGE_ONLY` which was removed
|
||||
- **Verification**: Run `bun test tests/hook-constants.test.ts` to confirm failure
|
||||
|
||||
### 0.2 Verify No Code References USER_MESSAGE_ONLY
|
||||
- **Finding**: Grep found references only in:
|
||||
- `tests/hook-constants.test.ts` (test file - needs fix)
|
||||
- `src/services/CLAUDE.md` (memory context - auto-generated, not code)
|
||||
- `plugin/scripts/CLAUDE.md` (memory context - auto-generated, not code)
|
||||
- **Conclusion**: Only the test file needs updating; CLAUDE.md files are memory records
|
||||
|
||||
### 0.3 Verify CLAUDE.md Files Are Legitimate
|
||||
- **Clarification**: The PR reviewer mentioned "user-specific CLAUDE.md files starting with ~/"
|
||||
- **Finding**: All CLAUDE.md files in the commit are within the repository (`docs/`, `src/`, `plugin/`)
|
||||
- **Conclusion**: These are legitimate in-repo context files, not user-specific paths
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Fix Test File (REQUIRED)
|
||||
|
||||
### Task 1.1: Remove USER_MESSAGE_ONLY Test
|
||||
**File**: `tests/hook-constants.test.ts`
|
||||
**Action**: Delete lines 61-63 that test for the removed constant
|
||||
|
||||
```typescript
|
||||
// DELETE THESE LINES:
|
||||
it('should define USER_MESSAGE_ONLY exit code', () => {
|
||||
expect(HOOK_EXIT_CODES.USER_MESSAGE_ONLY).toBe(3);
|
||||
});
|
||||
```
|
||||
|
||||
### Task 1.2: Add Test for BLOCKING_ERROR
|
||||
**File**: `tests/hook-constants.test.ts`
|
||||
**Action**: Add test for the new `BLOCKING_ERROR` constant (exit code 2) that replaced it
|
||||
|
||||
```typescript
|
||||
// ADD THIS TEST:
|
||||
it('should define BLOCKING_ERROR exit code', () => {
|
||||
expect(HOOK_EXIT_CODES.BLOCKING_ERROR).toBe(2);
|
||||
});
|
||||
```
|
||||
|
||||
### Verification
|
||||
- Run `bun test tests/hook-constants.test.ts`
|
||||
- Expect: All tests pass
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Documentation Consistency (NICE TO HAVE)
|
||||
|
||||
### Issue
|
||||
Three similar notes about Claude Code 2.1.0 have slightly different wording:
|
||||
|
||||
1. `docs/public/architecture/hooks.mdx:254`:
|
||||
> "SessionStart hooks no longer display any user-visible messages. Context is still injected via `hookSpecificOutput.additionalContext` but users don't see startup output in the UI."
|
||||
|
||||
2. `docs/public/hooks-architecture.mdx:31`:
|
||||
> "SessionStart hooks no longer display any user-visible messages. Context is silently injected via `hookSpecificOutput.additionalContext`."
|
||||
|
||||
3. `docs/public/hooks-architecture.mdx:441`:
|
||||
> "SessionStart hooks output is never displayed to users. Context is injected silently via `hookSpecificOutput.additionalContext`."
|
||||
|
||||
### Task 2.1: Standardize Note Wording
|
||||
**Action**: Use consistent wording across all three locations
|
||||
|
||||
**Standard text**:
|
||||
```
|
||||
As of Claude Code 2.1.0 (ultrathink update), SessionStart hooks no longer display user-visible messages. Context is silently injected via `hookSpecificOutput.additionalContext`.
|
||||
```
|
||||
|
||||
### Files to Update
|
||||
1. `docs/public/architecture/hooks.mdx:253-255` - Update Note block
|
||||
2. `docs/public/hooks-architecture.mdx:30-32` - Update Note block
|
||||
3. `docs/public/hooks-architecture.mdx:440-442` - Update Note block
|
||||
|
||||
### Verification
|
||||
- Grep for the standard text in all three files
|
||||
- Visual review of documentation
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Code Quality Improvements (OPTIONAL)
|
||||
|
||||
### Issue 3.1: Hardcoded Promotional Message
|
||||
**File**: `src/hooks/context-hook.ts:66-68`
|
||||
**Current code**:
|
||||
```typescript
|
||||
const enhancedContext = `${text}
|
||||
|
||||
Access 300k tokens of past research & decisions for just 19,008t. Use MCP search tools to access memories by ID.`;
|
||||
```
|
||||
|
||||
### Options
|
||||
1. **Leave as-is**: The token count is a rough estimate and doesn't need to be exact
|
||||
2. **Make configurable**: Add to settings (over-engineering for this use case)
|
||||
3. **Remove hardcoded numbers**: Use relative language instead
|
||||
|
||||
### Recommendation
|
||||
Leave as-is for now. The token counts are marketing copy, not critical functionality. Creating a PR just for this adds unnecessary complexity.
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Final Verification
|
||||
|
||||
### 4.1 Run Full Test Suite
|
||||
```bash
|
||||
bun test
|
||||
```
|
||||
|
||||
### 4.2 Build Verification
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 4.3 Grep Verification
|
||||
```bash
|
||||
grep -r "USER_MESSAGE_ONLY" src/ --include="*.ts" --include="*.js"
|
||||
```
|
||||
Expected: No results (CLAUDE.md files excluded as they're memory records)
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Priority | Effort | Description |
|
||||
|-------|----------|--------|-------------|
|
||||
| 1 | REQUIRED | 5 min | Fix test file - remove USER_MESSAGE_ONLY test, add BLOCKING_ERROR test |
|
||||
| 2 | Nice to have | 10 min | Standardize documentation note wording |
|
||||
| 3 | Skip | - | Hardcoded token counts are fine as-is |
|
||||
| 4 | REQUIRED | 5 min | Run tests and build to verify |
|
||||
|
||||
## Expected Outcome
|
||||
- All tests pass
|
||||
- Build succeeds
|
||||
- No code references to removed USER_MESSAGE_ONLY constant
|
||||
- Documentation uses consistent wording (if Phase 2 is done)
|
||||
@@ -1,223 +0,0 @@
|
||||
# Plan: PR #628 Polish Items
|
||||
|
||||
**PR**: #628 - Windows Terminal Tab Accumulation & Windows 11 Compatibility
|
||||
**Status**: APPROVED by 3 reviewers with minor suggestions
|
||||
**Branch**: `feature/no-more-hook-files`
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (Completed by Orchestrator)
|
||||
|
||||
### Allowed APIs and Patterns
|
||||
|
||||
**Exit Code Constants** - `src/shared/hook-constants.ts:18-23`:
|
||||
```typescript
|
||||
export const HOOK_EXIT_CODES = {
|
||||
SUCCESS: 0,
|
||||
FAILURE: 1,
|
||||
BLOCKING_ERROR: 2,
|
||||
} as const;
|
||||
```
|
||||
|
||||
**Timeout Constants** - `src/shared/hook-constants.ts:1-8`:
|
||||
```typescript
|
||||
export const HOOK_TIMEOUTS = {
|
||||
DEFAULT: 300000,
|
||||
HEALTH_CHECK: 30000,
|
||||
WORKER_STARTUP_WAIT: 1000,
|
||||
WORKER_STARTUP_RETRIES: 300,
|
||||
PRE_RESTART_SETTLE_DELAY: 2000,
|
||||
WINDOWS_MULTIPLIER: 1.5
|
||||
} as const;
|
||||
```
|
||||
|
||||
**Platform Timeout Function** - `src/services/infrastructure/ProcessManager.ts:70-73`:
|
||||
```typescript
|
||||
export function getPlatformTimeout(baseMs: number): number {
|
||||
const WINDOWS_MULTIPLIER = 2.0;
|
||||
return process.platform === 'win32' ? Math.round(baseMs * WINDOWS_MULTIPLIER) : baseMs;
|
||||
}
|
||||
```
|
||||
|
||||
**Migration Guide Pattern** - `docs/public/architecture/pm2-to-bun-migration.mdx`:
|
||||
- Uses MDX format with frontmatter
|
||||
- Starts with `<Note>` for historical context
|
||||
- Uses `<AccordionGroup>` for before/after comparisons
|
||||
- Includes executive summary, key benefits, migration impact sections
|
||||
|
||||
**Exit Code Documentation** - `private/context/claude-code/exit-codes.md`:
|
||||
- Defines exit code 0, 2, and other behaviors
|
||||
- Per-hook event behavior table
|
||||
|
||||
### Files to Modify
|
||||
|
||||
| File | Change | Lines |
|
||||
|------|--------|-------|
|
||||
| `src/services/infrastructure/ProcessManager.ts` | Add POWERSHELL_TIMEOUT constant, reduce from 60000 to 10000 | 93, 123, 175, 241 |
|
||||
| `src/shared/hook-constants.ts` | Add POWERSHELL_TIMEOUT constant | After line 8 |
|
||||
| `CLAUDE.md` | Document exit code strategy | Architecture section |
|
||||
|
||||
### Anti-Patterns to Avoid
|
||||
|
||||
- DO NOT invent new exit code values (only 0, 1, 2 exist)
|
||||
- DO NOT change Windows multiplier (1.5x in hooks, 2.0x in ProcessManager - they serve different purposes)
|
||||
- DO NOT add upper bound PID validation (not in existing pattern, reviewers marked as "nice to have")
|
||||
- DO NOT create migration guide for Cursor (shell scripts still exist in cursor-hooks/, not removed)
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Extract PowerShell Timeout Constant
|
||||
|
||||
### What to Implement
|
||||
|
||||
Add a `POWERSHELL_TIMEOUT` constant to centralize the magic number `60000` and reduce to `10000` (10 seconds) as recommended by reviewers.
|
||||
|
||||
### Documentation References
|
||||
|
||||
1. Copy constant pattern from `src/shared/hook-constants.ts:1-8`
|
||||
2. Copy usage pattern from `src/services/infrastructure/ProcessManager.ts:93`
|
||||
|
||||
### Implementation Steps
|
||||
|
||||
1. **Add constant to hook-constants.ts** after line 8:
|
||||
```typescript
|
||||
POWERSHELL_COMMAND: 10000, // PowerShell process enumeration (10s - typically completes in <1s)
|
||||
```
|
||||
|
||||
2. **Import and use in ProcessManager.ts**:
|
||||
- Import `HOOK_TIMEOUTS` from `../../shared/hook-constants.js`
|
||||
- Replace `{ timeout: 60000 }` with `{ timeout: HOOK_TIMEOUTS.POWERSHELL_COMMAND }` at lines 93, 123, 175, 241
|
||||
|
||||
### Verification Checklist
|
||||
|
||||
- [ ] `grep -n "60000" src/services/infrastructure/ProcessManager.ts` returns 0 matches
|
||||
- [ ] `grep -n "POWERSHELL_COMMAND" src/services/infrastructure/ProcessManager.ts` returns 4 matches
|
||||
- [ ] `npm run build` succeeds
|
||||
- [ ] `npm test` passes (22/22 PowerShell tests still pass)
|
||||
|
||||
### Anti-Pattern Guards
|
||||
|
||||
- DO NOT use `getPlatformTimeout()` for PowerShell commands (they already run only on Windows)
|
||||
- DO NOT change timeout values in other files (only ProcessManager.ts uses PowerShell)
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Document Exit Code Strategy in CLAUDE.md
|
||||
|
||||
### What to Implement
|
||||
|
||||
Add an "Exit Code Strategy" section to the main CLAUDE.md to explain the graceful exit philosophy adopted in this PR.
|
||||
|
||||
### Documentation References
|
||||
|
||||
1. Copy exit code definitions from `private/context/claude-code/exit-codes.md`
|
||||
2. Follow format of existing CLAUDE.md sections
|
||||
|
||||
### Implementation Steps
|
||||
|
||||
1. **Add section after "File Locations"** in `/Users/alexnewman/Scripts/claude-mem/CLAUDE.md`:
|
||||
|
||||
```markdown
|
||||
## Exit Code Strategy
|
||||
|
||||
Claude-mem hooks use specific exit codes per Claude Code's hook contract:
|
||||
|
||||
- **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. ERROR-level logging is maintained for diagnostics.
|
||||
|
||||
See `private/context/claude-code/exit-codes.md` for full hook behavior matrix.
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
|
||||
- [ ] `grep -n "Exit Code Strategy" CLAUDE.md` returns 1 match
|
||||
- [ ] Section appears after "File Locations" section
|
||||
- [ ] No duplicate sections added
|
||||
|
||||
### Anti-Pattern Guards
|
||||
|
||||
- DO NOT copy the full exit-codes.md table (keep it brief, reference the source)
|
||||
- DO NOT change actual exit code behavior in code files
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Update Tests for New Timeout Constant
|
||||
|
||||
### What to Implement
|
||||
|
||||
Add test coverage for the new `POWERSHELL_COMMAND` timeout constant.
|
||||
|
||||
### Documentation References
|
||||
|
||||
1. Copy test pattern from `tests/hook-constants.test.ts:26-48`
|
||||
|
||||
### Implementation Steps
|
||||
|
||||
1. **Add test to hook-constants.test.ts** after line 42:
|
||||
```typescript
|
||||
test('POWERSHELL_COMMAND timeout is 10000ms', () => {
|
||||
expect(HOOK_TIMEOUTS.POWERSHELL_COMMAND).toBe(10000);
|
||||
});
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
|
||||
- [ ] `npm test -- tests/hook-constants.test.ts` passes
|
||||
- [ ] New test appears in test output
|
||||
- [ ] All 22 PowerShell parsing tests still pass
|
||||
|
||||
### Anti-Pattern Guards
|
||||
|
||||
- DO NOT modify PowerShell parsing tests (they test parsing, not timeouts)
|
||||
- DO NOT add integration tests for actual PowerShell execution (out of scope)
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Final Verification
|
||||
|
||||
### Verification Checklist
|
||||
|
||||
1. **Build passes**: `npm run build`
|
||||
2. **All tests pass**: `npm test`
|
||||
3. **No magic numbers remain**: `grep -rn "60000" src/services/infrastructure/ProcessManager.ts` returns 0
|
||||
4. **Exit code documentation exists**: `grep -n "Exit Code Strategy" CLAUDE.md` returns 1
|
||||
5. **Constant is used**: `grep -rn "POWERSHELL_COMMAND" src/` returns multiple matches
|
||||
|
||||
### Anti-Pattern Grep Checks
|
||||
|
||||
- [ ] `grep -rn "timeout: 60000" src/` returns 0 matches (no hardcoded 60s timeouts in ProcessManager)
|
||||
- [ ] `grep -rn "process.exit(3)" src/` returns 0 matches (exit code 3 not used)
|
||||
|
||||
### Commit Message Template
|
||||
|
||||
```
|
||||
polish: extract PowerShell timeout constant and document exit code strategy
|
||||
|
||||
- Extract magic number 60000ms to HOOK_TIMEOUTS.POWERSHELL_COMMAND (10000ms)
|
||||
- Reduce PowerShell timeout from 60s to 10s per review feedback
|
||||
- Document exit code strategy in CLAUDE.md
|
||||
- Add test coverage for new constant
|
||||
|
||||
Addresses review feedback from PR #628
|
||||
|
||||
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Description | Files Changed | Verification |
|
||||
|-------|-------------|---------------|--------------|
|
||||
| 0 | Documentation Discovery | N/A | Patterns identified |
|
||||
| 1 | Extract PowerShell timeout | hook-constants.ts, ProcessManager.ts | grep + build + test |
|
||||
| 2 | Document exit strategy | CLAUDE.md | grep |
|
||||
| 3 | Add test coverage | hook-constants.test.ts | npm test |
|
||||
| 4 | Final verification | N/A | All checks pass |
|
||||
|
||||
**Estimated Changes**: ~20 lines added/modified across 4 files
|
||||
**Risk Level**: Low (constants extraction, documentation only)
|
||||
**Breaking Changes**: None
|
||||
@@ -1,196 +0,0 @@
|
||||
# Plan: Integrate Workflow Agents and Commands into Claude-Mem
|
||||
|
||||
## Executive Summary
|
||||
|
||||
This plan integrates the `/make-plan` and `/do` orchestration workflow from `~/.claude/commands/` into the claude-mem plugin as project-level development tools.
|
||||
|
||||
## Dependency Analysis
|
||||
|
||||
### Commands to Copy (from `~/.claude/commands/`)
|
||||
|
||||
| File | Purpose | Dependencies |
|
||||
|------|---------|--------------|
|
||||
| `make-plan.md` | Orchestrator for LLM-friendly phased planning | Uses Task tool with subagents |
|
||||
| `do.md` | Orchestrator for executing plans via subagents | Uses Task tool with subagents |
|
||||
| `anti-pattern-czar.md` | Error handling anti-pattern detection/fixing | Uses Read, Edit, Bash tools |
|
||||
|
||||
### Specialized Agents Referenced
|
||||
|
||||
The `/make-plan` and `/do` commands reference these **conceptual agent roles** (not actual agent files):
|
||||
|
||||
| Agent Role | Referenced In | Description |
|
||||
|------------|---------------|-------------|
|
||||
| "Documentation Discovery" | make-plan.md | Fact-gathering from docs/examples |
|
||||
| "Verification" | make-plan.md, do.md | Verify implementation matches plan |
|
||||
| "Implementation" | do.md | Execute implementation tasks |
|
||||
| "Anti-pattern" | do.md | Grep for known bad patterns |
|
||||
| "Code Quality" | do.md | Review code changes |
|
||||
| "Commit" | do.md | Commit after verification passes |
|
||||
| "Branch/Sync" | do.md | Push and prepare phase handoffs |
|
||||
|
||||
**Key Finding**: These are **role descriptions**, not separate agent files. The Task tool's `general-purpose` subagent_type executes all roles. The commands define *what* each role should do, not separate agent implementations.
|
||||
|
||||
### Existing Project Assets
|
||||
|
||||
Located in `.claude/`:
|
||||
- `agents/github-morning-reporter.md` - Already in project
|
||||
- `skills/version-bump/SKILL.md` - Already in project
|
||||
- No existing commands directory
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Documentation Discovery (Complete)
|
||||
|
||||
### Sources Consulted
|
||||
1. `/Users/alexnewman/.claude/commands/make-plan.md` (62 lines)
|
||||
2. `/Users/alexnewman/.claude/commands/do.md` (39 lines)
|
||||
3. `/Users/alexnewman/.claude/commands/anti-pattern-czar.md` (122 lines)
|
||||
4. `/Users/alexnewman/.claude/settings.json` (36 lines)
|
||||
5. `.claude/skills/CLAUDE.md` (30 lines)
|
||||
6. `.claude/agents/github-morning-reporter.md` (102 lines)
|
||||
|
||||
### Allowed APIs/Patterns
|
||||
- **Commands**: `.claude/commands/*.md` files with `#$ARGUMENTS` placeholder for user input
|
||||
- **Skills**: `.claude/skills/<name>/SKILL.md` with YAML frontmatter (name, description)
|
||||
- **Agents**: `.claude/agents/*.md` with YAML frontmatter (name, description, model)
|
||||
|
||||
### Anti-Patterns to Avoid
|
||||
- Skills require YAML frontmatter; commands do not
|
||||
- Commands use `#$ARGUMENTS` for input; skills/agents receive prompts differently
|
||||
- Don't create separate agent files for role descriptions - the Task tool handles routing
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Create Commands Directory
|
||||
|
||||
### What to Implement
|
||||
1. Create `.claude/commands/` directory
|
||||
2. Copy `make-plan.md` from `~/.claude/commands/make-plan.md`
|
||||
3. Copy `do.md` from `~/.claude/commands/do.md`
|
||||
4. Copy `anti-pattern-czar.md` from `~/.claude/commands/anti-pattern-czar.md`
|
||||
|
||||
### Documentation References
|
||||
- Pattern: `~/.claude/commands/*.md` (source files)
|
||||
- Existing example: `.claude/skills/version-bump/SKILL.md` for claude-mem project tools
|
||||
|
||||
### Verification Checklist
|
||||
```bash
|
||||
# Verify files exist
|
||||
ls -la .claude/commands/
|
||||
|
||||
# Verify content matches source
|
||||
diff ~/.claude/commands/make-plan.md .claude/commands/make-plan.md
|
||||
diff ~/.claude/commands/do.md .claude/commands/do.md
|
||||
diff ~/.claude/commands/anti-pattern-czar.md .claude/commands/anti-pattern-czar.md
|
||||
|
||||
# Verify #$ARGUMENTS placeholder exists
|
||||
grep '\$ARGUMENTS' .claude/commands/*.md
|
||||
```
|
||||
|
||||
### Anti-Pattern Guards
|
||||
- Do NOT add YAML frontmatter to commands (they don't need it)
|
||||
- Do NOT modify the source content (copy verbatim)
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Create CLAUDE.md Documentation
|
||||
|
||||
### What to Implement
|
||||
Create `.claude/commands/CLAUDE.md` documenting the commands directory (following pattern from `.claude/skills/CLAUDE.md`)
|
||||
|
||||
### Content Template
|
||||
```markdown
|
||||
# Project-Level Commands
|
||||
|
||||
This directory contains slash commands **for developing and maintaining the claude-mem project itself**.
|
||||
|
||||
## Commands in This Directory
|
||||
|
||||
### /make-plan
|
||||
Orchestrator for creating LLM-friendly implementation plans in phases. Deploys subagents for documentation discovery and fact gathering.
|
||||
|
||||
**Usage**: `/make-plan <task description>`
|
||||
|
||||
### /do
|
||||
Orchestrator for executing plans via subagents. Deploys specialized subagents for implementation, verification, and code quality review.
|
||||
|
||||
**Usage**: `/do <plan-file-path or inline plan>`
|
||||
|
||||
### /anti-pattern-czar
|
||||
Interactive workflow for detecting and fixing error handling anti-patterns using the automated scanner.
|
||||
|
||||
**Usage**: `/anti-pattern-czar`
|
||||
|
||||
## Adding New Commands
|
||||
|
||||
Commands are markdown files with `#$ARGUMENTS` placeholder for user input.
|
||||
```
|
||||
|
||||
### Verification Checklist
|
||||
```bash
|
||||
# Verify file exists
|
||||
cat .claude/commands/CLAUDE.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Update Settings (if needed)
|
||||
|
||||
### What to Implement
|
||||
Check if `.claude/settings.json` needs any permission updates for the new commands.
|
||||
|
||||
### Verification Checklist
|
||||
```bash
|
||||
# Check current settings
|
||||
cat .claude/settings.json
|
||||
|
||||
# Verify commands work by listing them
|
||||
# (After Claude Code restart, commands should appear in slash-command list)
|
||||
```
|
||||
|
||||
### Anti-Pattern Guards
|
||||
- Do NOT add skill permissions for commands (they're different)
|
||||
- Commands don't require explicit permissions
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Final Verification
|
||||
|
||||
### Verification Checklist
|
||||
1. All three command files exist in `.claude/commands/`
|
||||
2. Content matches source files exactly (byte-for-byte if possible)
|
||||
3. CLAUDE.md documentation exists
|
||||
4. Git status shows new files ready for commit
|
||||
|
||||
```bash
|
||||
# Full verification
|
||||
ls -la .claude/commands/
|
||||
wc -l .claude/commands/*.md
|
||||
git status
|
||||
```
|
||||
|
||||
### Commit Message Template
|
||||
```
|
||||
feat: add /make-plan, /do, and /anti-pattern-czar workflow commands
|
||||
|
||||
Add project-level orchestration commands for claude-mem development:
|
||||
- /make-plan: Create LLM-friendly implementation plans in phases
|
||||
- /do: Execute plans via coordinated subagents
|
||||
- /anti-pattern-czar: Detect and fix error handling anti-patterns
|
||||
|
||||
These commands enable structured, agent-driven development workflows.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
**Files to Create**:
|
||||
1. `.claude/commands/make-plan.md` (copy from ~/.claude/commands/)
|
||||
2. `.claude/commands/do.md` (copy from ~/.claude/commands/)
|
||||
3. `.claude/commands/anti-pattern-czar.md` (copy from ~/.claude/commands/)
|
||||
4. `.claude/commands/CLAUDE.md` (new documentation)
|
||||
|
||||
**No Agent Files Needed**: The "agents" referenced in make-plan.md and do.md are role descriptions, not separate files. The Task tool's built-in subagent types handle execution.
|
||||
|
||||
**Confidence**: High - analysis complete with full source file reads.
|
||||
@@ -1,22 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38082 | 10:13 PM | ✅ | Merge Conflict Resolution - Kept Feature Branch Versions | ~431 |
|
||||
|
||||
**test-audit-2026-01-05.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37776 | 6:35 PM | 🔵 | Test Audit Reveals Quality Issues and Architecture Recommendations | ~372 |
|
||||
| #37775 | " | 🔵 | Test Audit Identifies Zero Coverage for Logger FormatTool Tests | ~280 |
|
||||
| #37747 | 6:20 PM | 🔵 | Comprehensive Test Suite Audit Completed: 41 Files Analyzed | ~664 |
|
||||
| #37736 | 6:16 PM | 🔵 | Test Suite Audit Reveals Critical Test Failure Root Cause | ~660 |
|
||||
| #37735 | " | ✅ | Test Suite Audit Report Generated: 41 Tests Scored and Analyzed | ~634 |
|
||||
| #37732 | 6:15 PM | 🔵 | Test Quality Audit Completed: Identified Critical Mock Pollution Issue | ~490 |
|
||||
</claude-mem-context>
|
||||
@@ -26,49 +26,4 @@ Manages semantic versioning for the claude-mem project itself. Handles updating
|
||||
## Adding New Skills
|
||||
|
||||
**For claude-mem development** → Add to `.claude/skills/`
|
||||
**For end users** → Add to `plugin/skills/` (gets distributed with plugin)
|
||||
|
||||
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Nov 9, 2025
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #5901 | 6:54 PM | ✅ | Project Skills Documentation Created | ~317 |
|
||||
|
||||
### Dec 13, 2025
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24725 | 4:07 PM | 🔵 | Claude Skills Infrastructure for Automation | ~220 |
|
||||
|
||||
### Dec 14, 2025
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #26354 | 9:20 PM | 🔵 | PR #317 Second CLAUDE.md Compliance Review Confirms No Violations | ~442 |
|
||||
| #26353 | " | 🔵 | PR #317 CLAUDE.md Compliance Review Completed | ~402 |
|
||||
| #26193 | 8:15 PM | 🔵 | PR spans 21 files with net addition of 374 lines across codebase | ~375 |
|
||||
| #26173 | 8:08 PM | ✅ | Updated Skills CLAUDE.md Documentation for Version Bump | ~277 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33311 | 3:09 PM | ✅ | Version 8.2.3 Release Deployed with Worker Stability Improvements | ~434 |
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38082 | 10:13 PM | ✅ | Merge Conflict Resolution - Kept Feature Branch Versions | ~431 |
|
||||
</claude-mem-context>
|
||||
**For end users** → Add to `plugin/skills/` (gets distributed with plugin)
|
||||
@@ -1,21 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 13, 2025
|
||||
|
||||
**feature_request.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25012 | 6:41 PM | 🟣 | Auto-Convert Feature Requests to GitHub Discussions | ~298 |
|
||||
| #25011 | " | ✅ | Staged GitHub Feature Request Automation Files | ~206 |
|
||||
| #25009 | 6:40 PM | ✅ | Feature Request Template Auto-Labeling Configured | ~241 |
|
||||
| #24995 | 6:26 PM | 🔵 | Standard Feature Request Template Configuration | ~260 |
|
||||
|
||||
**bug_report.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24994 | 6:26 PM | 🔵 | Standard Bug Report Template Configuration | ~258 |
|
||||
| #24992 | " | 🔵 | GitHub Issue Templates Located | ~188 |
|
||||
</claude-mem-context>
|
||||
@@ -7,6 +7,12 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Before submitting
|
||||
|
||||
- [ ] I searched [existing issues](https://github.com/thedotmack/claude-mem/issues) and confirmed this is not a duplicate
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Quick Bug Report (Recommended)
|
||||
|
||||
**Use the automated bug report generator** for comprehensive diagnostics:
|
||||
|
||||
@@ -7,6 +7,12 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Before submitting
|
||||
|
||||
- [ ] I searched [existing issues](https://github.com/thedotmack/claude-mem/issues) and confirmed this is not a duplicate
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
*No recent activity*
|
||||
</claude-mem-context>
|
||||
@@ -1,82 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 13, 2025
|
||||
|
||||
**convert-feature-requests.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25022 | 6:48 PM | ✅ | Workflow Fix Committed to Repository | ~289 |
|
||||
| #25021 | " | 🔴 | Fixed Issue Number Reference in Workflow Steps | ~277 |
|
||||
| #25020 | " | 🔴 | Workflow String Interpolation Fixed by Consolidating Steps | ~339 |
|
||||
| #25019 | 6:47 PM | 🔵 | GitHub Workflow Automates Feature Request Triage | ~328 |
|
||||
| #25012 | 6:41 PM | 🟣 | Auto-Convert Feature Requests to GitHub Discussions | ~298 |
|
||||
| #25011 | " | ✅ | Staged GitHub Feature Request Automation Files | ~206 |
|
||||
| #25010 | 6:40 PM | 🟣 | GitHub Action Workflow for Feature Request Auto-Conversion | ~414 |
|
||||
|
||||
**summary.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #25002 | 6:38 PM | 🔵 | AI Summary Workflow for New Issues | ~239 |
|
||||
|
||||
**claude.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24997 | 6:27 PM | 🔵 | Claude Code Action Workflow for Issue and PR Comments | ~242 |
|
||||
| #24727 | 4:08 PM | 🔵 | GitHub Automation Baseline Assessment | ~312 |
|
||||
| #24722 | 4:06 PM | 🔵 | Existing Claude Workflow Trigger Configuration | ~233 |
|
||||
|
||||
**claude-code-review.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24996 | 6:27 PM | 🔵 | Existing GitHub Actions Workflows Identified | ~199 |
|
||||
| #24723 | 4:06 PM | 🔵 | Automated PR Review Workflow Pattern | ~268 |
|
||||
| #24720 | " | 🔵 | GitHub Workflows Inventory | ~142 |
|
||||
|
||||
### Dec 17, 2025
|
||||
|
||||
**issue-list-query**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #28918 | 7:27 PM | 🔵 | Four open issues identified - MCP connection, Bun PATH, web UI path, and endless mode | ~432 |
|
||||
|
||||
**pr-list-query**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #28917 | 7:27 PM | 🔵 | Recent PRs audit reveals comprehensive Windows stabilization and MCP fixes | ~414 |
|
||||
|
||||
**windows-ci.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #28655 | 5:30 PM | ✅ | Windows CI Removal Committed to Repository | ~253 |
|
||||
| #28654 | " | ✅ | Windows CI Workflow File Removed | ~174 |
|
||||
| #28650 | 5:26 PM | ✅ | Committed Windows CI Workflow Simplification | ~213 |
|
||||
| #28649 | " | ✅ | Removed Build and Install Steps from Windows CI | ~278 |
|
||||
| #28648 | " | 🔵 | Windows CI Workflow Includes Build Step | ~288 |
|
||||
| #28644 | 5:24 PM | ✅ | Modified 27 files with 693 additions and 239 deletions for Windows support | ~447 |
|
||||
| #28625 | 5:19 PM | 🟣 | Windows CI Testing Workflow Deployed | ~303 |
|
||||
| #28624 | " | ✅ | Windows CI Workflow File Staged for Commit | ~163 |
|
||||
| #28623 | " | 🔵 | Windows CI Workflow File Present But Untracked | ~178 |
|
||||
| #28622 | 5:18 PM | 🟣 | Windows CI Pipeline with Worker Lifecycle Testing | ~326 |
|
||||
|
||||
### Dec 31, 2025
|
||||
|
||||
**claude-code-review.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34627 | 3:01 PM | 🔵 | Claude Code Review GitHub Action Provides Automated PR Review Integration | ~478 |
|
||||
|
||||
**claude.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34626 | 3:01 PM | 🔵 | Test-Driven Validation Agent Performing Extensive Infrastructure Analysis | ~501 |
|
||||
|
||||
### Jan 6, 2026
|
||||
|
||||
**windows-ci.yml**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38108 | 12:15 AM | 🔵 | Complete Windows Zombie Port Bug Technical Deep Dive | ~935 |
|
||||
</claude-mem-context>
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
actions: read # Required for Claude to read CI results on PRs
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
steps:
|
||||
- name: Get issue details and create discussion
|
||||
id: discussion
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
// Get issue details
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
}
|
||||
|
||||
- name: Comment on issue
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const issueNumber = ${{ steps.discussion.outputs.issue_number }};
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
console.log(`Added comment to issue #${issueNumber}`);
|
||||
|
||||
- name: Close and lock issue
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const issueNumber = ${{ steps.discussion.outputs.issue_number }};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Deploy Install Scripts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'openclaw/install.sh'
|
||||
- 'install/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Copy install scripts to deploy directory
|
||||
run: |
|
||||
mkdir -p install/public
|
||||
cp openclaw/install.sh install/public/openclaw.sh
|
||||
|
||||
- name: Deploy to Vercel
|
||||
uses: amondnet/vercel-action@v25
|
||||
with:
|
||||
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
||||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
||||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
vercel-args: '--prod'
|
||||
working-directory: ./install
|
||||
@@ -0,0 +1,21 @@
|
||||
name: Publish to npm
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: npm install --ignore-scripts
|
||||
- run: npm run build
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -14,11 +14,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Run AI inference
|
||||
id: inference
|
||||
uses: actions/ai-inference@v1
|
||||
uses: actions/ai-inference@v2
|
||||
with:
|
||||
prompt: |
|
||||
Summarize the following GitHub issue in one paragraph:
|
||||
|
||||
+8
-1
@@ -1,6 +1,7 @@
|
||||
datasets/
|
||||
node_modules/
|
||||
dist/
|
||||
!installer/dist/
|
||||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
@@ -11,12 +12,15 @@ dist/
|
||||
.claude/settings.local.json
|
||||
.claude/agents/
|
||||
.claude/skills/
|
||||
.claude/plans/
|
||||
.claude/worktrees/
|
||||
plugin/data/
|
||||
plugin/data.backup/
|
||||
package-lock.json
|
||||
bun.lock
|
||||
private/
|
||||
datasets/
|
||||
Auto Run Docs/
|
||||
|
||||
# Generated UI files (built from viewer-template.html)
|
||||
src/ui/viewer.html
|
||||
@@ -30,4 +34,7 @@ src/ui/viewer.html
|
||||
|
||||
# Prevent other malformed path directories
|
||||
http*/
|
||||
https*/
|
||||
https*/
|
||||
|
||||
# Ignore WebStorm project files (for dinosaur IDE users)
|
||||
.idea/
|
||||
|
||||
+858
-708
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
@@ -14,12 +22,14 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="docs/i18n/README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="docs/i18n/README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="docs/i18n/README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="docs/i18n/README.pt.md">🇵🇹 Português</a> •
|
||||
<a href="docs/i18n/README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="docs/i18n/README.ko.md">🇰🇷 한국어</a> •
|
||||
<a href="docs/i18n/README.es.md">🇪🇸 Español</a> •
|
||||
<a href="docs/i18n/README.de.md">🇩🇪 Deutsch</a> •
|
||||
<a href="docs/i18n/README.fr.md">🇫🇷 Français</a>
|
||||
<a href="docs/i18n/README.fr.md">🇫🇷 Français</a> •
|
||||
<a href="docs/i18n/README.he.md">🇮🇱 עברית</a> •
|
||||
<a href="docs/i18n/README.ar.md">🇸🇦 العربية</a> •
|
||||
<a href="docs/i18n/README.ru.md">🇷🇺 Русский</a> •
|
||||
@@ -29,10 +39,12 @@
|
||||
<a href="docs/i18n/README.tr.md">🇹🇷 Türkçe</a> •
|
||||
<a href="docs/i18n/README.uk.md">🇺🇦 Українська</a> •
|
||||
<a href="docs/i18n/README.vi.md">🇻🇳 Tiếng Việt</a> •
|
||||
<a href="docs/i18n/README.tl.md">🇵🇭 Tagalog</a> •
|
||||
<a href="docs/i18n/README.id.md">🇮🇩 Indonesia</a> •
|
||||
<a href="docs/i18n/README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="docs/i18n/README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="docs/i18n/README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="docs/i18n/README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="docs/i18n/README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="docs/i18n/README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="docs/i18n/README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -101,13 +113,25 @@
|
||||
Start a new Claude Code session in the terminal and enter the following commands:
|
||||
|
||||
```
|
||||
> /plugin marketplace add thedotmack/claude-mem
|
||||
/plugin marketplace add thedotmack/claude-mem
|
||||
|
||||
> /plugin install claude-mem
|
||||
/plugin install claude-mem
|
||||
```
|
||||
|
||||
Restart Claude Code. Context from previous sessions will automatically appear in new sessions.
|
||||
|
||||
> **Note:** Claude-Mem is also published on npm, but `npm install -g claude-mem` installs the **SDK/library only** — it does not register the plugin hooks or set up the worker service. To use Claude-Mem as a plugin, always install via the `/plugin` commands above.
|
||||
|
||||
### 🦞 OpenClaw Gateway
|
||||
|
||||
Install claude-mem as a persistent memory plugin on [OpenClaw](https://openclaw.ai) gateways with a single command:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://install.cmem.ai/openclaw.sh | bash
|
||||
```
|
||||
|
||||
The installer handles dependencies, plugin setup, AI provider configuration, worker startup, and optional real-time observation feeds to Telegram, Discord, Slack, and more. See the [OpenClaw Integration Guide](https://docs.claude-mem.ai/openclaw-integration) for details.
|
||||
|
||||
**Key Features:**
|
||||
|
||||
- 🧠 **Persistent Memory** - Context survives across sessions
|
||||
@@ -125,7 +149,7 @@ Restart Claude Code. Context from previous sessions will automatically appear in
|
||||
|
||||
## Documentation
|
||||
|
||||
📚 **[View Full Documentation](docs/)** - Browse markdown docs on GitHub
|
||||
📚 **[View Full Documentation](https://docs.claude-mem.ai/)** - Browse on official website
|
||||
|
||||
### Getting Started
|
||||
|
||||
@@ -194,7 +218,6 @@ Claude-Mem provides intelligent memory search through **4 MCP tools** following
|
||||
1. **`search`** - Search memory index with full-text queries, filters by type/date/project
|
||||
2. **`timeline`** - Get chronological context around a specific observation or query
|
||||
3. **`get_observations`** - Fetch full observation details by IDs (always batch multiple IDs)
|
||||
4. **`__IMPORTANT`** - Workflow documentation (always visible to Claude)
|
||||
|
||||
**Example Usage:**
|
||||
|
||||
@@ -228,6 +251,17 @@ See **[Beta Features Documentation](https://docs.claude-mem.ai/beta-features)**
|
||||
- **uv**: Python package manager for vector search (auto-installed if missing)
|
||||
- **SQLite 3**: For persistent storage (bundled)
|
||||
|
||||
---
|
||||
### Windows Setup Notes
|
||||
|
||||
If you see an error like:
|
||||
|
||||
```powershell
|
||||
npm : The term 'npm' is not recognized as the name of a cmdlet
|
||||
```
|
||||
|
||||
Make sure Node.js and npm are installed and added to your PATH. Download the latest Node.js installer from https://nodejs.org and restart your terminal after installation.
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
@@ -299,6 +333,8 @@ See the [LICENSE](LICENSE) file for full details.
|
||||
- **Documentation**: [docs/](docs/)
|
||||
- **Issues**: [GitHub Issues](https://github.com/thedotmack/claude-mem/issues)
|
||||
- **Repository**: [github.com/thedotmack/claude-mem](https://github.com/thedotmack/claude-mem)
|
||||
- **Official X Account**: [@Claude_Memory](https://x.com/Claude_Memory)
|
||||
- **Official Discord**: [Join Discord](https://discord.com/invite/J4wttp9vDu)
|
||||
- **Author**: Alex Newman ([@thedotmack](https://github.com/thedotmack))
|
||||
|
||||
---
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 29, 2025
|
||||
|
||||
**save-file-edit.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34270 | 10:45 PM | 🔵 | Save File Edit Hook Captures File Modifications as Tool Observations | ~495 |
|
||||
|
||||
**session-summary.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34268 | 10:44 PM | 🔵 | Session Summary Hook Generates Summaries and Updates Context on Stop | ~498 |
|
||||
|
||||
**save-observation.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34267 | 10:44 PM | 🔵 | Save Observation Hook Captures MCP and Shell Executions | ~494 |
|
||||
|
||||
**context-inject.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34266 | 10:44 PM | 🔵 | Context Inject Hook Refreshes Memory Context Before Prompt Submission | ~498 |
|
||||
| #34165 | 9:41 PM | 🔵 | Context Injection Hook Implementation for Cursor | ~466 |
|
||||
|
||||
**session-init.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34264 | 10:43 PM | 🔵 | Session Init Hook Initializes Sessions on Prompt Submission | ~514 |
|
||||
|
||||
**common.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34261 | 10:43 PM | 🔵 | Cursor Hooks Common Shell Library Provides Core Utilities | ~381 |
|
||||
| #34237 | 10:31 PM | 🔄 | Removed arbitrary array index validation from json_get function | ~421 |
|
||||
|
||||
**STANDALONE-SETUP.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34258 | 10:39 PM | ✅ | Updated STANDALONE-SETUP.md to recommend user-level installation | ~265 |
|
||||
| #34257 | " | 🔵 | Claude-Mem Command Reference for Cursor Integration | ~245 |
|
||||
| #34256 | " | ✅ | Updated STANDALONE-SETUP.md to recommend user-level installation | ~305 |
|
||||
| #34252 | 10:38 PM | 🔵 | Cursor Hooks Installation and Worker Setup Process | ~258 |
|
||||
| #34224 | 10:14 PM | ✅ | Completed Bun Migration by Updating All Windows Commands | ~392 |
|
||||
| #34223 | " | ✅ | Updated Windows Installation Commands to Use Bun | ~354 |
|
||||
| #34222 | 10:13 PM | ✅ | Updated Quick Reference Table to Use Bun Commands | ~361 |
|
||||
| #34221 | " | ✅ | Updated Step 5 Status Check Command to Use Bun | ~353 |
|
||||
| #34220 | " | ✅ | Updated Step 4 Worker Start Command to Use Bun | ~360 |
|
||||
| #34219 | 10:12 PM | ✅ | Updated Step 3 Hook Installation Commands to Use Bun | ~322 |
|
||||
| #34218 | " | ✅ | Updated STANDALONE-SETUP Step 1 Commands to Use Bun Instead of NPM | ~357 |
|
||||
| #34217 | " | ✅ | Updated STANDALONE-SETUP Prerequisites to Require Bun Runtime | ~341 |
|
||||
| #34215 | 10:08 PM | 🔵 | Retrieved Detailed Cursor Integration Implementation History | ~676 |
|
||||
| #34214 | 10:07 PM | 🔵 | Cursor Integration Feature Set Discovered via Memory Search | ~427 |
|
||||
|
||||
**QUICKSTART.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34255 | 10:39 PM | ✅ | Quickstart Documentation Reordered to Recommend User-Level Installation First | ~265 |
|
||||
| #34251 | 10:38 PM | 🔵 | Quickstart Documentation Shows CLI-Based Installation Method | ~257 |
|
||||
| #34225 | 10:14 PM | ✅ | Updated QUICKSTART Worker Restart Command to Use Bun | ~308 |
|
||||
|
||||
**README.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34254 | 10:38 PM | ✅ | Updated README to recommend user-level installation over project-level | ~345 |
|
||||
| #34253 | " | 🔵 | Cursor hooks installation documented with quick install CLI and manual options | ~327 |
|
||||
| #34250 | " | 🔵 | Documentation references installation types and project-level concepts | ~311 |
|
||||
| #34226 | 10:14 PM | ✅ | Updated README Quick Install Commands to Use Bun | ~311 |
|
||||
|
||||
**install.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34249 | 10:37 PM | ✅ | Install Script Usage Message Updated to Recommend User-Level Installation | ~256 |
|
||||
| #34248 | " | ✅ | Marked user-level installation as recommended in install script | ~255 |
|
||||
| #34246 | " | ✅ | Simplified path rewriting logic after enterprise mode removal | ~291 |
|
||||
| #34245 | " | ✅ | Simplified conditional logic after removing enterprise installation code | ~266 |
|
||||
| #34244 | 10:36 PM | ✅ | Removed enterprise installation mode from cursor-hooks installer | ~298 |
|
||||
| #34243 | " | ✅ | Removed enterprise installation option from Cursor hooks installer | ~292 |
|
||||
| #34242 | " | 🔵 | Cursor hooks installation script copies and configures hooks with path adjustments | ~387 |
|
||||
| #34240 | 10:33 PM | 🔵 | Cursor hooks installation paths and requirements vary by deployment mode | ~312 |
|
||||
| #34239 | " | 🔵 | Cursor hooks installation supports enterprise mode | ~240 |
|
||||
| #34233 | 10:26 PM | ⚖️ | Implemented PR 493 fixes with mixed necessity and complexity trade-offs | ~610 |
|
||||
| #34232 | " | 🔵 | PR 493 review identified security and concurrency issues requiring fixes | ~560 |
|
||||
| #34228 | 10:21 PM | 🔴 | Fixed sed portability issue in install.sh | ~318 |
|
||||
|
||||
**common.ps1**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34238 | 10:31 PM | 🔄 | Rollback complete: simplified over-engineered concurrency and validation code | ~434 |
|
||||
| #34231 | 10:25 PM | 🔴 | Fixed race conditions and security vulnerabilities in Cursor integration | ~562 |
|
||||
|
||||
**hooks.json**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34184 | 9:51 PM | 🔵 | Cursor Hooks Configuration Schema | ~375 |
|
||||
|
||||
### Dec 31, 2025
|
||||
|
||||
**session-init.sh**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34675 | 3:37 PM | 🔵 | API Endpoint /api/sessions/init Expects contentSessionId Parameter | ~401 |
|
||||
|
||||
### 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 |
|
||||
|
||||
**INTEGRATION.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37995 | 9:01 PM | 🔵 | CLAUDE_MEM_WORKER_HOST setting implementation pattern | ~304 |
|
||||
|
||||
**README.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37990 | 9:00 PM | 🔵 | CLAUDE_MEM_WORKER_HOST setting used across 19 files | ~289 |
|
||||
|
||||
### Jan 7, 2026
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38195 | 7:35 PM | ✅ | Context-hook enhanced with promotional footer and user-message-hook removed from SessionStart | ~376 |
|
||||
| #38194 | " | 🔵 | Working tree contains 10 modified files ready for commit | ~303 |
|
||||
</claude-mem-context>
|
||||
+77
-1
@@ -3,5 +3,81 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
*No recent activity*
|
||||
### Nov 6, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #4241 | 11:19 PM | 🟣 | Object-Oriented Architecture Design Document Created | ~662 |
|
||||
| #4240 | 11:11 PM | 🟣 | Worker Service Rewrite Blueprint Created | ~541 |
|
||||
| #4239 | 11:07 PM | 🟣 | Comprehensive Worker Service Performance Analysis Document Created | ~541 |
|
||||
| #4238 | 10:59 PM | 🔵 | Overhead Analysis Document Checked | ~203 |
|
||||
|
||||
### Nov 7, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #4609 | 6:33 PM | ✅ | PR #69 Successfully Merged to Main Branch | ~516 |
|
||||
| #4600 | 6:31 PM | 🟣 | Added Worker Service Documentation Suite | ~441 |
|
||||
| #4597 | " | 🔄 | Worker Service Refactored to Object-Oriented Architecture | ~473 |
|
||||
|
||||
### Nov 8, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #5539 | 10:20 PM | 🔵 | Harsh critical audit of context-hook reveals systematic anti-patterns | ~3154 |
|
||||
| #5497 | 9:29 PM | 🔵 | Harsh critical audit of context-hook reveals systematic anti-patterns | ~2815 |
|
||||
| #5495 | 9:28 PM | 🔵 | Context Hook Audit Reveals Project Anti-Patterns | ~660 |
|
||||
| #5476 | 9:17 PM | 🔵 | Critical Code Audit Identified 14 Anti-Patterns in Context Hook | ~887 |
|
||||
| #5391 | 8:45 PM | 🔵 | Critical Code Quality Audit of Context Hook Implementation | ~720 |
|
||||
| #5150 | 7:37 PM | 🟣 | Troubleshooting Skill Added to Claude-Mem Plugin | ~427 |
|
||||
|
||||
### Nov 9, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #6161 | 11:55 PM | 🔵 | YC W26 Application Research and Preparation Completed for Claude-Mem | ~1628 |
|
||||
| #6155 | 11:47 PM | ✅ | Comprehensive Y Combinator Winter 2026 Application Notes Created | ~1045 |
|
||||
| #5979 | 7:58 PM | 🔵 | Smart Contextualization Feature Architecture | ~560 |
|
||||
| #5971 | 7:49 PM | 🔵 | Hooks Reference Documentation Structure | ~448 |
|
||||
| #5929 | 7:08 PM | ✅ | Documentation Updates for v5.4.0 Skill-Based Search Migration | ~604 |
|
||||
| #5927 | " | ✅ | Updated Configuration Documentation for Skill-Based Search | ~497 |
|
||||
| #5920 | 7:05 PM | ✅ | Renamed Architecture Documentation File Reference | ~271 |
|
||||
|
||||
### Nov 18, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #11515 | 8:22 PM | 🔵 | Smart Contextualization Architecture Retrieved with Command Hook Pattern Details | ~502 |
|
||||
|
||||
### Dec 8, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #22294 | 9:43 PM | 🔵 | Documentation Site Structure Located | ~359 |
|
||||
|
||||
### Dec 12, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #24430 | 8:27 PM | ✅ | Removed Final Platform Check Reference from Linux Section | ~320 |
|
||||
| #24429 | " | ✅ | Final Platform Check Reference Removal from Linux Section | ~274 |
|
||||
| #24428 | " | ✅ | Corrected Second Line Number Reference for Migration Marker Logic | ~267 |
|
||||
| #24427 | 8:26 PM | ✅ | Updated Line Number Reference for PM2 Cleanup Implementation | ~260 |
|
||||
| #24426 | " | ✅ | Removed Platform Check from Manual Marker Deletion Scenario | ~338 |
|
||||
| #24425 | " | ✅ | Removed Platform Check from Fresh Install Scenario Flow | ~314 |
|
||||
| #24424 | 8:25 PM | ✅ | Renumbered Manual Marker Deletion Scenario | ~285 |
|
||||
| #24423 | " | ✅ | Renumbered Fresh Install Scenario | ~243 |
|
||||
| #24422 | " | ✅ | Removed Obsolete Windows Platform Detection Scenario | ~311 |
|
||||
| #24421 | " | ✅ | Removed Platform Check from macOS Migration Documentation | ~294 |
|
||||
| #24420 | 8:24 PM | ✅ | Platform Check Removed from Migration Documentation | ~288 |
|
||||
| #24417 | 8:16 PM | ✅ | Code Reference Example Updated to Reflect Actual Cross-Platform Implementation | ~366 |
|
||||
| #24416 | " | ✅ | Architecture Decision Documentation Updated to Reflect Cross-Platform PM2 Cleanup Rationale | ~442 |
|
||||
| #24415 | 8:15 PM | ✅ | Migration Marker Lifecycle Documentation Updated for Unified Cross-Platform Behavior | ~463 |
|
||||
| #24414 | " | ✅ | Platform Comparison Table Updated to Reflect Unified Cross-Platform Migration | ~351 |
|
||||
| #24413 | " | ✅ | Windows Platform-Specific Documentation Completely Rewritten for Unified Migration | ~428 |
|
||||
| #24412 | " | ✅ | User Experience Timeline Updated for Cross-Platform PM2 Cleanup | ~291 |
|
||||
| #24411 | 8:14 PM | ✅ | Migration Marker Lifecycle Documentation Updated for All Platforms | ~277 |
|
||||
| #24410 | " | ✅ | Marker File Platform Behavior Documentation Updated for Unified Migration | ~282 |
|
||||
| #24409 | " | ✅ | Migration Steps Documentation Updated for Cross-Platform PM2 Cleanup | ~278 |
|
||||
| #24408 | 8:13 PM | ✅ | PM2 Migration Documentation Updated to Remove Windows Platform Check | ~280 |
|
||||
</claude-mem-context>
|
||||
@@ -0,0 +1,213 @@
|
||||
# Claude-Mem PR Shipping Report
|
||||
*Generated: 2026-02-04*
|
||||
|
||||
## Executive Summary
|
||||
|
||||
6 PRs analyzed for shipping readiness. **1 is ready to merge**, 4 have conflicts, 1 is too large for easy review.
|
||||
|
||||
| PR | Title | Status | Recommendation |
|
||||
|----|-------|--------|----------------|
|
||||
| **#856** | Idle timeout for zombie processes | ✅ **MERGEABLE** | **Ship it** |
|
||||
| #700 | Windows Terminal popup fix | ⚠️ Conflicts | Rebase, then ship |
|
||||
| #722 | In-process worker architecture | ⚠️ Conflicts | Rebase, high impact |
|
||||
| #657 | generate/clean CLI commands | ⚠️ Conflicts | Rebase, then ship |
|
||||
| #863 | Ragtime email investigation | 🔍 Needs review | Research pending |
|
||||
| #464 | Sleep Agent Pipeline (contributor) | 🔴 Too large | Request split or dedicated review |
|
||||
|
||||
---
|
||||
|
||||
## Ready to Ship
|
||||
|
||||
### PR #856: Idle Timeout for Zombie Observer Processes
|
||||
**Status:** ✅ MERGEABLE (no conflicts)
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Additions | 928 |
|
||||
| Deletions | 171 |
|
||||
| Files | 8 |
|
||||
| Risk | Low-Medium |
|
||||
|
||||
**What it does:**
|
||||
- Adds 3-minute idle timeout to `SessionQueueProcessor`
|
||||
- Prevents zombie observer processes that were causing 13.4GB swap usage
|
||||
- Processes exit gracefully after inactivity instead of waiting forever
|
||||
|
||||
**Why ship it:**
|
||||
- Fixes real user-reported issue (79 zombie processes)
|
||||
- Well-tested (11 new tests, 440 lines of test coverage)
|
||||
- Clean implementation, preventive approach
|
||||
- Supersedes PR #848's reactive cleanup
|
||||
- No conflicts, ready to merge
|
||||
|
||||
**Review notes:**
|
||||
- 1 Greptile bot comment (addressed)
|
||||
- Race condition fix included
|
||||
- Enhanced logging added
|
||||
|
||||
---
|
||||
|
||||
## Needs Rebase (Have Conflicts)
|
||||
|
||||
### PR #700: Windows Terminal Popup Fix
|
||||
**Status:** ⚠️ CONFLICTING
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Additions | 187 |
|
||||
| Deletions | 399 |
|
||||
| Files | 8 |
|
||||
| Risk | Medium |
|
||||
|
||||
**What it does:**
|
||||
- Eliminates Windows Terminal popup by removing spawn-based daemon
|
||||
- Worker `start` command becomes daemon directly (no child spawn)
|
||||
- Removes `restart` command (users do `stop` then `start`)
|
||||
- Net simplification: -212 lines
|
||||
|
||||
**Breaking changes:**
|
||||
- `restart` command removed
|
||||
|
||||
**Review status:**
|
||||
- ✅ 1 APPROVAL from @volkanfirat (Jan 15, 2026)
|
||||
|
||||
**Action needed:** Resolve conflicts, then ready to ship.
|
||||
|
||||
---
|
||||
|
||||
### PR #722: In-Process Worker Architecture
|
||||
**Status:** ⚠️ CONFLICTING
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Additions | 869 |
|
||||
| Deletions | 4,658 |
|
||||
| Files | 112 |
|
||||
| Risk | High |
|
||||
|
||||
**What it does:**
|
||||
- Hook processes become the worker (no separate daemon spawning)
|
||||
- First hook that needs worker becomes the worker
|
||||
- Eliminates Windows spawn issues ("NO SPAWN" rule)
|
||||
- 761 tests pass
|
||||
|
||||
**Architectural impact:** HIGH
|
||||
- Fundamentally changes worker lifecycle
|
||||
- Hook processes stay alive (they ARE the worker)
|
||||
- First hook wins port 37777, others use HTTP
|
||||
|
||||
**Action needed:** Resolve conflicts. Consider relationship with PR #700 (both touch worker architecture).
|
||||
|
||||
---
|
||||
|
||||
### PR #657: Generate/Clean CLI Commands
|
||||
**Status:** ⚠️ CONFLICTING
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Additions | 1,184 |
|
||||
| Deletions | 5,057 |
|
||||
| Files | 104 |
|
||||
| Risk | Medium |
|
||||
|
||||
**What it does:**
|
||||
- Adds `claude-mem generate` and `claude-mem clean` CLI commands
|
||||
- Fixes validation bugs (deleted folders recreated from stale DB)
|
||||
- Fixes Windows path handling
|
||||
- Adds automatic shell alias installation
|
||||
- Disables subdirectory CLAUDE.md files by default
|
||||
|
||||
**Breaking changes:**
|
||||
- Default behavior change: folder CLAUDE.md now disabled by default
|
||||
|
||||
**Action needed:** Resolve conflicts, complete Windows testing.
|
||||
|
||||
---
|
||||
|
||||
## Needs Attention
|
||||
|
||||
### PR #863: Ragtime Email Investigation
|
||||
**Status:** 🔍 Research pending
|
||||
|
||||
Research agent did not return results. Manual review needed.
|
||||
|
||||
---
|
||||
|
||||
### PR #464: Sleep Agent Pipeline (Contributor: @laihenyi)
|
||||
**Status:** 🔴 Too large for effective review
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Additions | 15,430 |
|
||||
| Deletions | 469 |
|
||||
| Files | 73 |
|
||||
| Wait time | 37+ days |
|
||||
| Risk | High |
|
||||
|
||||
**What it does:**
|
||||
- Sleep Agent Pipeline with memory tiering
|
||||
- Supersession detection
|
||||
- Session Statistics API (`/api/session/:id/stats`)
|
||||
- StatusLine + PreCompact hooks
|
||||
- Context Generator improvements
|
||||
- Self-healing CI workflow
|
||||
|
||||
**Concerns:**
|
||||
| Issue | Details |
|
||||
|-------|---------|
|
||||
| 🔴 Size | 15K+ lines is too large for effective review |
|
||||
| 🔴 SupersessionDetector | Single file with 1,282 additions |
|
||||
| 🟡 No tests visible | Test plan checkboxes unchecked |
|
||||
| 🟡 Self-healing CI | Auto-fix workflow could cause infinite commit loops |
|
||||
| 🟡 Serena config | Adds `.serena/` tooling |
|
||||
|
||||
**Recommendation:**
|
||||
1. **Option A:** Request contributor split into 4-5 smaller PRs
|
||||
2. **Option B:** Allocate dedicated review time (several hours)
|
||||
3. **Option C:** Cherry-pick specific features (hooks, stats API)
|
||||
|
||||
**Note:** Contributor has been waiting 37+ days. Deserves response either way.
|
||||
|
||||
---
|
||||
|
||||
## Shipping Strategy
|
||||
|
||||
### Phase 1: Quick Wins (This Week)
|
||||
1. **Merge #856** — Ready now, fixes real user issue
|
||||
2. **Rebase #700** — Has approval, Windows fix needed
|
||||
3. **Rebase #657** — Useful CLI commands
|
||||
|
||||
### Phase 2: Architecture (Careful Review)
|
||||
4. **Review #722** — High impact, conflicts with #700 approach?
|
||||
- Both PRs eliminate spawning but in different ways
|
||||
- May need to pick one approach
|
||||
|
||||
### Phase 3: Contributor PR
|
||||
5. **Respond to #464** — Options:
|
||||
- Ask for split
|
||||
- Schedule dedicated review
|
||||
- Cherry-pick subset
|
||||
|
||||
### Phase 4: Investigation
|
||||
6. **Manual review #863** — Ragtime email feature
|
||||
|
||||
---
|
||||
|
||||
## Conflict Resolution Order
|
||||
|
||||
Since multiple PRs have conflicts, suggested rebase order:
|
||||
|
||||
1. **#856** (merge first — no conflicts)
|
||||
2. **#700** (rebase onto main after #856)
|
||||
3. **#657** (rebase onto main after #700)
|
||||
4. **#722** (rebase last — may conflict with #700 architecturally)
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Ready | Conflicts | Needs Work |
|
||||
|-------|-----------|------------|
|
||||
| 1 PR (#856) | 3 PRs (#700, #722, #657) | 2 PRs (#464, #863) |
|
||||
|
||||
**Immediate action:** Merge #856, then rebase the conflict PRs in order.
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
Title: Bug: SDK Agent fails on Windows when username contains spaces
|
||||
---
|
||||
|
||||
## Bug Report
|
||||
|
||||
**Summary:** Claude SDK Agent fails to start on Windows when the user's path contains spaces (e.g., `C:\Users\Anderson Wang\`), causing PostToolUse hooks to hang indefinitely.
|
||||
|
||||
**Severity:** High - Core functionality broken
|
||||
|
||||
**Affected Platform:** Windows only
|
||||
|
||||
---
|
||||
|
||||
## Symptoms
|
||||
|
||||
PostToolUse hook displays `(1/2 done)` indefinitely. Worker logs show:
|
||||
|
||||
```
|
||||
ERROR [SESSION] Generator failed {provider=claude, error=Claude Code process exited with code 1}
|
||||
ERROR [SESSION] Generator exited unexpectedly
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Root Cause
|
||||
|
||||
Two issues in the Windows code path:
|
||||
|
||||
1. **`SDKAgent.ts`** - Returns full auto-detected path with spaces:
|
||||
```
|
||||
C:\Users\Anderson Wang\AppData\Roaming\npm\claude.cmd
|
||||
```
|
||||
|
||||
2. **`ProcessRegistry.ts`** - Node.js `spawn()` cannot directly execute `.cmd` files when the path contains spaces
|
||||
|
||||
---
|
||||
|
||||
## Proposed Fix
|
||||
|
||||
### File 1: `src/services/worker/SDKAgent.ts`
|
||||
|
||||
On Windows, prefer `claude.cmd` via PATH instead of full auto-detected path:
|
||||
|
||||
```typescript
|
||||
// On Windows, prefer "claude.cmd" (via PATH) to avoid spawn issues with spaces in paths
|
||||
if (process.platform === 'win32') {
|
||||
try {
|
||||
execSync('where claude.cmd', { encoding: 'utf8', windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] });
|
||||
return 'claude.cmd'; // Let Windows resolve via PATHEXT
|
||||
} catch {
|
||||
// Fall through to generic error
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### File 2: `src/services/worker/ProcessRegistry.ts`
|
||||
|
||||
Use `cmd.exe /d /c` wrapper for .cmd files on Windows:
|
||||
|
||||
```typescript
|
||||
const useCmdWrapper = process.platform === 'win32' && spawnOptions.command.endsWith('.cmd');
|
||||
|
||||
if (useCmdWrapper) {
|
||||
child = spawn('cmd.exe', ['/d', '/c', spawnOptions.command, ...spawnOptions.args], {
|
||||
cwd: spawnOptions.cwd,
|
||||
env: spawnOptions.env,
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
signal: spawnOptions.signal,
|
||||
windowsHide: true
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Why This Works
|
||||
|
||||
- **PATHEXT Resolution:** Windows searches PATH and tries each extension in PATHEXT automatically
|
||||
- **cmd.exe wrapper:** Properly handles paths with spaces and argument passing
|
||||
- **Avoids shell parsing:** Using direct arguments instead of `shell: true` prevents empty string misparsing
|
||||
|
||||
---
|
||||
|
||||
## Testing
|
||||
|
||||
Verified on Windows 11 with username containing spaces:
|
||||
- PostToolUse hook completes successfully
|
||||
- Observations are stored to database
|
||||
- No more "process exited with code 1" errors
|
||||
|
||||
---
|
||||
|
||||
## Additional Notes
|
||||
|
||||
- Maintains backward compatibility with `CLAUDE_CODE_PATH` setting
|
||||
- No impact on non-Windows platforms
|
||||
- Related to Issue #733 (credential isolation) - separate fix
|
||||
@@ -1,77 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Nov 13, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #7806 | 4:54 PM | 🔵 | PR #101 Enhancement: Continuation Prompt Token Reduction | ~634 |
|
||||
|
||||
### Nov 16, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #9976 | 11:35 PM | 🔵 | Endless Mode Architecture Plan Documented | ~661 |
|
||||
| #9967 | 11:18 PM | ⚖️ | Endless Mode Architecture: Immutable Storage with Ephemeral Transform | ~217 |
|
||||
|
||||
### Nov 17, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #10131 | 1:22 AM | 🔵 | Endless Mode Token Economics Analysis Output: Complete Infrastructure Impact | ~542 |
|
||||
| #10130 | " | ✅ | Integration of Actual Compute Savings Analysis into Main Execution Flow | ~258 |
|
||||
| #10129 | " | 🔵 | Prompt Caching Economics: User Cost vs. Anthropic Compute Cost Divergence | ~451 |
|
||||
| #10126 | 1:19 AM | 🔴 | Fix Return Statement Variable Names in playTheTapeThrough Function | ~313 |
|
||||
| #10125 | " | ✅ | Redesign Timeline Display to Show Fresh/Cached Token Breakdown and Real Dollar Costs | ~501 |
|
||||
| #10124 | " | ✅ | Replace Estimated Cost Model with Actual Caching-Based Costs in Anthropic Scale Analysis | ~516 |
|
||||
| #10123 | " | ✅ | Pivot Session Length Comparison Table from Token to Cost Metrics | ~413 |
|
||||
| #10122 | " | ✅ | Add Dual Reporting: Token Count vs Actual Cost in Comparison Output | ~410 |
|
||||
| #10121 | 1:18 AM | ✅ | Apply Prompt Caching Cost Model to Endless Mode Calculation Function | ~501 |
|
||||
| #10120 | " | ✅ | Integrate Prompt Caching Cost Calculations into Without-Endless-Mode Function | ~426 |
|
||||
| #10119 | " | ✅ | Display Prompt Caching Pricing in Initial Calculator Output | ~297 |
|
||||
| #10118 | " | ✅ | Add Prompt Caching Pricing Model to Token Economics Calculator | ~316 |
|
||||
| #10115 | 1:15 AM | 🟣 | Token Economics Calculator for Endless Mode Sessions | ~465 |
|
||||
| #10013 | 12:13 AM | 🔵 | Duplicate Agent SDK TypeScript Reference Documentation | ~340 |
|
||||
| #10012 | " | 🔵 | Agent SDK TypeScript API Reference Complete | ~349 |
|
||||
|
||||
### Nov 18, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #11738 | 11:51 PM | ⚖️ | Comprehensive Architecture Document Created for Phase 1 | ~868 |
|
||||
| #11711 | 11:44 PM | 🔵 | Language Model Tool Documentation Index | ~282 |
|
||||
| #11710 | " | 🔵 | Language Model Tool API Implementation Guide | ~718 |
|
||||
| #11709 | 11:43 PM | 🔵 | Comprehensive Copilot Extension Implementation Plan | ~624 |
|
||||
| #11708 | " | 🔵 | VS Code Chat Sample Documentation Unavailable | ~327 |
|
||||
| #11707 | " | 🔵 | VS Code Language Model API Structure and Capabilities | ~515 |
|
||||
| #11705 | " | ⚖️ | VS Code Extension Development Planning Phase Initiated | ~327 |
|
||||
| #11206 | 3:01 PM | 🔵 | mem-search skill architecture and migration details retrieved in full format | ~538 |
|
||||
|
||||
### Nov 25, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #15538 | 8:36 PM | 🔵 | Context Document for Landing Page Refinements | ~381 |
|
||||
| #15314 | 5:04 PM | 🔵 | Endless Mode Documentation Post Retrieved with 156 Lines | ~671 |
|
||||
|
||||
### Dec 20, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31257 | 8:58 PM | ⚖️ | Eight Conflict Detection Hypotheses Evaluated with Simulation Results | ~525 |
|
||||
| #31256 | " | 🔵 | Supersession vs Conflict Detection Feature Analysis | ~515 |
|
||||
|
||||
### Dec 30, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34520 | 2:34 PM | 🔵 | V2 Example Code Demonstrates All Key Patterns | ~537 |
|
||||
|
||||
### Jan 7, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38209 | 7:39 PM | 🔵 | Claude Code Hooks System Architecture and Usage | ~491 |
|
||||
</claude-mem-context>
|
||||
@@ -1,38 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- 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 |
|
||||
</claude-mem-context>
|
||||
+55
-47
@@ -1,5 +1,4 @@
|
||||
🌐 هذه ترجمة آلية. نرحب بالتصحيحات من المجتمع!
|
||||
|
||||
<section dir="rtl">
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
@@ -14,6 +13,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +33,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -43,7 +44,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 +82,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,32 +110,34 @@
|
||||
> /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
|
||||
📚 **[عرض التوثيق الكامل](https://docs.claude-mem.ai/)** - تصفح على الموقع الرسمي
|
||||
|
||||
### البدء
|
||||
|
||||
- **[دليل التثبيت](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 +148,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 +167,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 +198,7 @@
|
||||
9. **الجدول الزمني حسب الاستعلام** - البحث عن الملاحظات والحصول على سياق الجدول الزمني حول أفضل تطابق
|
||||
10. **مساعدة API** - الحصول على توثيق API البحث
|
||||
|
||||
**أمثلة على استعلامات اللغة الطبيعية:**
|
||||
**أمثلة على الاستعلامات:**
|
||||
|
||||
```
|
||||
"What bugs did we fix last session?"
|
||||
@@ -219,8 +224,7 @@
|
||||
|
||||
- **Node.js**: 18.0.0 أو أعلى
|
||||
- **Claude Code**: أحدث إصدار مع دعم الإضافات
|
||||
- **Bun**: بيئة تشغيل JavaScript ومدير العمليات (يُثبت تلقائيًا إذا كان مفقودًا)
|
||||
- **uv**: مدير حزم Python للبحث المتجهي (يُثبت تلقائيًا إذا كان مفقودًا)
|
||||
- **Bun & uv**: (يتم تثبيتهما تلقائياً) لإدارة العمليات والبحث المتجه.
|
||||
- **SQLite 3**: للتخزين المستمر (مدمج)
|
||||
|
||||
---
|
||||
@@ -241,7 +245,7 @@
|
||||
|
||||
## استكشاف الأخطاء وإصلاحها
|
||||
|
||||
إذا واجهت مشكلات، صِف المشكلة لـ Claude وستقوم مهارة troubleshoot تلقائيًا بتشخيصها وتوفير الإصلاحات.
|
||||
إذا واجهت مشكلة، اشرحها لـ Claude وسيقوم بتشغيل خاصية troubleshoot لإصلاحها ذاتياً.
|
||||
|
||||
انظر **[دليل استكشاف الأخطاء وإصلاحها](https://docs.claude-mem.ai/troubleshooting)** للمشكلات الشائعة والحلول.
|
||||
|
||||
@@ -250,27 +254,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 +304,6 @@ npm run bug-report
|
||||
|
||||
---
|
||||
|
||||
**مبني باستخدام Claude Agent SDK** | **مدعوم بواسطة Claude Code** | **صُنع باستخدام TypeScript**
|
||||
**مبني باستخدام Claude Agent SDK** | **مدعوم بواسطة Claude Code** | **صُنع باستخدام TypeScript**
|
||||
|
||||
</section>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Claude Code পুনরায় চালু করুন। পূর্ব
|
||||
|
||||
## ডকুমেন্টেশন
|
||||
|
||||
📚 **[সম্পূর্ণ ডকুমেন্টেশন দেখুন](docs/)** - GitHub-এ markdown ডক্স ব্রাউজ করুন
|
||||
📚 **[সম্পূর্ণ ডকুমেন্টেশন দেখুন](https://docs.claude-mem.ai/)** - অফিসিয়াল ওয়েবসাইটে ব্রাউজ করুন
|
||||
|
||||
### শুরু করা
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Restartujte Claude Code. Kontext z předchozích sezení se automaticky objeví
|
||||
|
||||
## Dokumentace
|
||||
|
||||
📚 **[Zobrazit kompletní dokumentaci](docs/)** - Procházejte dokumentaci v markdown na GitHubu
|
||||
📚 **[Zobrazit kompletní dokumentaci](https://docs.claude-mem.ai/)** - Procházet na oficiálních stránkách
|
||||
|
||||
### Začínáme
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Genstart Claude Code. Kontekst fra tidligere sessioner vil automatisk vises i ny
|
||||
|
||||
## Dokumentation
|
||||
|
||||
📚 **[Se Fuld Dokumentation](docs/)** - Gennemse markdown-dokumenter på GitHub
|
||||
📚 **[Se Fuld Dokumentation](https://docs.claude-mem.ai/)** - Gennemse på den officielle hjemmeside
|
||||
|
||||
### Kom Godt I Gang
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Starten Sie Claude Code neu. Kontext aus vorherigen Sitzungen wird automatisch i
|
||||
|
||||
## Dokumentation
|
||||
|
||||
📚 **[Vollständige Dokumentation anzeigen](docs/)** - Markdown-Dokumentation auf GitHub durchsuchen
|
||||
📚 **[Vollständige Dokumentation anzeigen](https://docs.claude-mem.ai/)** - Auf der offiziellen Website durchsuchen
|
||||
|
||||
### Erste Schritte
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@
|
||||
|
||||
## Τεκμηρίωση
|
||||
|
||||
📚 **[Προβολή Πλήρους Τεκμηρίωσης](docs/)** - Περιήγηση στα markdown έγγραφα στο GitHub
|
||||
📚 **[Προβολή Πλήρους Τεκμηρίωσης](https://docs.claude-mem.ai/)** - Περιήγηση στον επίσημο ιστότοπο
|
||||
|
||||
### Ξεκινώντας
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -35,6 +36,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -127,7 +129,7 @@ Reinicia Claude Code. El contexto de sesiones anteriores aparecerá automáticam
|
||||
|
||||
## Documentación
|
||||
|
||||
📚 **[Ver Documentación Completa](docs/)** - Explora documentos markdown en GitHub
|
||||
📚 **[Ver Documentación Completa](https://docs.claude-mem.ai/)** - Navegar en el sitio web oficial
|
||||
|
||||
### Primeros Pasos
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +34,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -125,7 +127,7 @@ Käynnistä Claude Code uudelleen. Aiempien istuntojen konteksti ilmestyy automa
|
||||
|
||||
## Dokumentaatio
|
||||
|
||||
📚 **[Näytä täydellinen dokumentaatio](docs/)** - Selaa markdown-dokumentteja GitHubissa
|
||||
📚 **[Näytä täydellinen dokumentaatio](https://docs.claude-mem.ai/)** - Selaa virallisella verkkosivustolla
|
||||
|
||||
### Aloitus
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Redémarrez Claude Code. Le contexte des sessions précédentes apparaîtra auto
|
||||
|
||||
## Documentation
|
||||
|
||||
📚 **[Voir la documentation complète](docs/)** - Parcourez la documentation markdown sur GitHub
|
||||
📚 **[Voir la documentation complète](https://docs.claude-mem.ai/)** - Parcourir sur le site officiel
|
||||
|
||||
### Pour commencer
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +34,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -125,7 +127,7 @@
|
||||
|
||||
## תיעוד
|
||||
|
||||
📚 **[צפה בתיעוד המלא](docs/)** - עיין במסמכי markdown ב-GitHub
|
||||
📚 **[צפה בתיעוד המלא](https://docs.claude-mem.ai/)** - דפדף באתר הרשמי
|
||||
|
||||
### תחילת העבודה
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Claude Code को पुनः आरंभ करें। पिछले स
|
||||
|
||||
## दस्तावेज़ीकरण
|
||||
|
||||
📚 **[पूर्ण दस्तावेज़ीकरण देखें](docs/)** - GitHub पर markdown दस्तावेज़ ब्राउज़ करें
|
||||
📚 **[पूर्ण दस्तावेज़ीकरण देखें](https://docs.claude-mem.ai/)** - आधिकारिक वेबसाइट पर ब्राउज़ करें
|
||||
|
||||
### शुरुआत करना
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Indítsa újra a Claude Code-ot. A korábbi munkamenetek kontextusa automatikusa
|
||||
|
||||
## Dokumentáció
|
||||
|
||||
📚 **[Teljes dokumentáció megtekintése](docs/)** - Markdown dokumentumok böngészése GitHub-on
|
||||
📚 **[Teljes dokumentáció megtekintése](https://docs.claude-mem.ai/)** - Böngészés a hivatalos weboldalon
|
||||
|
||||
### Első lépések
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Restart Claude Code. Konteks dari sesi sebelumnya akan secara otomatis muncul di
|
||||
|
||||
## Dokumentasi
|
||||
|
||||
📚 **[Lihat Dokumentasi Lengkap](docs/)** - Telusuri dokumen markdown di GitHub
|
||||
📚 **[Lihat Dokumentasi Lengkap](https://docs.claude-mem.ai/)** - Jelajahi di situs web resmi
|
||||
|
||||
### Memulai
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Riavvia Claude Code. Il contesto delle sessioni precedenti apparirà automaticam
|
||||
|
||||
## Documentazione
|
||||
|
||||
📚 **[Visualizza Documentazione Completa](docs/)** - Sfoglia i documenti markdown su GitHub
|
||||
📚 **[Visualizza Documentazione Completa](https://docs.claude-mem.ai/)** - Sfoglia sul sito ufficiale
|
||||
|
||||
### Per Iniziare
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Claude Codeを再起動します。以前のセッションからのコンテキ
|
||||
|
||||
## ドキュメント
|
||||
|
||||
📚 **[完全なドキュメントを見る](docs/)** - GitHubでマークダウンドキュメントを閲覧
|
||||
📚 **[完全なドキュメントを見る](https://docs.claude-mem.ai/)** - 公式ウェブサイトで閲覧
|
||||
|
||||
### はじめに
|
||||
|
||||
@@ -212,7 +214,7 @@ Claude-Memは、過去の作業について尋ねると自動的に呼び出さ
|
||||
|
||||
Claude-Memは、**Endless Mode**(拡張セッション用の生体模倣メモリアーキテクチャ)などの実験的機能を備えた**ベータチャネル**を提供します。http://localhost:37777 → SettingsのWebビューアUIから安定版とベータ版を切り替えます。
|
||||
|
||||
Endless Modeと試用方法の詳細については、**[ベータ機能ドキュメント](https://docs.claude-mem.ai/beta-features)**を参照してください。
|
||||
Endless Modeと試用方法の詳細については、**[ベータ機能ドキュメント](https://docs.claude-mem.ai/beta-features)** を参照してください。
|
||||
|
||||
---
|
||||
|
||||
@@ -230,13 +232,13 @@ Endless Modeと試用方法の詳細については、**[ベータ機能ドキ
|
||||
|
||||
設定は`~/.claude-mem/settings.json`で管理されます(初回実行時にデフォルト値で自動作成)。AIモデル、ワーカーポート、データディレクトリ、ログレベル、コンテキスト注入設定を構成します。
|
||||
|
||||
利用可能なすべての設定と例については、**[設定ガイド](https://docs.claude-mem.ai/configuration)**を参照してください。
|
||||
利用可能なすべての設定と例については、**[設定ガイド](https://docs.claude-mem.ai/configuration)** を参照してください。
|
||||
|
||||
---
|
||||
|
||||
## 開発
|
||||
|
||||
ビルド手順、テスト、コントリビューションワークフローについては、**[開発ガイド](https://docs.claude-mem.ai/development)**を参照してください。
|
||||
ビルド手順、テスト、コントリビューションワークフローについては、**[開発ガイド](https://docs.claude-mem.ai/development)** を参照してください。
|
||||
|
||||
---
|
||||
|
||||
@@ -244,7 +246,7 @@ Endless Modeと試用方法の詳細については、**[ベータ機能ドキ
|
||||
|
||||
問題が発生した場合は、Claudeに問題を説明すると、troubleshootスキルが自動的に診断して修正を提供します。
|
||||
|
||||
よくある問題と解決策については、**[トラブルシューティングガイド](https://docs.claude-mem.ai/troubleshooting)**を参照してください。
|
||||
よくある問題と解決策については、**[トラブルシューティングガイド](https://docs.claude-mem.ai/troubleshooting)** を参照してください。
|
||||
|
||||
---
|
||||
|
||||
@@ -286,7 +288,7 @@ Copyright (C) 2025 Alex Newman (@thedotmack). All rights reserved.
|
||||
- 派生作品もAGPL-3.0の下でライセンスする必要があります
|
||||
- このソフトウェアには保証がありません
|
||||
|
||||
**Ragtimeに関する注意**: `ragtime/`ディレクトリは**PolyForm Noncommercial License 1.0.0**の下で個別にライセンスされています。詳細は[ragtime/LICENSE](ragtime/LICENSE)を参照してください。
|
||||
**Ragtimeに関する注意**: `ragtime/`ディレクトリは **PolyForm Noncommercial License 1.0.0** の下で個別にライセンスされています。詳細は[ragtime/LICENSE](ragtime/LICENSE)を参照してください。
|
||||
|
||||
---
|
||||
|
||||
@@ -299,4 +301,4 @@ Copyright (C) 2025 Alex Newman (@thedotmack). All rights reserved.
|
||||
|
||||
---
|
||||
|
||||
**Claude Agent SDKで構築** | **Claude Codeで動作** | **TypeScriptで作成**
|
||||
**Claude Agent SDKで構築** | **Claude Codeで動作** | **TypeScriptで作成**
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -114,19 +116,19 @@ Claude Code를 재시작하세요. 이전 세션의 컨텍스트가 자동으로
|
||||
- 🧠 **지속적인 메모리** - 세션 간 컨텍스트 유지
|
||||
- 📊 **점진적 공개** - 토큰 비용 가시성을 갖춘 계층화된 메모리 검색
|
||||
- 🔍 **스킬 기반 검색** - mem-search 스킬로 프로젝트 기록 쿼리
|
||||
- 🖥️ **웹 뷰어 UI** - http://localhost:37777에서 실시간 메모리 스트림 확인
|
||||
- 🖥️ **웹 뷰어 UI** - http://localhost:37777 에서 실시간 메모리 스트림 확인
|
||||
- 💻 **Claude Desktop 스킬** - Claude Desktop 대화에서 메모리 검색
|
||||
- 🔒 **개인정보 제어** - `<private>` 태그를 사용하여 민감한 콘텐츠를 저장소에서 제외
|
||||
- ⚙️ **컨텍스트 설정** - 주입되는 컨텍스트에 대한 세밀한 제어
|
||||
- 🤖 **자동 작동** - 수동 개입 불필요
|
||||
- 🔗 **인용** - ID로 과거 관찰 참조 (http://localhost:37777/api/observation/{id}를 통해 액세스하거나 http://localhost:37777의 웹 뷰어에서 모두 보기)
|
||||
- 🔗 **인용** - ID로 과거 관찰 참조 (http://localhost:37777/api/observation/{id} 를 통해 액세스하거나 http://localhost:37777 의 웹 뷰어에서 모두 보기)
|
||||
- 🧪 **베타 채널** - 버전 전환을 통해 Endless Mode와 같은 실험적 기능 사용
|
||||
|
||||
---
|
||||
|
||||
## 문서
|
||||
|
||||
📚 **[전체 문서 보기](docs/)** - GitHub에서 마크다운 문서 탐색
|
||||
📚 **[전체 문서 보기](https://docs.claude-mem.ai/)** - 공식 웹사이트에서 찾아보기
|
||||
|
||||
### 시작하기
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +34,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -125,7 +127,7 @@ Herstart Claude Code. Context van eerdere sessies verschijnt automatisch in nieu
|
||||
|
||||
## Documentatie
|
||||
|
||||
📚 **[Bekijk Volledige Documentatie](docs/)** - Blader door markdown documenten op GitHub
|
||||
📚 **[Bekijk Volledige Documentatie](https://docs.claude-mem.ai/)** - Bladeren op de officiële website
|
||||
|
||||
### Aan de Slag
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Start Claude Code på nytt. Kontekst fra tidligere økter vil automatisk vises i
|
||||
|
||||
## Dokumentasjon
|
||||
|
||||
📚 **[Se Full Dokumentasjon](docs/)** - Bla gjennom markdown-dokumenter på GitHub
|
||||
📚 **[Se Full Dokumentasjon](https://docs.claude-mem.ai/)** - Bla gjennom på det offisielle nettstedet
|
||||
|
||||
### Komme I Gang
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +34,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -125,7 +127,7 @@ Uruchom ponownie Claude Code. Kontekst z poprzednich sesji automatycznie pojawi
|
||||
|
||||
## Dokumentacja
|
||||
|
||||
📚 **[Wyświetl Pełną Dokumentację](docs/)** - Przeglądaj dokumentację markdown na GitHub
|
||||
📚 **[Wyświetl Pełną Dokumentację](https://docs.claude-mem.ai/)** - Przeglądaj na oficjalnej stronie
|
||||
|
||||
### Pierwsze Kroki
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Reinicie o Claude Code. O contexto de sessões anteriores aparecerá automaticam
|
||||
|
||||
## Documentação
|
||||
|
||||
📚 **[Ver Documentação Completa](docs/)** - Navegue pelos documentos markdown no GitHub
|
||||
📚 **[Ver Documentação Completa](https://docs.claude-mem.ai/)** - Navegar no site oficial
|
||||
|
||||
### Começando
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Reporniți Claude Code. Contextul din sesiunile anterioare va apărea automat î
|
||||
|
||||
## Documentație
|
||||
|
||||
📚 **[Vizualizați Documentația Completă](docs/)** - Răsfoiți documentele markdown pe GitHub
|
||||
📚 **[Vizualizați Documentația Completă](https://docs.claude-mem.ai/)** - Răsfoiți pe site-ul oficial
|
||||
|
||||
### Introducere
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@
|
||||
|
||||
## Документация
|
||||
|
||||
📚 **[Просмотреть полную документацию](docs/)** - Просмотр markdown-документов на GitHub
|
||||
📚 **[Просмотреть полную документацию](https://docs.claude-mem.ai/)** - Просмотр на официальном сайте
|
||||
|
||||
### Начало работы
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Starta om Claude Code. Kontext från tidigare sessioner kommer automatiskt att v
|
||||
|
||||
## Dokumentation
|
||||
|
||||
📚 **[Visa fullständig dokumentation](docs/)** - Bläddra bland markdown-dokument på GitHub
|
||||
📚 **[Visa fullständig dokumentation](https://docs.claude-mem.ai/)** - Bläddra på den officiella webbplatsen
|
||||
|
||||
### Komma igång
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +34,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -125,7 +127,7 @@
|
||||
|
||||
## เอกสาร
|
||||
|
||||
📚 **[ดูเอกสารฉบับเต็ม](docs/)** - เรียกดูเอกสาร markdown บน GitHub
|
||||
📚 **[ดูเอกสารฉบับเต็ม](https://docs.claude-mem.ai/)** - เรียกดูบนเว็บไซต์อย่างเป็นทางการ
|
||||
|
||||
### เริ่มต้นใช้งาน
|
||||
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
🌐 Ito ay isang awtomatikong pagsasalin. Malugod na tinatanggap ang mga pagwawasto mula sa komunidad!
|
||||
|
||||
---
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-dark-mode.webp">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp" alt="Claude-Mem" width="400">
|
||||
</picture>
|
||||
</a>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
<a href="README.es.md">🇪🇸 Español</a> •
|
||||
<a href="README.de.md">🇩🇪 Deutsch</a> •
|
||||
<a href="README.fr.md">🇫🇷 Français</a> •
|
||||
<a href="README.he.md">🇮🇱 עברית</a> •
|
||||
<a href="README.ar.md">🇸🇦 العربية</a> •
|
||||
<a href="README.ru.md">🇷🇺 Русский</a> •
|
||||
<a href="README.pl.md">🇵🇱 Polski</a> •
|
||||
<a href="README.cs.md">🇨🇿 Čeština</a> •
|
||||
<a href="README.nl.md">🇳🇱 Nederlands</a> •
|
||||
<a href="README.tr.md">🇹🇷 Türkçe</a> •
|
||||
<a href="README.uk.md">🇺🇦 Українська</a> •
|
||||
<a href="README.vi.md">🇻🇳 Tiếng Việt</a> •
|
||||
<a href="README.tl.md">🇵🇭 Tagalog</a> •
|
||||
<a href="README.id.md">🇮🇩 Indonesia</a> •
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
<a href="README.el.md">🇬🇷 Ελληνικά</a> •
|
||||
<a href="README.hu.md">🇭🇺 Magyar</a> •
|
||||
<a href="README.fi.md">🇫🇮 Suomi</a> •
|
||||
<a href="README.da.md">🇩🇰 Dansk</a> •
|
||||
<a href="README.no.md">🇳🇴 Norsk</a>
|
||||
</p>
|
||||
|
||||
<h4 align="center">Sistema ng kompresyon ng persistent memory na ginawa para sa <a href="https://claude.com/claude-code" target="_blank">Claude Code</a>.</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="LICENSE">
|
||||
<img src="https://img.shields.io/badge/License-AGPL%203.0-blue.svg" alt="License">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/version-6.5.0-green.svg" alt="Version">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="Node">
|
||||
</a>
|
||||
<a href="https://github.com/thedotmack/awesome-claude-code">
|
||||
<img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Claude Code">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/15496" target="_blank">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge-dark.svg">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg" alt="thedotmack/claude-mem | Trendshift" width="250" height="55"/>
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/cm-preview.gif" alt="Claude-Mem Preview" width="800">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#mabilis-na-pagsisimula">Mabilis na Pagsisimula</a> •
|
||||
<a href="#paano-ito-gumagana">Paano Ito Gumagana</a> •
|
||||
<a href="#mga-search-tool-ng-mcp">Mga Search Tool</a> •
|
||||
<a href="#dokumentasyon">Dokumentasyon</a> •
|
||||
<a href="#konpigurasyon">Konpigurasyon</a> •
|
||||
<a href="#pag-troubleshoot">Pag-troubleshoot</a> •
|
||||
<a href="#lisensya">Lisensya</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Pinapanatili ng Claude-Mem ang konteksto sa pagitan ng mga session sa pamamagitan ng awtomatikong pagkuha ng mga obserbasyon sa paggamit ng mga tool, pagbuo ng mga semantikong buod, at paggawa nitong available sa mga susunod na session. Dahil dito, napapanatili ni Claude ang tuloy-tuloy na kaalaman tungkol sa mga proyekto kahit matapos o muling kumonekta ang mga session.
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## Mabilis na Pagsisimula
|
||||
|
||||
Magsimula ng bagong Claude Code session sa terminal at ilagay ang mga sumusunod na command:
|
||||
|
||||
```
|
||||
/plugin marketplace add thedotmack/claude-mem
|
||||
|
||||
/plugin install claude-mem
|
||||
```
|
||||
|
||||
I-restart ang Claude Code. Awtomatikong lalabas sa mga bagong session ang konteksto mula sa mga nakaraang session.
|
||||
|
||||
**Mga Pangunahing Tampok:**
|
||||
|
||||
- 🧠 **Persistent Memory** - Nananatili ang konteksto sa pagitan ng mga session
|
||||
- 📊 **Progressive Disclosure** - Layered na pagkuha ng memory na may visibility ng token cost
|
||||
- 🔍 **Skill-Based Search** - I-query ang history ng proyekto gamit ang mem-search skill
|
||||
- 🖥️ **Web Viewer UI** - Real-time memory stream sa http://localhost:37777
|
||||
- 💻 **Claude Desktop Skill** - Maghanap sa memory mula sa Claude Desktop conversations
|
||||
- 🔒 **Privacy Control** - Gamitin ang `<private>` tags para hindi ma-store ang sensitibong nilalaman
|
||||
- ⚙️ **Context Configuration** - Mas pinong kontrol kung anong konteksto ang ini-inject
|
||||
- 🤖 **Automatic Operation** - Walang kailangang manual na intervention
|
||||
- 🔗 **Citations** - I-refer ang mga lumang obserbasyon gamit ang IDs (i-access sa http://localhost:37777/api/observation/{id} o tingnan lahat sa web viewer sa http://localhost:37777)
|
||||
- 🧪 **Beta Channel** - Subukan ang mga experimental feature tulad ng Endless Mode sa pamamagitan ng version switching
|
||||
|
||||
---
|
||||
|
||||
## Dokumentasyon
|
||||
|
||||
📚 **[Tingnan ang Buong Dokumentasyon](https://docs.claude-mem.ai/)** - I-browse sa opisyal na website
|
||||
|
||||
### Pagsisimula
|
||||
|
||||
- **[Gabay sa Pag-install](https://docs.claude-mem.ai/installation)** - Mabilis na pagsisimula at advanced installation
|
||||
- **[Gabay sa Paggamit](https://docs.claude-mem.ai/usage/getting-started)** - Paano awtomatikong gumagana ang Claude-Mem
|
||||
- **[Mga Search Tool](https://docs.claude-mem.ai/usage/search-tools)** - I-query ang history ng proyekto gamit ang natural language
|
||||
- **[Mga Beta Feature](https://docs.claude-mem.ai/beta-features)** - Subukan ang mga experimental feature tulad ng Endless Mode
|
||||
|
||||
### Best Practices
|
||||
|
||||
- **[Context Engineering](https://docs.claude-mem.ai/context-engineering)** - Mga prinsipyo ng context optimization para sa AI agents
|
||||
- **[Progressive Disclosure](https://docs.claude-mem.ai/progressive-disclosure)** - Pilosopiya sa likod ng context priming strategy ng Claude-Mem
|
||||
|
||||
### Arkitektura
|
||||
|
||||
- **[Overview](https://docs.claude-mem.ai/architecture/overview)** - Mga bahagi ng sistema at daloy ng data
|
||||
- **[Architecture Evolution](https://docs.claude-mem.ai/architecture-evolution)** - Ang paglalakbay mula v3 hanggang v5
|
||||
- **[Hooks Architecture](https://docs.claude-mem.ai/hooks-architecture)** - Paano gumagamit ang Claude-Mem ng lifecycle hooks
|
||||
- **[Hooks Reference](https://docs.claude-mem.ai/architecture/hooks)** - 7 hook scripts, ipinaliwanag
|
||||
- **[Worker Service](https://docs.claude-mem.ai/architecture/worker-service)** - HTTP API at Bun management
|
||||
- **[Database](https://docs.claude-mem.ai/architecture/database)** - SQLite schema at FTS5 search
|
||||
- **[Search Architecture](https://docs.claude-mem.ai/architecture/search-architecture)** - Hybrid search gamit ang Chroma vector database
|
||||
|
||||
### Konpigurasyon at Pagbuo
|
||||
|
||||
- **[Konpigurasyon](https://docs.claude-mem.ai/configuration)** - Environment variables at settings
|
||||
- **[Pagbuo](https://docs.claude-mem.ai/development)** - Build, test, at contribution workflow
|
||||
- **[Pag-troubleshoot](https://docs.claude-mem.ai/troubleshooting)** - Karaniwang isyu at solusyon
|
||||
|
||||
---
|
||||
|
||||
## Paano Ito Gumagana
|
||||
|
||||
**Mga Pangunahing Bahagi:**
|
||||
|
||||
1. **5 Lifecycle Hooks** - SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd (6 hook scripts)
|
||||
2. **Smart Install** - Cached dependency checker (pre-hook script, hindi lifecycle hook)
|
||||
3. **Worker Service** - HTTP API sa port 37777 na may web viewer UI at 10 search endpoints, pinamamahalaan ng Bun
|
||||
4. **SQLite Database** - Nag-iimbak ng sessions, observations, summaries
|
||||
5. **mem-search Skill** - Natural language queries na may progressive disclosure
|
||||
6. **Chroma Vector Database** - Hybrid semantic + keyword search para sa matalinong pagkuha ng konteksto
|
||||
|
||||
Tingnan ang [Architecture Overview](https://docs.claude-mem.ai/architecture/overview) para sa detalye.
|
||||
|
||||
---
|
||||
|
||||
## Mga Search Tool ng MCP
|
||||
|
||||
Nagbibigay ang Claude-Mem ng intelligent memory search sa pamamagitan ng **5 MCP tools** na sumusunod sa token-efficient na **3-layer workflow pattern**:
|
||||
|
||||
**Ang 3-Layer Workflow:**
|
||||
|
||||
1. **`search`** - Kumuha ng compact index na may IDs (~50-100 tokens/result)
|
||||
2. **`timeline`** - Kumuha ng chronological context sa paligid ng mga interesting na result
|
||||
3. **`get_observations`** - Kunin ang full details PARA LANG sa na-filter na IDs (~500-1,000 tokens/result)
|
||||
|
||||
**Paano Ito Gumagana:**
|
||||
|
||||
- Gumagamit si Claude ng MCP tools para maghanap sa iyong memory
|
||||
- Magsimula sa `search` para makakuha ng index ng results
|
||||
- Gamitin ang `timeline` para makita ang nangyari sa paligid ng mga partikular na observation
|
||||
- Gamitin ang `get_observations` para kunin ang full details ng mga relevant na IDs
|
||||
- Gamitin ang `save_memory` para manual na mag-store ng importanteng impormasyon
|
||||
- **~10x tipid sa tokens** dahil nagfi-filter muna bago kunin ang full details
|
||||
|
||||
**Available na MCP Tools:**
|
||||
|
||||
1. **`search`** - Hanapin ang memory index gamit ang full-text queries, may filters (type/date/project)
|
||||
2. **`timeline`** - Kumuha ng chronological context sa paligid ng isang observation o query
|
||||
3. **`get_observations`** - Kumuha ng full observation details gamit ang IDs (laging i-batch ang maraming IDs)
|
||||
4. **`save_memory`** - Manual na mag-save ng memory/observation para sa semantic search
|
||||
5. **`__IMPORTANT`** - Workflow documentation (laging visible kay Claude)
|
||||
|
||||
**Halimbawa ng Paggamit:**
|
||||
|
||||
```typescript
|
||||
// Step 1: Search for index
|
||||
search(query="authentication bug", type="bugfix", limit=10)
|
||||
|
||||
// Step 2: Review index, identify relevant IDs (e.g., #123, #456)
|
||||
|
||||
// Step 3: Fetch full details
|
||||
get_observations(ids=[123, 456])
|
||||
|
||||
// Save important information manually
|
||||
save_memory(text="API requires auth header X-API-Key", title="API Auth")
|
||||
```
|
||||
|
||||
Tingnan ang [Search Tools Guide](https://docs.claude-mem.ai/usage/search-tools) para sa mas detalyadong mga halimbawa.
|
||||
|
||||
---
|
||||
|
||||
## Mga Beta Feature
|
||||
|
||||
May **beta channel** ang Claude-Mem na may mga experimental feature gaya ng **Endless Mode** (biomimetic memory architecture para sa mas mahahabang session). Magpalit sa pagitan ng stable at beta versions sa web viewer UI sa http://localhost:37777 → Settings.
|
||||
|
||||
Tingnan ang **[Dokumentasyon ng Mga Beta Feature](https://docs.claude-mem.ai/beta-features)** para sa detalye ng Endless Mode at kung paano ito subukan.
|
||||
|
||||
---
|
||||
|
||||
## Mga Pangangailangan ng Sistema
|
||||
|
||||
- **Node.js**: 18.0.0 o mas mataas
|
||||
- **Claude Code**: Pinakabagong bersyon na may plugin support
|
||||
- **Bun**: JavaScript runtime at process manager (auto-installed kung wala)
|
||||
- **uv**: Python package manager para sa vector search (auto-installed kung wala)
|
||||
- **SQLite 3**: Para sa persistent storage (kasama)
|
||||
|
||||
---
|
||||
|
||||
### Mga Tala sa Windows Setup
|
||||
|
||||
Kung makakita ka ng error gaya ng:
|
||||
|
||||
```powershell
|
||||
npm : The term 'npm' is not recognized as the name of a cmdlet
|
||||
```
|
||||
|
||||
Siguraduhing naka-install ang Node.js at npm at nakadagdag sa PATH. I-download ang pinakabagong Node.js installer mula sa https://nodejs.org at i-restart ang terminal matapos mag-install.
|
||||
|
||||
---
|
||||
|
||||
## Konpigurasyon
|
||||
|
||||
Pinamamahalaan ang settings sa `~/.claude-mem/settings.json` (auto-created na may defaults sa unang run). I-configure ang AI model, worker port, data directory, log level, at context injection settings.
|
||||
|
||||
Tingnan ang **[Gabay sa Konpigurasyon](https://docs.claude-mem.ai/configuration)** para sa lahat ng available na settings at mga halimbawa.
|
||||
|
||||
---
|
||||
|
||||
## Pagbuo
|
||||
|
||||
Tingnan ang **[Gabay nang pagbuo](https://docs.claude-mem.ai/development)** para sa pag build instructions, testing, at contribution workflow.
|
||||
|
||||
---
|
||||
|
||||
## Pag-troubleshoot
|
||||
|
||||
Kung may issue, ilarawan ang problema kay Claude at awtomatikong magdi-diagnose at magbibigay ng mga ayos ang troubleshoot skill.
|
||||
|
||||
Tingnan ang **[Troubleshooting Guide](https://docs.claude-mem.ai/troubleshooting)** para sa mga karaniwang isyu at solusyon.
|
||||
|
||||
---
|
||||
|
||||
## Bug Reports
|
||||
|
||||
Gumawa ng kumpletong bug reports gamit ang automated generator:
|
||||
|
||||
```bash
|
||||
cd ~/.claude/plugins/marketplaces/thedotmack
|
||||
npm run bug-report
|
||||
```
|
||||
|
||||
## Pag-aambag
|
||||
|
||||
Malugod na tinatanggap ang mga kontribusyon! Pakisunod:
|
||||
|
||||
1. I-fork ang repository
|
||||
2. Gumawa ng feature branch
|
||||
3. Gawin ang mga pagbabago kasama ang tests
|
||||
4. I-update ang dokumentasyon
|
||||
5. Mag-submit ng Pull Request
|
||||
|
||||
Tingnan ang [Gabay nang pagbuo](https://docs.claude-mem.ai/development) para sa contribution workflow.
|
||||
|
||||
---
|
||||
|
||||
## Lisensya
|
||||
|
||||
Ang proyektong ito ay licensed sa ilalim ng **GNU Affero General Public License v3.0** (AGPL-3.0).
|
||||
|
||||
Copyright (C) 2025 Alex Newman (@thedotmack). All rights reserved.
|
||||
|
||||
Tingnan ang [LICENSE](LICENSE) file para sa buong detalye.
|
||||
|
||||
**Ano ang ibig sabihin nito:**
|
||||
|
||||
- Maaari mong gamitin, baguhin, at ipamahagi ang software na ito nang libre
|
||||
- Kung babaguhin mo at i-deploy sa isang network server, kailangan mong gawing available ang iyong source code
|
||||
- Dapat ding naka-license sa AGPL-3.0 ang mga derivative works
|
||||
- WALANG WARRANTY para sa software na ito
|
||||
|
||||
**Tala tungkol sa Ragtime**: Ang `ragtime/` directory ay may hiwalay na lisensya sa ilalim ng **PolyForm Noncommercial License 1.0.0**. Tingnan ang [ragtime/LICENSE](ragtime/LICENSE) para sa detalye.
|
||||
|
||||
---
|
||||
|
||||
## Suporta
|
||||
|
||||
- **Dokumentasyon**: [docs/](docs/)
|
||||
- **Issues**: [GitHub Issues](https://github.com/thedotmack/claude-mem/issues)
|
||||
- **Repository**: [github.com/thedotmack/claude-mem](https://github.com/thedotmack/claude-mem)
|
||||
- **Author**: Alex Newman ([@thedotmack](https://github.com/thedotmack))
|
||||
|
||||
---
|
||||
|
||||
**Built with Claude Agent SDK** | **Powered by Claude Code** | **Made with TypeScript**
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -33,6 +34,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -125,7 +127,7 @@ Claude Code'u yeniden başlatın. Önceki oturumlardaki bağlam otomatik olarak
|
||||
|
||||
## Dokümantasyon
|
||||
|
||||
📚 **[Tam Dokümantasyonu Görüntüle](docs/)** - GitHub'da markdown dökümanlarına göz atın
|
||||
📚 **[Tam Dokümantasyonu Görüntüle](https://docs.claude-mem.ai/)** - Resmi web sitesinde göz atın
|
||||
|
||||
### Başlarken
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@
|
||||
|
||||
## Документація
|
||||
|
||||
📚 **[Переглянути повну документацію](docs/)** - Переглядайте markdown документи на GitHub
|
||||
📚 **[Переглянути повну документацію](https://docs.claude-mem.ai/)** - Переглянути на офіційному сайті
|
||||
|
||||
### Початок роботи
|
||||
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
<section dir="rtl">
|
||||
🌐 یہ ایک خودکار ترجمہ ہے۔ کمیونٹی کی اصلاحات کا خیر مقدم ہے!
|
||||
|
||||
---
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-dark-mode.webp">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp" alt="Claude-Mem" width="400">
|
||||
</picture>
|
||||
</a>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<p align="center" dir="ltr">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
<a href="README.es.md">🇪🇸 Español</a> •
|
||||
<a href="README.de.md">🇩🇪 Deutsch</a> •
|
||||
<a href="README.fr.md">🇫🇷 Français</a>
|
||||
<a href="README.he.md">🇮🇱 עברית</a> •
|
||||
<a href="README.ar.md">🇸🇦 العربية</a> •
|
||||
<a href="README.ru.md">🇷🇺 Русский</a> •
|
||||
<a href="README.pl.md">🇵🇱 Polski</a> •
|
||||
<a href="README.cs.md">🇨🇿 Čeština</a> •
|
||||
<a href="README.nl.md">🇳🇱 Nederlands</a> •
|
||||
<a href="README.tr.md">🇹🇷 Türkçe</a> •
|
||||
<a href="README.uk.md">🇺🇦 Українська</a> •
|
||||
<a href="README.vi.md">🇻🇳 Tiếng Việt</a> •
|
||||
<a href="README.id.md">🇮🇩 Indonesia</a> •
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
<a href="README.el.md">🇬🇷 Ελληνικά</a> •
|
||||
<a href="README.hu.md">🇭🇺 Magyar</a> •
|
||||
<a href="README.fi.md">🇫🇮 Suomi</a> •
|
||||
<a href="README.da.md">🇩🇰 Dansk</a> •
|
||||
<a href="README.no.md">🇳🇴 Norsk</a>
|
||||
</p>
|
||||
|
||||
<h4 align="center"><a href="https://claude.com/claude-code" target="_blank">Claude Code</a> کے لیے بنایا گیا مستقل میموری کمپریشن سسٹم۔</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="LICENSE">
|
||||
<img src="https://img.shields.io/badge/License-AGPL%203.0-blue.svg" alt="License">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/version-6.5.0-green.svg" alt="Version">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="Node">
|
||||
</a>
|
||||
<a href="https://github.com/thedotmack/awesome-claude-code">
|
||||
<img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Claude Code">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/15496" target="_blank">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge-dark.svg">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg" alt="thedotmack/claude-mem | Trendshift" width="250" height="55"/>
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/cm-preview.gif" alt="Claude-Mem Preview" width="800">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#تیز-رفتار-شروعات">تیز رفتار شروعات</a> •
|
||||
<a href="#یہ-کیسے-کام-کرتا-ہے">یہ کیسے کام کرتا ہے</a> •
|
||||
<a href="#تلاش-کے-اوزار">تلاش کے اوزار</a> •
|
||||
<a href="#دستاویزات">دستاویزات</a> •
|
||||
<a href="#ترتیبات">ترتیبات</a> •
|
||||
<a href="#مسائل-کی-تشخیص">مسائل کی تشخیص</a> •
|
||||
<a href="#لائسنس">لائسنس</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Claude-Mem خودکار طور پر ٹول کے استعمال کے بعد کے مشاہدات کو ریکارڈ کرتا ہے، سیمانٹک خلاصے تیار کرتا ہے اور انہیں مستقبل کے سیشنز میں دستیاب کرتا ہے تاکہ آپ سیشن میں براہ راست تناسب محفوظ رہے۔ یہ Claude کو سیشن ختم ہونے یا دوبارہ جڑنے کے بعد بھی منصوبے کے بارے میں معلومات کی مسلسلیت برقرار رکھنے کے قابل بناتا ہے۔
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## تیز رفتار شروعات
|
||||
|
||||
ٹرمنل میں نیا Claude Code سیشن شروع کریں اور ہیں کمانڈز درج کریں:
|
||||
|
||||
```
|
||||
> /plugin marketplace add thedotmack/claude-mem
|
||||
|
||||
> /plugin install claude-mem
|
||||
```
|
||||
|
||||
Claude Code کو دوبارہ شروع کریں۔ سابقہ سیشن کا تناسب خودکار طور پر نئے سیشن میں موجود ہوگا۔
|
||||
|
||||
**اہم خصوصیات:**
|
||||
|
||||
- 🧠 **مستقل میموری** - تناسب سیشن کے دوران برقرار رہتا ہے
|
||||
- 📊 **بتدریج ظہور** - لیئرڈ میموری کی بازیافت ٹوکن کی لاگت کی نمائندگی کے ساتھ
|
||||
- 🔍 **کمکردہ تلاش** - mem-search مہارت کے ساتھ اپنے منصوبے کی تاریخ میں تلاش کریں
|
||||
- 🖥️ **ویب ویور یو آئی** - http://localhost:37777 پر حقیقی وقت میموری اسٹریم
|
||||
- 💻 **Claude Desktop مہارت** - Claude Desktop بات چیت سے میموری تلاش کریں
|
||||
- 🔒 **رازداری کے کنٹرولز** - حساس مواد کو ذخیرہ سے خارج کرنے کے لیے `<private>` ٹیگ استعمال کریں
|
||||
- ⚙️ **تناسب کی ترتیبات** - کون سا تناسب انجیکٹ کیا جائے اس پر باریک کنٹرول
|
||||
- 🤖 **خودکار آپریشن** - کسی دستی مداخلت کی ضرورت نہیں
|
||||
- 🔗 **حوالہ** - ID کے ذریعے سابقہ مشاہدات کا حوالہ دیں (http://localhost:37777/api/observation/{id} کے ذریعے رسائی حاصل کریں یا تمام کو http://localhost:37777 پر ویب ویور میں دیکھیں)
|
||||
- 🧪 **بیٹا چینل** - ورژن تبدیل کرنے کے ذریعے Endless Mode جیسی تجرباتی خصوصیات آزمائیں
|
||||
|
||||
---
|
||||
|
||||
## دستاویزات
|
||||
|
||||
📚 **[مکمل دستاویزات دیکھیں](docs/)** - GitHub پر markdown ڈاکس کو براؤز کریں
|
||||
|
||||
### شروعات کرنا
|
||||
|
||||
- **[انسٹالیشن گائیڈ](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/beta-features)** - Endless Mode جیسی تجرباتی خصوصیات آزمائیں
|
||||
|
||||
### بہترین طریقہ کار
|
||||
|
||||
- **[تناسب انجینیئرنگ](https://docs.claude-mem.ai/context-engineering)** - AI ایجنٹ کے تناسب کی اہمیت کے اصول
|
||||
- **[بتدریج ظہور](https://docs.claude-mem.ai/progressive-disclosure)** - Claude-Mem کے تناسب کی تیاری کی حکمت عملی کے پیچھے فلسفہ
|
||||
|
||||
### تعمیر
|
||||
|
||||
- **[جائزہ](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/worker-service)** - HTTP API اور Bun انتظام
|
||||
- **[ڈیٹا بیس](https://docs.claude-mem.ai/architecture/database)** - SQLite اسکیما اور FTS5 تلاش
|
||||
- **[تلاش تعمیر](https://docs.claude-mem.ai/architecture/search-architecture)** - Chroma ویکٹر ڈیٹا بیس کے ساتھ ہائبرڈ تلاش
|
||||
|
||||
### ترتیبات اور ترقی
|
||||
|
||||
- **[ترتیبات](https://docs.claude-mem.ai/configuration)** - ماحول کے متغیرات اور سیٹنگز
|
||||
- **[ترقی](https://docs.claude-mem.ai/development)** - تعمیر، جانچ، حصہ داری
|
||||
- **[مسائل کی تشخیص](https://docs.claude-mem.ai/troubleshooting)** - عام مسائل اور حل
|
||||
|
||||
---
|
||||
|
||||
## یہ کیسے کام کرتا ہے
|
||||
|
||||
**اہم اجزاء:**
|
||||
|
||||
1. **5 لائف سائیکل ہکس** - SessionStart، UserPromptSubmit، PostToolUse، Stop، SessionEnd (6 ہک اسکرپٹس)
|
||||
2. **سمارٹ انسٹالیشن** - کیش شدہ منحصرات چیکر (پری ہک اسکرپٹ، لائف سائیکل ہک نہیں)
|
||||
3. **ورکر سروس** - ویب ویور UI اور 10 تلاش کے endpoints کے ساتھ پورٹ 37777 پر HTTP API، Bun کے ذریعے برتاؤ
|
||||
4. **SQLite ڈیٹا بیس** - سیشنز، مشاہدات، خلاصہ ذخیرہ کرتا ہے
|
||||
5. **mem-search مہارت** - بتدریج ظہور کے ساتھ قدرتی زبان کے سوالات
|
||||
6. **Chroma ویکٹر ڈیٹا بیس** - ہائبرڈ سیمانٹک + کلیدی لفظ تلاش ذہین تناسب کی بازیافت کے لیے
|
||||
|
||||
تفصیلات کے لیے [تعمیر کا جائزہ](https://docs.claude-mem.ai/architecture/overview) دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## MCP تلاش کے اوزار
|
||||
|
||||
Claude-Mem ٹوکن-موثر **3-لیئر ورک فلو پیٹرن** کی پیروی کرتے ہوئے **4 MCP اوزار** کے ذریعے ذہین میموری تلاش فراہم کرتا ہے:
|
||||
|
||||
**3-لیئر ورک فلو:**
|
||||
|
||||
1. **`search`** - IDs کے ساتھ کمپیکٹ انڈیکس حاصل کریں (~50-100 ٹوکن/نتیجہ)
|
||||
2. **`timeline`** - دلچسپ نتائج کے ارد گرد زمانی تناسب حاصل کریں
|
||||
3. **`get_observations`** - فلٹر شدہ IDs کے لیے صرف مکمل تفصیلات حاصل کریں (~500-1,000 ٹوکن/نتیجہ)
|
||||
|
||||
**یہ کیسے کام کرتا ہے:**
|
||||
- Claude آپ کی میموری میں تلاش کے لیے MCP اوزار استعمال کرتا ہے
|
||||
- نتائج کا انڈیکس حاصل کرنے کے لیے `search` سے شروع کریں
|
||||
- مخصوص مشاہدات کے ارد گرد کیا ہو رہا تھا دیکھنے کے لیے `timeline` استعمال کریں
|
||||
- متعلقہ IDs کے لیے مکمل تفصیلات حاصل کرنے کے لیے `get_observations` استعمال کریں
|
||||
- تفصیلات حاصل کرنے سے پہلے فلٹرنگ کے ذریعے **~10x ٹوکن کی بچت**
|
||||
|
||||
**دستیاب MCP اوزار:**
|
||||
|
||||
1. **`search`** - مکمل متن کی تلاش کے سوالات کے ساتھ میموری انڈیکس تلاش کریں، قسم/تاریخ/منصوبے کے لحاظ سے فلٹر کریں
|
||||
2. **`timeline`** - مخصوص مشاہدہ یا سوال کے ارد گرد زمانی تناسب حاصل کریں
|
||||
3. **`get_observations`** - IDs کے ذریعے مکمل مشاہدہ تفصیلات حاصل کریں (ہمیشہ متعدد IDs کو بیچ کریں)
|
||||
4. **`__IMPORTANT`** - ورک فلو دستاویزات (ہمیشہ Claude کو نظر آتی ہے)
|
||||
|
||||
**استعمال کی مثال:**
|
||||
|
||||
```typescript
|
||||
// مرحلہ 1: انڈیکس کے لیے تلاش کریں
|
||||
search(query="authentication bug", type="bugfix", limit=10)
|
||||
|
||||
// مرحلہ 2: انڈیکس کا جائزہ لیں، متعلقہ IDs کی شناخت کریں (مثلاً، #123, #456)
|
||||
|
||||
// مرحلہ 3: مکمل تفصیلات حاصل کریں
|
||||
get_observations(ids=[123, 456])
|
||||
```
|
||||
|
||||
تفصیلی مثالوں کے لیے [تلاش کے اوزار گائیڈ](https://docs.claude-mem.ai/usage/search-tools) دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## بیٹا خصوصیات
|
||||
|
||||
Claude-Mem ایک **بیٹا چینل** فراہم کرتا ہے جس میں **Endless Mode** جیسی تجرباتی خصوصیات ہیں (بڑھی ہوئی سیشنز کے لیے حیاتی نقل میموری کی تعمیر)۔ http://localhost:37777 → Settings میں ویب ویور UI سے مستحکم اور بیٹا ورژن کے درمیان سوئچ کریں۔
|
||||
|
||||
Endless Mode اور اسے کیسے آزمائیں اس کے بارے میں تفصیلات کے لیے **[بیٹا خصوصیات دستاویزات](https://docs.claude-mem.ai/beta-features)** دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## نظام کی ضروریات
|
||||
|
||||
- **Node.js**: 18.0.0 یا اس سے اوپر
|
||||
- **Claude Code**: پلگ ان سپورٹ کے ساتھ جدید ترین ورژن
|
||||
- **Bun**: JavaScript رن ٹائم اور پروسیس مینیجر (غیر موجود ہو تو خودکار طور پر انسٹال ہوگا)
|
||||
- **uv**: ویکٹر تلاش کے لیے Python پیکج مینیجر (غیر موجود ہو تو خودکار طور پر انسٹال ہوگا)
|
||||
- **SQLite 3**: مستقل اسٹوریج کے لیے (بنڈل شدہ)
|
||||
|
||||
---
|
||||
|
||||
## ترتیبات
|
||||
|
||||
سیٹنگز `~/.claude-mem/settings.json` میں منظم ہیں (پہلی رن میں ڈیفالٹ کے ساتھ خودکار طور پر بنائی جاتی ہے)۔ AI ماڈل، ورکر پورٹ، ڈیٹا ڈائریکٹری، لاگ لیول اور تناسب انجیکشن سیٹنگز کو ترتیب دیں۔
|
||||
|
||||
تمام دستیاب سیٹنگز اور مثالوں کے لیے **[ترتیبات گائیڈ](https://docs.claude-mem.ai/configuration)** دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## ترقی
|
||||
|
||||
تعمیر کی ہدایات، جانچ اور حصہ داری کے کام کے بہاؤ کے لیے **[ترقی گائیڈ](https://docs.claude-mem.ai/development)** دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## مسائل کی تشخیص
|
||||
|
||||
اگر مسائل کا سامنا ہو تو Claude کو مسئلہ بتائیں اور troubleshoot مہارت خودکار طور پر تشخیص دے گی اور حل فراہم کرے گی۔
|
||||
|
||||
عام مسائل اور حل کے لیے **[مسائل کی تشخیص گائیڈ](https://docs.claude-mem.ai/troubleshooting)** دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## خرابی کی رپورٹ
|
||||
|
||||
خودکار جنریٹر کے ساتھ تفصیلی خرابی کی رپورٹ تیار کریں:
|
||||
|
||||
```bash
|
||||
cd ~/.claude/plugins/marketplaces/thedotmack
|
||||
npm run bug-report
|
||||
```
|
||||
|
||||
## حصہ داری
|
||||
|
||||
حصہ داری کا خیر مقدم ہے! براہ کرم:
|
||||
|
||||
1. رپوزیٹری کو فورک کریں
|
||||
2. ایک خصوصیت کی برانچ بنائیں
|
||||
3. ٹیسٹ کے ساتھ اپنی تبدیلیاں کریں
|
||||
4. دستاویزات کو اپڈیٹ کریں
|
||||
5. ایک Pull Request جمع کریں
|
||||
|
||||
حصہ داری کے کام کے بہاؤ کے لیے [ترقی گائیڈ](https://docs.claude-mem.ai/development) دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## لائسنس
|
||||
|
||||
یہ منصوبہ **GNU Affero General Public License v3.0** (AGPL-3.0) کے تحت لائسنس ہے۔
|
||||
|
||||
Copyright (C) 2025 Alex Newman (@thedotmack)۔ تمام حقوق محفوظ ہیں۔
|
||||
|
||||
مکمل تفصیلات کے لیے [LICENSE](LICENSE) فائل دیکھیں۔
|
||||
|
||||
**اس کا مطلب کیا ہے:**
|
||||
|
||||
- آپ اس سافٹ ویئر کو آزادی سے استعمال، تبدیل اور تقسیم کر سکتے ہیں
|
||||
- اگر آپ اسے تبدیل کریں اور نیٹ ورک سرور میں نشر کریں تو آپ کو اپنا سورس کوڈ دستیاب کرنا ہوگا
|
||||
- ماخوذ کام بھی AGPL-3.0 کے تحت لائسنس ہونے چاہیں
|
||||
- اس سافٹ ویئر کے لیے کوئی وارنٹی نہیں
|
||||
|
||||
**Ragtime کے بارے میں نوٹ**: `ragtime/` ڈائریکٹری الگ سے **PolyForm Noncommercial License 1.0.0** کے تحت لائسنس ہے۔ تفصیلات کے لیے [ragtime/LICENSE](ragtime/LICENSE) دیکھیں۔
|
||||
|
||||
---
|
||||
|
||||
## معاونت
|
||||
|
||||
- **دستاویزات**: [docs/](docs/)
|
||||
- **مسائل**: [GitHub Issues](https://github.com/thedotmack/claude-mem/issues)
|
||||
- **رپوزیٹری**: [github.com/thedotmack/claude-mem](https://github.com/thedotmack/claude-mem)
|
||||
- **مصنف**: Alex Newman ([@thedotmack](https://github.com/thedotmack))
|
||||
|
||||
---
|
||||
|
||||
**Claude Agent SDK کے ساتھ بنایا گیا** | **Claude Code کے ذریعے طاقت ور** | **TypeScript کے ساتھ بنایا گیا**
|
||||
|
||||
</section>
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@ Khởi động lại Claude Code. Ngữ cảnh từ các phiên trước sẽ t
|
||||
|
||||
## Tài Liệu
|
||||
|
||||
📚 **[Xem Tài Liệu Đầy Đủ](docs/)** - Duyệt tài liệu markdown trên GitHub
|
||||
📚 **[Xem Tài Liệu Đầy Đủ](https://docs.claude-mem.ai/)** - Duyệt trên trang web chính thức
|
||||
|
||||
### Bắt Đầu
|
||||
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
🌐 這是自動翻譯。歡迎社群貢獻修正!
|
||||
|
||||
---
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-dark-mode.webp">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp" alt="Claude-Mem" width="400">
|
||||
</picture>
|
||||
</a>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
<a href="README.es.md">🇪🇸 Español</a> •
|
||||
<a href="README.de.md">🇩🇪 Deutsch</a> •
|
||||
<a href="README.fr.md">🇫🇷 Français</a>
|
||||
<a href="README.he.md">🇮🇱 עברית</a> •
|
||||
<a href="README.ar.md">🇸🇦 العربية</a> •
|
||||
<a href="README.ru.md">🇷🇺 Русский</a> •
|
||||
<a href="README.pl.md">🇵🇱 Polski</a> •
|
||||
<a href="README.cs.md">🇨🇿 Čeština</a> •
|
||||
<a href="README.nl.md">🇳🇱 Nederlands</a> •
|
||||
<a href="README.tr.md">🇹🇷 Türkçe</a> •
|
||||
<a href="README.uk.md">🇺🇦 Українська</a> •
|
||||
<a href="README.vi.md">🇻🇳 Tiếng Việt</a> •
|
||||
<a href="README.id.md">🇮🇩 Indonesia</a> •
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
<a href="README.el.md">🇬🇷 Ελληνικά</a> •
|
||||
<a href="README.hu.md">🇭🇺 Magyar</a> •
|
||||
<a href="README.fi.md">🇫🇮 Suomi</a> •
|
||||
<a href="README.da.md">🇩🇰 Dansk</a> •
|
||||
<a href="README.no.md">🇳🇴 Norsk</a>
|
||||
</p>
|
||||
|
||||
<h4 align="center">為 <a href="https://claude.com/claude-code" target="_blank">Claude Code</a> 打造的持久記憶壓縮系統</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="LICENSE">
|
||||
<img src="https://img.shields.io/badge/License-AGPL%203.0-blue.svg" alt="License">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/version-6.5.0-green.svg" alt="Version">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="Node">
|
||||
</a>
|
||||
<a href="https://github.com/thedotmack/awesome-claude-code">
|
||||
<img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Claude Code">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/15496" target="_blank">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge-dark.svg">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg" alt="thedotmack/claude-mem | Trendshift" width="250" height="55"/>
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/cm-preview.gif" alt="Claude-Mem Preview" width="800">
|
||||
</picture>
|
||||
</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 即使在工作階段結束或重新連線後,仍能維持對專案的知識連續性。
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## 快速開始
|
||||
|
||||
在終端機中開啟新的 Claude Code 工作階段,並輸入以下指令:
|
||||
|
||||
```
|
||||
> /plugin marketplace add thedotmack/claude-mem
|
||||
|
||||
> /plugin install claude-mem
|
||||
```
|
||||
|
||||
重新啟動 Claude Code。先前工作階段的脈絡將自動出現在新的工作階段中。
|
||||
|
||||
**主要功能:**
|
||||
|
||||
- 🧠 **持久記憶** - 脈絡跨工作階段保留
|
||||
- 📊 **漸進式揭露** - 具有 Token 成本可見性的分層記憶擷取
|
||||
- 🔍 **技能式搜尋** - 使用 mem-search 技能查詢專案歷史
|
||||
- 🖥️ **網頁檢視介面** - 在 http://localhost:37777 即時檢視記憶串流
|
||||
- 💻 **Claude Desktop 技能** - 從 Claude Desktop 對話中搜尋記憶
|
||||
- 🔒 **隱私控制** - 使用 `<private>` 標籤排除敏感內容的儲存
|
||||
- ⚙️ **脈絡設定** - 精細控制注入哪些脈絡
|
||||
- 🤖 **自動運作** - 無需手動介入
|
||||
- 🔗 **引用** - 使用 ID 參考過去的觀察(透過 http://localhost:37777/api/observation/{id} 存取,或在 http://localhost:37777 的網頁檢視器中檢視全部)
|
||||
- 🧪 **Beta 通道** - 透過版本切換試用 Endless Mode 等實驗性功能
|
||||
|
||||
---
|
||||
|
||||
## 文件
|
||||
|
||||
📚 **[檢視完整文件](docs/)** - 在 GitHub 上瀏覽 Markdown 文件
|
||||
|
||||
### 入門指南
|
||||
|
||||
- **[安裝指南](https://docs.claude-mem.ai/installation)** - 快速開始與進階安裝
|
||||
- **[使用指南](https://docs.claude-mem.ai/usage/getting-started)** - Claude-Mem 如何自動運作
|
||||
- **[搜尋工具](https://docs.claude-mem.ai/usage/search-tools)** - 使用自然語言查詢專案歷史
|
||||
- **[Beta 功能](https://docs.claude-mem.ai/beta-features)** - 試用 Endless Mode 等實驗性功能
|
||||
|
||||
### 最佳實務
|
||||
|
||||
- **[脈絡工程](https://docs.claude-mem.ai/context-engineering)** - AI 代理脈絡最佳化原則
|
||||
- **[漸進式揭露](https://docs.claude-mem.ai/progressive-disclosure)** - Claude-Mem 脈絡啟動策略背後的理念
|
||||
|
||||
### 架構
|
||||
|
||||
- **[概覽](https://docs.claude-mem.ai/architecture/overview)** - 系統元件與資料流程
|
||||
- **[架構演進](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 個掛鉤腳本說明
|
||||
- **[Worker 服務](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 向量資料庫的混合搜尋
|
||||
|
||||
### 設定與開發
|
||||
|
||||
- **[設定](https://docs.claude-mem.ai/configuration)** - 環境變數與設定
|
||||
- **[開發](https://docs.claude-mem.ai/development)** - 建置、測試、貢獻
|
||||
- **[疑難排解](https://docs.claude-mem.ai/troubleshooting)** - 常見問題與解決方案
|
||||
|
||||
---
|
||||
|
||||
## 運作原理
|
||||
|
||||
**核心元件:**
|
||||
|
||||
1. **5 個生命週期掛鉤** - SessionStart、UserPromptSubmit、PostToolUse、Stop、SessionEnd(6 個掛鉤腳本)
|
||||
2. **智慧安裝** - 快取的相依性檢查器(pre-hook 腳本,非生命週期掛鉤)
|
||||
3. **Worker 服務** - 連接埠 37777 上的 HTTP API,含網頁檢視介面與 10 個搜尋端點,由 Bun 管理
|
||||
4. **SQLite 資料庫** - 儲存工作階段、觀察、摘要
|
||||
5. **mem-search 技能** - 具有漸進式揭露的自然語言查詢
|
||||
6. **Chroma 向量資料庫** - 用於智慧脈絡擷取的混合語意 + 關鍵字搜尋
|
||||
|
||||
詳情請參閱[架構概覽](https://docs.claude-mem.ai/architecture/overview)。
|
||||
|
||||
---
|
||||
|
||||
## MCP 搜尋工具
|
||||
|
||||
Claude-Mem 透過遵循 Token 高效的 **3 層工作流程模式**,以 **4 個 MCP 工具**提供智慧記憶搜尋:
|
||||
|
||||
**3 層工作流程:**
|
||||
|
||||
1. **`search`** - 取得精簡索引與 ID(每筆結果約 50-100 tokens)
|
||||
2. **`timeline`** - 取得有趣結果周圍的時間脈絡
|
||||
3. **`get_observations`** - 僅為過濾後的 ID 擷取完整詳情(每筆結果約 500-1,000 tokens)
|
||||
|
||||
**運作方式:**
|
||||
|
||||
- Claude 使用 MCP 工具搜尋您的記憶
|
||||
- 從 `search` 開始取得結果索引
|
||||
- 使用 `timeline` 檢視特定觀察周圍發生的事情
|
||||
- 使用 `get_observations` 擷取相關 ID 的完整詳情
|
||||
- 透過在擷取詳情前過濾,**節省約 10 倍 token**
|
||||
|
||||
**可用的 MCP 工具:**
|
||||
|
||||
1. **`search`** - 使用全文查詢搜尋記憶索引,依類型/日期/專案過濾
|
||||
2. **`timeline`** - 取得特定觀察或查詢周圍的時間脈絡
|
||||
3. **`get_observations`** - 依 ID 擷取完整觀察詳情(批次處理多個 ID)
|
||||
4. **`__IMPORTANT`** - 工作流程文件(Claude 永遠可見)
|
||||
|
||||
**使用範例:**
|
||||
|
||||
```typescript
|
||||
// 步驟 1:搜尋索引
|
||||
search(query="authentication bug", type="bugfix", limit=10)
|
||||
|
||||
// 步驟 2:檢閱索引,識別相關 ID(例如 #123、#456)
|
||||
|
||||
// 步驟 3:擷取完整詳情
|
||||
get_observations(ids=[123, 456])
|
||||
```
|
||||
|
||||
詳細範例請參閱[搜尋工具指南](https://docs.claude-mem.ai/usage/search-tools)。
|
||||
|
||||
---
|
||||
|
||||
## Beta 功能
|
||||
|
||||
Claude-Mem 提供具有實驗性功能的 **Beta 通道**,例如 **Endless Mode**(用於延長工作階段的仿生記憶架構)。在 http://localhost:37777 → Settings 的網頁檢視介面中切換穩定版與 Beta 版。
|
||||
|
||||
有關 Endless Mode 與如何試用的詳情,請參閱 **[Beta 功能文件](https://docs.claude-mem.ai/beta-features)**。
|
||||
|
||||
---
|
||||
|
||||
## 系統需求
|
||||
|
||||
- **Node.js**:18.0.0 或更高版本
|
||||
- **Claude Code**:具有外掛支援的最新版本
|
||||
- **Bun**:JavaScript 執行環境與程序管理員(如缺少將自動安裝)
|
||||
- **uv**:用於向量搜尋的 Python 套件管理員(如缺少將自動安裝)
|
||||
- **SQLite 3**:用於持久儲存(已內建)
|
||||
|
||||
---
|
||||
|
||||
## 設定
|
||||
|
||||
設定在 `~/.claude-mem/settings.json` 中管理(首次執行時自動以預設值建立)。設定 AI 模型、Worker 連接埠、資料目錄、日誌層級與脈絡注入設定。
|
||||
|
||||
所有可用設定與範例請參閱 **[設定指南](https://docs.claude-mem.ai/configuration)**。
|
||||
|
||||
---
|
||||
|
||||
## 開發
|
||||
|
||||
建置說明、測試與貢獻工作流程請參閱 **[開發指南](https://docs.claude-mem.ai/development)**。
|
||||
|
||||
---
|
||||
|
||||
## 疑難排解
|
||||
|
||||
如遇問題,向 Claude 描述問題,troubleshoot 技能將自動診斷並提供修正。
|
||||
|
||||
常見問題與解決方案請參閱 **[疑難排解指南](https://docs.claude-mem.ai/troubleshooting)**。
|
||||
|
||||
---
|
||||
|
||||
## 錯誤回報
|
||||
|
||||
使用自動產生器建立完整的錯誤回報:
|
||||
|
||||
```bash
|
||||
cd ~/.claude/plugins/marketplaces/thedotmack
|
||||
npm run bug-report
|
||||
```
|
||||
|
||||
## 貢獻
|
||||
|
||||
歡迎貢獻!請依照以下步驟:
|
||||
|
||||
1. Fork 儲存庫
|
||||
2. 建立功能分支
|
||||
3. 加入測試並進行變更
|
||||
4. 更新文件
|
||||
5. 提交 Pull Request
|
||||
|
||||
貢獻工作流程請參閱[開發指南](https://docs.claude-mem.ai/development)。
|
||||
|
||||
---
|
||||
|
||||
## 授權條款
|
||||
|
||||
本專案採用 **GNU Affero 通用公共授權條款 v3.0**(AGPL-3.0)授權。
|
||||
|
||||
Copyright (C) 2025 Alex Newman (@thedotmack). All rights reserved.
|
||||
|
||||
完整詳情請參閱 [LICENSE](LICENSE) 檔案。
|
||||
|
||||
**這代表什麼:**
|
||||
|
||||
- 您可以自由使用、修改與散佈此軟體
|
||||
- 如果您修改並部署於網路伺服器上,您必須公開您的原始碼
|
||||
- 衍生作品也必須採用 AGPL-3.0 授權
|
||||
- 本軟體不提供任何擔保
|
||||
|
||||
**關於 Ragtime 的說明**:`ragtime/` 目錄採用 **PolyForm Noncommercial License 1.0.0** 另行授權。詳情請參閱 [ragtime/LICENSE](ragtime/LICENSE)。
|
||||
|
||||
---
|
||||
|
||||
## 支援
|
||||
|
||||
- **文件**:[docs/](docs/)
|
||||
- **Issues**:[GitHub Issues](https://github.com/thedotmack/claude-mem/issues)
|
||||
- **儲存庫**:[github.com/thedotmack/claude-mem](https://github.com/thedotmack/claude-mem)
|
||||
- **官方 X 帳號**:[@Claude_Memory](https://x.com/Claude_Memory)
|
||||
- **官方 Discord**:[加入 Discord](https://discord.com/invite/J4wttp9vDu)
|
||||
- **作者**:Alex Newman ([@thedotmack](https://github.com/thedotmack))
|
||||
|
||||
---
|
||||
|
||||
**使用 Claude Agent SDK 建置** | **由 Claude Code 驅動** | **以 TypeScript 開發**
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
@@ -34,6 +35,7 @@
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
@@ -126,7 +128,7 @@
|
||||
|
||||
## 文档
|
||||
|
||||
📚 **[查看完整文档](docs/)** - 在 GitHub 上浏览 Markdown 文档
|
||||
📚 **[查看完整文档](https://docs.claude-mem.ai/)** - 在官方网站浏览
|
||||
|
||||
### 入门指南
|
||||
|
||||
@@ -212,7 +214,7 @@ Claude-Mem 通过 mem-search 技能提供智能搜索,当您询问过去的工
|
||||
|
||||
Claude-Mem 提供**测试版渠道**,包含实验性功能,如**无尽模式**(用于扩展会话的仿生记忆架构)。从 Web 查看器界面 http://localhost:37777 → 设置 切换稳定版和测试版。
|
||||
|
||||
详见**[测试版功能文档](https://docs.claude-mem.ai/beta-features)**了解无尽模式的详细信息和试用方法。
|
||||
详见 **[测试版功能文档](https://docs.claude-mem.ai/beta-features)** 了解无尽模式的详细信息和试用方法。
|
||||
|
||||
---
|
||||
|
||||
@@ -230,13 +232,13 @@ Claude-Mem 提供**测试版渠道**,包含实验性功能,如**无尽模式**(
|
||||
|
||||
设置在 `~/.claude-mem/settings.json` 中管理(首次运行时自动创建默认设置)。可配置 AI 模型、worker 端口、数据目录、日志级别和上下文注入设置。
|
||||
|
||||
详见**[配置指南](https://docs.claude-mem.ai/configuration)**了解所有可用设置和示例。
|
||||
详见 **[配置指南](https://docs.claude-mem.ai/configuration)** 了解所有可用设置和示例。
|
||||
|
||||
---
|
||||
|
||||
## 开发
|
||||
|
||||
详见**[开发指南](https://docs.claude-mem.ai/development)**了解构建说明、测试和贡献工作流程。
|
||||
详见 **[开发指南](https://docs.claude-mem.ai/development)** 了解构建说明、测试和贡献工作流程。
|
||||
|
||||
---
|
||||
|
||||
@@ -244,7 +246,7 @@ Claude-Mem 提供**测试版渠道**,包含实验性功能,如**无尽模式**(
|
||||
|
||||
如果遇到问题,向 Claude 描述问题,troubleshoot 技能将自动诊断并提供修复方案。
|
||||
|
||||
详见**[故障排除指南](https://docs.claude-mem.ai/troubleshooting)**了解常见问题和解决方案。
|
||||
详见 **[故障排除指南](https://docs.claude-mem.ai/troubleshooting)** 了解常见问题和解决方案。
|
||||
|
||||
---
|
||||
|
||||
@@ -301,4 +303,4 @@ Copyright (C) 2025 Alex Newman (@thedotmack)。保留所有权利。
|
||||
|
||||
**使用 Claude Agent SDK 构建** | **由 Claude Code 驱动** | **使用 TypeScript 制作**
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
🌐 Esta é uma tradução manual por mig4ng. Correções da comunidade são bem-vindas!
|
||||
|
||||
---
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-dark-mode.webp">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/claude-mem-logo-for-light-mode.webp" alt="Claude-Mem" width="400">
|
||||
</picture>
|
||||
</a>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="README.zh.md">🇨🇳 中文</a> •
|
||||
<a href="README.zh-tw.md">🇹🇼 繁體中文</a> •
|
||||
<a href="README.ja.md">🇯🇵 日本語</a> •
|
||||
<a href="README.pt.md">🇵🇹 Português</a> •
|
||||
<a href="README.pt-br.md">🇧🇷 Português (Brasil)</a> •
|
||||
<a href="README.ko.md">🇰🇷 한국어</a> •
|
||||
<a href="README.es.md">🇪🇸 Español</a> •
|
||||
<a href="README.de.md">🇩🇪 Deutsch</a> •
|
||||
<a href="README.fr.md">🇫🇷 Français</a>
|
||||
<a href="README.he.md">🇮🇱 עברית</a> •
|
||||
<a href="README.ar.md">🇸🇦 العربية</a> •
|
||||
<a href="README.ru.md">🇷🇺 Русский</a> •
|
||||
<a href="README.pl.md">🇵🇱 Polski</a> •
|
||||
<a href="README.cs.md">🇨🇿 Čeština</a> •
|
||||
<a href="README.nl.md">🇳🇱 Nederlands</a> •
|
||||
<a href="README.tr.md">🇹🇷 Türkçe</a> •
|
||||
<a href="README.uk.md">🇺🇦 Українська</a> •
|
||||
<a href="README.vi.md">🇻🇳 Tiếng Việt</a> •
|
||||
<a href="README.id.md">🇮🇩 Indonesia</a> •
|
||||
<a href="README.th.md">🇹🇭 ไทย</a> •
|
||||
<a href="README.hi.md">🇮🇳 हिन्दी</a> •
|
||||
<a href="README.bn.md">🇧🇩 বাংলা</a> •
|
||||
<a href="README.ur.md">🇵🇰 اردو</a> •
|
||||
<a href="README.ro.md">🇷🇴 Română</a> •
|
||||
<a href="README.sv.md">🇸🇪 Svenska</a> •
|
||||
<a href="README.it.md">🇮🇹 Italiano</a> •
|
||||
<a href="README.el.md">🇬🇷 Ελληνικά</a> •
|
||||
<a href="README.hu.md">🇭🇺 Magyar</a> •
|
||||
<a href="README.fi.md">🇫🇮 Suomi</a> •
|
||||
<a href="README.da.md">🇩🇰 Dansk</a> •
|
||||
<a href="README.no.md">🇳🇴 Norsk</a>
|
||||
</p>
|
||||
|
||||
<h4 align="center">Sistema de compressão de memória persistente construído para <a href="https://claude.com/claude-code" target="_blank">Claude Code</a>.</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="LICENSE">
|
||||
<img src="https://img.shields.io/badge/License-AGPL%203.0-blue.svg" alt="License">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/version-6.5.0-green.svg" alt="Version">
|
||||
</a>
|
||||
<a href="package.json">
|
||||
<img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="Node">
|
||||
</a>
|
||||
<a href="https://github.com/thedotmack/awesome-claude-code">
|
||||
<img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Claude Code">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/15496" target="_blank">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge-dark.svg">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg">
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg" alt="thedotmack/claude-mem | Trendshift" width="250" height="55"/>
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/thedotmack/claude-mem">
|
||||
<picture>
|
||||
<img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/cm-preview.gif" alt="Claude-Mem Preview" width="800">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#início-rápido">Início Rápido</a> •
|
||||
<a href="#como-funciona">Como Funciona</a> •
|
||||
<a href="#ferramentas-de-procura-mcp">Ferramentas de Procura</a> •
|
||||
<a href="#documentação">Documentação</a> •
|
||||
<a href="#configuração">Configuração</a> •
|
||||
<a href="#solução-de-problemas">Solução de Problemas</a> •
|
||||
<a href="#licença">Licença</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Claude-Mem preserva o contexto perfeitamente entre sessões, capturando automaticamente observações de uso de ferramentas, gerando resumos semânticos e disponibilizando-os para sessões futuras. Isso permite que Claude mantenha a continuidade do conhecimento sobre projetos mesmo após o término ou reconexão de sessões.
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## Início Rápido
|
||||
|
||||
Inicie uma nova sessão do Claude Code no terminal e digite os seguintes comandos:
|
||||
|
||||
```
|
||||
> /plugin marketplace add thedotmack/claude-mem
|
||||
|
||||
> /plugin install claude-mem
|
||||
```
|
||||
|
||||
Reinicie o Claude Code. O contexto de sessões anteriores aparecerá automaticamente em novas sessões.
|
||||
|
||||
**Principais Recursos:**
|
||||
|
||||
- 🧠 **Memória Persistente** - O contexto sobrevive entre sessões
|
||||
- 📊 **Divulgação Progressiva** - Recuperação de memória em camadas com visibilidade de custo de tokens
|
||||
- 🔍 **Procura Baseada em Skill** - Consulte seu histórico de projeto com a skill mem-search
|
||||
- 🖥️ **Interface Web de Visualização** - Fluxo de memória em tempo real em http://localhost:37777
|
||||
- 💻 **Skill para Claude Desktop** - Busque memória em conversas do Claude Desktop
|
||||
- 🔒 **Controle de Privacidade** - Use tags `<private>` para excluir conteúdo sensível do armazenamento
|
||||
- ⚙️ **Configuração de Contexto** - Controle refinado sobre qual contexto é injetado
|
||||
- 🤖 **Operação Automática** - Nenhuma intervenção manual necessária
|
||||
- 🔗 **Citações** - Referencie observações passadas com IDs (acesse via http://localhost:37777/api/observation/{id} ou visualize todas no visualizador web em http://localhost:37777)
|
||||
- 🧪 **Canal Beta** - Experimente recursos experimentais como o Endless Mode através da troca de versões
|
||||
|
||||
---
|
||||
|
||||
## Documentação
|
||||
|
||||
📚 **[Ver Documentação Completa](https://docs.claude-mem.ai/)** - Navegar no site oficial
|
||||
|
||||
### Começando
|
||||
|
||||
- **[Guia de Instalação](https://docs.claude-mem.ai/installation)** - Início rápido e instalação avançada
|
||||
- **[Guia de Uso](https://docs.claude-mem.ai/usage/getting-started)** - Como Claude-Mem funciona automaticamente
|
||||
- **[Ferramentas de Procura](https://docs.claude-mem.ai/usage/search-tools)** - Consulte seu histórico de projeto com linguagem natural
|
||||
- **[Recursos Beta](https://docs.claude-mem.ai/beta-features)** - Experimente recursos experimentais como o Endless Mode
|
||||
|
||||
### Melhores Práticas
|
||||
|
||||
- **[Engenharia de Contexto](https://docs.claude-mem.ai/context-engineering)** - Princípios de otimização de contexto para agentes de IA
|
||||
- **[Divulgação Progressiva](https://docs.claude-mem.ai/progressive-disclosure)** - Filosofia por trás da estratégia de preparação de contexto do Claude-Mem
|
||||
|
||||
### Arquitetura
|
||||
|
||||
- **[Visão Geral](https://docs.claude-mem.ai/architecture/overview)** - Componentes do sistema e fluxo de dados
|
||||
- **[Evolução da Arquitetura](https://docs.claude-mem.ai/architecture-evolution)** - A jornada da v3 à v5
|
||||
- **[Arquitetura de Hooks](https://docs.claude-mem.ai/hooks-architecture)** - Como Claude-Mem usa hooks de ciclo de vida
|
||||
- **[Referência de Hooks](https://docs.claude-mem.ai/architecture/hooks)** - 7 scripts de hook explicados
|
||||
- **[Serviço Worker](https://docs.claude-mem.ai/architecture/worker-service)** - API HTTP e gerenciamento do Bun
|
||||
- **[Banco de Dados](https://docs.claude-mem.ai/architecture/database)** - Schema SQLite e Procura FTS5
|
||||
- **[Arquitetura de Procura](https://docs.claude-mem.ai/architecture/search-architecture)** - Procura híbrida com banco de dados vetorial Chroma
|
||||
|
||||
### Configuração e Desenvolvimento
|
||||
|
||||
- **[Configuração](https://docs.claude-mem.ai/configuration)** - Variáveis de ambiente e configurações
|
||||
- **[Desenvolvimento](https://docs.claude-mem.ai/development)** - Build, testes e contribuição
|
||||
- **[Solução de Problemas](https://docs.claude-mem.ai/troubleshooting)** - Problemas comuns e soluções
|
||||
|
||||
---
|
||||
|
||||
## Como Funciona
|
||||
|
||||
**Componentes Principais:**
|
||||
|
||||
1. **5 Hooks de Ciclo de Vida** - SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd (6 scripts de hook)
|
||||
2. **Instalação Inteligente** - Verificador de dependências em cache (script pré-hook, não um hook de ciclo de vida)
|
||||
3. **Serviço Worker** - API HTTP na porta 37777 com interface de visualização web e 10 endpoints de Procura, gerenciado pelo Bun
|
||||
4. **Banco de Dados SQLite** - Armazena sessões, observações, resumos
|
||||
5. **Skill mem-search** - Consultas em linguagem natural com divulgação progressiva
|
||||
6. **Banco de Dados Vetorial Chroma** - Procura híbrida semântica + palavra-chave para recuperação inteligente de contexto
|
||||
|
||||
Veja [Visão Geral da Arquitetura](https://docs.claude-mem.ai/architecture/overview) para detalhes.
|
||||
|
||||
---
|
||||
|
||||
## Skill mem-search
|
||||
|
||||
Claude-Mem fornece Procura inteligente através da skill mem-search que se auto-invoca quando você pergunta sobre trabalhos anteriores:
|
||||
|
||||
**Como Funciona:**
|
||||
- Pergunte naturalmente: *"O que fizemos na última sessão?"* ou *"Já corrigimos esse bug antes?"*
|
||||
- Claude invoca automaticamente a skill mem-search para encontrar contexto relevante
|
||||
|
||||
**Operações de Procura Disponíveis:**
|
||||
|
||||
1. **Search Observations** - Procura de texto completo em observações
|
||||
2. **Search Sessions** - Procura de texto completo em resumos de sessão
|
||||
3. **Search Prompts** - Procura em solicitações brutas do usuário
|
||||
4. **By Concept** - Encontre por tags de conceito (discovery, problem-solution, pattern, etc.)
|
||||
5. **By File** - Encontre observações que referenciam arquivos específicos
|
||||
6. **By Type** - Encontre por tipo (decision, bugfix, feature, refactor, discovery, change)
|
||||
7. **Recent Context** - Obtenha contexto de sessão recente para um projeto
|
||||
8. **Timeline** - Obtenha linha do tempo unificada de contexto em torno de um ponto específico no tempo
|
||||
9. **Timeline by Query** - Busque observações e obtenha contexto de linha do tempo em torno da melhor correspondência
|
||||
10. **API Help** - Obtenha documentação da API de Procura
|
||||
|
||||
**Exemplos de Consultas em Linguagem Natural:**
|
||||
|
||||
```
|
||||
"Quais bugs corrigimos na última sessão?"
|
||||
"Como implementamos a autenticação?"
|
||||
"Quais mudanças foram feitas em worker-service.ts?"
|
||||
"Mostre-me trabalhos recentes neste projeto"
|
||||
"O que estava acontecendo quando adicionamos a interface de visualização?"
|
||||
```
|
||||
|
||||
Veja [Guia de Ferramentas de Procura](https://docs.claude-mem.ai/usage/search-tools) para exemplos detalhados.
|
||||
|
||||
---
|
||||
|
||||
## Recursos Beta
|
||||
|
||||
Claude-Mem oferece um **canal beta** com recursos experimentais como **Endless Mode** (arquitetura de memória biomimética para sessões estendidas). Alterne entre versões estável e beta pela interface de visualização web em http://localhost:37777 → Settings.
|
||||
|
||||
Veja **[Documentação de Recursos Beta](https://docs.claude-mem.ai/beta-features)** para detalhes sobre o Endless Mode e como experimentá-lo.
|
||||
|
||||
---
|
||||
|
||||
## Requisitos do Sistema
|
||||
|
||||
- **Node.js**: 18.0.0 ou superior
|
||||
- **Claude Code**: Versão mais recente com suporte a plugins
|
||||
- **Bun**: Runtime JavaScript e gerenciador de processos (instalado automaticamente se ausente)
|
||||
- **uv**: Gerenciador de pacotes Python para Procura vetorial (instalado automaticamente se ausente)
|
||||
- **SQLite 3**: Para armazenamento persistente (incluído)
|
||||
|
||||
---
|
||||
|
||||
## Configuração
|
||||
|
||||
As configurações são gerenciadas em `~/.claude-mem/settings.json` (criado automaticamente com valores padrão na primeira execução). Configure modelo de IA, porta do worker, diretório de dados, nível de log e configurações de injeção de contexto.
|
||||
|
||||
Veja o **[Guia de Configuração](https://docs.claude-mem.ai/configuration)** para todas as configurações disponíveis e exemplos.
|
||||
|
||||
---
|
||||
|
||||
## Desenvolvimento
|
||||
|
||||
Veja o **[Guia de Desenvolvimento](https://docs.claude-mem.ai/development)** para instruções de build, testes e fluxo de contribuição.
|
||||
|
||||
---
|
||||
|
||||
## Solução de Problemas
|
||||
|
||||
Se você estiver enfrentando problemas, descreva o problema para Claude e a skill troubleshoot diagnosticará automaticamente e fornecerá correções.
|
||||
|
||||
Veja o **[Guia de Solução de Problemas](https://docs.claude-mem.ai/troubleshooting)** para problemas comuns e soluções.
|
||||
|
||||
---
|
||||
|
||||
## Relatos de Bug
|
||||
|
||||
Crie relatos de bug abrangentes com o gerador automatizado:
|
||||
|
||||
```bash
|
||||
cd ~/.claude/plugins/marketplaces/thedotmack
|
||||
npm run bug-report
|
||||
```
|
||||
|
||||
## Contribuindo
|
||||
|
||||
Contribuições são bem-vindas! Por favor:
|
||||
|
||||
1. Faça um fork do repositório
|
||||
2. Crie uma branch de feature
|
||||
3. Faça suas alterações com testes
|
||||
4. Atualize a documentação
|
||||
5. Envie um Pull Request
|
||||
|
||||
Veja [Guia de Desenvolvimento](https://docs.claude-mem.ai/development) para o fluxo de contribuição.
|
||||
|
||||
---
|
||||
|
||||
## Licença
|
||||
|
||||
Este projeto está licenciado sob a **GNU Affero General Public License v3.0** (AGPL-3.0).
|
||||
|
||||
Copyright (C) 2025 Alex Newman (@thedotmack). Todos os direitos reservados.
|
||||
|
||||
Veja o arquivo [LICENSE](LICENSE) para detalhes completos.
|
||||
|
||||
**O Que Isso Significa:**
|
||||
|
||||
- Você pode usar, modificar e distribuir este software livremente
|
||||
- Se você modificar e implantar em um servidor de rede, você deve disponibilizar seu código-fonte
|
||||
- Trabalhos derivados também devem ser licenciados sob AGPL-3.0
|
||||
- NÃO HÁ GARANTIA para este software
|
||||
|
||||
**Nota sobre Ragtime**: O diretório `ragtime/` é licenciado separadamente sob a **PolyForm Noncommercial License 1.0.0**. Veja [ragtime/LICENSE](ragtime/LICENSE) para detalhes.
|
||||
|
||||
---
|
||||
|
||||
## Suporte
|
||||
|
||||
- **Documentação**: [docs/](docs/)
|
||||
- **Issues**: [GitHub Issues](https://github.com/thedotmack/claude-mem/issues)
|
||||
- **Repositório**: [github.com/thedotmack/claude-mem](https://github.com/thedotmack/claude-mem)
|
||||
- **Autor**: Alex Newman ([@thedotmack](https://github.com/thedotmack))
|
||||
|
||||
---
|
||||
|
||||
**Construído com Claude Agent SDK** | **Desenvolvido por Claude Code** | **Feito com TypeScript** | **Editado por mig4ng**
|
||||
+1
-89
@@ -85,92 +85,4 @@ npx mintlify dev
|
||||
|
||||
**Simple Rule**:
|
||||
- `/docs/public/` = Official user documentation (Mintlify .mdx files) ← YOU ARE HERE
|
||||
- `/docs/context/` = Internal docs, plans, references, audits
|
||||
|
||||
|
||||
<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 |
|
||||
|----|------|---|-------|------|
|
||||
| #11206 | 3:01 PM | 🔵 | mem-search skill architecture and migration details retrieved in full format | ~538 |
|
||||
|
||||
### Nov 21, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #13221 | 2:01 AM | 🔴 | Fixed broken markdown link to Viewer UI documentation | ~316 |
|
||||
| #13220 | 2:00 AM | 🔴 | Escaped HTML less-than symbol in universal architecture timeout documentation | ~316 |
|
||||
| #13216 | 1:54 AM | ✅ | Universal Architecture Added to Navigation | ~330 |
|
||||
| #13215 | " | 🟣 | Universal AI Memory Architecture Documentation Created | ~732 |
|
||||
| #13213 | 1:50 AM | 🔵 | Introduction Page Content and Recent v6.0.0 Release | ~495 |
|
||||
| #13212 | " | 🔵 | Architecture Evolution Documentation Structure | ~408 |
|
||||
| #13211 | " | 🔵 | Mintlify Documentation Site Configuration | ~430 |
|
||||
| #13209 | 1:48 AM | 🔵 | Public Documentation Structure and Guidelines | ~383 |
|
||||
|
||||
### Nov 25, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #14994 | 2:22 PM | ✅ | Version Channel Section Added to Configuration Documentation | ~301 |
|
||||
| #14993 | " | ✅ | Beta Features Added to Documentation Navigation | ~188 |
|
||||
| #14992 | 2:21 PM | 🟣 | Beta Features Documentation Page Created | ~488 |
|
||||
| #14991 | " | 🔵 | Mintlify Navigation Structure and Documentation Groups | ~394 |
|
||||
| #14989 | " | 🔵 | Installation Documentation with Quick Start and Verification Steps | ~383 |
|
||||
| #14988 | " | 🔵 | Configuration Documentation Structure and Environment Variables | ~338 |
|
||||
|
||||
### Nov 26, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #16190 | 10:22 PM | 🔵 | RAGTIME Search Retrieved Five Observations About Claude-Mem vs RAG Architecture | ~637 |
|
||||
|
||||
### Dec 3, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #19884 | 9:42 PM | 🔵 | Configuration system and environment variables | ~701 |
|
||||
| #19878 | 9:40 PM | 🔵 | Installation process and system architecture | ~486 |
|
||||
|
||||
### Dec 8, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #22335 | 10:26 PM | 🔵 | Mintlify documentation configuration analyzed | ~534 |
|
||||
| #22311 | 9:47 PM | 🔵 | Comprehensive Hooks Architecture Documentation Review | ~263 |
|
||||
| #22297 | 9:43 PM | 🔵 | Mintlify Documentation Framework Configuration | ~446 |
|
||||
| #22294 | " | 🔵 | Documentation Site Structure Located | ~359 |
|
||||
|
||||
### Dec 9, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #23179 | 10:44 PM | ✅ | Removed explanatory reasons from tool exclusion documentation | ~297 |
|
||||
|
||||
### Dec 15, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #27038 | 6:02 PM | 🔵 | 95% token reduction claims found only in private experimental documents, not in main public docs | ~513 |
|
||||
| #27037 | " | 🔵 | Branch switching functionality exists in SettingsRoutes with UI switcher removal intent | ~463 |
|
||||
| #26986 | 5:24 PM | ✅ | Updated Endless Mode latency warning in beta features documentation | ~299 |
|
||||
|
||||
### Dec 29, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33938 | 6:27 PM | 🔵 | Relevant CLAUDE.md Context Identified for PR #492 | ~435 |
|
||||
| #33750 | 12:25 AM | ✅ | Documentation Update: Removed Version Number from Architecture Evolution | ~281 |
|
||||
|
||||
### Jan 7, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38233 | 7:42 PM | ✅ | Renumbered SessionEnd Hook from 6 to 5 | ~315 |
|
||||
| #38229 | 7:41 PM | ✅ | Renumbered PostToolUse Hook from 4 to 3 | ~278 |
|
||||
| #38225 | " | ✅ | Updated Hook Count Description in Hooks Architecture Documentation | ~352 |
|
||||
</claude-mem-context>
|
||||
- `/docs/context/` = Internal docs, plans, references, audits
|
||||
@@ -1,38 +0,0 @@
|
||||
<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 |
|
||||
|----|------|---|-------|------|
|
||||
| #11206 | 3:01 PM | 🔵 | mem-search skill architecture and migration details retrieved in full format | ~538 |
|
||||
|
||||
### Nov 21, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #13218 | 1:58 AM | 🔴 | Escaped HTML special character in MDX documentation | ~261 |
|
||||
|
||||
### Dec 3, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #19891 | 9:43 PM | 🔵 | Seven hook scripts across five lifecycle events | ~713 |
|
||||
|
||||
### Dec 15, 2025
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #27040 | 6:03 PM | 🔵 | Comprehensive search confirms no 95% claims exist in main branch public documentation | ~508 |
|
||||
| #27037 | 6:02 PM | 🔵 | Branch switching functionality exists in SettingsRoutes with UI switcher removal intent | ~463 |
|
||||
|
||||
### Jan 7, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38221 | 7:41 PM | ✅ | Removed User Message Hook Documentation Section | ~339 |
|
||||
| #38218 | 7:40 PM | ✅ | Updated Hook Configuration Documentation to Match Implementation | ~382 |
|
||||
| #38212 | " | 🔵 | 5-Stage Hook Lifecycle Architecture for Memory Agent | ~668 |
|
||||
</claude-mem-context>
|
||||
@@ -26,7 +26,7 @@ Settings are managed in `~/.claude-mem/settings.json`. The file is auto-created
|
||||
| Setting | Default | Description |
|
||||
|-------------------------------|---------------------------------|---------------------------------------|
|
||||
| `CLAUDE_MEM_GEMINI_API_KEY` | — | Gemini API key ([get free key](https://aistudio.google.com/app/apikey)) |
|
||||
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite` | Gemini model: `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash` |
|
||||
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite` | Gemini model: `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash-preview` |
|
||||
|
||||
See [Gemini Provider](usage/gemini-provider) for detailed configuration and free tier information.
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 29, 2025
|
||||
|
||||
**gemini-setup.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34346 | 11:11 PM | 🟣 | Gemini Free Tier Integration Guide | ~413 |
|
||||
| #34337 | 11:10 PM | 🔵 | Cursor Documentation Available | ~161 |
|
||||
| #34331 | 11:05 PM | 🔴 | Fixed Broken Links in cursor/gemini-setup.mdx | ~253 |
|
||||
| #34326 | 11:04 PM | 🔵 | Broken Links in Cursor Gemini Setup Documentation | ~324 |
|
||||
| #34320 | 11:03 PM | 🔵 | Mintlify Broken Links Detected in Documentation | ~292 |
|
||||
| #34215 | 10:08 PM | 🔵 | Retrieved Detailed Cursor Integration Implementation History | ~676 |
|
||||
| #34214 | 10:07 PM | 🔵 | Cursor Integration Feature Set Discovered via Memory Search | ~427 |
|
||||
| #34148 | 9:28 PM | 🟣 | Cursor IDE Integration with Cross-Platform Hooks and Documentation | ~514 |
|
||||
| #34112 | 9:07 PM | 🟣 | Committed Cursor Public Documentation to Repository | ~427 |
|
||||
| #34106 | 9:05 PM | 🟣 | Created Cursor-Specific Gemini Setup Guide | ~563 |
|
||||
|
||||
**index.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34339 | 11:10 PM | 🟣 | Cursor IDE Integration with Persistent Memory | ~394 |
|
||||
| #34335 | 11:06 PM | 🟣 | Mintlify Documentation Linting Successfully Completed | ~409 |
|
||||
| #34330 | 11:05 PM | 🔴 | Fixed Remaining Broken Links in cursor/index.mdx Next Steps Section | ~284 |
|
||||
| #34329 | " | 🔴 | Fixed Broken Links in cursor/index.mdx Detailed Guides Section | ~269 |
|
||||
| #34325 | 11:04 PM | 🔵 | Multiple Broken Links in Cursor Index Documentation | ~329 |
|
||||
| #34216 | 10:08 PM | 🔵 | Additional Cursor Integration Details Retrieved for Post Writing | ~600 |
|
||||
| #34105 | 9:05 PM | 🟣 | Created Cursor Integration Landing Page | ~522 |
|
||||
|
||||
**openrouter-setup.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34332 | 11:05 PM | 🔴 | Fixed Broken Links in cursor/openrouter-setup.mdx | ~283 |
|
||||
| #34324 | 11:04 PM | 🔵 | Broken Link Syntax Identified in Cursor Documentation | ~329 |
|
||||
| #34107 | 9:06 PM | 🟣 | Created Cursor-Specific OpenRouter Setup Guide | ~573 |
|
||||
|
||||
**cursor**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34322 | 11:03 PM | 🔵 | Cursor Directory Files Confirmed to Exist | ~224 |
|
||||
|
||||
### Jan 4, 2026
|
||||
|
||||
**gemini-setup.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36751 | 12:32 AM | 🔵 | Gemini-Related Files Located Across Project | ~242 |
|
||||
</claude-mem-context>
|
||||
@@ -103,7 +103,7 @@ Open http://localhost:37777 to see the memory viewer.
|
||||
|-------|---------------|-------|
|
||||
| `gemini-2.5-flash-lite` | 10 (4,000 with billing) | **Default.** Fastest, highest free tier RPM |
|
||||
| `gemini-2.5-flash` | 5 (1,000 with billing) | Higher capability |
|
||||
| `gemini-3-flash` | 5 (1,000 with billing) | Latest model |
|
||||
| `gemini-3-flash-preview` | 5 (1,000 with billing) | Latest model |
|
||||
|
||||
To change the model, update your settings:
|
||||
|
||||
|
||||
@@ -73,7 +73,8 @@
|
||||
"modes",
|
||||
"development",
|
||||
"troubleshooting",
|
||||
"platform-integration"
|
||||
"platform-integration",
|
||||
"openclaw-integration"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -22,6 +22,10 @@ That's it! The plugin will automatically:
|
||||
|
||||
Start a new Claude Code session and you'll see context from previous sessions automatically loaded.
|
||||
|
||||
> **Important:** Claude-Mem is published on npm, but running `npm install -g claude-mem` installs the
|
||||
> **SDK/library only**. It does **not** register plugin hooks or start the worker service.
|
||||
> To use Claude-Mem as a persistent memory plugin, always install via the `/plugin` commands above.
|
||||
|
||||
## System Requirements
|
||||
|
||||
- **Node.js**: 18.0.0 or higher
|
||||
|
||||
@@ -65,6 +65,7 @@ Inherits all behavior from Code Mode but instructs Claude to generate **all** me
|
||||
| **Hindi** | `code--hi` | हिन्दी |
|
||||
| **Hungarian** | `code--hu` | Magyar |
|
||||
| **Indonesian** | `code--id` | Bahasa Indonesia |
|
||||
| **Urdu** | `code--ur` | اردو |
|
||||
| **Italian** | `code--it` | Italiano |
|
||||
| **Japanese** | `code--ja` | 日本語 |
|
||||
| **Korean** | `code--ko` | 한국어 |
|
||||
|
||||
@@ -0,0 +1,385 @@
|
||||
---
|
||||
title: OpenClaw Integration
|
||||
description: Persistent memory for OpenClaw agents — observation recording, MEMORY.md live sync, and real-time observation feeds
|
||||
icon: dragon
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
The OpenClaw plugin gives claude-mem persistent memory to agents running on the [OpenClaw](https://openclaw.ai) gateway. It handles three things:
|
||||
|
||||
1. **Observation recording** — Captures tool usage from OpenClaw's embedded runner and sends it to the claude-mem worker for AI processing
|
||||
2. **MEMORY.md live sync** — Writes a continuously-updated timeline to each agent's workspace so agents always have context from previous sessions
|
||||
3. **Observation feed** — Streams new observations to messaging channels (Telegram, Discord, Slack, etc.) in real-time via SSE
|
||||
|
||||
<Info>
|
||||
OpenClaw's embedded runner (`pi-embedded`) calls the Anthropic API directly without spawning a `claude` process, so claude-mem's standard hooks never fire. This plugin bridges that gap by using OpenClaw's event system to capture the same data.
|
||||
</Info>
|
||||
|
||||
## How It Works
|
||||
|
||||
```plaintext
|
||||
OpenClaw Gateway
|
||||
│
|
||||
├── before_agent_start ──→ Sync MEMORY.md + Init session
|
||||
├── tool_result_persist ──→ Record observation + Re-sync MEMORY.md
|
||||
├── agent_end ────────────→ Summarize + Complete session
|
||||
└── gateway_start ────────→ Reset session tracking
|
||||
│
|
||||
▼
|
||||
Claude-Mem Worker (localhost:37777)
|
||||
├── POST /api/sessions/init
|
||||
├── POST /api/sessions/observations
|
||||
├── POST /api/sessions/summarize
|
||||
├── POST /api/sessions/complete
|
||||
├── GET /api/context/inject ──→ MEMORY.md content
|
||||
└── GET /stream ─────────────→ SSE → Messaging channels
|
||||
```
|
||||
|
||||
### Event Lifecycle
|
||||
|
||||
<Steps>
|
||||
<Step title="Agent starts (before_agent_start)">
|
||||
When an OpenClaw agent starts, the plugin does two things:
|
||||
|
||||
1. **Syncs MEMORY.md** — Fetches the latest timeline from the worker's `/api/context/inject` endpoint and writes it to `MEMORY.md` in the agent's workspace directory. This gives the agent context from all previous sessions before it starts working.
|
||||
|
||||
2. **Initializes a session** — Sends the user prompt to `POST /api/sessions/init` so the worker can create a new session and start processing.
|
||||
|
||||
Short prompts (under 10 characters) skip session init but still sync MEMORY.md.
|
||||
</Step>
|
||||
<Step title="Tool use recorded (tool_result_persist)">
|
||||
Every time the agent uses a tool (Read, Write, Bash, etc.), the plugin:
|
||||
|
||||
1. **Sends the observation** to `POST /api/sessions/observations` with the tool name, input, and truncated response (max 1000 chars)
|
||||
2. **Re-syncs MEMORY.md** with the latest timeline from the worker
|
||||
|
||||
Both operations are fire-and-forget — they don't block the agent from continuing work. The MEMORY.md file gets progressively richer as the session continues.
|
||||
|
||||
Tools prefixed with `memory_` are skipped to avoid recursive recording.
|
||||
</Step>
|
||||
<Step title="Agent finishes (agent_end)">
|
||||
When the agent completes, the plugin extracts the last assistant message and sends it to `POST /api/sessions/summarize`, then calls `POST /api/sessions/complete` to close the session. Both are fire-and-forget.
|
||||
</Step>
|
||||
<Step title="Gateway restarts (gateway_start)">
|
||||
Clears all session tracking (session IDs, workspace directory mappings) so agents get fresh state after a gateway restart.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### MEMORY.md Live Sync
|
||||
|
||||
The plugin writes a `MEMORY.md` file to each agent's workspace directory containing the full timeline of observations and summaries from previous sessions. This file is updated:
|
||||
|
||||
- On every `before_agent_start` event (agent gets fresh context before starting)
|
||||
- On every `tool_result_persist` event (context stays current during the session)
|
||||
|
||||
The content comes from the worker's `GET /api/context/inject?projects=<project>` endpoint, which generates a formatted markdown timeline from the SQLite database.
|
||||
|
||||
<Info>
|
||||
MEMORY.md updates are fire-and-forget. They run in the background without blocking the agent. The file reflects whatever the worker has processed so far — it doesn't wait for the current observation to be fully processed before writing.
|
||||
</Info>
|
||||
|
||||
### Observation Feed (SSE → Messaging)
|
||||
|
||||
The plugin runs a background service that connects to the worker's SSE stream (`GET /stream`) and forwards `new_observation` events to a configured messaging channel. This lets you monitor what your agents are learning in real-time from Telegram, Discord, Slack, or any supported OpenClaw channel.
|
||||
|
||||
The SSE connection uses exponential backoff (1s → 30s) for automatic reconnection.
|
||||
|
||||
## Setting Up the Observation Feed
|
||||
|
||||
The observation feed sends a formatted message to your OpenClaw channel every time claude-mem creates a new observation. Each message includes the observation title and subtitle so you can follow along as your agents work.
|
||||
|
||||
Messages look like this in your channel:
|
||||
|
||||
```
|
||||
🧠 Claude-Mem Observation
|
||||
**Implemented retry logic for API client**
|
||||
Added exponential backoff with configurable max retries to handle transient failures
|
||||
```
|
||||
|
||||
### Step 1: Choose your channel
|
||||
|
||||
The observation feed works with any channel that your OpenClaw gateway has configured. You need two pieces of information:
|
||||
|
||||
- **Channel type** — The name of the channel plugin registered with OpenClaw (e.g., `telegram`, `discord`, `slack`, `signal`, `whatsapp`, `line`)
|
||||
- **Target ID** — The chat ID, channel ID, or user ID where messages should be sent
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Telegram" icon="telegram">
|
||||
**Channel type:** `telegram`
|
||||
|
||||
**Target ID:** Your Telegram chat ID (numeric). To find it:
|
||||
1. Message [@userinfobot](https://t.me/userinfobot) on Telegram
|
||||
2. It will reply with your chat ID (e.g., `123456789`)
|
||||
3. For group chats, the ID is negative (e.g., `-1001234567890`)
|
||||
|
||||
```json
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "telegram",
|
||||
"to": "123456789"
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Discord" icon="discord">
|
||||
**Channel type:** `discord`
|
||||
|
||||
**Target ID:** The Discord channel ID. To find it:
|
||||
1. Enable Developer Mode in Discord (Settings → Advanced → Developer Mode)
|
||||
2. Right-click the channel → Copy Channel ID
|
||||
|
||||
```json
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "discord",
|
||||
"to": "1234567890123456789"
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Slack" icon="slack">
|
||||
**Channel type:** `slack`
|
||||
|
||||
**Target ID:** The Slack channel ID (not the channel name). To find it:
|
||||
1. Open the channel in Slack
|
||||
2. Click the channel name at the top
|
||||
3. Scroll to the bottom of the channel details — the ID looks like `C01ABC2DEFG`
|
||||
|
||||
```json
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "slack",
|
||||
"to": "C01ABC2DEFG"
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Signal" icon="signal-messenger">
|
||||
**Channel type:** `signal`
|
||||
|
||||
**Target ID:** The Signal phone number or group ID configured in your OpenClaw gateway.
|
||||
|
||||
```json
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "signal",
|
||||
"to": "+1234567890"
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="WhatsApp" icon="whatsapp">
|
||||
**Channel type:** `whatsapp`
|
||||
|
||||
**Target ID:** The WhatsApp phone number or group JID configured in your OpenClaw gateway.
|
||||
|
||||
```json
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "whatsapp",
|
||||
"to": "+1234567890"
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="LINE" icon="line">
|
||||
**Channel type:** `line`
|
||||
|
||||
**Target ID:** The LINE user ID or group ID from the LINE Developer Console.
|
||||
|
||||
```json
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "line",
|
||||
"to": "U1234567890abcdef"
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
### Step 2: Add the config to your gateway
|
||||
|
||||
Add the `observationFeed` block to your claude-mem plugin config in your OpenClaw gateway configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": {
|
||||
"claude-mem": {
|
||||
"enabled": true,
|
||||
"config": {
|
||||
"project": "my-project",
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "telegram",
|
||||
"to": "123456789"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<Warning>
|
||||
The `channel` value must match a channel plugin that is already configured and running on your OpenClaw gateway. If the channel isn't registered, you'll see `Unknown channel type: <channel>` in the logs.
|
||||
</Warning>
|
||||
|
||||
### Step 3: Verify the connection
|
||||
|
||||
After starting the gateway, check that the feed is connected:
|
||||
|
||||
1. **Check the logs** — You should see:
|
||||
```
|
||||
[claude-mem] Observation feed starting — channel: telegram, target: 123456789
|
||||
[claude-mem] Connecting to SSE stream at http://localhost:37777/stream
|
||||
[claude-mem] Connected to SSE stream
|
||||
```
|
||||
|
||||
2. **Use the status command** — Run `/claude_mem_feed` in any OpenClaw chat to see:
|
||||
```
|
||||
Claude-Mem Observation Feed
|
||||
Enabled: yes
|
||||
Channel: telegram
|
||||
Target: 123456789
|
||||
Connection: connected
|
||||
```
|
||||
|
||||
3. **Trigger a test** — Have an agent do some work. When the worker processes the tool usage into an observation, you'll receive a message in your configured channel.
|
||||
|
||||
<Info>
|
||||
The feed only sends `new_observation` events — not raw tool usage. Observations are generated asynchronously by the worker's AI agent, so there's a 1-2 second delay between tool use and the observation message appearing in your channel.
|
||||
</Info>
|
||||
|
||||
### Troubleshooting the Feed
|
||||
|
||||
| Symptom | Cause | Fix |
|
||||
|---------|-------|-----|
|
||||
| `Connection: disconnected` | Worker not running or wrong port | Check `workerPort` config, run `npm run worker:status` |
|
||||
| `Connection: reconnecting` | Worker was running but connection dropped | The plugin auto-reconnects with backoff — wait up to 30s |
|
||||
| `Unknown channel type` in logs | Channel plugin not loaded on gateway | Verify your OpenClaw gateway has the channel plugin configured |
|
||||
| No messages appearing | Feed connected but no observations being created | Check that agents are running and the worker is processing observations |
|
||||
| `Observation feed disabled` in logs | `enabled` is `false` or missing | Set `observationFeed.enabled` to `true` |
|
||||
| `Observation feed misconfigured` in logs | Missing `channel` or `to` | Both `channel` and `to` are required |
|
||||
|
||||
## Installation
|
||||
|
||||
Run this one-liner to install everything automatically:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://install.cmem.ai/openclaw.sh | bash
|
||||
```
|
||||
|
||||
The installer handles dependency checks (Bun, uv), plugin installation, memory slot configuration, AI provider setup, worker startup, and optional observation feed configuration.
|
||||
|
||||
You can also pre-select options:
|
||||
|
||||
```bash
|
||||
# With a specific AI provider
|
||||
curl -fsSL https://install.cmem.ai/openclaw.sh | bash -s -- --provider=gemini --api-key=YOUR_KEY
|
||||
|
||||
# Fully unattended (defaults to Claude Max Plan)
|
||||
curl -fsSL https://install.cmem.ai/openclaw.sh | bash -s -- --non-interactive
|
||||
|
||||
# Upgrade existing installation
|
||||
curl -fsSL https://install.cmem.ai/openclaw.sh | bash -s -- --upgrade
|
||||
```
|
||||
|
||||
### Manual Configuration
|
||||
|
||||
Add `claude-mem` to your OpenClaw gateway's plugin configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": {
|
||||
"claude-mem": {
|
||||
"enabled": true,
|
||||
"config": {
|
||||
"project": "my-project",
|
||||
"syncMemoryFile": true,
|
||||
"workerPort": 37777,
|
||||
"observationFeed": {
|
||||
"enabled": true,
|
||||
"channel": "telegram",
|
||||
"to": "your-chat-id"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<Note>
|
||||
The claude-mem worker service must be running on the same machine as the OpenClaw gateway. The plugin communicates with it via HTTP on `localhost:37777`.
|
||||
</Note>
|
||||
|
||||
## Configuration
|
||||
|
||||
<ParamField body="project" type="string" default="openclaw">
|
||||
Project name for scoping observations in the memory database. All observations from this gateway will be stored under this project name.
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="syncMemoryFile" type="boolean" default={true}>
|
||||
Enable automatic MEMORY.md sync to agent workspaces. Set to `false` if you don't want the plugin writing files to workspace directories.
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="workerPort" type="number" default={37777}>
|
||||
Port for the claude-mem worker service. Override if your worker runs on a non-default port.
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="observationFeed.enabled" type="boolean" default={false}>
|
||||
Enable live observation streaming to messaging channels.
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="observationFeed.channel" type="string">
|
||||
Channel type: `telegram`, `discord`, `signal`, `slack`, `whatsapp`, `line`
|
||||
</ParamField>
|
||||
|
||||
<ParamField body="observationFeed.to" type="string">
|
||||
Target chat/user/channel ID to send observations to.
|
||||
</ParamField>
|
||||
|
||||
## Commands
|
||||
|
||||
### /claude_mem_feed
|
||||
|
||||
Show or toggle the observation feed status.
|
||||
|
||||
```
|
||||
/claude_mem_feed # Show current status
|
||||
/claude_mem_feed on # Request enable
|
||||
/claude_mem_feed off # Request disable
|
||||
```
|
||||
|
||||
### /claude_mem_status
|
||||
|
||||
Check worker health and session status.
|
||||
|
||||
```
|
||||
/claude_mem_status
|
||||
```
|
||||
|
||||
Returns worker status, port, active session count, and observation feed connection state.
|
||||
|
||||
## Architecture
|
||||
|
||||
The plugin uses HTTP calls to the already-running claude-mem worker service rather than spawning subprocesses. This means:
|
||||
|
||||
- No `bun` dependency required on the gateway
|
||||
- No process spawn overhead per event
|
||||
- Uses the same worker API that Claude Code hooks use
|
||||
- All operations are non-blocking (fire-and-forget where possible)
|
||||
|
||||
### Session Tracking
|
||||
|
||||
Each OpenClaw agent session gets a unique `contentSessionId` (format: `openclaw-<sessionKey>-<timestamp>`) that maps to a claude-mem session in the worker. The plugin tracks:
|
||||
|
||||
- `sessionIds` — Maps OpenClaw session keys to content session IDs
|
||||
- `workspaceDirsBySessionKey` — Maps session keys to workspace directories so `tool_result_persist` events can sync MEMORY.md even when the event context doesn't include `workspaceDir`
|
||||
|
||||
Both maps are cleared on `gateway_start`.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Claude-mem worker service running on `localhost:37777` (or configured port)
|
||||
- OpenClaw gateway with plugin support
|
||||
- Network access between gateway and worker (localhost only)
|
||||
@@ -1,131 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 25, 2025
|
||||
|
||||
**gemini-provider.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32789 | 9:49 PM | 🟣 | Gemini AI Provider Integration Merged to Main | ~409 |
|
||||
|
||||
**manual-recovery.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32654 | 8:51 PM | 🔵 | Identified multiple files related to queue recovery | ~375 |
|
||||
|
||||
### Dec 26, 2025
|
||||
|
||||
**openrouter-provider.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32925 | 10:26 PM | 🔵 | OpenRouter Provider Integration Proposed in PR 448 | ~543 |
|
||||
| #32924 | 10:21 PM | 🟣 | OpenRouter Provider Documentation | ~501 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
**claude-desktop.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33651 | 11:44 PM | 🔴 | Migration 17 Wrapped in Transaction with Documentation Updates | ~331 |
|
||||
| #33650 | 11:43 PM | 🔵 | Code Changes Ready for Token Optimizations PR | ~292 |
|
||||
| #33648 | " | ✅ | Documentation Installation Steps Renumbered | ~283 |
|
||||
| #33647 | 11:42 PM | ✅ | Removed Skill Installation Steps from Claude Desktop Documentation | ~347 |
|
||||
| #33646 | " | ✅ | Updated Documentation to Reflect Streamlined 3-Tool MCP Architecture | ~391 |
|
||||
| #33643 | 11:41 PM | 🔵 | Documentation Uses Inconsistent Naming for MCP Server | ~403 |
|
||||
| #33639 | " | 🔵 | Pull Request Review Identified Critical Migration Risk | ~457 |
|
||||
| #33638 | 11:40 PM | 🔵 | Pull Request Review Identified Critical Migration Risk and Token Optimization Success | ~415 |
|
||||
| #33636 | 11:35 PM | ✅ | Major Documentation and Code Cleanup Removed 4,929 Lines | ~381 |
|
||||
| #33598 | 11:15 PM | 🔵 | Filtered MCP search query successfully returning rename history with type constraints | ~386 |
|
||||
| #33597 | 11:14 PM | 🔵 | MCP search tool successfully retrieving mem-search to mcp-search rename history | ~361 |
|
||||
| #33539 | 10:54 PM | ✅ | Updated configuration examples to use mcp-search as MCP server key | ~449 |
|
||||
| #33538 | " | ✅ | Updated Step 3 installation instructions to reference mcp-search MCP server | ~250 |
|
||||
| #33537 | " | ✅ | Updated prerequisites documentation to reference mcp-search MCP server | ~266 |
|
||||
| #33536 | 10:53 PM | 🔵 | Identified documentation file requiring MCP server name update | ~451 |
|
||||
| #33526 | 10:47 PM | 🔵 | Claude Desktop skill installation guide references mem-search server and skill | ~388 |
|
||||
|
||||
**search-tools.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33540 | 10:55 PM | 🔵 | Grep search found mem-search references in internationalized documentation | ~577 |
|
||||
|
||||
**openrouter-provider.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33312 | 3:09 PM | ✅ | OpenRouter Provider Documentation | ~497 |
|
||||
|
||||
### Dec 29, 2025
|
||||
|
||||
**gemini-provider.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34335 | 11:06 PM | 🟣 | Mintlify Documentation Linting Successfully Completed | ~409 |
|
||||
| #34333 | 11:05 PM | 🔴 | Fixed Broken Links in usage/gemini-provider.mdx | ~285 |
|
||||
| #34328 | 11:04 PM | 🔵 | Broken Link in Usage Gemini Provider Documentation | ~330 |
|
||||
| #34320 | 11:03 PM | 🔵 | Mintlify Broken Links Detected in Documentation | ~292 |
|
||||
| #34103 | 9:05 PM | 🔵 | Gemini Provider Documentation Covers Free Tier and Configuration | ~480 |
|
||||
|
||||
**openrouter-provider.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34334 | 11:05 PM | 🔴 | Fixed All Broken Links in usage/openrouter-provider.mdx | ~339 |
|
||||
| #34327 | 11:04 PM | 🔵 | Broken Links in Usage OpenRouter Provider Documentation | ~337 |
|
||||
|
||||
**usage**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34323 | 11:03 PM | 🔵 | Usage Directory Files Confirmed to Exist | ~280 |
|
||||
|
||||
**search-tools.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33763 | 12:27 AM | ✅ | Pull request #480 created for MCP architecture documentation updates | ~423 |
|
||||
| #33760 | 12:26 AM | ✅ | Major documentation overhaul across 6 files with 908 additions | ~367 |
|
||||
| #33702 | 12:09 AM | ⚖️ | Documentation Update Strategy Finalized for MCP Architecture Transition | ~845 |
|
||||
| #33694 | 12:06 AM | 🔵 | Search Tools Documentation Describes Deleted Skill Architecture | ~615 |
|
||||
| #33679 | 12:03 AM | 🔵 | Search Tools Documentation Structure and Skill-Based Architecture | ~473 |
|
||||
|
||||
**claude-desktop.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33703 | 12:10 AM | 🔵 | Final Documentation Review Confirms Update Requirements | ~756 |
|
||||
| #33699 | 12:08 AM | ✅ | Claude Desktop Documentation Successfully Updated for MCP Tools | ~583 |
|
||||
| #33689 | 12:05 AM | 🔴 | Migration 17 Transaction Safety and Documentation Updates | ~436 |
|
||||
| #33681 | 12:03 AM | ✅ | Claude Desktop Documentation Updated for MCP Tools Workflow | ~491 |
|
||||
| #33675 | 12:02 AM | 🔄 | Major Documentation and Code Cleanup in MCP Clarity Branch | ~491 |
|
||||
|
||||
### Jan 4, 2026
|
||||
|
||||
**gemini-provider.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36751 | 12:32 AM | 🔵 | Gemini-Related Files Located Across Project | ~242 |
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**folder-context.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38086 | 10:42 PM | ✅ | Merged PR with comprehensive CLAUDE.md documentation system | ~478 |
|
||||
| #38066 | 9:50 PM | ✅ | v9.0 Documentation Audit Completed with 14 Files Updated | ~547 |
|
||||
| #38064 | " | ⚖️ | 9.0 Release Documentation Audit Complete - Major Gaps Identified | ~997 |
|
||||
| #38053 | 9:47 PM | 🔵 | Folder Context Documentation Exists But Marked As Disabled By Default | ~616 |
|
||||
|
||||
**getting-started.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38042 | 9:44 PM | 🔵 | Getting Started Documentation Review for Live Context Gap | ~411 |
|
||||
|
||||
**claude-desktop.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37617 | 5:32 PM | ⚖️ | PR #558 Review Requirements Categorized by Priority | ~637 |
|
||||
| #37561 | 4:50 PM | 🔵 | Claude Desktop mem-search Skill Documentation Confirms Platform-Specific Feature | ~393 |
|
||||
|
||||
**private-tags.mdx**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37512 | 3:22 PM | 🔵 | Privacy Tag System Release History and Documentation Evolution | ~749 |
|
||||
| #37505 | 3:21 PM | 🔵 | Comprehensive Dual-Tag Privacy System Architecture and Implementation Details | ~915 |
|
||||
</claude-mem-context>
|
||||
@@ -39,7 +39,7 @@ Claude-mem supports Google's Gemini API as an alternative to the Claude Agent SD
|
||||
|---------|--------|---------|-------------|
|
||||
| `CLAUDE_MEM_PROVIDER` | `claude`, `gemini` | `claude` | AI provider for observation extraction |
|
||||
| `CLAUDE_MEM_GEMINI_API_KEY` | string | — | Your Gemini API key |
|
||||
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash` | `gemini-2.5-flash-lite` | Gemini model to use |
|
||||
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash-preview` | `gemini-2.5-flash-lite` | Gemini model to use |
|
||||
| `CLAUDE_MEM_GEMINI_BILLING_ENABLED` | `true`, `false` | `false` | Skip rate limiting if billing is enabled on Google Cloud |
|
||||
|
||||
### Using the Settings UI
|
||||
@@ -79,7 +79,7 @@ The settings file takes precedence over the environment variable.
|
||||
|-------|--------------|-------|
|
||||
| `gemini-2.5-flash-lite` | 10 | Default, recommended for free tier (highest RPM) |
|
||||
| `gemini-2.5-flash` | 5 | Higher capability, lower rate limit |
|
||||
| `gemini-3-flash` | 5 | Latest model, lower rate limit |
|
||||
| `gemini-3-flash-preview` | 5 | Latest model, lower rate limit |
|
||||
|
||||
## Provider Switching
|
||||
|
||||
@@ -139,7 +139,7 @@ Google has two rate limit tiers for free usage:
|
||||
|-------|-----|-----|
|
||||
| gemini-2.5-flash-lite | 10 | 250K |
|
||||
| gemini-2.5-flash | 5 | 250K |
|
||||
| gemini-3-flash | 5 | 250K |
|
||||
| gemini-3-flash-preview | 5 | 250K |
|
||||
|
||||
Claude-mem enforces these limits automatically with built-in delays between requests. Processing may be slower but stays within limits.
|
||||
|
||||
@@ -149,7 +149,7 @@ Claude-mem enforces these limits automatically with built-in delays between requ
|
||||
|-------|-----|-----|
|
||||
| gemini-2.5-flash-lite | 4,000 | 4M |
|
||||
| gemini-2.5-flash | 1,000 | 1M |
|
||||
| gemini-3-flash | 1,000 | 1M |
|
||||
| gemini-3-flash-preview | 1,000 | 1M |
|
||||
|
||||
<Tip>
|
||||
**Recommended**: Enable billing on your Google Cloud project to unlock much higher rate limits. You won't be charged unless you exceed the generous free quota. This allows claude-mem to process observations instantly instead of waiting between requests.
|
||||
|
||||
@@ -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.*
|
||||
@@ -1,17 +0,0 @@
|
||||
<claude-mem-context>
|
||||
# Recent Activity
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Jan 3, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36651 | 11:03 PM | 🔵 | Critical Design Decision Documented: Memory Session ID Must Never Equal Content Session ID | ~481 |
|
||||
|
||||
### Jan 8, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38731 | 6:49 PM | 🟣 | Comprehensive Sonnet vs Opus Behavioral Analysis Report Generated and Saved | ~700 |
|
||||
</claude-mem-context>
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
.vercel
|
||||
public/openclaw.sh
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# claude-mem installer bootstrap
|
||||
# Usage: curl -fsSL https://install.cmem.ai | bash
|
||||
# or: curl -fsSL https://install.cmem.ai | bash -s -- --provider=gemini --api-key=YOUR_KEY
|
||||
|
||||
INSTALLER_URL="https://install.cmem.ai/installer.js"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
error() { echo -e "${RED}Error: $1${NC}" >&2; exit 1; }
|
||||
info() { echo -e "${CYAN}$1${NC}"; }
|
||||
|
||||
# Check Node.js
|
||||
if ! command -v node &> /dev/null; then
|
||||
error "Node.js is required but not found. Install from https://nodejs.org"
|
||||
fi
|
||||
|
||||
NODE_VERSION=$(node -v | sed 's/v//')
|
||||
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1)
|
||||
if [ "$NODE_MAJOR" -lt 18 ]; then
|
||||
error "Node.js >= 18 required. Current: v${NODE_VERSION}"
|
||||
fi
|
||||
|
||||
info "claude-mem installer (Node.js v${NODE_VERSION})"
|
||||
|
||||
# Create temp file for installer
|
||||
TMPFILE=$(mktemp "${TMPDIR:-/tmp}/claude-mem-installer.XXXXXX.mjs")
|
||||
|
||||
# Cleanup on exit
|
||||
cleanup() {
|
||||
rm -f "$TMPFILE"
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
# Download installer
|
||||
info "Downloading installer..."
|
||||
if command -v curl &> /dev/null; then
|
||||
curl -fsSL "$INSTALLER_URL" -o "$TMPFILE"
|
||||
elif command -v wget &> /dev/null; then
|
||||
wget -q "$INSTALLER_URL" -O "$TMPFILE"
|
||||
else
|
||||
error "curl or wget required to download installer"
|
||||
fi
|
||||
|
||||
# Run installer with TTY access
|
||||
# When piped (curl | bash), stdin is the script. We need to reconnect to the terminal.
|
||||
if [ -t 0 ]; then
|
||||
# Already have TTY (script was downloaded and run directly)
|
||||
node "$TMPFILE" "$@"
|
||||
else
|
||||
# Piped execution -- reconnect stdin to terminal
|
||||
node "$TMPFILE" "$@" </dev/tty
|
||||
fi
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "https://openapi.vercel.sh/vercel.json",
|
||||
"rewrites": [
|
||||
{ "source": "/", "destination": "/install.sh" }
|
||||
],
|
||||
"headers": [
|
||||
{
|
||||
"source": "/(.*)\\.sh",
|
||||
"headers": [
|
||||
{ "key": "Content-Type", "value": "text/plain; charset=utf-8" },
|
||||
{ "key": "Cache-Control", "value": "public, max-age=300, s-maxage=60" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "/(.*)\\.js",
|
||||
"headers": [
|
||||
{ "key": "Content-Type", "value": "application/javascript; charset=utf-8" },
|
||||
{ "key": "Cache-Control", "value": "public, max-age=300, s-maxage=60" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { build } from 'esbuild';
|
||||
|
||||
await build({
|
||||
entryPoints: ['src/index.ts'],
|
||||
bundle: true,
|
||||
format: 'esm',
|
||||
platform: 'node',
|
||||
target: 'node18',
|
||||
outfile: 'dist/index.js',
|
||||
banner: {
|
||||
js: '#!/usr/bin/env node',
|
||||
},
|
||||
external: [],
|
||||
});
|
||||
|
||||
console.log('Build complete: dist/index.js');
|
||||
Vendored
+2107
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "claude-mem-installer",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"bin": { "claude-mem-installer": "./dist/index.js" },
|
||||
"files": ["dist"],
|
||||
"scripts": {
|
||||
"build": "node build.mjs",
|
||||
"dev": "node build.mjs && node dist/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.1",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.24.0",
|
||||
"typescript": "^5.7.0",
|
||||
"@types/node": "^22.0.0"
|
||||
},
|
||||
"engines": { "node": ">=18.0.0" }
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import * as p from '@clack/prompts';
|
||||
import { runWelcome } from './steps/welcome.js';
|
||||
import { runDependencyChecks } from './steps/dependencies.js';
|
||||
import { runIdeSelection } from './steps/ide-selection.js';
|
||||
import { runProviderConfiguration } from './steps/provider.js';
|
||||
import { runSettingsConfiguration } from './steps/settings.js';
|
||||
import { writeSettings } from './utils/settings-writer.js';
|
||||
import { runInstallation } from './steps/install.js';
|
||||
import { runWorkerStartup } from './steps/worker.js';
|
||||
import { runCompletion } from './steps/complete.js';
|
||||
|
||||
async function runInstaller(): Promise<void> {
|
||||
if (!process.stdin.isTTY) {
|
||||
console.error('Error: This installer requires an interactive terminal.');
|
||||
console.error('Run directly: npx claude-mem-installer');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const installMode = await runWelcome();
|
||||
|
||||
// Dependency checks (all modes)
|
||||
await runDependencyChecks();
|
||||
|
||||
// IDE and provider selection
|
||||
const selectedIDEs = await runIdeSelection();
|
||||
const providerConfig = await runProviderConfiguration();
|
||||
|
||||
// Settings configuration
|
||||
const settingsConfig = await runSettingsConfiguration();
|
||||
|
||||
// Write settings file
|
||||
writeSettings(providerConfig, settingsConfig);
|
||||
p.log.success('Settings saved.');
|
||||
|
||||
// Installation (fresh or upgrade)
|
||||
if (installMode !== 'configure') {
|
||||
await runInstallation(selectedIDEs);
|
||||
await runWorkerStartup(settingsConfig.workerPort, settingsConfig.dataDir);
|
||||
}
|
||||
|
||||
// Completion summary
|
||||
runCompletion(providerConfig, settingsConfig, selectedIDEs);
|
||||
}
|
||||
|
||||
runInstaller().catch((error) => {
|
||||
p.cancel('Installation failed.');
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
import * as p from '@clack/prompts';
|
||||
import pc from 'picocolors';
|
||||
import type { ProviderConfig } from './provider.js';
|
||||
import type { SettingsConfig } from './settings.js';
|
||||
import type { IDE } from './ide-selection.js';
|
||||
|
||||
function getProviderLabel(config: ProviderConfig): string {
|
||||
switch (config.provider) {
|
||||
case 'claude':
|
||||
return config.claudeAuthMethod === 'api' ? 'Claude (API Key)' : 'Claude (CLI subscription)';
|
||||
case 'gemini':
|
||||
return `Gemini (${config.model ?? 'gemini-2.5-flash-lite'})`;
|
||||
case 'openrouter':
|
||||
return `OpenRouter (${config.model ?? 'xiaomi/mimo-v2-flash:free'})`;
|
||||
}
|
||||
}
|
||||
|
||||
function getIDELabels(ides: IDE[]): string {
|
||||
return ides.map((ide) => {
|
||||
switch (ide) {
|
||||
case 'claude-code': return 'Claude Code';
|
||||
case 'cursor': return 'Cursor';
|
||||
}
|
||||
}).join(', ');
|
||||
}
|
||||
|
||||
export function runCompletion(
|
||||
providerConfig: ProviderConfig,
|
||||
settingsConfig: SettingsConfig,
|
||||
selectedIDEs: IDE[],
|
||||
): void {
|
||||
const summaryLines = [
|
||||
`Provider: ${pc.cyan(getProviderLabel(providerConfig))}`,
|
||||
`IDEs: ${pc.cyan(getIDELabels(selectedIDEs))}`,
|
||||
`Data dir: ${pc.cyan(settingsConfig.dataDir)}`,
|
||||
`Port: ${pc.cyan(settingsConfig.workerPort)}`,
|
||||
`Chroma: ${settingsConfig.chromaEnabled ? pc.green('enabled') : pc.dim('disabled')}`,
|
||||
];
|
||||
|
||||
p.note(summaryLines.join('\n'), 'Configuration Summary');
|
||||
|
||||
const nextStepsLines: string[] = [];
|
||||
|
||||
if (selectedIDEs.includes('claude-code')) {
|
||||
nextStepsLines.push('Open Claude Code and start a conversation — memory is automatic!');
|
||||
}
|
||||
if (selectedIDEs.includes('cursor')) {
|
||||
nextStepsLines.push('Open Cursor — hooks are active in your projects.');
|
||||
}
|
||||
nextStepsLines.push(`View your memories: ${pc.underline(`http://localhost:${settingsConfig.workerPort}`)}`);
|
||||
nextStepsLines.push(`Search past work: use ${pc.bold('/mem-search')} in Claude Code`);
|
||||
|
||||
p.note(nextStepsLines.join('\n'), 'Next Steps');
|
||||
|
||||
p.outro(pc.green('claude-mem installed successfully!'));
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
import * as p from '@clack/prompts';
|
||||
import pc from 'picocolors';
|
||||
import { findBinary, compareVersions, installBun, installUv } from '../utils/dependencies.js';
|
||||
import { detectOS } from '../utils/system.js';
|
||||
|
||||
const BUN_EXTRA_PATHS = ['~/.bun/bin/bun', '/usr/local/bin/bun', '/opt/homebrew/bin/bun'];
|
||||
const UV_EXTRA_PATHS = ['~/.local/bin/uv', '~/.cargo/bin/uv'];
|
||||
|
||||
interface DependencyStatus {
|
||||
nodeOk: boolean;
|
||||
gitOk: boolean;
|
||||
bunOk: boolean;
|
||||
uvOk: boolean;
|
||||
bunPath: string | null;
|
||||
uvPath: string | null;
|
||||
}
|
||||
|
||||
export async function runDependencyChecks(): Promise<DependencyStatus> {
|
||||
const status: DependencyStatus = {
|
||||
nodeOk: false,
|
||||
gitOk: false,
|
||||
bunOk: false,
|
||||
uvOk: false,
|
||||
bunPath: null,
|
||||
uvPath: null,
|
||||
};
|
||||
|
||||
await p.tasks([
|
||||
{
|
||||
title: 'Checking Node.js',
|
||||
task: async () => {
|
||||
const version = process.version.slice(1); // remove 'v'
|
||||
if (compareVersions(version, '18.0.0')) {
|
||||
status.nodeOk = true;
|
||||
return `Node.js ${process.version} ${pc.green('✓')}`;
|
||||
}
|
||||
return `Node.js ${process.version} — requires >= 18.0.0 ${pc.red('✗')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Checking git',
|
||||
task: async () => {
|
||||
const info = findBinary('git');
|
||||
if (info.found) {
|
||||
status.gitOk = true;
|
||||
return `git ${info.version ?? ''} ${pc.green('✓')}`;
|
||||
}
|
||||
return `git not found ${pc.red('✗')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Checking Bun',
|
||||
task: async () => {
|
||||
const info = findBinary('bun', BUN_EXTRA_PATHS);
|
||||
if (info.found && info.version && compareVersions(info.version, '1.1.14')) {
|
||||
status.bunOk = true;
|
||||
status.bunPath = info.path;
|
||||
return `Bun ${info.version} ${pc.green('✓')}`;
|
||||
}
|
||||
if (info.found && info.version) {
|
||||
return `Bun ${info.version} — requires >= 1.1.14 ${pc.yellow('⚠')}`;
|
||||
}
|
||||
return `Bun not found ${pc.yellow('⚠')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Checking uv',
|
||||
task: async () => {
|
||||
const info = findBinary('uv', UV_EXTRA_PATHS);
|
||||
if (info.found) {
|
||||
status.uvOk = true;
|
||||
status.uvPath = info.path;
|
||||
return `uv ${info.version ?? ''} ${pc.green('✓')}`;
|
||||
}
|
||||
return `uv not found ${pc.yellow('⚠')}`;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
// Handle missing dependencies
|
||||
if (!status.gitOk) {
|
||||
const os = detectOS();
|
||||
p.log.error('git is required but not found.');
|
||||
if (os === 'macos') {
|
||||
p.log.info('Install with: xcode-select --install');
|
||||
} else if (os === 'linux') {
|
||||
p.log.info('Install with: sudo apt install git (or your distro equivalent)');
|
||||
} else {
|
||||
p.log.info('Download from: https://git-scm.com/downloads');
|
||||
}
|
||||
p.cancel('Please install git and try again.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!status.nodeOk) {
|
||||
p.log.error(`Node.js >= 18.0.0 is required. Current: ${process.version}`);
|
||||
p.cancel('Please upgrade Node.js and try again.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!status.bunOk) {
|
||||
const shouldInstall = await p.confirm({
|
||||
message: 'Bun is required but not found. Install it now?',
|
||||
initialValue: true,
|
||||
});
|
||||
|
||||
if (p.isCancel(shouldInstall)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (shouldInstall) {
|
||||
const s = p.spinner();
|
||||
s.start('Installing Bun...');
|
||||
try {
|
||||
installBun();
|
||||
const recheck = findBinary('bun', BUN_EXTRA_PATHS);
|
||||
if (recheck.found) {
|
||||
status.bunOk = true;
|
||||
status.bunPath = recheck.path;
|
||||
s.stop(`Bun installed ${pc.green('✓')}`);
|
||||
} else {
|
||||
s.stop(`Bun installed but not found in PATH. You may need to restart your shell.`);
|
||||
}
|
||||
} catch {
|
||||
s.stop(`Bun installation failed. Install manually: curl -fsSL https://bun.sh/install | bash`);
|
||||
}
|
||||
} else {
|
||||
p.log.warn('Bun is required for claude-mem. Install manually: curl -fsSL https://bun.sh/install | bash');
|
||||
p.cancel('Cannot continue without Bun.');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!status.uvOk) {
|
||||
const shouldInstall = await p.confirm({
|
||||
message: 'uv (Python package manager) is recommended for Chroma. Install it now?',
|
||||
initialValue: true,
|
||||
});
|
||||
|
||||
if (p.isCancel(shouldInstall)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (shouldInstall) {
|
||||
const s = p.spinner();
|
||||
s.start('Installing uv...');
|
||||
try {
|
||||
installUv();
|
||||
const recheck = findBinary('uv', UV_EXTRA_PATHS);
|
||||
if (recheck.found) {
|
||||
status.uvOk = true;
|
||||
status.uvPath = recheck.path;
|
||||
s.stop(`uv installed ${pc.green('✓')}`);
|
||||
} else {
|
||||
s.stop('uv installed but not found in PATH. You may need to restart your shell.');
|
||||
}
|
||||
} catch {
|
||||
s.stop('uv installation failed. Install manually: curl -fsSL https://astral.sh/uv/install.sh | sh');
|
||||
}
|
||||
} else {
|
||||
p.log.warn('Skipping uv — Chroma vector search will not be available.');
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import * as p from '@clack/prompts';
|
||||
|
||||
export type IDE = 'claude-code' | 'cursor';
|
||||
|
||||
export async function runIdeSelection(): Promise<IDE[]> {
|
||||
const result = await p.multiselect({
|
||||
message: 'Which IDEs do you use?',
|
||||
options: [
|
||||
{ value: 'claude-code' as const, label: 'Claude Code', hint: 'recommended' },
|
||||
{ value: 'cursor' as const, label: 'Cursor' },
|
||||
// Windsurf coming soon - not yet selectable
|
||||
],
|
||||
initialValues: ['claude-code'],
|
||||
required: true,
|
||||
});
|
||||
|
||||
if (p.isCancel(result)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const selectedIDEs = result as IDE[];
|
||||
|
||||
if (selectedIDEs.includes('claude-code')) {
|
||||
p.log.info('Claude Code: Plugin will be registered via marketplace.');
|
||||
}
|
||||
if (selectedIDEs.includes('cursor')) {
|
||||
p.log.info('Cursor: Hooks will be configured for your projects.');
|
||||
}
|
||||
|
||||
return selectedIDEs;
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
import * as p from '@clack/prompts';
|
||||
import pc from 'picocolors';
|
||||
import { execSync } from 'child_process';
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { homedir, tmpdir } from 'os';
|
||||
import type { IDE } from './ide-selection.js';
|
||||
|
||||
const MARKETPLACE_DIR = join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack');
|
||||
const PLUGINS_DIR = join(homedir(), '.claude', 'plugins');
|
||||
const CLAUDE_SETTINGS_PATH = join(homedir(), '.claude', 'settings.json');
|
||||
|
||||
function ensureDir(directoryPath: string): void {
|
||||
if (!existsSync(directoryPath)) {
|
||||
mkdirSync(directoryPath, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
function readJsonFile(filepath: string): any {
|
||||
if (!existsSync(filepath)) return {};
|
||||
return JSON.parse(readFileSync(filepath, 'utf-8'));
|
||||
}
|
||||
|
||||
function writeJsonFile(filepath: string, data: any): void {
|
||||
ensureDir(join(filepath, '..'));
|
||||
writeFileSync(filepath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
||||
}
|
||||
|
||||
function registerMarketplace(): void {
|
||||
const knownMarketplacesPath = join(PLUGINS_DIR, 'known_marketplaces.json');
|
||||
const knownMarketplaces = readJsonFile(knownMarketplacesPath);
|
||||
|
||||
knownMarketplaces['thedotmack'] = {
|
||||
source: {
|
||||
source: 'github',
|
||||
repo: 'thedotmack/claude-mem',
|
||||
},
|
||||
installLocation: MARKETPLACE_DIR,
|
||||
lastUpdated: new Date().toISOString(),
|
||||
autoUpdate: true,
|
||||
};
|
||||
|
||||
ensureDir(PLUGINS_DIR);
|
||||
writeJsonFile(knownMarketplacesPath, knownMarketplaces);
|
||||
}
|
||||
|
||||
function registerPlugin(version: string): void {
|
||||
const installedPluginsPath = join(PLUGINS_DIR, 'installed_plugins.json');
|
||||
const installedPlugins = readJsonFile(installedPluginsPath);
|
||||
|
||||
if (!installedPlugins.version) installedPlugins.version = 2;
|
||||
if (!installedPlugins.plugins) installedPlugins.plugins = {};
|
||||
|
||||
const pluginCachePath = join(PLUGINS_DIR, 'cache', 'thedotmack', 'claude-mem', version);
|
||||
const now = new Date().toISOString();
|
||||
|
||||
installedPlugins.plugins['claude-mem@thedotmack'] = [
|
||||
{
|
||||
scope: 'user',
|
||||
installPath: pluginCachePath,
|
||||
version,
|
||||
installedAt: now,
|
||||
lastUpdated: now,
|
||||
},
|
||||
];
|
||||
|
||||
writeJsonFile(installedPluginsPath, installedPlugins);
|
||||
|
||||
// Copy built plugin to cache directory
|
||||
ensureDir(pluginCachePath);
|
||||
const pluginSourceDir = join(MARKETPLACE_DIR, 'plugin');
|
||||
if (existsSync(pluginSourceDir)) {
|
||||
cpSync(pluginSourceDir, pluginCachePath, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
function enablePluginInClaudeSettings(): void {
|
||||
const settings = readJsonFile(CLAUDE_SETTINGS_PATH);
|
||||
|
||||
if (!settings.enabledPlugins) settings.enabledPlugins = {};
|
||||
settings.enabledPlugins['claude-mem@thedotmack'] = true;
|
||||
|
||||
writeJsonFile(CLAUDE_SETTINGS_PATH, settings);
|
||||
}
|
||||
|
||||
function getPluginVersion(): string {
|
||||
const pluginJsonPath = join(MARKETPLACE_DIR, 'plugin', '.claude-plugin', 'plugin.json');
|
||||
if (existsSync(pluginJsonPath)) {
|
||||
const pluginJson = JSON.parse(readFileSync(pluginJsonPath, 'utf-8'));
|
||||
return pluginJson.version ?? '1.0.0';
|
||||
}
|
||||
return '1.0.0';
|
||||
}
|
||||
|
||||
export async function runInstallation(selectedIDEs: IDE[]): Promise<void> {
|
||||
const tempDir = join(tmpdir(), `claude-mem-install-${Date.now()}`);
|
||||
|
||||
await p.tasks([
|
||||
{
|
||||
title: 'Cloning claude-mem repository',
|
||||
task: async (message) => {
|
||||
message('Downloading latest release...');
|
||||
execSync(
|
||||
`git clone --depth 1 https://github.com/thedotmack/claude-mem.git "${tempDir}"`,
|
||||
{ stdio: 'pipe' },
|
||||
);
|
||||
return `Repository cloned ${pc.green('OK')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Installing dependencies',
|
||||
task: async (message) => {
|
||||
message('Running npm install...');
|
||||
execSync('npm install', { cwd: tempDir, stdio: 'pipe' });
|
||||
return `Dependencies installed ${pc.green('OK')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Building plugin',
|
||||
task: async (message) => {
|
||||
message('Compiling TypeScript and bundling...');
|
||||
execSync('npm run build', { cwd: tempDir, stdio: 'pipe' });
|
||||
return `Plugin built ${pc.green('OK')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Registering plugin',
|
||||
task: async (message) => {
|
||||
message('Copying files to marketplace directory...');
|
||||
ensureDir(MARKETPLACE_DIR);
|
||||
|
||||
// Sync from cloned repo to marketplace dir, excluding .git and lock files
|
||||
execSync(
|
||||
`rsync -a --delete --exclude=.git --exclude=package-lock.json --exclude=bun.lock "${tempDir}/" "${MARKETPLACE_DIR}/"`,
|
||||
{ stdio: 'pipe' },
|
||||
);
|
||||
|
||||
message('Registering marketplace...');
|
||||
registerMarketplace();
|
||||
|
||||
message('Installing marketplace dependencies...');
|
||||
execSync('npm install', { cwd: MARKETPLACE_DIR, stdio: 'pipe' });
|
||||
|
||||
message('Registering plugin in Claude Code...');
|
||||
const version = getPluginVersion();
|
||||
registerPlugin(version);
|
||||
|
||||
message('Enabling plugin...');
|
||||
enablePluginInClaudeSettings();
|
||||
|
||||
return `Plugin registered (v${getPluginVersion()}) ${pc.green('OK')}`;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
// Cleanup temp directory (non-critical if it fails)
|
||||
try {
|
||||
execSync(`rm -rf "${tempDir}"`, { stdio: 'pipe' });
|
||||
} catch {
|
||||
// Temp dir will be cleaned by OS eventually
|
||||
}
|
||||
|
||||
if (selectedIDEs.includes('cursor')) {
|
||||
p.log.info('Cursor hook configuration will be available after first launch.');
|
||||
p.log.info('Run: claude-mem cursor-setup (coming soon)');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import * as p from '@clack/prompts';
|
||||
import pc from 'picocolors';
|
||||
|
||||
export type ProviderType = 'claude' | 'gemini' | 'openrouter';
|
||||
export type ClaudeAuthMethod = 'cli' | 'api';
|
||||
|
||||
export interface ProviderConfig {
|
||||
provider: ProviderType;
|
||||
claudeAuthMethod?: ClaudeAuthMethod;
|
||||
apiKey?: string;
|
||||
model?: string;
|
||||
rateLimitingEnabled?: boolean;
|
||||
}
|
||||
|
||||
export async function runProviderConfiguration(): Promise<ProviderConfig> {
|
||||
const provider = await p.select({
|
||||
message: 'Which AI provider should claude-mem use for memory compression?',
|
||||
options: [
|
||||
{ value: 'claude' as const, label: 'Claude', hint: 'uses your Claude subscription' },
|
||||
{ value: 'gemini' as const, label: 'Gemini', hint: 'free tier available' },
|
||||
{ value: 'openrouter' as const, label: 'OpenRouter', hint: 'free models available' },
|
||||
],
|
||||
});
|
||||
|
||||
if (p.isCancel(provider)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const config: ProviderConfig = { provider };
|
||||
|
||||
if (provider === 'claude') {
|
||||
const authMethod = await p.select({
|
||||
message: 'How should Claude authenticate?',
|
||||
options: [
|
||||
{ value: 'cli' as const, label: 'CLI (Max Plan subscription)', hint: 'no API key needed' },
|
||||
{ value: 'api' as const, label: 'API Key', hint: 'uses Anthropic API credits' },
|
||||
],
|
||||
});
|
||||
|
||||
if (p.isCancel(authMethod)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.claudeAuthMethod = authMethod;
|
||||
|
||||
if (authMethod === 'api') {
|
||||
const apiKey = await p.password({
|
||||
message: 'Enter your Anthropic API key:',
|
||||
validate: (value) => {
|
||||
if (!value || value.trim().length === 0) return 'API key is required';
|
||||
if (!value.startsWith('sk-ant-')) return 'Anthropic API keys start with sk-ant-';
|
||||
},
|
||||
});
|
||||
|
||||
if (p.isCancel(apiKey)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.apiKey = apiKey;
|
||||
}
|
||||
}
|
||||
|
||||
if (provider === 'gemini') {
|
||||
const apiKey = await p.password({
|
||||
message: 'Enter your Gemini API key:',
|
||||
validate: (value) => {
|
||||
if (!value || value.trim().length === 0) return 'API key is required';
|
||||
},
|
||||
});
|
||||
|
||||
if (p.isCancel(apiKey)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.apiKey = apiKey;
|
||||
|
||||
const model = await p.select({
|
||||
message: 'Which Gemini model?',
|
||||
options: [
|
||||
{ value: 'gemini-2.5-flash-lite' as const, label: 'Gemini 2.5 Flash Lite', hint: 'fastest, highest free RPM' },
|
||||
{ value: 'gemini-2.5-flash' as const, label: 'Gemini 2.5 Flash', hint: 'balanced' },
|
||||
{ value: 'gemini-3-flash-preview' as const, label: 'Gemini 3 Flash Preview', hint: 'latest' },
|
||||
],
|
||||
});
|
||||
|
||||
if (p.isCancel(model)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.model = model;
|
||||
|
||||
const rateLimiting = await p.confirm({
|
||||
message: 'Enable rate limiting? (recommended for free tier)',
|
||||
initialValue: true,
|
||||
});
|
||||
|
||||
if (p.isCancel(rateLimiting)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.rateLimitingEnabled = rateLimiting;
|
||||
}
|
||||
|
||||
if (provider === 'openrouter') {
|
||||
const apiKey = await p.password({
|
||||
message: 'Enter your OpenRouter API key:',
|
||||
validate: (value) => {
|
||||
if (!value || value.trim().length === 0) return 'API key is required';
|
||||
},
|
||||
});
|
||||
|
||||
if (p.isCancel(apiKey)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.apiKey = apiKey;
|
||||
|
||||
const model = await p.text({
|
||||
message: 'Which OpenRouter model?',
|
||||
defaultValue: 'xiaomi/mimo-v2-flash:free',
|
||||
placeholder: 'xiaomi/mimo-v2-flash:free',
|
||||
});
|
||||
|
||||
if (p.isCancel(model)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
config.model = model;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
import * as p from '@clack/prompts';
|
||||
import pc from 'picocolors';
|
||||
|
||||
export interface SettingsConfig {
|
||||
workerPort: string;
|
||||
dataDir: string;
|
||||
contextObservations: string;
|
||||
logLevel: string;
|
||||
pythonVersion: string;
|
||||
chromaEnabled: boolean;
|
||||
chromaMode?: 'local' | 'remote';
|
||||
chromaHost?: string;
|
||||
chromaPort?: string;
|
||||
chromaSsl?: boolean;
|
||||
}
|
||||
|
||||
export async function runSettingsConfiguration(): Promise<SettingsConfig> {
|
||||
const useDefaults = await p.confirm({
|
||||
message: 'Use default settings? (recommended for most users)',
|
||||
initialValue: true,
|
||||
});
|
||||
|
||||
if (p.isCancel(useDefaults)) {
|
||||
p.cancel('Installation cancelled.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (useDefaults) {
|
||||
return {
|
||||
workerPort: '37777',
|
||||
dataDir: '~/.claude-mem',
|
||||
contextObservations: '50',
|
||||
logLevel: 'INFO',
|
||||
pythonVersion: '3.13',
|
||||
chromaEnabled: true,
|
||||
chromaMode: 'local',
|
||||
};
|
||||
}
|
||||
|
||||
// Custom settings
|
||||
const workerPort = await p.text({
|
||||
message: 'Worker service port:',
|
||||
defaultValue: '37777',
|
||||
placeholder: '37777',
|
||||
validate: (value = '') => {
|
||||
const port = parseInt(value, 10);
|
||||
if (isNaN(port) || port < 1024 || port > 65535) {
|
||||
return 'Port must be between 1024 and 65535';
|
||||
}
|
||||
},
|
||||
});
|
||||
if (p.isCancel(workerPort)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
|
||||
const dataDir = await p.text({
|
||||
message: 'Data directory:',
|
||||
defaultValue: '~/.claude-mem',
|
||||
placeholder: '~/.claude-mem',
|
||||
});
|
||||
if (p.isCancel(dataDir)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
|
||||
const contextObservations = await p.text({
|
||||
message: 'Number of context observations per session:',
|
||||
defaultValue: '50',
|
||||
placeholder: '50',
|
||||
validate: (value = '') => {
|
||||
const num = parseInt(value, 10);
|
||||
if (isNaN(num) || num < 1 || num > 200) {
|
||||
return 'Must be between 1 and 200';
|
||||
}
|
||||
},
|
||||
});
|
||||
if (p.isCancel(contextObservations)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
|
||||
const logLevel = await p.select({
|
||||
message: 'Log level:',
|
||||
options: [
|
||||
{ value: 'DEBUG', label: 'DEBUG', hint: 'verbose' },
|
||||
{ value: 'INFO', label: 'INFO', hint: 'default' },
|
||||
{ value: 'WARN', label: 'WARN' },
|
||||
{ value: 'ERROR', label: 'ERROR', hint: 'errors only' },
|
||||
],
|
||||
initialValue: 'INFO',
|
||||
});
|
||||
if (p.isCancel(logLevel)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
|
||||
const pythonVersion = await p.text({
|
||||
message: 'Python version (for Chroma):',
|
||||
defaultValue: '3.13',
|
||||
placeholder: '3.13',
|
||||
});
|
||||
if (p.isCancel(pythonVersion)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
|
||||
const chromaEnabled = await p.confirm({
|
||||
message: 'Enable Chroma vector search?',
|
||||
initialValue: true,
|
||||
});
|
||||
if (p.isCancel(chromaEnabled)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
|
||||
let chromaMode: 'local' | 'remote' | undefined;
|
||||
let chromaHost: string | undefined;
|
||||
let chromaPort: string | undefined;
|
||||
let chromaSsl: boolean | undefined;
|
||||
|
||||
if (chromaEnabled) {
|
||||
const mode = await p.select({
|
||||
message: 'Chroma mode:',
|
||||
options: [
|
||||
{ value: 'local' as const, label: 'Local', hint: 'starts local Chroma server' },
|
||||
{ value: 'remote' as const, label: 'Remote', hint: 'connect to existing server' },
|
||||
],
|
||||
});
|
||||
if (p.isCancel(mode)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
chromaMode = mode;
|
||||
|
||||
if (mode === 'remote') {
|
||||
const host = await p.text({
|
||||
message: 'Chroma host:',
|
||||
defaultValue: '127.0.0.1',
|
||||
placeholder: '127.0.0.1',
|
||||
});
|
||||
if (p.isCancel(host)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
chromaHost = host;
|
||||
|
||||
const port = await p.text({
|
||||
message: 'Chroma port:',
|
||||
defaultValue: '8000',
|
||||
placeholder: '8000',
|
||||
validate: (value = '') => {
|
||||
const portNum = parseInt(value, 10);
|
||||
if (isNaN(portNum) || portNum < 1 || portNum > 65535) return 'Port must be between 1 and 65535';
|
||||
},
|
||||
});
|
||||
if (p.isCancel(port)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
chromaPort = port;
|
||||
|
||||
const ssl = await p.confirm({
|
||||
message: 'Use SSL for Chroma connection?',
|
||||
initialValue: false,
|
||||
});
|
||||
if (p.isCancel(ssl)) { p.cancel('Installation cancelled.'); process.exit(0); }
|
||||
chromaSsl = ssl;
|
||||
}
|
||||
}
|
||||
|
||||
const config: SettingsConfig = {
|
||||
workerPort,
|
||||
dataDir,
|
||||
contextObservations,
|
||||
logLevel,
|
||||
pythonVersion,
|
||||
chromaEnabled,
|
||||
chromaMode,
|
||||
chromaHost,
|
||||
chromaPort,
|
||||
chromaSsl,
|
||||
};
|
||||
|
||||
// Show summary
|
||||
const summaryLines = [
|
||||
`Worker port: ${pc.cyan(workerPort)}`,
|
||||
`Data directory: ${pc.cyan(dataDir)}`,
|
||||
`Context observations: ${pc.cyan(contextObservations)}`,
|
||||
`Log level: ${pc.cyan(logLevel)}`,
|
||||
`Python version: ${pc.cyan(pythonVersion)}`,
|
||||
`Chroma: ${chromaEnabled ? pc.green('enabled') : pc.dim('disabled')}`,
|
||||
];
|
||||
if (chromaEnabled && chromaMode) {
|
||||
summaryLines.push(`Chroma mode: ${pc.cyan(chromaMode)}`);
|
||||
}
|
||||
|
||||
p.note(summaryLines.join('\n'), 'Settings Summary');
|
||||
|
||||
return config;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user