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/verdicts.test.ts

View on GitHub
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { readCalls } from './calls.ts';
import type { CallRecord } from './calls.ts';
import type { Trace } from './harvest.ts';
import { commandId, externalVerdicts, verdictRef } from './verdicts.ts';

// Real records copied out of this machine's sessions (paths and ids redacted), kept in their raw nested shape.
const fixtures = JSON.parse(readFileSync(fileURLToPath(new URL('./selftest/fixtures/verdict-traces.json', import.meta.url)), 'utf8')) as Record<string, Trace>;

function call(line: number, command: string, failed: boolean, result: string | null = null): CallRecord {
  return { call_id: `c${line}`, line_start: line - 1, line_end: line, turn: null, tool: 'Bash', target: command.slice(0, 200),
    started_at: null, ended_at: null, failed, failure_kind: failed ? 'exit_nonzero' : null, exit_code: failed ? 1 : null,
    benign_nonzero: false, error_excerpt: failed ? result : null, command_text: command, result_excerpt: result };
}
const brief = (calls: readonly CallRecord[]) => externalVerdicts(calls).map(item => [item.line, item.kind, item.passed]);

test('commandId finds the verdict command behind the wrappers real sessions put in front of it', () => {
  assert.equal(commandId('cd /x && npx vitest run a'), 'vitest');
  assert.equal(commandId('timeout 300 infisical run -- bun test'), 'bun test');
  assert.equal(commandId('S=/tmp; python3 -m pytest -q'), 'pytest');
  assert.equal(commandId('git status && git push origin main'), 'git push');
  assert.equal(commandId('ls -la'), null);
  assert.equal(commandId('infisical run -p app -c dev -- npx vitest run tests/a.test.ts'), 'vitest');
  assert.equal(commandId('env -u HTTPS_PROXY -u HTTP_PROXY timeout 300 npx vitest run a'), 'vitest');
  assert.equal(commandId('./node_modules/.bin/vitest run'), 'vitest');
  assert.equal(commandId('.venv/bin/pytest -q'), 'pytest');
  assert.equal(commandId('uv run python -m pytest test/a.py -q'), 'pytest');
  assert.equal(commandId('bash tests/release.t'), null, 'a .t script is a test only as the command itself');
  assert.equal(commandId('tests/release.t'), 'release.t');
  assert.equal(commandId("rg -n 'foo|bar' src && npm test"), 'npm test', 'a | inside quotes is not a pipe');
  assert.equal(commandId('git add -A && git commit -m x && git push'), 'git push', 'same-family segments merge');
  assert.equal(commandId('pytest a.py && npm run build && pytest b.py'), null, 'two verdict families in one command');
  // A wrapper's own option is dropped, `run test` is a test only for the package managers.
  assert.equal(commandId('npx --yes vitest run a'), 'vitest');
  assert.equal(commandId('npx -y jest'), 'jest');
  assert.equal(commandId('pnpm run test'), 'pnpm run test');
  assert.equal(commandId('cargo run test'), null);
  assert.equal(commandId('sudo -E make'), 'make');
});

test('the four real excerpts yield two, two, zero and zero verdicts', () => {
  const vitest = readCalls(fixtures.claude_vitest);
  assert.ok(vitest.length > 0, 'the instrument sees the Claude Code calls');
  assert.deepEqual(brief(vitest), [[184, 'test', false], [202, 'test', true]]);
  assert.deepEqual(brief(readCalls(fixtures.codex_pytest)), [[710, 'test', false], [720, 'test', true]]);
  assert.deepEqual(brief(readCalls(fixtures.claude_ls)), []);
  // unittest's own zero-count summary, as the real one at a Codex line 1169 printed it, on a pytest call that exited 0.
  assert.deepEqual(brief([call(30, 'python3 -m pytest -q tests/', false, '----------------------------------------------------------------------\nRan 0 tests in 1.117s\n\nOK\n')]), []);
});

