/index.html and /welcome.html. Narrative sections
below were verified on 2026-10-08 against commit 9979de3 (committed 2026-10-07):
schema 1.4, financial engine, Rule of 40, Excel import, screener,
Vercel routes, APIs, agent service, tests, and CI. Architecture diagrams are shown as
auditable Mermaid notation; this same-origin page intentionally executes no third-party diagram code.
rel=canonical on the www host.localStorage; JSON and Excel imports are parsed in-browser. Ordinary modeling makes no model-data POST. Network-capable exceptions are explicit: feedback text → POST /api/feedback; survey answers → POST /api/survey-waterfall-pain; a job description → a screener URL the user supplies; and the complete model plus question → an optional agent URL the user saves. Page loads still contact Vercel, Vercel Web Analytics, and Google Fonts. See the Assurance tab for the complete inventory.| Page | Purpose | Key Fields |
|---|---|---|
| Assumptions | 47 discrete model assumptions across 6 domains | Option pool, vesting, anti-dilution, carry structure, governance |
| Company & Fund | Company identity + fund economics | Name, stage, jurisdiction, fund size, carry %, hurdle, fees |
| Capital Structure | Shareholders, financing rounds, convertibles | Security type, shares, OIP, pref multiple, seniority, vesting |
| Exit Scenarios | Multiple exit price scenarios + dividend/note as-of year | Label, total proceeds ($M), notes, exitP.asOfYear |
| Page | Output | Visualization |
|---|---|---|
| Cap Table | Issued FD vs as-converted FD + liquidation overhang | Data table + Ownership grid; dual-FD copy in BLUF |
| Waterfall | Proceeds allocation per scenario, including converted synthetics | SVG curve + crosshair tooltip + bars |
| Decay | Investor dilution across rounds, optional pro-rata overlay | HiDPI canvas line chart |
| Fund MOIC | Simplified single-deal return proxy: aggregates every holder marked investor against one fund investment, then estimates hurdle, carry, and management-fee drag | HiDPI canvas + metric cards |
| Feature | Description |
|---|---|
| Glossary | 112 searchable, categorized VC terms with plain-English definitions |
| AI Prompts | Copy-paste research prompts plus on-device Model BLUF & Ask (modeled numbers, not an LLM). Optional self-hosted agent-service is operators-only. |
| BLUF Panels | Bottom-Line-Up-Front summaries, copy-to-clipboard for IC memos |
| JSON I/O | Import/Export portable model files; schema 1.4 (writes ran, Rule of 40 state, and written claims). JSON import resets ran and asks you to ▶ Run Model. |
| Excel I/O | Client-side .xlsx / .xlsm import (zip + DecompressionStream, no CDN). Drag-drop, mapping UI, ?import=xlsx|excel|1. Workbook never uploaded. |
| Rule of 40 / X | Scenario planner projects ARR and EV/revenue bands; shared standalone calculator uses rule-of-40.js. Results can be added to exit scenarios. |
| Written claims | Records a stated ownership percentage and as-of date for later reconciliation; it does not override computed ownership. |
| Feedback | FAB → sanitize/redact → /api/feedback → private Blob + Slack; public summaries at /feedback |
| Print / Undo / Theme | Print CSS for Cap Table + Waterfall + Fund MOIC, Ctrl+Z (50-deep), dark/light with system preference + localStorage |
| URL | What it is |
|---|---|
| /welcome | Short GP landing. Linked from the app as Overview. Opt-in via ?welcome=1 / #welcome. Rewrite /welcome → welcome.html. |
| /why | Why CapStack exists. Linked from welcome and /i. |
| /faq | User-facing Q&A aligned to the shipped engine (faq.html + faq.md). |
/privacy, /terms | Privacy and terms. Linked from welcome. |
| /demo | Public walkthrough + social unfurl (/demo/social). |
| /demo/excel-ingest | Excel import walkthrough. Aliases: /demo/onboarding/excel/ingest/sample. |
| /embed/* | Fictional $3B-AUM waterfall dashboard, snippet loader, visual generator. Not your model data. |
| /i | Script-free quick-link hub. Rewrite also serves /i without trailing slash. |
| /feedback | Public AI/extractive summaries only. Noindex. Full text stays private. |
| /survey/waterfall-pain | Instant survey (answers only). Noindex. UTM redirect if utm_campaign is missing. |
/rule-of-40, /rule-of-40-explained | Standalone calculator and explanation using shared rule-of-40.js math. |
| /screener | Local-first analyst/engineer candidate screens. Candidate names, answers, ratings, notes, and a SHA-256 PIN hash persist in browser storage. The PIN is a convenience gate for shared screens; use a dedicated device for live screens. |
flowchart LR
A["/"] -->|index.html| C[Modeling app]
C -->|no saved model| D[Demo data seeded]
C -->|saved model| E[Hydrate schema 1.4]
A -->|Overview / ?welcome=1| B[welcome.html]
A -->|?import=xlsx| XL[Excel importer]
B -->|CTA ?app=1| C
D --> F{User Action}
E --> F
XL --> F
F -->|Add/Edit| G[Shareholders\nRounds\nConvertibles]
F -->|Configure| H[47 Assumptions\nCompany & Fund\nExit Scenarios]
F -->|"▶ Run Model"| I[Engine]
G --> I
H --> I
I --> J[recalcAntiDilution]
J --> K[convertInstruments]
K --> L[computeWaterfall ≤10 iter]
L --> M[Cap Table / Curve / Decay / MOIC]
M --> N[BLUF / Print / JSON]
C -->|FAB| O[POST /api/feedback]
C -->|optional| P[agent-service]
style A fill:#d4a843,color:#0d0f14,stroke:none
style I fill:#4dd4a0,color:#0d0f14,stroke:none
style N fill:#5b9cf0,color:#0d0f14,stroke:none
style O fill:#a06df0,color:#0d0f14,stroke:none
/ — There is no first-visit redirect to marketing. welcome.html is opt-in (Overview link, ?welcome=1, or #welcome). Bookmarks use index.html?app=1, which sets cs-visited=1 and lands on Assumptions once per tab (sessionStorage cs-app1-tab). ?import=xlsx opens the Excel importer.loadSaved() restores capstack-gp-model (schema 1.4). Restores source.ran; if missing, infers ran when the last session page was an output view. Missing exitP.asOfYear defaults to the current year. If nothing is saved, demo holders + two rounds are seeded.issueYear, per-holder capMul), rounds, convertibles (optional convertAs), 47 assumptions (13 demoted keys are disabled), company/fund, exit scenarios + as-of year.recalcAntiDilution(), then the pure waterfall engine (synthetics + iterated conversion). Allocations are derived, never stored. S.ran is persisted so outputs re-render on reload. Navigates to Waterfall.ran). Excel import stays local. Print (Cap Table, Waterfall, Fund MOIC). Feedback FAB posts a sanitized message to /api/feedback (not the cap table).a10b (dividend rate), not an extra 48th row. DEFAULTS also has a19 outside the 47-row UI.
Eight keys in DEMOTE_KEYS (a17, a22, a23, a28–a30, a33, a34) remain visible but have no direct engine effect.
Domain cards below are parsed from ASSUMPTION_DOMAINS in live source when analysis succeeds.
pie title Assumptions by Domain
"D1 — Share Count & Dilution" : 8
"D2 — Preferred Stock Terms" : 11
"D3 — Convertible Instruments" : 7
"D4 — Exit Event" : 9
"D5 — Fund-Level" : 6
"D6 — Operational & Governance" : 6
S.
Allocations and charts are never persisted — they recompute from source when S.ran is true.
Schema 1.4 stores that boolean (and session page/theme) so returning GPs see outputs after reload.
Source state also includes Rule of 40 inputs and written ownership claims.
erDiagram
STATE ||--|| ASSUMPTIONS : contains
STATE ||--|| COMPANY : contains
STATE ||--|| FUND : contains
STATE ||--o{ SHAREHOLDER : has
STATE ||--o{ ROUND : has
STATE ||--o{ CONVERTIBLE : has
STATE ||--|| EXIT_PARAMS : contains
STATE ||--o{ EXIT_SCENARIO : has
STATE ||--|| RULE40 : contains
STATE ||--o{ WRITTEN_CLAIM : records
STATE {
boolean ran "Outputs eligible to re-render"
int nid "Next unique ID"
}
ASSUMPTIONS {
string uiRows "47 ASSUMPTION_DOMAINS items"
number a10b "D2 dividend percent, 1 of 47"
string a19 "in DEFAULTS only, hidden from UI"
string defaults "built-in enum and number defaults"
}
COMPANY {
string name "Acme Technologies, Inc. (fictional sample)"
string stage "series-a"
string jur "delaware"
int yr "2021"
int authC "Authorized common"
int authP "Authorized preferred"
}
FUND {
string name "Fund LP name"
number size "$M committed"
number carry "Carry %"
number hurdle "Hurdle rate %"
number fee "Mgmt fee %"
number gp "GP commit %"
number inv "Investment per deal $M"
number period "Investment period years"
number life "Total fund life years"
}
SHAREHOLDER {
int id "Unique ID"
string name "Holder name"
string role "founder/investor/employee/advisor"
string type "common/preferred/option/rsu/warrant"
int shares "Share count"
string series "Seed/A/B/C"
number oip "Original issue price"
number prefMul "Preference multiple"
string part "none/full/capped"
number capMul "Per-holder participation cap x OIP"
int sen "Seniority level"
number strike "Strike price"
int vest "Vested %"
string color "Hex color"
number convR "Conversion ratio (anti-dilution)"
int issueYear "Pref issue year"
string accelOverride "Per-holder accel policy"
boolean proRata "Investor follow-on rights"
}
ROUND {
int id "Unique ID"
string name "Round name"
number preMoney "Pre-money valuation"
number inv "Investment amount"
number postMoney "Post-money valuation"
number pool "Option pool expansion"
string date "ISO date"
string lead "Lead investor"
}
CONVERTIBLE {
int id "Unique ID"
string type "safe or note"
string investor "Investor name"
number amount "Principal dollars"
number cap "Valuation cap dollars, UI enters millions"
number disc "Discount 0-1, UI enters percent"
number interest "Interest 0-1, UI enters percent"
string dayCount "Optional override, else a25"
string convertAs "Override a24: pref/common/cash"
int sen "Optional seniority override"
string issueDate "ISO date"
string maturity "Notes only"
}
EXIT_PARAMS {
number fees "Transaction fees %"
number escrow "Escrow holdback %"
number debt "Outstanding debt $M"
number ret "Retention/earnout $M"
int asOfYear "Dividend / note accrual end year"
}
EXIT_SCENARIO {
int id "Unique ID"
string label "Scenario name"
number proceeds "Total proceeds $M"
string notes "Description"
}
RULE40 {
number arr "Current ARR $M"
number yrs "Years to exit"
boolean weighted "1.33g + 0.67m mode"
number gx "Rule of X growth multiplier"
array profiles "Growth/margin cases"
}
WRITTEN_CLAIM {
int id "Unique ID"
string date "Claim date"
string text "Free-form statement parsed into a percent series"
}
/faq and the shipped capstack-app.js engine — not the May 2026 guts-page snapshot.| Limitation | What the engine actually does |
|---|---|
| American (deal-by-deal) carry | European waterfall math is the supported computation. Do not use the output as an American-carry or clawback model. |
| Cap table vs waterfall FD | UI labels issued FD vs as-converted FD (issued + converting instruments via getExitIdentity()). Waterfall claim% is post-election residual weights — a third number. Do not paste one unlabeled FD% into a memo. |
| SAFE / note conversion | Converted at exit (cap, discount, note interest) when caps/rounds allow. Per-instrument convertAs overrides a24 (pref / common / cash). Banner when convertibles are present; flagged if conversion cannot be computed. |
| Anti-dilution | recalcAntiDilution() runs before outputs from down-round history. Global defaults support none / BBWA / NBWA / full ratchet, with a per-holder override and carve-out handling. It is not a complete legal interpretation of financing documents. |
| Conversion elections | Iterated up to 10 passes near breakevens (electionConverged flag). Capped participation uses per-holder capMul (else a12) and redistributes surplus in up to 20 inner passes. |
| Proceeds conservation | Identity is day-1 allocs + escrow + fees + debt + retention + unallocated = gross. UI warns if |unallocated| > $1. |
| Demoted assumptions | Eight DEMOTE_KEYS (a17, a22, a23, a28–a30, a33, a34) are disabled and have no direct engine effect. |
| Escrow and mixed consideration | Preferences run on the full post-deduction equity pot; escrow is then split from each equity allocation as a holdback. It is not an NVCA two-pass Additional Consideration re-run. The waterfall curve’s “preference covered” annotation still grosses up for escrow and may not align with the allocation engine. Stock scenarios may apply the configured haircut; probability-weighted earnout adds earnout × probability. |
| Rule of 40 / X | Constant growth and midpoint multiple projections are scenario-generation aids, not valuations. Rule of X ranks profiles but has no published pass/fail cutoff in this implementation. |
| Fund return output | All holders marked investor are attributed to one fund; holders are not linked to a specific fund. Full-fund management fees are applied to one deal, and the hurdle uses total fund life. Treat this as a directional deal-return proxy, not a European fund waterfall or administrator-grade fund model. “Top quartile” labels are internal heuristics, not benchmark evidence. |
| Conversion elections | The engine iterates, but non-participating preferred holders are evaluated sequentially. Near a conversion boundary, record order can change elections and allocations even when electionConverged is true. |
| Historical replay | Anti-dilution and decay start from the current cap table and replay entered rounds; they do not reconstruct dated historical cap tables. Results can double-count issuance or depend on present-day unrelated shares. The pro-rata overlay is an approximation and does not guarantee exact ownership maintenance. |
| Assumption coverage | Eight controls are explicitly demoted. Additional enabled keys without direct dollar-engine consumption include a1, a2, a8, a15, a36, a38, a39, a41, and a42–a47; some drive warnings/UI only. In particular, authorized-share “enforcement” (a45) warns rather than blocking issuance. Verify code consumption before relying on any assumption. |
| Schema and import | schema_version is recorded but not enforced through a migration/compatibility layer. JSON import is not transactional and does not fully reject duplicate IDs, malformed arrays, invalid enums, or negative/nonnumeric values. |
| Convertible and option approximations | An unpriceable convertible can be omitted while other instruments continue. SAFE denominators/latest PPS are reconstructed approximations. Double-trigger awards accelerate at exit without a termination condition, and treasury-method PPS is bootstrapped rather than solved iteratively. |
| Excel defaults and units | Import warnings do not block commit. Missing security type may default to common; missing preferred terms receive defaults; unreadable shares can become zero after warning. Small exit values may be interpreted as already denominated in millions. Review every mapping and preview. |
| Exotic terms | Side letters, MFN stacks, pay-to-play are not a complete legal model. Flags cover some issues (full ratchet, participating pref, preference overhang, low GP commit). |
/model, /capstack-app.js, /capstack.css, and /welcome.html from the same origin and parsing them in-browser.
flowchart LR
A[index.html] --> B[capstack.css + capstack-app.js]
B -->|model + ran| D[localStorage]
A -->|POST| F["/api/feedback"]
F --> G[Vercel Blob private]
F --> H[Slack]
F -.-> I[AI Gateway summarize]
A -.-> J[optional agent-service]
SUR["/survey/waterfall-pain"] -->|POST| SP["/api/survey-waterfall-pain"]
SP --> G
MANUAL["authorized manual call"] --> WO["/api/weekly-ops"]
K[Static pages] --> E[Vercel CDN]
K --- L[welcome / why / faq / privacy / terms / demo / survey / embed / screener / Rule of 40 / i / feedback]
E --> M[www.capstack.space]
A --> E
F --> E
WO --> E
style A fill:#d4a843,color:#0d0f14
style D fill:#4dd4a0,color:#0d0f14
style F fill:#a06df0,color:#0d0f14
style M fill:#4dd4a0,color:#0d0f14
vercel.json; a scheduled GitHub production smoke still runs Mondays.
The calculator does not need those functions to run.
S but are not pure functions
(computeWaterfall, convertInstruments, recalcAntiDilution)
still ships inline. Charting is mixed: SVG for the waterfall curve (crosshair), canvas for Decay and Fund MOIC.
/api/feedback. The waterfall-pain survey POSTs answers only. Optional agent POSTs model JSON only to the URL you type.
JSON and Excel import/export are the portability story. IndexedDB remains a future path; browser storage quotas vary and are not guaranteed.
main; that external project setting was not inspected. Static files plus Vercel Functions:
api/feedback.js, api/survey-waterfall-pain.js, api/weekly-ops.js
(implemented but not scheduled by vercel.json). Blob, Slack, optional AI Gateway summaries.
vercel.json rewrites welcome/why/faq/privacy/terms/demo/excel-ingest/Rule-of-40/screener/i/feedback/survey,
noindexes /docs/*, /feedback, and /survey/*, and sets clickjacking
headers on / and welcome. GitHub Pages workflow is disabled
(if: false) so routes do not drift. Canonical URLs use the www host.
capstack.css and capstack-app.js./ redirects to /welcome; /model and /?app=1 serve this file
├── capstack-app.js Classic script the shell loads. One script, so let state stays in one scope
├── capstack.css Stylesheet the shell loads
├── capstack-boot.js Blocking head script that hides a dismissed hint before first paint
├── welcome.html — Short GP landing at /welcome
├── why.html Why CapStack exists at /why
├── faq.html / faq.md User FAQ at /faq
├── privacy.html / terms.html Legal at /privacy, /terms
├── og-image.svg / og-image.png OG mark; app meta points at /og-image.png
├── vercel.json Rewrites, noindex, and clickjacking headers on HTML except embeds; no active cron
├── robots.txt Disallow /docs/
├── package.json npm test + Function deps (@vercel/blob, ai, @vercel/connect)
├── api/
│ ├── feedback.js Sanitize, store, Slack, optional summarize
│ ├── survey-waterfall-pain.js POST answers / GET CSV export
│ ├── weekly-ops.js Authorized ops report endpoint — currently unscheduled
│ └── _lib/ sanitize.mjs, weekly-ops.mjs
├── feedback/index.html Public summaries at /feedback (noindex)
├── survey/waterfall-pain/ Instant survey UI (noindex)
├── i/index.html Quick-link hub at /i
├── demo/ Walkthrough, social unfurl, excel-ingest
├── embed/ Dashboard, loader, generator — fictional sample, not live models
├── screener/ Local candidate match desk, analyst/engineer rooms, questions and scoring
├── rule-of-40.js Shared Rule of 40 / X scenario math
├── agent-service/ Optional durable AI service (localhost:8787). Not required for modeling.
├── docs/xlsx-import/ Excel import notes + reader spike
├── scripts/ browser-smoke.mjs for post-deploy Playwright
├── tests/ waterfall goldens, xlsx*, weekly-ops, canonical-hosts, ux-hardening
├── .github/workflows/
│ ├── frontend-tests.yml npm test on app/embed/api changes
│ ├── production-smoke.yml Post-deploy HTTP + browser smoke on www
│ ├── agent-service-ci.yml Agent tests + golden eval
│ ├── feedback-notify.yml Issue triage on bug/enhancement/feedback labels
│ └── deploy.yml GitHub Pages — disabled; Vercel is canonical
└── docs/dev/learn/deconstruct-the-guts/
└── index.html This page (noindexed)
mindmap
root((CapStack GP))
Frontend
HTML5
Semantic elements
Inline SVG favicon
JSON-LD structured data
CSS3
CSS Custom Properties
CSS Grid layout
Media queries
Print stylesheet
Dark/Light theming
JavaScript ES6+
Global-state financial engine
DOM manipulation
localStorage API
Clipboard API
FileReader API
DecompressionStream
Canvas 2D + SVG
fetch (feedback + optional agent)
Drag and drop
External
Google Fonts
DM Mono
Fraunces
Deployment
Vercel CDN
vercel.json rewrites + headers
Vercel Functions
/api/feedback
/api/survey-waterfall-pain
/api/weekly-ops
Vercel Blob (private)
Optional
agent-service (Express, Zod)
AI Gateway (feedback summaries)
Design
Monospace-first typography
CSS variable theming
Responsive breakpoints
Accessibility ARIA
| Technology | Role | Why This Choice | Version / Notes |
|---|---|---|---|
| HTML5 | Document structure | Zero-build static delivery with partial semantic/accessibility coverage | Living standard |
| CSS3 | Styling + theming | Custom properties for dark/light toggle; Grid for 3-column layout | CSS Variables, Grid, color-mix() |
| Vanilla JS (ES6+) | Logic + interactivity | No framework/build runtime; engine reads and sometimes mutates global state | No automated cross-browser support matrix; Excel requires DecompressionStream |
| localStorage | Model persistence | Core model stays local unless a configured remote agent is used. Excel workbooks never upload. Survey/feedback are separate paths. | Browser-dependent quota; no guaranteed capacity |
| SVG + Canvas | Charts | Waterfall curve is SVG (crosshair tooltip). Decay and Fund MOIC are HiDPI <canvas>. | Mixed on purpose after chart-hardening |
| Google Fonts | Typography | DM Mono + Fraunces | CDN, display=swap |
| GitHub Actions | CI | Frontend node --test, agent-service CI, issue triage, post-deploy production smoke (HTTP + Playwright on www). Pages deploy is off. | Node 20 |
| Vercel | Host + Functions | Static CDN + feedback / survey / weekly-ops + Blob + optional AI Gateway | Rewrites and route-specific headers; no active Vercel cron |
| CSP | Partial browser policy | Meta CSP on index.html sets script-src 'self' plus the Insights host, with no 'unsafe-inline' and no 'unsafe-eval'. There is no script-src-attr exception: handlers are data-cs-* attributes dispatched from capstack-app.js. style-src is 'self' only. connect-src https: permits operator-hosted agents. The walkthrough page keeps 'unsafe-eval' because it evaluates sliced regions. This policy is a meta tag, not a response header. | index.html head |
capstack-app.js is organized. The shell is index.html. Exact size and function metrics above are extracted live from source.
graph LR
subgraph UI["UI Layer"]
NAV["Navigation
nav(), togAcc()"]
FORMS["Form Handlers
updCo(), updFund(), setA()"]
RENDER["Renderers
renderCapTable()
renderWaterfall()
renderDecay()
renderFund()"]
MODAL["Modal System
showModal(), closeModal()"]
end
subgraph ENGINE["Computation Engine (Pure Functions)"]
FD["computeFD()
Fully diluted shares"]
AD["recalcAntiDilution()
convR from down rounds"]
CV["convertInstruments()
SAFE/note synthetics"]
WF["computeWaterfall()
≤10 election passes"]
PC["prefClaim()
OIP × shares × prefMul + divs"]
DC["computeDecay()
Ownership dilution"]
CURVE["genWFCurve() + drawWFCurve()"]
LP["getTotalLP()
Liquidation preference"]
XI["getExitIdentity()
issued vs as-converted FD"]
end
subgraph STATE["State Management"]
S["Global S object"]
UNDO["Undo stack
pushUndo(), undo()"]
SAVE["Persistence
autoSave(), loadSaved()"]
IO["Import/Export
exportJSON(), importJSON()
xlsx* client-side"]
end
FORMS -->|"mutate"| S
S -->|"read"| ENGINE
ENGINE -->|"results"| RENDER
UNDO -->|"snapshot"| S
SAVE -->|"serialize"| S
style NAV fill:#5b9cf0,color:#0d0f14,stroke:none
style FD fill:#4dd4a0,color:#0d0f14,stroke:none
style WF fill:#4dd4a0,color:#0d0f14,stroke:none
style S fill:#d4a843,color:#0d0f14,stroke:none
function declarations in capstack-app.js, auto-extracted from deployed source. Arrow functions and other files are not counted. flowchart TB A["Gross Exit Proceeds
($M × 1,000,000)"] --> B{"Deduct Fees?
(a27 = gross)"} B -->|Yes| C["− Transaction Fees
(exitP.fees %)"] B -->|No| D[Skip] C --> E["− Outstanding Debt
(exitP.debt × $1M)"] D --> E E --> F{"Deduct Retention?
(a32 = deduct)"} F -->|Yes| G["− Retention/Earnout
(exitP.ret × $1M)"] F -->|No| H[Skip] G --> I["Post-deduction Equity Pot"] H --> I I --> SYN["Merge convertInstruments()\nsynthetics + optional cash payout"] SYN --> L["Step 1: Seniority Stack"] L --> M["For each seniority level
(ascending):"] M --> N["Pay liquidation preference
prefClaim() = OIP × shares × prefMul
+ accrued dividends to asOfYear"] N --> O{"Pool sufficient?"} O -->|Yes| P["Full pref paid.
Deduct from pool."] O -->|No| Q["Pro-rata split
among level. Pool = 0."] P --> R["Step 2: Residual Split"] Q --> S["No residual.
Common gets $0."] R --> T["Non-participating pref:
Compare convert vs. pref.
Iterate ≤10 passes."] R --> U["Participating pref:
Gets pref + pro-rata
of residual (double dip)"] R --> V["Capped pref:
Participate up to cap;
redistribute surplus ≤20 passes"] R --> W["Common + Options + RSUs:
Pro-rata by FD shares"] W --> X["Post-allocation split:
Day-1 = equity × (1 − escrow%)
Escrow = equity × escrow%"] style A fill:#d4a843,color:#0d0f14,stroke:none style I fill:#4dd4a0,color:#0d0f14,stroke:none style S fill:#e05870,color:#0d0f14,stroke:none style W fill:#5b9cf0,color:#0d0f14,stroke:none
graph TB
subgraph Tokens["Design Tokens (CSS Variables)"]
INK["Ink (Backgrounds)
--ink through --ink4"]
RIM["Rim (Borders)
--rim through --rim2"]
CHALK["Chalk (Text)
--chalk through --chalk4"]
ACCENT["Accent Colors
--amber --cyan --rose
--jade --sky --violet"]
end
subgraph Layout["Layout System"]
GRID["CSS Grid Shell
topbar | sidenav | main | rpanel"]
RESP["Responsive Breakpoints
1100px, 900px, 768px, 500px"]
PRINT["Print CSS
Cap Table + Waterfall + Fund MOIC"]
end
subgraph Components["Component Styles"]
CARDS[".card"]
FORMS[".field, .fg"]
TABLES[".dt"]
PILLS[".pill"]
BTNS[".btn"]
ALERTS[".alert"]
end
Tokens --> Layout
Tokens --> Components
style INK fill:#1a1e2a,color:#e8eaf5,stroke:#323655
style ACCENT fill:#d4a843,color:#0d0f14,stroke:none
style GRID fill:#5b9cf0,color:#0d0f14,stroke:none
sequenceDiagram
participant U as User
participant DOM as DOM Forms
participant S as State (S)
participant LS as localStorage
participant E as Engine
participant R as Renderers
U->>DOM: Edit input field
DOM->>S: pushUndo() + mutate S
S->>LS: autoSave() → JSON.stringify
Note over S: _inputsDirty = true
U->>DOM: Click "▶ Run Model"
DOM->>E: runModel()
E->>E: recalcAntiDilution()
E->>E: convertInstruments() inside computeWaterfall()
E->>E: computeWaterfall() ≤10 election passes
E->>E: computeDecay()
E->>S: S.ran = true
E->>R: renderOut(page)
R->>DOM: innerHTML update
S->>LS: autoSave() includes ran
Note over LS: On next page load:
LS->>S: loadSaved() → JSON.parse, restore ran
S->>DOM: hydrateUI()
alt ran is true
S->>R: re-render last output page
end
main; the repository does not prove that external setting or gate deployment on CI. Modeling is static; feedback, survey, and weekly-ops are Functions.
flowchart LR
A["git push main"] --> B["Vercel webhook"]
B --> C["Static files + api/*.js"]
C --> D["vercel.json rewrites + headers"]
D --> G["www.capstack.space"]
style A fill:#d4a843,color:#0d0f14,stroke:none
style G fill:#4dd4a0,color:#0d0f14,stroke:none
/index.html — modeling app. Canonical https://www.capstack.space/welcome/why/faq, /privacy, /terms/demo, /demo/social/demo/excel-ingest/rule-of-40, /rule-of-40-explained/screener, /screener/analyst, /screener/engineer/ii/index.html/feedback/survey/waterfall-painutm_campaign missing/api/feedback/api/survey-waterfall-pain/api/weekly-ops/docs/*/screener/*python3 -m http.server 8000 — Functions need vercel devif: false) so /i rewrites do not drift| API | Usage | Fallback |
|---|---|---|
| localStorage | Model (capstack-gp-model incl. ran), corrupt-model backup, theme, optional agent URL, local feedback log, visit marker, and separate screener configuration/sessions. The agent API key is session-scoped, not stored here. | Model save is guarded; storage is unencrypted and readable by same-origin script and anyone with browser-profile access. Reset purges CapStack and screener keys on this origin. |
| Clipboard API | BLUF copy | Toast on denied permission |
| FileReader / ArrayBuffer | JSON import; Excel .xlsx zip parse | try/catch + toast. Excel needs DecompressionStream |
| DecompressionStream | Inflate deflate-raw zip entries for xlsx | Throws XLSX_NO_INFLATE_SUPPORT |
| Drag and drop | Workbook drop onto the importer | File picker still works |
| URL.createObjectURL | JSON export blob download | Standard |
| matchMedia | System theme | Defaults dark |
| window.print() | printModel() shows Cap Table, Waterfall, Fund MOIC | — |
| Canvas 2D | Decay + Fund MOIC (devicePixelRatio) | Empty-state copy if no data |
| fetch | POST /api/feedback; optional agent /api/agent/run | Agent is off unless URL is set |
| sessionStorage | cs-app1-tab so ?app=1 lands on Assumptions once per tab | Ignored if storage blocked |
DEFAULTS (~line 1290)ASSUMPTION_DOMAINS (~line 5436)S.a.yourKey in the engine — or add it to DEMOTE_KEYS if it is display-onlycount and the sidenav badge #nb-ass if the 47 total changes. a10b already counts as one of the 47.
openAddSh() (~line 1704)_modalAction push in the same functioncomputeFD(), recalcAntiDilution(), prefClaim(), or computeWaterfall() as neededrenderShList() and renderCapTable()
<div id="pg-yourpage" class="pg"> in the HTML#tb-nav), sidenav (#sidenav), and mobile navrenderYourPage() functionrenderOut() (~line 2432)[data-theme] blocks (~line 48)--ink (bg), --chalk (text), --rim (borders), then accent colors
computeWaterfall(proceedsM) is a pure function (~line 2208). runModel() (~2422) calls recalcAntiDilution() first, then sets S.ran.computeWaterfall(100){allocs, escrow, fees, debt, ret, remaining, day1, gross, unallocated, cashPayouts, pool, decisions, resWeights, electionConverged, _synthetics}allocs is keyed by shareholder (and synthetic) IDprefClaim() (~1944). Conversion loop is maxIter=10. Conservation miss surfaces when |unallocated| > 1.
| Don't | Why |
|---|---|
| Add a bundler for the modeling app | The model is index.html, capstack.css, and one classic script, capstack-app.js. There is no bundler. Root package.json deps exist for Vercel Functions (api/*.js). npm run build:engine only slices the free-tool copy. Excel parsing lives in capstack-app.js, not SheetJS from a CDN. |
| Store computed allocations in state | Allocations must always be derived from source. Persist only ran (and inputs) so reload re-renders — do not snapshot allocs. |
Use innerHTML with unescaped user input | XSS risk. Always use esc() helper for any user-provided string. |
Remove the pushUndo() call before mutations | Breaks Ctrl+Z. Every state mutation must snapshot first. |
Forget to call autoSave() after mutations | User loses work if they close the tab. Always save after state changes. |
tests/ and run with npm test (Node built-in runner). CI includes frontend-tests.yml, agent-service-ci.yml, and post-deploy production-smoke.yml. Root HTML/JS/API changes are covered, but nested screener JS/question JSON are not direct frontend-workflow path triggers. Production smoke is Chromium-only, runs after deployment, and covers the core app/Excel walkthrough—not APIs, agent integration, screener, Rule of 40, embed, rollback, quota failure, or performance budgets.
| File | Guards |
|---|---|
tests/waterfall-moic.test.mjs | Ported waterfall + MOIC math (multi-pass capped pref) |
tests/waterfall-golden.test.mjs | Internal hand-authored fixtures for preferences, conversion, residual allocation, and conservation; not an external NVCA/YC certification |
tests/prod-waterfall-loader.test.mjs | Pins production engine by slicing capstack-app.js into Node |
tests/embed-waterfall.test.mjs | Fictional $3B embed dashboard numbers |
tests/feedback.test.mjs | Sanitize / PII redact / type clamp for api/_lib/sanitize.mjs |
tests/weekly-ops.test.mjs | Weekly ops report + cron auth helpers |
tests/xlsx-*.test.mjs | Reader, detect, plan, commit, template, demo page, entry |
tests/ux-hardening.test.mjs | Persist ran, sanitize colors/roles, save-fail toast |
tests/canonical-hosts.test.mjs | www canonical URLs |
tests/welcome-links.test.mjs | Welcome / why / overview links |
tests/rule-of-40.test.mjs | Shared standalone and embedded Rule of 40 / X math |
tests/screener.test.mjs, tests/sim-pack.test.mjs | Role banks/scoring/routes/shell disclosures; sim-pack guards destructive forgotten-PIN recovery |
tests/written-claim.test.mjs | Stated ownership claim persistence and reconciliation |
/. App should load (no auto-redirect to welcome). Demo data appears. Overview still opens welcome.html.ran).convR.?import=xlsx; dark↔light redraws charts; print CSS (Cap Table, Waterfall, Fund MOIC)./feedback lists summaries only. Survey at /survey/waterfall-pain stores answers, not the model. Needs Function env on Vercel (or vercel dev locally).| Use case | Assessment | Conditions |
|---|---|---|
| Fictional, public, or de-identified scenarios | Suitable | Use a supported browser; independently reconcile material outputs. |
| Confidential cap-table modeling on a firm-managed device | Conditional | Firm approves the mutable hosted application and browser storage; dedicated profile/device; remote agent off; no shared workstation; clear/export under firm policy. |
| Highly restricted MNPI or regulated personal data | Not yet defensible | Still requires a pinned/self-hosted artifact, a CSP without inline script, encrypted or non-browser storage, and a formal security review. Import bounds and session-only agent keys do not close that gap. |
| Closing, legal, tax, accounting, valuation, or fund-administration system of record | Out of scope | Use counsel, administrators, source documents, and independently controlled models. |
Basis: index.html CSP, persistence, import, feedback, and agent regions; vercel.json; privacy.html; terms.html; API and agent-service source; automated tests. No penetration test, dependency audit service, production configuration inspection, SOC report, or legal review was performed.
| Boundary | Crossing | Implemented control | Residual risk |
|---|---|---|---|
| Browser ↔ static host | HTML, fonts, analytics script and events | HTTPS is supplied by Vercel; app CSP restricts most source classes | Hosted code is mutable; no signed/pinned release or subresource integrity; response headers are incomplete. |
| DOM ↔ model state | User strings rendered through templates | esc(), safeColor(), sanitization tests | Large inline-render surface means every future interpolation must preserve escaping; CSP allows inline script. |
| Browser ↔ local storage | Model, settings, optional key, screener reports | Same-origin browser isolation; guarded model save/load; corrupt backup | No encryption, expiry, lock, or user-facing complete-data purge. Same-origin script/profile access can read it. |
| File ↔ importer | JSON text; XLSX ZIP/XML | No upload. JSON is schema-allowlisted (1.0–1.4), size-capped at 2 MB, collection-capped, and rejected before undo/state mutation. XLSX rejects files over 32 MB, more than 400 entries, an entry over 8 MB, aggregate claimed inflation over 32 MB, or a compression ratio over 100:1. | Excel row/column ceilings are still coarser than the zip ceilings. A validated string can still contain markup; render paths that forget esc() remain an XSS risk under the current inline CSP. |
| Browser ↔ CapStack APIs | Feedback or survey only | Body limits, validation/redaction, origin checks, private Blob, basic rate limits | No-Origin clients are allowed; in-memory limits are per instance; retention/deletion SLA is unspecified. |
| Browser ↔ optional remote service | Complete browser sourceState, question, metadata, API key | User opt-in; HTTPS required from hosted app; service key, CORS including www, schema, body limit, rate limit, metadata-only logger. The API key is stored in sessionStorage and removed from localStorage on read. | Any HTTPS host is still permitted by the app CSP. The agent URL remains in localStorage. Agent Zod schemas strip undeclared model fields before provider prompting. Operator owns retention and security. |
| Trigger | Destination | Payload / observable data | Default? | Evidence |
|---|---|---|---|---|
| Load public pages | Vercel / CapStack origin | Normal HTTP metadata such as IP, user agent, route, and timing; static files | Yes | vercel.json, deployed static pages |
| Load typography | This origin /fonts/ (Fraunces, DM Mono). Screener pages still request fonts.googleapis.com and fonts.gstatic.com (Inter, Source Serif). | Font request metadata; no model state | Yes | Page <link> elements, fonts/fonts.css |
| Web Analytics | Vercel Insights | Aggregate page analytics; named export event on JSON export; code sends no model fields | Yes | /_vercel/insights/script.js, exportJSON() |
| Edit/run/print/on-device BLUF | None beyond already loaded page | Model remains in memory/localStorage; print/clipboard go to OS facilities | Yes | getSource(), engine/render functions |
| Import JSON/XLSX | None | File bytes parsed in the browser | User action | handleImport(), xlsxReadWorkbook() |
| Send feedback | /api/feedback → private Vercel Blob, Slack, optional AI Gateway | Chosen type and message after regex-based email/phone/common-secret redaction; summary may be publicly listed | User action | submitFeedback(), api/feedback.js, sanitize.mjs |
| Submit survey | /api/survey-waterfall-pain → private Vercel Blob | Enumerated answers, one short free-text answer, and UTM/source fields; no model state | User action | survey/waterfall-pain/index.html, API route |
| Remote model BLUF / Ask | User-saved agent base URL; provider chosen by operator | Complete current model state reaches the agent endpoint with question/workflow metadata and API-key header; agent schema then strips undeclared fields before provider prompting | Off | buildAgentRequest(), AgentRequestSchema, runAgentWorkflow() |
| Screener “deeper help” | User-entered hosted URL | Full pasted job description | Off | screener/desk.js hostedExtract() |
| View this engineering page | CapStack origin, Vercel Insights | Static spec, same-origin typography, aggregate analytics; diagrams remain inert notation | Yes | This file intentionally has no third-party executable diagram dependency |
| Data | Location | Retention | Deletion / recovery |
|---|---|---|---|
Model inputs and ran | localStorage: capstack-gp-model | Until site data is cleared, Reset runs, or the value is overwritten; no expiry | Reset calls purgeCapstackStorage(), which removes model, corrupt backup, agent URL, feedback log, Excel profiles, theme/visit markers, and screener.* keys. JSON export remains the backup path. |
| Agent URL | localStorage: cs-agent-baseurl | Until cleared or Reset | Not encrypted. The API key is not stored here. |
| Agent API key | sessionStorage: cs-agent-apikey | Current tab only | Closing the tab drops it. A previously stored localStorage copy is deleted on the next read. |
| Screener sessions and PIN hash | Role-specific localStorage keys and shared config | Until deleted/cleared; no expiry | Per-report delete; forgotten PIN flow deletes PIN and all reports. SHA-256 PIN hash is not password-hardening and is not a device security boundary. |
| Feedback | Private Vercel Blob; excerpt in Slack; optional model-provider processing; public summary | No retention period encoded | No user self-service deletion or repository-defined deletion workflow. |
| Survey answers | Private Vercel Blob | No retention period encoded | Authorized CSV export exists; no user self-service deletion. |
| Ops reports | Private Vercel Blob plus configured Slack/email | No retention period encoded | Operator/provider administration; endpoint currently unscheduled. |
capstack-gp-model is not a complete purge: the corrupt backup, agent settings, feedback history, screener records, theme, and visit keys are separate.| Surface | Access control | Validation / limits | Storage / output | Important caveat |
|---|---|---|---|---|
GET /api/feedback | Present Origin must be an allowed host; a missing Origin is still accepted on this public list | Lists up to 50 summaries | Public summary, type, timestamp, ID | No authentication; noindex is not access control. |
POST /api/feedback | Origin check; in-memory 5/min/IP | 8 KB raw body, including when Content-Length is absent; 8–2,000-char retained message; type clamp; regex redaction; honeypot | Private Blob and Slack independently; returns partial-delivery flags | Rate limits are process-local. Regex redaction is not a DLP guarantee. A missing Origin is rejected on POST. |
POST /api/survey-waterfall-pain | Origin check; in-memory 8/min/IP | 8 KB declared body; enums; bounded/normalized UTM and free text; honeypot | Private Blob | Rate limits reset per cold instance and are not a distributed abuse control. |
GET /api/survey-waterfall-pain | Bearer SURVEY_EXPORT_SECRET or CRON_SECRET | Reads up to 500 records; CSV escaping | CSV with attachment/no-store headers | Shared fallback secret expands blast radius. |
GET /api/weekly-ops | Cron bearer authorization | Provider timeouts and bounded list sizes | Report to configured email/Slack and private archive; dry-run can return detailed report | Not scheduled in current vercel.json; production env and provider permissions were not inspected. |
Agent GET /health | Public | No request body | Provider/model/configured status | Operational metadata is intentionally exposed. |
| Agent workflow/run | Required API key; configured CORS; key+IP in-memory rate limit | Express 1 MB body; Zod request/output schemas; configurable 200k-char state; one JSON repair attempt | Provider output; allowlisted metadata logs | Source schema strips preference/participation/seniority/conversion/vesting/strike and Rule of 40/written-claim fields before provider prompts. Default CORS includes the apex host but not canonical www, so production requires an explicit override. No per-user identity, durable quota, retention control, or hosted deployment is supplied. |
esc(). Residual risk remains wherever a later template interpolates a stored string without escaping, because the CSP still allows inline script.npm audit --omit=dev reports one high-severity undici advisory in the root and critical proxy-addr, moderate qs, and low body-parser advisories in the agent service. Fixes are available; no SBOM, provenance, or deploy attestation is evidenced.privacy.html describes remote BLUF/Ask as a digest, while current buildAgentRequest() transmits complete sourceState. The implementation and this specification are authoritative until that public notice is corrected.DecompressionStream remains an Excel-import requirement./og-image.png, generated from og-image.svg and tracked beside it. The apex domain redirect status is also set on the Vercel project domain, outside this file.| Control question | Required answer |
|---|---|
Has the firm classified the model data and accepted browser localStorage for that class? | Yes |
| Is the device managed, patched, encrypted at rest, access-controlled, and free of unapproved extensions? | Yes |
| Is the browser profile dedicated/non-shared, with screen locking and controlled cloud sync? | Yes |
| Has the firm approved trusting the current hosted artifact, or deployed a reviewed immutable copy? | Yes |
| Will real names/identifiers be minimized where they are not necessary? | Yes |
| Is the remote agent unset unless the firm operates and has reviewed the complete service/provider path? | Yes |
| Are feedback and survey avoided for confidential, personal, legal, or deal-specific content? | Yes |
| Are imported files from a trusted source and below firm-approved size/complexity limits? | Yes |
| Are exports, printouts, downloads, clipboard contents, and backups governed as confidential records? | Yes |
| Will material inputs and outputs be independently reconciled before a decision? | Yes |
| Is there a defined end-of-use purge process covering all CapStack and screener storage keys and downloaded artifacts? | Yes |
| Claim area | Primary evidence | Verification status |
|---|---|---|
| Core data stays local by default | index.html: persistence, engine, import/export, agent mode; network-call search | Source inspected; root tests passed |
| Waterfall / dilution / MOIC behavior | Production functions plus waterfall-*.test.mjs, prod-waterfall-loader.test.mjs | Automated tests passed; no independent financial certification |
| Import behavior | capstack-app.js XLSX regions, tests/xlsx-*.test.mjs | Automated tests passed; adversarial resource-exhaustion limits incomplete |
| Feedback and survey | api/*.js, api/_lib/sanitize.mjs, corresponding tests | Source/tests inspected; provider configuration and stored production records not inspected |
| Agent service | agent-service/src/*, README, tests, golden eval | 11 tests + eval passed; no hosted instance or provider retention inspected |
| Deployment controls | vercel.json, GitHub workflows, production-smoke script | Repository configuration inspected; current Vercel/GitHub account controls not inspected |
| Dependencies | Root and agent package.json/package-lock.json; npm audit --omit=dev | Audit run 2026-10-08: 1 high root advisory; 1 critical, 1 moderate, 1 low agent advisory. No provenance verification. |
| Revision | 9979de38db858a5496a3b009328dc1bcc3c65420 | Verified 2026-10-08 |