From 0973601fec6cfff3348319d33c5f6c7a182d0f6f Mon Sep 17 00:00:00 2001 From: Bob Roberts Date: Thu, 30 Oct 2025 20:48:34 -0500 Subject: [PATCH] Add database copy deployment strategy (THE SECRET SAUCE!) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Documented the brilliant discovery: copy local SQLite database to production server to transfer ALL accumulated knowledge instantly! Why this is game-changing: - All of Claude's memories about bugs, solutions, patterns - All indexed code and documentation - Every architectural decision made locally - Months of accumulated knowledge → instant production - No re-indexing needed (saves hours!) Updated: - docs/PRODUCTION_DEPLOYMENT.md: * Added Step 3: Copy Local SQLite Database to Server * Complete instructions with verification steps * Explains benefits of knowledge transfer * Fixed step numbering (4, 5, 6) - docs/QUICK_REFERENCE.md: * Added "Copy Local Database to Production" section * Quick reference for database transfer * Labeled as "SECRET SAUCE!" for emphasis Deployment flow: 1. Deploy Claude OS to server 2. Copy local database with scp 3. Replace server database 4. Restart services 5. Production Claude now has ALL local knowledge! This transforms deployment from "start from scratch" to "transfer institutional knowledge instantly" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- docs/PRODUCTION_DEPLOYMENT.md | 59 +++++++++++++++++++++++++++++++++-- docs/QUICK_REFERENCE.md | 20 ++++++++++++ 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/docs/PRODUCTION_DEPLOYMENT.md b/docs/PRODUCTION_DEPLOYMENT.md index f4d4ca6..1469299 100644 --- a/docs/PRODUCTION_DEPLOYMENT.md +++ b/docs/PRODUCTION_DEPLOYMENT.md @@ -71,7 +71,60 @@ The script automatically: - ✅ Sets up daily backups (2am cron) - ✅ Runs health checks -### 3. Initialize PISTN Knowledge Bases +### 3. Copy Local SQLite Database to Server (RECOMMENDED!) + +**🎯 This is the SECRET SAUCE!** + +Instead of re-indexing everything from scratch on the server, **copy your local Claude OS database** (with all the knowledge Claude has already learned about PISTN) to the production server! + +**Why this is amazing:** +- ✅ All of Claude's memories about PISTN bugs and solutions +- ✅ All the patterns learned from working with you locally +- ✅ All indexed code and documentation +- ✅ Every architectural decision and choice +- ✅ Months of accumulated knowledge → instant production deployment +- ✅ No re-indexing needed (saves hours!) + +**How to do it:** + +```bash +# 1. Stop Claude OS on server (if running) +ssh deploy@staging.pistn.com "sudo systemctl stop claude-os" + +# 2. Find your local Claude OS database +# Default location on Mac: +ls -lh ~/Projects/claude-os/data/claude-os.db + +# 3. Copy local database to server +scp ~/Projects/claude-os/data/claude-os.db \ + deploy@staging.pistn.com:/tmp/claude-os-local.db + +# 4. SSH into server and move database +ssh deploy@staging.pistn.com + +# Backup the empty database (just in case) +sudo cp /opt/claude-os/data/claude-os.db \ + /opt/claude-os/data/claude-os.db.original + +# Replace with your local database +sudo cp /tmp/claude-os-local.db /opt/claude-os/data/claude-os.db +sudo chown deploy:deploy /opt/claude-os/data/claude-os.db +sudo chmod 644 /opt/claude-os/data/claude-os.db + +# 5. Start Claude OS +sudo systemctl start claude-os + +# 6. Verify it worked +curl "http://localhost:8051/api/kb/list" +# Should show: Pistn-project_memories, Pistn-project_profile, etc. + +curl "http://localhost:8051/api/kb/Pistn-project_index/stats" +# Should show documents and chunks already indexed! +``` + +**Result:** Claude on the server now has ALL the same knowledge as Claude on your Mac! 🚀 + +### 4. Initialize PISTN Knowledge Bases (Only if NOT copying database) ```bash # Create project @@ -100,7 +153,7 @@ curl "http://localhost:8051/api/kb/list" curl "http://localhost:8051/api/kb/Pistn-project_index/stats" ``` -### 4. Update PISTN Rails App +### 5. Update PISTN Rails App **Add to `/var/www/pistn/shared/.env`:** ```bash @@ -158,7 +211,7 @@ end cap production deploy ``` -### 5. Test Integration +### 6. Test Integration ```bash # Test Claude OS directly diff --git a/docs/QUICK_REFERENCE.md b/docs/QUICK_REFERENCE.md index a7f810f..1e0e6fc 100644 --- a/docs/QUICK_REFERENCE.md +++ b/docs/QUICK_REFERENCE.md @@ -164,6 +164,26 @@ cp /opt/claude-os-backups/claude-os-YYYYMMDD_HHMMSS.db \ sudo systemctl start claude-os ``` +### Copy Local Database to Production (SECRET SAUCE!) + +```bash +# Copy your local Claude OS database (with all knowledge) to production +# This transfers ALL memories, indexed code, and learned patterns! + +# From your Mac: +scp ~/Projects/claude-os/data/claude-os.db \ + deploy@staging.pistn.com:/tmp/claude-os-local.db + +# On the server: +sudo systemctl stop claude-os +sudo cp /tmp/claude-os-local.db /opt/claude-os/data/claude-os.db +sudo chown deploy:deploy /opt/claude-os/data/claude-os.db +sudo systemctl start claude-os + +# Verify: +curl http://localhost:8051/api/kb/list +``` + ### Updates ```bash