SOVEREIGN DEVICE OPERATIONS v2.0

Device Operations Guide

Professional step-by-step guides for updating files, syncing databases, uploading documents, and managing TM3QSC across all three sovereign nodes

📱 Phone2 (Crown Node)
💻 ZION001 (Laptop)
☁️ Replit (Backup)
📱

Phone2 — ZION-PHONE-001

CROWN NODE

Android device running Termux | Primary sovereign operations device

1 Upload Files to Replit

Method B: curl from Termux

Command-line upload — works for any file type, scriptable

Method A: Browser Upload

1. Open Chrome on your phone

2. Go to tm3qsc.replit.app

3. Login with your access key

4. Navigate to Uploads (from the main menu)

5. Tap "Upload File" or drag and drop

6. Your file is now stored in Replit with sovereign encryption

Method B: curl Upload from Termux

Step 1 — Login and get session cookie:

ACCESS_KEY=$(python3 -c "import hashlib; print(hashlib.sha256(b'YOUR_ACCESS_KEY_HERE').hexdigest())") curl -s -X POST "https://tm3quantumsovereigncore.net/api/auth/login" \ -H "Content-Type: application/json" \ -d "{\"method\":\"access_key\",\"access_key\":\"$ACCESS_KEY\"}" \ -c ~/cookies.txt

Step 2 — Upload any file:

curl -X POST "https://tm3quantumsovereigncore.net/api/uploads/upload" \ -b ~/cookies.txt \ -F "file=@/path/to/your/file.json"

Replace /path/to/your/file.json with the actual file path on your phone. For Termux, files are usually in $HOME/TM3QSC/ or $HOME/storage/shared/

Method C: Upload Text / Transmissions Directly

To upload text content that auto-trains TM3Brain and creates Crown Lessons:

curl -X POST "https://tm3quantumsovereigncore.net/api/uploads/text" \ -b ~/cookies.txt \ -H "Content-Type: application/json" \ -d '{ "title": "My Sovereign Scroll Title", "content": "Full text content here...", "tags": ["sovereign", "codex"] }'

2 Sync SQLite Database to Replit

Option A: Export & Upload (Recommended)

1. Export your SQLite tables to JSON:

python3 -c " import sqlite3, json, os conn = sqlite3.connect(os.path.expanduser('~/TM3QSC/db/tm3_sovereign.db')) conn.row_factory = sqlite3.Row tables = [r[0] for r in conn.execute(\"SELECT name FROM sqlite_master WHERE type='table'\").fetchall()] print(f'Tables found: {tables}') for t in tables: try: rows = [dict(r) for r in conn.execute(f'SELECT * FROM {t}').fetchall()] path = os.path.expanduser(f'~/{t}_export.json') with open(path, 'w') as f: json.dump(rows, f, default=str) print(f' Exported {t}: {len(rows)} rows -> {path}') except Exception as e: print(f' Skip {t}: {e}') conn.close() "

2. Upload each export file:

