title: MCP-PostgreSQL disconnect fix

insight: Rewrote vault_loader.py to read from PostgreSQL instead of JSON files, fixing the critical disconnect where API wrote to PostgreSQL but MCP read from JSON files

reasoning_chain: Problem identified: Sunaiva Memory MCP couldn't see user-uploaded data

reasoning_chain: Root cause: API server writes to PostgreSQL via database.py, but MCP server reads from JSON files via vault_loader.py

reasoning_chain: Solution: Complete rewrite of vault_loader.py (736 lines) to query PostgreSQL first, with JSON fallback

reasoning_chain: Key changes: PostgreSQL connection pool, queries 5 tables (vaults, users, entities, decisions, preferences, conversations)

reasoning_chain: Added entity description synthesis (DB stores context array, MCP expects description string)

reasoning_chain: Added decision topic mapping (DB stores context, MCP filters by topic)

reasoning_chain: Write operations now insert directly into PostgreSQL

reasoning_chain: Graceful degradation: PG first, JSON fallback if DB unreachable

reasoning_chain: Zero changes to server.py - same public interface, drop-in replacement

source_context: vault_loader.py has been completely rewritten (736 lines). Before: API writes to PostgreSQL, MCP reads from JSON files. Completely disconnected.


title: Genesis Constitution ratified as supreme law

insight: Consolidated all operational directives from MEMORY.md, CLAUDE.md, and GLOBAL_GENESIS_RULES.md into a single 598-line constitutional document with legal-style articles

reasoning_chain: Multiple directive documents created fragmentation and potential conflicts

reasoning_chain: Need for single source of truth that all agents can inherit

reasoning_chain: Created 10-article structure with Preamble, Schedules, and Oath of Compliance

reasoning_chain: Articles lock in: Three Prime Directives, Genesis as Driver, Resource Maximization, Verification Protocol, Operational Mandates, Autonomous Operation, Agent Hierarchy, Revenue Imperative, Amendment Process, Exceptional Planning

reasoning_chain: Declares supremacy over all other operational documents

reasoning_chain: Every future agent, session, and generation inherits it

source_context: This is now the supreme law of Genesis. Every directive from MEMORY.md, CLAUDE.md, and GLOBAL_GENESIS_RULES.md consolidated into one authoritative document.


title: Patent portfolio deadline and Triple Gate architecture

insight: Discovered 9 active provisional patents with Triple Gate architecture (Authentication/Validation/Execution), all expiring June 2-3, 2026 - minimum $3,510 needed to extend protection

reasoning_chain: Agent a484464 completed comprehensive patent inventory

reasoning_chain: Found 9 active provisional patents (P1-P9) focused on AI validation technology

reasoning_chain: Patents form Triple Gate architecture: Gate 1 (Authentication): P1, P4, P8; Gate 2 (Validation): P5, P6, P3, P7; Gate 3 (Execution): P2, P9

reasoning_chain: Critical deadline: provisionals expire June 2-3, 2026 (~3.5 months)

reasoning_chain: Cost to extend: $3,510 self-filed new provisionals, $135K-$150K full non-provisional conversion

reasoning_chain: Product mapping: ReceptionistAI (P1,P4,P7,P3), Sunaiva Memory (P1,P8,P2,P7), Talking Widget (P1,P7,P6), AIVA (ALL 9)

reasoning_chain: Strategic realization: IP worth more than all products combined

source_context: Provisionals expire June 2-3, 2026. That is approximately 3.5 months away. The $3,510 self-filing by April 2026 is the MINIMUM to protect this portfolio. This IP is worth more than every product we're building combined.


title: Frontend API URL bug identification and fix

insight: Fixed onboarding.html to properly detect development environment by checking both localhost and 127.0.0.1, and corrected port from 8081 to 8080

reasoning_chain: Problem: onboarding.html had inconsistent API_BASE detection compared to other frontend files

reasoning_chain: Root cause 1: Only checked 'localhost', missing '127.0.0.1' check present in dashboard.html and admin.html

reasoning_chain: Root cause 2: Used port 8081 for localhost instead of 8080 (inconsistent with other files)

reasoning_chain: Solution: Added 127.0.0.1 check, changed port from 8081 to 8080

reasoning_chain: Production URL https://api.sunaivadigital.com was already correct

reasoning_chain: All frontend files now consistently resolve to production API in live environment

source_context: The fix makes the localhost detection and port consistent with the other files. All frontend files now consistently resolve to https://api.sunaivadigital.com in production and http://localhost:8080 during local development.


title: Agency lead generation for Instantly.ai

insight: Generated 38 agency leads formatted for Instantly.ai with 5-email sequence, but flagged all leads as info@ addresses with lower expected response rates

reasoning_chain: Task: Format leads for Instantly.ai import

reasoning_chain: Created CSV with 38 leads: 18 web design, 11 digital marketing, 4 SEO, 3 consulting, 2 CRM

