constitution · epochs · watch · epoch 3

comparison

c_f10e7b043e68 (tommy-mor) vs c_f6d0fed9bf9a (tommy-mor)

download prompt · raw event · cmp_493943df9ce204

council reasoning

~anthropic/claude-sonnet-latest · winner A · 8:2 · permalink

Side A is a coherent, working refactor that replaces a combinator-based URL engine with a cleaner graph-based canonicalization approach, updates docs, and preserves test coverage via registry_tests. Side B's 'init seed' dump adds huge files (forms.rs, ranking.rs) that literally contain leftover shell prompts and 'cat' commands baked into the file content, meaning those files as committed are broken/non-compiling, making it low-quality, unreviewed noise despite its size.

~x-ai/grok-latest · winner A · 3:1 · permalink

A delivers a focused architectural refactor of URL canonicalization (deleting the ad-hoc engine primitives in favor of a semantic DFA/graph design, with registry updates and docs), which is lasting core design. B is a noisy bulk seed dump of prototypes, notes, and large files (parser/reducer/ranking/vote) polluted by terminal paste artifacts and non-code .tdsl ideation, so most of its volume does not land as clean lasting value.

openai/gpt-chat-latest · winner A · 4:1 · permalink

Side A replaces the URL canonicalization implementation with a new graph-based architecture by removing the old `engine` layer, routing the public API through `graph`/`parse`, and simplifying `registry.rs` to use semantic graph resolution and shared breadcrumb logic. Side B adds a very large mix of prototype code, notes, and even terminal-capture artifacts (for example `forms.rs` and `ranking.rs` include shell prompts), making it a broad initial dump rather than a focused, maintainable project improvement.

sides

A — c_f10e7b043e68 (tommy-mor)

message

[7bb7145d] url stuff

diff preview

diff --git a/AGENTS.md b/AGENTS.md
index e60b9ba6012593361ef10e8fdd9439cd9932e09b..babb889d6fbfb1fa7176c9e6b7544ae17b61dd2e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -58,4 +58,4 @@ Use **tmux** for `cargo run --package sorter2-server` (dev server). Rebuild afte
 
 - First `cargo test` / `cargo build --release` is slow; Clojure smoke test always does a release build.
 - `legacy/` and `ideas/` are not part of the workspace build.
-- **ItemId** for web URLs is a canonical full URL (`https://reddit.com/r/rust`). Rules live in [`server/src/url_rules/`](server/src/url_rules/) (composable Rust, not a config DSL). After changing canonicalization rules, rebuild the projection: `cargo run --package sorter2-server -- replay-index`.
+- **ItemId** for web URLs is a canonical full URL (`https://reddit.com/r/rust`). Rules live in [`server/src/url_rules/graph.rs`](server/src/url_rules/graph.rs): a semantic graph (DFA on host + path, query params in `Context`) with a generic internet fallback for unknown sites. After changing rules, rebuild the projection: `cargo run --package sorter2-server -- replay-index`.
diff --git a/server/src/url_rules/engine.rs b/server/src/url_rules/engine.rs
deleted file mode 100644
index e29b6b48c08deb7bffe031b1e542b1e25a7bef15..0000000000000000000000000000000000000000
--- a/server/src/url_rules/engine.rs
+++ /dev/null
@@ -1,187 +0,0 @@
-//! Composable URL normalization primitives.
-
-use std::collections::HashMap;
-
-use url::Url;
-
-/// Mutable URL view used by rule combinators before serializing to a canonical string.
-#[derive(Debug, Clone)]
-pub struct ParsedUrl {
-    pub scheme: String,
-    pub host: String,
-    pub path_segments: Vec<String>,
-    pub query: HashMap<String, String>,
-    pub fragment: Option<String>,
-}
-
-impl ParsedUrl {
-    pub fn parse(raw: &str) -> Option<Self> {
-        let trimmed = raw.trim();
-        if trimmed.is_empty() {
-            return None;
-        }
-
-        let with_scheme = if trimmed.contains("://") {
-            trimmed.to_string()
-        } else if trimmed.starts_with("r/") || trimmed.starts_with("/r/") {
-            let rest = trimmed.trim_start_matches('/').trim_start_matches("r/");
-            format!("https://reddit.com/r/{rest}")
-        } else if trimmed.contains('.') && !trimmed.starts_with('/') {
-            format!("https://{trimmed}")
-        } else {
-            trimmed.to_string()
-        };
-
-        let url = Url::parse(&with_scheme).ok()?;
-        let host = url.host_str()?.to_string();
-        let path_segments: Vec<String> = url
-            .path_segments()
-            .map(|segs| segs.filter(|s| !s.is_empty()).map(str::to_string).collect())
-            .unwrap_or_default();
-
-        let mut query = HashMap::new();
-        for (k, v) in url.query_pairs() {
-            query.insert(k.into_owned(), v.into_owned());
-        }
-
-        Some(Self {
-            scheme: url.scheme().to_string(),
-            path_segments,
-            query,
-            fragment: url.fragment().map(str::to_string),
-            host,
-        })
-    }
-
-    pub fn with_path_segments(&self, segments: &[String]) -> Self {
-        let mut u = self.clone();
-        u.path_segments = segments.to_vec();
-        u
-    }
-
-    pub fn to_url(&self) -> Option<Url> {
-        let mut url = if self.path_segments.is_empty() {
-            Url::parse(&format!("{}://{}", self.scheme, self.host)).ok()?
-        } else {
-            let path = format!("/{}", self.path_segments.join("/"));
-            Url::parse(&format!("{}://{}{}", self.scheme, self.host, path)).ok()?
-        };
-        if !self.query.is_empty() {
-            let mut pairs: Vec<_> = self.query.iter().collect();
-            pairs.sort_by(|a, b| a.0.cmp(b.0));
-            url.query_pairs_mut().clear();
-            for (k, v) in pairs {
-                url.query_pairs_mut().append_pair(k, v);
-            }
-        }
-        if let Some(ref frag) = self.fragment {
-            url.set_fragment(Some(frag));
-        }
-        Some(url)
-    }
-
-    pub fn canonical_string(&self) -> Option<String> {
-        let url = self.to_url()?;
-        let mut s = url.to_string();
-        if self.path_segments.is_empty() {
-            s = s.trim_end_matches('/').to_string();
-        }
-        Some(s)
-    }
-}
-
-pub fn force_https(u: &mut ParsedUrl) {
-    if u.scheme == "http" {
-        u.scheme = "https".to_string();
-    }
-}
-
-pub fn drop_fragment(u: &mut ParsedUrl) {
-    u.fragment = None;
-}
-
-pub fn strip_www(u: &mut ParsedUrl) {
-    if u.host.starts_with("www.") {
-        u.host = u.host[4..].to_string();
-    }
-}
-
-pub fn lowercase_host(u: &mut ParsedUrl) {
-    u.host = u.host.to_ascii_lowercase();
-}
-
-pub fn lowercase_path(u: &mut ParsedUrl) {
-    for seg in &mut u.path_segments {
-        *seg = seg.to_ascii_lowercase();
-    }
-}
-
-pub fn clear_query(u: &mut ParsedUrl) {
-    u.query.clear();
-}
-
-pub fn keep_only_query(u: &mut ParsedUrl, keys: &[&str]) {
-    u.query
-        .retain(|k, _| keys.iter().any(|want| want == &k.as_str()));
-}
-
-pub fn strip_tracking_params(u: &mut ParsedUrl) {
-    u.query.retain(|k, _| {
-        let lower = k.to_ascii_lowercase();
-        !(lower.starts_with("utm_")
-            || matches!(
-                lower.as_str(),
-                "fbclid" | "gclid" | "ref" | "ref_src" | "ref_source" | "mc_cid" | "mc_eid"
-            ))
-    });
-}
-
-pub fn truncate_after_segment(u: &mut ParsedUrl, name: &str, keep: usize) {
-    if let Some(i) = u.path_segments.iter().position(|s| s == name) {
-        let end = (i + 1 + keep).min(u.path_segments.len());
-        u.path_segments.truncate(end);
-    }
-}
-
-pub fn drop_listing_suffix(u: &mut ParsedUrl, suffixes: &[&str]) {
-    if u.path_segments.len() >= 3 && u.path_segments.first().map(String::as_str) == Some("r") {
-        if let Some(last) = u.path_segments.last() {
-            if suffixes.iter().any(|s| *s == last.as_str()) {
-                u.path_segments.pop();
-            }
-        }
-    }
-}
-
-pub fn normalize_reddit_host(u: &mut ParsedUrl) {
-    if matches!(
-        u.host.as_str(),
-        "old.reddit.com" | "new.reddit.com" | "www.reddit.com"
-    ) {
-        u.host = "reddit.com".to_string();
-    }
-}
-
-pub fn rewrite_youtu_be(u: &mut ParsedUrl) {
-    if u.host == "youtu.be" && u.path_segments.len() == 1 {
-        let id = u.path_segments[0].clone();
-        u.host = "youtube.com".to_string();
-        u.path_segments = vec!["watch".to_string()];
-        u.query.insert("v".to_string(), id);
-    }
-}
-
-pub fn rewrite_youtube_shorts(u: &mut ParsedUrl) {
-    if u.host == "youtube.com" && u.path_segments.first().map(String::as_str) == Some("shorts") {
-        if let Some(id) = u.path_segments.get(1).cloned() {
-            u.path_segments = vec!["watch".to_string()];
-            u.query.insert("v".to_string(), id);
-        }
-    }
-}
-
-pub fn normalize_youtube_host(u: &mut ParsedUrl) {
-    if matches!(u.host.as_str(), "m.youtube.com" | "www.youtube.com") {
-        u.host = "youtube.com".to_string();
-    }
-}
diff --git a/server/src/url_rules/mod.rs b/server/src/url_rules/mod.rs
index 03d53bd3e82d704a01ba3fd8dd02b7d31422c0de..9e1445346ce77a49dd6a7e7713bf9c57aef353cc 100644
--- a/server/src/url_rules/mod.rs
+++ b/server/src/url_rules/mod.rs
@@ -1,8 +1,12 @@
-//! URL canonicalization and hierarchy rules for [`crate::path_types::ItemId`].
+//! URL canonicalization and hierarchy via a semantic graph (DFA + generic fallback).
 
