sno-ai/sno-station-skills / skills/R-recursive-self-improvement/rem-reflect/skill
rem-reflect
VerifiedSelf 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.
scripts/sampling.test.ts
View on GitHubimport { test } from 'node:test';
import assert from 'node:assert/strict';
import { eligibleTraces } from './sampling.ts';
import type { Trace } from './harvest.ts';
import type { Harness } from './identity.ts';
const DAY = 86_400_000;
const NOW = Date.parse('2026-09-21T12:00:00Z');
function trace(half: Harness, session: string, version: number, ageDays: number, trivial = false): Trace {
return {
user_id: 'u', project_id: 'p', agent_id: half, source_harness: half, originator: half,
trace_id: `${session}.v${version}`, session_id: session, version,
source_path: `/x/${session}`, source_line_range: [1, 2], source_mtime: NOW - ageDays * DAY,
records: [], skipped_records: 0, skipped_blocks: 0, redactions: 0,
trivial, skills_loaded: [],
};
}
test('the local pool retains every newest recent version, including trivial sessions, without a sample limit', () => {
const older = trace('codex', 'resumed', 1, 2);
const latest = trace('codex', 'resumed', 2, 1);
const many = Array.from({ length: 12 }, (_, index) => trace('codex', `codex-${index}`, 1, 1, true));
const claude = trace('claude-code', 'claude', 1, 0.5);
const pool = eligibleTraces([older, latest, ...many, claude], NOW);
assert.deepEqual(pool.halves.codex.map(row => row.trace_id), [latest.trace_id, ...many.map(row => row.trace_id)]);
assert.deepEqual(pool.halves['claude-code'].map(row => row.trace_id), [claude.trace_id]);
assert.deepEqual(pool.superseded.map(row => row.trace_id), [older.trace_id]);
assert.deepEqual(pool.expired, []);
});
test('an expired newest version closes the session; an exactly three-day-old trace is expired', () => {
const old = trace('codex', 'expired', 2, 3);
const prior = trace('codex', 'expired', 1, 4);
const recent = trace('claude-code', 'recent', 1, 2.99);
const pool = eligibleTraces([prior, recent, old], NOW);
assert.deepEqual(pool.halves.codex, []);
assert.deepEqual(pool.halves['claude-code'].map(row => row.trace_id), [recent.trace_id]);
assert.deepEqual(pool.expired.map(row => row.trace_id), [old.trace_id]);
assert.deepEqual(pool.superseded.map(row => row.trace_id), [prior.trace_id]);
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 472k | Updated | Claude CodeCodex | Unverified | Install |
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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 available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |