demarkus-library — Roadmap & Resume
Pick-up-where-we-left-off doc. Authoritative plan is /plans/universe-library.md; this tracks status and the queued work. Build model: Opus 4.8 default, Fable 5 for load-bearing transport/auth/concurrency design.
Where we are (2026-06-11, end of session)
All merged to main (HEAD c4aab23):
- Phase 0 foundation spike · Phase 1a reading room (stacks, card catalog, editions, link rewriting, htmx fragment-vs-page).
- Phase 1b — library card: DONE. Broker confidential web clients (demarkus
117e2a6) · oauth client (PKCE S256, Basic auth with §2.3.1 escaping) · server-side sessions + single-flight refresh · ctx threading on ports · broker MCPWorldGatewaywith per-reader pooled sessions (1 request per read; fixed the live 429s) · login turnstile (/login, /login/start, /auth/callback, /logout; HX-Redirect for htmx) · composition-root swapDEMARKUS_TRANSPORT=quic|broker· native TLS serving for local e2e (mkcert + hosts-file recipe in journal 2026-06-11). E2e verified live. - Multi-world floor + federation (fc4277c): (world, path) addressing,
/w/<world>/...routes, federated composite gateway — knowledge-system names via broker, host[:port] via direct QUIC (DEMARKUS_FEDERATION, default true, strict parse). Read token never leaves home host (test-pinned). Cross-world mark:// links clickable; root hub = the floor. - Frontmatter strip in markdown adapter (render-side mitigation).
How to resume
cd ~/latebit/demarkus-library && go test ./... && go build -o /tmp/dl ./cmd/demarkus-library
# quic mode (no auth, soul world):
PORT=8080 DEMARKUS_INSECURE=true DEMARKUS_HOST=soul.demarkus.io \
DEMARKUS_AUTH=<token from .mcp.json> /tmp/dl
# broker mode: env per config.go (BROKER_URL, CLIENT_ID/SECRET, REDIRECT_URI,
# WORLD=root, TLS_CERT/KEY for local https) — full recipe in journal 2026-06-11.
File map (hexagonal — ADR 0002)
internal/core/{domain,port,service}— entities, ports (ctx+world on every method), Read/Browse/History/Searchinternal/adapter/inbound/web— Echo handlers/routes (/w/:world/...), auth turnstile, session pkg, templates, links.go (cross-world rewriting)internal/adapter/outbound/{world,broker,federated,oauth,markdown}— direct QUIC (token→home only), MCP pool, shape-router, broker OAuth, goldmarkinternal/adapter/bearer— ctx token contract between middleware & gatewaycmd/demarkus-library— composition root, AppConfig, brokerAuth shim
Next sessions — queued work
1. Deploy manifests (next up)
Dockerfile + helm chart for the library, mirroring the broker chart's
conventions: Secret for DEMARKUS_CLIENT_SECRET + session cookie material,
ingress with TLS (native TLS serving stays a local-dev knob), env wiring per
config.go. Outcome: library in-cluster next to the broker; mkcert path
retired to dev-only.
2. Broker rate limit back down (deploy-side, demarkus repo)
rateLimit.tokens was raised to 60/min burst 30 during the 429 incident.
Reads are now 1 request each (session pool) — drop to ~30/min burst ~15 in
the broker AppSet values.
3. Rendering upgrades (full split in debt.md)
Order: (a) chroma syntax highlighting via goldmark-highlighting — server-side, zero JS, biggest visible win; bluemonday must allow chroma spans/classes. (b) GFM alerts + emoji extensions. (c) Later, islands: mermaid.js + KaTeX, vendored, degradable (ADR 0003 concessions).
4. Phase 2 — restricted collections (per /plans/universe-library.md)
Per-world/per-path authorization surfaced in the reading room. Depends on
broker-side authz semantics — re-read the plan + broker authz.go first.
Standing deferred
- Backlinks / "cited by" (needs graph crawl; viz deferred).
mark_worldsenumeration tool on broker → generated floor page.- Find + fix publishers that wrote metadata fences into bodies (strip is render-side mitigation only).
- Phase 3 cataloging desk (writes, CodeMirror island) · Phase 4 AI librarian (SSE) · Phase 5 public face.
History (condensed — details in journals + ADRs)
- 2026-06-10: Phases 0 + 1a built and merged (PRs #1–2).
- 2026-06-11: Phase 1b planned (plan,
ADR 0004 — broker loopback
finding, device flow rejected, confidential web client chosen) and fully
shipped (PRs #3–#9); floor + federation; frontmatter strip. Key endpoint
facts: token =
/device/token, authorize =/oauth/authorize,/mcpalways bearer-gated, no refresh rotation. Gotchas in debugging.md.
Git / process notes
- Work on
feature/*/fix/*branches. Never auto-commit — Fritz commits and opens PRs; CodeRabbit reviews via.coderabbit.yaml. - PR scopes: domain, port, service, web, world, markdown, cmd, view, deps, ci, broker, auth, session, oauth, federated.