Skip to content

ericrisco/rsc-harness / skills/roast-me

roast-me

Verified

Use when someone wants an honest, comedic audit of their own prompting — reads their past agent transcripts, scores prompt quality and compute efficiency, names their worst habits, builds a model-selection cheat sheet. NOT reviewing code an agent produced (that is `code-review`), NOT prompting technique in general (that is `prompt-engineering`).

FileKindSize
SKILL.mdskill md5.4 KB
evals/README.mdmarkdown3.8 KB
evals/cases.yamlconfig5.7 KB
prompts/analyze.mdmarkdown5.5 KB
prompts/compute.mdmarkdown4.8 KB
prompts/roast.mdmarkdown7.6 KB
tools/adapters/__init__.pyscript36 B
tools/adapters/base.pyscript2.4 KB
tools/adapters/claude.pyscript4.2 KB
tools/adapters/codex.pyscript8.0 KB
tools/adapters/gemini.pyscript5.4 KB
tools/adapters/registry.pyscript2.0 KB
tools/extract_prompts.pyscript20.2 KB

tools/adapters/claude.py

View on GitHub
"""Claude Code adapter — first-class reference implementation.

Session files: ~/.claude/projects/*/*.jsonl
Format: JSON Lines, one object per line.

Each line is a conversation event with a "type" field:
  "user"      — user message (prompt or tool result)
  "assistant" — model response

User prompt records are lines where:
  - type == "user"
  - message.isMeta is falsy
  - message.content contains at least one text block (not only tool_result blocks)

This is the canonical adapter; its parsing logic is the reference for all others.

Confirmed: path and format verified against live ~/.claude/projects structure on
macOS (2026-06). The JSONL schema is stable across Claude Code versions.
"""

from __future__ import annotations

import json
import time
from pathlib import Path
from typing import Any

from .base import BaseAdapter


class ClaudeAdapter(BaseAdapter):
    RUNTIME_ID = "claude"

    # Location of Claude Code project session files.
    PROJECTS_DIR = Path.home() / ".claude" / "projects"

    def discover(self) -> list[Path]:
        """Find all *.jsonl session files under ~/.claude/projects/."""
        if not self.PROJECTS_DIR.exists():
            return []
        files: list[Path] = []
        try:
            for jsonl in self.PROJECTS_DIR.rglob("*.jsonl"):
                try:
                    if jsonl.is_file():
                        files.append(jsonl)
                except OSError:
                    continue
        except OSError:
            return []
        return sorted(files, key=lambda f: f.stat().st_mtime, reverse=True)

    def parse(self, path: Path) -> list[dict[str, Any]]:
        """Parse one Claude Code .jsonl session file."""
        records: list[dict[str, Any]] = []
        try:
            lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
        except OSError:
            return []

        for line in lines:
            line = line.strip()
            if not line:
                continue
            try:
                obj = json.loads(line)
            except json.JSONDecodeError:
                continue

            if obj.get("type") != "user":
                continue

            msg = obj.get("message", {})
            if msg.get("isMeta"):
                continue

            content = msg.get("content", [])
            text = _extract_text(content)
            if not text.strip():
                continue
            # Skip messages that are only tool_result blocks
            if _is_only_tool_results(content):
                continue

            ts = _parse_timestamp(obj)
            records.append({
                "runtime": self.RUNTIME_ID,
                "session_file": str(path),
                "prompt_text": text,
                "timestamp": ts,
                # Forward the raw object so the main extractor can inspect
                # adjacent lines for error/correction context.
                "_raw": obj,
            })

        return records


# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------

def _extract_text(content: Any) -> str:
    if isinstance(content, str):
        return content
    if isinstance(content, list):
        parts = []
        for block in content:
            if isinstance(block, dict) and block.get("type") == "text":
                parts.append(block.get("text", ""))
        return "\n".join(parts)
    return ""


def _is_only_tool_results(content: Any) -> bool:
    if not isinstance(content, list):
        return False
    has_text = any(
        isinstance(b, dict) and b.get("type") == "text" for b in content
    )
    has_tool_result = any(
        isinstance(b, dict) and b.get("type") == "tool_result" for b in content
    )
    return has_tool_result and not has_text


def _parse_timestamp(obj: dict) -> float | None:
    ts = obj.get("timestamp")
    if ts is None:
        return None
    if isinstance(ts, (int, float)):
        return float(ts)
    if isinstance(ts, str):
        try:
            import datetime
            dt = datetime.datetime.fromisoformat(ts.replace("Z", "+00:00"))
            return dt.timestamp()
        except (ValueError, AttributeError):
            pass
    return None
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall