refactor: optimize CLAUDE.md context footprint (-49%)

Extract Ollama docs and PROJECT_STATE locking protocol to on-demand
reference files. Trim Work Mode to detection table only. Remove verbose
anti-pattern examples and credential encryption details.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-20 12:09:17 -07:00
parent 30af2d31c7
commit a50af7faf1
4 changed files with 395 additions and 493 deletions

67
.claude/OLLAMA.md Normal file
View File

@@ -0,0 +1,67 @@
# Ollama — Local AI Reference
Ollama runs on Mike's workstation (DESKTOP-0O8A1RL) with GPU acceleration. Available to all team members via Tailscale.
## Models
| Model | Size | Use For |
|-------|------|---------|
| `qwen3:14b` | 9.3 GB | Summarization, classification, data extraction, drafting |
| `codestral:22b` | 12 GB | Code generation, refactoring suggestions, docstrings |
| `nomic-embed-text` | 274 MB | Embeddings only (used by GrepAI) |
## Endpoints
- **DESKTOP-0O8A1RL** (local): `http://localhost:11434`
- **Any other machine** (Tailscale required): `http://100.92.127.64:11434`
Check reachability:
```bash
curl -s http://100.92.127.64:11434/api/tags | python -c "import sys,json; [print(m['name']) for m in json.load(sys.stdin).get('models',[])]"
```
If it fails: verify Tailscale is connected (`tailscale status`) and Mike's workstation is online.
## Access Control
- Port 11434 allowed ONLY from Tailscale subnet (100.0.0.0/8)
- NOT exposed to LAN, VPN, or internet
- Binding: `OLLAMA_HOST=0.0.0.0:11434` (firewall restricts)
## Calling Ollama
Resolve endpoint from identity.json first:
```bash
OLLAMA=$([ "$(jq -r .machine .claude/identity.json 2>/dev/null)" = "DESKTOP-0O8A1RL" ] \
&& echo "http://localhost:11434" || echo "http://100.92.127.64:11434")
```
Preferred one-liner (avoids shell escaping):
```bash
python3 -c "
import urllib.request, json, sys
url = 'http://localhost:11434/api/generate'
body = json.dumps({'model':'qwen3:14b','prompt': sys.argv[1],'stream':False}).encode()
res = json.loads(urllib.request.urlopen(urllib.request.Request(url, body)).read())
print(res['response'])
" "Your prompt here"
```
For code suggestions, swap `qwen3:14b` for `codestral:22b`.
## When to Use Which Model
| Task | Model |
|------|-------|
| Summarize logs, diffs, session notes | qwen3:14b |
| Classify bug type, severity, category | qwen3:14b |
| Extract structured data from text | qwen3:14b |
| Draft commit message from diff | qwen3:14b |
| Suggest refactor for a function | codestral:22b |
| Docstring / comment generation | codestral:22b |
## Review Policy
- Low-stakes output (summary, classification, draft) — use directly
- Code suggestions from codestral — always review before applying
- Never use Ollama for: auth decisions, credential handling, production migrations, security review