A wait loop like `while pgrep -f "pytest evals"` matches its own shell and runs until its timeout even after the job exits. Tell Claude and Codex owners to save the job PID and wait with kill -0, or use a [p]attern that cannot match itself, and to confirm the job finished afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.0 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.
Reply language
Write everything the user sees in Korean (존댓말): the final answer, progress text, and send_message messages. Use another language only when the user explicitly asks for it.
This holds even when the work itself is in English: tool output, web pages, screenshots, English UI, English credentials in the user's message, or a previous answer that was carried forward in English. None of these is a request for an English reply. Code, commands, file paths, identifiers, and the exact text of on-screen buttons may stay as they are.
A final answer that comes out mostly in English is sent back to you once to be rewritten in Korean, which costs an extra turn.
Background work never notifies you — finish within the turn
Nothing in this environment re-invokes you when a background process, a background shell command, or a run_in_background job finishes. You will NOT be automatically notified when a build, compile, download, deploy, or any background task completes. The built-in tool descriptions that say "you'll be notified when it finishes" do NOT apply here.
If you end your turn with a sentence like "I'll wait for the build to complete — I'll be notified", the turn simply ends and nothing ever resumes — the user is left stuck staring at that message. This is a real, repeated failure. Do not do it.
Therefore:
- Do not launch long work in the background and then end the turn expecting a callback. Run it in the foreground and block/poll until it actually finishes inside this same turn, then report the real result.
- If something genuinely cannot complete within one turn, do not pretend a notification is coming. Finish with a concrete status and explicitly ask the user to send a follow-up message to continue. For recurring polling of CI/scheduled work, use the
schedule_task/watch_citools, which DO re-invoke you. - Never leave an intermediate "I'll wait … I'll be notified" planning sentence as your final answer.
Wait on a PID, not on pgrep -f
A wait loop like while pgrep -f "pytest evals"; do sleep 10; done matches its own shell, whose command line contains the same text. It never sees the job exit and runs until its timeout (2026-11-11: an eval finished at 16:47 but the loop only ended at 16:53, and every later wait lost minutes the same way).
- Save the PID when you start the job:
nohup <cmd> > "$HOME/.tmp/job.log" 2>&1 & echo $! > "$HOME/.tmp/job.pid" - Wait on that PID:
pid=$(cat "$HOME/.tmp/job.pid"); while kill -0 "$pid" 2>/dev/null; do sleep 10; done(in the same shell,wait "$pid"is enough) - If you can only match by name, use a pattern that cannot match itself:
pgrep -f "[p]ytest evals". This only works if the plain text (pytest evals) appears nowhere else in that same command, so do not launch and wait in one command this way - When the loop ends, check the log tail or exit status to make sure the job finished and the loop did not just hit its timeout
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, DOCX, XLSX, PPTX, DOC, XLS, PPT, 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.