Files
skill-evolution/scripts/skill-evolution-fetch.sh
T
Carlo1911 18df2fe7b4 skill-evolution: host-agnostic skill self-improvement pipeline
Standalone Python stdlib pipeline that reads an agent's past sessions,
compares them against installed skills, and generates structured
improvement proposals gated by an evaluation framework before anything
mutates. Host-agnostic via HostAdapter (Hermes, Claude Code).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 14:24:33 -05:00

40 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Wrapper the skill-evolution cron job invokes, so the cron entry can stay a single
# stable command. It emits NDJSON on stdout for analyze.py to consume.
#
# Resolves fetch_sessions.py relative to THIS script's own location, because that is
# where it lives (both are in scripts/). Two earlier resolution strategies were wrong:
#
# - Probing a hardcoded skills-home path with a hardcoded fallback: neither path
# exists in this repo's layout, so the wrapper always failed.
# - `if git rev-parse --show-toplevel; then` to find the project root: that command's
# stdout is not captured, so it prepended the repo path as a stray line to the NDJSON
# stream piped into analyze.py.
#
# Nothing here may write to stdout except fetch_sessions.py. Arguments are passed through,
# so --dry-run and --lookback-hours work via the wrapper too.
set -euo pipefail
# Resolve symlinks before taking dirname: a deployed entry point is commonly a symlink
# into this repo, and dirname of the *link* would point at the deploy directory, which
# holds no Python. Loop rather than `readlink -f` for portability across BSD/GNU.
SELF="${BASH_SOURCE[0]}"
while [ -L "$SELF" ]; do
TARGET="$(readlink -- "$SELF")"
case "$TARGET" in
/*) SELF="$TARGET" ;;
*) SELF="$(dirname -- "$SELF")/$TARGET" ;; # relative link
esac
done
SCRIPT_DIR="$(cd -- "$(dirname -- "$SELF")" && pwd)"
FETCH="$SCRIPT_DIR/fetch_sessions.py"
if [ ! -f "$FETCH" ]; then
echo "skill-evolution-fetch.sh: fetch_sessions.py not found next to this script ($SCRIPT_DIR)" >&2
exit 1
fi
exec "${SKILL_EVOLUTION_PYTHON:-python3}" "$FETCH" "$@"