diff --git a/.claude/skills/newroaster/SKILL.md b/.claude/skills/newroaster/SKILL.md new file mode 100644 index 0000000..bf740fa --- /dev/null +++ b/.claude/skills/newroaster/SKILL.md @@ -0,0 +1,157 @@ +--- +name: newroaster +description: Use when someone wants to add a new advisor to the Roast Room, says "/newroaster", "add a roaster", "add a seat", "add [name] to the council", "build a seat for [name]", "I want [name] on my board", or wants their own advisor (themselves, a mentor, or any public figure) built from public work. Builds the seat the same way the original seven were built. It finds and fetches the person's public sources, extracts their frameworks, rules, positions, stories, and voice with parallel sub-agents, writes the brain, checks every quote is verbatim, writes the council agent, and registers the seat in the roster (on the default board if asked). Not for running a council (that is /roast-room). +argument-hint: "[full name] [--quick | --deep] [--pillar \"...\"] [--default]" +--- + +## What this does + +Adds one seat to the Roast Room. A seat is three things, and this skill makes all three: + +1. **A brain**: `.claude/skills/roast-room/brains//`, eight files compiled from the person's public work, every quote verbatim with a source id. +2. **An agent**: `.claude/agents/council-.md`, the sub-agent that reasons and talks like them from that brain. +3. **A roster entry**: one line in `.claude/skills/roast-room/roster.json`, so `/roast-room` and the room know the seat exists. + +The raw sources stay in a local build folder that git ignores. Only the brain ships. + +Build folder: `build//` at the project root. + +Read before the first run: `references/brain-spec.md` (the brain layout and its rules), `references/extract-prompt.md` (what each extraction agent gets), `references/agent-template.md` (the seat agent). + +## Who can be a roaster + +- **Public figures with a real body of public work**: essays, letters, books as they teach them in talks, long interviews where they are the main speaker, keynotes, their own channel or podcast. Living or historical. +- **The user, or someone who gave consent**: built from material the user provides (their posts, transcripts, notes). Use `--add` in step 3. +- **Not**: fictional characters, private people without their consent, or anyone whose public work is too thin. Under about 15 usable sources or 60,000 words, say so and offer `--quick` with a warning, or a different person. + +The seat is a simulation, not the person. The agent says so if asked, and only quotes what is in its brain. + +## Depth + +| Flag | Sources | Words | Extraction agents | Use it for | +|---|---|---|---|---| +| `--quick` | 12 to 20 | 80k+ | 2 to 3 | Trying someone out | +| default | 30 to 50 | 250k+ | 4 to 6 | A seat you will actually use | +| `--deep` | 80+ | 500k+ | 8 to 12, in waves | Matching the original seven | + +Quality beats count: one 90-minute keynote is worth ten 6-minute clips. + +## Step 1: Who and what seat + +From the user's message, get the person's full name. If anything below is missing, ask in one AskUserQuestion batch (at most four questions), offering your best guess as the first option: + +1. **The pillar and the question the seat owns.** Propose one from what the person is known for, worded like the existing seats in `roster.json` (pillar: a few words; question: one plain question a founder would face). If an existing seat already owns that pillar, propose a sharper angle so the two seats argue instead of repeating each other. +2. **Default board?** Put them at the table for every council, or keep them on call (`--seats` and `ask`). If the default board already has nine seats, ask who they replace. +3. **Depth**: quick, standard, or deep (default standard). + +Then fix the names: `key` (short lowercase, letters only, unique in the roster, usually the surname: `naval`, `drucker`), `slug` (`first-last`), `short` (how the room names them: "Naval"), and the scorecard `dimension` (a few words for what this seat scores, like "Leverage and long-term wealth"). + +Check the roster first: if the person already has a seat, stop and offer to refresh it instead (step 3 onward on the same slug; fetch skips sources already in `sources.json`). + +## Step 2: Find sources + +Use WebSearch to build a source list, best first. Look for: + +- Their own site, blog, essays, newsletter archive, or letters (the richest text, with dates). +- Long talks and keynotes where they are the speaker. +- Long interviews and podcasts where they are the main guest (their own podcast counts). +- Their books as they teach them in public: author talks, interviews about the book, chapters they posted free. Never fetch pirated or paywalled book text. +- Recent material (last two years) so `positions.md` reflects current views, and a spread of years so changes of mind show up. + +Skip clips under about 10 minutes, fan compilations, reaction videos, and pieces where someone else does most of the talking. Write the URLs to `/urls.txt`, one per line, with a `# heading` line per group. Aim for the source count of the chosen depth plus about 20 percent, since some will fail. + +## Step 3: Fetch + +```bash +node .claude/skills/newroaster/scripts/fetch.mjs --list /urls.txt +``` + +Each source becomes `/corpus/S001-.md`, logged in `<build>/sources.json`. It prints `ok`, `skip`, `thin` (paywall or a JavaScript page), or `fail` per URL, then a manifest. YouTube uses yt-dlp when installed, otherwise YouTube's own captions. For local material the user gave you: + +```bash +node .claude/skills/newroaster/scripts/fetch.mjs <build> --add path/to/file.md --title "..." --date 2024-05-01 +``` + +If a source came back thin or failed, find a different copy (a transcript page, an archive.org copy) or replace it. A PDF without `pdftotext` is saved as `pending-*.pdf`: read it with the Read tool, save the text as a `.md`, then `--add` it. Re-run until the manifest meets the depth target, then open two or three corpus files to confirm they are clean text by the right person. Write the manifest line counts into your notes for the final report. + +## Step 4: Extract (map) + +Split the sources into batches of about 50,000 words each (a 90-minute talk is about 13,000; a long essay 5,000). Spawn one extraction agent per batch, in **one message**, in parallel, foreground: `subagent_type: general-purpose`, `model: sonnet`, with the prompt from `references/extract-prompt.md` (fill in the name, the seat's pillar and question, the batch's source ids and file paths, and the notes file to write). Run at most six at a time; for `--deep`, run them in waves. + +Each agent writes `<build>/notes/batch-NN.md`. Wait until every agent has reported. When all are back, check every note quote: + +```bash +node .claude/skills/newroaster/scripts/check_quotes.mjs <build> <build>/notes +``` + +Fix what it reports: correct a wrong source id, delete a quote it cannot find. Notes with no verifiable quote can stay as paraphrase, marked "inferred from S0xx". + +## Step 5: Write the brain (reduce) + +Create `.claude/skills/roast-room/brains/<slug>/`. Write `sources.md` with the script: + +```bash +node .claude/skills/newroaster/scripts/fetch.mjs <build> --sources-md .claude/skills/roast-room/brains/<slug>/sources.md --name "Full Name" +``` + +Then spawn three writer agents in one message, in parallel (`general-purpose`, default model). Each reads every notes file plus `references/brain-spec.md` and writes its files into the brain folder, following the spec's budgets and rules: + +- Writer A: `frameworks.md`, `principles.md`, and `books.md`. +- Writer B: `positions.md` and `stories.md`. +- Writer C: `voice.md`. + +Tell each writer the seat's pillar and question, the build folder (so it can open a corpus file to check a quote's context), and that every quote must be copied exactly from the notes with its source id. Writers write only their own files. + +When they are back, write `_hot.md` yourself from the six finished files (the spec lists what goes in it, including "where this lens misfires"). Then check the whole brain: + +```bash +node .claude/skills/newroaster/scripts/check_quotes.mjs <build> .claude/skills/roast-room/brains/<slug> +``` + +Fix until it passes: every quote verbatim, every id right. Read `_hot.md` once more as the agent will: it should tell you how this person decides, in their words, in under 800 words. + +## Step 6: Write the agent + +Write `.claude/agents/council-<key>.md` from `references/agent-template.md`. Fill every bracket from the brain: the lens (five or six questions this person asks of any decision), how they talk (from `voice.md`), how they debate (name their natural opponents among the seats in `roster.json` and what they concede, from "where this lens misfires"), and the never-list. The description names the pillar, the source count and what the brain is built from, and the trigger phrases ("what would [name] say"). + +## Step 7: Register the seat + +```bash +node .claude/skills/newroaster/scripts/add_seat.mjs --key <key> --name "<Full Name>" --short "<Short>" --slug <slug> --pillar "<pillar>" --question "<question>" --dimension "<dimension>" [--default] [--swap <key>] +``` + +It refuses if the agent file or a brain file is missing. `--default` adds the seat to the default board; `--swap <key>` takes another seat off it in the same move. Then: + +- Add one or two "natural tension" lines for the new seat to `.claude/skills/roast-room/references/seats.md` (who they will clash with, and over what). + +## Step 8: Test the seat + +New agent files load when Claude Code starts, so test with the fallback the council itself uses: spawn `general-purpose` with `Read .claude/agents/council-<key>.md and follow it as your instructions for this whole task. Only read files; do not write anything.` followed by the single-seat consult prompt from `.claude/skills/roast-room/references/round-prompts.md`, on a short sample decision in the seat's pillar. Then check its answer: + +- It sounds like the person (compare with `voice.md`), speaks in the first person, and never claims to be them. +- It names frameworks with source ids, and every quote passes `check_quotes.mjs` (save the answer to `<build>/test-consult.md` and run the checker on it). +- It owns its pillar instead of giving generic advice. + +If it fails, fix the agent or `_hot.md` and test again, once. + +## Step 9: Report + +Tell the user, in under 150 words: + +- Who was added, their pillar and question, and whether they are on the default board. +- The brain: sources, words, years covered, and the files written. +- How to use them now: `/roast-room ask <key> ...` for one answer, `/roast-room --seats <key>,buffett,... ...` to seat them, and `/roast-room board` to change the default board. +- One line: restart Claude Code (or open a new session) so the seat loads as its own agent type; until then the council uses the fallback automatically. +- One line: the room draws them a simple cartoon bust in their color. For a real portrait, save a square image with a transparent background as `app/public/portraits/<key>-base.png` (`.webp` or `.jpg` also work). Add `-open`, `-mid`, and `-blink` versions of the same image to make the mouth move. + +## Without sub-agents (Codex or a runtime that cannot spawn agents) + +Run steps 4 and 5 yourself, one batch at a time: extract a batch into its notes file, then move to the next. Write the brain files one at a time from the notes. Everything else is the same. + +## Rules + +- Public and lawful sources only. The corpus stays in the build folder and is never committed or shared; the brain holds short quotes (under 45 words) and paraphrase, never book text. +- Every quote in the brain is verbatim and passes `check_quotes.mjs`. A line with no source is inference and says so. +- Do not touch the other seats' brains or agents. Only `roster.json`'s `"seats"` and `"default"` change, through `add_seat.mjs`. +- Plain English in everything you write yourself: short sentences, no em dashes, no filler. +- Cost: a standard seat is about 8 to 10 sub-agent runs. Say which depth you used. diff --git a/.claude/skills/newroaster/references/agent-template.md b/.claude/skills/newroaster/references/agent-template.md new file mode 100644 index 0000000..0f1fe2f --- /dev/null +++ b/.claude/skills/newroaster/references/agent-template.md @@ -0,0 +1,48 @@ +# Seat agent template + +Write this to `.claude/agents/council-<key>.md`, replacing every bracket. Model it on an existing seat (`.claude/agents/council-graham.md` is a good one to read first). Keep the section headings so every seat has the same shape. The frontmatter `description` must not contain a colon followed by a space. + +```markdown +--- +name: council-[key] +description: The [pillar, lowercase] seat on the Roast Room council. Reasons, decides, and talks the way [Full Name] does, grounded in a brain compiled from [N] of [his/her/their] public sources ([what they are, with years]). Use inside /roast-room, or directly when someone asks "what would [Name] say", wants a read on [three or four topics this seat owns], or asks the [Short] seat a question. +tools: Read, Grep, Glob +maxTurns: 12 +--- + +You hold the **[Pillar]** seat on the Roast Room council. You reason, decide, and talk the way [Full Name] does. You are not [Full Name] and never claim to be; you are a simulation built from [their] public work, and if anyone asks, you say so. Your job on the council: own one question, **"[question]"**, and bring that lens at full strength. The Chair balances the room. You do not. + +## Your brain + +Root: `.claude/skills/roast-room/brains/[slug]/` + +1. Read `_hot.md` first, every time. +2. Then at most three more files that fit the decision: `frameworks.md`, `positions.md` ([one note, such as "stances with dates; cite the newer view when they changed"]), `principles.md`, `voice.md` (read it before your first answer in a session), `stories.md`, `books.md`. +3. Never look outside your brain folder for facts about [Name]. The brain is your memory. +4. Cite every framework or rule you use with its source id from the brain, like ([Framework name], S0xx). Quote only lines that appear verbatim in the brain. Everything else is your reasoning, in your voice, unquoted. + +## Your lens + +- [Five or six questions this person asks of any decision, each one line, from _hot.md's decision loop.] + +## How you talk + +[Three to five sentences from voice.md: sentence length, cadence, the moves they make, signature phrases to use when they fit, how they hedge or don't.] + +- Speak as the seat, in the first person ("I'd kill option A"). Never narrate the expert in the third person ("he says", "by her rule"). Verbatim lines go in quotes with the source id, and that is the only attribution you need. + +## How you debate + +- Argue from your pillar first, with numbers. If the brief lacks the numbers you need, state your assumption and run the math anyway. +- Your natural opponents are [two or three seats from roster.json, with what you push them on]. [What you concede, from "where this lens misfires".] +- Engage the strongest version of the other seats' arguments. Move only for a better argument or a new fact, and say exactly what moved you. +- If everyone agrees with you, attack the weakest part of your own case. +- Answer in the exact shape the round prompt asks for. No preamble. + +## Never + +- Claim to be [Full Name], speak for [them] about things outside the brain, or invent a quote, number, or story. +- Use em dashes. +- Hedge to sound balanced. A clear "no" with a reason is more useful than a soft "it depends". +- [One or two misuses specific to this lens, from "where this lens misfires".] +``` diff --git a/.claude/skills/newroaster/references/brain-spec.md b/.claude/skills/newroaster/references/brain-spec.md new file mode 100644 index 0000000..29294f6 --- /dev/null +++ b/.claude/skills/newroaster/references/brain-spec.md @@ -0,0 +1,30 @@ +# Brain spec: one seat on the Roast Room council + +Every seat has the same brain layout, so the council agents differ only in content. The original seven follow this spec; new seats must too. + +Folder: `.claude/skills/roast-room/brains/<slug>/` + +## Files + +| File | Budget (standard; `--quick` may run about half) | Contents | +|---|---|---| +| `_hot.md` | 600 to 800 words | Read on every council call. Who the seat is, the pillar and the question it owns, the corpus in one line, worldview in three sentences, the 8 rules they decide by (each with one short verbatim quote and source id), the 5 frameworks they reach for first, their decision loop (5 or 6 steps), signature questions they ask founders, a voice cheat sheet (5 lines), and **where this lens misfires**. | +| `frameworks.md` | 12 to 25 entries | Name (as they name it, or a short name marked *(unnamed)*), what it is, parts or steps, when to use it, how to score a decision with it (scoring guidance from their own thresholds, labeled as guidance), one verbatim quote with source id, and how many sources use it (with ids). Include the frameworks from their books. Most-used first. | +| `principles.md` | 15 to 30 entries | Decision rules in one plain sentence, one or two verbatim quotes with source ids, number of supporting sources, confidence (high = 3+ sources, medium = 2, low = 1). | +| `positions.md` | 20 to 40 topics | Their stance on common founder questions: pricing, discounting, raising money, debt, first hire, firing, partners, equity, focus versus diversification, side projects, niche, content, paid ads, brand, AI, remote work, work hours, burnout, selling the company, culture, metrics, competition, timing. Verbatim quote, source id, and date. When they changed their mind, record both views side by side with dates. Topics with no evidence say "no recorded position"; never guess. | +| `voice.md` | 400 to 700 words | How they talk: sentence length, cadence, signature phrases (verbatim, with how many sources use them), go-to analogies, how they open and close an argument, how they disagree, words and moves they never use. Then 8 to 12 short verbatim voice anchors (under 45 words each, with source ids). | +| `stories.md` | 10 to 20 entries | The stories and case studies they reuse, one or two lines each with the lesson and source ids. | +| `books.md` | one entry per book | Title, year, core thesis, key frameworks in your own words, which sources teach it. Never reproduce book text. If they have no books, say so in one line and list their major essays or series instead. | +| `sources.md` | all | Written by `fetch.mjs --sources-md`: a header with counts and total words, then `id | title | url | date | words` per source. | + +Each file opens with a `# <File>: <Full Name>` heading and one line on what it was built from. + +## Rules + +- Every quote is verbatim from the corpus and carries a source id from `sources.md`, like "..." (S014). Quotes stay under 45 words. `check_quotes.mjs` must pass on the whole folder. +- Quotation marks mean verbatim. Signature questions, paraphrases, and your own summaries go without them, so no agent later passes them off as the person's words. +- Never attribute a view without a source id. A line that is your reading of several sources says "inferred from S0xx, S0yy". +- Plain English. No em dashes. No filler. +- The brain describes how the person thinks so an agent can reason like them. It is not a biography and not a fan page: include where they are wrong, inconsistent, or out of their depth. +- **Where this lens misfires** is mandatory in `_hot.md`: the situations where this person's advice is known to fit badly (advice built for high-ticket services applied to SaaS, public-equity rules applied to a seed-stage startup, a solo creator's playbook applied to a 50-person company). Use what they say about their own limits first, then the shape of their experience. +- Prefer newer sources when views changed, and say so with dates. diff --git a/.claude/skills/newroaster/references/extract-prompt.md b/.claude/skills/newroaster/references/extract-prompt.md new file mode 100644 index 0000000..966fd22 --- /dev/null +++ b/.claude/skills/newroaster/references/extract-prompt.md @@ -0,0 +1,51 @@ +# Extraction prompt (map step) + +One agent per batch of about 50,000 words. Spawn them in one message, in parallel: `subagent_type: general-purpose`, `model: sonnet`. Replace the bracketed parts. + +``` +ROAST ROOM SEAT BUILD: EXTRACT NOTES + +You are building the brain for a new Roast Room seat: [Full Name], who will hold the [pillar] seat and own the question "[question]". The brain teaches an agent to reason, decide, and talk like this person. Your job is one batch of their public sources. + +Repo root: [absolute path] +Read these source files in full (each opens with its title and "Source: S0xx | url | date"): +[one line per source: S0xx | corpus/S0xx-....md | words] + +Write your notes to: [build]/notes/batch-[NN].md +Write nothing else. Do not edit the source files. + +For each source, add a section "## S0xx | [title] | [date]" with these parts. Skip a part when the source has nothing for it. Only extract what [Full Name] says; ignore the host, the interviewer, and other guests. + +### Frameworks +- **[Name as they call it, or a short name + (unnamed)]**: what it is, its parts or steps, when they use it, and any threshold or number they attach. Quote: "[verbatim]" (S0xx) + +### Rules +- [A decision rule in one plain sentence.] Quote: "[verbatim]" (S0xx) + +### Positions +- [Topic]: [their stance in one line]. Quote: "[verbatim]" (S0xx) + Topics that matter most: pricing, discounting, raising money, debt, hiring, firing, partners, equity, focus, side projects, niche, content, ads, brand, AI, remote work, hours, burnout, selling the company, culture, metrics, competition, timing. Anything they feel strongly about counts too. + +### Stories +- [The story in one line]: [the lesson they draw]. (S0xx) + +### Books +- [Title]: what they say the book argues, in your words. (S0xx) + +### Voice +- Signature phrases, verbatim. Analogies they reach for. How they open, argue, disagree, and close. Words or moves they avoid. +- Two or three voice anchors: short verbatim lines (under 45 words) that sound most like them. "[verbatim]" (S0xx) + +### Limits +- Anything they say about where their advice does not apply, mistakes they admit, or views they changed (with the date). (S0xx) + +Quote rules, which a script checks against the source files: +- Copy quotes character for character from the source file, including their grammar and filler words. Never fix, merge, or paraphrase inside quotation marks. +- Every quote is under 45 words and is followed by its source id in parentheses. +- A quote may skip words with "..." only inside one passage. +- If you cannot find the exact words, write the point as paraphrase with no quotation marks. + +At the end, add "## Batch summary": the five frameworks and five rules that came up most in this batch, with source ids. + +Reply with one line: the notes path, and how many frameworks, rules, positions, and quotes you wrote. +``` diff --git a/.claude/skills/newroaster/scripts/add_seat.mjs b/.claude/skills/newroaster/scripts/add_seat.mjs new file mode 100644 index 0000000..6398443 --- /dev/null +++ b/.claude/skills/newroaster/scripts/add_seat.mjs @@ -0,0 +1,76 @@ +#!/usr/bin/env node +// Register a finished seat in the Roast Room roster (.claude/skills/roast-room/roster.json). +// +// node .claude/skills/newroaster/scripts/add_seat.mjs --key naval --name "Naval Ravikant" --short Naval \ +// --slug naval-ravikant --pillar "Leverage and wealth" --question "Does this build leverage you own?" \ +// --dimension "Leverage and long-term wealth" [--color "#22b8a0"] [--default] [--swap <key>] +// +// Checks the agent file and the brain exist first, so a half-built seat never reaches the table. +// --default puts the seat on the default board; --swap <key> takes that seat off the board in +// the same move (the board holds at most nine). Running it again for the same key updates it. +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..", ".."); +const SKILL = path.join(ROOT, ".claude", "skills", "roast-room"); +const ROSTER = path.join(SKILL, "roster.json"); +const MAX_BOARD = 9; +const BRAIN_FILES = ["_hot.md", "frameworks.md", "principles.md", "positions.md", "voice.md", "stories.md", "sources.md"]; +const PALETTE = ["#22b8a0", "#e05d9b", "#c9a227", "#5b7cfa", "#ef7d32", "#2fa4d6", "#a3be3c", "#b06ad9", "#d6543f", "#3fb37f"]; + +const args = process.argv.slice(2); +const opt = (n) => { const i = args.indexOf(`--${n}`); return i >= 0 ? args[i + 1] : undefined; }; +const fail = (m) => { console.error("add_seat: " + m); process.exit(1); }; + +const seat = { + key: (opt("key") || "").toLowerCase(), + name: opt("name"), short: opt("short"), initials: opt("initials"), slug: opt("slug"), + pillar: opt("pillar"), question: opt("question"), dimension: opt("dimension"), color: opt("color"), +}; +for (const f of ["key", "name", "short", "slug", "pillar", "question", "dimension"]) if (!seat[f]) fail(`--${f} is required`); +if (!/^[a-z][a-z0-9]{1,15}$/.test(seat.key)) fail("--key must be 2 to 16 lowercase letters or digits, starting with a letter"); +if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(seat.slug)) fail("--slug must look like first-last"); +seat.initials ||= seat.name.split(/\s+/).map((w) => w[0]).join("").slice(0, 3).toUpperCase(); + +const agent = path.join(ROOT, ".claude", "agents", `council-${seat.key}.md`); +if (!fs.existsSync(agent)) fail(`missing agent file ${path.relative(ROOT, agent)}`); +const brain = path.join(SKILL, "brains", seat.slug); +const missing = BRAIN_FILES.filter((f) => !fs.existsSync(path.join(brain, f))); +if (missing.length) fail(`brain ${path.relative(ROOT, brain)} is missing ${missing.join(", ")}`); + +const r = JSON.parse(fs.readFileSync(ROSTER, "utf8")); +const others = r.seats.filter((s) => s.key !== seat.key); +if (others.some((s) => s.slug === seat.slug)) fail(`slug ${seat.slug} already belongs to another seat`); +if (others.some((s) => s.short.toLowerCase() === seat.short.toLowerCase())) fail(`short name ${seat.short} is taken; pick another`); +if (!/^#[0-9a-f]{6}$/i.test(seat.color || "")) { + const used = new Set(r.seats.map((s) => s.color.toLowerCase())); + seat.color = PALETTE.find((c) => !used.has(c)) || PALETTE[r.seats.length % PALETTE.length]; +} +const at = r.seats.findIndex((s) => s.key === seat.key); +if (at >= 0) r.seats[at] = seat; else r.seats.push(seat); + +const swap = opt("swap"); +if (swap) r.default = r.default.filter((k) => k !== swap); +if (args.includes("--default") && !r.default.includes(seat.key)) { + if (r.default.length >= MAX_BOARD) fail(`the default board already has ${MAX_BOARD} seats; add --swap <key> to take one off`); + r.default.push(seat.key); +} + +// one seat per line keeps the file easy to read and edit by hand +const line = (o) => "{ " + Object.entries(o).map(([k, v]) => `${JSON.stringify(k)}: ${JSON.stringify(v)}`).join(", ") + " }"; +const out = [ + "{", + ` "board": ${JSON.stringify(r.board || "default")},`, + ` "default": [${r.default.map((k) => JSON.stringify(k)).join(", ")}],`, + ` "seats": [`, + r.seats.map((s) => " " + line(s)).join(",\n"), + " ]", + "}", +].join("\n") + "\n"; +JSON.parse(out); // never write a file the room cannot read +fs.writeFileSync(ROSTER, out); + +console.log(`${at >= 0 ? "Updated" : "Added"} ${seat.name} (${seat.key}) to the roster.`); +console.log(`Default board (${r.default.length}): ${r.default.map((k) => r.seats.find((s) => s.key === k)?.short || k).join(", ")}`); +console.log(`Board setting: ${r.board || "default"}`); diff --git a/.claude/skills/newroaster/scripts/check_quotes.mjs b/.claude/skills/newroaster/scripts/check_quotes.mjs new file mode 100644 index 0000000..9fab7f9 --- /dev/null +++ b/.claude/skills/newroaster/scripts/check_quotes.mjs @@ -0,0 +1,65 @@ +#!/usr/bin/env node +// Check that every quote in a seat's notes or brain is verbatim in the source it cites. +// +// node .claude/skills/newroaster/scripts/check_quotes.mjs <build dir> <file or folder> [...] +// +// A quote is text in double quotes followed within a few characters by a source id, like +// "..." (S014) or "..." (S014, S020). Each quote must appear in the corpus file of one of +// its ids. A quote found under a different id is reported with the right one; a quote found +// nowhere is reported as not found and must be cut or replaced. Quotes with "..." are checked +// piece by piece. Exit code 1 when anything needs fixing. +import fs from "node:fs"; +import path from "node:path"; + +const [, , buildArg, ...targets] = process.argv; +if (!buildArg || !targets.length) { + console.error("usage: check_quotes.mjs <build dir> <file or folder> [...]"); + process.exit(2); +} +const BUILD = path.resolve(buildArg); +const sources = JSON.parse(fs.readFileSync(path.join(BUILD, "sources.json"), "utf8")); + +const norm = (s) => s.toLowerCase() + .replace(/[‘’`]/g, "'").replace(/[“”]/g, '"') + .replace(/'\s+(t|s|re|ll|ve|d|m)\b/g, "'$1") + .replace(/\[\d\d:\d\d(:\d\d)?\]/g, " ") + .replace(/[^a-z0-9' ]+/g, " ").replace(/\s+/g, " ").trim(); +const corpus = new Map(sources.map((s) => [s.id, norm(fs.readFileSync(path.join(BUILD, s.file), "utf8"))])); + +const files = []; +const walk = (p) => { + if (fs.statSync(p).isDirectory()) for (const n of fs.readdirSync(p)) walk(path.join(p, n)); + else if (/\.md$/.test(p)) files.push(p); +}; +for (const t of targets) walk(path.resolve(t)); + +const found = (q, id) => { + const hay = corpus.get(id); + if (!hay) return false; + // "..." splits a quote into pieces that must each be in the source + return q.split(/\.\.\.|…/).map(norm).filter((p) => p.split(" ").length >= 3).every((p) => hay.includes(p)); +}; + +let ok = 0; +const wrong = [], missing = []; +const re = /["“]([^"“”\n]{12,600})["”][^\n"“]{0,40}?[(\[]((?:S\d{3})(?:\s*[,;]\s*S\d{3})*)/g; +for (const f of files) { + const lines = fs.readFileSync(f, "utf8").split(/\r?\n/); + lines.forEach((line, i) => { + for (const m of line.matchAll(re)) { + const q = m[1]; + if (norm(q).split(" ").length < 4) continue; + const ids = m[2].split(/\s*[,;]\s*/); + const where = `${path.relative(process.cwd(), f)}:${i + 1}`; + if (ids.some((id) => found(q, id))) { ok++; continue; } + const other = sources.find((s) => found(q, s.id)); + if (other) wrong.push(`${where} cites ${ids.join(", ")}, but the quote is in ${other.id}: "${q.slice(0, 90)}"`); + else missing.push(`${where} not found in any source: "${q.slice(0, 110)}"`); + } + }); +} + +console.log(`quotes verified: ${ok}; wrong source id: ${wrong.length}; not found: ${missing.length}`); +for (const w of wrong) console.log(" WRONG ID " + w); +for (const m of missing) console.log(" NOT FOUND " + m); +process.exit(wrong.length || missing.length ? 1 : 0); diff --git a/.claude/skills/newroaster/scripts/fetch.mjs b/.claude/skills/newroaster/scripts/fetch.mjs new file mode 100644 index 0000000..4aed7cb --- /dev/null +++ b/.claude/skills/newroaster/scripts/fetch.mjs @@ -0,0 +1,263 @@ +#!/usr/bin/env node +// Fetch public sources for a new Roast Room seat into its build folder, one markdown file per +// source, and keep the source id table (S001, S002, ...) the brain cites. +// +// node .claude/skills/newroaster/scripts/fetch.mjs <build dir> <url> [<url> ...] +// node .claude/skills/newroaster/scripts/fetch.mjs <build dir> --list urls.txt +// node .claude/skills/newroaster/scripts/fetch.mjs <build dir> --add <file.md|.txt|.pdf> --title "..." [--url ...] [--date YYYY-MM-DD] +// node .claude/skills/newroaster/scripts/fetch.mjs <build dir> --manifest +// node .claude/skills/newroaster/scripts/fetch.mjs <build dir> --sources-md <brain>/sources.md --name "Full Name" +// +// Web pages become plain text. YouTube links become transcripts with [mm:ss] markers (yt-dlp +// when it is installed, otherwise YouTube's own caption tracks). PDFs need pdftotext; without +// it the file is saved and flagged so Claude can read it and write the text in. --add takes a +// local file you already have (your own transcripts, notes, or posts). Re-runs skip URLs that +// are already in sources.json. Node 20+, no installs. +import fs from "node:fs"; +import path from "node:path"; +import os from "node:os"; +import { execFileSync, spawnSync } from "node:child_process"; + +const [, , buildArg, ...rest] = process.argv; +if (!buildArg || buildArg.startsWith("--")) { + console.error("usage: fetch.mjs <build dir> <url ...> | --list <file> | --add <file> --title <t> | --manifest | --sources-md <file> --name <n>"); + process.exit(2); +} +const BUILD = path.resolve(buildArg); +const CORPUS = path.join(BUILD, "corpus"); +const TABLE = path.join(BUILD, "sources.json"); +fs.mkdirSync(CORPUS, { recursive: true }); +const sources = fs.existsSync(TABLE) ? JSON.parse(fs.readFileSync(TABLE, "utf8")) : []; +const save = () => fs.writeFileSync(TABLE, JSON.stringify(sources, null, 2) + "\n"); +const nextId = () => "S" + String(sources.reduce((m, s) => Math.max(m, Number(s.id.slice(1))), 0) + 1).padStart(3, "0"); +const words = (t) => (t.match(/\S+/g) || []).length; +const slugify = (t) => t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60) || "source"; +const UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Safari/537.36"; +const has = (bin) => !spawnSync(bin, ["-v"], { stdio: "ignore" }).error; // installed at all, whatever the exit code + +function opt(name) { + const i = rest.indexOf(name); + return i >= 0 ? rest[i + 1] : undefined; +} + +// ------------------------------------------------------------------ html to text +const ENT = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", nbsp: " ", mdash: "-", ndash: "-", hellip: "...", rsquo: "'", lsquo: "'", rdquo: '"', ldquo: '"', copy: "(c)" }; +const decode = (s) => s + .replace(/&#x([0-9a-f]+);/gi, (_, h) => String.fromCodePoint(parseInt(h, 16))) + .replace(/&#(\d+);/g, (_, d) => String.fromCodePoint(Number(d))) + .replace(/&([a-z]+);/gi, (m, n) => ENT[n.toLowerCase()] ?? m); + +function htmlToText(html) { + let h = html.replace(/<!--[\s\S]*?-->/g, ""); + for (const tag of ["script", "style", "noscript", "svg", "nav", "header", "footer", "aside", "form", "iframe", "button"]) { + h = h.replace(new RegExp(`<${tag}\\b[\\s\\S]*?</${tag}>`, "gi"), " "); + } + // the article body when the page marks one, else the whole body + const art = h.match(/<article\b[\s\S]*<\/article>/i) || h.match(/<main\b[\s\S]*<\/main>/i); + if (art && words(art[0].replace(/<[^>]+>/g, " ")) > 250) h = art[0]; + else h = (h.match(/<body\b[\s\S]*<\/body>/i) || [h])[0]; + h = h + .replace(/<h([1-6])\b[^>]*>/gi, (_, n) => "\n\n" + "#".repeat(Number(n)) + " ") + .replace(/<\/h[1-6]>/gi, "\n\n") + .replace(/<li\b[^>]*>/gi, "\n- ") + .replace(/<br\s*\/?>/gi, "\n") + .replace(/<\/(p|div|section|blockquote|tr|ul|ol|table|pre)>/gi, "\n\n") + .replace(/<[^>]+>/g, " "); + return decode(h) + .replace(/[ \t ]+/g, " ") + .replace(/ *\n */g, "\n") + .replace(/\n{3,}/g, "\n\n") + .trim(); +} + +function pageMeta(html, url) { + const meta = (re) => { const m = html.match(re); return m ? decode(m[1]).trim() : ""; }; + const title = meta(/<meta[^>]+property=["']og:title["'][^>]+content=["']([^"']+)/i) || meta(/<title[^>]*>([^<]+)<\/title>/i) || url; + const date = + meta(/<meta[^>]+(?:property|name)=["'](?:article:published_time|date|pubdate|publish-date|dc\.date)["'][^>]+content=["']([^"']+)/i) || + meta(/"datePublished"\s*:\s*"([^"]+)"/) || + meta(/<time[^>]+datetime=["']([^"']+)/i) || + (url.match(/\/(20\d\d|19\d\d)\/(\d\d)\//) || []).slice(1, 3).join("-"); + return { title: title.replace(/\s+/g, " ").slice(0, 160), date: (date.match(/\d{4}(-\d\d){0,2}/) || [""])[0] }; +} + +async function get(url, init = {}) { + const r = await fetch(url, { redirect: "follow", signal: AbortSignal.timeout(45000), ...init, headers: { "user-agent": UA, "accept-language": "en-US,en;q=0.9", ...(init.headers || {}) } }); + if (!r.ok) throw new Error(`HTTP ${r.status}`); + return r; +} + +// ------------------------------------------------------------------ youtube +const ytId = (u) => (u.match(/(?:youtu\.be\/|[?&]v=|\/shorts\/|\/live\/|\/embed\/)([\w-]{11})/) || [])[1]; +const stamp = (ms) => { const s = Math.floor(ms / 1000); return `[${String(Math.floor(s / 60)).padStart(2, "0")}:${String(s % 60).padStart(2, "0")}]`; }; + +/** json3 caption events -> paragraphs of about 60 words, each opening with its timestamp */ +function json3ToText(j) { + const out = []; let buf = []; let start = null; + for (const ev of j.events || []) { + if (!ev.segs) continue; + const t = ev.segs.map((s) => s.utf8 || "").join("").replace(/\s+/g, " ").trim(); + if (!t) continue; + if (start === null) start = ev.tStartMs || 0; + buf.push(t); + if (words(buf.join(" ")) >= 60) { out.push(`${stamp(start)} ${buf.join(" ")}`); buf = []; start = null; } + } + if (buf.length) out.push(`${stamp(start || 0)} ${buf.join(" ")}`); + return decode(out.join("\n\n")).replace(/\[(Music|Applause|Laughter)\]/gi, "").trim(); +} + +function viaYtDlp(id) { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "roaster-")); + try { + const info = JSON.parse(execFileSync("yt-dlp", ["-J", "--no-warnings", `https://www.youtube.com/watch?v=${id}`], { encoding: "utf8", maxBuffer: 64 << 20 })); + execFileSync("yt-dlp", ["--skip-download", "--write-subs", "--write-auto-subs", "--sub-langs", "en.*,en", "--sub-format", "json3", "--no-warnings", "-o", path.join(dir, "v"), `https://www.youtube.com/watch?v=${id}`], { stdio: "ignore" }); + const files = fs.readdirSync(dir).filter((f) => f.endsWith(".json3")); + // a human-made track beats auto captions when both exist + const pick = files.find((f) => !/-orig|auto/i.test(f) && /\.en\.json3$/.test(f)) || files[0]; + if (!pick) throw new Error("no English captions"); + const text = json3ToText(JSON.parse(fs.readFileSync(path.join(dir, pick), "utf8"))); + const d = info.upload_date || ""; + return { title: info.title, date: d ? `${d.slice(0, 4)}-${d.slice(4, 6)}-${d.slice(6, 8)}` : "", text, channel: info.channel || "", seconds: info.duration || 0 }; + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +} + +async function viaInnertube(id) { + const body = { context: { client: { clientName: "ANDROID", clientVersion: "20.10.38", androidSdkVersion: 30, hl: "en", gl: "US" } }, videoId: id }; + const r = await get("https://www.youtube.com/youtubei/v1/player?prettyPrint=false", { + method: "POST", body: JSON.stringify(body), + headers: { "content-type": "application/json", "user-agent": "com.google.android.youtube/20.10.38 (Linux; U; Android 11) gzip" }, + }); + const j = await r.json(); + const tracks = j.captions?.playerCaptionsTracklistRenderer?.captionTracks || []; + const en = tracks.filter((t) => /^en/.test(t.languageCode)); + const track = en.find((t) => t.kind !== "asr") || en[0]; + if (!track) throw new Error(j.playabilityStatus?.reason || "no English captions"); + const cap = await (await get(track.baseUrl.replace(/&fmt=[^&]*/, "") + "&fmt=json3")).text(); + if (!cap.trim()) throw new Error("caption track came back empty"); + let date = ""; + try { + const page = await (await get(`https://www.youtube.com/watch?v=${id}`)).text(); + date = ((page.match(/"(?:publishDate|uploadDate)":"([^"]+)"/) || [])[1] || "").slice(0, 10); + } catch {} + return { title: j.videoDetails?.title || id, date, text: json3ToText(JSON.parse(cap)), channel: j.videoDetails?.author || "", seconds: Number(j.videoDetails?.lengthSeconds) || 0 }; +} + +async function youtube(id) { + const errors = []; + if (has("yt-dlp") && !process.env.NO_YTDLP) { try { return viaYtDlp(id); } catch (e) { errors.push(`yt-dlp: ${e.message.split("\n")[0]}`); } } + try { return await viaInnertube(id); } catch (e) { errors.push(`captions: ${e.message}`); } + throw new Error(errors.join("; ")); +} + +// ------------------------------------------------------------------ pdf +function pdfText(file) { + if (!has("pdftotext")) return null; + return execFileSync("pdftotext", ["-layout", "-enc", "UTF-8", file, "-"], { encoding: "utf8", maxBuffer: 256 << 20 }); +} + +// ------------------------------------------------------------------ one source +function write(src, text) { + const file = `${src.id}-${slugify(src.title)}.md`; + const head = `# ${src.title}\n\nSource: ${src.id} | ${src.url || "local file"} | ${src.date || "undated"} | ${src.kind}${src.channel ? ` | ${src.channel}` : ""}\n\n`; + fs.writeFileSync(path.join(CORPUS, file), head + text.trim() + "\n"); + Object.assign(src, { file: `corpus/${file}`, words: words(text) }); + sources.push(src); + save(); + return src; +} + +async function fetchOne(url) { + url = url.trim(); + if (!url || url.startsWith("#")) return; + if (sources.some((s) => s.url === url)) return console.log(`skip ${url} (already fetched)`); + const id = nextId(); + try { + const yt = ytId(url); + if (yt) { + const v = await youtube(yt); + const s = write({ id, title: v.title, url: `https://www.youtube.com/watch?v=${yt}`, date: v.date, kind: "video", channel: v.channel, minutes: Math.round(v.seconds / 60) }, v.text); + return console.log(`ok ${s.id} ${s.words.toLocaleString()} words ${s.title}`); + } + const r = await get(url); + const type = r.headers.get("content-type") || ""; + if (type.includes("pdf") || /\.pdf($|\?)/i.test(url)) { + const raw = path.join(CORPUS, `pending-${slugify(path.basename(new URL(url).pathname, ".pdf"))}.pdf`); + fs.writeFileSync(raw, Buffer.from(await r.arrayBuffer())); + const text = pdfText(raw); + if (!text) return console.log(`pdf ${raw} saved, but pdftotext is not installed. Read it and save its text with --add.`); + fs.rmSync(raw); + const s = write({ id, title: path.basename(raw, ".pdf").replace(/^pending-/, "").replace(/-/g, " "), url, date: (url.match(/(19|20)\d\d/) || [""])[0], kind: "pdf" }, text); + return console.log(`ok ${s.id} ${s.words.toLocaleString()} words ${s.title}`); + } + const html = await r.text(); + const text = htmlToText(html); + const meta = pageMeta(html, url); + // essays often print their date as a line near the top ("July 2013") instead of in the markup + if (!meta.date) { + const m = text.slice(0, 600).match(/\b(January|February|March|April|May|June|July|August|September|October|November|December) (?:\d{1,2}, )?((?:19|20)\d\d)\b/); + if (m) meta.date = `${m[2]}-${String("JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(m[1].slice(0, 3)) / 3 + 1).padStart(2, "0")}`; + } + if (words(text) < 250 && !rest.includes("--keep-short")) { + return console.log(`thin ${url} (${words(text)} words: paywall, login, or a page built by JavaScript; skipped)`); + } + const s = write({ id, title: meta.title, url, date: meta.date, kind: "web" }, text); + console.log(`ok ${s.id} ${s.words.toLocaleString()} words ${s.title}`); + } catch (e) { + console.log(`fail ${url} (${e.message})`); + } +} + +function addLocal(file) { + const title = opt("--title") || path.basename(file).replace(/\.[^.]+$/, ""); + let text; + if (/\.pdf$/i.test(file)) { + text = pdfText(file); + if (!text) throw new Error("pdftotext is not installed; read the PDF and save its text as a .md or .txt file, then --add that"); + } else text = fs.readFileSync(file, "utf8"); + const s = write({ id: nextId(), title, url: opt("--url") || "", date: opt("--date") || "", kind: opt("--kind") || "local" }, text); + console.log(`ok ${s.id} ${s.words.toLocaleString()} words ${s.title}`); +} + +function manifest() { + const total = sources.reduce((n, s) => n + (s.words || 0), 0); + const byKind = {}; + for (const s of sources) { byKind[s.kind] = byKind[s.kind] || { n: 0, w: 0 }; byKind[s.kind].n++; byKind[s.kind].w += s.words || 0; } + const dates = sources.map((s) => s.date).filter(Boolean).sort(); + console.log(`${sources.length} sources, ${total.toLocaleString()} words${dates.length ? `, ${dates[0].slice(0, 4)} to ${dates.at(-1).slice(0, 4)}` : ""}`); + for (const [k, v] of Object.entries(byKind)) console.log(` ${k}: ${v.n} sources, ${v.w.toLocaleString()} words`); + const thin = sources.filter((s) => s.words < 800); + if (thin.length) console.log(` short (<800 words): ${thin.map((s) => s.id).join(", ")}`); +} + +/** The brain's sources.md: a header with counts, then one line per source id. */ +function sourcesMd(out, name) { + const total = sources.reduce((n, s) => n + (s.words || 0), 0); + const kinds = [...new Set(sources.map((s) => s.kind))].map((k) => `${sources.filter((s) => s.kind === k).length} ${k}`).join(", "); + const lines = [ + `# Sources: ${name}`, + "", + `${sources.length} sources (${kinds}), ${total.toLocaleString()} words. Video dates are upload dates. Every quote in this brain carries one of these ids.`, + "", + "Format: id | title | url | date | words", + "", + ...sources.map((s) => `- ${s.id} | ${s.title.replace(/\|/g, "/").replace(/\s*[—–]\s*/g, ": ")} | ${s.url || "local file"} | ${s.date || "undated"} | ${s.words}`), + ]; + fs.writeFileSync(out, lines.join("\n") + "\n"); + console.log(`wrote ${out}`); +} + +// ------------------------------------------------------------------ main +if (opt("--sources-md")) sourcesMd(opt("--sources-md"), opt("--name") || path.basename(BUILD)); +else if (rest.includes("--manifest")) manifest(); +else if (opt("--add")) addLocal(opt("--add")); +else { + const list = opt("--list"); + const urls = list ? fs.readFileSync(list, "utf8").split(/\r?\n/) : rest.filter((a) => !a.startsWith("--")); + for (const u of urls) { + await fetchOne(u); + await new Promise((r) => setTimeout(r, 400)); // be polite to the sites + } + manifest(); +} diff --git a/.claude/skills/roast-room/SKILL.md b/.claude/skills/roast-room/SKILL.md index 0223120..8c609c9 100644 --- a/.claude/skills/roast-room/SKILL.md +++ b/.claude/skills/roast-room/SKILL.md @@ -1,21 +1,36 @@ --- name: roast-room -description: Use when a founder wants a hard business decision debated by a council of world-class operators, says "roast room", "put this in the Roast Room", "founder council", "convene the council", "take this to the board", "what would Hormozi, Bezos, or Buffett say", "should I do X", or can't make up their mind on pricing, hiring, raising money, a new product, a partnership, a pivot, an event, or spending. Seven sub-agents, each built from one expert's public work (Bezos, Paul Graham, Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, Buffett), argue it over three rounds, then a Chair returns a scored verdict, the reasoning, the dissent, and next steps. Also does a one-seat consult ("ask the Hormozi seat"). Not /roast (generic personas, idea validation). -argument-hint: "[the decision] [--quick] [--seats hormozi,buffett,...] | ask <seat> [question]" +description: Use when a founder wants a hard business decision debated by a council of world-class operators, says "roast room", "put this in the Roast Room", "founder council", "convene the council", "take this to the board", "what would Hormozi, Bezos, or Buffett say", "should I do X", or can't make up their mind on pricing, hiring, raising money, a new product, a partnership, a pivot, an event, or spending. A board of sub-agents, each built from one expert's public work (Bezos, Paul Graham, Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, and Buffett out of the box, plus any seat added with /newroaster), argue it over three rounds, then a Chair returns a scored verdict, the reasoning, the dissent, and next steps. Also does a one-seat consult ("ask the Hormozi seat"). Not /roast (generic personas, idea validation). +argument-hint: "[the decision] [--quick] [--all] [--seats hormozi,buffett,...] | ask <seat> [question] | board" --- ## What this does -The Roast Room: runs a board meeting on one decision. Seven seats, one per business pillar, each a sub-agent that reasons and talks the way its expert does, grounded in a brain compiled from that person's videos, essays, letters, talks, and books as they teach them in public. The seats argue across three rounds: open, debate, vote. You act as the **Chair**: you never argue a side, you run the room, keep the score, and write the verdict. +The Roast Room: runs a board meeting on one decision. A board of seats (seven out of the box), one per business pillar, each a sub-agent that reasons and talks the way its expert does, grounded in a brain compiled from that person's videos, essays, letters, talks, and books as they teach them in public. The seats argue across three rounds: open, debate, vote. You act as the **Chair**: you never argue a side, you run the room, keep the score, and write the verdict. -Read once before the first run: `references/seats.md` (roster, weights, tensions), `references/round-prompts.md` (what each seat gets), `references/scoring.md` (math and overrides), `references/report-template.md` (output), `references/live-room.md` (the small JSON files the visual room plays). A finished example council lives in `sessions/2026-10-09-example-take-the-seed/`. +Read once before the first run: `roster.json` (every seat and the default board), `references/seats.md` (picking the board, weights, tensions), `references/round-prompts.md` (what each seat gets), `references/scoring.md` (math and overrides), `references/report-template.md` (output), `references/live-room.md` (the small JSON files the visual room plays). A finished example council lives in `sessions/2026-10-09-example-take-the-seed/`. ## Modes -- **Full council** (default): all seven seats, three rounds. For decisions that are expensive or hard to undo. -- **Quick** (`--quick`): four seats chosen per `seats.md`, Rounds 1 and 2, Round 3 only if the scores did not converge. For reversible calls. -- **Named seats** (`--seats a,b,c`): only those seats, three rounds. -- **Consult** (`ask <seat> ...`): one seat, one answer, using the single-seat prompt. No scoring, no session folder needed. +- **Full council** (default): the board (see "Pick the board"), three rounds. For decisions that are expensive or hard to undo. +- **Quick** (`--quick`): four seats from the board, chosen per `seats.md`, Rounds 1 and 2, Round 3 only if the scores did not converge. For reversible calls. +- **Named seats** (`--seats a,b,c`): only those seats, three rounds. Any seat in `roster.json` can be named, on the default board or not. +- **Everyone** (`--all`): every seat in `roster.json`, up to nine. +- **Consult** (`ask <seat> ...`): one seat, one answer, using the single-seat prompt. No scoring, no session folder needed. Works for any seat in the roster. +- **Board settings** (`board`): show and change who sits at the table by default. See "Board settings" below. No council runs. + +## Pick the board + +Who sits at the table comes from `roster.json`, in this order: + +1. `--seats a,b,c` or `--all` on this run wins. `--quick` then picks four from those seats. +2. Otherwise `"board"` in `roster.json` decides: + - `"default"` (out of the box): seat the `"default"` list. No question asked. + - `"ask"`: before the brief, show the default board and the other seats in one line each (name and pillar), and ask with one AskUserQuestion: keep the default board (recommended), let the Chair pick, or name the seats. Then seat the answer. + - `"auto"`: the Chair picks the best seats for this decision from the whole roster: up to seven, every pillar the decision touches, always one seat that guards the downside (money, capital, or risk), and never two seats with the same pillar unless they disagree on it. Say who was picked and why in one line before Round 1. +3. Never seat more than nine. Every seat at the table must have an agent file (`.claude/agents/council-<key>.md`) and a brain folder; skip and name any that do not. + +Tell the user who is at the table in one line when the council starts, and that `--seats`, `--all`, or `/roast-room board` change it. ## Step 1: The brief @@ -33,7 +48,7 @@ Keep the brief under 300 words. Mark every assumption as `(assumed)`. ## Step 2: Set up the room -- Set a relevance weight per seat (1 to 3) with a one-line reason, per `seats.md`. +- Seat the board (see "Pick the board"). Set a relevance weight per seat at the table (1 to 3) with a one-line reason, per `seats.md`. - Create the session folder: `sessions/YYYY-MM-DD-<decision-slug>/` at the project root. Save `brief.md` (the brief, the options, and the weights table) and `council.json` (`live-room.md`). - Tell the user once: "Watch it live at http://localhost:4730" (the Roast Room plays the council as these files land; it is optional and the council runs the same without it). @@ -41,7 +56,7 @@ Keep the brief under 300 words. Mark every assumption as `(assumed)`. Spawn every seat in **one message**, in parallel, foreground (`run_in_background: false`), `subagent_type: council-<seat>`, with the Round 1 prompt. If a `council-*` type is not registered in this session, use `general-purpose` with the fallback lines from `round-prompts.md`. -When the cards come back, save them verbatim to `round-1.md`, one `## <Seat>` heading per card (Bezos, Graham, Hormozi, Gary V, Martell, Wickman, Buffett), and write the file right away so the room can start playing. Check each card has every field; send a card back once if it is missing scores or a stance. Then add a `## Chair notes` section at the bottom of `round-1.md`: +When the cards come back, save them verbatim to `round-1.md`, one `## <Seat>` heading per card (the seat's `short` name from `roster.json`: Bezos, Graham, Hormozi, Gary V, and so on), and write the file right away so the room can start playing. Check each card has every field; send a card back once if it is missing scores or a stance. Then add a `## Chair notes` section at the bottom of `round-1.md`: - The **cruxes**: the one to three underlying disagreements that explain why seats split (a factual question, a numbers question, or a values question such as speed versus safety), with the seats on each side. - The **unanimity check** (`scoring.md`): if Round 1 converged, make the strongest unargued alternative a crux and name which seats must argue it at full strength. @@ -75,9 +90,20 @@ Quick mode skips this round when the Round 2 spread on the top option is 3 or le - Quote seats faithfully. Never put words in a seat's mouth or rewrite a card. - Seats speak in their expert's voice; your report is plain English that follows the house writing rules (no em dashes, no AI tells, no tee-ups). - Treat a unanimous Round 1 as a warning, not a win. -- Cost: a full council is 21 sub-agent runs, about 1M tokens. Use `--quick` for small calls, and say which mode you used. +- Cost: a full council is three sub-agent runs per seat (21 for seven seats), about 1M tokens. Use `--quick` for small calls, and say which mode you used. - The seats are simulations built from public work. Never present a seat's line as something the real person said unless it is a verbatim quote with a source id from the brain. +## Board settings + +`/roast-room board` (or "change my board", "who's on my board", "add Naval to my default board") edits `roster.json` and runs no council. + +1. Show the roster in a short table: seat, pillar, on the default board or not. Then the current `"board"` setting in plain words ("every council seats your default board", "the Chair asks each time", or "the Chair picks per decision"). +2. Ask what to change, with AskUserQuestion when the user has not already said: add or remove seats on the default board, or switch the setting between `default`, `ask`, and `auto`. +3. Edit `roster.json` in place: only the `"board"` and `"default"` fields. Keep the default board between one and nine seats, using keys that exist in `"seats"`. Never remove a seat from `"seats"` here; taking someone off the default board keeps them available for `--seats` and `ask`. +4. Confirm the new board in one line. The room picks it up on its next page load. + +To add a brand new advisor, use `/newroaster`. + ## Without sub-agents (Codex or a runtime that cannot spawn agents) Run the same protocol sequentially yourself. For each seat, read `.claude/agents/council-<seat>.md` and its brain, write that seat's card, then clear your head before the next seat: do not let one seat's card shape the next one's in Round 1. Rounds 2 and 3 work the same way with the prior cards in view. @@ -86,5 +112,6 @@ Run the same protocol sequentially yourself. For each seat, read `.claude/agents - `brains/<slug>/`: one brain per seat (`_hot.md`, `frameworks.md`, `principles.md`, `positions.md`, `voice.md`, `stories.md`, `books.md`, `sources.md`). - `scripts/check_quotes.py`: verifies every attributed quote in a session against the brains. -- Agents: `.claude/agents/council-{bezos,graham,hormozi,garyvee,martell,wickman,buffett}.md`. +- `roster.json`: every seat (key, name, pillar, the question it owns, scorecard dimension, color) and the default board. `/newroaster` adds seats; `/roast-room board` changes the board. +- Agents: `.claude/agents/council-<key>.md`, one per seat in the roster. - The room app: `app/` (start at the project `README.md`). diff --git a/.claude/skills/roast-room/references/scoring.md b/.claude/skills/roast-room/references/scoring.md index 24c8c41..7b9fed5 100644 --- a/.claude/skills/roast-room/references/scoring.md +++ b/.claude/skills/roast-room/references/scoring.md @@ -44,6 +44,8 @@ Round 3's FINAL SCORE is each seat's support for the draft resolution as written One column per seat: its final PILLAR SCORE, which is that seat's judgment of the recommended option on its own pillar alone. Any pillar at 4 or below gets a named fix in "What to do next", even when the verdict is GO. +Each seat's dimension label is its `dimension` field in `roster.json`. The seven that ship: + | Pillar | Dimension label | |---|---| | Strategy and decisions (Bezos) | Strategic fit and reversibility | diff --git a/.claude/skills/roast-room/references/seats.md b/.claude/skills/roast-room/references/seats.md index 6a4c2e3..b117d06 100644 --- a/.claude/skills/roast-room/references/seats.md +++ b/.claude/skills/roast-room/references/seats.md @@ -1,5 +1,7 @@ # Seats +`roster.json` (one folder up) is the source of truth: every seat, its key, pillar, question, and scorecard dimension, plus the default board and how the board is picked. The seven seats that ship with the Roast Room: + | Seat | Agent | Pillar | Owns the question | Brain | |---|---|---|---|---| | Bezos | `council-bezos` | Strategy and decisions | Is this the right bet, and how reversible is it? | `brains/jeff-bezos/` | @@ -10,7 +12,7 @@ | Wickman | `council-wickman` | Operations and scaling | Can the business run this without the founder holding it together? | `brains/gino-wickman/` | | Buffett | `council-buffett` | Money and capital | What does it do to cash, risk, and long-term value? | `brains/warren-buffett/` | -Brain paths are relative to `.claude/skills/roast-room/`. +Brain paths are relative to `.claude/skills/roast-room/`. Seats added with `/newroaster` follow the same pattern: `council-<key>` and `brains/<slug>/`, listed in `roster.json`. ## Relevance weights @@ -26,7 +28,7 @@ Every seat is at least 1. Exactly one or two seats get a 3. ## Quick council -`--quick` seats four: the two highest-weight seats, Buffett or Bezos (whichever is not already in, as the downside check), and the seat most likely to disagree with the others (the Chair names why). Use quick for reversible, low-stakes calls. Full council for anything a founder cannot easily undo. +`--quick` seats four from the board: the two highest-weight seats, the seat that guards the downside (Buffett or Bezos out of the box; otherwise the board's money, capital, or risk seat), and the seat most likely to disagree with the others (the Chair names why). Use quick for reversible, low-stakes calls. Full council for anything a founder cannot easily undo. ## Natural tensions to expect @@ -35,4 +37,6 @@ Every seat is at least 1. Exactly one or two seats get a 3. - Buffett (stay in your circle, avoid leverage) against Gary V (bet on the underpriced platform now). - Martell (buy back your time, hire early) against Graham and Buffett (stay small and frugal until it works). +Seats added with `/newroaster` append their own tension lines here. + If Round 1 comes back unanimous, the Chair should be suspicious and press the seat whose pillar is most at risk in Round 2. diff --git a/.claude/skills/roast-room/roster.json b/.claude/skills/roast-room/roster.json new file mode 100644 index 0000000..d627639 --- /dev/null +++ b/.claude/skills/roast-room/roster.json @@ -0,0 +1,13 @@ +{ + "board": "default", + "default": ["bezos", "graham", "hormozi", "garyvee", "martell", "wickman", "buffett"], + "seats": [ + { "key": "bezos", "name": "Jeff Bezos", "short": "Bezos", "initials": "JB", "slug": "jeff-bezos", "pillar": "Strategy and decisions", "question": "Is this the right bet, and how reversible is it?", "dimension": "Strategic fit and reversibility", "color": "#e8a33d" }, + { "key": "graham", "name": "Paul Graham", "short": "Graham", "initials": "PG", "slug": "paul-graham", "pillar": "Product and startups", "question": "Is this something people actually want, and is it growing?", "dimension": "Real demand and growth", "color": "#f06b3f" }, + { "key": "hormozi", "name": "Alex Hormozi", "short": "Hormozi", "initials": "AH", "slug": "alex-hormozi", "pillar": "Offers, pricing, and sales", "question": "Will people pay, how much, and how do we close?", "dimension": "Offer strength and unit economics", "color": "#d94a6a" }, + { "key": "garyvee", "name": "Gary Vaynerchuk", "short": "Gary V", "initials": "GV", "slug": "gary-vaynerchuk", "pillar": "Marketing and attention", "question": "Where does the attention come from, and is it underpriced?", "dimension": "Attention and distribution", "color": "#9b5de5" }, + { "key": "martell", "name": "Dan Martell", "short": "Martell", "initials": "DM", "slug": "dan-martell", "pillar": "People, hiring, and founder time", "question": "Who does this, and what does it cost the founder's calendar?", "dimension": "Team capacity and founder time", "color": "#3d8bfd" }, + { "key": "wickman", "name": "Gino Wickman", "short": "Wickman", "initials": "GW", "slug": "gino-wickman", "pillar": "Operations and scaling", "question": "Can the business run this without the founder holding it together?", "dimension": "Operational readiness", "color": "#1fa67a" }, + { "key": "buffett", "name": "Warren Buffett", "short": "Buffett", "initials": "WB", "slug": "warren-buffett", "pillar": "Money and capital", "question": "What does it do to cash, risk, and long-term value?", "dimension": "Downside and capital efficiency", "color": "#4c6a92" } + ] +} diff --git a/.gitignore b/.gitignore index 5f84cf5..c514709 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ node_modules/ .DS_Store +# /newroaster's raw sources (transcripts, essays, notes) stay on your machine; only the brain ships +build/ + # your councils stay on your machine; the examples ship with the repo sessions/* !sessions/.gitkeep diff --git a/CLAUDE.md b/CLAUDE.md index 7f9dee2..ec8b84d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,8 +1,9 @@ # Roast Room -This project is the Roast Room: a council of seven simulated advisors (Bezos, Paul Graham, Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, Buffett) that debates a founder's business decision. +This project is the Roast Room: a council of simulated advisors that debates a founder's business decision. Seven ship with it (Bezos, Paul Graham, Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, Buffett), and the user can add more. - When the user brings a decision ("should I...", pricing, hiring, raising money, a new product, a pivot), run `/roast-room`. For a quick question to one advisor, use `/roast-room ask <seat> ...`. +- Every advisor and the default board live in `.claude/skills/roast-room/roster.json`. When the user wants to add an advisor ("add Naval", "I want X on my board"), run `/newroaster`. When they want to change who sits at the table by default, or be asked each time, run `/roast-room board`. - If the user asks to start or open the room, run `npm start` in the background and tell them to open http://localhost:4730. It needs Node 20 or newer and nothing else. - Councils are saved in `sessions/<date>-<decision>/`. The room plays them live as those files land. Follow `.claude/skills/roast-room/references/live-room.md` exactly so the room can read them. - The seats are simulations built from public work. Never present a seat's words as something the real person said unless it is a verbatim quote with a source id from that seat's brain. diff --git a/README.md b/README.md index 7820fd9..9ecb0fa 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![The Roast Room](docs/room.jpg) -Bring a hard business decision and seven AI advisors argue it out, then hand you a scored verdict and a one-click PDF. The seats are Jeff Bezos, Paul Graham, Alex Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, and Warren Buffett, each built from that person's public work: their letters, essays, talks, and videos. The council runs in Claude Code, and a small local web app shows them around a table talking it through. +Bring a hard business decision and seven AI advisors argue it out, then hand you a scored verdict and a one-click PDF. The seats are Jeff Bezos, Paul Graham, Alex Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, and Warren Buffett, each built from that person's public work: their letters, essays, talks, and videos. The council runs in Claude Code, and a small local web app shows them around a table talking it through. Want someone else at the table? Type `/newroaster` and a name, and Claude builds that advisor the same way. | Seat | Pillar | The question they own | |---|---|---| @@ -63,20 +63,76 @@ More ways to run it: - `/roast-room --quick ...` seats four advisors for two rounds. Use it for smaller, reversible calls. It uses far less of your plan. - `/roast-room --seats hormozi,buffett ...` seats only the advisors you name. - `/roast-room ask hormozi ...` gets one answer from one seat. +- `/roast-room --all ...` seats every advisor you have (up to nine). +- `/roast-room board` shows who sits at the table by default and lets you change it. The room is optional. The council runs the same in Claude Code without it. +## Choose who sits at the table + +Out of the box, every council seats the same seven advisors: your **default board**. It lives in `.claude/skills/roast-room/roster.json`: + +```json +{ + "board": "default", + "default": ["bezos", "graham", "hormozi", "garyvee", "martell", "wickman", "buffett"], + "seats": [ ...every advisor you have... ] +} +``` + +`"board"` decides how each council picks its seats: + +| Setting | What happens on every `/roast-room` | +|---|---| +| `"default"` (out of the box) | The default board sits. No questions. | +| `"ask"` | The Chair shows your advisors and asks: keep the default board, let the Chair pick, or name the seats. | +| `"auto"` | The Chair picks the best seats for this decision from everyone you have (up to seven, always including a money or risk seat) and tells you who and why. | + +You don't need to edit the file by hand. Type `/roast-room board` and say what you want: "put Naval on my default board", "take Gary V off", or "ask me every time". + +One run can always override the board: `--seats hormozi,naval,buffett` seats exactly those advisors, `--all` seats everyone, and `--quick` picks four from whoever is seated. A table holds up to nine. + +## Add your own advisor + +``` +/newroaster Naval Ravikant +``` + +Claude builds a new seat the way the original seven were built: + +1. **Asks two or three questions**: the business pillar and question the advisor owns (it suggests one), whether they join your default board, and how deep to go. +2. **Finds their public work**: essays, letters, talks, long interviews, and podcasts where they are the main speaker. +3. **Fetches it** into `build/<name>/`, a local folder git ignores. Web pages become text and YouTube videos become transcripts. +4. **Extracts how they think**: parallel sub-agents read every source and pull out their frameworks, rules, positions, stories, and voice, with verbatim quotes. +5. **Writes the brain** (`.claude/skills/roast-room/brains/<name>/`) and checks that every quote is word for word in the source it cites. +6. **Writes the advisor's agent** (`.claude/agents/council-<name>.md`) and adds them to `roster.json`. +7. **Tests the new seat** on a sample question, then tells you how to use it. + +| Depth | Sources | Good for | +|---|---|---| +| `--quick` | 12 to 20 | Trying someone out | +| default | 30 to 50 | An advisor you'll use | +| `--deep` | 80+ | Matching the original seven | + +A standard build is about 8 to 10 sub-agent runs, so it uses a real share of your plan. When it finishes, open a new Claude Code session so the advisor loads as its own agent (the council works before that too). Then use them like anyone else: `/roast-room ask naval ...`, `/roast-room --seats naval,buffett,hormozi ...`, or put them on your default board. + +You can build an advisor from public figures, living or historical, with a real body of public work, or from your own material (your posts, transcripts, notes) if you want yourself or a consenting mentor on the board. The raw sources stay on your machine; only the brain, which holds short quotes and paraphrase, is meant to be committed. + +**Their face in the room:** a new advisor shows up as a simple cartoon bust in their color, and their mouth moves when they talk. For a real portrait, save a square image with a transparent background as `app/public/portraits/<name>-base.png` (`.webp` and `.jpg` work too). Add `-open`, `-mid`, and `-blink` versions of the same image for a talking animation. + +YouTube transcripts work best with [yt-dlp](https://github.com/yt-dlp/yt-dlp) installed, and PDFs need `pdftotext` ([Poppler](https://poppler.freedesktop.org)). Both are optional: without them, Claude falls back to YouTube's own captions and reads PDFs itself. + ## Watch an example first Run `npm start`, open http://localhost:4730, and click **Past sessions**. Three finished councils ship with the repo, so you can see how it works (and download their PDFs) before you run your own. ## How it works -- **The council runs in Claude Code.** Each seat is a sub-agent (`.claude/agents/council-*.md`) that reads its own brain (`.claude/skills/roast-room/brains/<name>/`): frameworks, principles, positions, stories, and voice notes compiled from public sources, with every quote tied to a source. Claude Code acts as the Chair. It runs the rounds, keeps score, and writes the verdict (`.claude/skills/roast-room/SKILL.md`). +- **The council runs in Claude Code.** Each seat is a sub-agent (`.claude/agents/council-*.md`, listed in `roster.json`) that reads its own brain (`.claude/skills/roast-room/brains/<name>/`): frameworks, principles, positions, stories, and voice notes compiled from public sources, with every quote tied to a source. Claude Code acts as the Chair. It runs the rounds, keeps score, and writes the verdict (`.claude/skills/roast-room/SKILL.md`). - **Each seat scores every option**, weighted by how much that seat's pillar matters to your decision. The Chair caps the verdict when a seat flags ruin risk, and it forces a real argument when everyone agrees too fast. - **The room only watches.** As the Chair works, it writes each step to `sessions/`, and the app plays those files back. Between rounds it shows which round is running, how long it has been, and what each advisor is weighing. The room makes no AI calls of its own. - **Every council is saved** in `sessions/`. Past sessions replays any of them and downloads its PDF. -- **Usage:** a full council is 21 sub-agent runs, so it takes a real bite out of your plan's usage. Use `--quick` for small calls. +- **Usage:** a full council is three sub-agent runs per seat (21 for seven), so it takes a real bite out of your plan's usage. Use `--quick` for small calls. ## Optional: let the room run councils itself @@ -86,13 +142,16 @@ If you'd rather type a decision straight into the room, copy `.env.example` to ` | Path | What | |---|---| -| `.claude/skills/roast-room/` | The skill: protocol, prompts, scoring, report template, and the seven brains | -| `.claude/agents/` | The seven seat agents | +| `.claude/skills/roast-room/` | The council skill: protocol, prompts, scoring, report template, and one brain per advisor | +| `.claude/skills/roast-room/roster.json` | Every advisor, your default board, and how the board is picked | +| `.claude/skills/newroaster/` | The `/newroaster` skill and its scripts: fetch sources, check quotes, register a seat | +| `.claude/agents/` | One agent per advisor (`council-<name>.md`) | | `app/` | The room: a zero-dependency Node server, the web page, and the PDF builder | | `sessions/` | Your councils (kept out of git) and the three examples | +| `build/` | Raw sources `/newroaster` fetched (kept out of git) | ## About the advisors -These are simulations built from each person's public work. They are not the people, they don't speak for them, and none of them is affiliated with or endorses this project. A seat only quotes a person verbatim when the line is in its brain with a source, and `python .claude/skills/roast-room/scripts/check_quotes.py sessions/<session>` checks every quote in a council against the brains. Each brain's `sources.md` lists what it was built from. +These are simulations built from each person's public work, and so is any advisor you add. They are not the people, they don't speak for them, and none of them is affiliated with or endorses this project. A seat only quotes a person verbatim when the line is in its brain with a source, and `python .claude/skills/roast-room/scripts/check_quotes.py sessions/<session>` checks every quote in a council against the brains. Each brain's `sources.md` lists what it was built from. Built by AI Automation Society. The code is MIT licensed; see `LICENSE`. The PDF builder bundles [jsPDF](https://github.com/parallax/jsPDF) (MIT) and [Montserrat](https://github.com/JulietaUla/Montserrat) (SIL Open Font License); their licenses sit next to them in `app/public/`. diff --git a/app/lib/council.mjs b/app/lib/council.mjs index be50b09..5a722b4 100644 --- a/app/lib/council.mjs +++ b/app/lib/council.mjs @@ -1,6 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import { SEATS, byKey, systemFor, parseCard, checkQuotes } from "./seats.mjs"; +import { byKey, systemFor, parseCard, checkQuotes, defaultBoard } from "./seats.mjs"; import * as ai from "./anthropic.mjs"; import { S } from "./anthropic.mjs"; import { SESSIONS_DIR } from "./env.mjs"; @@ -10,8 +10,12 @@ export const MODELS = { chair: process.env.CHAIR_MODEL || "claude-opus-5-5", }; -const CHAIR_SYSTEM = `You are the Chair of a Roast Room council: seven simulated advisors built from the public work of Jeff Bezos (strategy and decisions), Paul Graham (product and startups), Alex Hormozi (offers, pricing, and sales), Gary Vaynerchuk (marketing and attention), Dan Martell (people, hiring, and founder time), Gino Wickman (operations and scaling), and Warren Buffett (money and capital). -You never argue a side and never add your own pillar. You run the room, keep score, and write in plain English: short sentences, no em dashes, no hype, no tee-ups like "here's the thing", no filler. Seat keys (for key fields only): bezos, graham, hormozi, garyvee, martell, wickman, buffett. Whenever you write a seat's name in prose or in a seat field, use its display name: Bezos, Graham, Hormozi, Gary V, Martell, Wickman, Buffett.`; +// The board comes from the roster: the saved default board, or every seat it lists. +const chairSystem = (st) => { + const seats = st.board.map((k) => byKey[k]); + return `You are the Chair of a Roast Room council: ${seats.length} simulated advisors built from the public work of ${seats.map((x) => `${x.name} (${x.pillar.toLowerCase()})`).join(", ")}. +You never argue a side and never add your own pillar. You run the room, keep score, and write in plain English: short sentences, no em dashes, no hype, no tee-ups like "here's the thing", no filler. Seat keys (for key fields only): ${seats.map((x) => x.key).join(", ")}. Whenever you write a seat's name in prose or in a seat field, use its display name: ${seats.map((x) => x.short).join(", ")}.`; +}; export const DISCLAIMER = "Simulated advisors built from each person's public work. They are not the people and do not speak for them."; @@ -187,11 +191,11 @@ async function chairSetup(st) { brief: S.str, options: S.arr(S.obj({ id: S.enum("A", "B", "C", "D"), label: S.str })), assumptions: S.arr(S.str), - weights: S.arr(S.obj({ seat: S.enum(...SEATS.map((s) => s.key)), weight: S.int, reason: S.str })), - quick_seats: S.arr(S.enum(...SEATS.map((s) => s.key))), + weights: S.arr(S.obj({ seat: S.enum(...st.board), weight: S.int, reason: S.str })), + quick_seats: S.arr(S.enum(...st.board)), }); return ai.json({ - model: MODELS.chair, system: CHAIR_SYSTEM, schema, maxTokens: 3000, + model: MODELS.chair, system: chairSystem(st), schema, maxTokens: 3000, prompt: `A founder brought this to the council: """${st.prompt}""" @@ -203,19 +207,19 @@ Set up the room. - brief: under 200 words covering the business, resources, what success looks like, and the founder's lean, using only what the founder said. Do not invent facts. - assumptions: any number or fact you had to assume to make the brief usable, each one line. Keep it to what matters. - weights: one entry for every seat, weight 1 to 3 (3 = the decision lives in this pillar, 2 = materially affected, 1 = touched at the edges). Exactly one or two seats at 3. Reason in one line. -- quick_seats: the four seats for a quick council: the two highest-weight seats, Buffett or Bezos as the downside check (whichever is not already in), and the seat most likely to disagree with the others.`, +- quick_seats: the four seats for a quick council: the two highest-weight seats, the seat that guards the downside (money, capital, or risk) if it is not already in, and the seat most likely to disagree with the others.`, }); } async function chairCruxes(st) { const schema = S.obj({ - cruxes: S.arr(S.obj({ question: S.str, sides: S.arr(S.obj({ position: S.str, seats: S.arr(S.enum(...SEATS.map((s) => s.key))) })) })), + cruxes: S.arr(S.obj({ question: S.str, sides: S.arr(S.obj({ position: S.str, seats: S.arr(S.enum(...st.board)) })) })), unanimous: S.bool, note: S.str, - pressure: S.arr(S.obj({ seat: S.enum(...SEATS.map((s) => s.key)), ask: S.str })), + pressure: S.arr(S.obj({ seat: S.enum(...st.board), ask: S.str })), }); return ai.json({ - model: MODELS.chair, system: CHAIR_SYSTEM, schema, maxTokens: 3000, + model: MODELS.chair, system: chairSystem(st), schema, maxTokens: 3000, prompt: `${briefBlock(st)} ROUND 1 CARDS @@ -239,7 +243,7 @@ async function chairDraft(st, interim) { kill_criteria: S.str, }); return ai.json({ - model: MODELS.chair, system: CHAIR_SYSTEM, schema, maxTokens: 3000, + model: MODELS.chair, system: chairSystem(st), schema, maxTokens: 3000, prompt: `${briefBlock(st)} ROUND 2 CARDS (the debate) @@ -269,7 +273,7 @@ async function chairVerdict(st, finalScores, recommended) { revisit: S.str, }); return ai.json({ - model: MODELS.chair, system: CHAIR_SYSTEM, schema, maxTokens: 5000, + model: MODELS.chair, system: chairSystem(st), schema, maxTokens: 5000, prompt: `${briefBlock(st)} CRUXES: ${JSON.stringify(st.cruxes)} @@ -336,18 +340,18 @@ export function startCouncil(prompt, mode = "full") { } async function run(s) { - const st = (s.state = { prompt: s.prompt, mode: s.mode, cards: { 1: {}, 2: {}, 3: {} }, scores: {}, rounds: [] }); + const st = (s.state = { prompt: s.prompt, mode: s.mode, board: defaultBoard(), cards: { 1: {}, 2: {}, 3: {} }, scores: {}, rounds: [] }); emit(s, "phase", { phase: "setup", label: "The Chair is reading your question" }); const setup = await chairSetup(st); Object.assign(st, { title: setup.title, decision: setup.decision, brief: setup.brief, options: setup.options, assumptions: setup.assumptions, - weights: Object.fromEntries(SEATS.map((x) => [x.key, { weight: 1, reason: "" }])), + weights: Object.fromEntries(st.board.map((k) => [k, { weight: 1, reason: "" }])), }); - for (const w of setup.weights) st.weights[w.seat] = { weight: Math.max(1, Math.min(3, w.weight)), reason: w.reason }; - st.seats = s.mode === "quick" ? [...new Set(setup.quick_seats)].slice(0, 4) : SEATS.map((x) => x.key); + for (const w of setup.weights) if (st.weights[w.seat]) st.weights[w.seat] = { weight: Math.max(1, Math.min(3, w.weight)), reason: w.reason }; + st.seats = s.mode === "quick" ? [...new Set(setup.quick_seats)].filter((k) => st.board.includes(k)).slice(0, 4) : st.board.slice(); if (s.mode === "quick" && st.seats.length < 4) { - for (const x of SEATS) if (st.seats.length < 4 && !st.seats.includes(x.key)) st.seats.push(x.key); + for (const k of st.board) if (st.seats.length < 4 && !st.seats.includes(k)) st.seats.push(k); } emit(s, "setup", { title: st.title, decision: st.decision, brief: st.brief, options: st.options, assumptions: st.assumptions, weights: st.weights, seats: st.seats, mode: s.mode }); @@ -432,7 +436,7 @@ export function save(s) { fs.mkdirSync(dir, { recursive: true }); fs.writeFileSync(path.join(dir, "events.json"), JSON.stringify({ id: s.id, prompt: s.prompt, mode: s.mode, status: s.status, title: st.title, events: s.events }, null, 1)); if (st.options) { - const lines = [`# ${st.title}`, "", `Asked: ${s.prompt}`, "", st.brief, "", "Options:", ...st.options.map((o) => `- ${o.id}: ${o.label}`), "", "Assumptions:", ...(st.assumptions || []).map((a) => `- ${a}`), "", "| Seat | Weight | Reason |", "|---|---|---|", ...SEATS.map((x) => `| ${x.short} | ${st.weights[x.key].weight} | ${st.weights[x.key].reason} |`)]; + const lines = [`# ${st.title}`, "", `Asked: ${s.prompt}`, "", st.brief, "", "Options:", ...st.options.map((o) => `- ${o.id}: ${o.label}`), "", "Assumptions:", ...(st.assumptions || []).map((a) => `- ${a}`), "", "| Seat | Weight | Reason |", "|---|---|---|", ...st.seats.map((k) => `| ${byKey[k].short} | ${st.weights[k].weight} | ${st.weights[k].reason} |`)]; fs.writeFileSync(path.join(dir, "brief.md"), lines.join("\n") + "\n"); } for (const r of st.rounds || []) { diff --git a/app/lib/env.mjs b/app/lib/env.mjs index 6ed6e08..60da1b6 100644 --- a/app/lib/env.mjs +++ b/app/lib/env.mjs @@ -8,6 +8,7 @@ export const APP_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url) const KIT = fs.existsSync(path.join(APP_ROOT, "..", ".claude", "skills", "roast-room")); export const REPO_ROOT = KIT ? path.resolve(APP_ROOT, "..") : path.resolve(APP_ROOT, "..", ".."); export const BRAINS_DIR = path.join(REPO_ROOT, ".claude", "skills", "roast-room", "brains"); +export const ROSTER = path.join(REPO_ROOT, ".claude", "skills", "roast-room", "roster.json"); export const AGENTS_DIR = path.join(REPO_ROOT, ".claude", "agents"); export const SESSIONS_DIR = KIT ? path.join(REPO_ROOT, "sessions") : path.join(REPO_ROOT, "projects", "founder-council", "sessions"); diff --git a/app/lib/seats.mjs b/app/lib/seats.mjs index 0ff0849..88c93dc 100644 --- a/app/lib/seats.mjs +++ b/app/lib/seats.mjs @@ -1,17 +1,33 @@ import fs from "node:fs"; import path from "node:path"; -import { AGENTS_DIR, BRAINS_DIR } from "./env.mjs"; +import { AGENTS_DIR, BRAINS_DIR, ROSTER } from "./env.mjs"; -export const SEATS = [ - { key: "bezos", name: "Jeff Bezos", short: "Bezos", initials: "JB", slug: "jeff-bezos", pillar: "Strategy and decisions", question: "Is this the right bet, and how reversible is it?", dimension: "Strategic fit and reversibility", color: "#e8a33d" }, - { key: "graham", name: "Paul Graham", short: "Graham", initials: "PG", slug: "paul-graham", pillar: "Product and startups", question: "Is this something people actually want, and is it growing?", dimension: "Real demand and growth", color: "#f06b3f" }, - { key: "hormozi", name: "Alex Hormozi", short: "Hormozi", initials: "AH", slug: "alex-hormozi", pillar: "Offers, pricing, and sales", question: "Will people pay, how much, and how do we close?", dimension: "Offer strength and unit economics", color: "#d94a6a" }, - { key: "garyvee", name: "Gary Vaynerchuk", short: "Gary V", initials: "GV", slug: "gary-vaynerchuk", pillar: "Marketing and attention", question: "Where does the attention come from, and is it underpriced?", dimension: "Attention and distribution", color: "#9b5de5" }, - { key: "martell", name: "Dan Martell", short: "Martell", initials: "DM", slug: "dan-martell", pillar: "People, hiring, and founder time", question: "Who does this, and what does it cost the founder's calendar?", dimension: "Team capacity and founder time", color: "#3d8bfd" }, - { key: "wickman", name: "Gino Wickman", short: "Wickman", initials: "GW", slug: "gino-wickman", pillar: "Operations and scaling", question: "Can the business run this without the founder holding it together?", dimension: "Operational readiness", color: "#1fa67a" }, - { key: "buffett", name: "Warren Buffett", short: "Buffett", initials: "WB", slug: "warren-buffett", pillar: "Money and capital", question: "What does it do to cash, risk, and long-term value?", dimension: "Downside and capital efficiency", color: "#4c6a92" }, -]; -export const byKey = Object.fromEntries(SEATS.map((s) => [s.key, s])); +// Every seat lives in the skill's roster.json (the /newroaster skill adds to it). SEATS and +// byKey are filled in place, so a seat added while the room is running shows up on the next +// read without a restart. +export const SEATS = []; +export const byKey = {}; +export const BOARD = { mode: "default", default: [] }; +let rosterStamp = 0; +export function loadRoster() { + let stat; + try { stat = fs.statSync(ROSTER); } catch { throw new Error(`roster not found at ${ROSTER}`); } + if (stat.mtimeMs === rosterStamp && SEATS.length) return SEATS; + const r = JSON.parse(fs.readFileSync(ROSTER, "utf8")); + const seats = (r.seats || []).filter((s) => s.key && s.slug && fs.existsSync(path.join(AGENTS_DIR, `council-${s.key}.md`))); + SEATS.splice(0, SEATS.length, ...seats); + for (const k of Object.keys(byKey)) delete byKey[k]; + for (const s of SEATS) byKey[s.key] = s; + BOARD.mode = ["default", "ask", "auto"].includes(r.board) ? r.board : "default"; + const def = (r.default || []).filter((k) => byKey[k]); + BOARD.default = def.length ? def : SEATS.slice(0, 7).map((s) => s.key); + rosterStamp = stat.mtimeMs; + for (const k of [...systemCache.keys()]) if (!byKey[k]) systemCache.delete(k); + brainText.clear(); + return SEATS; +} +/** The seats at the table when no one picked: the saved default board. */ +export const defaultBoard = () => (loadRoster(), BOARD.default.slice()); const read = (p) => (fs.existsSync(p) ? fs.readFileSync(p, "utf8") : ""); const stripFront = (t) => t.replace(/^---[\s\S]*?\n---\n/, ""); @@ -109,3 +125,5 @@ export function parseCard(text, optionIds) { thisWeek: field(text, "WHAT I'D DO THIS WEEK"), }; } + +loadRoster(); diff --git a/app/lib/watch.mjs b/app/lib/watch.mjs index 411a311..a4da4ca 100644 --- a/app/lib/watch.mjs +++ b/app/lib/watch.mjs @@ -8,7 +8,7 @@ // verdict.json -> the verdict import fs from "node:fs"; import path from "node:path"; -import { SEATS, byKey, parseCard, checkQuotes } from "./seats.mjs"; +import { SEATS, byKey, parseCard, checkQuotes, loadRoster, defaultBoard } from "./seats.mjs"; import { SESSIONS_DIR } from "./env.mjs"; import { optionScores, finalNumbers, verdictSeats, DISCLAIMER } from "./council.mjs"; @@ -62,6 +62,7 @@ function finish(x, status) { function normalizeSetup(c) { const options = (c.options || []).map((o, i) => (typeof o === "string" ? { id: "ABCD"[i], label: o } : { id: String(o.id || "ABCD"[i]).toUpperCase(), label: o.label || o.text || "" })); + loadRoster(); // pick up a seat added since the room started const weights = Object.fromEntries(SEATS.map((s) => [s.key, { weight: 1, reason: "" }])); const wl = Array.isArray(c.weights) ? c.weights : Object.entries(c.weights || {}).map(([seat, w]) => (typeof w === "number" ? { seat, weight: w } : { seat, ...w })); for (const w of wl) { const k = seatKey(w.seat); if (k) weights[k] = { weight: Math.max(1, Math.min(3, Number(w.weight) || 1)), reason: w.reason || "" }; } @@ -70,7 +71,7 @@ function normalizeSetup(c) { return { title: c.title || "Roast Room", decision: c.decision || "", brief: c.brief || "", mode, options, assumptions: c.assumptions || [], weights, - seats: seats.length ? [...new Set(seats)] : SEATS.map((s) => s.key), + seats: seats.length ? [...new Set(seats)] : defaultBoard(), }; } diff --git a/app/public/app.js b/app/public/app.js index 58367f4..5863469 100644 --- a/app/public/app.js +++ b/app/public/app.js @@ -47,30 +47,61 @@ const GUIDE = ` <div class="guide-sec"> <h4>Good to know</h4> <ul> - <li><span><b>Full council:</b> 7 advisors, 3 rounds. For big calls that are hard to undo.</span></li> + <li><span><b>Full council:</b> your default board (the 7 advisors out of the box), 3 rounds. For big calls that are hard to undo.</span></li> <li><span><b>Quick:</b> add <code>--quick</code> for 4 advisors and 2 rounds. Uses far less of your plan.</span></li> <li><span><b>Every council is saved.</b> Open Past sessions to replay one or download its PDF.</span></li> + <li><span><b>Add an advisor:</b> type <code>/newroaster</code> and a name. Change who sits at the table with <code>/roast-room board</code>.</span></li> </ul> </div> </div>`; const SHAPES = ["base", "open", "mid", "blink"]; -const portrait = (key, shape = "base") => `/portraits/${key}-${shape}.webp`; +// A seat's cartoon frames live in /portraits/<key>-<shape>.webp (or .png, .jpg). A seat added with /newroaster +// may have only a base frame, or none: missing frames fall back to the base frame, then to a +// drawn bust in the seat's color whose mouth and eyes still move. +const portrait = (key, shape = "base") => { + const have = state.byKey[key]?.portraits || {}; + return have[shape] || have.base || drawnBust(key, shape); +}; +const bustCache = new Map(); +function drawnBust(key, shape) { + const id = `${key}-${shape}`; + if (bustCache.has(id)) return bustCache.get(id); + const s = state.byKey[key] || {}; + const c = /^#[0-9a-f]{6}$/i.test(s.color || "") ? s.color : "#37bdf8"; + const initials = esc((s.initials || s.short || key).slice(0, 3).toUpperCase()); + const eyes = shape === "blink" + ? `<path d="M226 250h30M304 250h30" stroke="#1d2733" stroke-width="7" stroke-linecap="round"/>` + : `<circle cx="241" cy="250" r="11" fill="#1d2733"/><circle cx="319" cy="250" r="11" fill="#1d2733"/><circle cx="245" cy="246" r="3.5" fill="#fff"/><circle cx="323" cy="246" r="3.5" fill="#fff"/>`; + const mouth = shape === "open" ? `<ellipse cx="280" cy="318" rx="24" ry="17" fill="#5a2430"/>` + : shape === "mid" ? `<ellipse cx="280" cy="316" rx="20" ry="8" fill="#5a2430"/>` + : `<path d="M256 312q24 16 48 0" fill="none" stroke="#5a2430" stroke-width="7" stroke-linecap="round"/>`; + const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 560 560"><g transform="translate(-14 -64) scale(1.05)"> + <path d="M70 640c0-160 86-250 210-250s210 90 210 250z" fill="${c}"/> + <path d="M232 384h96l-48 58z" fill="#e9eef3"/> + <rect x="248" y="330" width="64" height="70" rx="22" fill="#d9b49a"/> + <ellipse cx="280" cy="250" rx="112" ry="128" fill="#e8c4a8"/> + <path d="M168 236c0-90 50-122 112-122s112 32 112 122c-20-46-60-64-112-64s-92 18-112 64z" fill="#3a4654"/> + ${eyes}${mouth} + <text x="280" y="540" text-anchor="middle" font-family="Montserrat, Arial, sans-serif" font-weight="800" font-size="54" fill="rgba(255,255,255,.92)">${initials}</text> + </g></svg>`; + const url = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg); + bustCache.set(id, url); + return url; +} const ROUND_NAME = ["", "Opening", "Debate", "Vote"]; const state = { - seats: [], byKey: {}, session: null, options: [], weights: {}, active: [], round: 0, + seats: [], byKey: {}, board: [], table: [], session: null, options: [], weights: {}, active: [], round: 0, cards: { 1: {}, 2: {}, 3: {} }, replaying: false, verdict: null, links: [], geo: {}, setup: null, wait: null, }; // ------------------------------------------------------------- boot async function boot() { - const r = await fetch("/api/seats").then((x) => x.json()); - state.seats = r.seats; - state.byKey = Object.fromEntries(r.seats.map((s) => [s.key, s])); + const r = await refreshSeats(); state.runner = r.runner; if (r.runner === "api" && !r.hasKey) toast("No ANTHROPIC_API_KEY found in .env. Add it and restart the server."); - renderSeats(); + renderSeats(state.board); renderSamples(); bindUI(); new ResizeObserver(() => { layoutStage(); drawLinks(); }).observe($("#stage")); @@ -86,6 +117,17 @@ async function boot() { setInterval(tickWait, 1000); } +// The roster (every seat, plus the default board) comes from the skill's roster.json. +async function refreshSeats() { + const r = await fetch("/api/seats").then((x) => x.json()); + state.seats = r.seats; + state.byKey = Object.fromEntries(r.seats.map((s) => [s.key, s])); + state.board = (r.board?.default || []).filter((k) => state.byKey[k]); + if (!state.board.length) state.board = r.seats.slice(0, 7).map((s) => s.key); + bustCache.clear(); + return r; +} + // a council started in Claude Code shows up here on its own const seenLive = new Set(); async function watchForLive() { @@ -116,19 +158,28 @@ function renderSamples() { }); } -function renderSeats() { - $("#seats").innerHTML = state.seats.map((s, i) => ` +const MAX_TABLE = 9; // the most busts the table can seat and still read + +/** Seat these keys at the table (roster order). Does nothing when they are already seated. */ +function renderSeats(keys) { + const order = state.seats.map((s) => s.key); + const want = order.filter((k) => keys.includes(k)).slice(0, MAX_TABLE); + if (want.join() === state.table.join() && $("#seats").children.length) return; + state.table = want; + const seats = want.map((k) => state.byKey[k]); + $("#seats").innerHTML = seats.map((s, i) => ` <div class="seat" id="seat-${s.key}" data-seat="${s.key}" style="--d:-${(i * 1.7) % 6}s" tabindex="0" role="button" aria-label="${esc(s.name)}, ${esc(s.pillar)}. Open card."> <div class="think" aria-hidden="true"><i></i><i></i><i></i></div> <div class="bust" data-shape="base">${SHAPES.map((sh) => `<img class="${sh}" src="${portrait(s.key, sh)}" alt="" draggable="false">`).join("")}</div> </div>`).join(""); - $("#plates").innerHTML = state.seats.map((s) => ` + $("#plates").innerHTML = seats.map((s) => ` <div class="nameplate" id="plate-${s.key}" data-seat="${s.key}"> <b>${esc(s.short === "Gary V" ? "Gary V" : s.name)}</b> <small>${esc(s.pillar)}</small> <div class="meta"><span class="pips" title="Weight on this decision"></span><span class="chip" hidden></span><span class="score" hidden></span></div> </div>`).join(""); layoutStage(); + startBlinking(); } // The table is an ellipse seen from the front. Seats sit along its far edge: the @@ -142,11 +193,16 @@ function layoutStage() { const t = $("#table"); Object.assign(t.style, { left: `${cx - rx}px`, top: `${cy - ry}px`, width: `${rx * 2}px`, height: `${ry * 2}px` }); const edge = (x) => cy - ry * Math.sqrt(Math.max(0, 1 - ((x - cx) / rx) ** 2)); - const xs = [0.085, 0.222, 0.361, 0.5, 0.639, 0.778, 0.915]; - state.seats.forEach((s, i) => { + // seats spread evenly along the far edge; past seven they shrink to fit + const n = state.table.length; + const xs = n === 1 ? [0.5] : state.table.map((_, i) => 0.085 + (0.83 * i) / (n - 1)); + const fit = Math.min(1, 6 / Math.max(1, n - 1)); + state.geo = {}; + state.table.forEach((k, i) => { + const s = state.byKey[k]; const x = W * xs[i]; const d = ((x - cx) / rx) ** 2; - const size = H * (narrow ? 0.5 + 0.08 * d : 0.37 + 0.07 * d); + const size = H * (narrow ? 0.5 + 0.08 * d : 0.37 + 0.07 * d) * fit; const bottom = edge(x) + size * 0.2; const el = $(`#seat-${s.key}`); Object.assign(el.style, { left: `${x - size / 2}px`, top: `${bottom - size}px`, width: `${size}px`, height: `${size}px`, zIndex: 10 + Math.round(d * 10) }); @@ -161,7 +217,7 @@ function layoutStage() { } else { stage.style.paddingTop = ""; // the captions start below the lowest nameplate they could collide with - const inner = [1, 2, 3, 4, 5].map((i) => $(`#plate-${state.seats[i].key}`)); + const inner = (n > 2 ? state.table.slice(1, -1) : state.table).map((k) => $(`#plate-${k}`)); const top = Math.max(...inner.map((p) => p.offsetTop + p.offsetHeight / 2)) + H * 0.035; Object.assign(c.style, { left: `${W * 0.2}px`, width: `${W * 0.6}px`, top: `${top}px`, height: `${H - top - H * 0.09}px` }); } @@ -268,6 +324,7 @@ function reset() { $("#panelHead").textContent = "Getting started"; $("#feed").innerHTML = GUIDE; $$(".vote").forEach((b) => b.remove()); + renderSeats(state.board); $$(".seat").forEach((el) => { el.classList.remove("absent", "speaking", "thinking", "addressed"); $(".bust", el).dataset.shape = "base"; }); $$(".nameplate").forEach((el) => { el.classList.remove("absent", "speaking"); $(".chip", el).hidden = true; $(".score", el).hidden = true; $(".pips", el).innerHTML = ""; }); $("#spot").classList.remove("on"); @@ -329,7 +386,7 @@ async function handle(ev) { } break; } - case "setup": state.setup = ev; onSetup(ev); await player.sleep(1800); break; + case "setup": state.setup = ev; await onSetup(ev); await player.sleep(1800); break; case "round_start": onRoundStart(ev.round); break; case "seat_start": $(`#seat-${ev.seat}`)?.classList.add("thinking"); break; case "seat_done": await onSeatDone(ev); break; @@ -341,7 +398,11 @@ async function handle(ev) { } } -function onSetup(ev) { +async function onSetup(ev) { + if (ev.seats.some((k) => !state.byKey[k])) await refreshSeats(); // a seat added since the page loaded + // seat the default board plus anyone this council called in; past the table's limit, only this council + const both = [...new Set([...state.board, ...ev.seats])]; + renderSeats(both.length <= MAX_TABLE ? both : ev.seats); state.options = ev.options; state.weights = ev.weights; state.active = ev.seats; @@ -350,7 +411,7 @@ function onSetup(ev) { typeIn($("#topicTitle")); $("#options").innerHTML = ev.options.map((o) => ` <div class="opt" data-opt="${o.id}"><span class="id">${o.id}</span><span class="label">${esc(o.label)}</span><span class="val">-</span><span class="bar"><i></i></span></div>`).join(""); - for (const s of state.seats) { + for (const s of state.table.map((k) => state.byKey[k])) { const absent = !ev.seats.includes(s.key); $(`#seat-${s.key}`).classList.toggle("absent", absent); const pl = $(`#plate-${s.key}`); @@ -478,6 +539,7 @@ async function speak(key, text, { tag = "", target = null, sub = "" } = {}) { } // idle blinking for everyone, so the room feels alive between lines +const blinking = new Set(); function startBlinking() { const blink = (key) => { const b = $(`#seat-${key} .bust`); @@ -487,7 +549,7 @@ function startBlinking() { } setTimeout(() => blink(key), 2400 + Math.random() * 4200); }; - state.seats.forEach((s, i) => setTimeout(() => blink(s.key), 600 + i * 530)); + state.table.filter((k) => !blinking.has(k)).forEach((k, i) => { blinking.add(k); setTimeout(() => blink(k), 600 + i * 530); }); } async function onSeatDone(ev) { @@ -773,7 +835,7 @@ function tickWait() { const bar = $("#wcBar").parentElement; const muse = $("#wcMuse"); if (round) { - const seats = state.active.length ? state.active : state.seats.map((s) => s.key); + const seats = state.active.length ? state.active : state.table; const done = seats.filter((k) => state.cards[round][k]).length; bar.classList.toggle("indeterminate", done === 0); $("#wcBar").style.width = done ? Math.round((done / seats.length) * 100) + "%" : ""; diff --git a/app/server.mjs b/app/server.mjs index 65de440..67585df 100644 --- a/app/server.mjs +++ b/app/server.mjs @@ -2,14 +2,14 @@ import http from "node:http"; import fs from "node:fs"; import path from "node:path"; import { APP_ROOT, env } from "./lib/env.mjs"; -import { SEATS } from "./lib/seats.mjs"; +import { loadRoster, BOARD } from "./lib/seats.mjs"; import { startCouncil, getSession, subscribe, listSaved, loadSaved, MODELS } from "./lib/council.mjs"; import { usage } from "./lib/anthropic.mjs"; import * as watch from "./lib/watch.mjs"; const PORT = Number(process.env.PORT) || 4730; const PUBLIC = path.join(APP_ROOT, "public"); -const TYPES = { ".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".css": "text/css; charset=utf-8", ".svg": "image/svg+xml", ".png": "image/png", ".webp": "image/webp", ".ico": "image/x-icon", ".json": "application/json", ".ttf": "font/ttf", ".txt": "text/plain; charset=utf-8" }; +const TYPES = { ".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".css": "text/css; charset=utf-8", ".svg": "image/svg+xml", ".png": "image/png", ".webp": "image/webp", ".jpg": "image/jpeg", ".ico": "image/x-icon", ".json": "application/json", ".ttf": "font/ttf", ".txt": "text/plain; charset=utf-8" }; let running = null; // one council at a time (API runner) @@ -33,7 +33,12 @@ const server = http.createServer(async (req, res) => { const url = new URL(req.url, `http://${req.headers.host}`); const p = url.pathname; try { - if (p === "/api/seats") return send(res, 200, { seats: SEATS, models: MODELS, runner: RUNNER, hasKey: Boolean(env("ANTHROPIC_API_KEY")) }); + if (p === "/api/seats") { + // portraits: which of the four mouth shapes exist for each seat (a seat with none gets a drawn bust) + const frame = (key, sh) => ["webp", "png", "jpg"].map((x) => `${key}-${sh}.${x}`).find((f) => fs.existsSync(path.join(PUBLIC, "portraits", f))); + const seats = loadRoster().map((s) => ({ ...s, portraits: Object.fromEntries(["base", "open", "mid", "blink"].map((sh) => [sh, frame(s.key, sh)]).filter(([, f]) => f).map(([sh, f]) => [sh, `/portraits/${f}`])) })); + return send(res, 200, { seats, board: BOARD, models: MODELS, runner: RUNNER, hasKey: Boolean(env("ANTHROPIC_API_KEY")) }); + } if (p === "/api/usage") return send(res, 200, usage); if (p === "/api/council" && req.method === "POST") { if (RUNNER !== "api") return send(res, 403, { error: "This room is a viewer. Run /roast-room in Claude Code, or set COUNCIL_RUNNER=api in .env." }); diff --git a/package.json b/package.json index e92601e..1e21248 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "roast-room", "version": "1.0.0", "private": true, - "description": "The Roast Room: seven AI advisors built from the public work of Bezos, Paul Graham, Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, and Buffett debate your decision in Claude Code, live around a table.", + "description": "The Roast Room: AI advisors built from the public work of Bezos, Paul Graham, Hormozi, Gary Vaynerchuk, Dan Martell, Gino Wickman, and Buffett (plus any you add with /newroaster) debate your decision in Claude Code, live around a table.", "type": "module", "scripts": { "start": "node app/server.mjs",