Internal knowledge base for Cornell Physical Intelligence (CUPI), a Cornell University student robotics organization — built for how a hardware team documents things. Live at wiki.cornellphysicalintelligence.com; the main site is cornellphysicalintelligence.com.
- Markdown pages with
[[wiki links]], backlinks, callouts, live task checklists, tables (sortable), code blocks - Drag-and-drop images, schematics, and CAD: STL/OBJ get an interactive 3D viewer in the page; STEP / SchDoc / PcbDoc / PDF attach as labeled cards; Onshape and Altium 365 links become rich cards
- Full version history with diffs and restore, trash with 30-day retention
- ⌘K search, templates (meeting notes, design doc, decision record, BOM, test report, bring-up log)
- Search automatically searches page previews for the task you describe; save previews suggest change summaries and flag concrete dependencies in linked pages
- Recruitment cycles with any number of website forms, reviewed per person with shared flags and attributed comments
- Comments, activity feed, per-page watching with an inbox, starred pages, wiki health (broken links / orphans / stale pages)
- Sidebar: Home, Applications (admins), New page, then the page tree. Activity, Wiki health, Trash, Members (roster and access log), Integrations (AI and email), bug reports, and keyboard shortcuts live in the Settings menu behind the gear beside the account card
- Google OAuth restricted to cornell.edu + an admin-managed member allowlist with emailed invite codes
- Matches the design language of cornellphysicalintelligence.com
The CUPI mark is four circles: left half filled, bottom half filled, upper-right quarter filled, and an outline split by a vertical bar. It is the club's logo everywhere in this repo; the crab that appears on the welcome page, in the welcome email, and on the link-preview card is a mascot illustration, not the logo.
src/client/logo-row.svg— the row form, used by the boot splash (inlined into the shell at build time; draws incurrentColorso it follows the theme). Inside the app the sidebar brand is the 2x2 mark (inlined asCUPI_MARK, 20px, strokes rescaled to about a pixel) followed by the text "CUPI Wiki" in the display serif (Playfair Display).src/client/logo-square.svg— the 2x2 form, the master for every icon:favicon-squircle-32.png(browser tab, inline data URI) andfavicon-cupi-192.png(crawlable/favicon-cupi.png, Apple touch icon) are rasterized from it as a black mark on white with a hairline edge.- Opening the wiki shows the mark drawing itself in over the page background until the store has booted, then the splash fades out over the app (
settleBootinsrc/client/main.js). The mark does not travel to the sidebar.
Re-rasterize the PNGs from logo-square.svg whenever the mark changes; do not reintroduce the crab as a logo or icon.
Signed out, the wiki shows its own frame with the members-only parts closed. The sidebar keeps the brand, the section names (no pages), and a "Not signed in" account row; there is no search box or page navigation. The content column mirrors the home page: a "Sign in to the CUPI Wiki" heading, then the Google sign-in control in the slot the search box has when signed in, then one line on what the wiki is and who can sign in (SIGNIN_NOTE in src/client/ui.js). No card, no footer. Both builds render through viewLoginShell; src/remote.js supplies the live Google link and the denied notice. Keyboard shortcuts and preference writes are off until someone signs in.
People are credited by name alone on pages, in history, in the activity feed, and in the trash; the initials bubble appears only on the signed-in account row and the preview build's account chooser. The editor always opens in split view (write-only below 900px wide); the Write / Split / Preview tabs change only the open editor. "Export wiki as Markdown" lives in the Settings menu with the other wiki tools.
Give an agent the normal wiki URL: https://wiki.cornellphysicalintelligence.com/. The server includes every current page in the initial HTML, so a reader can extract the wiki without signing in or running JavaScript. A persistent discovery note outside the app root also exposes the full-text link and its public/no-login scope in browser accessibility snapshots after the app boots, whether signed in or out. It distinguishes the public wiki feed from private Applications records. The note is visually clipped in ordinary browsing, with a keyboard-focus reveal. The live sidebar also has an Agent context button that copies the public URL with instructions without navigating away, signed in or out; if clipboard access is blocked, a dialog provides the text for manual copying. Document metadata and HTTP headers also advertise the feed.
/contextserves every current page in an ordinary read-only HTML document for browser tools. No app boot or login is required; wiki text is escaped rather than executed as HTML./llms-full.txtserves the same page bodies, hierarchy, tags, owner names, and update times as plain-text Markdown, without tokens or expiry./llms.txtlists individual page URLs;/llms-full.txt?page=<id>lets agents fetch pages separately when their reader truncates a large export./api/context/files/<id>serves attachments referenced by current pages. Binary files are separate downloads, not converted into text. External services and repositories retain their own access rules.
Wiki page content and its referenced attachments are public. Editing, recruitment, member accounts, preferences, history, trash, and integration settings still require their existing permissions and are excluded from these exports. No page content is copied into the build: each request reads the current database snapshot. Responses are not cached. All readers receive the same content, without user-agent detection. The discovery note describes the public endpoint rather than requesting a permissions bypass; an agent still needs browsing support and enough context capacity.
The function bundles public/wiki-shell.html. The build removes the old public/index.html so Vercel's static-file precedence cannot bypass the live homepage route. npm run test:context exercises anonymous homepage extraction, individual pages, current content, attachments, and private-data exclusion in isolated storage.
No framework. The client is one self-contained HTML file (scripts/build.mjs assembles it from src/client/). The backend is one Vercel serverless function (api/index.js): OAuth, HMAC-signed session cookies, a versioned JSONB state document in Postgres with optimistic-concurrency writes, and attachments as bytea rows. Clients apply mutations optimistically and the server re-validates every one against the member's role.
wiki_stateholds shared content and revision history. A version-matched compressed snapshot reduces database transfer; canonical JSONB remains available for cache repair.wiki_user_prefsholds each member's stars, recent pages, watches, and display settings with a separate version. Saving preferences neither rewrites shared content nor forces other members to download it. Reads and writes return only the signed-in member's preferences; writes check active membership in the same database statement.- Existing preferences remain in the legacy state as a fallback until that member first saves. The first save copies and merges them into the new table. Include both tables in backups, plus every
recruit_*table listed under Applications. A backend rollback must retain the new table and its read overlay, or newer personal settings will temporarily be hidden. /api/state?since=<content version>&prefsSince=<personal version>checks both versions in one small query. A preferences-only change returns preferences without pages or attachment listings. Older open tabs can still save; reload them to receive cross-device preference changes without waiting for a content change.- Hidden tabs and tabs idle for five minutes pause polling. Preference saves are debounced and duplicate values are skipped. Server acknowledgments include the canonical saved values so validation limits cannot leave the client displaying unsaved settings.
- Multipart page uploads retain their parts until the completed file is verified. A stable file ID makes finish retries reuse the same file after a lost response; cleanup failures do not invalidate a successful upload.
wiki_ai_usageholds shared OpenAI spending reservations, measured token costs, and request counters separately from content. Include it in backups and retain it across redeployments and rollbacks; deleting or restoring an older ledger can reset spending protection. Production uses atomic versioned updates across workers; local development uses.devaiusage.json.
Applications (#/applications) holds recruitment cycles. The old interest list was imported as one cycle, named for its term ("Fall 2026"). Each cycle is a flow of stages that applicants move through. A new cycle starts with the interest form, coffee chats, the application form and an interview, or copies another cycle's flow; a cycle saved before the flow chart keeps its three forms as its first three stages, in order. A stage is a form (applicants fill it in on the club website), a meeting (a coffee chat, an interview), a review, or any other step. Any stage can have a website form and any stage can have a checklist.
- Flow. A cycle opens on its flow chart, left to right in the order people meet the stages (top to bottom on a phone). Each card shows where its form is on the website (On /apply, Link only, Off, or Full, green only when an applicant can send it right now; hover for why not), who is there now and, where a checkbox marks the stage done, how many of those who reached it are done. Each connection carries how many people passed along it (they reached both of its stages), and a short arrow into each first stage counts who entered there (
GET /api/recruit/cycles/:id/insights→edges: [{ from, to, n }]). The outcomes (accepted, waitlisted, declined, withdrew) close the chart. The layout (recruitFlowLayoutinsrc/client/recruit-flow.js) fits the chart to its width: stages that follow the same stage stack in one column, balanced around it; a connection that passes a column takes a lane clear of the cards there; connections bend once, with rounded corners, between columns; and a chart still too wide at its smallest cards is drawn a little smaller (not below 80%) before it scrolls. Leads add stages (the + in the chart, or the + on a card), connect them by dragging from a card's + or through its menu, disconnect them (the card's menu), move them within a column, and remove them; removing a stage connects the stages before it to the stages after it. The server refuses a connection that would loop, and refuses to remove a stage that still holds form responses, people placed there, or checklist entries. A stage without saved connections leads to the next stage in the cycle's order, which is how older cycles read. Every change is one version-matched save. - Splits. A stage can send people on by their answer to one question, so not everyone gets every form: "Split by an answer…" (on the + under a card, or its menu) picks a choose-one, choose-many or checkbox question from this stage's form or the form of a stage before it, and a stage for each answer, or a new form made for it. Anyone else goes to a stage or stops there. The dialog starts each answer on the stage named for it (Mechanical: "Mech form", Software: "CS form"). The split's branches leave the card together, dashed, each labelled with its answers and its count; the stage's other connections still take everyone. Someone who picked several answers goes each of their ways, with each unmapped choice following Anyone else. Before the source form is submitted, every way stays ahead and none is up next; a submitted blank follows Anyone else or stops. Routing reads the newest submission, including column-only answers on older forms. Stages a split sent someone away from leave their progress and their page; saving a split refreshes cached paths while preserving comment drafts. A split is saved on its stage as
split: { stage, q, routes: { <answer>: <stage> }, otherwise }(lib/recruit/flow.jsreads the newest answer to it); its stages are always among the stage's connections, cutting one drops the answers that led there, and removing the split keeps the connections for everyone. The server checks the question, the answers and the stages, and refuses a split by a question people only answer later. - A stage. A card opens its stage in a panel that slides over the chart (its address,
#/applications/<cycle>/stage?key=<stage>, still links straight to it); the card stays lit behind it, and the chart slides it clear of the panel where there is room. The panel's head has the stage's kind, a menu that sets where its form is on the website (saved at once, beside whether it is live), its numbers, and the stages before and after it; Escape or the ✕ closes it. People lists everyone who reached it (or who is there now, done, not done, or up next) with its checklist ticked right in the list. Form is everything applicants read, as they read it: the form's address on the site, its title (the stage's name), description and questions, its submit button, and the heading and message after sending. Checklist is what the team records for each person there: checkbox, rating, choice, short text, note, number, date or team member, answered once for the team or by each reviewer. One team checkbox can mark the stage done; "Chat completed" is how the coffee chats stage records that a chat actually happened. Settings holds the kind (a label and an icon on the card), the stage's name when it has no form, the subteam a form's applicants join when the form does not ask (so a "CS application" form fills in Software), who is emailed on each response (with nobody named, cuphysint@cornell.edu is), a cap, and removing the form or the stage. Where a stage leads is drawn and changed on the chart only. Form, Checklist and Settings edit one draft, and nothing changes until Save. Every form keeps Name and Email; each section'srequiredlist in the cycle payload names its fixed questions. Every form also has its own page on the site (/apply/interest/,/apply/coffee/, …). - Website. The cycle's Website tab (
src/client/recruit-website.js) is/applyas applicants see it, beside everything that decides it: whether this cycle feeds the website (and, when it is not live, the one reason why: a draft or closed cycle, another cycle feeding/apply, none, or a passed deadline, with the control that fixes it), and each form's place: On /apply (open and listed), Link only (open at its own address, never at/apply) or Off. With several on/applyapplicants choose one first; the tab sets their order (drag, or the arrow keys on a grip), each form's button, and the question above them, and its preview follows as they are typed. Above the forms is what the page says first, in blocks the team adds, orders and removes: headings, text (line breaks kept), and the deadline, which reads the cycle's own (Settings → Details) and is worded on the site as "Applications are due Friday, October 30 at 11:59 PM EDT"; its lead-in words are editable, and without a deadline it shows nothing. Empty blocks show nothing; the closed page shows none of them. Up to 12, saved assite.blocks([{ id, type: heading | text | deadline, text }]). A form that reached its cap drops out of/apply, here as on the site./applynever falls back to a form that is not on it: with none, it shows the closed page. Everything on this tab saves at once; Off keeps a form's place in the order for when it returns. Saved assite.landing(the list, in order),site.question, and each section'sopenandchoiceLabel. - People. A table (stage, status, progress through every stage, flag and comments, subteam, year) or a board with a column per stage that leads drag people between. Search and filters (stage, status, review, form sent, subteam, year, and
next=<stage>for who goes there next) run on the server; the export streams everyone the list shows with every checklist field (people.csv?columns=full). Leads move people and set their status one at a time or for a selection (POST /api/recruit/cycles/:id/people/:email/move,POST /api/recruit/cycles/:id/moves). A person stands where the team last moved them, unless they sent a later stage's form since; with no move, at the furthest form they sent. - A person's page. When they first sent a form (under their name), where they are in the flow and where they go next, a card per stage on their path with its checklist and their answers, the team's comments (each can name a stage), and what happened when. Leads use Accept beside the status badge, or More decisions to waitlist, decline or mark withdrawn; Change decision can revise an acceptance or reactivate someone. Checklist values save as they are set (
PATCH /api/recruit/cycles/:id/people/:email/fields) and every list showing the person follows. The flag, the comments, the checklist, the stage and the status belong to the person in the cycle (recruit_people, one row per cycle and email), never to a submission. Previous and Next step through the list the page was opened from. - Insights. How far people got (reached and done, per stage), where active people are now, statuses, forms sent per day, subteams, years, and what each checklist adds up to: chats held, average scores, choices. Every chart has a table view (
GET /api/recruit/cycles/:id/insights). - Website feed.
GET /api/recruit/site(public, CORS-limited to the site, never cached) describes the cycle receiving the website,landing(the form/applyshows when it shows one),apply({ question, choices: [{ key, label }], blocks }: the forms on/applythat are open, in the team's order, offered as a choice when more than one can take responses, and what the page says above them,[{ type, text, closesAt? }]with empty blocks and a deadline the cycle lacks left out; saved assite.landing, a list,site.questionandsite.blocks), and its forms: key, title, description,open, and the question list (short,long,email,single,multi,checkbox,link,file,longfile). Stages without a form never appear.POST /api/recruit/site/<key>takes{ answers, files, website }for any of the cycle's forms, validates against that form, journals the receipt, writes the row, and emails the addresses the form names (none named,cuphysint@cornell.edu, orRECRUIT_BACKUP_TO). Its answer listsnext, the open forms this person goes to after that one ([{ key, title }], splits applied), when there are any. One row per email per form: a repeat from the website replaces that person's answers for the form, keeps the attachments it does not resend, and is emailed to the team as an update; the audit row (app.update) keeps the answers it replaced, and the journal keeps every copy. A form set not to replace keeps the first response and refuses repeats. With no cycle receiving the website the feed lists no forms and the site shows its closed page.POST /api/interest, the website's old flat route, still lands in the receiving cycle's interest form under that form's own rules (its cap, repeats, recipients) and answers closed when the cycle has no interest form with the six fixed questions, or no cycle receives the website; nothing on the website posts to it any more. - Cycles. Settings open from the gear beside the cycle's name, in one dialog: Status (draft, open, closed as one control, saved at once), Details (name, deadline and subteams, one Save), and Who can review (leads and reviewers, managed in their own small dialog); archive and delete sit in the dialog's foot. Exactly one open cycle feeds the website; an admin sets which on the Website tab. Leads edit the flow and move people; reviewers read, comment and fill in checklists.
Server modules are plain objects (lib/recruit/modules/{cycles,applications,people,roles,site}.js) mounted by lib/recruit/index.js through one registry; api/index.js forwards /api/recruit/* with a single line. lib/recruit/flow.js is the flow model every route shares (connections, rows, splits and each person's path, where each person stands, checklist values, insights); lib/recruit/sections.js owns the stage defaults, the public shape, and validation of edits. Client modules (src/client/recruit-{core,cycles,flow,stage,people,person,insights}.js) call RECRUIT.register and are concatenated after ai.js: recruit-flow.js is the chart and its layout, recruit-stage.js a stage's panel with the form and checklist builders, recruit-people.js the table and board, recruit-person.js a person's page, recruit-insights.js the charts. Tables (recruit_cycles, recruit_settings, recruit_applications, recruit_applicants, recruit_people, recruit_roles, recruit_audit, recruit_requests, interest_receipts) are created lazily with additive statements only; recruit_people.track (stage, status, checklist values, moves) and its own track_version were added in place. Writes use guarded SQL statements, with admissions and capacity checks inside a cycle row lock and transaction, and checklist values and moves as single atomic updates; every storage function has a memory branch (.devrecruit.json, gitignored) so npm run dev runs the whole feature. Tests: npm run test:recruit and node --test scripts/test-recruit-contract.mjs. The club website's Apply page (src/pages/ApplyOpen.jsx in the Website-CUPI repo) renders the feed and nothing else; when the wiki cannot be reached it says so. lib/interest.js and the #/interest panel code are the retired interest list: the panel address redirects to Applications, and only the old POST /api/interest route still serves (through lib/recruit/bridge.js), for any stale copy of the website. Addresses from before the flow chart (#/applications/<cycle>/<form>) open that stage's panel.
Migration. The current list and its archives are imported from the cycle index (admin, "Import the current list and archives"); the import is copy-only, idempotent, and resumable, and interest_submissions / interest_archives are left in place. scripts/recruit-rollback.mjs --cycle cy-… --dry-run previews a legacy projection. A write requires --backup /path/to/new-backup.json: it first saves the cycle, every form response, shared reviews, grants, audit, receipts and referenced file bytes to an owner-only file. The legacy table can represent only one response per email and one file; it is not a complete restore format. Recruitment tables and the Blob journal are retained. Until the import runs, everything behaves as before.
The September 2026 recruitment repair overview records the resolved review findings, UI comparisons, compatibility boundaries, and verification.
Backups must include every recruit_* table above, recruit_people.track included: it is the only copy of checklist values, stages and statuses. Submissions pass through a separate private Blob receipt journal before database processing; its recovery path and browser draft protections are independent of wiki preference synchronization.
Applicant attachments. A website repeat (and a staff placement from the queue) retains saved attachments unless a new file replaces the same question's attachment. The server marks website submissions as able to replace (replaces on the journal entry); the legacy POST /api/interest route never replaces, whatever its client sends. Omitted files never request deletion. The website blocks sending when a selected file was rejected or a restored draft still needs a file reattached; the applicant must choose a valid file or explicitly remove the pending attachment. Invalid, empty, obsolete, and MIME/signature-mismatched upload fields are rejected before a receipt is saved. Browser drafts retain filenames, not file bytes.
Success requires ok: true and a valid jr-<timestamp>-<random> receipt. A superseded submission returns 409 SUBMISSION_SUPERSEDED, not success. A database outage returns 202 queued: true only after the private journal saves the submission and its files, or a backup email does. Any submission left with fewer than two copies (journal or database failed) is emailed with its files to the form's recipients and cuphysint@cornell.edu (RECRUIT_BACKUP_TO overrides); during a database outage only the environment's RESEND_API_KEY (with RESEND_FROM on a verified domain) can send it. The email says what the database answered (a second copy, or the only copy of a refused repeat, a full form or a late submission). When neither store holds a submission, its answers also go to the server log ([intake] EMAIL ONLY or [intake] NOT SAVED); When neither the database nor the journal's saved cycle can be read, what the page sent is emailed to the team with the files whose bytes are an image or PDF, and logged ([intake] EMAIL ONLY (no cycle)). A submission refused as a repeat, full or late while the journal failed is logged too. 503 means the journal, the database and the email all failed, or the database answered with an outcome it could not confirm. The receiving cycle is kept in the journal (interest-intake/v1/site/live.json, rewritten every ten minutes), so the feed and submissions keep working while the database fails or hangs (reads give up after 10 s, writes after 15 s). Public limits never refuse a crowd on one network: 600 feed loads and 120 sends per minute per address, and at least 600 submissions per address per hour whatever a cycle stored; only that address's own submissions count. The legacy POST /api/interest keeps the cycle's stored limits. Answers are stripped of NUL characters and of half an emoji cut at a length limit, which the database would refuse; emails also lose invisible characters (zero-width spaces, soft hyphens) that would make them a separate person. A long answer whose form sets no limit takes 5,000 characters, and the website counts down near any limit. A choice whose option was renamed or removed while the page was open is kept as the applicant picked it. A link question takes a bare domain (github.com/me becomes https://github.com/me) and "N/A" or "none" for someone with no link yet. Files are checked by how they begin (a phone photo with data after its end marker, or a PDF padded after %%EOF, is fine) and stored as the type their bytes show, if the question takes that type. A required question missing from a submission's answers was added after the applicant's page loaded (the website always sends every question it showed), so it does not refuse them; for file questions, which carry no answer, the website's shown list of question keys says the same. Submissions journaled while the database failed are marked for retry, and the feed puts them into the database (and emails the form's recipients) once it answers again, a few per minute, without waiting for an admin to open the queue; one that fails again waits ten minutes on that instance, so it never holds back the rest. While the database does not answer, the feed carries offline: true. The spam trap (a hidden field, hp_8c1f; website from older pages) never refuses anyone: a submission that fills it is saved like any other, and the person is flagged with a comment saying so (and the team's email says so), for the team to decide. What the old trap kept (answers only, under interest-intake/v1/suspect/) is listed for admins at GET /api/recruit/queue/suspects. Closing the receiving cycle keeps the website's pointer: the site shows its closed page while the cycle is closed and the forms again when it reopens; archiving ends it. .github/workflows/apply-monitor.yml checks that the website's /apply/ loads, that the live feed answers from the database (not offline), and an open form's submit preflight, every ten minutes as GitHub schedules it (in practice, runs come hours apart); a failed run is the alert. The site retains drafts on unconfirmed responses, rejects multi-file drops for a single upload question, and requires explicit removal of pending files whose question was removed or changed. CI runs the website draft tests and wiki route failure tests, plus scripts/test-recruit-postgres-live.mjs against an isolated Postgres cluster to verify concurrent intake, attachment rollback, and journal recovery. The latter can be run locally with RECRUIT_PG_RUNTIME pointing to a separate installation of embedded-postgres and pg; it never connects to a configured production database.
Recruitment deadlines close public intake at 11:59 PM Eastern on the selected date. The feed shows the forms closed from then on; a submission still reaching the wiki within 15 minutes after (LATE_GRACE_MS: a page loaded before the deadline, a slow upload, an automatic retry) is taken, and the final serialized database write applies the same cutoff. The legacy bridge has no grace. A journaled submission that comes back late on replay waits in the queue as "Arrived after the deadline" for an admin to place. On-time receipts can still recover after an outage. Submission question snapshots preserve historical labels and types; legacy rows without snapshots are frozen before their next form edit. Labels changed before this protection cannot be reconstructed automatically. Exports retain the historical questions too.
Reviewer comment drafts survive reload in browser storage, scoped to account, cycle, and person; retry IDs survive with them to avoid duplicate comments. Wiki attachment failures remain visible with Retry/Remove controls and block Save. Reloaded attachment drafts require the file to be chosen again; file bytes are never stored in localStorage.
- Import to Vercel — vercel.com → Add New → Project → import
Cornell-Physical-Intelligence/wiki. The defaults work (vercel.jsoncarries the build command). - Add Postgres — in the Vercel project: Storage → Create Database → Postgres (Neon). This injects
POSTGRES_URLautomatically. Tables and the seed state create themselves on first request. - Google OAuth — console.cloud.google.com → APIs & Services → Credentials → Create OAuth client ID (Web application):
- Authorized redirect URIs:
https://wiki.cornellphysicalintelligence.com/api/auth/callbackandhttps://<project>.vercel.app/api/auth/callback - Put Client ID / Client secret into Vercel env vars
GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET - Also set
SESSION_SECRETto a long random string (openssl rand -hex 32)
- Authorized redirect URIs:
- Domain — Vercel project → Settings → Domains → add
wiki.cornellphysicalintelligence.com; then in Google Cloud DNS (the domain's DNS host) add:wiki CNAME cname.vercel-dns.com. - Invite emails (optional) — create a Resend key, set
RESEND_API_KEY(andRESEND_FROMonce the domain is verified there). Without it, invites still work — admins share the code from the Pending list. - Page assistance (optional) — an admin connects an OpenAI API key under Integrations → AI, chooses a model and reasoning effort, and tests the connection there. Defaults are Luna (
gpt-5.6-luna) with no reasoning for speed. Keys are AES-256-GCM encrypted usingWIKI_CREDENTIAL_SECRET(or the existingSESSION_SECRET); keep that server secret stable across deployments. An existing server-sideOPENAI_API_KEYremains a migration fallback until a saved key replaces it; Disconnect disables both. Set server-sideTYPESAFE_API_KEYseparately for Jev (jev-latest) and redeploy. ChatGPT/Codex sign-in does not supply the Platform API credential. Never put either key in client files or public environment variables.
First sign-in: ab3233@cornell.edu is seeded as admin. Add everyone else from Members.
Change summaries start quietly after a 1.6-second pause while editing, with at least 10 seconds between background requests. Exact recent drafts reuse their results, including Undo and opening Save; hidden tabs, composition, pending uploads, unchanged pages and disconnected AI skip prefetch. Failures back off for 30 seconds. Saving opens an editable summary and a bounded diff preview immediately, using a cached suggestion as the placeholder when ready; generation never disables Save. The owner-selected model (Luna by default) receives the page title, section and changed lines, with embedded file data removed; provider response storage is disabled. A basic summary remains available when the key is absent or the provider times out. After a pause in editing, Jev quietly checks the page for a clearer section, unfinished placeholders, unassigned commitments, and concrete effects on up to eight linked pages. Suggestions never change content automatically or prevent saving.
Search automatically sends the query and up to 32 eligible page previews (a mix of keyword matches and pages from each section) to Jev. It returns up to five strongly relevant pages ahead of normal results. Existing search filters still apply. Requests are debounced and cancelled when the query changes or search closes. Results appear in the normal list without an AI mode or status; existing keyboard selections stay in place. This is bounded discovery rather than an exhaustive semantic index. Attachments and intake records are never candidates.
All three endpoints require active membership. Requests have size limits and short timeouts, and identical provider calls share a ten-minute in-memory cache. Provider credentials stay on the server, and provider failures leave normal search and saving available. npm run test:assistance exercises provider contracts and save-preview behavior with synthetic transports.
OpenAI spending: Integrations → AI shows estimated costs and request counts for today and this month. The shared limits are $1/day, $5/calendar month, and 5¢ per request, with UTC boundaries. Every paid request, including connection tests, must first reserve its conservative maximum cost in Postgres. Provider-reported input, cached input, cache-write and output/reasoning usage settle that reservation; timeouts, missing usage, and failed accounting keep the full reservation counted. If accounting is unavailable, no new provider call is sent. Unexpected costs or provider tiers pause calls for review. Editing and saving remain available throughout.
OpenAI calls are additionally limited to 3 concurrent requests globally (1 per member), 30/minute globally (8 per member), and 1,200/day globally (200 per member). Cross-worker duplicates are suppressed for two minutes, and a crashed worker releases its concurrency slot after 90 seconds without refunding possible spend. High-cost model/effort combinations may be rejected by the 5¢ request ceiling. Limits cannot be raised by browser input or by replacing a key. The admin readout refreshes only while visible, without replacing unsaved forms.
Tracking starts when the ledger is initialized and covers this wiki’s OpenAI requests only. It excludes earlier use, Jev, hosting, and other applications sharing the key. Costs use published standard short-context rates dated September 18, 2026; review lib/ai-usage.js when provider pricing changes. The provider invoice remains authoritative. There is deliberately no UI action to clear the ledger or reset a safety halt; inspect provider billing and reconcile retained reservations before changing it. node --test scripts/test-ai-usage.mjs scripts/test-ai-usage-ui.mjs covers concurrent workers, budget races, crash/timeout handling, UTC rollover, and settings refresh behavior without using a real credential.
Intake review adds review and review_version columns on first use. Keep them in database backups. Comments append atomically with retry-safe IDs; applicant updates cannot overwrite review data. Archive clearing checks both the application and review versions so a comment arriving during archiving stays on the live list.
npm run dev # builds the client and serves on :4870 with fake auth + in-memory DBGoogle proves the email (domain re-verified server-side — the hd hint is not trusted); the allowlist in state decides membership; every mutation is re-applied server-side with role checks; invite codes are one-time, admin-visible only; sessions are HMAC-signed HttpOnly cookies that last 30 days and renew on use (a page load or poll in the second half of a session issues a fresh cookie). When a session does end, the open tab asks the member to sign in again instead of failing quietly on the next save or AI call. Attachments referenced by current pages are also available through the public context export; other attachment routes require sign-in. All attachments are served with X-Content-Type-Options: nosniff; known image, video, audio, text, and PDF types render inline (non-PDF under Content-Security-Policy: sandbox, so an uploaded SVG or anything else opened directly has no access to the wiki origin), and every other type downloads as application/octet-stream. Mutation ops are dispatched only to the module's own functions, so prototype names like constructor are rejected and an op error is always a plain string.
The workspace uses restrained navigation and reference-wiki article structure. Floating surfaces share a custom WebGL fragment shader for curved edge lighting and shading, with CSS backdrop blur. One shared renderer draws only on open, resize or theme change. Reduced-transparency/high-contrast preferences and unavailable WebGL use a readable fallback.