[object Object]

← back to Ken

Ken v2 follow-the-winners: hourly auto-check, alerts on QUIET->SIGNAL emergence (TK-10166)

74d4a2d85593a9b214ba7dd561f7cdd3a07764a6 · 2026-08-03 08:30:45 -0700 · Steve Abrams

Files touched

Diff

commit 74d4a2d85593a9b214ba7dd561f7cdd3a07764a6
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 3 08:30:45 2026 -0700

    Ken v2 follow-the-winners: hourly auto-check, alerts on QUIET->SIGNAL emergence (TK-10166)
---
 kalshi-dash/follow-the-winners-check.sh | 45 +++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/kalshi-dash/follow-the-winners-check.sh b/kalshi-dash/follow-the-winners-check.sh
new file mode 100755
index 0000000..ca6c760
--- /dev/null
+++ b/kalshi-dash/follow-the-winners-check.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# follow-the-winners-check.sh — hourly auto-check of the Ken v2 "follow the winners"
+# signal (TK-10166). Runs the READ-ONLY signal engine; stays SILENT while the paper sim
+# is rebuilding / no portfolio clears the gate, and alerts (CNCP card + George email)
+# ONLY on the transition QUIET -> SIGNAL (a proven-winner consensus bet actually emerges).
+# Never places an order, never re-arms — surfacing only. Born 2026-08-03.
+set -uo pipefail
+DIR="$HOME/Projects/Ken/kalshi-dash"; DATA="$DIR/data/ftw"; mkdir -p "$DATA"
+LOG="$DATA/run.log"; STATE="$DATA/state.json"; LATEST="$DATA/latest.txt"
+TO="${FTW_TO:-steve@designerwallcoverings.com}"; CNCP="${CNCP_URL:-http://localhost:3333}"
+log(){ echo "[$(date -Iseconds)] $1" | tee -a "$LOG" >&2; }
+
+OUT="$(cd "$DIR" && KEN_DATABASE_URL="postgresql://localhost:5432/ken" node follow-the-winners.mjs 2>&1)"
+echo "$OUT" > "$LATEST"
+
+# a real signal = proven winners AND at least one live-bet row (line starting with BUY_)
+if echo "$OUT" | grep -q "PROVEN WINNERS" && echo "$OUT" | grep -qE "^\s*BUY_"; then
+  NOW="SIGNAL"
+else
+  NOW="QUIET"
+fi
+PREV=$(jq -r '.state // "QUIET"' "$STATE" 2>/dev/null || echo QUIET)
+echo "{\"state\":\"$NOW\",\"ts\":\"$(date -Iseconds)\"}" > "$STATE"
+log "ftw check: $NOW (prev=$PREV)"
+
+# only alert on the emergence QUIET -> SIGNAL
+if [ "$NOW" != "SIGNAL" ] || [ "$PREV" = "SIGNAL" ]; then
+  log "no alert (state=$NOW, prev=$PREV)"; exit 0
+fi
+
+log "⚡ SIGNAL EMERGED — surfacing"
+WINROWS=$(echo "$OUT" | sed -n '/LIVE-BET SIGNAL/,/carry a winner signal/p' | grep -E "^\s*BUY_" | head -8)
+NOTE="[KEN SIGNAL $(date +%H:%M)] follow-the-winners: proven faux-portfolio winners now agree on live bets. Review at http://127.0.0.1:7810 — this is SURFACING ONLY, Ken stays disarmed/paper. Top rows: $(echo "$WINROWS" | tr '\n' ' | ')"
+curl -sS --max-time 10 "$CNCP/api/parking-lot" -H 'Content-Type: application/json' \
+  -d "$(jq -n --arg u "ken://follow-winners" --arg note "$NOTE" '{url:$u,note:$note}')" >/dev/null 2>&1 \
+  && log "CNCP posted" || log "CNCP fail"
+
+if [ -f "$HOME/.claude/skills/_shared/george-send.sh" ]; then
+  . "$HOME/.claude/skills/_shared/george-send.sh"
+  ROWS=$(echo "$WINROWS" | sed 's/&/\&amp;/g;s/</\&lt;/g' | awk 'NF{print "<div style=\"font-family:monospace\">"$0"</div>"}')
+  BODY="<div style=\"font-family:-apple-system,sans-serif\"><h3 style=\"color:#1a7f37\">⚡ Ken signal: the winning faux portfolios agree on a bet</h3><p>The proven-winner portfolios (cleared the win-rate + sample gate) now hold a consensus direction on live markets. <b>Ken is still disarmed/paper — this is a heads-up, not a trade.</b></p>$ROWS<p style=\"color:#666;font-size:13px\">Review at <a href=\"http://127.0.0.1:7810\">the dashboard</a>. To act on it you'd commit the re-arm gate + arm live yourself.</p></div>"
+  RESP="$(george_send steve-office "$TO" "⚡ Ken follow-the-winners signal — $(date +%H:%M)" "$BODY")"
+  echo "$RESP" | grep -q '"success":true' && log "emailed" || log "email failed"
+fi
+log "surfaced ftw signal"

← f60f68f auto-save: 2026-08-03T08:22:05 (1 files) — kalshi-dash/.giti  ·  back to Ken  ·  Ken v2: profit-based ranking — sum(daily_pnl_cents), gate on d137b3b →