MDX Limo
Plan: Merge Knowledge into Library

Plan: Merge Knowledge into Library

Context

The app has two overlapping top-level pages: Library (/content) shows pipeline content pieces in table/kanban views, and Knowledge (/workspace) is a filesystem file browser for reference docs, generated artifacts, and approved bundles. The user's intent: Library should be the single surface for everything the agent knows about and has produced — content pipeline items, reference materials, brand guidelines, workflow outputs, and workspace artifacts. Knowledge gets absorbed into Library and its route is removed.

Approach: Three-View Library

Expand the Library page from 2 views (Table, Kanban) to 3 views (Table, Kanban, Files). The Table view becomes the unified item list across all content types. The Files view absorbs the current workspace file browser.

View Modes

ViewShowsUse case
TableAll items: pipeline pieces + reference docs from DBDefault. "Everything at a glance"
KanbanContent pipeline items only (same as today)Working the pipeline
FilesWorkspace file tree (ported from Knowledge page)Browsing raw artifacts, reading docs

Data Model Extension

Extend ContentPiece with a kind discriminant to support reference documents alongside pipeline items:

1// Add to ContentPiece or create a wrapper 2kind: 'content' | 'reference'

Reference documents come from listDocumentsByClass('our_page') — fetched server-side alongside existing pipeline queries. They appear in the Table view with appropriate columns (no keyword/priority for reference docs — show "—").

Header Action Bar (adapts per view)

  • Table: Search + Kind filter (All / Content / References) + View toggle
  • Kanban: Search + View toggle (same as today)
  • Files: Search (BM25) + Section toggle (Library / Generated / Artifacts) + View toggle

Steps

1. Extend server data (frontend/app/(app)/content/page.tsx)

  • Add listDocumentsByClass('our_page') to the parallel query in getContentPieces()
  • Map documents to ContentPiece[] with kind: 'reference', sensible defaults for pipeline-specific fields
  • Pass combined array to ContentLibraryClient

2. Update types (frontend/src/content-engine/types.ts)

  • Add kind?: 'content' | 'reference' to ContentPiece (optional for backwards compat, default 'content')

3. Extract Files view (frontend/components/content-engine/library-files-view.tsx)

  • Port the file tree + preview + metadata layout from workspace-page-client.tsx into a standalone component
  • Remove its own useHeaderSlot() call — parent manages the header
  • Props: activeSection, onSectionChange, searchQuery

4. Rewrite Library client (frontend/components/content-engine/content-library-client.tsx)

  • Add third view mode: 'table' | 'kanban' | 'files'
  • Add kind filter state for Table view
  • Header slot renders different controls per view mode
  • Lazy-load both KanbanBoard and LibraryFilesView
  • Table columns: Title, Kind (badge), Type, Status, Keyword, Updated
  • Reference doc rows show kind: 'reference' badge, "—" for keyword/priority

5. Extend selection system (frontend/components/content-engine/content-provider.tsx)

  • Add { type: 'document'; data: DocumentRow } to SelectedItem union
  • Reference doc clicks open the context panel with doc metadata + content preview

6. Add document context panel (frontend/components/content-engine/context-panel.tsx)

  • Add rendering branch for type === 'document': title, class, source URL, word count, updated date, content preview

7. Update navigation (frontend/lib/app-navigation.ts)

  • Move Library nav item from Content group to Main group (replace Knowledge's slot)
  • Change icon from Library to BookOpen (currently used by Knowledge)
  • Update route to /library (cleaner URL for a top-level page)
  • Remove KNOWLEDGE_BASE_PAGE constant
  • Remove /workspace entries from getPageMeta() and APP_NAV_ITEMS
  • Update CONTENT_LIBRARY_PAGE.subtitle to: "Content pipeline, reference materials, and workspace artifacts"

8. Route changes

  • Create frontend/app/(app)/library/page.tsx (move from /content)
  • Delete frontend/app/(app)/workspace/page.tsx
  • Delete frontend/components/content-engine/workspace-page-client.tsx
  • Keep workspace API routes (/api/harness/workspace/*) — Files view still needs them

9. Cleanup

  • Remove unused imports and Knowledge-related constants
  • Update any links that point to /workspace

Key Files

FileAction
frontend/app/(app)/content/page.tsxExtend with document queries
frontend/components/content-engine/content-library-client.tsxMajor rewrite — 3 views, kind filter
frontend/components/content-engine/workspace-page-client.tsxExtract into library-files-view.tsx, then delete
frontend/components/content-engine/content-provider.tsxAdd 'document' to SelectedItem
frontend/components/content-engine/context-panel.tsxAdd document detail rendering
frontend/src/content-engine/types.tsAdd kind to ContentPiece
frontend/lib/app-navigation.tsRestructure nav, remove Knowledge
frontend/app/(app)/workspace/page.tsxDelete

New Files

FilePurpose
frontend/components/content-engine/library-files-view.tsxExtracted file browser component

Decisions

  • Route: /library (new top-level URL). Old /content route can redirect or be removed.
  • Reference docs: Intermixed with pipeline items in the Table view, filterable via Kind dropdown.

Verification

  1. pnpm build — no type errors
  2. Navigate to Library page — Table view shows both pipeline items and reference documents
  3. Kind filter works — can isolate content vs references
  4. Kanban view unchanged — shows only pipeline items
  5. Files view works — file tree loads, BM25 search works, file preview renders
  6. Click reference doc in Table — context panel shows document details
  7. /workspace route is gone (404)
  8. Sidebar shows Library in Main group with BookOpen icon
Plan: Merge Knowledge into Library | MDX Limo