OR Key
drop another .md file to compare - side-by-side diff against corpus

corpus

Keeps a searchable record of everything said in your meetings.
description: "Triggers on prompt mention of 'corpus'."
personal 2 files 10 recent evals

What it does for you

Keeps a searchable record of everything said in your meetings.

What it produces

A recent result, so you can see the kind of work it returns.

loading…

How to get it

These run inside the Snappy workspace. Want this working in your business? I set skills like this up with you, in one focused week.

Work with me
For developers how this skill is built, graded, and how it runs

at a glance- the short version

actorExported functions in state/lib/corpus.ts.
auditorNone wired yet - eval is manual (Robert review).
eval modeshape
categoryKnowledge
stages3
dependskrisp

what's inside - the parts that make up a skill 3/4 present

A skill is just a few plain-text files. Only the main one is required. The rest are optional, added as the work needs them. This is what the skill is made of; how it runs is just below.

The skill
state/skills/corpus/SKILL.md present
the skill itself, in plain text
The main file. It says what the skill is and lays out the steps in plain English.
Code
state/lib/corpus.ts present
code the skill can run
Reusable code this skill can call when it needs to.
Scripts
state/bin/corpus/ not present
helper scripts
Optional. Added when a skill has a few commands to run.
Loader
state/skills/corpus/AGENTS.md present
what the AI loads on the fly
Loaded automatically the moment this skill is needed. Kept short on purpose.

how it's graded - what counts as a good run 3 criteria · 1 deterministic · 2 judge

Each row is one thing a good run has to get right. deterministic means a quick check decides, pass or fail. judge means the AI reads the result and rates it. Grading each piece on its own (instead of one overall score) shows exactly where a run fell short, so the fix is obvious.

name
kind
check
calls_corpus_functions
judge
The execution log indicates calls to at least one of listTranscripts(), readTranscript(), or searchCorpus() from state/lib/corpus.ts.
input_usage
judge
If an input was provided (e.g., listTranscripts_input), the corresponding function in state/lib/corpus.ts was called with it.
logs_pending_eval_row
deterministic
A new row is appended to state/log/pending-eval.ndjson after the skill execution completes.

how it runs - the shared frame every skill uses 5/5 present

Every skill runs the same way. One part does the work, a separate part checks it, and a short loader hands the AI exactly what it needs for the job. Anything this skill doesn't use shows a one-line note saying why, on purpose, not by accident.

makes the work The worker
present
Exported functions in state/lib/corpus.ts. the worker
Does the actual work. Whatever it produces is what gets checked next.
checks the work The reviewer
present
None wired yet - eval is manual (Robert review). the checker
A separate checker grades the work, so the part that made it can't approve its own work.
frame
learns Self-correction
present
fixes itself learns from gaps
When a run hits a gap, the skill gets edited on the spot [FIXED] or queued for a bigger rewrite [LOGGED], so it keeps getting better.
tidies up Background fixes
present
queued for rewrite runs in the background
Bigger fixes that can't be made on the spot get queued and rewritten in the background later.
remembers Run history
present
state/log/pending-eval.ndjson pending runs
Every run is written down here, then reviewed by hand each week.
Critical rules the things this skill must not get wrong
No must-not-break rules called out for this skill. Anything important lives in the writeup below.

what it has learned - fixes written back in over time sample

When a run hits something this skill didn't handle, the fix gets written back into the skill so it doesn't happen again. FIXED means it was corrected on the spot. LOGGED means it's queued for a bigger rewrite. Either way, the skill gets a little better and never makes the same mistake twice.

  1. Loading feedback rows…

how the work flows- who makes it, who checks it

inputs krisp
actor Exported functions in state/lib/corpus.ts.
1 generator
invoke
actor = Exported functions in state/lib/corpus.ts.
import from `state/lib/corpus.ts` — `listTranscripts()`, `readTranscript()`, `searchCorpus()
auditor None wired yet - eval is manual (Robert review).
2 auditor
inspect
auditor = None wired yet - eval is manual (Robert review).
listTranscripts()` returns non-empty before searching/reading
3 data
eval log
`state/log/pending-eval.ndjson` (manual eval — skill: "corpus")

SKILL.md- the skill, written out in plain English

corpus

Krisp transcript corpus operations for all snappy-* skills.

Ported from kernel snappy-corpus in Phase 0.5. See state/lib/corpus.ts for the full API surface.

Steps

  • listTranscripts() - see state/lib/corpus.ts
  • readTranscript() - see state/lib/corpus.ts
  • searchCorpus() - see state/lib/corpus.ts

Eval

Actor: the exported functions in state/lib/corpus.ts. Auditor: none wired yet - eval is manual (Robert review). File a state/log/pending-eval.ndjson row on each run.

Score convention:

OutcomeScore
Pass on first try1.0
Failed first, auto-fix applied, re-check passed0.5
Still failing or unrecoverable0.0

Gotchas

via the Phase 0.5 driver. Only these rewrites were applied: already in state/lib/)

  1. realpathSync(process.argv[1]) CLI guard wrapped in try/catch
  • See the kernel SKILL.md for the original long-form guidance if you need it

(read-only reference at the kernel path above).

Graduation

This skill is prose. Graduate by defining a deterministic auditor and flipping eval: auto.

Rubric

criteria:
  - name: calls_corpus_functions
    kind: judge
    check: "The execution log indicates calls to at least one of listTranscripts(), readTranscript(), or searchCorpus() from state/lib/corpus.ts."
  - name: input_usage
    kind: judge
    check: "If an input was provided (e.g., listTranscripts_input), the corresponding function in state/lib/corpus.ts was called with it."
  - name: logs_pending_eval_row
    kind: deterministic
    check: "A new row is appended to state/log/pending-eval.ndjson after the skill execution completes."

AGENTS.md- what the AI loads when this skill comes up

corpus - loader

Per-turn rules for the corpus skill. Full reference: state/skills/corpus/SKILL.md. Do not skip these.

Critical Rules

_(no failures recorded yet - this skill is a Phase 0.5 prose port from kernel snappy-corpus. No hard-won rules have surfaced yet. Read state/skills/corpus/SKILL.md and state/lib/corpus.ts before invoking.)_

Commands

| ui dashboard | state/skills/corpus/resources/ui.openui | |invoke: import from state/lib/corpus.ts - listTranscripts(), readTranscript(), searchCorpus() |verify: listTranscripts() returns non-empty before searching/reading |eval log: state/log/pending-eval.ndjson (manual eval - skill: "corpus")

OpenUI Resource

  • Skill-owned OpenUI Lang resource: state/skills/corpus/resources/ui.openui. Read it before rendering or editing this skill's generated component surface.
  • Treat this resource as a first-class artifact of the skill, not a generic chat response. Improve it when the skill's user-facing output needs to become richer.
  • System resources compose OpenUI primitives and inherit SnappyChat tokens. Use ui_contract: branded in SKILL.md only for deliberate platform or client visuals.

Known Pitfalls

  • Krisp is the documented MCP exception (program.md don't-list) - the daily cron at state/bin/krisp/refresh.sh is the only path that uses MCP for Krisp; everything else reads the cached state/log/krisp/ dump
  • Transcripts are the substrate for content-mine - don't pre-paraphrase here; readers downstream rely on verbatim text for citation gate

Self-Test

An agent reading this should correctly:

  1. [ ] Read from cached state/log/krisp/ dump, not invoke Krisp MCP directly outside the daily cron
  2. [ ] Return verbatim transcript text, no summary preprocessing
  3. [ ] Log to pending-eval.ndjson

Self-report

If this loader fell short, append a line:

echo "[$(date -u +%FT%TZ)] corpus: <what was missing>" >> state/log/loader-feedback.log

<!-- kernel-ok: historical attribution for the PID-loader pattern. -->

Self-correcting loader (PID feedback)

This is the rule that makes loaders learn. Ported from snappy-kernel, where it demonstrably worked: the snappy-dom-cartographer skill mapped Skool admin UI once, every later ship-agent inherited the full map for free.

Before you finish, do two things:

1. Fix gaps (P - proportional). MANDATORY. If this loader didn't cover your case - if you had to read another file, run an undocumented command, work around a wrong selector, or discover a quirk - you MUST attempt an Edit to this AGENTS.md before you log.

  • Default action: edit this file. Surgical. Add the missing line, table

row, or code example where it belongs. No restructuring.

  • Only LOGGED is allowed when: the fix needs >10 lines, spans multiple

files, or requires a structural rewrite. In that case the state/regen/drain.sh queue picks it up asynchronously.

  • "I didn't have time" / "it's minor" / "the next agent will figure it out"

are NOT valid reasons. Minor gaps compound - that's the whole point of this loop.

  • Concrete example of a valid P-fix: discover agent-browser screenshot

takes path positionally not as --output <path>. One line in a table. Edit it in. Do not just log it.

  • The goal: the next agent never has to leave the loader.

2. Log the result.

echo "[$(date -u +%FT%TZ)] corpus: <what was missing or fixed> [FIXED|LOGGED]" >> state/log/loader-feedback.log
  • FIXED = you patched this loader inline (P-fix).
  • LOGGED = too large for inline; the PostToolUse enqueue + Stop-hook drain

will rewrite the loader from scratch on next session-end.

Do not skip this. Every agent run must leave the system better than it found it. The loader is the setpoint; you are the sensor; the gap is the error signal; closing the gap is the correction.

api.ts- the code it can call

#!/usr/bin/env npx tsx
/**
 * snappy-corpus/api.ts -- Krisp transcript corpus operations for all snappy-* skills.
 *
 * Usage:
 *   npx tsx api.ts list                    # list all transcripts
 *   npx tsx api.ts list 2026 04            # list transcripts for April 2026
 *   npx tsx api.ts read <path> [offset] [limit]  # read transcript in chunks
 *   npx tsx api.ts search <query>          # grep across all transcripts
 *
 * Or import as module:
 *   import { listTranscripts, readTranscript, searchCorpus } from "./corpus.ts";
 */

import { existsSync, readFileSync, realpathSync } from "fs";
import { join } from "path";
import { execSync } from "child_process";
import { env } from "./env.ts";

const CORPUS_ROOT = join(process.env.HOME!, ".claude/corpus/krisp");

/** Lists transcript .md files, optionally filtered by year/month. Excludes .summary.md and .nuggets.json. */
export function listTranscripts(year?: string, month?: string): string[] {
  const pattern = year && month
    ? `${CORPUS_ROOT}/${year}/${month}/*.md`
    : year
    ? `${CORPUS_ROOT}/${year}/**/*.md`
    : `${CORPUS_ROOT}/**/*.md`;

  try {
    const output = execSync(`ls ${pattern} 2>/dev/null || true`, { encoding: "utf-8" });
    return output
      .split("\n")
      .filter((f) => f.endsWith(".md") && !f.endsWith(".summary.md"))
      .sort();
  } catch {
    return [];
  }
}

/** Reads a transcript file in chunks. Default: first 200 lines. */
export function readTranscript(path: string, offset = 0, limit = 200): { lines: string[]; total: number } {
  const absPath = path.startsWith("/") ? path : join(CORPUS_ROOT, path);
  if (!existsSync(absPath)) throw new Error(`Transcript not found: ${absPath}`);
  const content = readFileSync(absPath, "utf-8");
  const allLines = content.split("\n");
  return {
    lines: allLines.slice(offset, offset + limit),
    total: allLines.length,
  };
}

/** Greps across all transcripts for a query string. Returns matching file:line pairs. */
export function searchCorpus(query: string): { file: string; line: number; text: string }[] {
  try {
    const output = execSync(
      `grep -rni ${JSON.stringify(query)} ${CORPUS_ROOT}/ --include="*.md" 2>/dev/null | grep -v '.summary.md' | head -100`,
      { encoding: "utf-8", timeout: 30_000 }
    );
    return output
      .split("\n")
      .filter(Boolean)
      .map((line) => {
        const firstColon = line.indexOf(":");
        const secondColon = line.indexOf(":", firstColon + 1);
        return {
          file: line.slice(0, firstColon),
          line: parseInt(line.slice(firstColon + 1, secondColon), 10) || 0,
          text: line.slice(secondColon + 1).trim(),
        };
      });
  } catch {
    return [];
  }
}

// --- CLI ---

if ((() => { try { return import.meta.url === `file://${realpathSync(process.argv[1])}`; } catch { return false; } })()) {
  (async () => {
    const [, , cmd, ...args] = process.argv;

    switch (cmd) {
      case "list": {
        const [year, month] = args;
        const files = listTranscripts(year, month);
        console.log(`${files.length} transcripts:`);
        for (const f of files) console.log(`  ${f}`);
        break;
      }
      case "read": {
        const [path, offsetStr, limitStr] = args;
        if (!path) { console.error("Usage: api.ts read <path> [offset] [limit]"); process.exit(1); }
        const result = readTranscript(path, parseInt(offsetStr) || 0, parseInt(limitStr) || 200);
        console.log(`Lines ${parseInt(offsetStr) || 0}-${(parseInt(offsetStr) || 0) + result.lines.length} of ${result.total}:`);
        console.log(result.lines.join("\n"));
        break;
      }
      case "search": {
        const query = args.join(" ");
        if (!query) { console.error("Usage: api.ts search <query>"); process.exit(1); }
        const results = searchCorpus(query);
        console.log(`${results.length} matches:`);
        for (const r of results) {
          console.log(`  ${r.file}:${r.line}\t${r.text.slice(0, 120)}`);
        }
        break;
      }
      default:
        console.log("Usage: npx tsx api.ts [list|read|search] ...");
    }
  })();
}

scripts- helper scripts it can run

prose-only skill - 1 inline code block live in SKILL.md above (no state/bin/ sidecar yet).

how we check it- the checks, plus the last 10 runs

rubric shape schema-shape check (no inline rubric)
recent mean 1.00 · 10 runs actor/auditor: unverifiable
deps krisp
timestamp verb score primary_issue artifact
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -
2026-04-21 15:56Z - 1.00 - -
2026-04-21 03:53Z - 1.00 - -
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -
2026-04-21 15:56Z - 1.00 - -
2026-04-21 03:53Z - 1.00 - -
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -