Installs .convoys/README.md, log-convoy-event.sh, convoy-planning Cursor rule, and gitignored metrics JSONL. Documents Echodo dogfood kickoff and adds a shipped convoy record for Epic 1 model provider registry. Co-authored-by: Cursor <cursoragent@cursor.com>
83 lines
3.3 KiB
Bash
Executable file
83 lines
3.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# log-convoy-event.sh — append one convoy event to .convoys/.metrics.jsonl.
|
|
#
|
|
# Used by L2 roles to emit lightweight metrics for self-analytics.
|
|
# Schema: github.com/varutasu/agent-pipeline/analytics/schemas/convoy-event.json
|
|
#
|
|
# Usage:
|
|
# bash scripts/log-convoy-event.sh role=role-conductor convoy=bookmark-badge \
|
|
# classification=feature 'skip_flags=visual,smoke' duration_s=42 \
|
|
# model=claude-planning model_tier=premium
|
|
#
|
|
# All args are key=value. Required: role, convoy.
|
|
# Optional: brief, classification, skip_flags (comma-separated), duration_s,
|
|
# stack_class, outcome, multitask_group, model, model_tier,
|
|
# estimated_cost_usd.
|
|
#
|
|
# model / model_tier: use registry alias names per docs/adr-model-routing.md.
|
|
#
|
|
# Privacy: this file is gitignored by default; events contain only metadata,
|
|
# no code or prompts.
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
REPO_NAME="$(basename "$REPO_ROOT")"
|
|
METRICS_FILE="$REPO_ROOT/.convoys/.metrics.jsonl"
|
|
mkdir -p "$REPO_ROOT/.convoys"
|
|
|
|
ROLE=""; CONVOY=""; BRIEF=""; CLASSIFICATION=""
|
|
SKIP_FLAGS=""; DURATION_S=""; STACK_CLASS=""; OUTCOME=""; MULTITASK_GROUP=""
|
|
MODEL=""; MODEL_TIER=""; ESTIMATED_COST_USD=""
|
|
|
|
for arg in "$@"; do
|
|
k="${arg%%=*}"
|
|
v="${arg#*=}"
|
|
case "$k" in
|
|
role) ROLE="$v" ;;
|
|
convoy) CONVOY="$v" ;;
|
|
brief) BRIEF="$v" ;;
|
|
classification) CLASSIFICATION="$v" ;;
|
|
skip_flags) SKIP_FLAGS="$v" ;;
|
|
duration_s) DURATION_S="$v" ;;
|
|
stack_class) STACK_CLASS="$v" ;;
|
|
outcome) OUTCOME="$v" ;;
|
|
multitask_group) MULTITASK_GROUP="$v" ;;
|
|
model) MODEL="$v" ;;
|
|
model_tier) MODEL_TIER="$v" ;;
|
|
estimated_cost_usd) ESTIMATED_COST_USD="$v" ;;
|
|
*) echo "log-convoy-event: ignoring unknown arg '$k'" >&2 ;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "$ROLE" ] || [ -z "$CONVOY" ]; then
|
|
echo "log-convoy-event: role and convoy are required" >&2
|
|
echo "Usage: $0 role=<role> convoy=<slug> [classification=...] [skip_flags=a,b] [duration_s=N] [brief=N] [model=...] [model_tier=premium|fast|local|auto] [estimated_cost_usd=N]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
|
|
python3 - <<PY >> "$METRICS_FILE"
|
|
import json, sys
|
|
ev = {
|
|
"ts": "$ts",
|
|
"role": $(printf '%s' "$ROLE" | python3 -c 'import json,sys;print(json.dumps(sys.stdin.read()))'),
|
|
"convoy": $(printf '%s' "$CONVOY" | python3 -c 'import json,sys;print(json.dumps(sys.stdin.read()))'),
|
|
"repo": $(printf '%s' "$REPO_NAME" | python3 -c 'import json,sys;print(json.dumps(sys.stdin.read()))'),
|
|
"skip_flags": [s for s in "$SKIP_FLAGS".split(",") if s],
|
|
}
|
|
if "$BRIEF": ev["brief"] = int("$BRIEF")
|
|
if "$CLASSIFICATION": ev["classification"] = "$CLASSIFICATION"
|
|
if "$DURATION_S": ev["duration_s"] = int("$DURATION_S")
|
|
if "$STACK_CLASS": ev["stack_class"] = "$STACK_CLASS"
|
|
if "$OUTCOME": ev["outcome"] = "$OUTCOME"
|
|
if "$MULTITASK_GROUP": ev["multitask_group"] = "$MULTITASK_GROUP"
|
|
if "$MODEL": ev["model"] = "$MODEL"
|
|
if "$MODEL_TIER": ev["model_tier"] = "$MODEL_TIER"
|
|
if "$ESTIMATED_COST_USD":
|
|
ev["estimated_cost_usd"] = float("$ESTIMATED_COST_USD")
|
|
print(json.dumps(ev))
|
|
PY
|
|
|
|
echo "Logged: role=$ROLE convoy=$CONVOY → .convoys/.metrics.jsonl"
|