Skip to content

slice-2: visualization prototype (map + claims) for the discourse-lens skill - #6

Open
Meerav29 wants to merge 2 commits into
auto/queuefrom
auto/dl-skill-slice-2-prototype
Open

Meerav29 wants to merge 2 commits into
auto/queuefrom
auto/dl-skill-slice-2-prototype

Conversation

@Meerav29

Copy link
Copy Markdown
Owner

Part of #4 (autopilot, discourse-lens skill). Targets auto/queue, not main.

What this slice does

Builds the visualization skill/design.md chose (approach A: Claude's discrete judgments in, a seeded layout computed in the browser out) as one self-contained HTML page:

  • skill/prototype/template.html: the artifact template (25.6 KB, vanilla JS and inline SVG, no external requests). It has three tabs: Map (topic-coloured points, topic labels, a topic panel with descriptions and terms, a timeline strip, a hover tooltip, a source card on click or tap), Claims (propositions with agree, qualify and dispute bars, most debated first, expandable to each source's paraphrased claim with links), and Sources (a sortable table). Selecting a topic filters all three. Light and dark themes.
  • skill/prototype/build_map.py: stdlib-only validator and inliner. Run python build_map.py contract.json out.html. It is the generator slice-3 reuses.
  • skill/prototype/map.html: the reference fixture rendered (60 KB). The fixture's x/y are ignored.
  • make_test_contracts.py and check.cjs: test contracts, plus headless Chromium checks that write check-results.json and 11 screenshots.
  • skill/prototype/FINDINGS.md: P1 to P9 marked, what worked and what didn't, and GO for slice-3 with three conditions.

Review pack

About 20 to 30 minutes:

  1. Open skill/prototype/map.html in a browser (download the raw file). Try hover, click a point, click a topic, switch tabs, and narrow the window. This is the "does it feel like discourse-lens?" question from AUTOPILOT.md.
  2. Look at skill/prototype/screenshots/side-by-side.png (the app's UMAP vs the computed layout), then map-1440.png, map-390.png, claims-1440.png and variant-1440.png.
  3. Read skill/prototype/FINDINGS.md, especially "What didn't" (the map is islands, not a landscape) and "Not tested here".
  4. Skim the 6 new entries at the bottom of docs/autopilot/decisions.md.

Acceptance criteria

All were run in this cloud sandbox on 2026-10-23 with Chromium 141.0.7390.37 (preinstalled Playwright 1.56.1). Raw output is in skill/prototype/check-results.json.

  • Map and claims views per design.md. Map: points by topic, 7 labels (6 topics + unclustered), hover tooltip "Jevons paradox - Wikipedia / en.wikipedia.org · 2004-09-15", and a click or tap opens a source card. Claims: all 11 propositions with agree, qualify and dispute counts summing to 74. The order 0,9,3,1,7,2,5,4,6,10,8 matches design step 6 as computed independently. The first proposition expands to 18 stances with 18 links, all of them fixture URLs.
  • Layout approach A, x/y ignored, side-by-side included. The position hash f2ffd086b6375bec is the same for the fixture and for the fixture with x/y stripped, so x/y can't be feeding it. Nearest-topic agreement with the app's UMAP is 5 of 6 (the bar was 4). The side-by-side is screenshots/side-by-side.png.
  • Self-contained, < 1 MB. 0 requests other than file:// at both widths. No CDN script is used at all. map.html is 60,074 bytes.
  • No console errors at 1440 and 390 px. 0 errors and 0 warnings at 1440, at 390 (touch), in dark mode, and for the variant and synthetic-150 contracts. Screenshots: map-1440.png, map-390.png, map-390-tap.png, claims-1440.png, claims-390.png, plus the hover, topic-selected, dark, sources and variant shots.
  • Generator. build_map.py imports only argparse, json, re, sys, pathlib. A rebuild of map.html compared with cmp is byte-identical. bad-dangling.json → exit 1 with propositions[3].stances[0].article_id: 'does-not-exist' is not an article id. jsonschema 4.26.0 accepts that same file (0 errors), so this check exists only in build_map.py.
  • FINDINGS.md marks P1 to P8 proven. P9 is proven for size (template 25,622 bytes ≤ 40 KB), but whether Claude can re-emit the template in a chat turn is not tested. Layout time is 11.8 ms for 52 sources and 33.9 ms for synthetic 150 (bars: 1 s and 2 s). 48 of 48 clustered points are nearest their own centroid. 0 label overlaps at either width. The variant contract (27 of 52 undated, string terms, related, a bridge, edge sources, zero propositions) renders, and the timeline hides.

To re-run: the three commands in FINDINGS.md "What's here", then NODE_PATH=$(npm root -g) node check.cjs.

What's not verified: anything inside a real Claude.ai chat (A1 artifact CSP in chat, A5 a sandbox file shown as the artifact, the artifact iframe on a real phone). I re-read the Claude Code artifact page constraints and the chat What are artifacts page today; the chat page still says nothing about scripts or CDNs. The prototype makes no external request, so A1 doesn't block it.

Decisions made without you

All six are also in docs/autopilot/decisions.md.

  1. Check browser: I used the preinstalled Playwright 1.56.1 / Chromium 141, not npx playwright@1.48.2 install, because the environment says not to download browsers. Rejected: installing a second browser.
  2. Layout rotated to fit the viewport (12 angles, keep the largest scale; a pure rotation, so no distances change). The cost is that the unclustered group can land in a corner rather than at the bottom as design 4.3 says. Rejected: stretching the axes separately, or a fixed tall map.
  3. A tap opens the source card; mouse hover shows the tooltip. Rejected: tooltip plus card on tap (the same information twice).
  4. A selected topic filters claims by stance: only that topic's sources (and bridges), bars recounted, "(of N overall)" shown. Rejected: highlighting without filtering.
  5. Point size grows with stances taken; bar width scales with stance count. Rejected: size by date or domain, and full-width bars.
  6. Generated test contracts and pages are gitignored; the generators, map.html, results and screenshots are committed. Rejected: committing about 200 KB of derived files.

Deliberately not included

  • No skill files (skill/discourse-lens/ is slice-3).
  • No CDN or d3 fallback: it wasn't needed.
  • No Ask view or reader, and no article text. The page holds the fixture's titles, URLs and short paraphrased claims only.
  • No change to backend/, frontend/, tests/, AUTOPILOT.md or CLAUDE.md.
  • I didn't try alternative layouts (approach D), within-topic structure, or a date encoding on the map. FINDINGS lists these as weaknesses.

How to revert

Close this PR, or after a merge run git revert <merge commit> on auto/queue. Everything lives under skill/prototype/ plus appended entries in docs/autopilot/decisions.md and the slice-2 status line in docs/autopilot/queue.md.


Generated by Claude Code

Single-file artifact template rendering the reference fixture with a layout
computed in the browser (design.md approach A), a stdlib build_map.py that
validates a contract and inlines it, headless Chromium checks for P1-P7 with
screenshots, and FINDINGS.md (go for slice-3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2sMgTaeyEWJuGMME34RDC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2sMgTaeyEWJuGMME34RDC
Meerav29 pushed a commit that referenced this pull request Oct 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2sMgTaeyEWJuGMME34RDC
Meerav29 pushed a commit that referenced this pull request Oct 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4qkQYA3HBDbujUy5MWTH6

Copy link
Copy Markdown
Owner Author

Review routine: held, not merged. Over the 600-line cap. Flagged for the owner.

Hand-written additions come to 974 lines: template.html 358, build_map.py 219, check.cjs 179, make_test_contracts.py 91, FINDINGS.md 87, decisions.md 36, .gitignore 2, queue.md 2. I excluded map.html (generated, 358 lines, 60,074 bytes), check-results.json (138) and the 11 PNGs. Even if you also left out the template, it's still 616. The queue says the cap applies to hand-written files, so this one waits for you.

Nothing else failed. What I checked myself:

  • Map and claims views: I re-ran map.html from the PR head in headless Chromium 141 at 1440 and 390 px (390 with touch). There were 0 console errors or warnings, 0 requests that weren't file://, and no sideways scroll at 390 (scrollWidth 390). All 52 points render, and the Claims tab opens to propositions with agree, qualify and dispute bars.
  • Size and dependencies: the page is self-contained and under 1 MB.
  • Scope: the diff only touches skill/prototype/, docs/autopilot/decisions.md and queue.md. Nothing in backend/, frontend/ or tests/, and no article text.
  • Not checked: I didn't re-run the PR's own check.cjs, and I didn't judge the go/no-go in FINDINGS.md.

Heads-up: I set slice-2 to held on auto/queue (9d77b0e). This PR edits the same status line, so merging will hit a one-line conflict in docs/autopilot/queue.md. Keep whichever status you mean. Slice-3 can't start until this is merged.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants