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

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
stages2
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 4 criteria · 4 deterministic

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
corpus_function_returns_nonzero
deterministic
Called function returns non-null result. listTranscripts returns array.length > 0. readTranscript returns {id, content, ...}. searchCorpus returns array with matches.
function_executes_no_errors
deterministic
Function completes with exit code 0; stderr empty or warnings-only. No auth/auth_expired or timeout errors.
result_matches_schema
deterministic
listTranscripts returns array of {id, title, date, ...}. readTranscript returns {id, text, speakers, ...}. searchCorpus returns {query, results: [...]}
eval_row_logged
deterministic
state/log/evals.ndjson or state/log/pending-eval.ndjson receives row with skill='corpus', score, item_count.

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/evals.ndjson unknown runs
Every run is written down here, so the next time this skill is used it already knows how the last runs went.
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.
see `state/skills/corpus/SKILL.md` Steps section
auditor None wired yet - eval is manual (Robert review).
2 data
eval log
`state/log/evals.ndjson` (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: corpus_function_returns_nonzero
    kind: deterministic
    check: "Called function returns non-null result. listTranscripts returns array.length > 0. readTranscript returns {id, content, ...}. searchCorpus returns array with matches."
  - name: function_executes_no_errors
    kind: deterministic
    check: "Function completes with exit code 0; stderr empty or warnings-only. No auth/auth_expired or timeout errors."
  - name: result_matches_schema
    kind: deterministic
    check: "listTranscripts returns array of {id, title, date, ...}. readTranscript returns {id, text, speakers, ...}. searchCorpus returns {query, results: [...]}"
  - name: eval_row_logged
    kind: deterministic
    check: "state/log/evals.ndjson or state/log/pending-eval.ndjson receives row with skill='corpus', score, item_count."

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 has not produced hard-won rules. Read state/skills/corpus/SKILL.md before invoking.)_

Commands

|invoke: see state/skills/corpus/SKILL.md Steps section |eval log: state/log/evals.ndjson (skill: "corpus")

Self-Test

An agent reading this should correctly:

  1. [ ] Know which lib/bin artifact backs this skill (or that it is prose-only)
  2. [ ] Know what to write to state/log/evals.ndjson after invoking
  3. [ ] Know the eval mode (auto / shape / manual) from the .md frontmatter

Self-report

If this loader fell short, append a line:

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

<!-- footer-injection-point -->

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, resolve, relative } from "path";
import { execSync, execFileSync } 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[] {
  // Validate year and month parameters to prevent injection
  if (year && !/^\d{4}$/.test(year)) throw new Error("year must be YYYY format");
  if (month && !/^\d{2}$/.test(month)) throw new Error("month must be MM format");

  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: string) => 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 } {
  // Reject absolute paths
  if (path.startsWith("/")) throw new Error("absolute paths not allowed");
  // Resolve and verify path is within CORPUS_ROOT
  const absPath = resolve(CORPUS_ROOT, path);
  const rel = relative(CORPUS_ROOT, absPath);
  if (rel.startsWith("..")) throw new Error("path traversal not allowed");
  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 = execFileSync(
      "grep",
      ["-rni", "--include=*.md", "--", query, CORPUS_ROOT + "/"],
      { encoding: "utf-8", timeout: 30_000 }
    );
    return output
      .split("\n")
      .filter((line) => line.length > 0 && !line.includes(".summary.md"))
      .slice(0, 100)
      .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 no runs actor/auditor: unverifiable
deps krisp

no recent runs logged - the eval contract is declared but nothing has been graded yet