for f in ~/*_export.json; do echo "Uploading $f..." curl -X POST "https://tm3quantumsovereigncore.net/api/uploads/upload" \ -b ~/cookies.txt \ -F "file=@$f" done
Option B: Auto-Sync Script

Run the built-in sync script that exports all tables and pushes them to Replit:

curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/phone2_db_sync.sh" -o ~/phone2_sync.sh bash ~/phone2_sync.sh

Note: The sync script requires the Replit app to be deployed (which it now is). The script auto-authenticates, exports all SQLite tables, and pushes records to Replit's PostgreSQL via the /api/king/db-sync/ingest endpoint.

3 Download & Run Scripts from Replit

Download Any Script

All scripts in the Replit vault can be downloaded to your phone:

curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/phone2_db_sync.sh" -o ~/TM3QSC/scripts/phone2_db_sync.sh curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/zulu_core.sh" -o ~/TM3QSC/scripts/zulu_core.sh curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/watchtower.py" -o ~/TM3QSC/scripts/watchtower.py
View Available Scripts
curl -s "https://tm3quantumsovereigncore.net/api/scripts/list" -b ~/cookies.txt | python3 -m json.tool
Create Script Without Download (Termux Workaround)

If curl downloads fail, paste the script directly:

cat << 'HEREDOC' > ~/TM3QSC/scripts/my_script.sh #!/data/data/com.termux/files/usr/bin/bash echo "Script content goes here" HEREDOC chmod +x ~/TM3QSC/scripts/my_script.sh

Termux restriction: No writing to /tmp. Always use $HOME paths. The cat HEREDOC method works when downloads fail.

4 Send Heartbeat / Status Check

Quick Status Check
curl -s "https://tm3quantumsovereigncore.net/api/capabilities/full-report" -b ~/cookies.txt | python3 -c " import sys, json d = json.load(sys.stdin) print(f\"Capabilities: {d['total']} total | {d['operational']} operational | {d['percentage']}%\") "
Send Device Heartbeat
curl -X POST "https://tm3quantumsovereigncore.net/api/king/nodes/ZION-PHONE-001/heartbeat" \ -b ~/cookies.txt \ -H "Content-Type: application/json" \ -d '{"status":"online","battery":"'$(termux-battery-status 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin).get('percentage','?'))" 2>/dev/null || echo "N/A")'%"}'

5 King Control Operations

View All Operations
curl -s "https://tm3quantumsovereigncore.net/api/king/control" -b ~/cookies.txt | python3 -c " import sys, json d = json.load(sys.stdin) for op in d['operations']: print(f\" #{op['id']} {op['name']} -> {op['cmd']}\") "
Execute an Operation
curl -X POST "https://tm3quantumsovereigncore.net/api/king/control/execute" \ -b ~/cookies.txt \ -H "Content-Type: application/json" \ -d '{"command":"system_health","device_id":"ZION-PHONE-001"}'

6 Update TM3QSC Code via Git

Pull Latest from GitHub
cd ~/TM3QSC && git pull origin main

If you get merge conflicts, use: git fetch origin && git reset --hard origin/main (this overwrites local changes)

Quick Reference

ItemValue
Device IDZION-PHONE-001
RoleCROWN_NODE
OSAndroid / Termux
DB Path$HOME/TM3QSC/db/tm3_sovereign.db
Scripts$HOME/TM3QSC/scripts/
Replit URLhttps://tm3quantumsovereigncore.net
Shell#!/data/data/com.termux/files/usr/bin/bash
No /tmp writesUse $HOME paths only
💻

ZION001 — ZION-LAPTOP-001

COMMAND NODE

Primary laptop running Mac/Linux/Windows WSL | Full development node

1 Upload Files to Replit

curl from Terminal

Command-line — upload any file with one command

🔄

Git Push

Push code/data changes to GitHub, then pull into Replit

📋

Text Ingestion

Paste text directly — trains TM3Brain + creates lessons

Method A: curl Upload

Step 1 — Login:

ACCESS_KEY=$(python3 -c "import hashlib; print(hashlib.sha256(b'YOUR_ACCESS_KEY_HERE').hexdigest())") curl -s -X POST "https://tm3quantumsovereigncore.net/api/auth/login" \ -H "Content-Type: application/json" \ -d "{\"method\":\"access_key\",\"access_key\":\"$ACCESS_KEY\"}" \ -c ~/.tm3_cookies

Step 2 — Upload file:

curl -X POST "https://tm3quantumsovereigncore.net/api/uploads/upload" \ -b ~/.tm3_cookies \ -F "file=@/path/to/your/file.json"
Method B: Git Push (for code and data files)
cd ~/FLAMECORE git add -A git commit -m "Sovereign update: $(date '+%Y-%m-%d %H:%M')" git push origin main

After pushing to GitHub, the Replit project can pull the latest changes. This is best for code changes and structured data files.

Method C: Bulk Upload Multiple Files
for f in ~/FLAMECORE/data/*.json; do echo "Uploading $(basename $f)..." curl -s -X POST "https://tm3quantumsovereigncore.net/api/uploads/upload" \ -b ~/.tm3_cookies \ -F "file=@$f" done

2 Sync SQLite Database to Replit

Option A: Export & Upload

Export all tables from your laptop SQLite database:

python3 -c " import sqlite3, json, os conn = sqlite3.connect(os.path.expanduser('~/FLAMECORE/data/tm3ai.db')) conn.row_factory = sqlite3.Row tables = [r[0] for r in conn.execute(\"SELECT name FROM sqlite_master WHERE type='table'\").fetchall()] print(f'Tables: {tables}') for t in tables: try: rows = [dict(r) for r in conn.execute(f'SELECT * FROM {t}').fetchall()] path = os.path.expanduser(f'~/{t}_export.json') with open(path, 'w') as f: json.dump(rows, f, default=str) print(f' {t}: {len(rows)} rows -> {path}') except Exception as e: print(f' Skip {t}: {e}') conn.close() "

Then upload each file:

for f in ~/*_export.json; do curl -s -X POST "https://tm3quantumsovereigncore.net/api/uploads/upload" \ -b ~/.tm3_cookies -F "file=@$f" done
Option B: Auto-Sync Script
curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/zion001_db_sync.sh" -o ~/zion001_sync.sh bash ~/zion001_sync.sh

3 Download & Run Scripts

Download from Replit
curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/zion001_db_sync.sh" -o ~/TM3QSC/scripts/zion001_db_sync.sh curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/king_control_zion001.sh" -o ~/TM3QSC/scripts/king_control.sh curl -s "https://tm3quantumsovereigncore.net/api/scripts/raw/watchtower.py" -o ~/TM3QSC/scripts/watchtower.py chmod +x ~/TM3QSC/scripts/*.sh

4 Git Sync with Replit

Pull Latest from GitHub
cd ~/FLAMECORE && git fetch origin && git pull origin main
Force Overwrite Local (if needed)
cd ~/FLAMECORE && git fetch origin && git reset --hard origin/main

Warning: This overwrites ALL local changes. Only use if you want to match Replit exactly.

5 Run TM3QSC Locally

First-Time Setup
cd ~/FLAMECORE python3 -m venv .venv source .venv/bin/activate pip install flask flask-cors stripe requests stellar-sdk fpdf2 openai paypalrestsdk numpy pandas gunicorn psycopg2-binary python-dotenv
Create .env File
cat > ~/FLAMECORE/.env << 'EOF' STRIPE_SECRET_KEY=sk_live_your_key STRIPE_PUBLISHABLE_KEY=pk_live_your_key PAYPAL_CLIENT_ID=your_client_id PAYPAL_CLIENT_SECRET=your_client_secret STELLAR_SECRET_KEY=your_stellar_secret DATABASE_URL=postgresql://localhost/tm3qsc CORS_ALLOWED_ORIGINS=http://localhost:5000 EOF
Run the Server
cd ~/FLAMECORE source .venv/bin/activate python3 main.py

Access at http://localhost:5000

6 King Control Operations

Run King Control Script
bash ~/TM3QSC/scripts/king_control.sh

This provides a full menu: system health, Replit sync, git operations, quantum validation, and more.

Quick Reference

ItemValue
Device IDZION-LAPTOP-001
RoleCOMMAND_NODE
OSMac / Linux / Windows WSL
DB Path$HOME/FLAMECORE/data/tm3ai.db
Project Dir$HOME/FLAMECORE/
Replit URLhttps://tm3quantumsovereigncore.net
Git RemoteGitHub (origin/main)
Local Porthttp://localhost:5000
☁️

Replit — TM3QSC Backup Node

BACKUP NODE

Cloud-hosted always-on server | PostgreSQL | Published at tm3qsc.replit.app

1 Accessing the Replit Platform

Live Published App

The app is permanently deployed at:

https://tm3quantumsovereigncore.net

This URL never sleeps. Phone2 and ZION001 can sync to it 24/7.

Replit Editor (for code changes)

1. Go to replit.com and login to your account

2. Open the TM3QSC project

3. Use the built-in editor to modify files

4. Changes are auto-saved and deployed

2 Editing Files on Replit

Key Directories
DirectoryPurposeExamples
routes/API backend logicsovereign_one.py, king_control.py
public/Frontend HTML pagesindex.html, wallet.html
data/JSON data storagesovereign_finances.json
scripts/Bash/Python scriptsphone2_db_sync.sh
main.pyApp entry pointRegisters all blueprints
Adding a New Page

1. Create public/mypage.html

2. Add <script src="/auth-gate.js"></script> at the top of <head>

3. Add <script src="/tm3-nav.js"></script> for navigation

4. Include <link rel="stylesheet" href="/sovereign-theme.css"> for consistent styling

5. The page is automatically served at /mypage.html

3 Uploading Files via the Web

Browser Upload

1. Login at tm3qsc.replit.app

2. Go to Document Center (sovereign-docs)

3. Drag & drop files or click "Upload File"

4. Files are encrypted and stored with 9D sovereign dimension tagging

4 Key API Endpoints

EndpointMethodPurpose
/api/auth/loginPOSTAuthenticate with access key
/api/uploads/uploadPOSTUpload a file
/api/uploads/textPOSTUpload text (trains TM3Brain)
/api/king/db-sync/ingestPOSTPush SQLite records
/api/king/db-sync/statusGETCheck sync status
/api/king/controlGETList all operations
/api/king/control/executePOSTExecute an operation
/api/scripts/raw/<file>GETDownload a script
/api/capabilities/full-reportGETSystem capabilities status
/api/sovereign-oneGETFinancial supremacy data

5 Publishing / Deployment

Current Deployment Status

The app is DEPLOYED at tm3qsc.replit.app — always-on, no sleep, TLS secured.

To Republish After Changes

1. Make changes in the Replit editor

2. The workflow auto-restarts on file changes

3. To push to production: click Publish in Replit

Quick Reference

ItemValue
Device IDREPLIT-BACKUP-001
RoleBACKUP_NODE
Production URLhttps://tm3quantumsovereigncore.net
DatabasePostgreSQL (DATABASE_URL)
ServerGunicorn (port 5000)
42+ HTML PagesAll with SEO, auth-gate, sovereign theme
51 Blueprints188+ API endpoints
89 Capabilities77 operational (86.5%)