Skip to content

Livi improvements - #103

Merged
LinceMathew merged 379 commits into
masterfrom
livi-improvements
Aug 30, 2026
Merged

Livi improvements#103
LinceMathew merged 379 commits into
masterfrom
livi-improvements

Conversation

@LinceMathew

@LinceMathew LinceMathew commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

This PR introduces v2 of the Livi AI Assistant, featuring an upgraded multi-branch architecture for Product Guidance, Actions (triggering code reviews and inspecting review details), and Historical Analytics with dynamic Vega-Lite chart visualizations.


Key Highlights

  • Added dbctx: Introduces a high-performance database context indexing tool that generates localized, schema-aware query contexts and sample SQL patterns to enable highly accurate text-to-SQL synthesis.
  • Integrated alaws: System prompts are now dynamically assembled from versioned, numbered alaws LawBooks (internal/mcpagent/alaws_livi/) with {{ref:}} templates, guaranteeing strict policy enforcement and preventing prompt drift.
  • Unified No-Data Analytics Guidance: Replaced cryptic or raw query dumps on single-row/zero-data results with friendly guidance and automatic Product Guidance suggested question cards.
  • UI & Vega-Lite Chart Rendering Fixes: Optimized InteractiveChart container sizing to guarantee instant, responsive SVG chart mounting and seamless scaling on dark-mode card surfaces.

Various Fixes

1. Intent Classification & Multi-Branch Routing

Every incoming user prompt is classified before token allocation into one of three dedicated execution branches:

  • product_guidance: Answers product navigation, feature, and workflow questions from embedded documentation without tool/SQL overhead.
  • action: Executes operational commands such as triggering code reviews or pulling PR details.
  • analytics: Performs multi-interpretation SQL queries against dbctx and generates Vega-Lite chart specifications.

2. LawBook Governance (alaws)

  • LawBook Directory: internal/mcpagent/alaws_livi/
  • Prompt Templates: Use {{ref:livi.<section>.<id>}} to compose prompt headers without inline rule duplication.

Verification & Testing

  • Backend & LawBook Tests: go test -v ./internal/mcpagent/... -run TestLawbookCompiles
  • Frontend Type Safety: npx tsc --noEmit (in ui/)

shrsv and others added 30 commits August 21, 2026 08:30
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:2, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
- Create LawBook sections for interpret rules (schema, sql, data-quality, chart-rules, count)
- Create PromptBook template (prompts/interpret.md) with {{ref:}} directives
- Embed chart_types.json for user message (matching Python script format)
- System prompt: self-contained with {{org_id}}/{{org_name}} variables
- User message: query + org context + dbctx schema + chart types
- Add VegaLiteSpec + Name fields to Interpretation struct
- Use LLM's vega_lite_spec with DATA_PLACEHOLDER replacement
- Fix classify test mocks to use 'response' field
- Fix ChatDebugPage Unicode escape + InteractiveChart prop names
- Add /chat-debug route and mega menu entry
LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%)
shrsv and others added 12 commits August 30, 2026 06:04
Explains the why (a safety net for changes that skip commit/push/PR checks)
and the mechanism (per-repo toggle, cron schedule, last/next run tracking),
with both the schedule list and schedule-edit screenshots.

LiveReview Pre-Commit Check: skipped (iter:2, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
…ction

Keeps the Org-Wide Harness table and screenshot as they were, and links to
the fuller Scheduled Reviews explanation now living alongside the other
Features entries, without reordering the existing ones.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:2, coverage:22%)
Adds a stable #scheduled-reviews anchor, bolds each capability's lead
phrase, and splits the "why" into short bullet points instead of a
run-on paragraph.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
The #scheduled-reviews anchor sat inside a collapsed <details> block, so
jumping to it landed on invisible content. Move the id onto the
<details> element itself so the link scrolls to the visible summary
line instead.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
Comment thread ui/src/pages/Chatbot/ChatConversation.tsx Fixed
LiveReview Pre-Commit Check: ran (iter:2, coverage:0%)
Comment thread ui/src/pages/Chatbot/ChatConversation.tsx Fixed
LinceMathew and others added 13 commits August 30, 2026 14:15
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
Explains that repos don't all need the same checkpoints: Commit Only,
Commit + Scheduled, Commit + Before Push + MR/PR, and the Full Harness
each trade shipping speed for review depth differently. Chart is a
Vega-Lite spec rendered to PNG via vl-convert.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
Replaces em dashes with colons in the checkpoint-combination bullets,
and re-exports the quadrant chart with a solid white background
instead of transparent so it renders correctly on GitHub.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
Swaps the gray/navy monochrome ramp for the violet/blue/amber/emerald
accent colors already used elsewhere on the page, so the chart fits
the site's visual language.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
The screenshot duplicated the one already shown later in the
Scheduled Reviews feature section, and added nothing between the
harness table and the review-depth quadrant.

LiveReview Pre-Commit Check: skipped (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
@LinceMathew
LinceMathew marked this pull request as ready for review August 30, 2026 15:55
@LinceMathew
LinceMathew merged commit 488117e into master Aug 30, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants