Skip to content
quahogEdgingChampPublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cloudline

A personal collection journal and purchase planner for carts, concentrates, flower, edibles and anything else worth remembering, a shopping list that fills itself in from an ocs.ca product link, and a Research tab that reads what Reddit says about a product type and turns it into an interactive buyer's guide.

Plain HTML, CSS and JavaScript with a small Python server. No build step, no dependencies.

Features

Collection

  • Quick add (only the name is required), with Potency & purchase, Experience and Inventory sections to fill in now or later
  • A details panel for reading an entry without editing it: facts, price per gram, tags, terpenes, notes, purchase history and an experience journal
  • Favorites view, search (/ to focus), and filters for type, status, brand, tags, rating, price and purchase date, shown as removable chips with a result count; save a set of filters as a named view
  • Buy again: a new purchase with the product facts copied and the rating and notes left blank; purchases of one product are linked into a history
  • Custom tags (rename, merge, remove from the menu), batch/lot, potency in % or mg, inventory status, "would you buy it again?"
  • Select several entries to compare (2–4), bulk-tag, re-categorise, export or delete
  • Deleting goes to Recently deleted for 30 days, with an Undo right away
  • Unsaved form drafts survive a closed tab; closing a changed form asks first

Shopping list

  • Paste an ocs.ca link and the item is added with its name, brand, category, THC and CBD ranges, terpenes, size, price and photo; add by hand otherwise
  • Priority, target price, preferred store and a note on each item; sort by priority, price, date or best match
  • Warns when a link is already on the list or already bought
  • "Matches your taste" explains itself: shared terpenes, brand or type with a specific entry you rated highly
  • Log purchase opens the form prefilled; saving moves the item into the collection, cancelling leaves it on the list

Duel

  • Insights → Your ranking → Duel: two products side by side; pick the one you'd rather have again (tap, or ← / →), ↓ for a new pair, U to undo. Each pick is an Elo match (K 40 for a product's first 10 duels, then 24, from 1500); pairs favour the same type, close scores and products with few duels. Repeat purchases share one score. The ranking shows in Insights and as the Collection sort "Your duel ranking", and syncs with everything else (duelRating / duelGames on each purchase)

Insights

  • Monthly spend with an optional budget, rating distribution, favorites by brand, inventory counts, a "worth buying again" list and value per gram
  • Every chart says what it left out (undated or unpriced entries)

