Imported from Roooted1776/frisky (
AGENTS.md). Install upstream withnpx skills add Roooted1776/frisky. Copyright stays with the author.
Agents
Product working notes for humans: MAX.md.
Dual-Mac / git identity: docs/DUAL-MAC.md.
Ops stack (VPS / MCP / secrets): docs/OPS.md.
Canonical repo: Roooted1776/RedMed-V1-Official (migrated from frisky).
Local clones: ~/Documents/RedMed-V1-Official (legacy ~/Documents/frisky OK until Macs re-clone).
Product wall (ops vs Assist)
Assist #d= / ICE profiles / Owner medical Keychain data must never pass through:
- RedMed MCP (
mcp/— seedocs/mcp.md) - Supabase (
mohxobgyjkcmkqxijgeg— ops/metadata only) - Hostinger VPS (
2010795/2.25.249.204) shell or Traefik routes
Assist origin stays Hostinger static + Cloudflare DNS/SSL (docs/domain.md). VPS is ops-only.
Who can work this repo
| Agent | Role | How it lands code |
|---|---|---|
| Grok (xAI) | Owner-side agent. GitHub connector on Roooted1776. Reads/writes this repo, opens/merges PRs, keeps main current. |
Commits via GitHub as Roooted1776. Do not invent a separate Grok GitHub user. |
| Cursor Agent | Cloud + local IDE agent. Linux Cloud Agent covers the static Hostinger / Assist shell (tapper/ path) only. MacBook Air / Mini My Machines workers (macbook-air, mac-mini) run tool calls on that Mac for iOS / Xcode — see docs/DUAL-MAC.md §0. |
PRs from cursor/* or main-* branches. Owner app (owner/) is macOS/Xcode, not the Linux Cloud Agent. |
| Owner (Max) | Source of truth for product calls. | MacBook Air + Mini clones at ~/Documents/RedMed-V1-Official (or legacy ~/Documents/frisky) → main. |
Grok is in this repo. Treat instructions here as binding when Grok edits RedMed.
Surfaces (do not mix)
Two folders, two audiences — never cross owner-only features into Assist.
| Surface | Folder / URL | Audience | Scope |
|---|---|---|---|
| Assist | tapper/ → https://redmed.live/tapper/ |
The person tapping the band (passerby / responder) | Tap pages, band #d= decode, RedMed · 911 · Aid web shell only. No NFC tab, Edit, Face ID, Keychain, or App Store flows. No-auth, no-ads. Folder + URL path stay tapper/ so already-written bands keep working. |
| Owner | owner/ |
The person with the app on their phone (App Store wearer) | Native iOS / SwiftUI (com.redmed.app). Profile, Edit, NFC Write/Scan, Face ID chrome, Keychain, HealthKit import. Not HIPAA-certified — local-only ICE card. |
- Assist (static Hostinger shell) — Product write base
https://redmed.live/tapper/(docs/domain.md). Stage withscripts/stage-worker-assets.sh→dist/passerby; deploy withnode scripts/deploy-hostinger-static.mjs redmed.live(HOSTINGER_API_TOKEN). Servestapper/, redirect stubs (index.html,redmed-emergency.html, …),sw.js,Document/,assets/,.htaccess(AASA Content-Type on Apache). No app build. No RedMed server / DB. Local:python3 -m http.server. CI:.github/workflows/pages-deploy.yml. Before merge:bash scripts/sync-tapper.sh,node scripts/test-d-codec.mjs, andnode scripts/test-worker-device.mjs. Ops MCP:mcp/(docs/mcp.md; product wall above). - Owner (native iOS app) —
owner/RedMed.xcodeproj. macOS only.ios-build.ymlonmacos-latest. Xcode copiestapper/index.htmlinto the bundle astapper.htmlfor NFC Preview only — that copy is read-only embed, not a second shell fork. - Own-band / Assist SOS — SOS exists so helpers can find someone on a dark rainy night after a motorist ejects from a vehicle: full sound + full light. It arms only when the helper toggles SOS · Locate Me, or when collision is detected using US Crash Detection timing (Apple Support 104959: 10s alert + 30s countdown →
tel:unless Stop) — not Apple's Crash Detection API. Band tap never auto-arms SOS. After the owner writes their custom band and has RedMed installed, Associated Domains (Universal Links) claims the tap — never aredmed://handoff carrying#d=(custom schemes are not exclusive; any app registeringredmedwould get the profile). NFC write ships only with Associated Domains (enforced bytest-nfc-hardware.mjs). No distance / BLE ranging.
Keep sw.js, tapper/sw.js, and owner/RedMed/sw.js CACHE versions in lockstep.
Git identity
Verified author on this repo: Max <maxaguilaraasted@gmail.com> (scripts/setup-mac-git.sh).
mrmax115@gmail.com and the MCCC school address are aliases / login emails — not the git author unless Max changes setup-mac-git.sh.
Gmail for automations: Cursor Gmail MCP, not a separate Grok Gmail plugin.
Invariants Grok must not break
- Band is the product. No fake “write from the app” storefront copy until Tag Reading + write-on-blank NTAG216 ships.
- No HIPAA-certified / fake App Store ID claims.
- Face ID is UI-only. Keychain stays
WhenPasscodeSetThisDeviceOnlywith no biometry ACL. - Assist at
https://redmed.live/tapper/is no-auth, no-ads.#d=codec lockstep tests must stay green. - SOS = full sound + full light; arms only on SOS toggle or US Crash Detection collision timing — never on band tap alone. Owner phone with RedMed + written band: applinks (Universal Links) claim the tap — no
redmed://band#d=handoff. No fake band-distance ranging. - Band is factory blank NDEF-unlocked NXP NTAG216 — no permanent lock bytes, ever.
scripts/test-nfc-hardware.mjs(51 checks) must stay green. - One repo, one branch for shipping:
Roooted1776/RedMed-V1-Officialmain(legacy remotefriskyuntil Macs cut over).
NFC hardware contract
scripts/test-nfc-hardware.mjs statically enforces the bracelet hardware
contract on Linux CI (no Xcode needed) — 51 checks, must all pass before
merge (pages-deploy.yml and ios-build.yml both run it). Rule detail for
IDE agents: .cursor/rules/nfc-hardware.mdc.
- Chip: product band is NXP NTAG216 only (13.56 MHz, ISO 14443A Type 2, NDEF blank unlocked). Never NTAG213/215, MIFARE, LF, or UHF.
- Tap geometry: deliberate antenna tap ~1–2″ (
AppConfig.BraceletRF); walk-by (~6–8″) must never fire a session. RedMed only starts CoreNFC on an explicit Write/Scan action, never on mere proximity. - Write gate:
NFCBandManager.writeBandrefuses scanner sessions, a busy session, and an empty profile before touching CoreNFC; enforces the 850-byte NTAG216 cap;NFCWriter.writeURLrefuses anything that is not amedicalCardBaseURL#d=URL. Parked builds (AppConfig.nfcHardwareEnabled == false) only pack a URL — never open a live session, never mark Linked. - NDEF contract: hand-built Well Known Type "U" record (keeps
#d=intact for iOS Background Tag Reading); single-record message checked against tag capacity before writing;queryNDEFStatushandled exhaustively (.notSupported/.readOnly/.readWrite/@unknown). - Read-back: every write is followed by a
readNDEFread-back compared viaNFCURICodec.match;writeVerified(not justwriteSucceeded) gateslinkBracelet. - No permanent lock bytes: band ships factory blank and unlocked
(
factoryLock = false,isRewritable = true); a.readOnlytag is refused, never force-written; RedMed never calls a lock/permalock API. - CoreNFC session type:
NFCNDEFReaderSessiononly — neverNFCTagReaderSession(raw tag access, lock-byte capable). No Simulator fake-success path anywhere.
