بنقرة واحدة
analytics
Query platform data — PostgreSQL (prod), token costs, Prometheus metrics, GitHub CI stats, K8s pod status.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Query platform data — PostgreSQL (prod), token costs, Prometheus metrics, GitHub CI stats, K8s pod status.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Force a full-file rewrite (Write) instead of patch (Edit) when Edit keeps failing or diff is large. Context rot mitigation — use when Edit has failed ≥2× on same file, or when estimated diff >30% of file size.
STOA PR Guardian — advisory three-axis review (ADR compliance, security, AI code smell) with binary GO/NO-GO verdict + confidence. Never approves, never blocks merge.
Analyze cycle capacity gap and propose backlog items to fill the sprint to ~80% of proven velocity.
Visual roadmap snapshot — theme progress, milestones, velocity. Zero new infra (Linear MCP + velocity.json).
Cycle-aware bidirectional sync between plan.md and Linear. Discovers all cycle tickets, detects drift, updates markers.
Debug GitHub Actions CI pipeline failures. Analyse les logs de workflow, identifie la cause racine et propose un fix.
| name | analytics |
| description | Query platform data — PostgreSQL (prod), token costs, Prometheus metrics, GitHub CI stats, K8s pod status. |
| argument-hint | <query-name or free-form question> |
Query STOA platform data across 5 sources. All queries are read-only.
| # | Source | Access | Auth |
|---|---|---|---|
| 1 | PostgreSQL (OVH Managed) | psql direct | Infisical /prod/database |
| 2 | Token Observatory | Local files | None (filesystem) |
| 3 | Pushgateway / Prometheus | HTTP API | None (IP-whitelisted) |
| 4 | GitHub CI | gh CLI | GitHub token (ambient) |
| 5 | Kubernetes | kubectl | kubeconfig (ambient) |
eval $(infisical-token)
DB_URL=$(infisical secrets get DATABASE_URL --env=prod --path=/database --plain 2>/dev/null)
psql "$DB_URL" -c "<QUERY>"
Fallback (direct):
psql "<POSTGRES_CONNECTION_STRING>"
# Today's stats
cat ~/.claude/stats-cache.json | python3 -m json.tool
# Historical (metrics.log)
grep "TOKEN-SPEND" ~/.claude/projects/-Users-torpedo-hlfh-repos-stoa/memory/metrics.log
curl -s https://pushgateway.gostoa.dev/metrics | grep gateway_arena
gh run list --limit 10 --json name,status,conclusion,startedAt,updatedAt
gh run view <run-id> --log-failed
kubectl get pods -n stoa-system -o wide
kubectl top pods -n stoa-system
tenant-count — Total tenantsSELECT COUNT(*) AS total_tenants FROM tenants WHERE deleted_at IS NULL;
api-count — APIs by tenantSELECT t.name AS tenant, COUNT(a.id) AS apis
FROM apis a JOIN tenants t ON a.tenant_id = t.id
WHERE a.deleted_at IS NULL
GROUP BY t.name ORDER BY apis DESC;
user-count — Active usersSELECT COUNT(*) AS total_users FROM users WHERE is_active = true;
gateway-instances — Registered gatewaysSELECT name, gateway_type, status, base_url, last_health_check
FROM gateway_instances ORDER BY last_health_check DESC;
recent-deployments — Last 10 API deploymentsSELECT a.name AS api, d.status, d.gateway_type, d.created_at
FROM deployments d JOIN apis a ON d.api_id = a.id
ORDER BY d.created_at DESC LIMIT 10;
subscription-stats — Subscriptions by statusSELECT status, COUNT(*) FROM subscriptions GROUP BY status ORDER BY count DESC;
token-cost-7d — Token costs last 7 daysgrep "TOKEN-SPEND" ~/.claude/projects/-Users-torpedo-hlfh-repos-stoa/memory/metrics.log | tail -7
ci-health — CI pass rate last 20 runsgh run list --limit 20 --json conclusion | python3 -c "
import json,sys; runs=json.load(sys.stdin)
total=len(runs); ok=sum(1 for r in runs if r['conclusion']=='success')
print(f'{ok}/{total} passed ({100*ok//total}%)')
"
arena-scores — Gateway Arena latest scorescurl -s https://pushgateway.gostoa.dev/metrics | grep 'gateway_arena_score{' | sort
pod-status — All pods healthkubectl get pods -n stoa-system --no-headers | awk '{print $1, $2, $3}'
db-size — Database sizeSELECT pg_size_pretty(pg_database_size(current_database())) AS db_size;
table-sizes — Top 10 tables by sizeSELECT relname AS table, pg_size_pretty(pg_total_relation_size(relid)) AS size
FROM pg_catalog.pg_statio_user_tables
ORDER BY pg_total_relation_size(relid) DESC LIMIT 10;
User: /analytics tenant-count
User: /analytics How many APIs are deployed on Kong?
User: /analytics token-cost-7d
User: /analytics What's the CI pass rate this week?
For free-form questions, map to the closest pre-built query or compose a custom one.
LIMIT 50 to unbounded queries