test('combined commands: one verdict family per command, and only tests need a summary line', () => {
  assert.deepEqual(brief([call(10, 'git add -A && git commit -m x', false, '[main abc] x\n 1 file changed')]), [[10, 'landed', true]]);
  assert.deepEqual(brief([call(11, 'git commit -m x && git push', false, 'To github.com:a/b.git\n   abc..def  main -> main')]), [[11, 'landed', true]]);
  assert.deepEqual(brief([call(12, 'npm run build && npm test', true, 'src/a.ts(3,1): error TS2322\nnpm ERR! code ELIFECYCLE')]), [],
    'build and test in one command: the failure cannot be attributed');
  assert.deepEqual(brief([call(13, 'pytest -q', true, 'ImportError while loading conftest')]), [[13, 'test', false]],
    'a failed call with a test identity is a failed test verdict even without a summary line');
  assert.deepEqual(brief([call(14, 'pytest -q', false, 'collected 0 items')]), [],
    'a test identity that neither failed nor printed a summary line is no verdict');
  assert.deepEqual(brief([call(19, 'pytest a.py && npm run build && pytest b.py', true, '12 passed in 0.3s\nerror: build failed')]), []);
  assert.deepEqual(brief([call(15, 'cd x && npx vitest run', false, ' Test Files  2 passed (2)\n      Tests  12 passed (12)')]), [[15, 'test', true]]);
  assert.deepEqual(brief([call(16, 'cd x && npx vitest run 2>&1 | tail -5', false, '      Tests  3 failed | 9 passed (12)')]), [[16, 'test', false]],
    'a failing summary line is a failed verdict even when the pipe exited 0');
  assert.deepEqual(brief([call(17, 'pytest -q', false, '\x1b[32m\x1b[1m2 passed\x1b[0m\x1b[32m in 1.27s\x1b[0m')]), [[17, 'test', true]], 'colour codes do not hide the count');
  assert.deepEqual(brief([call(18, 'cd x && tsc --noEmit', false, '')]), [[18, 'typecheck_lint', true]]);
  assert.deepEqual(brief([call(21, 'bun test 2>&1 | tee test.log', false, ' 1 pass\n 1 fail\nRan 2 tests across 1 file. [0.31s]')]), [[21, 'test', false]],
    "bun's own fail line is a failed verdict even when the pipe exited 0");
  assert.deepEqual(brief([call(22, 'bun test', false, ' 2 pass\n 0 fail\nRan 2 tests across 1 file. [0.31s]')]), [[22, 'test', true]]);
});

test('a success lesson may cite a passed test only when no test ran after it', () => {
  const calls = [
    call(20, 'pytest a.py', false, '3 passed in 0.2s'),
    call(40, 'pytest a.py && npm run build', true, '1 failed, 2 passed in 0.2s\nbuild skipped'),
  ];
  const verdicts = externalVerdicts(calls);
  assert.deepEqual(verdicts.map(item => [item.line, item.kind, item.passed]), [[20, 'test', true]], 'the second call carries two families and no verdict');
  const evidence = [{ line_start: 21, line_end: 22 }];
  const refused = verdictRef({ polarity: 'from_success', verdict_line: 20, evidence }, verdicts, calls);
  assert.ok('reason' in refused && /test ran later at line 40/.test(refused.reason), JSON.stringify(refused));
  assert.deepEqual(verdictRef({ polarity: 'from_success', verdict_line: 20, evidence }, verdicts, calls.slice(0, 1)), { ref: { line: 20, kind: 'test', passed: true } });
  // A failure lesson cites a failed test, check or build near its evidence; never a landing, never a far line.
  const failing = [call(100, 'tsc --noEmit', true, 'error TS2322'), call(300, 'git push', true, 'rejected')];
  const failed = externalVerdicts(failing);
  assert.deepEqual(verdictRef({ polarity: 'from_failure', verdict_line: 100, evidence: [{ line_start: 150, line_end: 150 }] }, failed, failing), { ref: { line: 100, kind: 'typecheck_lint', passed: false } });
  assert.match(String((verdictRef({ polarity: 'from_failure', verdict_line: 100, evidence: [{ line_start: 161, line_end: 161 }] }, failed, failing) as { reason: string }).reason), /more than 60 lines/);
  assert.match(String((verdictRef({ polarity: 'from_failure', verdict_line: 300, evidence: [{ line_start: 300, line_end: 300 }] }, failed, failing) as { reason: string }).reason), /landed/);
  assert.match(String((verdictRef({ polarity: 'from_failure', verdict_line: 7, evidence }, failed, failing) as { reason: string }).reason), /names no external verdict/);
});

test('the whole command text identifies a test that the 200-character target cuts off', () => {
  const [long] = readCalls(fixtures.claude_long_prefix);
  assert.ok(long.command_text !== null && long.command_text.indexOf('bun test') > 200, 'the real prefix is longer than the target cut');
  assert.equal(long.target?.length, 200);
  assert.equal(commandId(long.command_text ?? ''), 'bun test');
  assert.equal(commandId(long.target ?? ''), null);
});
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: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated 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: 323kUpdated Claude CodeCodexVerifiedInstall