HASSAR.AI Platform Documentation

Task V2

Everything below is waiting on you being back online with server access. Nothing on this list can move without that, so this is basically our to-do list for the 14th.

01

Fix the api.hassar.ai routing

The problem

api.hassar.ai and backend.hassar.ai currently return the exact same response — they're both pointing at our HASSAR.AI backend. api.hassar.ai is supposed to point at AGIM (Jim's server) instead.

Why

Your server runs two Cloudflare Tunnels: backend-hassarai-api (managed from the Cloudflare dashboard, correctly serves backend.hassar.ai) and hassar-backend (configured locally on the server, not in the dashboard — this one should serve api.hassar.ai → AGIM). Somewhere in the second tunnel's config, the ingress rule for api.hassar.ai is pointing at the wrong port — most likely the HASSAR.AI backend's port instead of AGIM's.

Steps
  1. SSH into your server.
  2. Find the cloudflared config file for the hassar-backend tunnel (typically ~/.cloudflared/config.yml or /etc/cloudflared/config.yml).
  3. Open it and find the ingress rule for hostname api.hassar.ai.
  4. Check the service: value on that line — note what port/address it currently points to.
  5. Find the port/address AGIM actually runs on (its own process, separate from the HASSAR.AI backend).
  6. Change the service: line for api.hassar.ai to point at AGIM's real port instead.
  7. Save the file and restart the tunnel: sudo systemctl restart cloudflared (or however it's run on your setup).
  8. Test from any machine — these should now return different responses (right now they're identical):
    curl https://api.hassar.ai/
    curl https://backend.hassar.ai/
Don't use the dashboard migration buttonThe "Migrate hassar-backend" button in the Cloudflare Zero Trust dashboard is irreversible and local-only config won't carry over. Edit the config file directly instead.
02

Confirm AGIM's real address

Once #1 is fixed and api.hassar.ai is actually reaching AGIM:

Steps
  1. Run curl https://api.hassar.ai/ again — confirm the response now looks like AGIM, not the {"ok":true} HASSAR.AI health check.
  2. Confirm whether AGIM needs an API key to accept requests, and get that key if so.
  3. Confirm the exact chat endpoint path AGIM expects (our code currently expects a path like /jim — confirm this still matches what AGIM actually exposes).
  4. Write down the final AGIM base URL + API key — these go into step #4 below.
03

Create an admin account on the live site

The problem

No account currently has admin access on the live HASSAR.AI site — this looks like it got lost when the backend moved off Railway onto your server. Without an admin account, nobody can reach the admin settings screen at all, which blocks steps #2 and #4.

Steps
  1. SSH into your server.
  2. Connect to the database:
    psql -U hassarai_user -d hassarai
  3. Decide which account becomes the first admin — either dale@acaieac.com.au or rizkyirawan0404@gmail.com (your call).
  4. Run:
    UPDATE users SET role = 'ADMIN' WHERE email = 'the-chosen-email@example.com';
  5. Log in on https://hassar.ai with that account and confirm you can reach the admin dashboard.
One-time onlyOnce this one account exists, every future admin action (adding more admins, changing settings) can be done from the website itself — no more DB access needed after this.
04

Turn on Jim (AGIM) in the site settings

Steps
  1. Log in with the admin account from #3.
  2. Go to System Admin → AI Config.
  3. Enter the AGIM URL and API key confirmed in #2.
  4. Save.
  5. Open Talk to Jim and send a test message — confirm you get a real AGIM response, not the local Ollama fallback.
05

Run 2 more security checks together

We already ran 2 rounds of security testing — both passed clean:

  • Semgrep (static code scan, 475 rules across 65 files) — 1 finding, already fixed (Docker container was running as root).
  • Promptfoo (red-teaming Jim's system prompt — jailbreaks, PII leaks, prompt extraction) — all completed tests passed.

Two more need the live site actually running to test properly, which is why we held off:

Steps
  1. Install Garak (pip install garak) and run it against the live chat endpoint — config already written up in docs/CYBER_SECURITY.md.
  2. Install OWASP ZAP and run a baseline scan against https://hassar.ai and https://api.hassar.ai.
  3. Review both sets of results together and fix anything that comes up.
Time neededAbout 30–60 minutes once the site is fully live.
06

Deploy the ready fix, and update Acai's chat setting

Part A — already done, just needs deploying

A CORS fix (commit a6524b8) that lets Acai's embedded HASSAR.AI sign-up widget work properly is already committed to main. It just needs your server to pull and redeploy:

git pull origin main
sudo systemctl restart hassarai-backend   # or however the backend service restarts on your setup
Part B — needs #2 done first

Acai's own chat widget currently points its AGIM_URL at HASSAR.AI's own internal chat endpoint instead of AGIM directly — this was a setup mistake from early on, not something that broke. Once #2 confirms AGIM's real address:

  1. Log into Acai's admin panel (https://acai.lomdv001.workers.dev/admin).
  2. Go to AI/Chat settings.
  3. Replace the current AGIM URL with the real one from #2.
  4. Test Acai's chat widget end-to-end.

Bottom line: items 1–4 are the main blockers — they unlock everything else. Once those are sorted, #5 and #6 are quick. Happy to jump on a call and go through all of this together whenever you're ready on the 14th.