structure: state/CURRENT.md — 2-4 line session state (rewritten each session) events/ — json event bus (pull-based, optional context) persistent/ — important decisions (one doc per decision) emit — helper script for emitting events
19 lines
567 B
Bash
Executable File
19 lines
567 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Emit an event to the agent event bus
|
|
# Usage: emit <agent> <action> <subject> [summary]
|
|
# Example: emit clawdbot deployed discord-feed-bots "5 feeds live"
|
|
|
|
AGENT="${1:?usage: emit <agent> <action> <subject> [summary]}"
|
|
ACTION="${2:?}"
|
|
SUBJECT="${3:?}"
|
|
SUMMARY="${4:-}"
|
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
EPOCH=$(date +%s)
|
|
FILE="$HOME/.agents/events/${EPOCH}-${AGENT}-${ACTION}-${SUBJECT}.json"
|
|
|
|
cat > "$FILE" << EOF
|
|
{"agent":"$AGENT","action":"$ACTION","subject":"$SUBJECT","summary":"$SUMMARY","timestamp":"$TIMESTAMP"}
|
|
EOF
|
|
|
|
echo "$FILE"
|