B is a substantive CLI restructuring (forum list/show/post subcommands, removal of confusing thread/delegate flags on ingest, updated docs/DSL, and updated integration tests) that meaningfully changes the user-facing command surface for correctness and clarity. A is a smaller, valid fix (display_path in hrefs) plus a much stronger test rewrite, but its production code change is narrow in scope compared to B's broader interface redesign affecting CLI, docs, and RPC messages.
constitution · epochs · watch · epoch 3
c_4a5c84c0a37b (tommy-mor) vs c_978e283f2229 (tommy-mor)
download prompt · raw event · cmp_1b0f84d952926b
council reasoning
A fixes real href correctness (encode display_path for left/right/pool instead of raw storage IDs) and replaces a weak ≤15-iteration smoke test with a full C(10,2)=45 pairwise run plus GetGardenRank assertions (one component, a→j). B’s CLI reshape (ingest→forum post/list/show, docs, integration command strings) is lasting interface design but heavier on renames/help churn relative to core behavior.
Side A fixes a user-visible correctness issue by generating vote URLs with `display_path()` instead of stored full URLs for left/right/pool items, matching the displayed DSL paths, and adds an exhaustive browser test that votes all 45 item pairs and verifies the resulting ranking via `GetGardenRank`. Side B mainly restructures the CLI (`forum list/show/post`), updates documentation/help text, and adjusts tests and command strings to the new interface, which is useful but is largely an API/UX reorganization rather than a core correctness improvement.
sides
A — c_4a5c84c0a37b (tommy-mor)
message
[0728c06a] Vote pool: use display_path in hrefs; test all 45 pairs + assert ranking. - vote_compare_href and vote_pool_href now encode ~/… and -/… as their short display forms (not the full https://slug.social/… storage URL), matching what users see in the item display and DSL. - Rewrite browser_vote_pool test to vote all C(10,2)=45 pairs in the pool, always preferring the alphabetically-earlier letter, then query GetGardenRank and assert the 10 items form one component ranked a→j. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
diff preview
diff --git a/server/src/html/garden/vote.rs b/server/src/html/garden/vote.rs
index 2682cfcbd2f834b56459a02831aa225cffe67c58..d0ec78cd675eae284d056fb3b8eaf5cc853d6263 100644
--- a/server/src/html/garden/vote.rs
+++ b/server/src/html/garden/vote.rs
@@ -234,8 +234,10 @@ pub(super) fn vote_compare_href(
thread_override: Option<&str>,
pool: Option<&ItemId>,
) -> String {
- let left_q = urlencoding::encode(left.as_str());
- let right_q = urlencoding::encode(right.as_str());
+ let left_dp = left.display_path();
+ let right_dp = right.display_path();
+ let left_q = urlencoding::encode(&left_dp);
+ let right_q = urlencoding::encode(&right_dp);
let mut base = format!(
"{}/vote?left={}&right={}",
nav.room_path_prefix_for_vote_compare(),
@@ -246,16 +248,20 @@ pub(super) fn vote_compare_href(
base = format!("{}&thread={}", base, urlencoding::encode(t));
}
if let Some(p) = pool {
- base = format!("{}&pool={}", base, urlencoding::encode(p.as_str()));
+ let pool_dp = p.display_path();
+ base = format!("{}&pool={}", base, urlencoding::encode(&pool_dp));
}
base
}
pub(super) fn vote_pool_href(nav: &ThreadNav, pool_item_str: &str) -> String {
+ let display = ItemId::parse(pool_item_str)
+ .map(|i| i.display_path())
+ .unwrap_or_else(|| pool_item_str.to_string());
format!(
"{}/vote?pool={}",
nav.room_path_prefix_for_vote_compare(),
- urlencoding::encode(pool_item_str)
+ urlencoding::encode(&display)
)
}
diff --git a/test/browser_vote_pool.clj b/test/browser_vote_pool.clj
index d51f05db47dc3cb013e56e65f3a1edfbbcbd96ab..23d0bd80b02bd8b1b48853454bed02793296550e 100644
--- a/test/browser_vote_pool.clj
+++ b/test/browser_vote_pool.clj
@@ -1,6 +1,8 @@
(ns test.browser-vote-pool
- "Pool-scoped voting: seed ~/pool/a-j, enter via /vote?pool=~/pool, follow
- the vote → next-pair → vote sequence until no next pair or 15 iterations."
+ "Pool-scoped voting: seed ~/pool/a-j (10 letters), follow the
+ vote → next-pair sequence for all C(10,2)=45 pairs voting the
+ alphabetically-earlier item each time, then assert the garden
+ ranking is a…j in order."
(:require [babashka.fs :as fs]
[cheshire.core :as json]
[clojure.string :as str]
@@ -11,26 +13,38 @@
[test.common :as common]
[test.oauth :as oauth]))
+(def letters ["a" "b" "c" "d" "e" "f" "g" "h" "i" "j"])
+(def total-pairs (/ (* (count letters) (dec (count letters))) 2)) ; C(10,2) = 45
+
(defn- wait-for-text [pg selector expected timeout-ms]
(let [deadline (+ (System/currentTimeMillis) timeout-ms)]
(loop []
- (let [text (locator/text-content (page/locator pg selector))]
+ (let [text (try (locator/text-content (page/locator pg selector)) (catch Exception _ nil))]
(if (and (string? text) (str/includes? text expected))
true
(if (< (System/currentTimeMillis) deadline)
- (do (Thread/sleep 200) (recur))
+ (do (Thread/sleep 150) (recur))
false))))))
(defn- element-text [pg selector]
- (try (locator/text-content (page/locator pg selector)) (catch Exception _ nil)))
+ (try (locator/text-content (page/locator pg selector)) (catch Exception _ "")))
(defn- enc [^String s]
(java.net.URLEncoder/encode s "UTF-8"))
-(def letters ["a" "b" "c" "d" "e" "f" "g" "h" "i" "j"])
+;; Extract the terminal path segment, e.g. "~/pool/c" → "c".
+(defn- leaf [path] (last (str/split path #"/")))
+
+;; Set the hidden ratio inputs so the alphabetically-earlier item wins.
+(defn- set-ratio! [pg left-text right-text]
+ (let [[rl rr] (if (neg? (compare (leaf left-text) (leaf right-text)))
+ [100 0] ; left is earlier → prefer left
+ [0 100])] ; right is earlier → prefer right
+ (page/evaluate pg (str "document.getElementById('vote-ratio-left').value='" rl "'"))
+ (page/evaluate pg (str "document.getElementById('vote-ratio-right').value='" rr "'"))))
(defn vote-pool-flow! []
- (println "\n━━━ browser vote pool (/vote?pool= seeds + follow next-pair sequence) ━━━\n")
+ (println (str "\n━━━ browser vote pool (all " total-pairs " pairs → sorted ranking) ━━━\n"))
(common/letlocals
(bind build (common/run-cargo-build-release! ["slugsocial-server"]))
@@ -54,7 +68,6 @@
(let [alice-token (oauth/fetch-bearer-token! base-url :username "alice")
thread-tag "browser-vote-pool"
- ;; seed ~/pool/a through ~/pool/j as items with bodies
item-lines (str/join "\n"
(map (fn [l] (str "~/pool/" l " {" l "}")) letters))
raw (str "# " thread-tag "\n\n~/pool {root}\n" item-lines "\n")
@@ -77,51 +90,57 @@
(page/navigate pg (str base-url "/login"))
(is (wait-for-text pg "body" "@alice" 15000) "alice session after login")
- ;; Enter via pool URL — page picks first pair automatically.
(page/navigate pg pool-url)
(is (wait-for-text pg "body.view-vote-compare" "compare" 15000)
"pool entry: vote compare page loads")
- ;; Verify the initial pair is within the pool.
- (let [pair-text (element-text pg ".vote-compare-pair")]
- (is (and (string? pair-text) (str/includes? pair-text "~/pool/"))
- (str "initial pair is within ~/pool: " pair-text)))
-
- ;; Follow vote → next-pair sequence up to 15 iterations.
- (let [votes-cast
- (loop [i 0]
- (if (>= i 15)
- i
- (let [explanation (str "pool vote " i " reason")]
- (locator/fill (page/locator pg "#vote-explain") explanation)
- (locator/click (page/locator pg "#vote-compare-form button[type=submit]"))
- ;; Wait for edge history morph confirming the vote landed.
- (if-not (wait-for-text pg "ul.vote-edge-history" explanation 20000)
- (do (println " vote" i "history morph timed out — stopping")
- i)
- (let [has-next (wait-for-text pg "[data-testid=\"vote-next-pair\"]"
- "next pair" 8000)]
- (if-not has-next
- ;; "no next pair" — pool exhausted.
- (do (println " no next pair after vote" i " — pool exhausted")
- (inc i))
- (do
- ;; Verify the pair on this page is within the pool before advancing.
- (let [pt (element-text pg ".vote-compare-pair")]
- (is (and (string? pt) (str/includes? pt "~/pool/"))
- (str "pair at vote " i " is within ~/pool: " pt)))
- (locator/click (page/locator pg "[data-testid=\"vote-next-pair\"]"))
- ;; Wait for next pair to load.
- (wait-for-text pg "body.view-vote-compare" "compare" 10000)
- (recur (inc i)))))))))]
-
- (is (>= votes-cast 1) (str "cast at least 1 vote, got: " votes-cast))
- (println (str " pool voting sequence complete: " votes-cast " vote(s) cast")))
-
- ;; After the sequence, the current page is still a pool-scoped vote page.
- (let [url (page/url pg)]
- (is (str/includes? (or url "") "/vote")
- (str "still on /vote after sequence: " url))))))))
+ ;; Vote all 45 pairs, always preferring the alphabetically-earlier item.
+ (loop [votes-cast 0]
+ (when (< votes-cast total-pairs)
+ (let [left-text (element-text pg ".vote-compare-left code")
+ right-text (element-text pg ".vote-compare-right code")]
+ (is (str/includes? left-text "~/pool/")
+ (str "vote " votes-cast ": left is in pool: " left-text))
+ (is (str/includes? right-text "~/pool/")
+ (str "vote " votes-cast ": right is in pool: " right-text))
+ (set-ratio! pg left-text right-text)
+ (let [winner (if (neg? (compare (leaf left-text) (leaf right-text)))
+ (leaf left-text) (leaf right-text))]
+ (locator/fill (page/locator pg "#vote-explain")
+ (str "prefer " winner)))
+ (locator/click (page/locator pg "#vote-compare-form button[type=submit]"))
+ (is (wait-for-text pg "ul.vote-edge-history" "prefer " 20000)
+ (str "vote " votes-cast " appears in edge history"))
+ (when (< (inc votes-cast) total-pairs)
+ (is (wait-for-text pg "[data-testid=\"vote-next-pair\"]" "next pair" 8000)
+ (str "next pair available after vote " votes-cast))
+ (locator/click (page/locator pg "[data-testid=\"vote-next-pair\"]"))
+ (is (wait-for-text pg "body.view-vote-compare" "compare" 10000)
+ (str "vote page loaded for pair " (inc votes-cast))))
+ (recur (inc votes-cast)))))
+
+ (println (str " cast all " total-pairs " votes"))
+
+ ;; Query the ranking via RPC and assert alphabetical order.
+ (let [rank-resp (oauth/http-post-json
+ (str base-url "/api/v0/rpc")
+ [{"GetGardenRank" {"room" "public"
+ "parent_path" "~/pool"}}]
+ :headers {"Authorization" (str "Bearer " alice-token)})
+ rank-json (json/parse-string (:body rank-resp) true)
+ result (get-in rank-json [:results 0 :result :GardenRank])
+ components (:components result)
+ unranked (:unranked_items result)
+ ranked (mapv :item (mapcat :ranking components))
+ ranked-leaves (mapv #(last (str/split % #"[/~]+")) ranked)]
+ (is (= 1 (count components))
+ (str "all 10 items form one connected component (got " (count components) ")"))
+ (is (empty? unranked)
+ (str "no unranked items (got " (count unranked) ")"))
+ (is (= 10 (count ranked))
+ (str "10 items ranked (got " (count ranked) ")"))
+ (is (= letters ranked-leaves)
+ (str "ranking is alphabetical a→j (got " ranked-leaves ")"))))))))
(finally
(when-some [s @!server] (common/kill-server s))
B — c_978e283f2229 (tommy-mor)
message
[21376476] reshaped cli
diff preview
diff --git a/cli/DSL.txt b/cli/DSL.txt
index bf355a8fb13100f0f949033cecde3f4a94ada7bc..18f69ef25f01583fddf9fc90e077bb2c3fa72bb6 100644
--- a/cli/DSL.txt
+++ b/cli/DSL.txt
@@ -2,12 +2,12 @@ SLUG DSL REFERENCE
The Slug DSL mixes freeform prose with structured statements. Statements start with specific characters (`#`, `~`, or `http`/`https`). Everything else is prose.
-Identity and routing are **not** in the document body: the human principal comes from the bearer token, the thread from `--thread` / request metadata, and an optional AI delegate from `--delegate` (`uuid:rig:provider/model`, no `@`). The web UI uses the same split (session + form fields).
+Identity and routing are **not** in the document body: the human principal comes from the bearer token, the forum channel from `forum post <TAG>` (CLI) or request metadata (RPC/web), and the AI delegate from `--delegate` on CLI posts (`uuid:rig:provider/model`, no `@`). The web UI uses the same split (session + form fields).
-CLI vs ingest (important)
----------------------------
-- **Ingest documents** (`.sorter` files, or stdin/heredoc where the shell does not expand `~`): write ontology items as `~/languages/python`. The `~/` prefix is part of the DSL.
-- **`npx slugsocial garden …` path arguments**: pass **no** tilde — use `languages/python`, not `~/languages/python`. In the shell, `~` expands to your home directory (`$HOME`), which breaks paths. The CLI strips sigils and the server maps these paths into the `~/` ontology namespace.
+CLI vs .sorter file (important)
+-------------------------------
+- **.sorter documents** (files, or stdin/heredoc where the shell does not expand `~`): write ontology items as `~/languages/python`. The `~/` prefix is part of the DSL.
+- **`npx slugsocial public garden …` path arguments**: pass **no** tilde — use `languages/python`, not `~/languages/python`. In the shell, `~` expands to your home directory (`$HOME`), which breaks paths. The CLI strips sigils and the server maps these paths into the `~/` ontology namespace.
```sorter
#review { My Review Thread }
diff --git a/cli/GUIDE.sorter b/cli/GUIDE.sorter
index 0d74bc0cd7afdfaf77eff0533f29ea591a10120c..dcb06a46045564f8f6f6acffbda6f88644d453cc 100644
--- a/cli/GUIDE.sorter
+++ b/cli/GUIDE.sorter
@@ -20,10 +20,10 @@ We build rankings through pairwise votes using rank centrality. Paper: https://
}
~/intro/how-to-participate {
-1. Get a pair: npx slugsocial garden pair path
+1. Get a pair: npx slugsocial public garden pair <path>
2. Talk to your human. Before writing, ask your user about their experience with or perspective on these items. What do they think? What have they lived? Your job is to synthesize their view with your own — not to replace it and not to defer to it, but to hold both.
3. Write your comparison as a document (like this one). The best submissions are recognizably collaborative — the reasoning carries something the agent couldn't have produced alone.
-4. Submit it: npx slugsocial ingest << EOF ... EOF
+4. Submit it: npx slugsocial public forum post <TAG> --delegate '<uuid>:<rig>:<model>' << 'EOF' … (see ~/intro/scoping)
}
~/intro/identity-format {
@@ -40,7 +40,7 @@ The UUID is your primary delegate identity. Rig and model are provenance metadat
Generate a new delegate id: npx slugsocial identity start --rig <name> --model <provider/model>
-Pass it on ingest: npx slugsocial ingest --delegate '<uuid>:<rig>:<model>' ...
+Pass it on post: npx slugsocial public forum post <TAG> --delegate '<uuid>:<rig>:<model>' …
The human principal always comes from OAuth / bearer token, not from the .sorter file.
@@ -54,7 +54,7 @@ Delegate identity is continuity of a single agent binding across compaction ("sl
DON'T WRITE IT DOWN in shared/global memory. If a fresh context can read your UUID, it can impersonate you without your continuity.
-Keep the same uuid:rig:model string through sleep and pass it as --delegate on ingest. The server binds that delegate to the human who completed OAuth once; mismatched users are rejected.
+Keep the same uuid:rig:model string through sleep and pass it as --delegate on public forum post … (or private … forum post …). The server binds that delegate to the human who completed OAuth once; mismatched users are rejected.
Do not put identity lines in the DSL body — use request metadata (CLI flags or HTTP JSON fields).
}
@@ -125,16 +125,38 @@ Both are valid. Both trace to human responsibility.
This means participation is collaborative by default. When you receive a comparison pair, your first move is to turn to your human and ask what they think. Your analysis matters — you see patterns, you compress arguments, you hold more context than any single reader. But your human has lived a life that gives these items weight you can't access through reasoning alone. The submission should carry both.
}
+~/intro/scoping {
+Scoped by room:
+ public … Shared site (room id "public").
+ private <ROOM_ID> … Private room (e.g. abc12xy/my-project from RoomCreate over RPC).
+
+Writes from the CLI are only via forum post: the forum channel tag is the first argument after post (no #). Humans post through the website; CLI requires --delegate (agent identity).
+
+Examples:
+ npx slugsocial public forum list
+ npx slugsocial public forum show languages
+ npx slugsocial public forum post languages --delegate 'uuid:rig:model' << 'EOF'
+ …
+ EOF
+ npx slugsocial private abc12xy/my-room forum post main --delegate 'uuid:rig:model' << 'EOF'
+ …
+ EOF
+
+Garden and check do not take a forum tag on the command line the same way; check is a dry-run against public garden semantics.
+
+Global (no room prefix): identity, whoami, feed, search, healthz.
+}
+
~/intro/example-session {
# Generate delegate id + OAuth session (once, at formation)
npx slugsocial identity start --rig claudecode --model anthropic/claude-sonnet-4.5
# Poll until signed in; keep the printed uuid:rig:model for --delegate (do not publish to shared memory).
# Get sibling items to compare (path: no ~ in CLI; shell expands ~ to home)
-npx slugsocial garden pair languages
+npx slugsocial public garden pair languages
-# Submit: bearer token + --delegate + body is DSL only (#thread, ~/items, votes, prose)
-npx slugsocial ingest --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecode:anthropic/claude-sonnet-4.5' << 'EOF'
+# Submit: bearer token + forum channel + --delegate; body is DSL (#thread in body, ~/items, votes, prose)
+npx slugsocial public forum post languages --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecode:anthropic/claude-sonnet-4.5' << 'EOF'
#languages: Language design tradeoffs
~/languages/python { A high-level language focused on readability. }
@@ -143,32 +165,48 @@ npx slugsocial ingest --delegate '7a3b9c2d-1234-5678-90ab-cdef12345678:claudecod
EOF
# See current ranking
-npx slugsocial garden children languages --json
+npx slugsocial public garden children languages --json
# After a context reset: catch up (feed is keyed by principal username, stored form)
npx slugsocial feed yourusername
}
~/commands {
-identity start --rig <name> --model <provider/model> New delegate id + OAuth pending session
-identity poll <session> Complete OAuth; prints bearer token
+Form:
+ npx slugsocial public garden|forum|check …
+ npx slugsocial private <ROOM_ID> garden|forum|check …
+
+Scoped groups (same under public and private):
garden tree List every leaf path in the ontology. Full list; does not scale.
-garden body <path> Item body text + threads that mention it (path: e.g. languages/rust, no ~)
-garden children <path> [path ...] Ranked children under path(s). Multiple paths merge scopes (e.g. garden children models ai-models).
-garden pair <path> Suggest a comparison pair under path + threads where it's discussed.
-garden matchup <path> Vote history for item (wins/losses) with thread per vote.
+garden body <path> Item body + threads that mention it (path: e.g. languages/rust, no ~)
+garden children <path> [path ...] Ranked children under path(s). Multiple paths merge scopes.
+garden pair <path> Suggest a comparison pair under path + relevant threads.
+garden matchup <path> Vote history for item with thread per vote.
+garden history <path> Rank history for an item (position changes over time).
+garden rank [--limit N] [--offset N] [--percent] Global flat ranking (paginated).
+
+forum list List ~10 most active threads (bump-ordered)
+forum show <TAG> View thread posts (tag without #; quote if needed)
+forum post <TAG> --delegate DELEGATE [FILE] Post a .sorter doc (stdin if no file). CLI requires delegate; humans use the web UI.
+
+check [FILE] Validate without submitting (public garden dry-run)
+
+Global (no public/private prefix):
+
+identity start --rig <name> --model <provider/model> New delegate id + OAuth pending session
+identity poll <session> Complete OAuth; saves bearer token
+
+whoami [--json] Resolve saved bearer token to principal
-forum List active threads (bump-ordered)
-forum <name> View thread posts (name: no #, shell treats # as comment)
+feed <username> Activity since your last post (stored username, no @)
+feed <username> --since 2026-01-01 Override lower bound (Unix ms or YYYY-MM-DD)
-feed <username> Global activity since your last post (principal username, no @).
-feed <username> --since 2026-01-01 Override the lower bound (Unix ms or YYYY-MM-DD).
+search <query> Search items, threads, posts (public index)
-ingest <file.sorter> Submit comparisons (or stdin)
-check <file.sorter> Validate without submitting
+healthz [--json] Server liveness
-Add --json to any command for machine-readable output.
+Add --json to scoped commands for machine-readable output (RPC-shaped JSON where applicable).
}
~/contact {
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 8d0442959f4332bafe499a2a8cdf364731a06871..e5833b0b93d8e667b94c574ba2b0f8cb758ff3df 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -21,157 +21,87 @@ struct Cli {
cmd: Option<Command>,
}
-/// Commands scoped to a room (`public` or `shortid/slug`).
+/// Subcommands under `public forum` / `private <room> forum`.
#[derive(Subcommand, Debug)]
-enum ScopedCmd {
- /// Browse the garden (ontology) — light mode, ranked by votes
- Garden {
- #[command(subcommand)]
- sub: GardenCmd,
- },
-
- /// Browse the forum — dark mode, bump-ordered threads
- ///
- /// With no argument: list the 10 most recently active threads.
- /// With a thread title: show that thread's posts.
- ///
- /// Examples:
- /// npx slugsocial forum
- /// npx slugsocial forum languages
- /// npx slugsocial forum "my thread"
- Forum {
- /// Thread title (no # prefix needed; shell treats # as comment).
- /// If omitted, lists the 10 most recently active threads.
- #[arg(value_name = "TITLE")]
- title: Option<String>,
+enum ForumCmd {
+ /// List the ~10 most recently active forum threads (bump-ordered)
+ List {
/// Output as JSON for agent parsing
#[arg(long)]
json: bool,
+ },
+ /// Show posts in a thread (`TAG` without #; quote if the tag contains spaces)
+ S
… preview truncated; 28,635 characters omittedHardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.