Two-mode workspace, working Kleros v2 connector, MASC keyword RAG, Ollama engine selector

SegPar's second commit ships the fork's actual product differentiation: a parallel Mediation workspace alongside the existing Legal surface, a real GraphQL connector to Kleros Court v2 on Arbitrum, a keyword-indexed MASC legal corpus, and an Ollama local-model integration. Some of it is real; some is polished scaffolding over mock data.

workflowintegration

The workspace architecture lives in WorkspaceContext.tsx. It stores mode (legal/mediation), role (lawyer/private_mediator/certified_mediator), and activeEngine, all persisted to localStorage. AppSidebar.tsx branches on mode to swap nav items entirely and applies a separate dark-gold-on-purple color palette for Mediation. A ModeSwitcher pill toggles between them. This is roughly 200 lines that has no dependency on the mediation domain - reusable shape if you need dual product surfaces.

The Kleros connector (backend/src/lib/kleros/client.ts, 357 lines) is working code. It queries the Kleros v2 subgraph on Arbitrum One via The Graph, fetches MetaEvidence from the IPFS gateway at cdn.kleros.link with an 8-second timeout, and exposes getCasesByWallet and getCaseDetail. The submitVote function is an explicit placeholder returning { success: false, pending: true } - on-chain signing must happen in the browser. Both KLEROS_SUBGRAPH_URL and KLEROS_IPFS_GATEWAY are env-configurable.

The MASC RAG is a TF-IDF-style keyword index over three hand-curated TypeScript files: Ley MASC CDMX (94 lines), Código Civil Federal arts. 1792-1798 and 2944-2955 (78 lines), and MASC doctrine (140 lines). Scores weight keyword matches at 3x, title at 2x, body at 1x, with Spanish NFD normalization. Exposed at GET /rag/analyze?q=&topK=. The code marks itself as a placeholder for pgvector. Don't pull this as a production RAG.

Ollama: backend/src/lib/llm/ollama.ts probes localhost:11434/api/tags, GET /engines/local returns availability and model list, and AIEnginePanel.tsx (330 lines) renders Cloud and Local engine sections. The selected engine is persisted to WorkspaceContext.

The six mediation pages and five Kleros UI components are visually complete but mostly mock-data-driven. Hardcoded case ID MX-001, hardcoded credential history, mock activity feed. IgniaAssistantPanel does call the real /rag/analyze endpoint, but passes a hardcoded Spanish query. The backend/.env.example gains a second block of API key assignments, creating duplicate keys in the file; it also lacks a trailing newline.

So what Two pieces worth evaluating for import regardless of your domain: the `WorkspaceContext` two-mode pattern (~200 lines, no mediation dependencies) and the Ollama probe plus `/engines/local` route (domain-neutral local-model detection). The Kleros connector is domain-specific but the GraphQL subgraph client pattern is clean if you need something similar. Skip the MASC corpus and the RAG implementation entirely - static keyword scoring over 300 lines of hardcoded TypeScript isn't worth adapting. Check the lockfile diff before pulling any subset; the commit adds 25 lines to `frontend/package-lock.json`.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from SegPar/ignia, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
279d64f6 Session 1.1: two-mode architecture, AI Engine selector, mediation visual identity RSAG 2026-05-08 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-175.md from inside the repo you want the changes in.

⬇ Download capture-thread-175.md