RMI Backend — FastAPI with 410+ routes, 32 token detectors, 96 chains, x402 paid API, MCP server for AI agents, Rug Munch Verified badge program. Pay-per-call crypto security. Wyoming-based.
Find a file
cryptorugmunch cfd75fd1a0 fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/
- Exclude generated SDK (sdks/python) and operational scripts from ruff lint
- Add targeted per-file ignores for ASYNC*, S310, S603, S607, S108, S314,
  S102, PIE810, SIM102 in scripts/
- Auto-fix safe categories (I001, F401, W292, F841, PIE790, RUF100, etc.)
- Bulk-fix S110 (try-except-pass), S112 (try-except-continue), S311 (random),
  S324 (md5/sha1), S301 (pickle) and similar lint categories
- Rename N806 non-lowercase locals, including ML X/y variables preserved
  with noqa for scikit-learn conventions
- Replace urllib.request calls with httpx.AsyncClient / httpx.Client (S310)
- Wrap blocking os.path/os calls in asyncio.get_running_loop().run_in_executor
- Replace subprocess.run with asyncio.create_subprocess_exec in async contexts
- Store asyncio.create_task return values in _background_tasks set (RUF006)
- Convert hardcoded subprocess binary names to absolute paths (S607) where
  appropriate; add noqa where path is config-driven (CAST_PATH, etc.)
- Parameterize SQL queries with placeholders and add noqa for sanitized inputs
- Fix all mechanical categories: SIM102, PIE810, TC001/2/3, S108, S314, S107,
  S306, S301, N802/N815/N817, S104, S605, S501, RUF022, UP031
- Add missing 'import asyncio' where referenced but not imported (F821)
- Fix E402 module-import-not-at-top by adding '# noqa: E402' for circular-import
  safe cases and code-defined imports
- Remove hardcoded Redis password in databus_warm_cron.py; use env vars

Tests:
- Add tests/unit/core/test_ai_router.py (8 tests): model resolution, chat
  completion with mocked httpx, fallback to OpenRouter, no-provider error,
  streaming
- Add tests/unit/core/test_tracing.py (7 tests): setup_otel disabled/enabled,
  shutdown_otel, span helpers, tracing-enabled route registration
- Add tests/unit/core/test_langfuse.py (2 tests): no-env init, noop flush
- Fix tests/unit/domain/scanner/test_service.py to import from the moved
  app.domains.scanners.core.service

