proposal: centralize machine config in identity.json
Merge Ollama fallback pattern with identity.json approach. Store endpoint/fallback/prose_model to eliminate curl probes. Same pattern as claudetools_root/vault_path (working). Next: coord message rollout to populate fields on all machines.
This commit is contained in:
147
.claude/memory/proposal_identity_centralization.md
Normal file
147
.claude/memory/proposal_identity_centralization.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Proposal: Centralize Machine-Specific Config in identity.json
|
||||
|
||||
## Problem
|
||||
Machine-specific settings are scattered across scripts with repeated detection logic:
|
||||
- Ollama endpoint probed with curl on every use
|
||||
- Python interpreter tried in sequence (`py`, `python3`, `python`)
|
||||
- Hostname detection (`$COMPUTERNAME` vs `hostname`)
|
||||
- Platform-specific path guessing
|
||||
|
||||
## Solution
|
||||
Store all machine-specific config in identity.json. Scripts read once, no probing.
|
||||
|
||||
## Proposed Schema (Full)
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "mike",
|
||||
"full_name": "Mike Swanson",
|
||||
"email": "mike@azcomputerguru.com",
|
||||
"role": "admin",
|
||||
"machine": "GURU-5070",
|
||||
"platform": "windows",
|
||||
"architecture": "amd64",
|
||||
|
||||
"paths": {
|
||||
"claudetools_root": "D:/claudetools",
|
||||
"vault_path": "D:/vault"
|
||||
},
|
||||
|
||||
"python": {
|
||||
"command": "py"
|
||||
},
|
||||
|
||||
"ollama": {
|
||||
"endpoint": "http://localhost:11434",
|
||||
"fallback": "http://100.101.122.4:11434",
|
||||
"prose_model": "qwen3:8b"
|
||||
},
|
||||
|
||||
"mode": "general",
|
||||
"last_updated": "2026-05-26T19:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Ollama Integration (Current vs Proposed)
|
||||
|
||||
**Current (OLLAMA.md pattern):**
|
||||
```bash
|
||||
if curl -s -m 2 http://localhost:11434/api/tags >/dev/null 2>&1; then
|
||||
OLLAMA="http://localhost:11434"
|
||||
else
|
||||
OLLAMA="http://100.101.122.4:11434" # Beast via Tailscale
|
||||
fi
|
||||
```
|
||||
|
||||
**Proposed:**
|
||||
```bash
|
||||
OLLAMA=$(jq -r '.ollama.endpoint // "http://100.101.122.4:11434"' "$IDENTITY_PATH")
|
||||
```
|
||||
|
||||
**Validation script** (run during onboarding or manually):
|
||||
```bash
|
||||
# .claude/scripts/validate-ollama.sh
|
||||
ENDPOINT=$(jq -r '.ollama.endpoint' .claude/identity.json)
|
||||
if ! curl -s -m 2 "$ENDPOINT/api/tags" >/dev/null 2>&1; then
|
||||
echo "[WARNING] Ollama endpoint $ENDPOINT unreachable"
|
||||
FALLBACK=$(jq -r '.ollama.fallback' .claude/identity.json)
|
||||
echo "Trying fallback: $FALLBACK"
|
||||
if curl -s -m 2 "$FALLBACK/api/tags" >/dev/null 2>&1; then
|
||||
echo "Fallback works. Update identity.json endpoint to: $FALLBACK"
|
||||
fi
|
||||
fi
|
||||
```
|
||||
|
||||
## Per-Machine Config Examples
|
||||
|
||||
**GURU-5070 (Mike's primary, Windows):**
|
||||
```json
|
||||
{
|
||||
"ollama": {
|
||||
"endpoint": "http://localhost:11434",
|
||||
"fallback": "http://100.101.122.4:11434",
|
||||
"prose_model": "qwen3:8b"
|
||||
},
|
||||
"python": {"command": "py"},
|
||||
"platform": "windows"
|
||||
}
|
||||
```
|
||||
|
||||
**GURU-BEAST-ROG (always-on Ollama host):**
|
||||
```json
|
||||
{
|
||||
"ollama": {
|
||||
"endpoint": "http://localhost:11434",
|
||||
"fallback": "http://localhost:11434",
|
||||
"prose_model": "qwen3:14b"
|
||||
},
|
||||
"python": {"command": "python3"},
|
||||
"platform": "windows"
|
||||
}
|
||||
```
|
||||
|
||||
**GURU-KALI (no local Ollama, remote only):**
|
||||
```json
|
||||
{
|
||||
"ollama": {
|
||||
"endpoint": "http://100.101.122.4:11434",
|
||||
"fallback": "http://100.101.122.4:11434",
|
||||
"prose_model": "qwen3:14b"
|
||||
},
|
||||
"python": {"command": "python3"},
|
||||
"platform": "linux"
|
||||
}
|
||||
```
|
||||
|
||||
**Howard-Home (local Ollama):**
|
||||
```json
|
||||
{
|
||||
"ollama": {
|
||||
"endpoint": "http://localhost:11434",
|
||||
"fallback": "http://100.101.122.4:11434",
|
||||
"prose_model": "qwen3:14b"
|
||||
},
|
||||
"python": {"command": "python3"},
|
||||
"platform": "windows"
|
||||
}
|
||||
```
|
||||
|
||||
## Migration Path
|
||||
|
||||
1. Add fields to identity.json template in CLAUDE.md onboarding
|
||||
2. Send coord message to all machines: "Update identity.json with Ollama/Python config"
|
||||
3. Each machine runs validation script, auto-detects, writes config
|
||||
4. Update syncro.md, OLLAMA.md, sync.sh to read from identity.json
|
||||
5. Remove detection logic from scripts
|
||||
|
||||
## Benefits
|
||||
|
||||
- **Faster**: No curl probe on every Ollama call (saves 2 seconds)
|
||||
- **Explicit**: Machine declares "I use local Ollama" vs "I use remote"
|
||||
- **Auditable**: `cat .claude/identity.json` shows full machine config
|
||||
- **Consistent**: Same pattern as `claudetools_root` / `vault_path` (already working)
|
||||
- **Offline-safe**: Scripts work without network probe (use declared endpoint)
|
||||
|
||||
## Rollout
|
||||
|
||||
Use coord API to send migration instructions to each machine (same pattern as claudetools_root rollout today).
|
||||
Reference in New Issue
Block a user