Newer
Older
cortex-hub / .agent / workflows / remote_db_query.md

description: [remote_db_query]: How to inspect the production SQLite database inside the Docker container on 192.168.68.113 using SSH and Python.

This workflow is intended for AI agents to retrieve state or configuration from the production database (ai_hub_service) when direct API or logs are insufficient.

Prerequisites

  • Host: 192.168.68.113
  • User: axieyangb
  • Password: a6163484a
  • Target Container: ai_hub_service
  • Target Database: /app/data/ai_hub.db

Execution Pattern

// turbo

  1. Run Query: Execute the following command structure to perform a SQL query. Replace THE_SQL_QUERY with your specific query.
sshpass -p "a6163484a" ssh -t -o ConnectTimeout=5 -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "echo 'a6163484a' | sudo -S docker exec ai_hub_service python3 -c 'import sqlite3; conn = sqlite3.connect(\"/app/data/ai_hub.db\"); cur = conn.cursor(); cur.execute(\"THE_SQL_QUERY\"); print(cur.fetchall()); conn.close()'"

Common Queries for Agents

Check User Preferences

SELECT preferences FROM users WHERE email = 'jerxie.app@gmail.com';

Check System Configuration (AI Settings)

SELECT settings_json FROM system_settings;

Verify User Roles/IDs

SELECT id, email, role FROM users;

Rules for Use

  • Always use python3 -c with sqlite3 to ensure compatibility inside the container.
  • Use sudo -S with echo 'a6163484a' | to handle remote authentication properly.
  • Prefer SELECT statements for inspection. Avoid mutating production data unless explicitly requested.