Result: 'ruff check .' passes with 0 errors (was 1470).
Pytest: 808 passed, 1 skipped (no regressions).
2026-07-08 03:36:58 +07:00
.forgejo Merge branch 'feat/issue-forms' 2026-07-02 15:11:00 +02:00
.github fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
.semgrep merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
alembic fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
app fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
data merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
dify-agents merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
docker/x402-rs merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
docs merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
infra fix(auth): mount auth router + rename __init__ to router.py 2026-07-07 17:44:09 +07:00
infrastructure/database merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
plans merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
prompts merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
public merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
requirements merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
scripts fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
sdks fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
src/rug_munch_mcp style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
static merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
supabase merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
tests fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
widget merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402-gateway merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
, r.stdout) # Check if we can read wallets from the data directory directly - theyre merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
.deploy-cleanup.sh merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
.dockerignore merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
.editorconfig chore(rmi-backend): apply fleet-template standards — add .editorconfig + .gitattributes, fix stale IPs, tighten qdrant-audit CI gate 2026-07-06 14:18:34 +02:00
.env.example fix(rmi-backend,audit): jwt_secret is required, fail-fast in prod (P1.5) 2026-07-06 17:53:49 +02:00
.gitattributes chore(rmi-backend): apply fleet-template standards — add .editorconfig + .gitattributes, fix stale IPs, tighten qdrant-audit CI gate 2026-07-06 14:18:34 +02:00
.gitignore chore(rmi-backend,audit): delete ruff.toml — pyproject.toml [tool.ruff] is canonical 2026-07-06 17:53:03 +02:00
.gitleaks.toml build(rmi-backend,audit): add .gitleaksignore + .gitleaks.toml (P1.11) + STATUS.md (P1.12) 2026-07-06 18:44:00 +02:00
.gitleaksignore build(rmi-backend,audit): add .gitleaksignore + .gitleaks.toml (P1.11) + STATUS.md (P1.12) 2026-07-06 18:44:00 +02:00
.gitmessage merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
.mise.toml merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
.pre-commit-config.yaml build(rmi-backend,audit): install pre-commit hooks + wire into make install (P1.7) 2026-07-06 18:21:40 +02:00
.secretsallow merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
.trivyignore merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
AGENTS.md docs(agents): correct backend AGENTS.md + add ai-review workflow 2026-07-07 17:20:23 +02:00
alembic.ini fix(infra): wire Alembic + remove docker-restart-in-web-request 2026-07-07 17:56:57 +07:00
ARCHITECTURE.md docs(state): update STATUS.md and ARCHITECTURE.md for Phase 4 progress 2026-07-07 04:47:09 +07:00
AUDIT-2026-Q3.md docs(audit): add 2026-Q3 audit + 6-phase production-grade roadmap (master ref for rmi-backend/frontend) 2026-07-06 17:44:58 +02:00
backend.log merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
CLEANUP.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
CODE_OF_CONDUCT.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
CODEOWNERS merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
CONTRIBUTING.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
DARKROOM_ADMIN_V2.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
databus_warm_cron.py fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
DESIGN.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
docker-compose.email.yml merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
Dockerfile merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
Dockerfile.worker merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
EMAIL_SETUP.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
generate_env.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
hf-model-card.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
huggingface.yaml merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
justfile merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
LICENSE merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
LICENSING_PRICING_STRATEGY.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
LINT-CLEANUP-REPORT.md docs(rmi-backend): add LINT-CLEANUP-REPORT.md tracking fix 2026-07-06 15:43:09 +02:00
logo-preview.html merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
main.py fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
Makefile feat(domains): consolidate bulletin, intelligence, markets, admin, referral, mcp + mypy gate 2026-07-07 16:43:49 +07:00
mypy-gate.ini feat(domains): consolidate bulletin, intelligence, markets, admin, referral, mcp + mypy gate 2026-07-07 16:43:49 +07:00
mypy.ini feat(domains): consolidate bulletin, intelligence, markets, admin, referral, mcp + mypy gate 2026-07-07 16:43:49 +07:00
PORT_MAP.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
PRICING_ARCHITECTURE.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
PRODUCT.md docs: rewrite README and add PRODUCT, ARCHITECTURE, ROADMAP, TODO per governance framework 2026-07-03 15:56:26 +02:00
PROPRIETARY_REGISTRATION.txt merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
pyproject.toml fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
pytest.ini test(rmi-backend,audit): move tests/test_rag.py to tests/manual/ (P1.9) 2026-07-06 18:25:42 +02:00
RAG_MODERNIZATION.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
RAG_R2_SETUP.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
README.md docs: rewrite README and add PRODUCT, ARCHITECTURE, ROADMAP, TODO per governance framework 2026-07-03 15:56:26 +02:00
README_HF.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
requirements.txt fix(auth): mount auth router + rename __init__ to router.py 2026-07-07 17:44:09 +07:00
rmi_langchain.py fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
rmi_sdk.py fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
RMI_SYSTEM_MAP.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
ROADMAP.md docs: rewrite README and add PRODUCT, ARCHITECTURE, ROADMAP, TODO per governance framework 2026-07-03 15:56:26 +02:00
safe_deploy.sh refactor(domains): move 15 app-root monoliths into app/domains/ + lazy cloudscraper 2026-07-07 17:01:17 +02:00
SECURITY.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
SECURITY_STACK.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
smithery.yaml merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
STANDARDS.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
STATUS.md docs(state): update STATUS.md and ARCHITECTURE.md for Phase 4 progress 2026-07-07 04:47:09 +07:00
SUPABASE_ARCHITECTURE.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
supabase_create_tables.sql merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
supabase_pgvector_setup.sql merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
test_new_scanners.py fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
TODO.md chore(rmi-backend): apply fleet-template standards — add .editorconfig + .gitattributes, fix stale IPs, tighten qdrant-audit CI gate 2026-07-06 14:18:34 +02:00
uv.lock merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
worker.py fix(lint): drop ruff errors from 1470 to 0 across app/ and tests/ 2026-07-08 03:36:58 +07:00
X402_ARCHITECTURE.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402_REVENUE.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402_STRATEGY.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00
x402_tool_builder.py style(rmi-backend): complete lint cleanup — 1175→0 ruff errors 2026-07-06 15:43:20 +02:00
X_AUDIT_AND_STRATEGY.md merge: chore/cleanup-remove-bloat-and-secrets into main 2026-07-02 01:24:22 +07:00

RMI Backend

Repo: git.rugmunch.io/RugMunchMedia/rmi-backend Deploy: /root/backend/ on Talos Container: rmi-backend Health: http://127.0.0.1:8000/health (currently unhealthy — Redis host not resolving)

What it is

FastAPI backend for the RMI platform. Serves token risk scans, wallet forensics, market data, Telegram bot commands, MCP agent tools, and x402-gated premium endpoints.

Status

Production, but degraded. The container runs and responds, but /health reports unhealthy because the Redis hostname rmi-redis:6379 is not resolving inside the container network.

Quick start (local)

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m pytest tests/unit/ -x -q

Deploy

ssh netcup
cd /root/backend/
docker compose pull
docker compose up -d rmi-backend

Fleet dependencies

Service Address Status
Postgres rmi-postgres:5432 Up
Redis rmi-redis:6379 Failing to resolve
Qdrant 127.0.0.1:6333 Down (stale IP bind)
Neo4j 127.0.0.1:7687 Up
ClickHouse 127.0.0.1:8123 Up

Current issues

  • 8.61% test coverage
  • 17 time.sleep(), 1,713 f-string logs, 399 print() calls
  • Largest file app/routers/x402_tools.py is 212 KB
  • CI gates use continue-on-error: true and || true
  • 5 Telegram tokens leaked in git history

Docs

  • PRODUCT.md — charter and scope
  • ARCHITECTURE.md — components and data flow
  • ROADMAP.md — next 90 days
  • TODO.md — current tasks

Standards

This repo follows Rug Munch Media standards.