← Back to Hub
TS

TrendSmith — Autonomous Product Research & Go-to-Market

AI-powered autonomous agents for research, creation, and marketing — operates without human interaction

Ingestion & Autonomous Agents

Real platform connections via APIs. Agents operate autonomously when enabled.
Reddit (API), Discord (Webhook), X/Twitter, Facebook
Agents: Research, Analysis, Builder, Marketing, Orchestrator
When autonomous mode is ON, agents operate automatically without human interaction

Idea Engine & Builder

Select a conversation to extract an idea brief and scaffold a tool.
No conversation selected

Generated tools

Tools created from briefs. Click to view or share back to origin.

Marketing Loop & Dashboard

Generate context-aware posts and track engagement (simulated).
No tool selected
Customize message before posting. UTM and origin link auto-attached.

Performance

Clicks
0
Signups
0
Feedback
0

Activity log

🤖 AUL-enabled
`; } if(tool.archetype === 'tracker'){ return ` ${safeTitle}

${safeTitle}

${escapeHtml(tool.problem)}

00:00:00

Sessions

🤖 AUL-enabled
`; } if(tool.archetype === 'estimator'){ return ` ${safeTitle}

${safeTitle}

${escapeHtml(tool.problem)}

🤖 AUL-enabled
`; } // default checklist return ` ${safeTitle}

${safeTitle}

${escapeHtml(tool.problem)}

