TokHub
When To Use
- The user wants to connect Codex or another agent to a local or remote TokHub URL.
- The user needs website-equivalent access to
/api/public/*,/api/me/*,/api/console/*,/api/admin/*, or site-key-scoped/v1/status/*. - The task must respect the logged-in user's platform and workspace roles.
- An owner/admin needs scoped
/api/admin/*admin-agent automation. - The user names retired
tokhub-admin; handle it here through admin-agent mode.
Do Not Use
- Editing, debugging, reviewing, or building TokHub source code.
- Calling
/gateway/v1/*model inference endpoints. - Bypassing TokHub website permissions or reading admin-only data as an ordinary user.
- Asking the user to paste passwords, cookies, keys, session files, or admin-agent tokens into chat.
Workflow
- Read
references/session-auth-contract.mdbefore login, profile, workspace, or session work. - Read
references/permission-model.mdbefore any write, export, delete, bulk, revoke, reset, credential, or admin operation. - Inspect
references/operation-catalog.json; for admin-agent automation, inspectreferences/admin-agent-operation-catalog.jsonandreferences/admin-agent-contract.md. - If the profile is not logged in, run
node agent-skills/tokhub/scripts/tokhub.mjs login --url https://host --profile defaultand let the user enter credentials in the terminal. - Run
node agent-skills/tokhub/scripts/tokhub.mjs preflight --profile default. - For reads, run
node agent-skills/tokhub/scripts/tokhub.mjs request GET /api/... --profile default. For/v1/status/*, require a local Site Key environment variable and pass--site-key-env ENV_VAR. - For writes, exports, downloads, deletes, bulk, reset, revoke, credential, package, or key actions, require
--execute --reason "..." --idempotency-key "...". - For owner/admin scoped bearer automation, use
node agent-skills/tokhub/scripts/tokhub.mjs admin-agent ...and keep the existing audit verification workflow. - Map
$tokhub-adminwording totokhubadmin-agent mode; the standalone package is retired. - Treat JSON as redacted. Exports/downloads require
--output; key material is not written inside the current git worktree unless--allow-repo-outputis passed.
Output Contract
Return:
- profile, base URL, auth mode, and target path
- role/workspace context, risk, guard status, execution status, important fields
- admin-agent audit verification for writes
- blocked precondition, missing role/scope/env, or refusal reason
Reference Map
references/session-auth-contract.md: login, profiles, CSRF, cookies, local secrets.references/permission-model.md: public, user, workspace, admin, admin-agent boundaries.references/operation-catalog.json: session operation catalog.references/admin-agent-contract.md: scoped bearer, idempotency, audit, secret rules.references/admin-agent-operation-catalog.json: admin-agent operation catalog.scripts/tokhub.mjs: deterministic TokHub client.evals/trigger_cases.json: trigger boundary cases.reports/output-risk-profile.md: likely output mistakes and mitigations.reports/trust-boundary.md: credential, network, and local session trust boundary.reports/output_quality_scorecard.md: governed package evidence summary.