dev@bfd:~/dev-diary$ git show 2026-01
commit 2026-01-12-major-webdev-baibe-core-work-done
Author: MJ
Date: Jan 12, 2026

2026-01-12 - major webdev + baibe_core work done

Timeline

  • 00:22 (Context) Started the day with BAIBE_CORE as a functional but raw prototype. The system demonstrated basic RAG capabilities but suffered from significant usability friction (UI layout bugs, no persistence), transparency issues (opaque storage), and “tunnel vision” where the AI could not identify the source files of retrieved chunks. The objective was to mature the system into a robust, “daily-driver” local RAG tool.
  • 00:22 (Action) Backend & RAG Architecture:
  • Tunnel Vision Fix: Patched KbRetriever to inject explicit path=... headers into context snippets, ensuring the AI recognizes file origins.
  • Performance Tuning: Increased retrieval TopK (5 → 25) and MaxChars (2k → 6k) to fully utilize the context window of modern local LLMs (gemma3:4b).
  • Inspection & Ops: Added WebDev browser utility scripts for deep storage inspection and WebDev browser utility scripts for secure chat export.
  • OS Integration: Implemented WebDev browser utility scripts to launch the host file explorer directly from the web UI. Frontend & UX:
  • Chat Experience: Implemented localStorage persistence, Markdown rendering, and keyboard shortcuts (Enter/Shift+Enter). Fixed CSS flexbox issues to ensure input visibility.
  • Streaming Stability: Refined the chat stream handler with a buffer to prevent JSON parse errors on split chunks. Implemented “smart” auto-scroll that respects the user’s reading position.
  • Tooling: Built the “Storage Inspector” tab to visualize raw vectors/chunks and added a “View Content” modal for source files.
  • 00:22 (Observation) - Context injection: Explicitly labeling chunks with file paths was the single biggest quality improvement. Without it, retrieval is semantically valid but practically confusing for the user.
  • Streaming data: HTTP chunk boundaries rarely align with JSON line breaks. A robust string buffer is mandatory for stable streaming; relying on newline splitting alone caused intermittent data loss.
  • UI Constraints: The window.prompt API is unreliable in Electron/WebView wrappers, necessitating custom modal implementations for all user input.
  • 00:22 (Open Thread) - Data Reactivity: The system currently relies on manual refreshes. Implementing a filesystem watcher or polling mechanism for USER_DROP_RO is the next logical step for a seamless ingest loop.
  • Frontend Complexity: index.html has grown to ~900 lines of mixed logic and view code. Refactoring this into modular scripts (or a lightweight component architecture) is becoming necessary for maintainability.
  • 00:22 (Context) The browser’s download functionality was highly restrictive and lacked visual feedback, causing “hanging” states on modern web apps (Blob/Data URLs). Additionally, the AI Assistant was strictly tethered to the main window, limiting multitasking efficiency.
  • 00:22 (Action) * [~10:00 AM - 1:00 PM] Core Download Logic: Implemented automatic downloading - custom GetUniqueFilePath helper to handle filename collisions (e.g., file (1).zip).
  • [~1:00 PM - 4:00 PM] Protocol & Security Refinement: Whitelisted blob: and data: schemes to fix hanging tabs. Removed restrictive MIME-type/Extension whitelists to allow “standard” browser behavior where all files are permitted.
  • [~4:00 PM - 8:30 PM] Visual Progress System: Created DownloadProgressForm.cs, a custom TopMost progress window. Integrated real-time byte tracking (BytesReceivedChanged) and percentage calculations.
  • [~8:30 PM - 10:30 PM] UX & Ergonomics: Repositioned the download modal to the bottom-right corner and implemented Win32 API calls (SendMessage/ReleaseCapture) to allow clicking and dragging the borderless window.
  • [~10:30 PM - Midnight] UI Decoupling: Modified Form1.cs to launch AI Assistant panels as independent top-level windows, allowing them to remain visible even when the main browser is minimized.
  • 00:22 (Observation) * Fixed Build Blockers: Identified and resolved a type mismatch (ulong? vs long) in the WebView2 SDK download properties that was causing compilation failures.
  • Friction Reduction: Removing the silent “IsAllowed” blocking logic immediately resolved the reported “hangs” on download buttons.
  • Multitasking: Independent AI panels significantly improve the “Research Agent” workflow, as the LLM context remains accessible regardless of the browser’s window state.
  • 00:22 (Open Thread) * Queue Management: Currently, each download creates a new popup; consider a “stacking” logic or a single “Downloads Manager” pane for multiple simultaneous files.
  • AI Context Persistence: Explore keeping AI panels open across app restarts (Session Restore) if the main window was closed while they were active.