Want this reviewed by our architects? Book a free 30-minute call. We'll pressure-test the plan and give you a fixed-scope proposal.
`;
const blocks = $$('.plan-block', out);
for (const b of blocks) { b.classList.add('in'); await sleep(170); }
$$('.phase .bar span', out).forEach((s) => { s.style.width = Math.min(100, +s.dataset.w) + '%'; });
$('#planBook').addEventListener('click', () => {
window.CC && window.CC.goContact({
need: plan.need,
msg: `${text}\n\n— AI Scoper draft: ${plan.title}, ~${plan.total} weeks (${plan.complexity}). Stage: ${$('#scoperStage').selectedOptions[0].text}. Timeline: ${$('#scoperUrgency').selectedOptions[0].text}.`
});
});
busy = false; go.disabled = false;
});
}
/* ================= CHAT ASSISTANT ================= */
const chat = $('#chat');
if (!chat) return;
const fab = $('#chatFab'), body = $('#chatBody'), form = $('#chatForm'), field = $('#chatText'), teaser = $('#chatTeaser'), suggest = $('#chatSuggest');
const history = [];
let greeted = false;
const CTA = (label = 'Book a free call', kind = 'contact') => ` ${label} →`;
const INTENTS = [
{ re: /\b(hi|hello|hey|yo|namaste|good (morning|evening|afternoon))\b/, a: () => `Hi! 👋 I'm the Cartesian assistant. I can tell you what we build, who's on the team, how engagements work, or scope your project right now. What are you working on?` },
{ re: /(price|pricing|cost|budget|rate|quote|how much|expensive|cheap)/, a: () => `Pricing depends on scope. We work three ways: • Fixed-scope projects for well-defined builds • Dedicated pod: an architect plus 2–4 engineers, billed monthly • Advisory: architecture reviews and AI strategy sprints Most projects start with a free 30-min call, and we send a fixed proposal within 48 hours.${CTA('Get a proposal')}` },
{ re: /(founder|who are (you|u)|your team|the team\b|team members|who.*(work|build)s? (on|with))/, a: () => `Our founding team: ${team().map((m) => `• ${m.name}, ${m.role}`).join(' ')} You work directly with senior people, not a bench of juniors.${CTA('Meet us on a call')}` },
{ re: /(agent|llm|gpt|claude|rag|chatbot|genai|copilot|ai\b|artificial)/, a: () => `AI agents are our specialty. We build agents that call your real tools (CRM, ERP, ticketing, databases), use retrieval over your documents, and ship with evals, guardrails and human approval steps. Typical first agent: 6–10 weeks to production.${CTA('Scope my AI agent', 'scope')}`, scope: true },
{ re: /(data|lake|warehouse|pipeline|etl|analytics|spark|kafka|databricks|snowflake)/, a: () => `Gautham leads our data practice: lakehouses, streaming pipelines with Kafka and Spark, dbt models and governed data products. We design pipelines that move analytics from nightly batches to near real time.${CTA('Talk to our data architect')}` },
{ re: /(legacy|monolith|migrat|moderni|mainframe|on-prem)/, a: () => `We modernize step by step with a strangler-fig approach: new services carve out the old system piece by piece, with zero-downtime cutovers. No big-bang rewrites.${CTA('Plan my migration')}` },
{ re: /(cloud|devops|kubernetes|k8s|aws|azure|gcp|terraform|ci\/?cd|infra)/, a: () => `We build cloud foundations on AWS, Azure and GCP: Terraform, Kubernetes, GitOps and observability. Every engagement includes a FinOps review of idle and oversized resources.${CTA()}` },
{ re: /(app|website|web|mobile|saas|mvp|product|startup)/, a: () => `We take products from idea to launch: discovery, UX, React / React Native front ends, robust APIs, billing and analytics. A typical MVP takes 10–14 weeks.${CTA('Scope my product', 'scope')}`, scope: true },
{ re: /(time|timeline|how long|weeks|fast|deadline|quick)/, a: () => `Rough guide: discovery 1–2 weeks, architecture 1–2 weeks, build 4–12 weeks, launch 2 weeks. Try our AI Project Scoper for an estimate tailored to your idea.${CTA('Open the Scoper', 'scope')}`, scopeLink: true },
{ re: /(process|how do you work|approach|method|agile|sprint)/, a: () => `Four steps: Discover → Architect → Build → Scale. Two-week sprints with live demos, full transparency in your Slack or Teams, and code you own from day one.${CTA()}` },
{ re: /(portfolio|work|case stud|project|client|example)/, a: () => `Our Work page has reference solutions with product walkthrough videos: an AI support agent, a real-time logistics lakehouse, a core banking modernization and more. On a call we can walk you through comparable client work under NDA.${CTA('Discuss a similar project')}` },
{ re: /(contact|email|call|meet|book|talk|reach|hire|start)/, a: () => `Let's talk! Email hello@cartesiancorp.com or send your details through our contact page. We reply within one business day.${CTA('Go to contact form')}` },
{ re: /(where|location|india|usa|remote|timezone|office)/, a: () => `We're a remote-first team and work across time zones with overlap hours for the US, UK, EU and India.${CTA()}` },
{ re: /(nda|security|secure|compliance|ip|own the code|confidential)/, a: () => `We sign NDAs before any detailed discussion. You own 100% of the code and IP, and we follow secure SDLC practices: least-privilege access, secrets management, and PII-safe AI pipelines.${CTA()}` }
];
function localAnswer(q) {
const t = q.toLowerCase();
for (const it of INTENTS) if (it.re.test(t)) return it.a();
if (q.split(/\s+/).length > 6) {
const p = buildPlan(q, 'normal', 'idea');
return `That sounds like a ${p.title.toLowerCase()}. My first-pass estimate is ~${p.total} weeks, led by ${p.team.slice(0, 2).map((i) => (member(i) || {}).name).join(' and ')}. Want our architects to turn this into a fixed proposal?${CTA('Yes, book a free call')}`;
}
return `Good question. The fastest way to a precise answer is a short call with one of our architects. Meanwhile I can tell you about our services, team, pricing or timelines.${CTA()}`;
}
const saved = store.get('cc_chat') || [];
function persist() { store.set('cc_chat', $$('.msg:not(.typing)', body).slice(-30).map((el) => ({ who: el.classList.contains('user') ? 'user' : 'bot', html: el.innerHTML }))); store.set('cc_hist', history.slice(-20)); }
function addMsg(html, who = 'bot') {
const m = document.createElement('div');
m.className = 'msg ' + who;
m.innerHTML = html;
body.appendChild(m);
body.scrollTop = body.scrollHeight;
$$('[data-cta]', m).forEach((a) => a.addEventListener('click', (e) => {
e.preventDefault();
const last = history.filter((h) => h.role === 'user').pop();
if (a.dataset.cta === 'scope') {
if (last && last.content.split(/\s+/).length > 4) store.set('cc_scoper', last.content);
const box = $('#scoperText');
if (box) { chat.classList.remove('open'); if (last) box.value = last.content; box.focus(); return; }
location.href = base + 'ai-scoper.html';
} else {
const transcript = history.filter((h) => h.role === 'user').map((h) => '- ' + h.content).join('\n');
chat.classList.remove('open');
window.CC && window.CC.goContact({ msg: transcript ? 'From my chat with the Cartesian assistant:\n' + transcript : '' });
}
}));
return m;
}
async function reply(q) {
history.push({ role: 'user', content: q });
addMsg(esc(q), 'user');
const typing = addMsg('', 'bot typing');
const [remoteText] = await Promise.all([remote({ mode: 'chat', messages: history }), sleep(650 + Math.random() * 500)]);
typing.remove();
const html = remoteText ? esc(remoteText).replace(/\n/g, ' ') + CTA() : localAnswer(q);
history.push({ role: 'assistant', content: html.replace(/<[^>]+>/g, ' ') });
addMsg(html);
renderSuggestions();
persist();
}
const SUGGESTIONS = ['What do you build?', 'Can you build an AI agent for us?', 'How much does a project cost?', 'Who is on the team?', 'How long does an MVP take?', 'Do you sign NDAs?'];
function renderSuggestions() {
const asked = new Set(history.filter((h) => h.role === 'user').map((h) => h.content));
suggest.innerHTML = '';
SUGGESTIONS.filter((s) => !asked.has(s)).slice(0, 4).forEach((s) => {
const b = document.createElement('button'); b.type = 'button'; b.textContent = s;
b.addEventListener('click', () => reply(s));
suggest.appendChild(b);
});
}
INTENTS.unshift({ re: /what do you (build|do)|services|offer/, a: () => `We're senior developers and architects who build: • AI agents & LLM apps • Enterprise architecture & modernization • Data platforms & pipelines • Cloud & DevOps • Web & mobile products Tell me what you're working on and I'll suggest an approach.` });
if (saved.length) {
greeted = true;
history.push(...(store.get('cc_hist') || []));
saved.forEach((m) => addMsg(m.html, m.who));
renderSuggestions();
}
function openChat() {
chat.classList.add('open', 'seen');
fab.setAttribute('aria-expanded', 'true');
store.set('cc_seen', true);
teaser.classList.remove('show');
fab.setAttribute('aria-label', 'Close assistant');
if (!greeted) {
greeted = true;
addMsg(`Hi, I'm Ask Cartesian ✦ I can answer questions about our services, team and pricing, or give you an instant project estimate. What are you building?`);
renderSuggestions();
persist();
}
setTimeout(() => field.focus(), 300);
}
fab.addEventListener('click', () => chat.classList.contains('open') ? (chat.classList.remove('open'), fab.setAttribute('aria-expanded', 'false'), fab.setAttribute('aria-label', 'Open Cartesian AI assistant')) : openChat());
if (store.get('cc_seen')) chat.classList.add('seen');
teaser.addEventListener('click', openChat);
form.addEventListener('submit', (e) => { e.preventDefault(); const q = field.value.trim(); if (!q) return; field.value = ''; reply(q); });
// proactive nudges (once per session)
if (!store.get('cc_nudged')) {
setTimeout(() => {
if (chat.classList.contains('open') || store.get('cc_nudged')) return;
store.set('cc_nudged', true);
teaser.classList.add('show');
setTimeout(() => teaser.classList.remove('show'), 12000);
}, 20000);
}
const workSec = $('.work-grid');
if (workSec && !store.get('cc_nudged')) {
new IntersectionObserver(([e], obs) => {
if (!e.isIntersecting) return;
obs.disconnect();
setTimeout(() => {
if (chat.classList.contains('open') || greeted) return;
if (store.get('cc_nudged')) return;
store.set('cc_nudged', true);
teaser.textContent = 'Like what you see? Get a free estimate for your project.';
teaser.classList.add('show');
setTimeout(() => teaser.classList.remove('show'), 9000);
}, 4000);
}, { threshold: .25 }).observe(workSec);
}
})();