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/ledger.ts
View on GitHubimport { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { reflectionFiles, readingLimits, isObject } from './config.ts';
import { appendRows } from './lessons.ts';
// The append-only skill-impact ledger. Code writes every row; cloud replies have no direct write path.
export interface ProposalRow {
type: 'proposal';
run_id: string;
half: string;
backend: string;
kind: 'create' | 'patch' | 'no_action';
target: string | null;
region: 'body' | 'reminders' | null;
diff: string;
expertise: Record<string, unknown>;
purpose: { summary: string; page_ids: string[] };
verdict: 'pending' | 'logged';
evidence: string[];
}
export function readLedger(store: string): Record<string, unknown>[] {
const path = join(store, reflectionFiles.ledger);
if (!existsSync(path)) return [];
return readFileSync(path, 'utf8').split('\n').filter(Boolean).map(line => {
const value: unknown = JSON.parse(line);
if (!isObject(value)) throw new Error('skill-impact.jsonl: a row is not an object');
return value;
});
}
export function appendLedger(store: string, row: Record<string, unknown>): void {
appendRows(join(store, reflectionFiles.ledger), [row]);
}
// The proposal validator reads recent rows and rejected proposals to refuse an identical repeat.
export interface ProposerLedger { recent: Record<string, unknown>[]; rejected: Record<string, unknown>[] }
export function proposerLedger(store: string): ProposerLedger {
const rows = readLedger(store);
const rejected = rows.filter(row => row.verdict === 'Rejected');
return { recent: rows.slice(-readingLimits.ledgerRows), rejected };
}
// A coarse unified diff between the current file and the proposed content. The ledger needs a
// human-readable record of the change; adoption applies the real bytes.
export function unifiedDiff(before: string, after: string, path: string): string {
if (before === after) return '';
const a = before.length ? before.split('\n') : [];
const b = after.length ? after.split('\n') : [];
const head = `--- a/${path}\n+++ b/${path}\n`;
return head + a.map(line => `-${line}`).concat(b.map(line => `+${line}`)).join('\n') + '\n';
}
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 |