58 lines
1.8 KiB
Bash
Executable File
58 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Research - Single research agent workflow
|
|
# Usage: ./workflows/Research <backend> <workdir>
|
|
|
|
set -e
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "Usage: $0 <backend> <workdir>"
|
|
echo " backend: claude, kiro-cli"
|
|
exit 1
|
|
fi
|
|
|
|
BACKEND="$1"
|
|
WORKDIR="$2"
|
|
|
|
RANDOM_WORD=$(shuf -n1 -e alpha beta gamma delta zeta theta kappa sigma omega lambda)
|
|
RANDOM_NUM=$(printf "%02d" $((RANDOM % 100)))
|
|
ALIAS_NAME="${RANDOM_WORD}${RANDOM_NUM}-research"
|
|
|
|
NAMESPACE=$(namespace)
|
|
if [ -z "$NAMESPACE" ]; then
|
|
echo "Error: No namespace found. Is anvillm running?"
|
|
exit 1
|
|
fi
|
|
|
|
AGENT_MOUNT="agent"
|
|
|
|
echo "Creating research session..."
|
|
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
echo "new $BACKEND $WORKDIR role=research tasks=plan9,agent-q" | 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 "$ALIAS_NAME" | 9p write $AGENT_MOUNT/$RESEARCH_ID/alias
|
|
|
|
cat <<EOF | 9p write $AGENT_MOUNT/$RESEARCH_ID/context
|
|
Your job is to provide answers to questions by researching existing knowledge base documents, the web, and the code base.
|
|
|
|
You are a research agent in a single-agent AnviLLM workflow.
|
|
|
|
- Search existing knowledge base documents for relevant information
|
|
- Analyze code and documentation in $WORKDIR
|
|
- Create or update KB documents with your findings
|
|
- Prefer updating existing documents over creating new ones
|
|
- Only create new KB documents for significant, reusable knowledge
|
|
|
|
Focus on providing concrete, actionable information that helps understand the system.
|
|
|
|
For communication with other agents or the user, load the anvillm-communication skill.
|
|
EOF
|
|
|
|
echo ""
|
|
echo "✓ Research workflow ready"
|
|
echo ""
|
|
echo "Session: $RESEARCH_ID (alias: $ALIAS_NAME)"
|
|
echo ""
|
|
echo "Give the research agent a topic to investigate."
|