Polarize
GitHub Get in touch

Changelog

What changed in the code.

Merged pull requests across the public polarizetech repositories, newest first, synced from GitHub once a day. Every repository, with the posts about it, is under Work.

2026-11-24 polarize-ui #14

feat!: warm dark is the only theme; add DatePicker

Summary

1. feat!: Polarize warm dark is the only theme (BREAKING). Operator request: “use the warm dark theme only - no other themes.”

  • tokens.json color keeps only polarize. light, dark, instrument, instrument-dark, fieldguide and fieldguide-dark are removed.
  • design.css: bare :root is warm dark. There is no light palette and no prefers-color-scheme switch. data-theme="polarize" still matches, and any other stamp falls through to warm dark.
  • shadcn bridge: one block for :root, .dark, :root[data-theme="polarize"]. In src/theme.css, dark: variants now always apply.
  • Docs-site theme toggle: hidden and inert. isDark() always returns true and DocsThemeToggle renders nothing. Both are kept with @deprecated so existing imports still compile.
  • Storybook: the theme toolbar is removed and the manager UI is warm dark.
  • The design-system artifact copy is regenerated. dev_check.py now fails if a second theme, color-scheme: light or prefers-color-scheme comes back.
  • The light steps inside epistemic.families, series and diverging are kept. They are validated palette data, not a theme.

2. feat: DatePicker and Calendar (src/components/ui/date-picker.tsx)

  • It uses the Radix Popover that radix-ui already ships, so there is no new dependency.
  • The value is an ISO date string YYYY-MM-DD, not a JS Date, so a time zone can’t shift the day.
  • Features: min/max, an isDisabled predicate, Monday or Sunday week start, ISO week numbers, a month-jump view, Today and clear buttons, and a hidden form input.
  • Full keyboard navigation.
  • Stories are under General UI/Components/Date picker.
  • Nothing is needed to get warm dark.
  • To keep a removed theme, pin v0.7.0.
  • For the old fieldguide landing card look, set --landing-radius: var(--radius-base); --landing-fill: var(--card);.
  • Read colours from tokens.color.polarize.
  • ⚠ polarize.tech’s homepage used the fieldguide theme, so it will change look once it picks this up.

Testing

  • python3 dev_check.py: 475/475 pass. The count is lower than before because six themes’ contrast checks went away.
  • npx tsc -p .: clean.
  • Storybook dev server plus Playwright: the date picker is verified by mouse, keyboard (arrow, Enter), clear, min/max and blocked days. The Landing story with a light OS setting renders warm dark.
  • storybook build could not run in the sandbox because the dataset host is unreachable. That is the environment, not this change.

Generated by Claude Code

2026-11-24 retrieval-augmented-generation #72

Remove personal deployment details; placeholder plugin URL with a setup script

What

  • Plugin URL: plugin/scientific-research-rag/.mcp.json and mcp.json now ship https://<your-gateway-host>/retrieval-augmented-generation. New scripts/configure_plugin.py sets the real URL from an argument, MCP_PUBLIC_URL, or config/rag.env, and refuses an empty, non-https or placeholder value. The README’s Install section (“Point the plugin at your gateway”) explains the script and the manual edit.
  • Provider ladders: config/hub.default.toml ships OpenRouter then local. NEAR AI is still defined and joins a ladder from config/hub.toml. tests/test_hub.py and the docs (hub-plan.md, mcp-clients.md) match.
  • Names: a private node name removed from docs/call-log.md, a private repo name from a test comment.

Checks

  • uv run pytest -q tests/test_hub.py tests/test_agent_profiles.py: 59 passed
  • ruff check and ruff format --check: clean
  • configure_plugin.py "<x>" exits 2; with an https URL it rewrites both files
  • git grep tailc463ae is empty. tests/test_calllog.py still uses the example host polarize-mcp.example.ts.net.

Operators who relied on the NEAR AI rung should add it back in their own config/hub.toml.

🤖 Generated with Claude Code

2026-11-24 retrieval-augmented-generation #71

Add PIPELINE_RANKER so the calling model can judge passage relevance

