disinto/exec/exec-briefing.sh
disinto-exec c3acce7f8f refactor: cherry-pick improvements from dev-agent's PR #700
Two wins from the dev-agent's implementation:

1. exec-briefing.sh: rewritten to just call exec-inject.sh with a
   briefing prompt (57 lines, down from 154). No more duplicated
   compass/character/context loading.

2. exec-inject.sh: response capture now uses agent_wait_for_claude_ready
   + pane line diff instead of custom EXEC-RESPONSE-START/END markers.
   Claude just responds naturally — no special output format needed.

Also: matrix listener uses nohup for robustness and validates TOML
path before passing to exec-inject.sh.
2026-03-25 16:15:10 +00:00

57 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
# =============================================================================
# exec-briefing.sh — Daily morning briefing via the executive assistant
#
# Cron entry: 0 7 * * * /path/to/disinto/exec/exec-briefing.sh [project.toml]
#
# Sends a briefing prompt to exec-inject.sh, which handles session management,
# response capture, and Matrix posting. No duplication of compass/context logic.
# =============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FACTORY_ROOT="$(dirname "$SCRIPT_DIR")"
export PROJECT_TOML="${1:-$FACTORY_ROOT/projects/disinto.toml}"
# shellcheck source=../lib/env.sh
source "$FACTORY_ROOT/lib/env.sh"
# shellcheck source=../lib/guard.sh
source "$FACTORY_ROOT/lib/guard.sh"
LOG_FILE="$SCRIPT_DIR/exec.log"
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; }
# ── Guards ────────────────────────────────────────────────────────────────
check_active exec
# Memory guard
AVAIL_MB=$(free -m 2>/dev/null | awk '/Mem:/{print $7}' || echo 9999)
if [ "${AVAIL_MB:-0}" -lt 2000 ]; then
log "SKIP: low memory (${AVAIL_MB}MB available)"
exit 0
fi
log "--- Exec briefing start ---"
BRIEFING_PROMPT="Daily briefing request (automated, $(date -u '+%Y-%m-%d')):
Produce a concise morning briefing covering:
1. Pipeline status — blocked issues, failing CI, stale PRs?
2. Recent activity — what merged/closed in the last 24h?
3. Backlog health — depth, underspecified issues?
4. Predictions — any unreviewed from the predictor?
5. Concerns — anything needing human attention today?
Check the forge API, git log, agent journals, and issue tracker.
Under 500 words. Lead with what needs action."
bash "$SCRIPT_DIR/exec-inject.sh" \
"briefing-cron" \
"$BRIEFING_PROMPT" \
"" \
"$PROJECT_TOML" || {
log "briefing injection failed"
exit 1
}
log "--- Exec briefing done ---"