Skip to content

sno-ai/sno-station-skills / skills/R-recursive-self-improvement/rem-reflect/skill

rem-reflect

Verified

Self Learning from this machine's Claude Code, Codex, Hermes, OpenClaw and Cursor sessions. Decide skill changes and lessons with accept/reject/tbd; recall lessons at session start.

FileKindSize
SKILL.mdskill md14.1 KB
references/labeler.mdmarkdown1.2 KB
references/labeler.schema.jsonconfig1.7 KB
references/local-settings.jsonconfig126 B
references/local-writer.schema.jsonconfig2.3 KB
references/proposal.schema.jsonconfig3.2 KB
references/render.jsonconfig245 B
references/signals.jsonconfig71 B
references/text.jsonconfig4.0 KB
scripts/adopt.test.tsscript13.0 KB
scripts/adopt.tsscript14.3 KB
scripts/agent-sessions.tsscript9.1 KB
scripts/allowance-fallback.test.tsscript16.0 KB
scripts/allowance-request-isolation.test.tsscript7.1 KB
scripts/backend.tsscript9.1 KB
scripts/calls.tsscript8.6 KB
scripts/catalogue-cloud.test.tsscript1.5 KB
scripts/catalogue.tsscript3.2 KB
scripts/chunk.tsscript2.1 KB
scripts/cloud-apply.test.tsscript25.2 KB
scripts/cloud-batch.test.tsscript11.2 KB
scripts/cloud-day.test.tsscript6.8 KB
scripts/cloud-verdict.test.tsscript12.1 KB
scripts/cloud-wait.test.tsscript1.3 KB
scripts/cloud.tsscript24.4 KB
scripts/config.tsscript8.1 KB
scripts/cursor.test.tsscript16.1 KB
scripts/cursor.tsscript6.7 KB
scripts/evidence.tsscript1.5 KB
scripts/first-message.test.tsscript10.3 KB
scripts/harvest.test.tsscript16.5 KB
scripts/harvest.tsscript22.6 KB
scripts/hermes-openclaw.test.tsscript25.6 KB
scripts/identity.test.tsscript3.3 KB
scripts/identity.tsscript3.5 KB
scripts/installed-roots.test.tsscript11.0 KB
scripts/journey-adopt-lesson.test.tsscript4.1 KB
scripts/journey-ops.test.tsscript8.0 KB
scripts/labeler.test.tsscript3.6 KB
scripts/labeler.tsscript9.5 KB
scripts/ledger.tsscript2.1 KB
scripts/lessons.tsscript4.7 KB
scripts/local-filter.test.tsscript3.9 KB
scripts/local-first-output.test.tsscript23.5 KB
scripts/local-settings.tsscript1.4 KB
scripts/local-writer.tsscript12.7 KB
scripts/login-in-place.test.tsscript5.8 KB
scripts/model-json.tsscript4.1 KB
scripts/no-network.test.tsscript5.0 KB
scripts/observe.tsscript1.4 KB
scripts/page-journey.test.tsscript6.7 KB
scripts/pages.test.tsscript4.1 KB
scripts/pages.tsscript4.8 KB
scripts/proposer-loop.test.tsscript1.5 KB
scripts/proposer-validate.test.tsscript9.1 KB
scripts/proposer.tsscript8.7 KB
scripts/recall-hook.test.tsscript20.9 KB
scripts/recall.test.tsscript31.4 KB
scripts/recall.tsscript18.2 KB
scripts/reflect.test.tsscript9.3 KB
scripts/reflect.tsscript14.3 KB
scripts/rem-reflectexecutablescript823 B
scripts/rem-reflect.tsscript17.8 KB
scripts/render-chunk.test.tsscript7.2 KB
scripts/render.tsscript9.7 KB
scripts/report.tsscript8.2 KB
scripts/run-status.test.tsscript19.1 KB
scripts/sampling.test.tsscript2.1 KB
scripts/sampling.tsscript915 B
scripts/selftest-guard.test.tsscript4.2 KB
scripts/selftest/bin/claudeexecutablescript94 B
scripts/selftest/bin/codexexecutablescript93 B
scripts/selftest/bin/shim-core.cjsscript4.6 KB
scripts/selftest/bin/snoexecutablescript5.7 KB
scripts/selftest/fixtures/hermes-session-export.jsonlother1.5 KB
scripts/selftest/fixtures/openclaw-events.jsonlother3.7 KB
scripts/selftest/fixtures/verdict-traces.jsonconfig16.6 KB
scripts/selftest/journey-e2e.shexecutablescript1.4 KB
scripts/selftest/journey.mjsscript9.5 KB
scripts/selftest/observe-journey.mjsscript12.5 KB
scripts/selftest/run-selftest.shexecutablescript7.0 KB
scripts/selftest/spawn-python.mjsexecutablescript765 B
scripts/session.test.tsscript5.2 KB
scripts/session.tsscript251 B
scripts/signal-local.test.tsscript7.0 KB
scripts/skill-impact.test.tsscript6.2 KB
scripts/station-settings.test.tsscript13.6 KB
scripts/store-memory.test.tsscript3.4 KB
scripts/store.tsscript7.7 KB
scripts/test-helpers.tsscript15.3 KB
scripts/text.tsscript760 B
scripts/trigger.test.tsscript3.6 KB
scripts/trigger.tsscript2.5 KB
scripts/verdicts.test.tsscript8.1 KB
scripts/verdicts.tsscript8.0 KB