Research

  • Pick a type (live resin / rosin carts, rosin, live resin concentrates, flower, pre-rolls, disposables, hash, edibles) or type your own search, and a depth:
    • Quick: 120 days, the model reads the ~30 most relevant threads in one pass
    • Standard: a year, ~90 threads in one pass
    • Deep: a year, every relevant thread (up to 400) and every comment, plus a search for comments naming the category's brands in other threads; the model reads it all in parts, takes notes on each, then writes the guide from the notes
  • Ask a question instead, on any theme at all ("how do live resin carts affect studying?", "is a dry herb vape worth it?", "what helps with cotton mouth?"). The writer plans first: which subreddits people discuss it in, short keyword searches, and what a full answer covers. The server then searches each subreddit (the archive's full-text search, else Reddit's own search) and always reads its newest posts, keeps the threads matching the searches, reads their comments and hands them to the writer. The answer: a short answer with how strong the evidence is, what people report (most common first, with how many said it and verified quotes), what it depends on, disagreements, risks people raise, tips, products named (linked to OCS when they are cannabis products), what the evidence can't tell, and questions to ask next. Quick: 4 subreddits, 2 years, ~30 threads; standard: 6, 3 years, ~80; deep: 8, 5 years, ~200 threads read in parts plus a comment search. A question needs a writer (no counts-only), and pauses, queues and continues like any other run
  • Pick who writes it: Claude (the claude CLI, your Claude Code plan), Codex (the codex CLI, your ChatGPT plan), Grok (the grok CLI, Grok Build, your SuperGrok / X Premium+ plan), or tick Counts only for no model; pick the model from the list the CLI itself reports, or type one, and a thinking level from the ones that model supports. Each writer keeps its own model, and one the CLI stops listing falls back to its default. "Read the evidence at medium thinking" only shows as live when it has an effect (Deep, Grok, questions: the runs read in parts)
  • The form is numbered in the order to fill it (what, how deep, who, model and thinking) and ends in a footer that sums up the run and how long it takes; Start stays off until the form can run (an empty custom search or question) and while a start is on its way, so a double click never starts two runs. The whole form, custom search words included, is remembered in this browser
  • The server reads every post in r/TheOCS and r/CanadianCannabisLPs for that window, picks the relevant threads, reads their comments, and lines brands up against the full OCS catalog; a progress panel shows each stage
  • The model writes the guide: quick picks (best overall, value, daytime, night & sleep, flavour, strongest, solo sessions, beginners, skip), trends, brand report cards, tiered rankings with pros, cons and verdicts, things to skip, tips, glossary and FAQ. Every quote is checked word for word against the real comment and dropped if it isn't there
  • Every guide ends with How to start: the method in a sentence (for a cart: one short puff on a low battery, wait 10–15 minutes, then decide), how much the first time, how long to wait, when it kicks in, peaks and wears off, the steps of a first session, what's different if you already smoke, how people overdo it, what helps if it's too much, gentler first picks from the guide's products, and verified quotes. Each step says whether people in the threads say it or it's a general harm-reduction basic, and the section says how strong its evidence is (see below)
  • Without a model, a plainer guide is built from mention counts and tone
  • Every guide says how much was fetched and how much the model actually read
  • Product cards show indica / sativa / hybrid (from OCS), strength, best time, what it's good for, what the high is like, hardware, value, all terpenes and every size's price; filter by plant type, use, brand or solo fit. Brand cards show OCS counts and prices, trend, tone and best pick. "What's changing" adds counted risers and fallers and what's new on OCS. Privacy mode hides everything to do with solo sessions
  • The section menu (Quick picks … Method) stays pinned under the app bar as you scroll and marks the section you're in
  • A Terpenes section lists every terpene OCS gives for the ranked products (spellings like Beta-Myrcene folded together): what each smells like, what people link it with, where else it's found, and the best-rated products carrying it. A terpene filter in Rankings narrows the list to products with it
  • Tap any terpene (a Rankings card, an entry's details, a shopping-list item) for its card: main effects, what it smells like, what people say about it, where else it's found, and how products with it rated in your own collection. In Research it also says how many ranked products carry it and the best-rated one, with buttons to filter Rankings to it or compare it in the Terpenes section. It opens beside the chip on a wide screen and as a bottom sheet on a phone
  • If the writer hits its plan's usage limit, the run pauses instead of failing: everything gathered and every part already read is saved, and the tab offers Continue (same writer, once the limit resets — the reset time is shown), Finish with another writer or model, or Discard. A Stop or a server restart mid-run is saved the same way
  • Up next: while a run goes, Add to queue lines up more; they run one after another, on the server, with the tab closed. Reorder (Move to front) or remove them. With "continue by itself when the limit resets" ticked (the default), a run paused by a usage limit goes back to the front of the queue and continues at the reset time the CLI gave (plus two minutes; an hour later if it didn't say). Meanwhile runs for other writers go ahead, and new runs for that writer are queued for the reset time (Start now anyway skips the wait). Six quick pauses in a row and it waits for you instead. The queue, and a run cut off by a server restart, pick up again when the server starts
  • The guide page: filterable, sortable product cards with Reddit quotes and links, a compare table, a price-per-gram vs score chart, monthly talk volume, brand mention sparklines; each card links to OCS, store prices and the latest posts, and adds straight to the shopping list (and says if it's already in your collection, with your rating)
  • Sort through on a guide: its products one at a time, best tier first, as cards you swipe or answer with keys: → onto the shopping list, ↑ a must-try (on the list at high priority), ← not for me, ↓ skip for now, U undo (an add comes back off the list), Esc to close. Products you own or already listed are left out, and decisions are remembered per guide in this browser, so the next visit starts where you stopped
  • While a run goes, the progress panel says roughly how long is left: from this run's own pace once parts finish, before that from past runs with the same writer, model and thinking level (research/cache/timing.json). Full log under it groups everything the run said by step, folds repeated progress lines and marks problems (failed, timed out, limit…)
  • Guides are saved and can be reopened, re-run, archived or deleted; the list sorts by date, who wrote it, depth, topic, comments read or product count, with separate Active and Archived views, and filters by writer, type and depth (shown when the guides differ in them). "Who wrote it" groups guides under Claude, Codex, Grok and counts-only, one heading per model (the one used most recently first), deepest and highest thinking level first inside each; "Deepest first" and "Topic" get headings too, and a deep guide a model read ranks above a deep one built from counts

Everywhere

  • Light (cream) and dark (midnight green) themes, following the OS or picked in the menu; a deep-green header and page heroes with a leaf mark, lime and purple accents, colour-coded product types
  • Privacy mode hides prices and notes for screen sharing
  • Discretion (Menu): a plain "Notes" tab title and icon; blank the page when you switch away, so the phone's app switcher shows nothing; and a panic cover: ` or a three-finger tap covers everything with a plain page, again (or a double tap) brings it back. Per browser, and concealment only: anyone holding the device can still open the page
  • Keyboard: dialogs trap focus and return it on close, Escape closes, Back closes the details panel
  • Installable, and the page itself opens offline

Run

python3 serve.py

Then open http://127.0.0.1:3002. Options:

Flag Default
--port, --host 3002, 127.0.0.1
--data weed_chart.json next to serve.py
--backups backups/ next to the data file
--research research/ next to the data file

Opening index.html directly still works, but only this browser keeps the data and there is no link lookup: ocs.ca sends no CORS headers, so the browser cannot fetch it itself.

Saving and sync

  • Every change is written to this browser first, then sent to the server. The sync pill says Saved only once the server has confirmed it.
  • Each save names the revision it was based on. If another device saved in between, the server answers 409 with its copy; the page merges the two record by record against the last copy both agreed on and saves again. A record edited on both sides keeps the newer edit, and you are told.
  • Offline or failed saves stay queued in the browser (across reloads) and retry with backoff; select the pill to retry now.
  • A browser that has never synced with this server and holds records the server lacks is asked which copy to keep, so data deleted elsewhere can't quietly come back.

Backups

  • Before an import, a restore or a clear, and at most every 15 minutes while you edit, the server copies weed_chart.json into backups/. The newest 100 are kept.
  • Menu → Backups & recovery lists them; preview one to see what would come back or go, then restore. Restoring snapshots the current state first.
  • Export JSON downloads everything, including the journal and Recently deleted.
  • backups/ holds personal data and is gitignored.

How the OCS lookup works

ocs.ca is a Shopify storefront, so every product page has a machine-readable twin at /products/<handle>.js. OCS publishes the cannabis specifics as namespaced tags on the product:

category--Vapes            thc_content_min--70.000000    terpenes--Limonene
subcategory--510 Thread…   thc_content_max--76.000000    plant_type--Sativa Dominant

ocs.py pulls the handle out of whatever link you paste, re-requests it from a hardcoded https://ocs.ca address, and maps those tags onto the fields this tracker stores. Potency comes back as the range OCS publishes; the single THC and CBD numbers written into an entry are its midpoint, and the range is kept in the notes as a store estimate.

Edibles are dosed in milligrams, so their percentage tags are a flat zero — those are left blank rather than recorded as "0% THC".

How the hibuddy price links and store prices work

Every collection row, shopping-list item, detail panel and research card has a price-tag link to the product's own page on hibuddy.ca, which compares store prices. hibuddy addresses products by an opaque id (/product/ef5b560e…), so the link can't be built from the name. Instead it points at /api/hibuddy?name=&brand=&type=, and only when it is opened does hibuddy.py read hibuddy's search page (/products/search?q=<brand> <name>) and pick the hit that is this product: same brand, every distinctive word of the name, the right category (a cart is never the same strain's pre-roll), a cart kept apart from the same strain's all-in-one pen, and a live resin cart kept apart from the same strain's distillate cart. The server then redirects there, or to the hibuddy search when nothing fits. Answers are cached in memory for a day.

Research guides also carry store prices. Once a guide is saved, research.py looks up each product (by its OCS listing first, the exact item and size the guide prices) and reads its hibuddy page, which lists the stores near a point with each one's price for every size. Each product gets hibuddy: {url, size, sizes: [{size, low, high, stores}], checked} and the guide a storePrices summary. The card shows the range for the size OCS sells beside its Store prices button; the compare table and the Sort-through deck show it too. A range is the cheapest and dearest store today: hibuddy keeps no price history on the page.

  • Where: stores near downtown Toronto (NEAR in hibuddy.py, hibuddy's own default). The page lists at most 200 offers, nearest first, so in the city that's the few km around the point.
  • Gently: one hibuddy page every 2.5 s (REQUEST_GAP). hibuddy shows a client that asks much faster "Product temporarily unavailable" for a while; when that happens nothing asks again for 15 min (REST_SECONDS), and a run keeps the products it had already checked. Only ordinary pages are read: hibuddy's robots.txt keeps scripts out of /api/.
  • Refresh any saved guide's prices from the shell: python3 research.py --store-prices (all) or --store-prices <report>.json. A guide of ~45 products takes a few minutes.

How the How to start section works

start.py writes it once the guide is saved, with the same writer, model and thinking level, in one more model call (2–4 min). Buying threads say little about how to start, so it reads two kinds of evidence:

Part What Where it comes from
A the guide's own threads, only the comments about starting out, dosing or taking too much research/cache/threads/ (a pattern picks "start low", "2 small puffs", "wait 10 minutes", "greened out", "redosed"…)
B up to 10 threads asking or answering how to start with this kind of product, every comment, starting talk first each topic's subreddits in FORMS (r/Carts for carts, r/edibles, r/Dabs, r/hash, r/trees…): their newest posts (the whole year on file for r/TheOCS and r/CanadianCannabisLPs), plus the archive's full-text search when it answers

The writer may fill gaps with general harm-reduction basics (Canada's Lower-Risk Cannabis Use Guidelines) and must mark those steps "General advice". It is saved as guide.start, and where it came from as startMethod (writer, comments read, subreddits, quotes kept and dropped). Quotes are checked like the guide's; a quote's thread is set from its comment.

  • Best effort: if the writer hits its usage limit or fails here, the guide is kept without the section, and the log says how to add it.
  • Older guides, or one that missed it: python3 research.py --how-to-start --provider claude --model opus --effort high writes it for every guide without one; name a report (--how-to-start <report>.json) to write it again. Counts-only guides get one too, written by the writer you name.
  • Answers to questions don't get one: they aren't about one kind of product.
  • The archive's full-text search often answers 422 when busy; a run then goes on with the subreddits' newest posts, which always load.

How research works

research.py does the work; serve.py runs it in a background thread (one at a time, the rest queued in research/queue.json) and research.js shows it. It also runs from the shell:

python3 research.py live-carts --depth quick                     # Claude, CLI default model
python3 research.py custom --query "cold cure" --no-llm
python3 research.py flower --model sonnet --effort low
python3 research.py hash --depth deep --provider codex --model gpt-6-sol --effort medium
python3 research.py rosin --provider grok --model grok-4.7 --effort high
python3 research.py --resume hash-20260924T182347Z --provider claude   # continue a paused run
python3 research.py question --query "does a grinder card beat a grinder?" --provider codex
python3 research.py --store-prices                                 # re-check every saved guide's store prices
python3 research.py --how-to-start --model opus --effort high      # How to start for every guide without one
Stage Source Notes
Catalog ocs.ca/products.json (Shopify, ~4,700 products, 19 pages) cached 12 h
Reddit Arctic Shift archive API, every post in the window cached; reruns fetch only new posts. Falls back to Reddit's public RSS feeds
Threads every comment of the top 45 / 100 / all (≤400) threads, paging past the archive's 100-per-request limit cached a day (a month for old threads)
Brand search (deep) the archive's full-text comment search, for the category's 12 most-discussed brands best effort; busy names can time out
Parse brand mentions (from OCS vendor names), month counts, keyword tone
Write claude -p --json-schema, codex exec --output-schema or grok --json-schema, no tools (llm.py) quick 1–5 min; deep 20–45 min
How to start the guide's threads, plus threads about starting out (see above); one more call to the same writer 2–4 min; best effort
Store prices each product's hibuddy page, after the guide is saved (see above) a few min; best effort

Prices, sizes, potency and links on the guide always come from the OCS catalog; the model only supplies a catalog reference. Reddit's own JSON API refuses unauthenticated scripts, and PullPush asks not to be scraped, so neither is used. Requests are throttled (1/s to the archive, 1 per 3 s to Reddit).

Everything lands in research/ next to the data file: reports/ holds the guides (JSON), cache/ the downloads, checkpoints/ runs waiting to continue (a few MB each; removed once their guide is written), queue.json the queued runs, which writers are held by a usage limit until when, and the run that was going (so a restart continues it). It's gitignored. Starting or queueing a run is refused for cross-site requests, since it spends Claude usage; so is saving the collection.

The public copy

GitHub Pages serves this repo at https://quahogedgingchamp.github.io/weed/. There is no serve.py there, so the collection starts empty and lives only in that visitor's browser, and the Research tab reads a snapshot instead of /api/research: python3 publish_research.py copies every guide in research/reports/ into published/research/ (plus an index.json shaped like the overview). On a *.github.io host the tab is read-only: no launcher, no archive, delete or run-again buttons. After a new guide, run the script, commit published/ and push.

Data file

  • weed_chart.json holds products, wishlist, experiences, trash and settings, and stays hand-editable. A file in the old v1 shape (or a bare array) is upgraded on first read, after a snapshot.
  • Its revision is a hash of its contents, so edits made directly to the file show up in open browsers within a few seconds.
  • A file that fails to parse is reported as an error, never as "empty", so a typo can't cause an empty collection to be synced back over it.
  • The server validates every save (types, lengths, http(s)-only links, unique ids) and rejects bad data with a 400 rather than writing it.
  • Only the page's own files are served: never the data file, backups, .git or the Python sources.

Tests

python3 -m unittest discover tests      # server: revisions, validation, snapshots, routing
node --test tests/*.test.js             # merge, migration, filters, units; script order
PLAYWRIGHT_CORE=/path/to/node_modules/playwright-core node tests/e2e.js

All three run against temporary data, never weed_chart.json; the browser test writes its sample guide with tests/make_guide.py (no network, no model). The browser test starts its own server on a free port. On qwertyserver Chromium lacks some desktop libraries (libatk-1.0.so.0, fonts): download and unpack them into a temporary folder and pass LD_LIBRARY_PATH and FONTCONFIG_FILE, as in ~/infomds/MEALPLANNER.md ("Browser verification").

Files

The page is plain scripts in js/, loaded in file order by index.html with no build step. They share one global scope, like one long file: a later file can use anything an earlier one defines, and code that runs at load time may only use what is already loaded. tests/scripts.test.js checks that index.html and sw.js list every script and that no name is declared twice. A new script needs a line in both.

File Purpose
index.html Page structure
styles.css Themes and layout
core.js Validation, migration, merge, filters, insights (no DOM)
js/01-setup.js … js/20-start.js The page: storage and state, then one file per part (collection, filters, details, form, OCS, terpenes, shopping, insights, backups, menu, sync); 20-start.js starts it
sw.js, manifest.webmanifest, icon.svg Offline shell and install
js/30-research-*.js … The Research tab: setup, home (launcher, progress, queue), guide, products, deck, how to start, terpenes, answer (a question's page), events
fonts/ Bricolage Grotesque (headings), self-hosted, SIL OFL
ocs.py Turns an ocs.ca link into fields
hibuddy.py Finds a product's hibuddy.ca page for the price links, and reads its store prices
research.py Reddit + OCS research runs, the guide writer, the run queue
ask.py Free questions: the plan, the searches, the answer's prompts and file
start.py A guide's How to start section: its evidence, prompt and schema, written after the guide
llm.py Claude / Codex / Grok CLI calls with a JSON schema, and their model lists
serve.py Static files, /api/state, /api/snapshots, /api/lookup, /api/hibuddy, /api/research…
publish_research.py, published/ The guides, copied for the read-only public copy
tests/ Server, core and browser tests

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages