-
Notifications
You must be signed in to change notification settings - Fork 0
Fix blueprint analysis: LexFiat architecture, court_query naming, and unmerged Cursor work audit #446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix blueprint analysis: LexFiat architecture, court_query naming, and unmerged Cursor work audit #446
Changes from all commits
18bb48b
c854e32
82b93b5
85f645f
2052530
d3f3fff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2976,4 +2976,236 @@ Complete remaining production readiness tasks: error handling verification, load | |||||
| - [ ] Security hardened | ||||||
| - [ ] Documentation complete | ||||||
| - [ ] Beta testing plan ready | ||||||
| - [ ] Known issues documented | ||||||
| - [ ] Known issues documented | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Appendix: Blueprint Review — "Master Blueprint" LLM Advisory Analysis | ||||||
|
|
||||||
| *Added 2026-02-28. Review requested via GitHub Issue #446.* | ||||||
|
|
||||||
| This section evaluates the "Master Blueprint for Your Legal AI OS" submitted for review, answering the three posed questions: what it got wrong, what it missed, and what it got right. The goal is to use this analysis as a foundation for further refinement into an actionable plan. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### Question 1: What Did the Blueprint Get Wrong? | ||||||
|
|
||||||
| **1. The Registry "Translation" (Step 1) Is Already Done** | ||||||
|
|
||||||
| The blueprint's top priority is creating a `lib/mcp-registry.ts` registry loop that maps the hierarchy into an MCP tool list. This already exists — and has for some time. `src/engines/registry.ts` and `src/modules/registry.ts` are fully functional, self-registering singletons. Tools are auto-registered in `mcp-server.ts` and `http-bridge.ts`. No "registry loop" needs to be written; the MCP tool list is already computed dynamically from registered tool classes. | ||||||
|
|
||||||
| **2. "Litigation Suite" Is the Suite/Platform Level, Not the App Level** | ||||||
|
|
||||||
| The blueprint describes a four-level hierarchy with "App" at the top, using "Litigation Suite" as an example. The codebase actually has a *five*-level hierarchy: **Tool → Module → Engine → App → Suite/Platform**. The App layer is real and documented — LexFiat and Arkiver are both Apps (per `docs/architecture/ARKIVER_ARCHITECTURE_GUIDE.md`). "Litigation Suite" would sit at the *Suite* level above Apps, not the App level. The Engines (MAE, GoodCounsel, Potemkin, Forecast, Chronometric, Custodian) are one level *below* Apps. The blueprint's direction was correct (Apps above Engines) but it conflated the Suite/Platform tier with the App tier, and missed the fifth level entirely. | ||||||
|
|
||||||
| **3. Supabase Is Not the Database Layer** | ||||||
|
|
||||||
| The blueprint repeatedly recommends Supabase as the memory/storage layer (pgvector, file storage, auth). The codebase uses **PostgreSQL with Drizzle ORM** directly (via the `postgres` npm package), **not** the Supabase SDK. Supabase-as-a-service could host the Postgres database, but there is no Supabase client in the codebase. Recommending "link your Supabase project in the Vercel dashboard" understates a real migration/integration effort. | ||||||
|
|
||||||
| **4. Vercel KV (Redis) for State Is Unnecessary** | ||||||
|
|
||||||
| The blueprint recommends Vercel KV (Redis) for "Current Matter Context" persistence. The codebase already uses the PostgreSQL schema for persistent state (matter data, wellness journals, ethics audits, email drafts). Adding Redis would be additional infrastructure complexity without clear benefit given the existing Drizzle ORM schema. | ||||||
|
|
||||||
| **5. The Multi-Model Router Is Already More Sophisticated Than Described** | ||||||
|
|
||||||
| The blueprint describes building "a lightweight logic layer in Vercel" that checks Supabase for user model preferences. The codebase already has `src/services/ai-provider-selector.ts`, `src/services/ai-performance-tracker.ts`, `src/engines/mae/services/multi-model-service.ts`, and `src/services/openrouter.ts`. Role-based parallel multi-model verification with weighted confidence scoring already exists in MAE. | ||||||
|
|
||||||
| **6. LexFiat's "Thin Client" Label Is Architecturally Correct — But Understates the Frontend** | ||||||
|
|
||||||
| The blueprint frames LexFiat as a "lightweight TypeScript app (Vercel)" — a thin client. The *architecture* here is actually accurate: LexFiat is a client-side React SPA with no backend of its own. Its backend IS Cyrano (Express + PostgreSQL/Drizzle). The `drizzle.config.ts` in LexFiat points to `Cyrano/src/lexfiat-schema.ts`; auth lives in Cyrano's `auth-server/`. What the "thin client" framing understates is the scale of the frontend: LexFiat is a fully-featured React 19 + Vite application with 30+ components, Tailwind CSS 4, Radix UI, TanStack Query, react-router-dom, and a complete workflow pipeline UI. It is not "lightweight" in the sense of minimal functionality — it is lightweight only in the sense that it carries no server-side code. | ||||||
|
|
||||||
| **7. Vercel `maxDuration: 10` Is Already Fixed (As of This PR)** | ||||||
|
|
||||||
| The blueprint correctly identifies the 10-second timeout as a problem and recommends 300 seconds. The `Cyrano/vercel.json` had `maxDuration: 10` — this has been corrected in this PR to `60` seconds with `memory: 1024` (Vercel Hobby tier maximum is 60s; Pro/Enterprise allows up to 300s for the full blueprint recommendation). | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### Question 2: What Did the Blueprint Mostly or Entirely Miss? | ||||||
|
|
||||||
| **1. The Suite/Platform Tier and the Skills Layer** | ||||||
|
|
||||||
| The blueprint's four-level hierarchy (App → Engine → Module → Tool) is actually five levels: Tool → Module → Engine → App → **Suite/Platform**. "Litigation Suite" would be a *Suite* sitting above Apps like LexFiat, not an App itself. Additionally, the codebase has a **Skills** abstraction (`src/skills/`) — declarative, markdown-defined capability descriptors loaded, registered, and dispatched by `skill-loader.ts`, `skill-registry.ts`, and `skill-dispatcher.ts`. These sit alongside or below the Tool layer and are entirely absent from the blueprint. | ||||||
|
|
||||||
| **2. The Mock/Prototype Status of Many AI Tools** | ||||||
|
|
||||||
| The most critical near-term blocker is that approximately 15 tools are MOCK implementations that return simulated responses without calling real AI APIs. The Cyrano README explicitly warns: "Do not use in production where real AI capabilities are expected." The blueprint assumes a working system that needs to be "animated" — in reality, real AI integration work is still pending for many tools. This is the actual critical path, not registry translation. | ||||||
|
|
||||||
| **3. GoodCounsel as a First-Class Ethics/Wellness Engine** | ||||||
|
|
||||||
| The blueprint treats wellness as a background post-process (`waitUntil` fire-and-forget). In Cyrano, **GoodCounsel** is a full Engine with wellness journaling, burnout detection, HIPAA-compliant encryption, crisis support pathways, and ethics review as first-class, synchronous features. It is not an afterthought. | ||||||
|
|
||||||
| **4. Clio Integration as the Primary Practice Management System** | ||||||
|
|
||||||
| The blueprint doesn't mention Clio at all. For the target user (a practicing attorney), Clio OAuth integration (`clio-oauth.ts`, `clio-webhooks.ts`, `clio-client.ts`, `clio-api.ts`) is arguably the most important third-party integration. Without Clio sync, matter data, time entries, and billing are disconnected from the attorney's actual workflow. | ||||||
|
|
||||||
| **5. Six Engines Beyond MAE** | ||||||
|
|
||||||
| The blueprint only describes a generic "Research Engine" and "Billing Engine." The codebase has six named, specialized Engines, each with distinct responsibilities: | ||||||
| - **MAE** (Multi-Agent Engine) — workflow orchestration | ||||||
| - **GoodCounsel** — ethics and wellness | ||||||
| - **Potemkin** — simulation and workflow validation | ||||||
| - **Forecast** — financial forecasting (tax, child support, QDRO) | ||||||
| - **Chronometric** — time reconstruction and billing | ||||||
| - **Custodian** — data governance and audit trails | ||||||
|
|
||||||
| **6. The Verification Module** | ||||||
|
|
||||||
| The blueprint doesn't address fact-checking or citation verification at all. The codebase has a dedicated `src/tools/verification/` subdirectory with `claim-extractor.ts`, `citation-checker.ts`, `citation-formatter.ts`, `source-verifier.ts`, and `consistency-checker.ts`. For a legal AI, this is critical for avoiding hallucinated case citations — a disbarment-level risk. | ||||||
|
|
||||||
| **7. The HTTP Bridge as the Real MCP-to-Web Adapter** | ||||||
|
|
||||||
| The blueprint describes building a Vercel AI SDK orchestrator route as Step 4. The codebase already has a production-grade HTTP Bridge (`src/http-bridge.ts`) with hybrid lazy-loading, race condition protection, timeout protection (30s), circuit breaker pattern, tool health monitoring, and hot reload. The "brain deployment" step is already done. | ||||||
|
|
||||||
| **8. Auth Server as a Separate Service** | ||||||
|
|
||||||
| The blueprint treats auth as a Supabase feature. Cyrano has its own dedicated auth server (`auth-server/` directory) with JWT, bcrypt, and separate deployment configuration. This is independent infrastructure that needs to be accounted for in any deployment plan. | ||||||
|
|
||||||
| **9. The Arkiver Subsystem** | ||||||
|
|
||||||
| The blueprint mentions "RAG Intake" generically. Arkiver is an entire subsystem with its own UI, MCP tools, processor pipeline (text, email, entity, insight, timeline), three engine modules (extractor, processor, analyst), and document integrity verification. It is far more complete and complex than the blueprint implies. | ||||||
|
|
||||||
| **10. MiCourt Integration (Michigan Courts)** | ||||||
|
|
||||||
| The codebase has a `micourt-service.ts` and `micourt-query.ts` exposing a `court_query` tool for querying Michigan court dockets. This is domain-specific legal infrastructure the blueprint cannot have known about — and a key differentiator. The blueprint's Section I.1 used `scrape_court_docket` as a generic illustrative example of what a Tool looks like (alongside `query_supabase`) — not as a proposed tool name. The important naming and framing correction: this system's tool is `court_query`, and the interaction model is explicit user-initiated docket querying, not scraping. | ||||||
|
||||||
| The codebase has a `micourt-service.ts` and `micourt-query.ts` exposing a `court_query` tool for querying Michigan court dockets. This is domain-specific legal infrastructure the blueprint cannot have known about — and a key differentiator. The blueprint's Section I.1 used `scrape_court_docket` as a generic illustrative example of what a Tool looks like (alongside `query_supabase`) — not as a proposed tool name. The important naming and framing correction: this system's tool is `court_query`, and the interaction model is explicit user-initiated docket querying, not scraping. | |
| The codebase has a `micourt-service.ts` and `micourt-query.ts` exposing a `micourt_query` tool for querying Michigan court dockets. This is domain-specific legal infrastructure the blueprint cannot have known about — and a key differentiator. The blueprint's Section I.1 used `scrape_court_docket` as a generic illustrative example of what a Tool looks like (alongside `query_supabase`) — not as a proposed tool name. The important naming and framing correction: this system's tool is `micourt_query`, and the interaction model is explicit user-initiated docket querying, not scraping. |
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “Recommended Corrections to the Blueprint” table uses || at the start of each row (e.g., || Blueprint Claim | Corrected Reality |). That adds an empty first column in Markdown and renders incorrectly. Please change these rows to start with a single | so the table formats as intended.
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “Cursor branches in the repository” table also uses || to start rows (e.g., || Branch | Unique Cursor commits | Status |), which renders as an extra empty column. Please change the table rows/separator to start with a single | so it displays correctly.
| |---|---|---| | |
| | --- | --- | --- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The appendix states that tools are auto-registered in
mcp-server.ts/http-bridge.tsand that the MCP tool list is computed dynamically from registered tool classes. InCyrano/src/mcp-server.tsthe tool list and dispatch are explicitly enumerated (ListToolsRequestSchema returns a hard-coded array; CallToolRequestSchema uses a switch), andhttp-bridge.tsalso uses an explicit TOOL_REGISTRY map. Please rephrase this to distinguish the engine/module registries (dynamic) from the tool registration (currently static/explicit).