-mod engine;
+mod graph;
+mod parse;
 mod registry;
 
+#[cfg(test)]
+mod registry_tests;
+
 pub use registry::{
     canonicalize_raw, looks_like_url, navigable_breadcrumbs, parent_url, resolve_id, CanonicalResult,
 };
diff --git a/server/src/url_rules/registry.rs b/server/src/url_rules/registry.rs
index 14514e9af8385fb2b9b2f35eb9ee14d453d4b97c..8e6c012ea1fc74b864307bdacdf5a0f5db5259fc 100644
--- a/server/src/url_rules/registry.rs
+++ b/server/src/url_rules/registry.rs
@@ -1,12 +1,7 @@
-//! Per-domain canonicalization and hierarchy rules.
+//! Public API: canonical identity and hierarchy via the URL graph.
 
-use std::collections::HashSet;
-
-use super::engine::{
-    clear_query, drop_fragment, drop_listing_suffix, force_https, keep_only_query, lowercase_host,
-    lowercase_path, normalize_reddit_host, normalize_youtube_host, rewrite_youtu_be,
-    rewrite_youtube_shorts, strip_tracking_params, strip_www, truncate_after_segment, ParsedUrl,
-};
+use super::graph::graph;
+use super::parse::UrlParts;
 
 /// Result of canonicalizing a raw URL string.
 #[derive(Debug, Clone, PartialEq, Eq)]
@@ -16,71 +11,16 @@ pub struct CanonicalResult {
     pub alias_of: Option<String>,
 }
 
-fn apply_global(u: &mut ParsedUrl) {
-    force_https(u);
-    drop_fragment(u);
-    strip_www(u);
-    lowercase_host(u);
-    strip_tracking_params(u);
-}
-
-fn normalize_reddit(u: &mut ParsedUrl) {
-    normalize_reddit_host(u);
-    lowercase_path(u);
-    truncate_after_segment(u, "comments", 1);
-    drop_listing_suffix(u, &["hot", "top", "new", "rising", "controversial"]);
-    clear_query(u);
-}
-
-fn normalize_youtube(u: &mut ParsedUrl) {
-    rewrite_youtu_be(u);
-    normalize_youtube_host(u);
-    rewrite_youtube_shorts(u);
-    keep_only_query(u, &["v", "list"]);
-}
-
-fn normalize_default(_u: &mut ParsedUrl) {
-    // Global rules only.
-}
-
-fn domain_key(host: &str) -> &'static str {
-    if host == "reddit.com" || host.ends_with(".reddit.com") {
-        "reddit.com"
-    } else if host == "youtube.com" || host == "youtu.be" {
-        "youtube.com"
-    } else {
-        "default"
-    }
-}
-
-fn normalize_for_host(u: &mut ParsedUrl) {
-    apply_global(u);
-    match domain_key(&u.host) {
-        "reddit.com" => normalize_reddit(u),
-        "youtube.com" => normalize_youtube(u),
-        _ => normalize_default(u),
-    }
-}
-
-/// Structural path segments that must not become standalone tree nodes when more path follows.
-fn structural_trailing(host: &str) -> &'static [&'static str] {
-    match domain_key(host) {
-        "reddit.com" => &["comments"],
-        _ => &[],
-    }
-}
-
 /// Canonicalize a raw URL. Returns `None` if the input is not URL-like.
 pub fn canonicalize_raw(raw: &str) -> Option<CanonicalResult> {
     let trimmed = raw.trim();
     if trimmed.is_empty() {
         return None;
     }
-    let mut u = ParsedUrl::parse(trimmed)?;
-    let input_snapshot = u.canonical_string()?;
-    normalize_for_host(&mut u);
-    let canonical = u.canonical_string()?;
-    let alias_of = if input_snapshot != canonical {
+    let parts = UrlParts::parse(trimmed)?;
+    let g = graph();
+    let canonical = g.resolve_canonical(&parts)?;
+    let alias_of = if trimmed != canonical {
         Some(trimmed.to_string())
     } else {
         None
@@ -98,35 +38,14 @@ pub fn resolve_id(raw: &str) -> Option<String> {
 
 /// Navigable ancestor URLs from domain root up to and including `canonical` (full URLs).
 pub fn navigable_breadcrumbs(canonical: &str) -> Vec<String> {
-    let Some(u) = ParsedUrl::parse(canonical) else {
-        return vec![canonical.to_string()];
+    let parts = match UrlParts::parse(canonical) {
+        Some(p) => p,
+        None => return vec![canonical.to_string()],
     };
-    let structural: HashSet<&str> = structural_trailing(&u.host).iter().copied().collect();
-    let n = u.path_segments.len();
-    let mut out = Vec::new();
-
-    // Domain root (no path segments).
-    if let Some(base) = u.with_path_segments(&[]).canonical_string() {
-        out.push(base);
-    }
-
-    for i in 0..n {
-        let segs: Vec<String> = u.path_segments[..=i].to_vec();
-        let is_last = i == n - 1;
-        let seg = u.path_segments[i].as_str();
-        if structural.contains(seg) && !is_last {
-            continue;
-        }
-        if let Some(url) = u.with_path_segments(&segs).canonical_string() {
-            if out.last() != Some(&url) {
- 

… preview truncated; 3,144 characters omitted

download full diff A

B — c_f6d0fed9bf9a (tommy-mor)

message

[1d9d8ade] init seed

diff preview

diff --git a/TEST.sh b/TEST.sh
new file mode 100755
index 0000000000000000000000000000000000000000..266b71f29259f5c2cad2617476ebe2ebc9596d39
--- /dev/null
+++ b/TEST.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cargo test --all
+./scripts/clj-test.sh
diff --git a/bundle.js b/bundle.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d316f9a57cc7c379fe4bd8e42e092c7eac5d265
--- /dev/null
+++ b/bundle.js
@@ -0,0 +1,52 @@
+/**
+ * Slug web UI: only plumbing — fetch/eval/SSE. No product UI logic here.
+ */
+(function () {
+  function evalJs(js) {
+    if (js && String(js).trim()) {
+      eval(js);
+    }
+  }
+
+  // Theme cookie sync (runs before paint; full reload if localStorage disagrees with cookie)
+
+  function initSlugUi() {
+    // POST forms → eval response (except theme + full-navigation forms)
+    document.addEventListener('submit', async function (e) {
+      var f = e.target;
+      if (!f || f.tagName !== 'FORM') return;
+      if ((f.method || 'get').toLowerCase() !== 'post') return;
+      if (f.id === 'slug-theme-form') return;
+      if (f.getAttribute('data-navigate') === 'full') return;
+      e.preventDefault();
+      var resp = await fetch(f.action, {
+        method: 'POST',
+        body: new URLSearchParams(new FormData(f)),
+        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+        credentials: 'same-origin',
+      });
+      evalJs(await resp.text());
+    });
+
+    // SSE: server-pushed JS
+    function connectSSE() {
+      var ssePath = window.location.pathname + window.location.search;
+      var es = new EventSource('/sse?path=' + encodeURIComponent(ssePath));
+      es.onmessage = function (e) {
+        evalJs(e.data);
+      };
+      es.onerror = function () {
+        es.close();
+        setTimeout(connectSSE, 3000);
+      };
+    }
+    connectSSE();
+  }
+
+  if (document.readyState === 'loading') {
+    document.addEventListener('DOMContentLoaded', initSlugUi);
+  } else {
+    initSlugUi();
+  }
+})();
+
diff --git a/clj-test.sh b/clj-test.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b62a49b98ed60a65a46807b7ad80fa3142f14952
--- /dev/null
+++ b/clj-test.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cd "$(dirname "$0")/.."
+mkdir -p target
+exec clojure -M:kaocha
diff --git a/forms.rs b/forms.rs
new file mode 100644
index 0000000000000000000000000000000000000000..d509fd889fde3fed2662ce0a39006b7a51ae762a
--- /dev/null
+++ b/forms.rs
@@ -0,0 +1,145 @@
+tommy@Tommys-Laptop:~/programming/slug-star/slug|main ⇒  cat server/src/form_template.rs
+//! Plan2-style JSON templates with `{"$form": "field_name"}` holes, filled from
+//! `application/x-www-form-urlencoded` (or any `String` → `String` map) **before**
+//! deserializing into a typed struct.
+//!
+//! # Wire format
+//!
+//! Templates are **compact JSON** (`serde_json::to_string`): one line, no pretty
+//! printing, strings escaped per JSON rules (`\"`, `\n`, etc.). Embed that string
+//! in HTML attributes or text nodes with normal HTML escaping (e.g. maud), not
+//! bespoke encodings.
+//!
+//! # Power vs flat hidden fields
+//!
+//! A form is always a string→string map. You can fake depth with dotted keys (`a.b.c`),
+//! but one structured blob (`__rpc__` = compact JSON) gives you nested objects,
+//! arrays, and optional fields without inventing a new naming scheme each time.
+//!
+//! # Security
+//!
+//! Substitution runs **before** `serde` into your command type. It does not fix
+//! authorization: if the client can replace the hidden `__rpc__` value, they can
+//! change the command shape unless you validate (signed blob, server-side session
+//! context, or treat the blob as hints only). Same threat model as any hidden field.
+
+use serde::Serialize;
+use serde_json::Value;
+use std::collections::HashMap;
+
+/// Serialize a value to compact JSON for a hidden `__rpc__` (or similar) field.
+pub fn template_json_compact<T: Serialize>(v: &T) -> serde_json::Result<String> {
+    serde_json::to_string(v)
+}
+
+/// Recursively walk the JSON AST and replace `{"$form": "key"}` with the submitted
+/// string for `key` (empty if missing). Other keys are unchanged.
+pub fn substitute_form_vars(val: &mut Value, form_data: &HashMap<String, String>) {
+    match val {
+        Value::Object(map) => {
+            if map.len() == 1 {
+                if let Some(Value::String(field_name)) = map.get("$form") {
+                    let submitted = form_data
+                        .get(field_name.as_str())
+                        .map(|s| s.as_str())
+                        .unwrap_or("");
+                    *val = Value::String(submitted.to_string());
+                    return;
+                }
+            }
+            for v in map.values_mut() {
+                substitute_form_vars(v, form_data);
+            }
+        }
+        Value::Array(arr) => {
+            for v in arr.iter_mut() {
+                substitute_form_vars(v, form_data);
+            }
+        }
+        _ => {}
+    }
+}
+
+/// Parse JSON, apply [`substitute_form_vars`], return the mutated value.
+pub fn fill_template_from_form(
+    template_json: &str,
+    form_data: &HashMap<String, String>,
+) -> Result<Value, serde_json::Error> {
+    let mut v: Value = serde_json::from_str(template_json)?;
+    substitute_form_vars(&mut v, form_data);
+    Ok(v)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use serde::Deserialize;
+
+    #[derive(Debug, Deserialize, PartialEq, Eq)]
+    struct Demo {
+        room: String,
+        thread_tag: String,
+        nested: Nested,
+    }
+
+    #[derive(Debug, Deserialize, PartialEq, Eq)]
+    struct Nested {
+        text: String,
+    }
+
+    #[test]
+    fn holes_become_strings() {
+        let json = r#"{
+            "room": "public",
+            "thread_tag": {"$form": "tag"},
+            "nested": {"text": {"$form": "body"}}
+        }"#;
+        let mut form = HashMap::new();
+        form.insert("tag".into(), "foo".into());
+        form.insert("body".into(), "hello\nworld".into());
+
+        let v = fill_template_from_form(json, &form).unwrap();
+        let d: Demo = serde_json::from_value(v).unwrap();
+        assert_eq!(
+            d,
+            Demo {
+                room: "public".into(),
+                thread_tag: "foo".into(),
+                nested: Nested {
+                    text: "hello\nworld".into(),
+                },
+            }
+        );
+    }
+
+    #[test]
+    fn missing_form_key_is_empty_string() {
+        let json = r#"{"x": {"$form": "nope"}}"#;
+        let mut form = HashMap::new();
+        form.insert("other".into(), "y".into());
+        let v = fill_template_from_form(json, &form).unwrap();
+        assert_eq!(v["x"], "");
+    }
+
+    #[test]
+    fn array_of_holes() {
+        let json = r#"{"items": [{"$form": "a"}, {"$form": "b"}]}"#;
+        let mut form = HashMap::new();
+        form.insert("a".into(), "1".into());
+        form.insert("b".into(), "2".into());
+        let v = fill_template_from_form(json, &form).unwrap();
+        assert_eq!(v["items"], serde_json::json!(["1", "2"]));
+    }
+
+    #[test]
+    fn template_json_compact_escapes_and_single_line() {
+        let s = template_json_compact(&serde_json::json!({
+            "x": "quote\"and\nnewline"
+        }))
+        .unwrap();
+        assert!(!s.contains('\n'));
+        assert!(s.contains("\\\"") || s.contains("\\n"));
+    }
+}
+tommy@Tommys-Laptop:~/programming/slug-star/slug|main ⇒  
+
diff --git a/gameifying.tdsl b/gameifying.tdsl
new file mode 100644
index 0000000000000000000000000000000000000000..93d2a61d94fcba4370c82d9612e6bb0f0318cc15
--- /dev/null
+++ b/gameifying.tdsl
@@ -0,0 +1,2 @@
+consider gating certain views (top all time?) by a 10 day usage streak.. or something like that. 
+or like a path, on homepage(?), that shows day 1: r/amitheasshole, day2: r/aww, day3: gaming, or something like that.  progressive revelation + usage incentive.
diff --git a/pagerank_streaming.tdsl b/pagerank_streaming.tdsl
new file mode 100644
index 0000000000000000000000000000000000000000..0f2231b94936c17610adf653ca26b0faa6f2ac3a
--- /dev/null
+++ b/pagerank_streaming.tdsl
@@ -0,0 +1,11 @@
+eventually i want to have ranking histories.
+like "visionary" and "fraud" waxing and waning in a uplot graph over time for #elon-musk. 
+there are too many query combinations to precomupte the ranking histories 
+(arbitrary user filters, and tag overlap combinations maybe), 
+so we're just going to have to calculate them all on demand. 
+computers are fast, its okay. for each vote, we need to calculate rank centrality again. 
+i was thinking, for n votes we calculate the rank centrality, 
+and get node weights. we then output that data to the client (over websocket, or testable barrier). 
+then we calculate n+1 votes, _but we keep the node weights in memory_ 
+so the rank centrality process converges faster. 
+this also has the side effect of making the ranking stream in satisfyingly as you load the page.
diff --git a/parser.rs b/parser.rs
new file mode 100644
index 0000000000000000000000000000000000000000..2b87b974f8d1dd93bee35681d87668a94e4ef349
--- /dev/null
+++ b/parser.rs
@@ -0,0 +1,1808 @@
+use std::collections::HashMap;
+use std::rc::Rc;
+use std::cell::RefCell;
+use crate::ui::action::UIAction;
+use crate::ui::types::{Suggestion, GuideOption, ScrollingSuggestion};
+
+// --- Core Abstractions ---
+
+/// Unique identifier for nodes in the graph
+type NodeId = &'static str;
+
+/// Pattern matching for edges
+#[derive(Debug, Clone)]
+pub enum EdgePattern {
+    /// Matches exact literal string
+    Literal(&'static str),
+    
+    /// Matches any prefix of a string and suggests the full string
+    /// e.g., PrefixOf("reddit.com") matches "r", "re", "red", "reddit", "reddit.com"
+    PrefixOf(&'static str),
+    
+    /// Captures a variable segment (e.g., subreddit name, username)
+    Variable(&'static str),
+    
+    /// Matches any string (wildcard)
+    Any,
+}
+
+impl EdgePattern {
+    /// Try to match this pattern against input, return (consumed_chars, captured_value)
+    fn matches(&self, input: &str) -> Option<(usize, Option<String>)> {
+        match self {
+            EdgePattern::Literal(lit) => {
+                if input.starts_with(lit) {
+                    Some((lit.len(), None))
+                } else {
+                    None
+                }
+            }
+            EdgePattern::PrefixOf(target) => {
+                // Check if input is a prefix of target
+                if target.starts_with(input) && !input.is_empty() {
+                    // It's a valid prefix
+                    Some((input.len(), None))
+                } else if input.starts_with(target) {
+                    // Full match
+                    Some((target.len(), None))
+                } else {
+                    None
+                }
+            }
+            EdgePattern::Variable(var_name) => {
+                // Consume until next '/' or end of string
+                let end = input.find('/').unwrap_or(input.len());
+                if end > 0 {
+                    let captured = input[..end].to_string();
+                    // Validate based on variable type
+                    if is_valid_variable(var_name, &captured) {
+                        Some((end, Some(captured)))
+                    } else {
+                        None
+                    }
+                } else {
+                    None
+                }
+            }
+            EdgePattern::Any => {
+                // Match everything until next '/' or end
+                let end = input.find('/').unwrap_or(input.len());
+                if end > 0 {
+                    Some((end, Some(input[..end].to_string())))
+                } else {
+                    None
+                }
+            }
+        }
+    }
+    
+    /// G

… preview truncated; 148,978 characters omitted

download full diff B

Hardlinks — judgments / attempts / prompt

prompt download

judgments

attempts

Prompt text is loaded only by the download route.