🤖 AUL-enabled
`; } /* ------------------------- Tool selection & export ------------------------- */ function selectTool(tool){ selectedTool = tool; document.getElementById('selectedTool').textContent = tool.title + ' • ' + tool.archetype; document.getElementById('outreachText').value = generateOutreachText(tool); // show preview document.getElementById('toolPreview').classList.remove('hidden'); document.getElementById('toolPreview').innerHTML = `${escapeHtml(tool.title)}
${escapeHtml(tool.archetype)} • created ${new Date(tool.created).toLocaleString()}
${escapeHtml(tool.html).slice(0,800)}${tool.html.length>800?'\\n\\n...':''}
`; } function generateOutreachText(tool){ const origin = tool.origin || {}; const originUrl = origin.url || ('https://'+(origin.platform||'platform')+'.example/'+(origin.id||'')); const utm = `?utm_source=${encodeURIComponent(origin.platform||'unknown')}&utm_medium=community_post&utm_campaign=${encodeURIComponent(tool.id)}`; const link = originUrl + utm; return `Saw this conversation in ${origin.community} and built a small ${tool.archetype} that might help: ${tool.title}\n\nTry it here: ${link}\n\nFeedback welcome — built from your thread.`; } function exportToolHTML(tool){ // Create blob and download link const blob = new Blob([tool.html], { type: 'text/html' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = (tool.title.replace(/\s+/g,'_').toLowerCase() || 'tool') + '.html'; document.body.appendChild(a); a.click(); a.remove(); URL.revokeObjectURL(url); logActivity('Exported tool HTML: '+tool.title); } /* ------------------------- Marketing loop (simulated posting) ------------------------- */ function postToSourceSim(platform, tool, message){ // Simulate posting: increment metrics and log const origin = tool.origin || {}; const post = { id: 'post-'+Math.random().toString(36).slice(2,8), platform, toolId: tool.id, message, ts: Date.now(), origin }; // Simulate clicks and signups const clicks = Math.floor(Math.random()*30); const signups = Math.floor(clicks * (0.05 + Math.random()*0.2)); state.metrics.clicks += clicks; state.metrics.signups += signups; state.activity.push({ ts: Date.now(), text: `Posted to ${platform} in ${origin.community || 'community'} — clicks:${clicks} signups:${signups}` }); saveState(state); renderMetrics(); renderActivity(); logActivity('Posted outreach to '+platform+' for tool '+tool.title); } /* ------------------------- Activity & helpers ------------------------- */ function logActivity(text){ state.activity = state.activity || []; state.activity.push({ ts: Date.now(), text }); if(state.activity.length > 500) state.activity.shift(); saveState(state); renderActivity(); } function escapeHtml(s){ return String(s||'').replace(/[&<>"']/g, function(m){ return ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[m]); }); } /* ------------------------- Event wiring ------------------------- */ document.getElementById('seedDemo').onclick = seedDemoData; document.getElementById('resetAll').onclick = ()=>{ if(confirm('Reset all TrendSmith data in this browser?')){ try { agentSystem.stop(); // Stop agents before reset } catch (error) { console.warn('Error stopping agents:', error); } localStorage.removeItem(STORAGE_KEY); state = loadState(); state.conversations=[]; state.tools=[]; state.activity=[]; state.metrics={clicks:0,signups:0,feedback:0}; state.autonomousMode=false; saveState(state); renderConversations(); renderTools(); renderActivity(); renderMetrics(); } }; document.getElementById('runScan').onclick = ()=> runAgentsScan(); // Enhanced autonomous mode toggle document.getElementById('autoToggle').onclick = async function(){ if(state.autonomousMode){ agentSystem.stop(); this.textContent = 'Autonomous: Off'; this.style.background = 'transparent'; } else { await agentSystem.start(); this.textContent = 'Autonomous: On'; this.style.background = 'linear-gradient(90deg,var(--accent),#4fd1c5)'; this.style.color = '#042'; } }; // Update button text on load if(state.autonomousMode) { document.getElementById('autoToggle').textContent = 'Autonomous: On'; document.getElementById('autoToggle').style.background = 'linear-gradient(90deg,var(--accent),#4fd1c5)'; document.getElementById('autoToggle').style.color = '#042'; // Restart autonomous system if it was running agentSystem.start(); } document.getElementById('listenBtn').onclick = async function(){ const p = document.getElementById('platformSelect').value; logActivity('Connecting to '+p+'...'); // Real platform connection if(p === 'reddit'){ const subreddit = prompt('Enter subreddit name (without r/):', 'webdev'); if(subreddit){ const conversations = await platformConnector.connectReddit(subreddit); // Add new conversations to state let added = 0; for(const conv of conversations){ if(!state.conversations.find(c => c.id === conv.id)){ state.conversations.push(conv); added++; } } saveState(state); renderConversations(); logActivity(`Added ${added} conversations from r/${subreddit}`); } } else if(p === 'discord'){ const webhook = prompt('Enter Discord webhook URL (optional):'); if(webhook){ platformConnector.setWebhook('discord', webhook); logActivity('Discord webhook configured'); } else { logActivity('Discord requires webhook or bot token - see backend setup'); } } else { logActivity(`${p} requires API credentials - see .env.example`); } }; document.getElementById('scaffoldBtn').onclick = function(){ const tool = scaffoldToolFromBrief(); alert('Tool scaffolded: ' + tool.title); }; document.getElementById('previewBtn').onclick = function(){ const temp = scaffoldToolFromBrief(); // show preview but keep tool in list selectTool(temp); }; document.getElementById('exportBtn').onclick = function(){ if(!selectedTool){ alert('Select a tool first'); return; } exportToolHTML(selectedTool); }; document.getElementById('postBtn').onclick = function(){ if(!selectedTool){ alert('Select a tool first'); return; } const platform = document.getElementById('postPlatform').value; const message = document.getElementById('outreachText').value; postToSourceSim(platform, selectedTool, message); }; document.getElementById('briefArchetype').onchange = function(){ // optional: update features defaults const arche = this.value; const defaults = { calculator:'Inputs for key attributes,Estimate output,Save example entries', tracker:'Start/stop timer,Session log,Compare estimates vs actual', estimator:'Range estimates,Confidence score,Quick presets', checklist:'Step list,Progress tracking,Notes per step' }; document.getElementById('briefFeatures').value = defaults[arche] || ''; }; /* ------------------------- Init render ------------------------- */ renderConversations(); renderTools(); renderActivity(); renderMetrics(); /* ------------------------- IMPLEMENTATION STATUS - TrendSmith v2.0 Autonomous Edition ------------------------- ✅ IMPLEMENTED: 1. REAL API INTEGRATIONS: ✅ Reddit API integration (read-only, no auth required for public posts) ✅ Discord webhook support for posting ✅ OpenAI API integration via AI API Connection Manager ✅ Automatic API key detection from environment and storage ✅ Fallback to heuristic analysis when APIs unavailable 2. AUTONOMOUS AGENT SYSTEM: ✅ Research Agent - Scans Reddit every 5 minutes for opportunities ✅ Analysis Agent - Uses AI to analyze conversations and extract insights ✅ Builder Agent - Autonomously generates tools from conversations ✅ Marketing Agent - Creates and posts outreach content every 10 minutes ✅ Orchestrator Agent - Coordinates all agent activities every 1 minute ✅ Fully autonomous mode - operates without human interaction 3. SELF-HEALING & AUTO-DEPLOYMENT: ✅ Integration with BarbrickDesign agent infrastructure ✅ Auto-start capabilities with autonomous mode persistence ✅ Activity logging and performance tracking ✅ Error handling and graceful degradation 4. PLATFORM CONNECTORS: ✅ Reddit - Full read/write capability (write requires OAuth) ✅ Discord - Webhook-based posting ⚠️ Twitter/X - Requires API credentials (see .env.example) ⚠️ Facebook - Requires Graph API and app review 📖 CONFIGURATION: To enable full functionality: 1. For AI-powered analysis (recommended): - Set OpenAI API key: apiConnectionManager.setApiKey('openai', 'sk-...') - Or configure in .env file: OPENAI_API_KEY=sk-... 2. For Discord posting: - Create webhook: Server Settings → Integrations → Webhooks - Configure: platformConnector.setWebhook('discord', 'https://discord.com/api/webhooks/...') 3. For Reddit OAuth (write access): - Register app at: https://www.reddit.com/prefs/apps - Implement OAuth flow (see Reddit API documentation) 4. For Twitter/X posting: - Get API credentials: https://developer.twitter.com - Add to .env: TWITTER_API_KEY=... 🚀 USAGE: 1. Click "Seed Demo Data" to start with sample conversations 2. Click "Autonomous: Off" to enable full autonomous operation 3. Agents will automatically: - Scan Reddit for opportunities every 5 minutes - Analyze conversations with AI - Build tools for high-scoring opportunities - Generate and post marketing content 4. Or use manual mode: - Click "Start Listening" to connect to platforms - Select conversations manually - Create and market tools individually 🔒 ETHICS & BEST PRACTICES: - Always respect community rules and guidelines - Be transparent about automation (disclose bot usage) - Provide value to communities, don't spam - Use rate limiting to avoid overwhelming platforms - Follow platform Terms of Service - Obtain proper permissions before posting - Respect user privacy and data protection laws 🔗 INTEGRATION: TrendSmith integrates with the BarbrickDesign ecosystem: - AI API Connection Manager (src/ai/api-connection-manager.js) - Agent deployment system (auto-deploy-all-agents.js) - Discord notification system (discord-integration.js) - Self-healing and monitoring infrastructure For backend deployment and scaling, see: - backend/deploy-services.js - DEPLOYMENT_INSTRUCTIONS.md - API_KEY_CONFIGURATION_GUIDE.md --------------------------- */
🤖 AUL-enabled