ln-033-hex-relay-lifecycle
Use when deploying, redeploying, verifying, migrating, or syncing users for the hex-relay Telegram/API control plane on a VPS.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 12
- Forks
- 3
01 前言 Front Matter
- name
- ln-033-hex-relay-lifecycle
- license
- MIT
- description
- Use when deploying, redeploying, verifying, migrating, or syncing users for the hex-relay Telegram/API control plane on a VPS.
- allowed-tools
- Bash, Read, mcp__hex-ssh__remote-ssh, mcp__hex-ssh__ssh-read-lines, mcp__hex-ssh__ssh-write-chunk, mcp__hex-ssh__ssh-edit-block, mcp__hex-ssh__ssh-download
03 SKILL.md 正文
<!-- markdownlint-disable MD012 MD022 MD032 MD040 MD041 MD060 -->
Paths: File paths (
shared/,agents/hex-relay/,../ln-030-vps-bootstrap/references/) are relative to skills repo root. If not found at CWD, locate thisSKILL.mddirectory and go up one level for repo root.
ln-033-hex-relay-lifecycle
Type: L3 Worker Category: 0XX Shared / Infrastructure
Manages hex-relay as a standalone product deployed into one project environment.
MANDATORY READ
MANDATORY READ: Load shared/references/worker_runtime_contract.md, shared/references/coordinator_summary_contract.md, and shared/references/vps_runtime_contract.md
MANDATORY READ: Load ../ln-030-vps-bootstrap/references/hex_relay_deploy.md, ../ln-030-vps-bootstrap/references/verification_recipes.md, agents/hex-relay/README.md, agents/hex-relay/docs/redeploy.md, and agents/hex-relay/docs/telegram-operator-runbook.md
Input / Output
| Direction | Content |
|---|---|
| Input | mode, project/VPS variables, Telegram variables, optional declared users, optional dry_run, optional runId, optional summaryArtifactPath |
| Output | vps-hex-relay-lifecycle summary with status, changes, warnings, blockers, verification, and artifact paths |
If summaryArtifactPath is provided, write the same summary JSON there. If not provided, return the summary inline and write it to the standalone run-scoped path. Generate a standalone run_id when runId is absent.
Modes
| Mode | Behavior |
|---|---|
initial_deploy |
Deploy agents/hex-relay/ into an existing project runtime |
redeploy |
Replace source on VPS, rebuild, restart service, verify health |
verify_only |
Inspect service, DB, hooks, Telegram command state without mutation |
sync_users |
Reconcile declared Telegram users/roles through supported relay state |
Workflow
Phase 1: Preflight
Verify:
- Telegram is enabled for deploy/sync modes
${PROJECT_NAME},${SERVICE_PREFIX},${PROJECT_DIR},${RELAY_HOOK_PORT}are set- project runtime exists
/etc/${PROJECT_NAME}/secrets.envexists but secret values are not printedagents/hex-relay/source is available locally
Phase 2: Compatibility
Use hex_relay_deploy.md.
Detect old ${SERVICE_PREFIX}-relay-bot.service and /opt/${SERVICE_PREFIX}-relay-bot.
Rule:
- disable or migrate old relay before enabling
${SERVICE_PREFIX}-hex-relay.service - never run old and new relay units together
Phase 3: Deploy Or Redeploy
For initial_deploy, install:
/opt/${SERVICE_PREFIX}-hex-relay${SERVICE_PREFIX}-hex-relay.service- project-scope hooks
- Telegram command registration
For redeploy, follow agents/hex-relay/docs/redeploy.md:
- package source without
node_modulesordist - upload source
- rebuild with
npm ci && npm run build - restart service
Phase 4: Users And Telegram
For sync_users, reconcile declared users without exposing tokens.
Verify:
- allowlist state
- per-user god target behavior
/new_session,/sessions,/tasks,/users,/usagecommand availability- BotFather hardening checklist status when applicable
Phase 5: Health
Verify:
${SERVICE_PREFIX}-hex-relay.serviceGET /healthrelay.dbschema- outbox/dispatch/todo state smoke
- final Claude reply mirrored through Stop hook when full smoke is requested
Phase 6: Summary
Write a vps-hex-relay-lifecycle summary artifact with deploy/redeploy/user-sync changes and health evidence.
Critical Rules
hex-relaysource is owned byagents/hex-relay/.- Do not edit built
dist/on the VPS. - Do not upload
node_modules/. - Do not print or store Telegram/provider token values.
dry_run=trueandverify_onlydo not mutate remote state.- Product-specific behavior is documented in
agents/hex-relay/README.md.
Definition of Done
- [ ] Telegram/relay gate evaluated and skipped as
N/A:when disabled. - [ ] Old
relay-botunit/path detected and disabled or reported before enablinghex-relay. - [ ]
/opt/${SERVICE_PREFIX}-hex-relaysource installed or verified. - [ ]
${SERVICE_PREFIX}-hex-relay.serviceactive or planned. - [ ] Product was built with
npm ci && npm run buildfor deploy/redeploy. - [ ]
/healthreturns expected service and god-session fields. - [ ] Telegram commands and declared users are verified or explicitly gated.
- [ ]
dry_run=true/verify_onlyperformed no mutation. - [ ] Structured
vps-hex-relay-lifecyclesummary artifact written.
Version: 1.0.0 Last Updated: 2026-05-05
04 同仓库更多 Skills
web-access
Use Treg for public web or platform data only when existing search, browser and connected tools cannot cover the task, with explicit cost and data boundaries.
treg
Use the Treg CLI or MCP catalog to discover, price and call authorized external tools with team-scoped credentials and a user-approved budget.
recruit
Turn a job description into an evidence-linked candidate shortlist through Treg, with job-related ranking and optional authorized business contact enrichment.
rea-growth
Analyze a company’s public growth and content through Treg, distinguish observations from hypotheses, and produce an evidence-linked playbook within an approved budget.
make-ugc
Create original AI UGC-style product videos through Treg: research hooks, approve a licensed presenter and voice, generate clips, add captions and report costs.
lead-signals
Find and qualify public buying signals through Treg, rank fitting business accounts and optionally enrich authorized business contact information.