scripts/selftest/run-selftest.sh

View on GitHub
#!/usr/bin/env bash
# The rem-reflect self-test runs the unit suite, then the full fixture journey
# under a PATH that holds only an allowlist of programs — node, git, a named set of coreutils, and the
# fixture claude / codex / sno shims — each a recording wrapper, so every child process exec is
# logged. It asserts the recorded exec list names no program outside the allowlist, and that a program
# spawning python3 (outside the allowlist) fails naming it. It finishes well under 300 seconds.
set -Eeuo pipefail

START=$(date +%s)
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPTS="$(dirname "$HERE")"
BIN_SRC="$HERE/bin"

fail() { printf 'run-selftest: FAIL: %s\n' "$1" >&2; exit 1; }

# On the home disk, not the system temp directory, which may be a RAM disk shared with other work.
mkdir -p "$HOME/.cache/rem-reflect-tests"
WORK="$(mktemp -d "$HOME/.cache/rem-reflect-tests/selftest.XXXXXX")"
trap 'rm -rf -- "$WORK"' EXIT
ALLOW_BIN="$WORK/bin"
mkdir -p "$ALLOW_BIN"
EXEC_LOG="$WORK/exec.log"
: > "$EXEC_LOG"

# The allowlist of real programs the journey may reach. Each becomes a recording wrapper that logs its
# own name to EXEC_LOG and then execs the real binary (resolved now, while the normal PATH still holds).
ALLOW_PROGRAMS=(node git sh bash env cat uname dirname basename mkdir rm cp mv ln chmod mktemp date sort grep sed head tail wc tr cut readlink)
# The wrapper shebang must be the real bash by absolute path: under the allowlist-only PATH a
# `#!/usr/bin/env bash` wrapper would re-resolve `bash` to the wrapper itself and recurse.
REAL_BASH="$(command -v bash)"
[[ -n "$REAL_BASH" ]] || fail "bash not found"
for prog in "${ALLOW_PROGRAMS[@]}"; do
  real="$(command -v "$prog" || true)"
  [[ -n "$real" ]] || continue
  { printf '#!%s\n' "$REAL_BASH"
    printf 'printf "%%s\\n" %q >> %q\n' "$prog" "$EXEC_LOG"
    printf 'exec %q "$@"\n' "$real"
  } > "$ALLOW_BIN/$prog"
  chmod +x "$ALLOW_BIN/$prog"
done
# The fixture CLIs: the real shims, which self-record to EXEC_LOG. They need shim-core.cjs beside them.
for shim in claude codex sno; do
  cp -- "$BIN_SRC/$shim" "$ALLOW_BIN/$shim"
  chmod +x "$ALLOW_BIN/$shim"
done
cp -- "$BIN_SRC/shim-core.cjs" "$ALLOW_BIN/shim-core.cjs"

# The set of names allowed to appear in the exec log (the wrappers plus the three shims).
declare -A ALLOWED=()
for prog in "${ALLOW_PROGRAMS[@]}" claude codex sno; do ALLOWED["$prog"]=1; done

# The unit suite runs under the normal environment because it exercises tools outside the journey's allowlist.
printf 'run-selftest: unit suite...\n'
# Its log is kept so a failure names the failing tests and every skipped test is shown, not hidden.
UNIT_LOG="$WORK/unit.log"
( cd "$SCRIPTS" && node --test --test-reporter=spec --experimental-strip-types ) >"$UNIT_LOG" 2>&1 \
  || { sed -n '/failing tests:/,$p' "$UNIT_LOG" >&2; fail "the unit suite did not pass"; }
sed -n 's/^﹣ \(.*\) ([0-9.]*ms) # \(.*\)$/run-selftest: SKIP unit test: \1 (\2)/p' "$UNIT_LOG"

# Parse an strace `-e trace=execve` log into the basenames of every program actually exec'd. This
# captures every child exec, including one launched by an absolute path that bypasses PATH.
execd_basenames() {
  sed -n 's/^[0-9 ]*execve("\([^"]*\)".*/\1/p' "$1" | while read -r p; do basename -- "$p"; done | sort -u
}

