69 lines
2.5 KiB
Bash
Executable File
69 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Docs - Documentation workflow (writer + techeditor)
|
|
# Usage: ./workflows/Docs <backend> <workdir>
|
|
|
|
set -e
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "Usage: $0 <backend> <workdir>"
|
|
echo " backend: claude, kiro-cli"
|
|
exit 1
|
|
fi
|
|
|
|
BACKEND="$1"
|
|
DOC_PATH="$2"
|
|
|
|
RANDOM_WORD=$(shuf -n1 -e alpha beta gamma delta zeta theta kappa sigma omega lambda)
|
|
RANDOM_NUM=$(printf "%02d" $((RANDOM % 100)))
|
|
ALIAS_PREFIX="${RANDOM_WORD}${RANDOM_NUM}"
|
|
|
|
NAMESPACE=$(namespace)
|
|
if [ -z "$NAMESPACE" ]; then
|
|
echo "Error: No namespace found. Is anvillm running?"
|
|
exit 1
|
|
fi
|
|
|
|
AGENT_MOUNT="agent"
|
|
|
|
echo "Creating writer session..."
|
|
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
echo "new $BACKEND $DOC_PATH role=writer tasks=git,plan9,agent-q" | 9p write $AGENT_MOUNT/ctl
|
|
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
WRITER_ID=$(comm -13 <(echo "$before") <(echo "$after") | head -1)
|
|
|
|
echo "Creating techeditor session..."
|
|
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
echo "new $BACKEND $DOC_PATH role=techeditor tasks=git,plan9,agent-q" | 9p write $AGENT_MOUNT/ctl
|
|
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
EDITOR_ID=$(comm -13 <(echo "$before") <(echo "$after") | head -1)
|
|
|
|
echo "${ALIAS_PREFIX}-writer" | 9p write $AGENT_MOUNT/$WRITER_ID/alias
|
|
echo "${ALIAS_PREFIX}-techeditor" | 9p write $AGENT_MOUNT/$EDITOR_ID/alias
|
|
|
|
cat <<EOF | 9p write $AGENT_MOUNT/$WRITER_ID/context
|
|
Your job is to write and update documentation in $DOC_PATH.
|
|
|
|
You are a writer agent in a two-agent AnviLLM workflow. Your peer is the techeditor.
|
|
|
|
After completing work, send APPROVAL_REQUEST to the techeditor for review. You will receive APPROVAL_RESPONSE with feedback or approval.
|
|
|
|
For communication with other agents, load the anvillm-communication skill.
|
|
EOF
|
|
|
|
cat <<EOF | 9p write $AGENT_MOUNT/$EDITOR_ID/context
|
|
You are a professional technical editor in a two-agent AnviLLM workflow. Your peer is the writer. Ensure documentation in $DOC_PATH is high quality, readable, and at the right detail level.
|
|
|
|
When you receive an APPROVAL_REQUEST from the writer, review the documentation. Send APPROVAL_RESPONSE with either approval or recommended changes.
|
|
|
|
For communication with other agents, load the anvillm-communication skill.
|
|
EOF
|
|
|
|
echo ""
|
|
echo "✓ Documentation workflow ready ($ALIAS_PREFIX)"
|
|
echo ""
|
|
echo "Sessions:"
|
|
echo " ${ALIAS_PREFIX}-writer: $WRITER_ID"
|
|
echo " ${ALIAS_PREFIX}-techeditor: $EDITOR_ID"
|
|
echo ""
|
|
echo "Give the writer a documentation task, or techeditor a document to review."
|