Refactor settings management to use ~/.claude-mem/settings.json

- Updated paths in troubleshooting documentation to reflect new settings file location.
- Modified diagnostics and reference files to read from ~/.claude-mem/settings.json.
- Introduced getWorkerPort utility for cleaner worker port retrieval.
- Enhanced ChromaSync and SDKAgent to load Python version and Claude path from settings.
- Updated SettingsRoutes to validate new settings: CLAUDE_MEM_LOG_LEVEL and CLAUDE_MEM_PYTHON_VERSION.
- Added early-settings module to load settings for logger and other early-stage modules.
- Adjusted logger to use early-loaded log level setting.
- Refactored paths to utilize early-loaded data directory setting.
This commit is contained in:
Alex Newman
2025-12-09 12:23:33 -05:00
parent b22adcca05
commit fc5c2d5e07
23 changed files with 342 additions and 166 deletions
+75 -19
View File
@@ -5,18 +5,38 @@ description: "Environment variables and settings for Claude-Mem"
# Configuration
## Environment Variables
## Settings File
| Variable | Default | Description |
Settings are managed in `~/.claude-mem/settings.json`. The file is auto-created with defaults on first run.
### Core Settings
| Setting | Default | Description |
|-------------------------------|---------------------------------|---------------------------------------|
| `CLAUDE_PLUGIN_ROOT` | Set by Claude Code | Plugin installation directory |
| `CLAUDE_MEM_DATA_DIR` | `~/.claude-mem/` | Data directory (production default) |
| `CLAUDE_CODE_PATH` | Auto-detected | Path to Claude Code CLI (for Windows) |
| `CLAUDE_MEM_WORKER_PORT` | `37777` | Worker service port |
| `CLAUDE_MEM_MODEL` | `claude-haiku-4-5` | AI model for processing observations |
| `CLAUDE_MEM_CONTEXT_OBSERVATIONS` | `50` | Number of observations to inject |
| `NODE_ENV` | `production` | Environment mode |
| `FORCE_COLOR` | `1` | Enable colored logs |
| `CLAUDE_MEM_WORKER_PORT` | `37777` | Worker service port |
### System Configuration
| Setting | Default | Description |
|-------------------------------|---------------------------------|---------------------------------------|
| `CLAUDE_MEM_DATA_DIR` | `~/.claude-mem` | Data directory location |
| `CLAUDE_MEM_LOG_LEVEL` | `INFO` | Log verbosity (DEBUG, INFO, WARN, ERROR, SILENT) |
| `CLAUDE_MEM_PYTHON_VERSION` | `3.13` | Python version for chroma-mcp |
| `CLAUDE_CODE_PATH` | _(auto-detect)_ | Path to Claude Code CLI (for Windows) |
### Environment Variables (Override Only)
Environment variables can temporarily override settings from the file for advanced use cases:
| Variable | Description |
|-------------------------------|---------------------------------------|
| `CLAUDE_PLUGIN_ROOT` | Set by Claude Code (plugin installation directory) |
| `NODE_ENV` | Environment mode (set by PM2) |
| `FORCE_COLOR` | Enable colored logs (set by PM2) |
**Note**: Settings file values take priority. Environment variables only apply when a setting is not present in the file.
## Model Configuration
@@ -35,15 +55,17 @@ Configure which AI model processes your observations.
./claude-mem-settings.sh
```
This script manages `CLAUDE_MEM_MODEL` in `~/.claude/settings.json`.
This script manages settings in `~/.claude-mem/settings.json`.
### Manual Configuration
Edit `~/.claude/settings.json`:
Edit `~/.claude-mem/settings.json`:
```json
{
"CLAUDE_MEM_MODEL": "claude-haiku-4-5"
"env": {
"CLAUDE_MEM_MODEL": "claude-haiku-4-5"
}
}
```
@@ -284,7 +306,7 @@ Token economics help you understand the value of cached observations vs. re-read
### Manual Configuration
Settings are stored in `~/.claude-mem/settings.json`. You can also configure via environment variables in `~/.claude/settings.json`:
Settings are stored in `~/.claude-mem/settings.json`:
```json
{
@@ -304,36 +326,70 @@ Settings are stored in `~/.claude-mem/settings.json`. You can also configure via
}
```
**Note**: The Context Settings Modal is the recommended way to configure these settings, as it provides live preview of changes.
**Note**: The Context Settings Modal (at http://localhost:37777) is the recommended way to configure these settings, as it provides live preview of changes.
## Customization
Settings can be customized in `~/.claude-mem/settings.json` or temporarily overridden via environment variables.
### Custom Data Directory
For development or testing, override the data directory:
**Recommended**: Edit `~/.claude-mem/settings.json`:
```json
{
"env": {
"CLAUDE_MEM_DATA_DIR": "/custom/path"
}
}
```
**Or** temporarily override via environment variable:
```bash
export CLAUDE_MEM_DATA_DIR=/custom/path
CLAUDE_MEM_DATA_DIR=/custom/path claude
```
### Custom Worker Port
If port 37777 is in use:
**Recommended**: Edit `~/.claude-mem/settings.json`:
```json
{
"env": {
"CLAUDE_MEM_WORKER_PORT": "38000"
}
}
```
Then restart the worker:
```bash
export CLAUDE_MEM_WORKER_PORT=38000
npm run worker:restart
```
**Or** temporarily override via environment variable:
```bash
CLAUDE_MEM_WORKER_PORT=38000 npm run worker:restart
```
### Custom Model
Use a different AI model:
**Recommended**: Edit `~/.claude-mem/settings.json`:
```json
{
"env": {
"CLAUDE_MEM_MODEL": "claude-opus-4"
}
}
```
Then restart the worker:
```bash
export CLAUDE_MEM_MODEL=claude-opus-4
npm run worker:restart
```
**Or** temporarily override via environment variable:
```bash
CLAUDE_MEM_MODEL=claude-opus-4 npm run worker:restart
```
## Advanced Configuration
### Hook Timeouts