102 lines
3.0 KiB
Bash
Executable File
102 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Check task board for tasks relevant to this agent
|
|
# Usage: bash check-taskboard.sh <agent-name>
|
|
# Returns: summary of pending/blocked tasks for this agent, or "nothing" if clear
|
|
set -euo pipefail
|
|
|
|
AGENT="${1:?Usage: check-taskboard.sh <agent-name>}"
|
|
HANDOFF_DIR="/home/papa/atomizer/handoffs"
|
|
SPRINT_FILE="/home/papa/atomizer/dashboard/sprint-mode.json"
|
|
|
|
# Check sprint mode
|
|
if [ -f "$SPRINT_FILE" ]; then
|
|
SPRINT_ACTIVE=$(python3 -c "import json; print(json.load(open('$SPRINT_FILE')).get('active', False))")
|
|
if [ "$SPRINT_ACTIVE" = "True" ]; then
|
|
echo "🏃 SPRINT MODE ACTIVE"
|
|
fi
|
|
fi
|
|
|
|
# Scan handoffs for this agent's tasks that aren't complete
|
|
PENDING=$(python3 -c "
|
|
import json, glob, sys
|
|
from datetime import datetime
|
|
|
|
agent = '$AGENT'
|
|
handoffs = sorted(glob.glob('$HANDOFF_DIR/orch-*.json'), reverse=True)
|
|
|
|
pending = []
|
|
for path in handoffs[:100]:
|
|
try:
|
|
with open(path) as f:
|
|
data = json.load(f)
|
|
if data.get('agent') != agent:
|
|
continue
|
|
status = data.get('status', '').lower()
|
|
if status in ('complete', 'done'):
|
|
continue
|
|
result_preview = (data.get('result', '') or '')[:80].replace('\n', ' ')
|
|
pending.append(f'{status}: {result_preview}')
|
|
except:
|
|
continue
|
|
|
|
if not pending:
|
|
print('nothing')
|
|
else:
|
|
for p in pending[:5]:
|
|
print(f' - {p}')
|
|
")
|
|
|
|
echo "$PENDING"
|
|
|
|
# Also check if there are tasks assigned to OTHER agents that this agent could contribute to
|
|
# (cross-pollination like Bhanu's model)
|
|
CROSS=$(python3 -c "
|
|
import json, glob
|
|
|
|
agent = '$AGENT'
|
|
# Agent domain mapping for cross-pollination
|
|
DOMAINS = {
|
|
'webster': ['research', 'literature', 'material', 'CTE', 'properties'],
|
|
'auditor': ['review', 'validate', 'check', 'verify', 'audit'],
|
|
'tech-lead': ['architecture', 'design', 'approach', 'methodology'],
|
|
'optimizer': ['optimization', 'parameter', 'objective', 'convergence'],
|
|
'study-builder': ['script', 'code', 'run_optimization', 'python'],
|
|
'nx-expert': ['NX', 'Nastran', 'mesh', 'FEA', 'solver'],
|
|
'secretary': ['summary', 'report', 'status', 'update'],
|
|
'manager': [],
|
|
}
|
|
|
|
my_keywords = DOMAINS.get(agent, [])
|
|
if not my_keywords:
|
|
print('none')
|
|
exit()
|
|
|
|
handoffs = sorted(glob.glob('$HANDOFF_DIR/orch-*.json'), reverse=True)
|
|
relevant = []
|
|
for path in handoffs[:50]:
|
|
try:
|
|
with open(path) as f:
|
|
data = json.load(f)
|
|
if data.get('agent') == agent:
|
|
continue
|
|
status = data.get('status', '').lower()
|
|
if status in ('complete', 'done'):
|
|
continue
|
|
result = (data.get('result', '') or '').lower()
|
|
if any(kw.lower() in result for kw in my_keywords):
|
|
relevant.append(f'{data.get(\"agent\")}: {(data.get(\"result\",\"\") or \"\")[:60].replace(chr(10),\" \")}')
|
|
except:
|
|
continue
|
|
|
|
if not relevant:
|
|
print('none')
|
|
else:
|
|
for r in relevant[:3]:
|
|
print(f' - {r}')
|
|
")
|
|
|
|
if [ "$CROSS" != "none" ]; then
|
|
echo "📌 Cross-pollination opportunities:"
|
|
echo "$CROSS"
|
|
fi
|