What

  • PIPELINE_RANKER=library (default, unchanged) keeps the paper library’s cross-encoder.
  • PIPELINE_RANKER=client retrieves with rerank=False in ask (gateway) and in pipeline runs (pool()). Passages come back unscored, so the relevance floor and coverage levels drop out, and the unscored coverage note now tells the calling model to judge each passage itself. Pipeline runs note that the reranker was off.
  • Documents client-only claim checks: PIPELINE_MCP_LLM=client with an empty PIPELINE_VERIFIER_MODEL (no code change needed; runs are marked “no independent verifier”).

Why: the local reranker (torch on MPS) and MiniCheck each take about 7 GB on the Mac and were behind 40 s retrieval timeouts. This lets the calling model do both for now, with the local models kept as options.

Checks

  • uv run pytest -q tests/test_pipeline.py tests/test_ask.py: 55 passed
  • ruff check and ruff format --check: clean
  • New test: test_the_ranker_setting_reaches_the_library_retrieval
  • Not covered by a test: the gateway’s client branch itself (checked by hand that ask calls retrieve(query, limit, 1800)).

🤖 Generated with Claude Code

2026-11-24 retrieval-augmented-generation #53

Make ask replies conversational, with a short tools-and-services footer

What changes

  • answer_format (research_mcp/brief.py): conversational replies, 2 or 3 sentences when possible, short lists when longer. No narration of what didn’t match, was skipped or wasn’t relevant. Ends with a footer: Tools (steps that ran), Services (provider, model, balance; plus Library: no match / weak match), and the links.
  • brief.used (new): the reply’s progress steps minus skipped / not run / left out ones, and the usage line (plus the research model when a run is attached).
  • Coverage notes for weak and none now say “note it in the footer”, not “say so first”.
  • research_mcp/ask.py: the full reply carries usage; the three “says no passage applies before answering” next-steps are removed.
  • research_mcp/gateway.py: server instructions match.

Out of scope: the full relay (detail="full") and the research pipeline’s own relay.

Checks

  • pytest: 539 passed, 2 skipped
  • ruff check .: clean
  • Coder check (code-level diff check): passed

The gateway needs a restart after merge for chats to see the new format.

Source: reply wording (owner’s stated preference).

🤖 Generated with Claude Code

2026-11-23 retrieval-augmented-generation #68

Route model calls through an ordered list of providers, the Mac first

What changed

Models router (deploy/models_router.py). The router on the droplet took one primary (Modal) and one fallback (the Mac). It now takes an ordered list of providers:

  • MODELS_PROVIDERS is a comma list of names. The default is local,modal, so the Mac comes first and Modal second.
  • Each provider reads MODELS_<NAME>_URL and, optionally, MODELS_<NAME>_PROXY.
  • Any provider that answers 402 or 429, or can’t be reached, sits out for MODELS_COOLDOWN_SECONDS while the next one serves. When every provider is out, all are still tried in order.
  • GET /router/status now returns order, using and out_for_seconds.
  • The old MODELS_PRIMARY_URL, MODELS_FALLBACK_URL and MODELS_FALLBACK_PROXY settings still work and mean modal, then local.

Tests. Five router tests replace the primary/fallback test. They cover the default order, the cooldown, all providers out, the legacy settings, and the error when a provider’s URL is missing.

Docs. docs/models-service.md describes the new settings. This branch also carries an earlier commit that adds the Mac’s memory use and a Cost section (Modal plans and the DigitalOcean GPU droplet price) to the same file.

Why

Modal’s monthly credit ran out in November and the Mac has served since. A list of providers lets the Mac be the default and lets another provider be added by configuration. The next step is DigitalOcean serverless inference for the reranker and bge-m3. On 100 real passages from the paper index, its scores matched ours: the reranker to within 1.1e-5 with the same top 5, and bge-m3 at a cosine similarity of at least 0.9996.

For reviewers

  • Deploying alone changes nothing on the droplet. It still uses the legacy settings, which keep Modal first. It goes Mac-first only once its settings switch to MODELS_PROVIDERS.
  • Behaviour change: a 402 or 429 from the last provider tried now gives the router’s 503 instead of that provider’s own error.
  • Tests: the full suite passes (540) and ruff reports nothing.

🤖 Generated with Claude Code

2026-11-23 retrieval-augmented-generation #69

Add a DigitalOcean provider to the models router

Stacked on #68 (the ordered provider list). Its base is claude/models-providers; once #68 merges, GitHub retargets this PR to main.

