# Application State

**Last Updated:** April 15, 2026
**Version:** 1.10.0

---

## Admin User

- Admin user email: `admin@fourayam.com`


## Current Status: ONLINE (Dev)

Service is running on port 3011 via PM2 (app name: `kstych`). Nginx/DNS for kaissa.ksty.ch can be re-enabled as needed.

### Restore Instructions
If full infra restore is needed (nginx/site configs), run: `bash /root/projects/kstych/scripts/restore.sh` and re-enable the nginx site.

### What Was Shut Down
- PM2 process `kstych` (port 3011) -- stopped and deleted
- Docker container `openclaw-public` (port 20001) -- composed down
- Systemd timer `job-scraper.timer` -- disabled
- Nginx config `kaissa.ksty.ch` -- removed
- Redis `chat:*` keys -- flushed

### Backups Saved (in `backup/`)
- `redis-chat-keys.txt` -- all 15 FAQ cache entries
- `candidates/` -- openclaw candidate profiles
- `credentials/` -- WhatsApp session data
- `nginx-kaissa.ksty.ch.conf` -- nginx site config
- `job-scraper.service` + `job-scraper.timer` -- systemd configs

## Infrastructure Status

### Deployment
- **Environment**: Production
- **Domain**: https://kaissa.ksty.ch
- **Port**: 3011
- **Process Manager**: PM2 (kstych)
- **Status**: Online

### Dependencies
- **Express.js**: Web framework
- **Helmet**: Security headers
- **CORS**: Cross-origin resource sharing
- **Morgan**: HTTP request logging
- **Compression**: Response compression

### Security
- **Cloudflare Turnstile**: Human verification required on page load
- **Mode**: Managed (shows challenge when suspicious activity detected)

### Features
- **Video Gallery**: 25 videos in responsive grid layout
- **Desktop**: 3-column grid, hover to auto-play (muted)
- **Tablet**: 2-column grid
- **Mobile**: 1-column grid, auto-play on scroll into view
- **WhatsApp Redirect**: Click video → opens WhatsApp chat with Nova (+12086460727)
- **Background**: Scroll-synced video background
- **AI Chat**: Ollama-powered chatbot for proposal Q&A
- **FAQ Mode**: 15 pre-defined questions about the proposal
- **Toggle**: Switch between Chat and FAQ modes
- **Redis Cache**: All FAQ responses cached (30 days TTL, ~100ms response)
- **Quick Replies**: 3 dynamic follow-up suggestions per response
- **Chat Icon**: Top-right position (desktop + mobile), default purple SVG

## SEO & Discoverability

### Assets
- **Favicon**: SVG, ICO, PNG (192x192, 512x512)
- **OG Image**: 1200x630 PNG for social sharing
- **Sitemap**: XML sitemap for search engines
- **robots.txt**: Crawler instructions
- **llm.txt**: AI/LLM context information

### Meta Tags
- Open Graph (Facebook)
- Twitter Cards
- Structured Data (JSON-LD)
- Canonical URL

## API Endpoints

| Method | Path | Description |
|--------|------|-------------|
| GET | `/` | Video gallery (with verification gate) |
| POST | `/api/chat` | Ollama AI chat endpoint |
| GET | `/health` | Health check |
| GET | `/api/status` | Service status |
| GET | `/api/geo` | Country detection (Cloudflare headers) |
| POST | `/api/verify-turnstile` | Turnstile token verification |
| GET | `/assets/background.mp4` | Background video |
| GET | `/assets/gallery/*.mp4` | Gallery videos (25 files) |
| GET | `/assets/proposal.pdf` | InnovationsGlobal proposal PDF |
| GET | `/favicon.svg` | SVG favicon |
| GET | `/og-image.png` | Open Graph image |
| GET | `/robots.txt` | Robots file |
| GET | `/sitemap.xml` | XML sitemap |
| GET | `/llm.txt` | LLM context file |
| GET | `/state.md` | This document |
| GET | `/specs.md` | Technical specifications |

## File Structure

```
/root/projects/kstych/
├── src/
│   └── server.js              # Main Express server
├── public/
│   ├── index.html             # Video gallery page
│   ├── favicon.svg            # Vector favicon
│   ├── favicon.ico            # Legacy favicon
│   ├── favicon-192.png        # PWA icon
│   ├── favicon-512.png        # Large PWA icon
│   ├── og-image.svg           # OG image source
│   ├── og-image.png           # OG image (1200x630)
│   ├── robots.txt             # Crawler rules
│   ├── sitemap.xml            # XML sitemap
│   ├── llm.txt                # AI/LLM context
│   └── assets/
│       ├── background.mp4     # Scroll-synced video
│       ├── proposal.pdf       # InnovationsGlobal proposal
│       └── gallery/           # 25 gallery videos
├── Flowsc/                    # Source video files
├── tasks/
│   └── todo.md                # Task tracking
├── logs/                      # PM2 application logs
├── ecosystem.config.js        # PM2 configuration
├── CLAUDE.md                  # Development guidance
├── state.md                   # This file
├── specs.md                   # Technical specifications
├── package.json               # Dependencies
├── scripts/
│   ├── scrape-jobs.js         # Puppeteer: scrape job listings
│   ├── scrape-all-details.js  # Puppeteer: scrape all job descriptions (3 parallel)
│   ├── daily-job-scrape.sh    # Shell: orchestrate daily scrape + copy to Nova
│   ├── test-nova.sh           # Test suite (12 tests)
│   └── jobs-with-details.json # Latest scraped jobs data (168 jobs)
└── openclaw-public/           # Dockerized OpenClaw gateway (Nova)
    ├── Dockerfile             # Custom image (node:22 + openclaw + whisper)
    ├── docker-compose.yml     # Security-hardened container (8GB/6CPU)
    ├── config/
    │   ├── openclaw.json      # Gateway config (mounted ro)
    │   └── .env               # API keys (mounted ro, gitignored)
    ├── credentials/           # WhatsApp session (gitignored)
    ├── workspace/             # Agent workspace (persistent)
    │   ├── candidates/        # Per-candidate JSON profiles
    │   └── jobs-data/         # Scraped jobs database
    ├── skills/
    │   └── jobs-database/     # Job search, get-job, stats scripts
    ├── state.md               # OpenClaw-specific state
    └── specs.md               # OpenClaw-specific specs
```

## OpenClaw Public Gateway (Docker)

**Company**: Innovations Global (Innovations Group)
**AI Name**: Nova
**WhatsApp Number**: +1 (973) 389-6989
**Container**: `openclaw-public`
**Host Port**: 20001 → 18789 (internal)
**Model**: Claude Sonnet 4 (anthropic/claude-sonnet-4-20250514)
**Website**: https://innovationsglobal.com
**Persona**: Nova — AI Recruitment Partner
**Status**: ✅ Online

### Features
- **AI Recruiter**: 5-phase conversation flow (intro → trust → discovery → matching → application)
- **Jobs Database**: 168 job openings scraped from erp.innovationuae.com (auto-updated daily at 6 AM UAE)
- **Candidate Memory**: Per-candidate JSON profiles in `workspace/candidates/{phone}.json`
- **Language Detection**: Auto-detects Hindi, Arabic, Romanian, etc.
- **Voice Support**: STT (Whisper, in-container) + TTS (Edge TTS, JennyNeural voice)
- **Privacy**: `/clear` command deletes all candidate data

### Access Control
- **DM Policy**: allowlist
- **Allowed**: +31686267875, +918826969145
- **Groups**: disabled

### Security
- Docker: cap-drop ALL, non-root (uid 1000), no-new-privileges
- Limits: 8GB RAM, 6 CPU, 512 PIDs
- No Docker socket mounted
- Filesystem: workspace-only, exec: allowlist, elevated: disabled

### Management
```bash
docker ps | grep openclaw-public
docker logs --tail 20 openclaw-public
cd /root/projects/kstych/openclaw-public && docker compose restart
docker exec openclaw-public openclaw status
```

## Change Log

### v1.10.0 - TDD foundation: Google auth, Stripe checkout, TextVerified wrapper (April 15, 2026)
- Added Google OAuth surface (Passport): /auth/google, /auth/google/callback, and /api/me (401 when not logged in)
- Stripe Checkout endpoint: POST /api/billing/checkout (type=phone|recharge) → returns Checkout Session URL; webhook receiver at /webhooks/stripe (signature required)
- TextVerified minimal wrapper: GET /api/tv/balance, POST /api/tv/purchase (env-driven, 503 when not configured)
- Jest + Supertest test suite added; all tests passing locally
- PM2 process restarted (kstych) on port 3011; /state.md and /specs.md publicly served

### v1.9.0 - Project Shutdown (March 5, 2026)
- Stopped and deleted kstych PM2 process (port 3011)
- Stopped and removed openclaw-public Docker container (port 20001)
- Disabled job-scraper.timer systemd timer
- Removed nginx config for kaissa.ksty.ch
- Flushed Redis chat:* keys (15 entries)
- Backed up: Redis keys, candidate data, WhatsApp credentials, nginx config, systemd configs
- Created restore script: scripts/restore.sh
- GitHub repo preserved at kaissaglobal/kstych for future restore

### v1.8.1 - Restore OpenClaw Public Container (February 24, 2026)
- Restored openclaw-public Docker container (was missing from Docker)
- WhatsApp channel re-linked for Nova (+12086460727) on port 19800
- All candidate data, jobs database, and skills intact
- Verified gateway, WhatsApp OK status, and message listening

### v1.8.0 - Nova AI Recruiter + Voice Support (February 23, 2026)
- Nova persona: warm AI recruitment partner for Innovations Global
- Built Puppeteer scraper for 168 job openings from erp.innovationuae.com
- Jobs database skill (search, get-job, stats) registered in openclaw.json
- Daily auto-scrape via systemd timer (job-scraper.timer, 6 AM UAE)
- Candidate memory system (per-phone JSON profiles, /clear to delete)
- 5-phase conversation flow (intro → trust → discovery → matching → application)
- Auto language detection (Hindi, Arabic, Romanian, etc.)
- STT: Whisper (CPU, base model) baked into Docker image
- TTS: Edge TTS (en-US-JennyNeural), auto-reply voice when candidate sends voice
- Model switched from Claude Opus → Claude Sonnet 4 (faster WhatsApp responses)
- Docker resources bumped: 2GB/2CPU → 8GB/6CPU
- Chat icon moved to top-right (desktop + mobile)
- Video click changed from modal popup → WhatsApp redirect to Nova
- Test suite: 12 tests all passing

### v1.7.0 - OpenClaw Public Docker Gateway (February 23, 2026)
- Added Dockerized OpenClaw gateway for WhatsApp +1 (973) 389-6989
- Security-hardened container (cap-drop ALL, non-root, PID/mem/CPU limits)
- WhatsApp allowlist: +31686267875, +918826969145
- Model: Claude Opus 4-6, skill: youtube-transcript + built-in
- No Docker socket (no escape vector)
- Directory: /root/projects/kstych/openclaw-public/

### v1.6.0 - Mobile UX Polish (February 22, 2026)
- Full-screen chat panel on mobile (position fixed, all edges 0)
- Prevented iOS zoom on input focus (viewport max-scale=1, 16px font)
- Fixed horizontal overflow on all containers
- WhatsApp-style typing dots animation (replaces "Thinking..." text)
- Typing animation for bot responses (2 chars per 12ms)
- Quick reply buttons fade in after typing animation completes
- Removed auto-focus on chat input (prevents mobile keyboard popup)
- Guaranteed 3 quick reply buttons per response with fallback pool
- Removed "Manufacturing Salaries" video (now 25 videos)
- Removed bottom whitespace (min-height/height fixes)
- Added footer with PDF download button and copyright
- Added proposal PDF download (/assets/proposal.pdf)

### v1.5.0 - Redis Caching & Quick Replies (February 21, 2026)
- Added Redis caching for chat responses
- All 15 FAQ questions pre-cached (24h TTL)
- Custom questions cached for 1 hour
- Cache hit response time: ~100ms (vs ~15s uncached)
- Added dynamic quick reply suggestions (3 per response)
- Switched to faster llama3.2:1b model
- Optimized proposal context for faster processing

### v1.4.0 - AI Chat & FAQ (February 21, 2026)
- Added Ollama-powered AI chatbot
- Chat answers questions based on InnovationsGlobal proposal
- FAQ mode with 15 pre-defined questions
- Toggle between Chat and FAQ modes
- Click FAQ question to ask chatbot
- Mobile responsive chat panel

### v1.3.0 - Video Gallery (February 21, 2026)
- Added video gallery with 26 videos
- 3-column desktop, 2-column tablet, 1-column mobile layout
- Hover to auto-play on desktop (muted)
- Auto-play on scroll into view on mobile (muted)
- Click to open modal with audio enabled
- Intersection Observer API for mobile viewport detection

### v1.2.0 - SEO, Mobile, Country Detection (February 16, 2026)
- Added favicon (SVG, ICO, PNG variants)
- Added Open Graph image (1200x630)
- Added SEO meta tags (OG, Twitter, structured data)
- Added robots.txt and sitemap.xml
- Added llm.txt for AI/LLM context
- Added Cloudflare country detection API
- Added localized greetings based on country
- Mobile optimized with responsive CSS
- Added PWA-ready icons

### v1.1.0 - Cloudflare Turnstile + Video Background (February 16, 2026)
- Added Cloudflare Turnstile human verification gate
- Added HD vertical video background (720x1280, 9:16)
- Implemented scroll-synced video playback

### v1.0.0 - Initial Setup (February 15, 2026)
- Express.js application created
- PM2 deployment configured on port 3011
