Skip to content

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

rem-reflect

Unverified

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/pages.ts

View on GitHub
import { reflectionFiles, isObject } from './config.ts';
import { message } from './text.ts';
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import type { Evidence } from './evidence.ts';
import type { Trace } from './harvest.ts';
import type { Harness } from './identity.ts';
import type { Outcome } from './labeler.ts';
import { atomicWrite } from './store.ts';

export interface Scenario { task_type: string; trigger: string; tools: string[] }
export type CounterExamples = 'not searched' | { searched: boolean; [key: string]: unknown };
export interface Operation { op: 'append' | 'replace' | 'insert_after'; target?: string; text: string }
export interface PageFields {
  summary: string; class: 'SKILL_DEFECT' | 'EXECUTION_LAPSE';
  root_cause: { subject: string; relation: string; fact: string; valid_at: string; evidence_pages: string[]; evidence_traces: string[] };
  fix: string; scenario: Scenario; skills_used: string[]; skill_target: string | null; knowledge_used: string[];
  outcome: Outcome; agent_id: Harness; project_id: string; user_id: string; evidence: string[];
  citations: Evidence[]; counter_examples: CounterExamples; superseded: boolean;
  possible_duplicate_of?: string | null; solved_by?: string | null;
}
export interface Page extends PageFields { page_id: string; body: string; count: number; task_ids: string[]; last_seen: string; skills_observed: string[]; backend?: string; judgment_id?: string }
export function patchBody(body: string, ops: readonly Operation[], isNew: boolean = false): string {
  for (const operation of ops) {
    if (operation.op === 'append') { body += operation.text; continue; }
    if (isNew) throw new Error(message('newAppend'));
    const target = operation.target;
    if (!target || !body.includes(target)) throw new Error(message('patchSubstring'));
    const index = body.indexOf(target);
    const replacement = operation.op === 'insert_after' ? target + operation.text : operation.text;
    body = body.slice(0, index) + replacement + body.slice(index + target.length);
  }
  return body;
}

// JSON values on individual YAML fields form the store's canonical frontmatter format.
export function serializePage(page: Page): string {
  const { body, ...fields } = page;
  return `---\n${Object.entries(fields).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join('\n')}\n---\n${body}`;
}
export function parsePage(text: string): Page {
  const match = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/.exec(text);
  if (!match) throw new Error(message('frontmatterMissing'));
  const fields: Record<string, unknown> = {};
  for (const line of match[1].split('\n')) {
    const separator = line.indexOf(': ');
    if (separator < 0) throw new Error(message('frontmatterInvalid'));
    fields[line.slice(0, separator)] = JSON.parse(line.slice(separator + 2));
  }
  if (typeof fields.page_id !== 'string' || typeof fields.summary !== 'string' || !Array.isArray(fields.citations)
    || !isObject(fields.root_cause) || typeof fields.root_cause.fact !== 'string' || typeof fields.count !== 'number'
    || typeof fields.last_seen !== 'string') throw new Error(message('storedPageInvalid'));
  return { ...fields, body: match[2] } as unknown as Page;
}
export function readPages(store: string): Page[] {
  const directory = join(store, reflectionFiles.pages);
  if (!existsSync(directory)) return [];
  return readdirSync(directory).filter(file => file.endsWith('.md')).sort().map(file => {
    const page = parsePage(readFileSync(join(directory, file), 'utf8'));
    if (`${page.page_id}.md` !== file) throw new Error(message('pageFilename'));
    return page;
  });
}
export function writePage(store: string, page: Page): void {
  if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(page.page_id)) throw new Error(message('pageIdInvalid'));
  atomicWrite(join(store, reflectionFiles.pages, `${page.page_id}.md`), serializePage(page));
}
export function citedTraces(page: Pick<Page, 'citations'>, traces: readonly Trace[]): Trace[] {
  const ids = new Set(page.citations.map(item => item.trace_id));
  return traces.filter(trace => ids.has(trace.trace_id));
}
export function renderIndex(pages: readonly Page[], traces: readonly Trace[]): string {
  return pages.map(page => {
    const skills = new Map<string, number>();
    for (const trace of citedTraces(page, traces)) for (const skill of trace.skills_loaded) skills.set(skill, (skills.get(skill) ?? 0) + 1);
    const top = [...skills].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).slice(0, 3).map(([skill]) => skill);
    return message('indexLine', { id: page.page_id, summary: page.summary, count: page.count, seen: page.last_seen,
      solved: page.solved_by ? message('solvedBy', { unit: page.solved_by }) : message('unsolved'), skills: top.join(', ') || message('none') });
  }).join('\n') + (pages.length ? '\n' : '');
}
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 CodeCodexUnverifiedInstall
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