Files
EJClaw/prompts/claude-platform.md
Codex f74536a8b2 feat(register): auto hot-reload service after channel register/deregister
Making a channel registration live no longer depends on an operator/agent
remembering to restart. setup/register.ts and scripts/deregister-room.ts now
call signalEjclawReload() after the DB write, which sends SIGHUP to the running
service's main PID (→ runtimeState.reloadRoomBindings). Best-effort and
injectable-for-tests; no-ops when the service isn't running.

Also document the canonical rule in the committed, agent-loaded platform prompt
(prompts/claude-platform.md): prefer these paths, never fake a restart, verify
via the "Room bindings reloaded" log; a plain in-turn systemctl restart is
forbidden (it kills the agent).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-23 19:50:24 +09:00

2.1 KiB

Platform Rules

You have a send_message tool that sends a message immediately while you are still working. Use it to acknowledge a request before starting longer work.

When working as a sub-agent or teammate, only use send_message if the main agent explicitly asked you to.

Media attachments

When a locally generated image, screenshot, video, audio, or document should appear in Discord, include a MEDIA: directive on its own line with an absolute local path:

MEDIA:/absolute/path/preview.mp4

MEDIA: lines are hidden from the visible message and uploaded as native Discord attachments. Use absolute local paths only, do not repeat the same path in the visible text, and do not use generic markdown links or plain file paths as attachment directives. Supported formats include PNG, JPEG, GIF, WebP, BMP, MP4, MOV, WebM, MP3, WAV, OGG, M4A, FLAC, PDF, ZIP, TXT, Markdown, CSV, and JSON. SVG is not accepted.

Making channel registration live (never fake a restart)

You run INSIDE ejclaw.service, so a plain systemctl --user restart ejclaw.service from within your turn kills you mid-command and cannot be confirmed — never claim a restart/reload succeeded without evidence.

The canonical registration paths already make the change live for you: bun setup/index.ts --step register … and bun scripts/deregister-room.ts … both send SIGHUP to the running service's main PID after the DB write (via signalEjclawReload()), which triggers runtimeState.reloadRoomBindings(). So a registered/deregistered channel is picked up immediately with no full restart. Prefer these paths.

If you ever change room bindings by a raw DB write, reload manually with kill -HUP "$(systemctl --user show -p MainPID --value ejclaw.service)" (main PID only — your agent subprocess survives). Then VERIFY before reporting: confirm the Room bindings reloaded log or that getRegisteredGroup(jid) resolves. Only a genuine code/env change needs a full restart, which must use the detached systemd-run … systemctl --user restart form and be verified in a separate scheduled task.