Skip to content

AI Integration Strategy — Knowledge Hub

Precedence note (S491, 22/07/2026): this master strategy doc predates the S491 tier-1 refresh. Where it conflicts with reference/platform-context.md, reference/platform-direction.md, or reference/deployment-architecture.md, the tier-1 docs win. The strategy/decision-log content here remains the canonical why record for the AI-integration layer set.

Date: 11 March 2026 (updated 7 April 2026, S151 Task 17b — restructure) Status: Active — master strategy document for all AI integration work Supersedes: .planning/.archive/.specs/spec4-ai-integration-architecture.md (6 March 2026, archived), .planning/.archive/.specs/2026-03-07-ai-integration-next-steps.md (7 March 2026, archived) Companion document: docs/reference/ai-integration-layers.md — technical layer map, capability crossover matrix, decision rules, and built/planned status. This document is the why; layers.md is the how. Author: Liam + Claude Code (Sessions 63, 64, 64b, 65, 66, 66b, 80, 81, 82, 108, 151)


  1. Vision and Strategic Positioning
  2. Current State — What Is Built
  3. Architecture — The Four-Layer Model
  4. Layer 1: Remote MCP Server
  5. Layer 2: MCP Apps
  6. Layer 3: Cowork Plugin
  7. Layer 4: Claude Code Plugin
  8. AI Service Layer
  9. Skill Files
  10. Background Automation
  11. Reorient Me — Phase 2 (AI Synthesis)
  12. Library-to-Bid Feedback Loop
  13. Presentation Split — Claude vs Web App
  14. Enterprise Search Patterns — Reference Implementation
  15. Client Context and Multi-Connector Experience
  16. Onboarding and Setup
  17. Implementation Sequence
  18. Effort Estimates
  19. Decision Log (10 active decisions)
  20. Key Reference Documents

The knowledge base IS the product. Bids are the first application; the same structured data will power sales proposals, compliance, training, and other use cases. The navigation and information architecture must lead with the KB.

1.2 “Everyone Ends Up Working Within an LLM”

Section titled “1.2 “Everyone Ends Up Working Within an LLM””

A strategic insight from the product owner (Session 62 brainstorm, §11.2 of State of the Product): most users already work within Claude Desktop, Claude.ai, Cowork, or similar LLM interfaces. Knowledge Hub’s job is to facilitate that — structuring data so AI can access it effectively, not competing for screen time.

This means:

  • Claude is the primary AI interface — where most AI-powered interaction happens day-to-day. Users ask questions, get briefings, draft responses, and analyse coverage from within Claude
  • The web app is the management layer — where users browse, edit, review, configure, and curate the golden-source knowledge base
  • We don’t compete, we complement — Knowledge Hub’s value is in the data layer and API surface, not in building Claude’s equivalent inside the web app
  • We adopt and customise, not reinvent — Anthropic and the ecosystem release plugins, skills, and commands regularly. We leverage existing patterns (enterprise-search, sales, operations) and customise for our domain

Knowledge Hub helps SMBs with AI readiness by providing easy interaction with company data. The key differentiator is creating golden-source knowledge bases that convert into actionable insights — not building another AI tool.

  • “Programmatic where possible” — save AI for tasks where natural language adds genuine value. Use deterministic functions for deterministic tasks
  • “Observe and intervene” — not “prevent and approve”. Trust users by default, flag for review when quality dips
  • “Invisible craft” — AI should be infrastructure, not a visible product feature
  • “Claude for questions, web app for workflows” — reading and querying should work from anywhere; complex visual workflows live in the web app

For the full 13 governing UX principles (canonical product UX direction) see docs/reference/ux-principles.md.


2.1 AI Service Layer (Extracted — Session 65)

Section titled “2.1 AI Service Layer (Extracted — Session 65)”

AI logic has been extracted from inline API route handlers into a shared service layer at lib/ai/. All AI integration points now call through this layer, which is also consumed by the MCP server. The integration points are:

#OperationRoute/FileAI Provider
1Classificationapp/api/items/[id]/classify/route.tsClaude Sonnet 4.6 (Pass 1 tool_use) + Claude Haiku 4.5 (Pass 2 entity validation)
2Summarisationapp/api/summaries/generate/route.tsClaude Sonnet 4.6 (tool_use)
3Change report generationapp/api/change-reports/generate/route.tsClaude Sonnet 4.6 (tool_use)
4Embeddingapp/api/embed/route.tsOpenAI text-embedding-3-large (1024 dims)
5Content extractionapp/api/extract/route.tsClaude Sonnet 4.6
6Vision/PDF analysisapp/api/items/[id]/vision/route.tsClaude Sonnet 4.6 (vision)
7Question extractionapp/api/bids/[id]/questions/extract/route.tsClaude Sonnet 4.5 (structured outputs)
8KB matchingapp/api/bids/[id]/questions/match/route.tsClaude Sonnet 4.5 (analysis) + OpenAI embeddings
9Response draftingapp/api/bids/[id]/responses/draft*/route.tsClaude Opus 4.6 (3-pass pipeline)
10Quality checklib/quality-check.tsClaude Haiku 4.5 (structured outputs)
11Tender metadatalib/structured-outputs.tsClaude Haiku 4.5

Model tier defaults are centralised in lib/anthropic.ts (MODEL_TIERS): analysis = claude-sonnet-4-5, drafting = claude-opus-4-6, quality = claude-haiku-4-5. The default service model for classification/summarisation is claude-sonnet-4-6 (overridable via AI_SUMMARY_MODEL). The Python ingestion pipeline pins to claude-opus-4-6 (scripts/kb_pipeline/config.py) for batch quality.

Service layer: lib/ai/index.ts (entry point), lib/ai/classify.ts, lib/ai/summarise.ts, lib/ai/change-reports.ts, lib/ai/embed.ts, lib/ai/extract.ts, lib/ai/vision.ts, lib/ai/questions.ts, lib/ai/matching.ts, lib/ai/drafting.ts, lib/ai/quality.ts, lib/ai/tender.ts, lib/ai/errors.ts (AIServiceError pattern).

Skill files: lib/ai/skills/ — 5 skill files (procurement-writing, uk-procurement, classification, classification-entity-types, governance) providing domain knowledge as structured prompts. Filename note: the procurement-writing skill was renamed S249 (ID-23) from bid-writing.md; the prose retains “bid” terminology as the UK procurement industry standard.

Supporting modules: lib/anthropic.ts (client, model tiers), lib/embeddings.ts (OpenAI), lib/bid-drafting.ts (3-pass pipeline), lib/citations.ts (Search Result Citations), lib/cost-estimation.ts, lib/bid-matching.ts, lib/ai-parse.ts (generic tool_use extractor), lib/validation/ai-schemas.ts (Zod schemas for AI responses).

Python pipeline: scripts/kb_pipeline/ (classify.py, summarise.py, embed.py) with its own Anthropic/OpenAI clients.

In-app AI interaction is handled by the ClaudePromptButton bridge, which generates contextual prompts and opens Claude directly. There is no embedded chat sidebar — see Decision 14 in §19 for the full rationale.

  • Interactive MCP App (Phase 3): Personal briefing app with 4-block layout (welcome, urgent, team, bids).
  • GET /api/reorient endpoint with lib/reorient.ts data augmentation (display names via admin client, workspace/question IDs).
  • Action model: sendMessage() for drafting workflows and callServerTool() for inline drill-downs.
  • Registered via show_reorient_me tool and ui://reorient-me/app.html resource (see docs/generated/mcp-inventory.md for current indices).
  • Full Phase 3 E2E verification complete. Live test counts in docs/generated/codebase-stats.md.

2.4 MCP Server (Complete — Sessions 65-108)

Section titled “2.4 MCP Server (Complete — Sessions 65-108)”

Architecture:

app/api/mcp/[transport]/route.ts # Handler with withMcpAuth, WebStandardStreamableHTTPServerTransport
app/.well-known/oauth-protected-resource/route.ts # RFC 9728
app/oauth/consent/page.tsx # Warm Meridian consent UI
app/api/oauth/decision/route.ts # Consent decision handler
lib/mcp/
tools/ # Tool registrations across category files
resources.ts # Resources + prompts
formatters.ts # Markdown formatters per domain
auth.ts # Per-user Supabase client, role check, service fallback
app-bundles.ts # Generated HTML for MCP App resources (Vercel-safe)
plugin-bundle.ts # Generated ZIP for /api/plugin/download (Vercel-safe)
  • Tool, resource, and prompt counts: see docs/generated/mcp-inventory.md (auto-generated). lib/mcp/CLAUDE.md carries the same numbers for the developer hot path.
  • Auth: OAuth 2.0 with Supabase — per-user RLS, role-gated write tools.
  • Transport: WebStandardStreamableHTTPServerTransport (SDK native) — fresh server + transport per request for Vercel serverless reliability.
  • Claude Code plugin (dedicated, beyond CLAUDE.md + checks)
  • Python worker for processing_queue jobs
  • Feedback loop AI enhancements (diff view, AI recommendations, answer variant routing)
  • MCP Apps: Search Results, Review Queue, Content Timeline (Coverage Matrix, Bid Dashboard, Reorient Me, and Intelligence Feed are live)
  • Freshness cron: recalculate-freshness-daily pg_cron at 03:00 UTC (deterministic, no AI)
  • Background cron routes: 5 Vercel cron routes at app/api/cron/ — freshness-transitions, classification-quality, coverage-alerts, content-gaps, quality-score (all implemented S102-S107)
  • Activity feed: get_grouped_activity_feed RPC with 3-CTE approach
  • Bid response history: Auto-versioned via bid_response_history_snapshot trigger — already queried by Reorient Me
  • Processing queue: processing_queue table exists for background jobs (no consumer yet)
  • Content history: Auto-versioned immutable audit trail with created_by

Knowledge Hub’s AI integration is organised into four layers on top of a shared data and service foundation. Layer 1 is the MCP server (raw data access); Layer 2 is MCP Apps (interactive visual cards rendered inside Claude); Layer 3 is the Cowork plugin (commands + skills that teach Claude how to use the tools); Layer 4 is the Claude Code plugin (developer-focused KB access).

The MCP server is the single reusable core. Layers 2-4 all build on it.

For the canonical layer map (ASCII diagram, per-layer descriptions, capability crossover matrix, and decision rules), see docs/reference/ai-integration-layers.md §1–§4.


Remote MCP server built as a Next.js API route using the MCP SDK’s WebStandardStreamableHTTPServerTransport directly. Runs within the existing Vercel deployment with no new infrastructure. A fresh server + transport is created per request for Vercel serverless reliability (see Decision 13).

Route: app/api/mcp/[transport]/route.ts

Dependencies: @modelcontextprotocol/sdk, @modelcontextprotocol/ext-apps, zod

The MCP server exposes tools, resources, and prompts. For the canonical inventory — current counts, names, parameters, annotations, and category breakdown — see docs/generated/mcp-inventory.md (auto-generated from the codebase). Both lib/mcp/CLAUDE.md and docs/reference/ai-integration-layers.md also reference this single source of truth.

Tool description quality matters enormously. API-to-tool mapping creates suboptimal AI experiences. Tools must be described in terms of what the user gets, not what the API does. Markdown summaries in content for model consumption; rich structured data in structuredContent for MCP App rendering. This mirrors Notion’s approach of returning Markdown instead of hierarchical JSON for model consumption.

Tool annotations: Every tool ships with readOnlyHint, destructiveHint, idempotentHint, openWorldHint, and title annotations. The inventory file shows the full annotation breakdown.

Tool response format — content vs structuredContent: MCP tool responses support two output fields. content is text the model reads and reasons about (concise Markdown). structuredContent is data optimised for UI rendering (what MCP Apps display). Knowledge Hub tools return both.

Deferred tool loading: Investigation (S82) found that deferred tool loading is a client-side concern, not an MCP SDK feature. The current tool count is at the upper end of the recommended range (~30-40 tools) for accurate tool selection. If the count grows further, consider splitting into multiple MCP servers rather than deferred loading.

Evaluation tooling: Knowledge Hub runs three layers of MCP eval coverage (bun run test:mcp-eval, :rq, :fc) covering protocol compliance, response quality, and functional correctness against the live database.

Recommended: OAuth 2.0 with Supabase.

Custom Connectors in Claude use OAuth for authentication. The flow:

  1. User adds Knowledge Hub as a connector in Claude Settings > Connectors
  2. Claude redirects to Knowledge Hub’s OAuth consent screen
  3. User authenticates with Supabase credentials
  4. OAuth provider issues a JWT; Claude stores it
  5. All subsequent tool calls carry the token
  6. MCP server validates via supabase.auth.getUser()

API key fallback: For initial development, a per-user API key stored in user_roles.metadata can be used with Bearer token auth. Transition to OAuth before client pilot.

Claude PlanCustom Connectors
Free1 custom connector
Pro ($20/month)Unlimited
Max ($100-200/month)Unlimited
Team ($25-30/user/month)Unlimited
EnterpriseUnlimited

Even free Claude users can connect to Knowledge Hub.

{
"mcpServers": {
"knowledge-hub": {
"url": "https://knowledge-hub-seven-kappa.vercel.app/api/mcp/mcp",
"headers": {
"Authorization": "Bearer <user-token>"
}
}
}
}

The Anthropic Messages API now supports MCP servers directly via the mcp_servers parameter (beta header: mcp-client-2025-11-20). This means any application using the Claude API can access Knowledge Hub tools without building MCP client infrastructure. Multiple servers can be connected in a single request.

Once connected, users interact naturally:

  • “Search my knowledge base for ISO 27001 compliance content”
  • “What bids are active and which ones are overdue?”
  • “Show me the coverage gaps in Security”
  • “Draft a response to this question using my KB: [question text]”
  • “What has changed in Knowledge Hub since yesterday?”
  • “Create a Q&A pair for our data retention policy”
  • “Search KB for our case studies and create an Asana task to update the stale ones”

The last example demonstrates cross-connector orchestration — Claude routes to Knowledge Hub for the search and Asana for the task creation, with no integration between the two systems required.


MCP Apps are interactive HTML interfaces rendered inside MCP hosts (Claude Desktop, Claude.ai, VS Code, Cowork). They run in sandboxed iframes with bidirectional communication to the MCP server via postMessage.

Why MCP Apps matter for Knowledge Hub:

  • Coverage matrices, bid progress dashboards, and review queues need visual density that text responses cannot provide
  • Users get web-app-level interactivity without leaving Claude
  • Apps can call MCP tools for live data and delegate actions to other connectors
  • Aligns perfectly with “not competing for screen time” — the UI lives inside Claude’s conversation

For the canonical built/planned list of MCP Apps (Coverage Matrix, Bid Dashboard, Reorient Me, Intelligence Feed, plus planned apps), see docs/reference/ai-integration-layers.md §5 (Layer 2 status table).

Use the create-mcp-app skill for new apps and convert-web-app skill for adapting existing pages. Build purpose-built lightweight React components using @modelcontextprotocol/ext-apps/react with the useApp hook, rather than converting full Next.js pages.

The convert-web-app 6-step process:

  1. Analyse the existing web app (data sources, dependencies, build system)
  2. Investigate CSP requirements (every external origin must be declared)
  3. Set up the MCP server (registerAppTool, registerAppResource)
  4. Adapt the build pipeline (Vite with vite-plugin-singlefile)
  5. Add MCP App initialisation alongside existing logic (hybrid pattern with isMcpApp detection — app works both standalone and inside Claude)
  6. Add host styling integration (CSS variables with fallbacks)

Key constraints:

  • Apps must be bundled as single HTML files (via vite-plugin-singlefile)
  • External origins must be declared in CSP metadata
  • No localStorage/sessionStorage (sandboxed iframe)
  • Auth handled by the MCP server, not the app

Cross-connector delegation: MCP Apps can delegate actions to the host, which routes them to other connected MCP servers (subject to user consent). This means a Knowledge Hub MCP App could request “create an Asana task for this gap” — the host routes to Asana’s MCP server without Knowledge Hub needing direct Asana integration. The routing is: App → Host → Other MCP Server. The app never calls other servers directly.

MCP Apps are supported by: Claude.ai, Claude Desktop, VS Code (Insiders), Goose, Postman, MCPJam, and ChatGPT.


Based on patterns from the 7 installed Cowork plugins (enterprise-search, sales, operations, product-management, customer-support, design, productivity).

For the canonical command and skill list with what each does, see docs/reference/ai-integration-layers.md §1 (Layer 3 commands and skills tables) and §5 (Layer 3 status table).

6.2 The ~~knowledge base Connector Pattern

Section titled “6.2 The ~~knowledge base Connector Pattern”

Cowork plugins use tool-agnostic ~~category references. Knowledge Hub maps to ~~knowledge base. This means the enterprise-search plugin (already installed by the client) will automatically include KB results when searching across sources — Claude routes ~~knowledge base queries to our MCP server.

6.3 Pattern Validation: Productivity Memory Management

Section titled “6.3 Pattern Validation: Productivity Memory Management”

The installed productivity Cowork plugin includes a memory-management skill with a two-tier memory architecture: CLAUDE.md as a “hot cache” (~30 people, ~30 terms, ~100 lines max) plus a memory/ directory for full storage (glossary, people, projects, context). Items promote/demote between tiers based on frequency — the “Hot 30” rule.

This validates Knowledge Hub’s existing approach: CLAUDE.md + MEMORY.md for session context, .planning/ + docs/ for deep reference. The pattern confirms that tiered context management (hot cache + cold storage) is the proven approach across Anthropic’s plugin ecosystem.

From the corpus of 34 Cowork skills analysed:

  • Concise skills (30-50 lines): Decision frameworks with clear taxonomies. Use for: classification.md, content-governance.md
  • Medium skills (100-200 lines): Multi-step workflows with templates. Use for: knowledge-synthesis.md, search-strategy.md
  • Long skills (400-800+ lines): Complex creative tasks with quality systems. Use for: procurement-writing.md
  • Always include: Trigger phrases in frontmatter, explicit anti-patterns, output format templates, confidence/quality indicators
  • Cross-reference: Skills and commands should reference each other by name

Commands follow a consistent pattern across all Cowork plugins:

  • Numbered step workflow (typically 5-8 steps)
  • Reference companion skills: “See the skill-name skill for…”
  • Use $ARGUMENTS for user input
  • Always include edge case handling as a final step
  • “Standalone + supercharged”: work without connectors, better with them

Cowork plugins can be distributed via:

  • Private marketplace (enterprise admin configures via Customize menu)
  • Direct install (copy plugin files)
  • Per-user provisioning with auto-install to specific teams

For developer-focused KB access within Claude Code. The current state is the .claude/ directory with CLAUDE.md, quality checks, and a shared MCP connection. A dedicated plugin with KB-aware agents (kb-researcher, bid-assistant) is planned post-pilot. See docs/reference/ai-integration-layers.md §5 (Layer 4 status table) for the canonical built/planned breakdown.

AspectCowork PluginClaude Code Plugin
AudienceKnowledge workers (bid managers, content editors)Developers working on KB
CommandsDomain-focused (/kb:briefing, /kb:coverage)Dev-focused (/kb:search, /kb:change-report)
AgentsNot used in Cowork pluginskb-researcher, bid-assistant
HooksNot usedCould trigger on file edits for KB sync
UICowork conversationTerminal output

Both Cowork and Claude Code plugins point to the same MCP server URL. The MCP server is the single reusable core; plugins add domain-specific skills and workflows on top.


All 12 AI integration points originally had logic inline in API route handlers. This was extracted in Sprint 3 (S65) into a shared service layer.

AI logic was extracted from routes into lib/ai/ functions that all consumers call:

lib/ai/
├── index.ts # Re-exports
├── classify.ts # Classification (from classify route)
├── summarise.ts # Summary generation (from summaries route)
├── match.ts # KB matching (from bid matching route)
├── draft.ts # Response drafting (from bid drafting route)
├── extract-questions.ts # Question extraction (from tender extraction)
├── quality-check.ts # Quality check (already partially extracted)
├── coverage-analysis.ts # Gap detection (new)
├── skills/
│ ├── loader.ts # Reads and parses skill markdown files
│ ├── procurement-writing.md # Bid writing best practices (renamed S249 ID-23)
│ ├── uk-procurement.md # UK procurement regulations
│ ├── classification.md # Classification guidance
│ ├── classification-entity-types.md # Entity-type classification taxonomy
│ └── governance.md # Governance rules
└── prompts/
├── classify.ts # Classification prompt templates
├── summarise.ts # Summary prompt templates
└── draft.ts # Drafting prompt templates

The AI service layer was the prerequisite for everything else:

  • MCP tools call lib/ai/classify() instead of duplicating classification logic
  • Background crons call lib/ai/ functions for batch operations
  • Cowork/Claude Code skills reference the same domain knowledge from skill files

API routes are now thin wrappers that validate input, call lib/ai/ functions, and return responses.

lib/dashboard.ts and lib/reorient.ts duplicate bid fetching logic. Extract shared bid query helpers as part of the service layer work.


9.1 Application-Level Skills (lib/ai/skills/)

Section titled “9.1 Application-Level Skills (lib/ai/skills/)”

These are markdown documents read at runtime by the application’s AI functions and injected into prompts as system context. They are NOT Claude Code skills/plugins — they are content files for the application’s own AI layer.

import { loadSkill } from './skills/loader';
const procurementWritingSkill = await loadSkill('procurement-writing');
const prompt = `${procurementWritingSkill}\n\n${basePrompt}`;

These are separate files in the Cowork plugin or Claude Code plugin structure. They teach Claude how to behave when working with Knowledge Hub data — query decomposition, bid writing patterns, content governance, classification guidance.

Application-level skills (in lib/ai/skills/) are injected into Claude API calls made by the server. Cowork/Claude Code skills (in the plugin) are instructions to Claude when working in the Claude interface. They share the same domain knowledge but serve different contexts:

ContextSkill LocationConsumer
Server-side AI (classification, drafting)lib/ai/skills/API routes, MCP tools
Claude conversation (Cowork, Desktop)Plugin skills/Claude directly

The content can be shared (copy procurement-writing guidance to both locations) but the format differs slightly (application skills are injected into prompts; Claude skills are SKILL.md with frontmatter triggers).


Full spec: docs/specs/background-automation-spec.md (4-eyes verified, S81).

Status: All 5 cron routes implemented (S102-S107).

10.1 Freshness Transition Notifications — Done

Section titled “10.1 Freshness Transition Notifications — Done”
  • Route: app/api/cron/freshness-transitions/route.ts
  • Schedule: Daily
  • Detects freshness state changes and notifies owners + admins

10.2 Classification Quality Monitor — Done

Section titled “10.2 Classification Quality Monitor — Done”
  • Route: app/api/cron/classification-quality/route.ts
  • Schedule: Weekly
  • Reclassifies items with confidence below 0.7 or stale classifications (>90 days)
  • Uses lib/ai/classify() — taxonomy-aware
  • Route: app/api/cron/coverage-alerts/route.ts
  • Schedule: Weekly
  • Analyses template requirements vs KB content, detects gaps
  • Route: app/api/cron/content-gaps/route.ts
  • Schedule: Weekly
  • Detects new/resolved/persistent gaps, sends notifications
  • Route: app/api/cron/quality-score/route.ts
  • Schedule: Daily
  • Recalculates quality scores across the KB

All routes are protected by Vercel cron secret header and log runs in pipeline_runs table.


11. Reorient Me — Phase 2 (AI Synthesis)

Section titled “11. Reorient Me — Phase 2 (AI Synthesis)”

Phase 1 (deterministic rendering) is fully built. See §2.3. The spec at docs/specs/reorient-me-spec.md is implemented with all acceptance criteria met.

Phase 2 (“AI synthesis”) is delivered via MCP across all surfaces simultaneously:

Delivery PathHow It Works
MCP toolget_reorientation returns structured data → Claude synthesises naturally in conversation
MCP AppInteractive briefing card rendered inline in Claude (click to expand urgent items, view bid details)
MCP promptreorient prompt template provides the interaction pattern
Phase 1 (deterministic) ✅ Done
AI Service Layer (Sprint 3) → Extract fetchReorientData to lib/ai/
MCP Server (Sprint 4) → get_reorientation tool
Phase 2 delivered across:
a) Claude conversation (MCP tool)
b) Claude UI (MCP App — interactive briefing)

11.4 Pattern Validation: Sales Daily Briefing

Section titled “11.4 Pattern Validation: Sales Daily Briefing”

The installed sales Cowork plugin includes a daily-briefing skill that is a direct analogue to Reorient Me — same concept of “here’s what matters today.” Its patterns validate our approach and provide implementation reference:

  • Connector data aggregation (calendar, CRM, email, enrichment sources)
  • 6-level priority ranking system
  • Quick mode vs End of Day mode variants
  • Follow-up question suggestions

The Reorient Me MCP tool should follow this same pattern, returning structured data that Claude synthesises into a natural briefing.

reorient-me-spec.md (now archived to .planning/.archive/.specs/) — Phase 1 complete. Phase 2 is delivered via MCP across all surfaces (tool, app, prompt) as described above.


Forward path (built): KB feeds bids. Tender upload → question extraction → KB matching → AI drafting → quality check.

Reverse path (partially built): Bid outcome dialog with “integrate to KB” checkbox → KBIntegrationReview dialog → create/update content items.

  1. No quality comparison — no diff view when updating existing content
  2. No AI analysis — no comparison of winning response vs existing Q&A pair
  3. No automatic detection — only triggered by explicit checkbox
  4. No answer variant handling — doesn’t route to standard vs advanced answer
  5. No win signal propagation — winning content not boosted in search ranking
  6. No batch workflow — reviewing 20+ responses individually is tedious

| Phase | What | Effort | | ------- | ----------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Phase 1 | Diff view for updates (side-by-side comparison) | 0.5 sessions | | Phase 2 | AI-assisted recommendations (Claude analyses response vs source) | 1 session | | Phase 3 | Answer variant routing (standard/advanced selector) | 0.5 sessions | | Phase 4 | Win signal propagation (search ranking boost for winning content) | 1 session | Done (S80)hybrid_search and search_for_bid_response RPCs both multiply similarity by (1 + 0.03 * win_rate). Diff view, AI recommendations, and answer variant routing (Phases 1-3) remain unbuilt |

The feedback loop can be triggered from Claude: “Review the winning responses from the IT Support bid and suggest which ones should update the KB.” This would use MCP tools to fetch bid responses, compare against existing content, and present recommendations — all within Claude’s conversation.


13. Presentation Split — Claude vs Web App

Section titled “13. Presentation Split — Claude vs Web App”
CapabilityWhy Claude
Search across KBUsers already work in Claude; no app switching
Cross-connector queries”Search KB AND create Asana task” only works in Claude
Bid briefingsNatural language synthesis adds genuine value
Coverage gap analysisAI interprets data and explains gaps
Draft responsesClaude uses KB + context to generate responses
Content classificationTrigger reclassification from Claude workflow
Reorientation”What changed since yesterday?” is a natural prompt
PromptsReusable templates for common KB workflows
SkillsDomain knowledge that makes Claude smarter about the user’s context
CapabilityWhy Web App
Browse and filter contentSpatial navigation, grid/list, pagination
Inline editingRich text, version history, metadata
Review workflowSpeed triage cards, approve/reject — visual UI
Dashboard and analyticsCharts, coverage matrices — visual data density
Bid session editorSide-by-side question/response with streaming
File upload and ingestionDrag-and-drop, progress, batch operations
User and role managementSettings, invitations, permissions
Taxonomy managementDrag-and-drop reordering, CRUD
ClaudePromptButton bridgeContextual prompt generation, opens Claude directly
Notifications and governanceVisual indicators, badges, review queues

Both surfaces should support search and briefings. Users should never feel they must switch to accomplish something. The MCP server and the web app share the same backend logic — both call lib/ai/ functions. The ClaudePromptButton bridge provides in-app entry points to Claude-based workflows.

MCP Apps blur the line in a positive way — users get web-app-level visual density (coverage matrix, bid dashboard, search results) without leaving Claude. This is the “not competing” principle in action: the visual UI lives inside Claude’s conversation rather than in a separate tab.

The “chatbot in a sidebar” trap: a generic in-app chat surface disconnected from context. Knowledge Hub deliberately does not embed one — it would duplicate what Claude Desktop, Claude.ai, and Cowork already provide, while adding third-party dependency risk and pulling against the “AI is invisible infrastructure” principle. The primary AI value is delivered through:

  1. Reorient Me section (deterministic, no chatbot needed)
  2. Inline AI actions (classify, summarise) triggered by buttons, not chat
  3. Smart defaults (auto-classification on ingest)
  4. ClaudePromptButton bridge for contextual AI entry points

14. Enterprise Search Patterns — Reference Implementation

Section titled “14. Enterprise Search Patterns — Reference Implementation”

The enterprise-search plugin (3 skills, 2 commands) provides mature patterns:

Query type classification (from search-strategy skill): Decision, Status, Document, Person, Factual, Temporal, Exploratory — each gets different search strategy and relevance scoring weights. Maps directly to how we should tune our hybrid search.

Confidence model (from knowledge-synthesis skill): freshness × authority × agreement. Maps to our existing freshness system.

Deduplication and synthesis (from knowledge-synthesis skill): Cross-source deduplication, conflicting information handling, summarisation strategies by result set size. Anti-patterns: never list by source, never bury the answer, never present uncertain info with high confidence.

Source prioritisation (from source-management skill): Different priorities for different query types. For Knowledge Hub: Q&A pairs > policies > case studies > articles for factual queries; freshness weighting for status queries.

  • Query decomposition: KB is a single source, but content TYPE decomposition (search Q&A pairs separately from articles) improves results
  • Authority hierarchy: replace source-type hierarchy with content-type hierarchy (Q&A pairs > policies > case studies > blogs)
  • Confidence levels: map to our freshness system (fresh = high confidence, stale = flag as potentially outdated)

With Knowledge Hub’s MCP server connected as a connector, the enterprise-search plugin will automatically route ~~knowledge base queries to our tools. This means the client gets unified cross-source search (KB + Notion + Asana + HubSpot) with zero additional integration work.


15. Client Context and Multi-Connector Experience

Section titled “15. Client Context and Multi-Connector Experience”

The first client uses: Notion, Clay, Asana, HubSpot, and (soon) Knowledge Hub. Knowledge Hub becomes the 5th connector. The user’s mental model is already established: each connector is a data source, Claude orchestrates across them.

Claude handles multi-connector workflows natively:

“Search my KB for ISO 27001 content, summarise what we have, and create an Asana task to review the stale items”

Claude routes to Knowledge Hub for the search, synthesises the results, then routes to Asana for task creation. No integration between KB and Asana required — Claude is the orchestrator.

Knowledge Hub’s tools must have clear, distinct descriptions so Claude can disambiguate them from Notion (which also holds documents) and HubSpot (which also has company data). The key differentiator: Knowledge Hub is the golden-source knowledge base — structured, classified, freshness-tracked content with AI-powered search. Notion is for working documents; KB is for authoritative, curated knowledge.

Cowork supports scheduled tasks. The client could schedule:

  • Daily KB briefing at 9am (“What changed in my KB overnight?”)
  • Weekly coverage gap report on Mondays
  • Bid deadline reminders

Claude Code supports /loop for recurring tasks in development sessions.


16.1 Claude.ai / Claude Desktop (Custom Connector)

Section titled “16.1 Claude.ai / Claude Desktop (Custom Connector)”
  1. User navigates to Claude Settings > Connectors
  2. Clicks “Add connector” and enters KB MCP server URL
  3. Claude redirects to Knowledge Hub’s OAuth consent screen
  4. User authenticates with KB credentials (Supabase Auth)
  5. Connector appears in the user’s connector list with toggle
  6. In any conversation, user enables the connector via + > Connectors
  1. Knowledge Hub plugin distributed via private marketplace
  2. User installs from Customize menu
  3. Plugin auto-configures MCP connector, prompting for OAuth on first use
  4. Skills, commands, and connector become available immediately

The Settings page should include a “Connect to Claude” section:

  1. Guide explaining what connecting to Claude enables
  2. One-click copy of the MCP server URL
  3. OAuth setup or API key generation
  4. “Test connection” button
  5. Quick-start prompts to verify the connection

When a user first enables the connector, Claude sees the tool definitions and can describe available capabilities if asked (“What can you do with my Knowledge Hub?”). Claude will proactively use KB tools when queries match — no special onboarding needed inside Claude.

For client-facing onboarding documentation see docs/client-documentation/Knowledge Hub — Claude Integration Guide.md.


Sprint 8: Background Automation — Complete (S102-S107)

Section titled “Sprint 8: Background Automation — Complete (S102-S107)”

All 5 cron routes implemented. See section 10 for details.

ItemNotes
Template-driven completeness Phases 2-6MCP tools, web UI, gap loop, templates, onboarding. Phase 1 data ready (66 requirements)
Claude Code pluginDeveloper-focused KB access
MCP App: Reorient MeInteractive briefing card inside Claude (see §11) — Built (S84)
MCP App: search results viewerRich result cards with domain/type filters
MCP App: review queueSpeed-triage cards in Claude
MCP settings UI + connection testSettings page for MCP connection
Feedback loop Phases 1-3Diff view, AI recommendations, answer variant routing

SprintScopeSessionsActual
Sprint 3AI service layer extraction + skill files1-21 (S65)
Sprint 4MCP server (5 core tools + auth + settings)1-21 (S65, combined with Sprint 3)
Sprint 5MCP server (full) + OAuth + serverless fix2-32 (S66 + S66b)
Sprint 6Data quality + entity graph + curation2-32 (S67 + S68)
Sprint 7aAdditional MCP tools + plugin1-21 (S69)
Sprint 7bMCP App: Coverage Matrix1-21 (S72)
Sprint 7cMCP App: Bid Dashboard + polish1-21 (S76)
Sprint 7dBid Dashboard drill-down11 (S81)
Sprint 8Background automation1-2Done (S102-S107)
Total to MVPSprints 3-5 (MCP server live with OAuth)4-74 sessions
Total comprehensiveAll sprints including polish10-15Complete

#DecisionRationaleRevisit Trigger
1Claude-first, web-app-secondUsers work within Claude; KB structures data for AI accessUser feedback prefers web app AI
2MCP server prioritised over in-app chatMCP reaches more surfaces (Claude.ai, Desktop, Cowork, Code, API)Resolved (S109) — see Decision 14
3OAuth 2.0 for MCP authCustom Connectors use OAuth; implemented in S66 with Supabase JWT validation, RFC 9728 metadata, consent UIN/A — implemented
4Adopt Enterprise Search patternsProven at scale, aligned with ~~knowledge base categoryPatterns don’t fit KB’s needs
5Purpose-built MCP Apps (not converted pages)Next.js pages too complex for single-HTML bundlingconvert-web-app approach viable
6Cowork plugin over Claude Code plugin firstClient is knowledge workers, not developersDev workflow demand high
7Deterministic reorient-me first, AI synthesis via MCPProgrammatic where possible; MCP unlocks synthesis on all surfacesPhase 1 feels insufficient
8Skill files dual-locationlib/ai/skills/ for server-side prompts; plugin skills/ for ClaudeMaintenance burden too high
9WebStandardStreamableHTTPServerTransport over mcp-handlermcp-handler’s shared transport corrupts on warm Vercel instances; SDK’s web standard transport with fresh server + transport per request is reliable (S66b)mcp-handler shared-state issue fixed upstream
10In-app chat sidebar removed (S109)Investigation (S108) showed an embedded chat sidebar duplicated MCP capabilities, added third-party dependency risk, and conflicted with “AI is invisible infrastructure”. ClaudePromptButton bridge preserved.N/A — completed

DocumentPurpose
docs/reference/ai-integration-layers.mdTechnical layer map, crossover matrix, decision rules
docs/generated/mcp-inventory.mdAuto-generated tool/resource/prompt inventory (canonical counts)
lib/mcp/CLAUDE.mdDeveloper conventions for the MCP module
docs/reference/state-of-the-product.md §11Product direction and brainstorm outcomes
docs/reference/ai-visibility-policy.mdAI framing rules and visibility decisions
docs/reference/ux-principles.mdThe 13 governing UX principles (extracted from ADS v1.0)
.planning/.archive/.specs/reorient-me-spec.mdReorient Me implementation spec (archived; Phase 1 done)
.planning/.archive/.specs/background-automation-spec.mdBackground automation spec (archived; all 5 cron routes built)
.planning/.archive/.specs/bid-dashboard-enhancements-spec.mdBid Dashboard drill-down spec (archived; implemented S81)
docs/specs/template-driven-completeness-spec.mdTemplate-driven KB completeness (6 phases)
.planning/.archive/.specs/copilotkit-investigation-s108.mdHistorical investigation that informed Decision 10 (archived)
.planning/research/claude-capabilities/mcp-apps-overview.mdMCP Apps specification and patterns
.planning/research/claude-capabilities/plugins/enterprise-search/Enterprise Search reference plugin
.planning/research/claude-capabilities/40+ Claude capability research documents
.claude/plugins/7 installed Cowork plugins (patterns reference)
.claude/skills/mcp-builder/MCP server building skill with best practices
.claude/skills/create-mcp-app/MCP App creation skill
.claude/skills/convert-web-app/Web app to MCP App conversion skill
claude-desktop-feedback-on-mcp-tools.mdClaude Desktop feedback on MCP tools — 7 improvement opportunities
CLAUDE.mdProject conventions, architecture, gotchas
DocumentStatus
.planning/.archive/.specs/spec4-ai-integration-architecture.mdSuperseded by this document (archived). Valid content (AI service layer, skill files, background automation) absorbed
.planning/.archive/.specs/2026-03-07-ai-integration-next-steps.mdSuperseded by this document (archived). Research and analysis absorbed and updated
.planning/.archive/.reference/ads-v1.mdADS v1.0 (10 February 2026) — archived 7 April 2026 (S151 Task 17b). UX principles extracted to docs/reference/ux-principles.md; AI framing extracted to docs/reference/ai-visibility-policy.md

AI Integration Strategy produced: 8 March 2026, updated 24 March 2026 (S110 — in-app chat references removed, renumbered to 4-layer model), updated 7 April 2026 (S151 Task 17b — restructure: counts referenced from inventory, duplicated layer map removed in favour of cross-link to layers.md, decision log compacted to 10 active entries, §16 numbering fixed). Sessions: 63 (research), 64 (Sprints 1-2), 64b (bug fixes, strategy consolidation), 65 (Sprints 3-4: AI service layer + MCP server core), 66 (Sprint 5: MCP OAuth + core tools), 66b (serverless crash fix), 67-68 (Sprint 6: data quality + entity graph), 69 (Sprint 7a: additional tools + plugin), 72 (Sprint 7b: Coverage Matrix app), 76 (Sprint 7c: Bid Dashboard app), 80 (taxonomy, win signal), 81 (Sprint 7d: drill-down, background automation spec), 82 (docs refresh), 84 (Sprint 9: Reorient Me Phase 3), 102-107 (Sprint 8: background automation, quality tools, content lifecycle), 151 (audit + restructure).