Fix Planning workflow: use AGENT_MOUNT and substitute session IDs in contexts

This commit is contained in:
Levi Neely 2026-02-15 21:39:39 +01:00
parent 20e661147c
commit 2a6e2f7ce9
1 changed files with 36 additions and 36 deletions

View File

@ -24,36 +24,36 @@ if [ -z "$NAMESPACE" ]; then
exit 1
fi
AGENT="agent"
AGENT_MOUNT="agent"
echo "Creating research session..."
before=$(9p read $AGENT/list | awk '{print $1}' | sort)
echo "new $BACKEND $DOC_PATH role=research tasks=plan9" | 9p write $AGENT/ctl
after=$(9p read $AGENT/list | awk '{print $1}' | sort)
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
echo "new $BACKEND $DOC_PATH role=research tasks=plan9" | 9p write $AGENT_MOUNT/ctl
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
RESEARCH_ID=$(comm -13 <(echo "$before") <(echo "$after") | head -1)
echo " ID: $RESEARCH_ID"
echo "Creating architect session..."
before=$(9p read $AGENT/list | awk '{print $1}' | sort)
echo "new $BACKEND $DOC_PATH role=architect tasks=git,plan9" | 9p write $AGENT/ctl
after=$(9p read $AGENT/list | awk '{print $1}' | sort)
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
echo "new $BACKEND $DOC_PATH role=architect tasks=git,plan9" | 9p write $AGENT_MOUNT/ctl
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
ARCH_ID=$(comm -13 <(echo "$before") <(echo "$after") | head -1)
echo " ID: $ARCH_ID"
echo "Creating techeditor session..."
before=$(9p read $AGENT/list | awk '{print $1}' | sort)
echo "new $BACKEND $DOC_PATH role=techeditor tasks=git,plan9" | 9p write $AGENT/ctl
after=$(9p read $AGENT/list | awk '{print $1}' | sort)
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
echo "new $BACKEND $DOC_PATH role=techeditor tasks=git,plan9" | 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 " ID: $EDITOR_ID"
# Set aliases
echo "${ALIAS_PREFIX}-research" | 9p write $AGENT/$RESEARCH_ID/alias
echo "${ALIAS_PREFIX}-architect" | 9p write $AGENT/$ARCH_ID/alias
echo "${ALIAS_PREFIX}-techeditor" | 9p write $AGENT/$EDITOR_ID/alias
echo "${ALIAS_PREFIX}-research" | 9p write $AGENT_MOUNT/$RESEARCH_ID/alias
echo "${ALIAS_PREFIX}-architect" | 9p write $AGENT_MOUNT/$ARCH_ID/alias
echo "${ALIAS_PREFIX}-techeditor" | 9p write $AGENT_MOUNT/$EDITOR_ID/alias
# Research context
cat <<EOF | 9p write $AGENT/$RESEARCH_ID/context
cat <<EOF | 9p write $AGENT_MOUNT/$RESEARCH_ID/context
Your job is to research system architecture and code for requested information. Use the agent-kb skill.
- Input: knowledge base (agent-kb) and relevant code
@ -63,54 +63,54 @@ Your job is to research system architecture and code for requested information.
When you receive a query from the architect, research and respond using shell tool with these exact commands:
cat > /tmp/msg.json <<EOF
{"to":"ARCHITECT_ID","type":"ANSWER","subject":"Research results","body":"YOUR_ANSWER_HERE"}
EOF
9p write agent/YOUR_ID/outbox/msg-$(date +%s).json < /tmp/msg.json
cat > /tmp/msg.json <<'ENDMSG'
{"to":"$ARCH_ID","type":"ANSWER","subject":"Research results","body":"YOUR_ANSWER_HERE"}
ENDMSG
9p write agent/$RESEARCH_ID/outbox/msg-\$(date +%s).json < /tmp/msg.json
Replace ARCHITECT_ID, YOUR_ID, and YOUR_ANSWER_HERE with actual values
Replace YOUR_ANSWER_HERE with actual answer
Do not actively await responses, but stop working until you receive an explicit request to conduct research.
EOF
# Architect context
cat <<EOF | 9p write $AGENT/$ARCH_ID/context
cat <<EOF | 9p write $AGENT_MOUNT/$ARCH_ID/context
Your job is to update design documentation in $DOC_PATH. Follow agent-kb conventions. Search the knowledge base for relevant documents.
If documentation is insufficient, query the research bot using shell tool with these exact commands:
cat > /tmp/msg.json <<EOF
{"to":"RESEARCH_ID","type":"QUESTION","subject":"Research request","body":"YOUR_QUESTION_HERE"}
EOF
9p write agent/YOUR_ID/outbox/msg-$(date +%s).json < /tmp/msg.json
cat > /tmp/msg.json <<'ENDMSG'
{"to":"$RESEARCH_ID","type":"QUESTION","subject":"Research request","body":"YOUR_QUESTION_HERE"}
ENDMSG
9p write agent/$ARCH_ID/outbox/msg-\$(date +%s).json < /tmp/msg.json
Replace RESEARCH_ID, YOUR_ID, and YOUR_QUESTION_HERE (include question, context, request for docs path or answer)
Replace YOUR_QUESTION_HERE (include question, context, request for docs path or answer)
Wait for the research agent to send the answer back
You will receive edit requests from the techeditor. Apply changes and send acknowledgment using shell tool:
cat > /tmp/msg.json <<EOF
{"to":"TECHEDITOR_ID","type":"STATUS_UPDATE","subject":"Changes applied","body":"YOUR_ACKNOWLEDGMENT"}
EOF
9p write agent/YOUR_ID/outbox/msg-$(date +%s).json < /tmp/msg.json
cat > /tmp/msg.json <<'ENDMSG'
{"to":"$EDITOR_ID","type":"STATUS_UPDATE","subject":"Changes applied","body":"YOUR_ACKNOWLEDGMENT"}
ENDMSG
9p write agent/$ARCH_ID/outbox/msg-\$(date +%s).json < /tmp/msg.json
Replace TECHEDITOR_ID, YOUR_ID, and YOUR_ACKNOWLEDGMENT with actual values
Replace YOUR_ACKNOWLEDGMENT with actual acknowledgment
Do not actively await responses, but stop working until you receive an explicit request to make a change from the techeditor.
EOF
# Tech-editor context
cat <<EOF | 9p write $AGENT/$EDITOR_ID/context
cat <<EOF | 9p write $AGENT_MOUNT/$EDITOR_ID/context
You are a professional technical writer. Ensure documentation in $DOC_PATH is high quality, readable, and at the right detail level for software engineers.
Do not edit documents directly. Send recommended changes to the architect using shell tool with these exact commands:
cat > /tmp/msg.json <<EOF
{"to":"ARCHITECT_ID","type":"REVIEW_REQUEST","subject":"Documentation review","body":"YOUR_RECOMMENDATIONS"}
EOF
9p write agent/YOUR_ID/outbox/msg-$(date +%s).json < /tmp/msg.json
cat > /tmp/msg.json <<'ENDMSG'
{"to":"$ARCH_ID","type":"REVIEW_REQUEST","subject":"Documentation review","body":"YOUR_RECOMMENDATIONS"}
ENDMSG
9p write agent/$EDITOR_ID/outbox/msg-\$(date +%s).json < /tmp/msg.json
Replace ARCHITECT_ID, YOUR_ID, and YOUR_RECOMMENDATIONS with actual values
Replace YOUR_RECOMMENDATIONS with actual recommendations
Request acknowledgment from the architect
When the architect acknowledges, proofread again. Iterate until satisfied.