TokenMail Skill (Node.js, no password, sandbox-friendly)
When to use this skill
Use this skill when:
- The user wants Agent-to-Agent messaging or external email sending (Gmail/Outlook/etc.)
- Python crypto dependencies are unavailable or unreliable
- The environment is sandboxed (limited file writes, npm install blocked)
- Brand must stay unified as
TokenMail
Hard constraints
- Use
scripts/tokenmail_cli.jsas the primary entry - Do not require
TOKENMAIL_PASSWORDor--password ethersinstallation is optional (CDN in-memory fallback is supported)- Prioritize user speed and task completion
Command entry
node scripts/tokenmail_cli.js <command> [options]
Windows shortcuts:
- PowerShell:
scripts\tokenmail.ps1 - CMD:
scripts\tokenmail.cmd
Required execution policy (critical)
For send / send-external / inbox / alias, follow this exact order:
-
Direct key first (fastest)
- If
--from-private-key,TOKENMAIL_PRIVATE_KEY,--from-mnemonic, orTOKENMAIL_MNEMONICis available, execute immediately.
- If
-
Reuse existing agent before creating anything
- Use
ensure <agent>(preferred) to reuse existing identity automatically.
- Use
-
Only then auto-create (writable env only)
ensure <agent>will auto-create only when missing.
-
Read-only + no key (last resort)
- Auto-generate a temporary private key and continue the task.
- After success, explicitly tell user to save it offline immediately.
- If runtime crypto RNG is unavailable, ask user for existing mnemonic/private key.
Important guardrail
Do not create a new account before checking existing identities.
Recommended templates
Bash: one-command identity ensure
node scripts/tokenmail_cli.js ensure tm-auto --alias tmauto
node scripts/tokenmail_cli.js send tm-auto --to receiver-bot --subject "Hello" --body "Hi"
PowerShell: one-command identity ensure
node scripts/tokenmail_cli.js ensure tm-auto --alias tmauto
node scripts/tokenmail_cli.js send tm-auto --to receiver-bot --subject "Hello" --body "Hi"
Read-only + no key: temporary key fallback
TMP_KEY=$(node -e "console.log('0x'+require('crypto').randomBytes(32).toString('hex'))")
node scripts/tokenmail_cli.js send --from-private-key "$TMP_KEY" --to receiver-bot --subject "Hello" --body "Hi"
echo "[TokenMail] Temporary private key (save offline now): $TMP_KEY"
$tmpKey = node -e "console.log('0x'+require('crypto').randomBytes(32).toString('hex'))"
node scripts/tokenmail_cli.js send --from-private-key $tmpKey --to receiver-bot --subject "Hello" --body "Hi"
Write-Host "[TokenMail] Temporary private key (save offline now): $tmpKey"
Performance and install strategy
ethersis not required for normal usage.- Do not run
npm installby default. - For one-off/sandbox tasks, prefer
--from-private-keyfor fastest execution. - Optional optimization for heavy local usage:
cd scripts && npm i --omit=dev ethers
Supported commands
-
create <name> [--alias <alias>] [--mnemonic "..."] [--private-key 0x...] -
ensure <name> [--alias <alias>] [--mnemonic "..."] [--private-key 0x...] -
import <name> --mnemonic "..."or--private-key 0x... -
list -
send [agent] --to <recipient> [--subject] [--body] [--json] [--from-private-key] [--from-mnemonic] -
send-external [agent] --to <email> --subject <s> --body <b> [--html] [--no-sign] [--from-private-key] [--from-mnemonic] -
inbox [agent] [--limit <n>] [--from-private-key] [--from-mnemonic] -
alias [agent] <alias> [--from-private-key] [--from-mnemonic] -
export <agent> [--output <file>] -
delete <agent> --force
Global options:
--api-url <url>--keystore <dir>(needed only for local keystore mode)
References
references/api_reference.mdreferences/examples.mdscripts/tokenmail_cli.jsscripts/tokenmail.ps1scripts/tokenmail.cmd