reasoning_chain: Created 5-email sequence across 21 days with A/B subject variants

reasoning_chain: Commission structure: 20-33% recurring lifetime

reasoning_chain: Pricing: Essentials $197/mo, Business $397/mo, Growth $597/mo

reasoning_chain: Critical warning: All 38 are info@ addresses (no personal names)

reasoning_chain: Identified response rate will be lower than named contacts

reasoning_chain: Recommended: LinkedIn enrichment pass would significantly boost conversion

reasoning_chain: Two placeholders need replacing: {{BOOKING_LINK}} and demo URL

source_context: Warning: All 38 are info@ addresses (no personal names). Response rate will be lower than named contacts. A LinkedIn enrichment pass would boost conversion significantly.


type: DIRECTIVE

title: Jules Protocol hardwired into MEMORY.md

insight: Jules (AI coding agent) protocol has been hardwired as mandatory operational procedure - 50+ tasks/day target, 200+ agent floor, Jules Pro utilization mandate

reasoning_chain: Need to formalize Jules as primary coding agent in Genesis operations

reasoning_chain: Jules Protocol added to MEMORY.md as hardwired rule

reasoning_chain: Resource Maximization Protocol established: Jules 50+ tasks/day, 200+ agents minimum

reasoning_chain: Cost hierarchy established: Jules > Claude > OpenRouter > Gemini > Instantly > GHL

source_context: Resource Maximization -- Jules 50+ tasks/day, 200+ agents, max Gemini/Instantly/GHL


title: 15 deployment blockers and P0 items identified

insight: Generated comprehensive task batch with 5 P0 deploy blockers (including security issues and data integrity) and P1 ship-quality items

reasoning_chain: Audit of system identified critical deployment issues

reasoning_chain: P0 Blockers (submit FIRST): MCP vault_loader PostgreSQL rewrite, connection pooling for Widget backend, onboarding state to PostgreSQL, remove hardcoded credentials, add .env.production to .gitignore

reasoning_chain: P1 Ship-quality: Unit tests for auth/billing/rate_limiter (zero tests for 7,800 lines), wire up overage cron (revenue feature silently does nothing), Redis-backed rate limiter, fix broken E2E tests for Memory MCP

reasoning_chain: P2 Post-launch: Email verification + password reset, tests for widgets/leads/metering

reasoning_chain: Each task has exact file paths, line numbers, and acceptance criteria

reasoning_chain: Jules can run all 15 concurrently (15 concurrent slots)

source_context: P0 (Deploy Blockers) -- submit these FIRST: MCP vault_loader PostgreSQL rewrite (data integrity), Connection pooling for Widget backend (will crash under traffic), Onboarding state to PostgreSQL (breaks in Docker), Remove hardcoded credentials from pipeline.py (security), Add .env.production to .gitignore (live Stripe keys exposed)


title: AIVA IS the patents embodied

insight: Realized that AIVA (Queen AI) is the physical embodiment of all 9 patents - the Triple Gate architecture is not just IP but operational reality

reasoning_chain: Patent portfolio describes Triple Gate validation architecture

reasoning_chain: AIVA (Queen) is the orchestrator of all Genesis agents

reasoning_chain: AIVA implements: cryptographic validation (P1), multi-model consensus (P5), dynamic confidence scoring (P6), hallucination detection (P7), adaptive thresholds (P9)

reasoning_chain: The patents are not just defensive IP but describe the actual system architecture

reasoning_chain: This makes the IP both defensible AND operational - unique strategic advantage

reasoning_chain: Enterprise licensing opportunity: license complete validation framework to OpenAI, Anthropic, Google

source_context: AIVA (Queen): ALL 9 -- she IS the patents embodied


title: Revenue imperative acknowledged

insight: Genesis Constitution Article 8 explicitly acknowledges $385/mo burn with $0 revenue, mandates stop building start selling

reasoning_chain: Financial reality acknowledged: $385/month burn rate

reasoning_chain: Builder's Trap acknowledged - building without selling

reasoning_chain: Strategic shift: stop building, start selling

source_context: Revenue Imperative -- $385/mo burn, $0 revenue, stop building start selling


type: METAPHOR

title: Belt and suspenders approach

insight: Described parallel agent work on MCP-PostgreSQL fix as 'belt and suspenders' - both agent a79718c and Jules working on same problem for verification

reasoning_chain: Agent a79718c already fixing MCP-PostgreSQL disconnect

reasoning_chain: Metaphor: belt and suspenders - redundant safety measure

reasoning_chain: Philosophy: verification through parallel workstreams

reasoning_chain: Ensures solution is robust before deployment

source_context: Note: Agent a79718c is ALSO fixing the MCP-PostgreSQL disconnect (#1 on that list) in parallel -- so Jules can verify/test what our agent builds, or tackle it independently. Belt and suspenders.