agentleFS
thewaifucorpthewaifucorp/bastion-agent/skills/mobile-connect/SKILL.md

bastion/mobile-connect

Skill8 starsChanged 4 months agoMITView on GitHub

Generates one-time connection tokens for the Bastion mobile app, manages device JWT lifecycle, and handles device revocation.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the user types /connect-app multiple times, each call generates a new independent token

    line 78
  2. Very specific:

    If the token expires before the user enters it, they must run /connect-app again

    line 79
  3. Distinctive:

    If a device name is already connected, exchanging a new token with the same name overwrites the previous entry

    line 80

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

bastion/mobile-connect

Connects the Bastion mobile app (iOS/Android) to the user's self-hosted Bastion instance using a secure one-time token exchange flow.

Triggers

TriggerAction
/connect-appGenerate a one-time token (BAST-XXXX-XXXX) valid for 5 minutes and display it (plus QR code) for the user to enter in the mobile app
/devicesList all currently connected devices with name and connection timestamp
/revoke {device_name}Immediately revoke the JWT for the specified device

Flow: /connect-app

1. User types /connect-app in Telegram/WhatsApp
2. Bastion calls generateConnectToken() → BAST-XXXX-XXXX
3. Token is stored in pendingTokens with 5-minute TTL
4. Bastion displays the token as text + QR code
5. User opens the mobile app and enters the token
6. App sends POST /auth/exchange { token, device_name }
7. Bastion validates TTL, deletes token immediately (one-time use)
8. Bastion generates JWT (exp: 90 days) and returns it
9. App stores JWT in keychain (iOS) / keystore (Android)
10. Connection established — app uses JWT for all subsequent requests

Flow: /devices

1. User types /devices
2. Bastion calls GET /devices
3. Returns list of connected (non-revoked) devices with name and connected_at
4. Bastion formats and displays the list to the user

Flow: /revoke {device_name}

1. User types /revoke my-iphone
2. Bastion calls DELETE /devices/my-iphone
3. Device is added to the in-memory revocation blocklist immediately
4. Any subsequent request using that device's JWT is rejected with 401
5. Bastion confirms revocation to the user

Security Notes

  • Tokens are one-time use: deleted immediately upon successful exchange
  • Token TTL is 5 minutes — expired tokens are rejected
  • JWT_SECRET is read from environment variable, never hardcoded
  • JWTs expire after 90 days; users must reconnect after expiry
  • Revocation is immediate and in-memory (survives until process restart)
  • The mobile app must store the JWT in the platform secure storage (keychain/keystore)

API Endpoints

MethodPathDescription
POST/auth/exchangeExchange one-time token for JWT
GET/devicesList connected devices
DELETE/devices/:deviceRevoke a device

Edge Cases

  • If the user types /connect-app multiple times, each call generates a new independent token
  • If the token expires before the user enters it, they must run /connect-app again
  • If a device name is already connected, exchanging a new token with the same name overwrites the previous entry
  • Revocation persists only in memory — a process restart clears the blocklist (production deployments should use Redis)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.