Replaced 50+ emoji types with ASCII text markers for consistent rendering across all terminals, editors, and operating systems: - Checkmarks/status: [OK], [DONE], [SUCCESS], [PASS] - Errors/warnings: [ERROR], [FAIL], [WARNING], [CRITICAL] - Actions: [DO], [DO NOT], [REQUIRED], [OPTIONAL] - Navigation: [NEXT], [PREVIOUS], [TIP], [NOTE] - Progress: [IN PROGRESS], [PENDING], [BLOCKED] Additional changes: - Made paths cross-platform (~/ClaudeTools for Mac/Linux) - Fixed database host references to 172.16.3.30 - Updated START_HERE.md and CONTEXT_RECOVERY_PROMPT.md for multi-OS use Files updated: 58 markdown files across: - .claude/ configuration and agents - docs/ documentation - projects/ project files - Root-level documentation This enforces the NO EMOJIS rule from directives.md and ensures documentation renders correctly on all systems. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
261 lines
6.0 KiB
Markdown
261 lines
6.0 KiB
Markdown
---
|
|
name: "Database Connection Info"
|
|
description: "Centralized database connection configuration for all agents"
|
|
---
|
|
|
|
# Database Connection Information
|
|
**FOR ALL AGENTS - UPDATED 2026-01-17**
|
|
|
|
---
|
|
|
|
## Current Database Configuration
|
|
|
|
### Production Database (RMM Server)
|
|
- **Host:** 172.16.3.30
|
|
- **Port:** 3306
|
|
- **Database:** claudetools
|
|
- **User:** claudetools
|
|
- **Password:** CT_e8fcd5a3952030a79ed6debae6c954ed
|
|
- **Character Set:** utf8mb4
|
|
- **Tables:** 43 tables (all migrated)
|
|
|
|
### Connection String
|
|
```
|
|
mysql+pymysql://claudetools:CT_e8fcd5a3952030a79ed6debae6c954ed@172.16.3.30:3306/claudetools?charset=utf8mb4
|
|
```
|
|
|
|
### Environment Variable
|
|
```bash
|
|
DATABASE_URL=mysql+pymysql://claudetools:CT_e8fcd5a3952030a79ed6debae6c954ed@172.16.3.30:3306/claudetools?charset=utf8mb4
|
|
```
|
|
|
|
---
|
|
|
|
## ClaudeTools API
|
|
|
|
### Production API (RMM Server)
|
|
- **Base URL:** http://172.16.3.30:8001
|
|
- **Documentation:** http://172.16.3.30:8001/api/docs
|
|
- **Health Check:** http://172.16.3.30:8001/health
|
|
- **Authentication:** JWT Bearer Token (required for all endpoints)
|
|
|
|
### JWT Token Location
|
|
- **File:** `D:\ClaudeTools\.claude\context-recall-config.env`
|
|
- **Variable:** `JWT_TOKEN`
|
|
- **Expiration:** 2026-02-16 (30 days from creation)
|
|
|
|
### Authentication Header
|
|
```bash
|
|
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpbXBvcnQtc2NyaXB0Iiwic2NvcGVzIjpbImFkbWluIiwiaW1wb3J0Il0sImV4cCI6MTc3MTI2NzQzMn0.7HddDbQahyRvaOq9o7OEk6vtn6_nmQJCTzf06g-fv5k
|
|
```
|
|
|
|
---
|
|
|
|
## Database Access Methods
|
|
|
|
### Method 1: Direct MySQL Connection (from RMM server)
|
|
```bash
|
|
# SSH to RMM server
|
|
ssh guru@172.16.3.30
|
|
|
|
# Connect to database
|
|
mysql -u claudetools -p'CT_e8fcd5a3952030a79ed6debae6c954ed' -D claudetools
|
|
|
|
# Example query
|
|
SELECT COUNT(*) FROM conversation_contexts;
|
|
```
|
|
|
|
### Method 2: Via ClaudeTools API (preferred for agents)
|
|
```bash
|
|
# Get contexts
|
|
curl -s "http://172.16.3.30:8001/api/conversation-contexts?limit=10" \
|
|
-H "Authorization: Bearer $JWT_TOKEN"
|
|
|
|
# Create context
|
|
curl -X POST "http://172.16.3.30:8001/api/conversation-contexts" \
|
|
-H "Authorization: Bearer $JWT_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{...}'
|
|
```
|
|
|
|
### Method 3: Python with SQLAlchemy
|
|
```python
|
|
from sqlalchemy import create_engine, text
|
|
|
|
DATABASE_URL = "mysql+pymysql://claudetools:CT_e8fcd5a3952030a79ed6debae6c954ed@172.16.3.30:3306/claudetools?charset=utf8mb4"
|
|
|
|
engine = create_engine(DATABASE_URL)
|
|
|
|
with engine.connect() as conn:
|
|
result = conn.execute(text("SELECT COUNT(*) FROM conversation_contexts"))
|
|
count = result.scalar()
|
|
print(f"Contexts: {count}")
|
|
```
|
|
|
|
---
|
|
|
|
## OLD vs NEW Configuration
|
|
|
|
### [WARNING] DEPRECATED - Old Jupiter Database (DO NOT USE)
|
|
- **Host:** 172.16.3.20 (Jupiter - Docker MariaDB)
|
|
- **Status:** Deprecated, data not migrated
|
|
- **Contains:** 68 old conversation contexts (pre-2026-01-17)
|
|
|
|
### [OK] CURRENT - New RMM Database (USE THIS)
|
|
- **Host:** 172.16.3.30 (RMM - Native MariaDB)
|
|
- **Status:** Production, current
|
|
- **Contains:** 7+ contexts (as of 2026-01-17)
|
|
|
|
**Migration Date:** 2026-01-17
|
|
**Reason:** Centralized architecture - all clients connect to RMM server
|
|
|
|
---
|
|
|
|
## For Database Agent
|
|
|
|
When performing operations, use:
|
|
|
|
### Read Operations
|
|
```python
|
|
# Use API for reads
|
|
import requests
|
|
|
|
headers = {
|
|
"Authorization": f"Bearer {jwt_token}"
|
|
}
|
|
|
|
response = requests.get(
|
|
"http://172.16.3.30:8001/api/conversation-contexts",
|
|
headers=headers,
|
|
params={"limit": 10}
|
|
)
|
|
|
|
contexts = response.json()
|
|
```
|
|
|
|
### Write Operations
|
|
```python
|
|
# Use API for writes
|
|
payload = {
|
|
"context_type": "session_summary",
|
|
"title": "...",
|
|
"dense_summary": "...",
|
|
"relevance_score": 8.5,
|
|
"tags": "[\"tag1\", \"tag2\"]"
|
|
}
|
|
|
|
response = requests.post(
|
|
"http://172.16.3.30:8001/api/conversation-contexts",
|
|
headers=headers,
|
|
json=payload
|
|
)
|
|
|
|
result = response.json()
|
|
```
|
|
|
|
### Direct Database Access (if API unavailable)
|
|
```bash
|
|
# SSH to RMM server first
|
|
ssh guru@172.16.3.30
|
|
|
|
# Then query database
|
|
mysql -u claudetools -p'CT_e8fcd5a3952030a79ed6debae6c954ed' -D claudetools \
|
|
-e "SELECT id, title FROM conversation_contexts LIMIT 5;"
|
|
```
|
|
|
|
---
|
|
|
|
## Common Database Operations
|
|
|
|
### Count Records
|
|
```sql
|
|
SELECT COUNT(*) FROM conversation_contexts;
|
|
SELECT COUNT(*) FROM clients;
|
|
SELECT COUNT(*) FROM sessions;
|
|
```
|
|
|
|
### List Recent Contexts
|
|
```sql
|
|
SELECT id, title, relevance_score, created_at
|
|
FROM conversation_contexts
|
|
ORDER BY created_at DESC
|
|
LIMIT 10;
|
|
```
|
|
|
|
### Search Contexts by Tag
|
|
```bash
|
|
# Via API (preferred)
|
|
curl "http://172.16.3.30:8001/api/conversation-contexts/recall?tags=migration&limit=5" \
|
|
-H "Authorization: Bearer $JWT_TOKEN"
|
|
```
|
|
|
|
---
|
|
|
|
## Health Checks
|
|
|
|
### Check Database Connectivity
|
|
```bash
|
|
# From RMM server
|
|
mysql -u claudetools -p'CT_e8fcd5a3952030a79ed6debae6c954ed' \
|
|
-h 172.16.3.30 \
|
|
-e "SELECT 1"
|
|
```
|
|
|
|
### Check API Health
|
|
```bash
|
|
curl http://172.16.3.30:8001/health
|
|
# Expected: {"status":"healthy","database":"connected"}
|
|
```
|
|
|
|
### Check API Service Status
|
|
```bash
|
|
ssh guru@172.16.3.30 "sudo systemctl status claudetools-api"
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Cannot Connect to Database
|
|
```bash
|
|
# Check if MariaDB is running
|
|
ssh guru@172.16.3.30 "sudo systemctl status mariadb"
|
|
|
|
# Check if port is open
|
|
curl telnet://172.16.3.30:3306
|
|
```
|
|
|
|
### API Returns 401 Unauthorized
|
|
```bash
|
|
# JWT token may be expired - regenerate
|
|
python D:\ClaudeTools\create_jwt_token.py
|
|
|
|
# Update config file
|
|
# Edit: D:\ClaudeTools\.claude\context-recall-config.env
|
|
```
|
|
|
|
### API Returns 404 Not Found
|
|
```bash
|
|
# Check if API service is running
|
|
ssh guru@172.16.3.30 "sudo systemctl status claudetools-api"
|
|
|
|
# Check API logs
|
|
ssh guru@172.16.3.30 "sudo journalctl -u claudetools-api -n 50"
|
|
```
|
|
|
|
---
|
|
|
|
## Important Notes
|
|
|
|
1. **Always use the API when possible** - Better for access control and validation
|
|
2. **JWT tokens expire** - Regenerate monthly (currently valid until 2026-02-16)
|
|
3. **Database is centralized** - All machines connect to RMM server
|
|
4. **No local database** - Don't try to connect to localhost:3306
|
|
5. **Use parameterized queries** - Prevent SQL injection
|
|
|
|
---
|
|
|
|
**Last Updated:** 2026-01-17
|
|
**Current Database:** 172.16.3.30:3306 (RMM)
|
|
**Current API:** http://172.16.3.30:8001
|