# The full fixture journey runs under the allowlist-only PATH. When available, strace records
# absolute-path child processes too. REM_SELFTEST keeps the driver from re-adding ambient PATH.
printf 'run-selftest: fixture journey under the allowlist PATH...\n'
EXECVE_LOG="$WORK/execve.log"
if [[ "$(uname -s)" == Linux ]] && command -v strace >/dev/null 2>&1; then
  journey_out="$(strace -f -e trace=execve -o "$EXECVE_LOG" \
    env PATH="$ALLOW_BIN" EXEC_LOG="$EXEC_LOG" REM_SELFTEST=1 \
    node --experimental-strip-types "$HERE/journey.mjs" isolated 2>&1)" \
    || { printf '%s\n' "$journey_out" >&2; fail "the fixture journey did not pass under the allowlist PATH"; }
  [[ -s "$EXECVE_LOG" ]] || fail "strace recorded no execve (the instrument did not run)"
else
  journey_out="$(env PATH="$ALLOW_BIN" EXEC_LOG="$EXEC_LOG" REM_SELFTEST=1 \
    node --experimental-strip-types "$HERE/journey.mjs" isolated 2>&1)" \
    || { printf '%s\n' "$journey_out" >&2; fail "the fixture journey did not pass under the allowlist PATH"; }
  printf 'run-selftest: SKIP (Linux only): socket and absolute-path exec traces need strace\n'
fi
grep -q 'JOURNEY OK isolated' <<<"$journey_out" || { printf '%s\n' "$journey_out" >&2; fail "the journey did not report success"; }

# 3. Every program actually exec'd (from the execve trace) is within the allowlist; the shims also
#    self-recorded to EXEC_LOG (recorded by the shims).
[[ -s "$EXEC_LOG" ]] || fail "the shims recorded no exec (the instrument did not run)"
if [[ -s "$EXECVE_LOG" ]]; then
  mapfile -t RAN < <(execd_basenames "$EXECVE_LOG")
else
  mapfile -t RAN < <(sort -u "$EXEC_LOG")
fi
for prog in "${RAN[@]}"; do
  [[ -n "${ALLOWED[$prog]:-}" ]] || fail "a program outside the allowlist was executed: $prog"
done
printf 'run-selftest: %s distinct programs exec'\''d, all within the allowlist\n' "${#RAN[@]}"

# 4a. Negative control by name: a program that spawns python3 by name fails under the allowlist, naming it.
printf 'run-selftest: python3 negative control (by name)...\n'
if neg_out="$(PATH="$ALLOW_BIN" EXEC_LOG="$EXEC_LOG" REM_SELFTEST=1 \
  node --experimental-strip-types "$HERE/spawn-python.mjs" 2>&1)"; then
  fail "a program spawning python3 by name was allowed to succeed under the allowlist"
fi
grep -q 'python3' <<<"$neg_out" || fail "the python3 failure did not name python3"

# 4b. Negative control by absolute path: python3 launched by absolute path bypasses the PATH allowlist
#     and runs, but the execve recorder must still catch it, proving the allowlist check has no blind spot.
PY_ABS="$(command -v python3 || true)"
if [[ -n "$PY_ABS" && -s "$EXECVE_LOG" ]]; then
  printf 'run-selftest: python3 negative control (absolute path bypass)...\n'
  BYPASS_LOG="$WORK/bypass.log"
  strace -f -e trace=execve -o "$BYPASS_LOG" \
    env PATH="$ALLOW_BIN" PY_ABS="$PY_ABS" REM_SELFTEST=1 \
    node --experimental-strip-types "$HERE/spawn-python.mjs" >/dev/null 2>&1 || true
  execd_basenames "$BYPASS_LOG" | grep -qx 'python3' \
    || fail "the execve recorder failed to catch an absolute-path python3 (allowlist check has a blind spot)"
else
  printf 'run-selftest: SKIP (Linux only): python3 negative control by absolute path needs python3 and the strace execve log\n'
fi

# The usage-statistics rows go through the real CLI, first with the recording `sno` shim and
#    then with no `sno` on PATH at all (the journey builds both PATHs itself).
printf 'run-selftest: observe rows journey...\n'
observe_out="$(node --experimental-strip-types "$HERE/observe-journey.mjs" 2>&1)" \
  || { printf '%s\n' "$observe_out" >&2; fail "the observe rows journey did not pass"; }

ELAPSED=$(( $(date +%s) - START ))
(( ELAPSED < 300 )) || fail "the self-test took ${ELAPSED}s, over the 300s budget"
printf 'Self-test OK: unit suite passed, journey passed under the allowlist (%ss), python3 was refused by name\n' "$ELAPSED"
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall