Some checks are pending
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / preflight (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / vps-smoke (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:frustration-matrix,kei-frustration-loop,kei-skill-importer,kei-projects-index,kei-projects-watcher,kei-gdrive-import,kei-leak-matrix,kei-skills,kei-gateway,kei-cron-scheduler,kei-export-trajectories,kei-backend-daytona,kei-d… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-compute-baremetal,kei-compute-vultr,kei-compute-linode,kei-compute-digitalocean,kei-svc-systemd,kei-llm-bridge-mlx name:hosted-sleep-compute]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-diff,kei-scheduler,kei-watch,kei-prune,kei-discover,kei-brain-view,kei-hibernate,kei-ledger-sign,kei-fork name:wave13-15]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-git-gitea,kei-git-forgejo,kei-git-gitlab,kei-git-bitbucket,kei-memory-sled,kei-memory-redis,kei-memory-postgres,kei-memory-sqlite,kei-auth-google,kei-auth-apple,kei-auth-magiclink,kei-auth-webauthn,kei-notify-slack,kei-n… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-ledger,kei-migrate,kei-changelog,kei-memory,kei-store,kei-conflict-scan,kei-refactor-engine,kei-graph-check,kei-shared,kei-dna-index,kei-pet name:core]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-machine-probe,kei-llm-ollama,kei-llm-llamacpp,kei-llm-mlx,kei-llm-router,kei-model name:llm-stack]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-router,kei-sage,kei-task,kei-chat-store,kei-crossdomain,kei-search-core,kei-content-store,kei-social-store,kei-curator,kei-auth,kei-artifact name:mcp-lbm]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:keisei,kei-forge,kei-runtime,kei-runtime-core,kei-atom-discovery,kei-agent-runtime,kei-capability,kei-provision,kei-entity-store,kei-pipe,kei-cache,kei-spawn,kei-replay name:atom-substrate]) (push) Blocked by required conditions
Any Claude Code session can now message any other (not just Agent-Teams teammates), without tmux. Append-only jsonl bus + a UserPromptSubmit hook that pulls unread into each session's context per turn. - scripts/kei-message.sh: `kei message send [--to <name|all>] <text>` / inbox / list / channels. Identity = basename(cwd); broadcast channel "all". - hooks/mailbox-inject.sh: UserPromptSubmit. Injects messages addressed to this session (cwd-basename) or "all", since last turn; per-session cursor dedup; first turn sets baseline (no history dump); never echoes own messages. - bin/kei: `kei message ...` dispatch before splash. - lib-scaffold: copy ALL scripts/*.sh on install (picks up kei-message.sh). - settings-snippet: wire mailbox-inject under UserPromptSubmit. Store: ~/.claude/mailbox/messages.jsonl. Bypass: KEI_MAILBOX_BYPASS=1. Verified: addressed delivery, broadcast, first-turn no-dump, cursor dedup, no self-echo (2-session simulation). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
159 lines
5.3 KiB
Bash
Executable file
159 lines
5.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# kei — KeiSeiKit launcher with TUI splash, then exec claude.
|
|
#
|
|
# Distinct from `keisei` (Rust exobrain CLI: `keisei attach/mount/...`).
|
|
# `kei` is the lightweight splash + launch entry point most users want.
|
|
#
|
|
# Usage:
|
|
# kei # splash → claude (interactive REPL)
|
|
# kei --no-splash # skip splash → exec claude
|
|
# kei --status # status only, don't launch claude
|
|
# kei message ... # inter-session mailbox (send/inbox/list) — see kei-message.sh
|
|
# kei [args...] # splash → claude args... (forwarded verbatim)
|
|
#
|
|
# The splash shows: substrate version, agent count, last sleep run,
|
|
# active sessions (kei-ping). Press any key to skip the dwell.
|
|
#
|
|
# Returns: same exit code as `claude`.
|
|
|
|
set -e
|
|
|
|
# --- subcommand dispatch (before splash) ---------------------------------
|
|
# `kei message ...` → the mailbox CLI; everything else falls through to launch.
|
|
case "${1:-}" in
|
|
message|msg|m)
|
|
shift
|
|
exec "$HOME/.claude/scripts/kei-message.sh" "$@"
|
|
;;
|
|
esac
|
|
|
|
# --- args ----------------------------------------------------------------
|
|
SPLASH=1
|
|
STATUS_ONLY=0
|
|
PASSTHROUGH=()
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--no-splash) SPLASH=0 ;;
|
|
--status) STATUS_ONLY=1; SPLASH=1 ;;
|
|
*) PASSTHROUGH+=("$arg") ;;
|
|
esac
|
|
done
|
|
|
|
# --- locate claude on PATH -----------------------------------------------
|
|
CLAUDE_BIN="$(command -v claude 2>/dev/null || true)"
|
|
if [ -z "$CLAUDE_BIN" ] && [ "$STATUS_ONLY" = "0" ]; then
|
|
echo "error: 'claude' not on PATH. Install Claude Code first:" >&2
|
|
echo " curl -fsSL https://claude.ai/install.sh | sh" >&2
|
|
exit 127
|
|
fi
|
|
|
|
# --- read state ----------------------------------------------------------
|
|
AGENTS_DIR="${HOME}/.claude/agents"
|
|
SYNC_DIR="${HOME}/.claude/memory/sync-repo"
|
|
|
|
# Agent count from generated .md files
|
|
agent_count() {
|
|
local n=0
|
|
if [ -d "$AGENTS_DIR" ]; then
|
|
n=$(find "$AGENTS_DIR" -maxdepth 1 -name "*.md" -not -name "_*" 2>/dev/null | wc -l | tr -d ' ')
|
|
fi
|
|
printf '%s' "$n"
|
|
}
|
|
|
|
# Profile from .installed marker file
|
|
profile_name() {
|
|
local f="${AGENTS_DIR}/_primitives/.installed"
|
|
if [ -f "$f" ]; then
|
|
grep -E "^profile" "$f" 2>/dev/null | head -1 | awk -F= '{gsub(/[ "]/,"",$2); print $2}' || echo "?"
|
|
else
|
|
echo "?"
|
|
fi
|
|
}
|
|
|
|
# Last Phase B sleep timestamp
|
|
last_sleep_run() {
|
|
local f="${SYNC_DIR}/reports/last-run.txt"
|
|
if [ -f "$f" ]; then
|
|
local ts
|
|
ts=$(cat "$f" 2>/dev/null | head -1)
|
|
if [ -n "$ts" ]; then
|
|
# epoch → human; macOS date(1) -r and Linux date(1) -d differ
|
|
if date -r "$ts" '+%Y-%m-%d %H:%M' >/dev/null 2>&1; then
|
|
date -r "$ts" '+%Y-%m-%d %H:%M'
|
|
elif date -d "@$ts" '+%Y-%m-%d %H:%M' >/dev/null 2>&1; then
|
|
date -d "@$ts" '+%Y-%m-%d %H:%M'
|
|
else
|
|
echo "$ts"
|
|
fi
|
|
else
|
|
echo "never"
|
|
fi
|
|
else
|
|
echo "never"
|
|
fi
|
|
}
|
|
|
|
# Active session count via kei-ping (auto-selects redis or sqlite backend)
|
|
active_sessions() {
|
|
if command -v kei-ping >/dev/null 2>&1; then
|
|
kei-ping list 2>/dev/null | grep -cE '^\s*[0-9]+s\s' || echo "0"
|
|
else
|
|
echo "n/a"
|
|
fi
|
|
}
|
|
|
|
# --- splash --------------------------------------------------------------
|
|
splash() {
|
|
local p ac sl as
|
|
p="$(profile_name)"
|
|
ac="$(agent_count)"
|
|
sl="$(last_sleep_run)"
|
|
as="$(active_sessions)"
|
|
|
|
# Only color if stdout is a tty. Brand palette: голубой (sky-blue) + жёлтый (gold).
|
|
local C0= C1= C2= C3= CV=
|
|
if [ -t 1 ]; then
|
|
C0=$'\033[0m'
|
|
C1=$'\033[1;38;5;39m' # голубой (sky-blue) — logo
|
|
C2=$'\033[1;38;5;220m' # жёлтый (gold) — brand line
|
|
C3=$'\033[2;38;5;39m' # dim blue — separators
|
|
CV=$'\033[1;38;5;220m' # жёлтый — field values
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
${C1} ██╗ ██╗███████╗██╗███████╗███████╗██╗${C0}
|
|
${C1} ██║ ██╔╝██╔════╝██║██╔════╝██╔════╝██║${C0}
|
|
${C1} █████╔╝ █████╗ ██║███████╗█████╗ ██║${C0}
|
|
${C1} ██╔═██╗ ██╔══╝ ██║╚════██║██╔══╝ ██║${C0}
|
|
${C1} ██║ ██╗███████╗██║███████║███████╗██║${C0}
|
|
${C1} ╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝╚═╝${C0}
|
|
|
|
${C2} KeiSeiKit · substrate v0.38${C0}
|
|
${C3} ─────────────────────────────────────${C0}
|
|
profile : ${CV}${p}${C0}
|
|
agents : ${CV}${ac}${C0}
|
|
last sleep run : ${CV}${sl}${C0}
|
|
active sessions: ${CV}${as}${C0}
|
|
${C3} ─────────────────────────────────────${C0}
|
|
|
|
EOF
|
|
}
|
|
|
|
# --- main ----------------------------------------------------------------
|
|
if [ "$SPLASH" = "1" ]; then
|
|
splash
|
|
fi
|
|
|
|
if [ "$STATUS_ONLY" = "1" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# Brief dwell so user sees splash before claude takes over the screen.
|
|
# Skipped if stdin not a tty (CI / piped) or if --no-splash.
|
|
if [ "$SPLASH" = "1" ] && [ -t 0 ] && [ -t 1 ]; then
|
|
# Wait up to 0.6s; any keypress aborts immediately.
|
|
read -t 0.6 -n 1 -s _ 2>/dev/null || true
|
|
fi
|
|
|
|
exec "$CLAUDE_BIN" "${PASSTHROUGH[@]}"
|