Self-Prompt

v1.1.0

Force agents to respond to automated messages by using `openclaw agent` instead of `openclaw message send`, ensuring tasks from scripts get agent replies.

0· 304·0 current·0 all-time
byEliran Wong@eliranwong
MIT-0
Download zip
LicenseMIT-0 · Free to use, modify, and redistribute. No attribution required.
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description match the included scripts and SKILL.md: both the bash and Python helpers call `openclaw agent` to force an agent turn and then use `openclaw message send` to deliver the response. Nothing requested or included (no env vars, no external URLs, no system-wide config access) is disproportionate to that purpose.
Instruction Scope
SKILL.md and the scripts remain within the stated scope (trigger agent turn, capture stdout, deliver back to chat). The scripts write an append-only log at ~/agent_task.log and require correct session-key formatting. They also cause the agent to run arbitrary prompts you supply — which is the point, but you should be aware that any secrets included in messages will be sent to the agent and appear in logs and chat.
Install Mechanism
No install spec is provided (instruction-only skill with bundled scripts). That is low-risk: nothing is downloaded or executed automatically on install beyond the provided scripts.
Credentials
The skill requests no credentials or environment variables. The only environment dependence is an override variable OPENCLAW_PATH; the default hardcoded path (/home/eliran/.nvm/current/bin/openclaw) is author-specific and may not exist on other systems — harmless but odd and worth adjusting to a generic default or requiring OPENCLAW_PATH to be set explicitly.
Persistence & Privilege
always is false and model invocation is allowed (normal). The skill only writes to its own log file in the user's home and does not modify other skills or system-wide agent settings.
Assessment
This skill appears to do exactly what it says: it wraps the openclaw CLI to force an agent response and deliver it to chat. Before installing or running it: 1) Verify the OPENCLAW_PATH used points to your openclaw binary (or set OPENCLAW_PATH explicitly) — the bundled default is an author-specific path. 2) Review and, if desired, change the log path (~/agent_task.log) to a location with appropriate permissions to avoid exposing sensitive output. 3) Avoid including secrets or sensitive data in automated messages sent to agents (they will appear in agent logs and chat). 4) Test in a non-production environment so you can confirm session-key formatting and timeout behavior. Overall the package is coherent, but exercise normal caution when letting automated scripts trigger agent actions.

Like a lobster shell, security has layers — review code before you run it.

latestvk97b20gh41tf2qz06wypccs8j981x9fs

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Self-Prompt: Forcing Agent Responses

The Problem

When automated scripts (cron, monitoring) send messages via openclaw message send:

  • Messages appear in chat as "system messages"
  • Agents may treat them as background info, not tasks
  • Agents respond to user messages but ignore automated ones
  • Accountability checks, alerts, and tasks go unanswered

The Solution

Use openclaw agent instead of openclaw message send for messages requiring agent response:

# OLD (agent may ignore):
openclaw message send --target -GROUP_ID --message "TASK: Do something"

# NEW (agent MUST respond):
RESPONSE=$(openclaw agent \
    --agent AGENT_ID \
    --session-id "agent:AGENT_ID:telegram:group:GROUP_ID" \
    --channel telegram \
    --message "TASK: Do something" \
    --timeout 180)

# Send response to chat:
openclaw message send --target -GROUP_ID --message "$RESPONSE"

Why This Works

  • openclaw message send → Creates chat message → Agent sees as "notification"
  • openclaw agent → Triggers actual agent turn → Agent MUST process and respond

Quick Start

For Bash Scripts

Use scripts/send_agent_task.sh:

# Simple usage:
~/.openclaw/skills/self-prompt/scripts/send_agent_task.sh \
    "AGENT_ID" \
    "GROUP_ID" \
    "Your task message here"

For Python Scripts

Use scripts/send_agent_task.py:

from send_agent_task import send_and_deliver

success, response = send_and_deliver(
    agent_id="stock-trading",
    group_id="-5283045656", 
    message="TASK: Analyze current positions",
    timeout=180
)

Pattern: Data + Task Separation

For monitoring scripts, separate data delivery from task requests:

# 1. Send DATA immediately (informational)
openclaw message send --target "$GROUP_ID" --message "📊 Position Data:
$POSITIONS"

# 2. Send TASK via agent (forces response)
RESPONSE=$(openclaw agent \
    --agent "$AGENT_ID" \
    --session-id "agent:$AGENT_ID:telegram:group:$GROUP_ID" \
    --message "Analyze the data above and report findings" \
    --timeout 180)

# 3. Deliver response
openclaw message send --target "$GROUP_ID" --message "📊 Analysis:
$RESPONSE"

Common Use Cases

Accountability Checks

# Force agent to respond to accountability check
send_agent_task.sh "my-agent" "-123456789" \
    "ACCOUNTABILITY CHECK: Did you complete the required tasks? Respond with status."

Monitoring Alerts

# Force agent to investigate and report
send_agent_task.sh "trading-agent" "-123456789" \
    "ALERT: Position down 5%. Investigate and report findings."

Scheduled Research Tasks

# Force agent to do research
send_agent_task.sh "research-agent" "-123456789" \
    "DAILY TASK: Search for news on $SYMBOLS and summarize findings."

Session Key Format

The session key follows this pattern:

agent:AGENT_ID:CHANNEL:TYPE:TARGET

Examples:

  • agent:stock-trading:telegram:group:-5283045656
  • agent:main:telegram:direct:123456789
  • agent:assistant:discord:channel:987654321

Script Reference

send_agent_task.sh

Location: scripts/send_agent_task.sh

send_agent_task.sh AGENT_ID GROUP_ID "message" [timeout]
  • Sends task via openclaw agent
  • Captures response
  • Sends response to group via message send
  • Logs to ~/agent_task.log

send_agent_task.py

Location: scripts/send_agent_task.py

from send_agent_task import send_and_deliver

success, response = send_and_deliver(
    agent_id="agent-name",
    group_id="-123456789",
    message="Task message",
    timeout=180,
    channel="telegram"
)

Troubleshooting

Agent not responding

  • Verify agent is running: openclaw gateway status
  • Check session key format matches your agent/group
  • Increase timeout for long-running tasks

Response not appearing in chat

  • Ensure script sends response via message send after capturing
  • Check GROUP_ID is correct (negative for groups)
  • Verify channel is correct (telegram/discord/etc)

Timeout errors

  • Increase timeout for research/analysis tasks (300-600 seconds)
  • Check if agent is overloaded with concurrent requests

Files

3 total
Select a file
Select a file to preview.

Comments

Loading comments…