dgenio / dgenio/contextweaver

[Parked until product proof] In-browser Pyodide playground

Open
#439 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

adoption blocked documentation needs-info priority: low
Dominant language
Python
Stars
9
Forks
17
Avg merge
21h 36m
Merged PRs (30d)
22

Description

Summary

contextweaver's demos are deterministic, network-free, and CPU-light —
the rare Python library that can run entirely in the browser. Add a
"Playground" page to the MkDocs site that loads contextweaver in Pyodide
(WebAssembly CPython) and lets visitors route a 100-tool catalog, firewall
a 16 KB payload, and inspect BuildStats — editable code, live output, no
install, no backend, no API keys.

Why this matters

  • "Try it in your browser" collapses the adoption funnel from
    README → install → quickstart to README → click. For a library whose
    pitch is a before/after number, letting visitors generate that number
    themselves in 10 seconds is the strongest possible demo.
  • Zero infrastructure: Pyodide runs client-side; GitHub Pages hosts it.
    Determinism means every visitor sees exactly the documented numbers.
  • Few projects in this category have anything comparable — it is a
    memorable differentiator and instantly shareable.

Proposed scope

  • docs/playground.md + JS glue: Pyodide bootstrap, micropip.install
    of the contextweaver wheel, a code editor (CodeMirror) preloaded with
    scenario snippets, and an output pane.
  • Scenario presets via tabs: (1) route 100 tools → ChoiceCards,
    (2) firewall + drilldown, (3) phase-budgeted build with BuildStats,
    (4) free-form editor.
  • Feasibility gate (first task): confirm the dependency story under
    Pyodide — PyYAML, jsonschema, rank-bm25 availability;
    tiktoken (Rust) will likely be unavailable, which the existing
    deterministic offline token-counter fallback (contextweaver.tokens,
    see the troubleshooting note on the tiktoken-unavailable path) is
    designed for; typer/rich/mcp are unused by the library paths the
    playground exercises but are import-time dependencies — if imports
    block, evaluate micropip's dependency handling or a documented
    playground-specific install step. Document findings in the issue
    before building UI.
  • CI: a Playwright (or similar) smoke test that loads the page and runs
    preset 1, gating the docs deploy; pin the Pyodide version.
  • Link prominently from README and docs/index.md.

Implementation notes

  • The wheel is pure-Python (py3-none-any) — installable by micropip
    directly from PyPI or a docs-hosted copy.
  • MkDocs material supports custom JS/CSS per page
    (extra_javascript); keep the playground self-contained under
    docs/assets/playground/.
  • Heuristic token counts will differ from tiktoken's — print a one-line
    note in playground output and link the troubleshooting entry; numbers
    must still be deterministic.
  • Keep load fast: lazy-load Pyodide on first interaction, show progress;
    total cold start on broadband should be < 15 s.

Acceptance criteria

  • Playground page on the docs site runs all three preset scenarios
    client-side with no backend and no keys.
  • Output for preset scenarios is deterministic across reloads.
  • Cold-start load is acceptable (lazy-loaded, with progress UI).
  • CI smoke test gates docs deployment; Pyodide version pinned.
  • README links the playground next to the install one-liner.

Out of scope

  • Running the MCP gateway/CLI in-browser (library APIs only).
  • Persistence, sharing links, or user accounts.
  • Mobile-optimized editor UX beyond what CodeMirror gives by default.

References


Priority: P1 · Effort: L · Impact: Transformational

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Pyodide dependency feasibility gate, checking the library paths, contextweaver.tokens fallback, and the tiktoken-unavailable note in docs/troubleshooting.md. If viable, map the work across docs/playground.md, docs/assets/playground/, README, docs/index.md, and the proposed Playwright smoke test. Done means the feasibility findings are documented and the page meets the listed client-side, deterministic, loading, CI, and linking criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python, wasm
Domain
documentation, frontend, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.