Erlang-style message passing via /tmp file system. Use when simulating actor model with actual message synchronization between processes. Provides send/receive primitives with blocking and pattern matching.
Implements Erlang-style message passing between simulated processes using the `/tmp` filesystem for synchronization. Provides `send-message.sh` for non-blocking delivery and `blocking receive-message.sh` with pattern matching and timeouts. Use when testing actor model patterns requiring true message synchronization.
/plugin marketplace add kokuyouwind/claude-plugins/plugin install code-like-prompt@kokuyouwind-pluginsThis skill is limited to using the following tools:
scripts/append-log.shscripts/assign-random-roles.shscripts/generate-random-persona.shscripts/receive-message.shscripts/send-message.shProvides Erlang-style message passing primitives using /tmp file system as a message transport layer.
This skill enables true message-passing semantics between simulated Erlang processes:
Messages are stored as JSON files in /tmp/erlang-messages/<to-pid>/:
/tmp/erlang-messages/
├── main/
│ ├── worker_1-1704067200000000000.json
│ └── worker_2-1704067201000000000.json
├── worker_1/
│ └── main-1704067199000000000.json
└── coordinator/
├── worker_1-1704067202000000000.json
└── worker_2-1704067203000000000.json
Send a message from one process to another (non-blocking):
# Get the plugin installation path
PLUGIN_PATH="$HOME/.claude/plugins/marketplaces/kokuyouwind-plugins/plugins/code-like-prompt"
# Send message: main -> worker_1
bash "${PLUGIN_PATH}/skills/erlang-message-sync/scripts/send-message.sh" \
main \
worker_1 \
'{"type":"request","from":"main","data":"hello"}'
Output:
Message sent from main to worker_1
Message file: /tmp/erlang-messages/worker_1/main-1704067200000000000.json
Message content: {"type":"request","from":"main","data":"hello"}
Receive a message (blocking until message arrives or timeout):
# Receive any message for worker_1 (30s timeout default)
MESSAGE=$(bash "${PLUGIN_PATH}/skills/erlang-message-sync/scripts/receive-message.sh" worker_1)
echo "Received: ${MESSAGE}"
# Receive only from 'main' with 5s timeout
MESSAGE=$(bash "${PLUGIN_PATH}/skills/erlang-message-sync/scripts/receive-message.sh" \
worker_1 \
main \
5)
Output:
Waiting for message to worker_1 from main (timeout: 5s)...
Received message at worker_1 from main
Message content: {"type":"request","from":"main","data":"hello"}
{"type":"request","from":"main","data":"hello"}
Syntax:
send-message.sh <from-pid> <to-pid> <message-json>
Arguments:
from-pid: Sender's process identifierto-pid: Recipient's process identifiermessage-json: Message content as JSON stringBehavior:
/tmp/erlang-messages/<to-pid> if needed<to-pid>/<from-pid>-<timestamp>.jsonExample:
bash send-message.sh coordinator worker_1 '{"task":"process","value":42}'
Syntax:
receive-message.sh <pid> [from-pid-pattern] [timeout-seconds]
Arguments:
pid: Receiving process identifierfrom-pid-pattern (optional): Filter by sender (glob pattern, default: *)timeout-seconds (optional): Maximum wait time (default: 30)Behavior:
/tmp/erlang-messages/<pid>/ every 100msExamples:
# Receive any message
MESSAGE=$(bash receive-message.sh main)
# Receive only from worker_1
MESSAGE=$(bash receive-message.sh coordinator worker_1)
# Receive from worker_1 with 10s timeout
MESSAGE=$(bash receive-message.sh coordinator worker_1 10)
# Sender (main process)
bash send-message.sh main worker_1 '{"type":"request","data":"compute"}'
RESPONSE=$(bash receive-message.sh main worker_1 10)
echo "Got response: ${RESPONSE}"
# Receiver (worker_1 process)
REQUEST=$(bash receive-message.sh worker_1 main)
# ... process request ...
bash send-message.sh worker_1 main '{"type":"response","result":"done"}'
# Main spawns two workers
bash send-message.sh main worker_1 '{"task":"A"}' &
bash send-message.sh main worker_2 '{"task":"B"}' &
# Workers send results to coordinator
# (In worker_1)
RESULT_1=$(bash receive-message.sh worker_1 main)
bash send-message.sh worker_1 coordinator '{"result":"A_done"}'
# (In worker_2)
RESULT_2=$(bash receive-message.sh worker_2 main)
bash send-message.sh worker_2 coordinator '{"result":"B_done"}'
# Coordinator collects both results
RESULT_A=$(bash receive-message.sh coordinator worker_1)
RESULT_B=$(bash receive-message.sh coordinator worker_2)
bash send-message.sh coordinator main '{"combined":"A_done,B_done"}'
# Receive only 'done' messages from any worker
MESSAGE=$(bash receive-message.sh coordinator "worker_*")
# Receive specifically from worker_1
MESSAGE=$(bash receive-message.sh coordinator worker_1)
Messages are automatically deleted when received. To manually clean up:
rm -rf /tmp/erlang-messages
if MESSAGE=$(bash receive-message.sh main worker_1 5); then
echo "Received: ${MESSAGE}"
else
echo "Timeout or error"
fi
The scripts are located at:
$HOME/.claude/plugins/marketplaces/kokuyouwind-plugins/plugins/code-like-prompt/skills/erlang-message-sync/scripts/
When using in commands, always resolve the full path or set a variable:
SKILL_DIR="$HOME/.claude/plugins/marketplaces/kokuyouwind-plugins/plugins/code-like-prompt/skills/erlang-message-sync"
bash "${SKILL_DIR}/scripts/send-message.sh" main worker_1 '{"msg":"hi"}'
bash "${SKILL_DIR}/scripts/receive-message.sh" worker_1
&Use this skill when:
Do not use when:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.