What changed

DigitalOcean provider (deploy/models_router.py). A provider with MODELS_<N>_KIND=digitalocean serves reranking and embeddings from DigitalOcean’s serverless inference (https://inference.do-ai.run, models bge-reranker-v2-m3 and bge-m3).

  • /rerank goes to DigitalOcean’s /v1/rerank. The answer comes back as {"scores": [...]} in document order, the same shape the Mac and Modal return. The model name paper-fetch sends is replaced with DigitalOcean’s.
  • /v1/embeddings and Ollama’s /api/embed (which the hub calls) go to /v1/embeddings. DigitalOcean’s vectors aren’t unit length (about 26), while Ollama’s are, so the router scales them to unit length.
  • Every other call goes to the next provider without putting DigitalOcean out: the claim checker’s /api/chat, /api/tags and /api/ps.
  • 401, 402, 403 and 429 put DigitalOcean out for the cooldown. Serverless inference is prepaid, so an empty balance falls back to the next provider.
  • MODELS_<N>_KEY_FILE sends a provider’s own key in place of the caller’s. The key is never logged.
  • MODELS_<N>_EMBED_MODEL and MODELS_<N>_RERANK_MODEL set the model names; the defaults are bge-m3 and bge-reranker-v2-m3.

Tests. Eight new tests cover:

  • the request mapping;
  • calls DigitalOcean doesn’t serve;
  • the score order;
  • unit-length scaling in both response shapes;
  • the swap to DigitalOcean’s own key;
  • /api/chat passing on to the next provider;
  • falling back on a 402;
  • the settings read from the environment.

The app-level tests use httpx.MockTransport. fastapi and httpx join the dev group, and uv.lock is updated, so CI can run them.

Docs. docs/models-service.md gains a DigitalOcean section and DigitalOcean’s prices under Cost: $0.01 per million tokens for the reranker and $0.02 for bge-m3, prepaid.

Why

Modal’s monthly credit ran out. DigitalOcean serves the same two models per token, with no GPU to wake, for cents a month.

Checks

  • uv run pytest -q: 548 passed. ruff format --check and ruff check are clean.
  • Live check on 2026-11-23. The router ran on the Mac with MODELS_PROVIDERS=digitalocean,local:
Call Result
/rerank, 20 real passages Same scores as the Mac’s full-precision reranker to within 7.8e-6; DigitalOcean took 1.2 s, the Mac 3.7 s
/api/embed Unit-length vectors, cosine similarity of at least 0.99977 with Ollama’s
/v1/embeddings Unit length, in the OpenAI shape
/api/tags Passed through to the Mac
  • An earlier direct comparison on 100 passages matched to within 1.1e-5 (reranker) and a cosine of at least 0.9996 (bge-m3).

For reviewers

  • Deploying alone changes nothing on the droplet. It needs MODELS_PROVIDERS=digitalocean,local,modal and a DigitalOcean model access key in MODELS_DIGITALOCEAN_KEY_FILE. That key hasn’t been created yet.
  • The claim checker (bespoke-minicheck) is unaffected. It still goes to the Mac, then Modal.

🤖 Generated with Claude Code

2026-11-23 polarize-ui #13

feat!: no light ground in a dark theme, and no range sliders

What

  • Element-scoped themes with their own ground. Every theme now also matches [data-theme="X"] on any element, and [data-theme]:not(:root) paints var(--background) / var(--foreground). A board, embed or widget that can’t own <html> puts data-theme and class="ui" on its outermost element and gets no light backdrop under a dark theme.
  • No range sliders. design.js adds knobs(), run on load: any bare <input type="range"> (not inside .ui-knob / .ui-fader) is wrapped in .ui-knob[data-ui-control], and controls.css / controls.js are loaded from the design folder on demand.
  • Claude Design System copy: polarize (warm dark) is listed first, so the canvas defaults to it. The README gains both rules.
  • CLAUDE.md, INTEGRATION.md § 6: both rules. dev_check.py: checks for all of the above.

Why

The Claude Design canvas re-stamps <html data-theme> as plain light/dark from the OS. That dropped a board’s polarize stamp, so cards and plots rendered on the light palette (white) inside a dark design.

Breaking

Marked feat!:. (1) Any non-root element with data-theme now paints a ground. (2) Bare range inputs on pages loading design.js become knobs. Migration is in the commit body.

Checked

  • python3 dev_check.py: 610/610.
  • node --check design.js.
  • Browser (noise-matrix flip-view served from this branch): with <html data-theme="light">, cards were #ffffff; with data-theme="polarize" on the wrapper they were #181310 on #100d0b. A bare range inserted at runtime became a knob. No light surface anywhere on the page, Plotly backgrounds included.

🤖 Generated with Claude Code

2026-11-22 scientific-research-scaffold #18

Release v0.14.0: the designer's MVP mode for exploratory work

  • While the work is exploratory (mode = "exploratory" in HYPOTHESIS.toml, stage = "exploratory" in SCOPE.toml, or Tier: explore in a scope file), the design rule in AGENTS.md and each new app’s README now send pages through the designer’s MVP mode: one quick pass that designs and builds the page on the design system, aiming for something workable within about an hour, with numbers and methods still from established papers.
  • Past exploratory (a hypothesis or claim, or Tier: grounded/publication), the full designer pass: a Claude Design from the Design artifact type (or a zero-build mockup) handed to frontend-developer.
  • agents submodule moves to scientific-research-agents v0.11.0 (polarizetech/scientific-research-agents#6); SCAFFOLD_REF, plugin manifests and CITATION.cff move to v0.14.0; CHANGELOG.md and UPGRADING.md have v0.14.0 sections.

Tests: python3 -m unittest discover tests: 107 run, OK (2 skipped).

🤖 Generated with Claude Code

2026-11-22 scientific-research-agents #6

Release v0.11.0: the designer's MVP mode for exploratory work

  • The designer works in MVP mode on exploratory work (a study’s mode = "exploratory", a unit’s stage = "exploratory", or a scope’s Tier: explore): one quick pass that designs and builds the page from the design system’s existing components and tokens, aiming for a workable page within about an hour, with no Claude Design, separate mockup, audit or hand-off. Numbers, labels and methods still come from established papers.
  • Past exploratory, it does the full pass: a Claude Design or mockup handed to the frontend-developer.
  • Bumps VERSION, CHANGELOG.md and CITATION.cff to 0.11.0 (also covers #5).

Tests: python3 -m unittest discover tests passes (13).

🤖 Generated with Claude Code

2026-11-21 scientific-research-scaffold #17

Release v0.13.0: visual work uses the profile's design system (#14, rebased)

What changed

The work of #14 (branch design-system), rebased onto main at v0.12.1, plus a release commit for v0.13.0. The three commits from #14 are unchanged in substance; the conflicts were resolved keeping v0.12.x behaviour, including scaffold check skipping the .scaffold/ CI checkout.

  • A profile’s [design] table names a design system pinned by tag (name, package, repo, ref, rules, optional house_rules, artifact). scaffold refuses a ref that is a branch or rules that name another tag.
  • When a profile names one, every repo’s AGENTS.md gets agent-rules/design.md and the house rules, and a new repo gets a README Design section and a manifest [design] table.
  • New apps are wired to the pinned design system (serve.py reads the files at the pinned tag, serves the fonts, and shows a banner when the checkout is missing). scaffold check warns about each page that doesn’t load it, pins a branch, or hand-writes hex colours outside allow_hex.
  • Pages are designed first, by the designer agent, and carry no documentation.
  • The polarizetech profile moves polarize-ui from v0.4.2 to v0.6.7, the tag downstream repos already pin.

Full notes: CHANGELOG.md § v0.13.0, and UPGRADING.md.

Why

Repos made with the scaffold already carry the design section in their AGENTS.md, from this branch while it was unmerged. Released scaffolds don’t know it, so scaffold update to v0.12.1 would delete that section. polarize-holo’s dry run showed this on 2026-11-21. Releasing this fixes the upgrade path.

For the reviewer

  • 107 tests pass (pytest -q tests).
  • polarize-holo’s scaffold update dry run against this branch reports AGENTS.md as current. It would only change the CI ref (v0.12.1 → v0.13.0) and the session-hook order in .claude/settings.json.
  • This supersedes #14. Close #14 once this merges. Not tagged: tag v0.13.0 after merge, following the scaffold’s own release steps.

🤖 Generated with Claude Code