AI · Full Stack · SaaS

Lumen — AI Marketing OS & Agent Suite

All-in-one AI marketing suite pairing a dynamic context-aware AI agent with a multi-tenant campaign & asset SaaS workspace

Lumen — AI Marketing OS & Agent Suite — Overview

Overview1 / 13

Challenge

Bridge the gap between strategic AI marketing planning and tangible SaaS campaign execution without overloading LLM context windows or disconnecting generated assets from campaign management tools.

Solution

Architected a unified suite combining a dynamic context AI agent with a multi-tenant SaaS workspace connected by a shared PostgreSQL schema. The agent dynamically loads targeted product/skill context for token-efficient reasoning, while the SaaS workspace handles Cloudinary asset hosting, landing page generation, lead capture, and performance analytics.

Outcome

A complete AI-first marketing workspace that transforms abstract AI strategies into multi-channel campaigns, live landing pages, gated lead magnets, and real-time conversion analytics.

Architecture

Hover or tap a component to see what it does.

Marketing OS: Campaigns, content, assets, landing pages, leads — and the editor for product playbooks the agent reads.

Key decisions

Dynamic context instead of one big prompt?

Each turn loads only the relevant product playbook and skill — fewer tokens, sharper answers.

Playbooks in Postgres, not files?

Edit a playbook in Marketing OS and the agent uses it on the very next message — no redeploy.

Why four LLM providers?

No lock-in. If a model's provider isn't configured, the request falls back to another instead of failing.

How do the two apps share login?

Marketing OS signs a 60-second, single-use token. Each token ID is recorded, so a replayed link is rejected.

Results

  • Strategy chat and campaign execution in one suite
  • 30 marketing skills, loaded only when needed
  • Live landing pages and gated lead capture
  • 4 LLM providers with automatic fallback
Read the detailed study

Overview

Lumen is an end-to-end AI Marketing Operating System made of two integrated Next.js applications: Lumen AI Agent, a conversational marketing copilot, and Marketing OS, a production SaaS workspace.

Marketing OS provides campaign management, an AI Content Studio (11+ content types), a Cloudinary asset manager, a live landing page builder (/p/[slug]), gated lead magnets (/m/[slug]) with verified email capture and CRM lead tracking, and an editor for the product playbooks that ground the agent.

The problem

AI chat tools are good at marketing strategy but disconnected from where campaigns actually run. Plans stay in chat, while assets, pages and leads live in other tools. Pasting full brand and product context into every prompt also bloats the context window and dilutes answers.

The dynamic context engine

Instead of one giant system prompt, a heuristic detector reads the chat history backwards — newest message first — looking for product and skill keywords. It stops at the first match, then loads that product's playbook files and the matching SKILL.md (from 30 skills such as SEO, ads, competitor analysis and product research).

The system prompt is assembled from a base persona plus just those files. Playbooks and skills are stored as rows in a Postgres markdown_files table, with product keys validated and file counts capped, so each turn carries only the context it needs.

Generative UI

When the agent needs structured input, it wraps a JSON question set in <mcq> tags. The frontend hides the raw text and renders an interactive <InteractiveMcq> form (radio buttons, text inputs) inside the streamed answer. Submitting it writes the answers back as the user's next message, so the conversation continues naturally.

Multi-LLM routing

Users pick a model in the UI. The router maps it to DeepSeek, OpenAI, Anthropic Claude or Google Gemini. If the chosen provider has no API key configured, it falls back through the available providers in order rather than failing the request.

Web research on free providers

The only paid AI dependency is the LLM itself; search and reading use free services. Search runs SearXNG and DuckDuckGo Instant Answer in parallel, uses DuckDuckGo Lite only if fewer than five results come back, and Wikipedia only when everything else returns nothing. Results are normalized, de-duplicated and stripped of tracking parameters.

Page reading uses Jina Reader with a local Readability + Turndown fallback and a circuit breaker for outages. Every outbound request goes through one safe-fetch layer: SSRF checks, DNS validation and pinning, per-hop redirect validation, timeouts and response-size limits. Site crawls respect robots.txt and stay same-origin.

How the two apps connect

Marketing OS owns users, workspaces and the playbook editor. When a playbook is created or updated there — including from an uploaded document — it is written to the markdown_files table, and the agent picks it up on the next message.

Sign-in carries across with single sign-on: Marketing OS issues a signed JWT that expires in 60 seconds, and every token ID is recorded when used so the same link can't be replayed. The agent can also accept logins from accounts created in Marketing OS by reading its user table over a separate, optional connection.

Explore More Projects & Systems

All Projects →

01 / Marketplace

Briz Market — Local Shopping Marketplace for Nepal

Built the web version of Briz (brizmarket.com), a local marketplace already live as an iOS and Android app, where shoppers in Nepal find products and stores nearby and get offers from local sellers. Phase 1 of the web app launched on 9 October 2026; it will grow into the full product in phases.

02 / AI Security

Agent Monitor — Local Security Boundary for AI Agents & MCP

Architected a local-first security firewall and real-time activity monitor for autonomous AI agents and MCP tools, enforcing deterministic policy gating, capability sandboxing, and real-time execution telemetry.

03 / Full Stack

Tracky — Multi-Tenant Issue Management System

Architected a multi-tenant issue and bug management platform with eight role-based dashboards, JWT auth with rotating refresh tokens, real-time WebSocket notifications, and a partner API for external integrations.