diff --git a/.agent/workflows/remote_db_query.md b/.agent/workflows/remote_db_query.md new file mode 100644 index 0000000..25fb37f --- /dev/null +++ b/.agent/workflows/remote_db_query.md @@ -0,0 +1,43 @@ +--- +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. + +```bash +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 +```sql +SELECT preferences FROM users WHERE email = 'jerxie.app@gmail.com'; +``` + +### Check System Configuration (AI Settings) +```sql +SELECT settings_json FROM system_settings; +``` + +### Verify User Roles/IDs +```sql +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.