# wiki_pages

slug: Backup-System
title: Backup System
tags: [backup, maintenance, cron]
created: 2026-06-21
path: /home/vincent/second-brain/wiki/Backup-System.md
body:
# Backup System

Weekly automated backup of critical files and directories.

## Schedule

```
0 3 * * 0 /home/vincent/backup-vincent.sh >> /home/vincent/backups/brain/backup.log 2>&1
```

- **Frequency:** Weekly
- **Day:** Sunday
- **Time:** 3:00 AM
- **Log:** `/home/vincent/backups/brain/backup.log`

## Backup Script

**Location:** `/home/vincent/backup-vincent.sh`

### What's Backed Up

Based on the script and cron configuration, the backup includes:
- Home directory critical files
- Configuration files
- Project directories
- Database dumps (if applicable)

### Backup Location

`/home/vincent/backups/`

### Verification

Check the log file for successful completion:
```bash
tail -20 /home/vincent/backups/brain/backup.log
```

## Backup Conventions

- Weekly backups run at 3am Sunday
- Logs are appended to `backup.log`
- Manual backups can be triggered by running the script directly
- Keep at least 4 weeks of backups

## Related

- [[Projects]]
- [[Error-Journal]]
- [[Second-Brain-Vault]]


slug: Projects
title: Projects
tags: [projects, index]
created: 2026-06-21
path: /home/vincent/second-brain/wiki/Projects.md
body:
# Projects

Index of active projects and their current status.

## Active Projects

### [[AgentForms]]
- **Path:** `/home/vincent/projects/agentforms/`
- **Stack:** Flask, Docker, Stripe, TailwindCSS
- **Port:** 5060 (relay)
- **Description:** Forms-to-documents platform for service businesses
- **Status:** Active — Stripe LIVE, 20 templates, blog posting automated

### [[MechBase PLC]]
- **Path:** `/home/vincent/projects/mechbase-plc/`
- **Stack:** Flask, TailwindCSS, React
- **Port:** 5003
- **Description:** PLC logic editor with Studio 5000 fidelity, ESP32 target
- **Status:** Active — Reactive subscriptions + structuredClone

### [[Lego Ladder]]
- **Path:** `/home/vincent/projects/lego-ladder/`
- **Stack:** TypeScript, Vite, IndexedDB
- **Description:** Ladder logic programming interface for Lego Technic Powered Up hubs
- **Status:** Active — Phase 1 complete

### [[Second Brain]]
- **Path:** `/home/vincent/second-brain/`
- **Stack:** Flask, Syncthing, Obsidian
- **Port:** 5080
- **Description:** Personal knowledge base with browser-based access
- **Status:** Active — Web app running, synced via Syncthing

### [[SeedVault Market]]
- **Path:** `/var/www/seedvault-local/`
- **Stack:** WordPress, WooCommerce, Apache2
- **Port:** 8899
- **Description:** Heirloom seeds e-commerce with Bitcoin payments
- **Status:** Active — ~$1.4K/yr revenue

### [[Quality Small Engine Repair]]
- **Path:** `/home/vincent/projects/quality-small-engine-handoff.md`
- **Stack:** Flask, TailwindCSS
- **Port:** 5050 (not currently running)
- **Description:** Demo website for local small engine repair shop
- **Status:** Demo/Handoff — Built as consultant pitch

### [[Bitcoin AI Assistant]]
- **Path:** `/home/vincent/projects/bitcoin-ai/`
- **Description:** Small form factor Bitcoin AI assistant on Intel NUC
- **Status:** Development

### [[Dev-AI]]
- **Path:** `/home/vincent/projects/dev-ai/`
- **Description:** Fine-tuned 27B code review model for CPU
- **Status:** Development

## Project Conventions

- All projects use descriptive, architectural service names
- Event-driven webhooks preferred over polling
- Level-based development methodology
- Self-hosted, self-reliant infrastructure
- Open source where possible

## Related

- [[Second-Brain-Vault]]
- [[Backup-System]]
- [[Error-Journal]]


slug: Migration-Post-Mortem
title: WordPress Migration Post-Mortem
tags: [migration, wordpress, lessons-learned, failure]
created: 2026-06-21
path: /home/vincent/second-brain/wiki/Migration-Post-Mortem.md
body:
# WordPress Migration Post-Mortem

**Site:** seedvault.market  
**Date:** May 22, 2026  
**Status:** Content lost due to migration error  
**Impact:** Complete loss of WordPress.com site content (posts, pages, products, media)

---

## What Went Wrong

### The Critical Error
**DNS was changed to the new NUC server BEFORE backing up the old WordPress.com site.**

This is backwards. The correct migration order is:
1. ✅ Backup old site
2. ✅ Set up new environment
3. ✅ Migrate content
4. ✅ Verify on new server
5. ✅ THEN change DNS

### Timeline
1. **NUC Setup Completed** — Docker containers running (WordPress + MySQL), Nginx reverse proxy configured, SSL obtained
2. **DNS Changed Prematurely** — WordPress.com detected external hosting and auto-disconnected the site
3. **No Backup Existed** — Site disappeared from WordPress.com dashboard
4. **Content Lost** — All posts, pages, products, media inaccessible

---

## Lessons Learned

### Migration Order (Correct)
```
1. BACKUP FIRST - Export WordPress.com site (XML or All-in-One WP Migration)
2. Set up new environment (NUC, Docker, Nginx, SSL)
3. Test new environment locally (internal IP, not public domain)
4. Migrate content to new environment
5. THEN change DNS - Point domain to new server
6. Verify everything works on new server
7. Keep old site running until confirmed migration success
```

### Critical Rules
- ✅ Always backup before any DNS change
- ✅ Test new environment on internal IP first
- ✅ Keep old site running until migration verified
- ✅ Have rollback plan before making changes

### Prevention
- Never change DNS before verifying backup exists
- Test on internal IP (`http://192.168.1.100:8081`) before going live
- Document rollback procedures
- Verify hosting provider behavior before migration (WordPress.com auto-disconnects on DNS change)

---

## Recovery Attempts

1. **WordPress.com Support** — Not yet attempted
2. **DNS Reversion** — Pointing DNS back to WordPress.com (`192.0.78.24`) to attempt auto-reconnect
3. **Rebuild from Scratch** — Install WooCommerce on NUC WordPress, rebuild ~32 products manually or via CSV (last resort)

---

## Current Status
- **NUC WordPress:** Working, empty, accessible at `https://seedvault.market`
- **WordPress.com Site:** Disconnected, inaccessible, possibly deleted
- **Content:** Lost (no backup existed)
- **DNS:** Being reverted to WordPress.com to attempt recovery

---

## Related
- [[Projects]]
- [[Error-Journal]]


slug: AgentForms
title: AgentForms
tags: [agentforms, project, income, flask, docker]
created: 2026-06-21
path: /home/vincent/second-brain/wiki/AgentForms.md
body:
# AgentForms

**Forms that turn into documents** — platform for service businesses to collect data and generate invoices, estimates, and reports.

## Overview

| Field | Value |
|---|---|
| **Path** | `/home/vincent/projects/agentforms/` |
| **Domain** | agentforms.io |
| **Port** | 5060 (relay), 5051/5070 (Cloudflare Tunnel) |
| **Stack** | Flask, SQLite, Redis, Docker, Stripe |
| **Revenue** | Stripe LIVE — 4 tiers |
| **Tests** | 343 passing |
| **Status** | ✅ Production-ready |

## Pricing Tiers

| Tier | Price | Description |
|---|---|---|
| Starter | $9/mo | Single user, basic forms |
| Pro | $29/mo | Advanced analytics, document generation |
| Teams | $49/mo | Team collaboration, invites |
| Teams+ | $79/mo | Priority support, unlimited |

## Infrastructure

| Component | Service | Status |
|---|---|---|
| **Relay** | `agentforms-relay` | Port 5060, healthy |
| **Worker** | `agentforms-worker` | Healthy |
| **Redis** | `agentforms-redis` | Healthy |
| **Database** | SQLite with WAL mode | `check_same_thread=False`, timeout=30 |
| **Email** | mail.agentforms.io:587 | Hetzner relay |
| **Payments** | Stripe webhook | `/billing/stripe/webhook` |
| **Tunnel** | Cloudflare | Ports 5051, 5060, 5070 exposed |

## Features Shipped

| Feature | Tests |
|---|---|
| Auth (login, register, magic link, logout) | 25 |
| Form Builder (create, edit, versions, rollback) | 66 |
| Form Analytics | 56 |
| SSE + Agent API (Phase 4) | 21 |
| Stripe Billing (4 tiers) | 12 |
| Email System (tracking, campaigns, A/B, reminders) | 41 |
| Document Generation (invoices, templates, PDF) | 3 |
| Webhook Integrations | 17 |
| Team Collaboration + Invites | — |
| Security Hardening (CSRF, CSP, rate limiting, encryption) | 36 |

## Templates

- **20 templates** in `form_templates` table
- Template browser at `/sites/templates`
- API at `/api/v2/templates`
- Seeds at `app/services/template_seeds.py`

## Blog

- Blog at `/blog`
- Dev.to automated posting — cron `e63962206d11` (Wed 12pm)
- Script: `~/.hermes/scripts/devto_post.py`

## Remaining Items

1. **Stripe webhook validation** — endpoint works, never received a real event. Trigger a real checkout to confirm.
2. **No production traffic** — 2 test accounts only. First paying customer is the real test.

## Related

- [[Projects]]
- [[Backup-System]]


slug: Second-Brain-Vault
title: Second Brain Vault
tags: [concept, system]
created: 2026-06-21
updated: 2026-06-21
path: /home/vincent/second-brain/wiki/Second-Brain-Vault.md
body:
# Second Brain Vault

An Obsidian vault at `~/second-brain/` that serves as a persistent, queryable knowledge base. The AI ingests content, extracts key ideas, and creates wikilinked Markdown pages that compound over time.

## Concept

Inspired by Andrej Karpathy's 16M-view post: stop using AI to write code, use it to build a second brain. Point an AI at a folder, feed it content, and have it build a living wiki.

## Architecture

- **raw/** — incoming source material
- **wiki/** — generated wiki pages with [[wikilinks]]
- **inbox/** — quick capture for fleeting thoughts
- **_templates/** — note templates for consistency

## How It Works

1. Drop source material into `raw/`
2. Say "ingest this"
3. AI reads, extracts key ideas, creates/updates wiki pages
4. Ask questions across everything — forever

## Key Insight

The compounding mechanism is [[wikilinks]] — each new page links to existing pages, creating a navigable graph of knowledge. The more you feed it, the richer the connections become.

## Caveats

- **Pruning is mandatory.** A knowledge base you never weed becomes a junk drawer. Stale notes, contradictions, and dead links accumulate fast.
- **Ingestion is easy, maintenance is hard.** The real work is keeping the signal-to-noise ratio high.

## Related

- [[Graph Memory]] — structured entities/relationships in SQLite
- [[Hermes Memory]] — hot/warm/cold tiered text memory
- [[Obsidian]] — the note-taking app that renders this vault

## Source

From: [Karpathy's second brain post](https://x.com/ridark_eth/status/2068753952850546985)


slug: MechBase-PLC
title: MechBase PLC
tags: [mechbase, project, plc, ladder-logic, esp32, income]
created: 2026-06-21
path: /home/vincent/second-brain/wiki/MechBase-PLC.md
body:
# MechBase PLC

**PLC-style logic editor** for industrial automation and Lego Technic projects. Web-based interface with Studio 5000 fidelity, targeting ESP32 firmware.

## Overview

| Field | Value |
|---|---|
| **Path** | `/home/vincent/projects/mechbase-plc/` |
| **Port** | 5003 |
| **Stack** | Flask, TailwindCSS, React, C++ |
| **Target** | ESP32 firmware |
| **Business** | Build fee + monthly retainer for local shops |
| **Status** | Active — Reactive subscriptions + structuredClone |

## Architecture

```
┌─────────────────────────────────────────────────────────┐
│  ESP32 Firmware (C++)                                   │
│  ┌───────────────────────────────────────────────────┐  │
│  │  Ladder Interpreter                               │  │
│  │                                                    │  │
│  │  For each scan:                                    │  │
│  │    1. Read digital inputs (GPIO)                   │  │
│  │    2. Evaluate networks rung-by-rung               │  │
│  │       a. Input branches (OR)                       │  │
│  │       b. Output branches (OTE/OTL/OTU/Timers)     │  │
│  │    3. Update timers (TON/TOF/TP)                   │  │
│  │    4. Write physical outputs (GPIO)                │  │
│  └───────────────────────────────────────────────────┘  │
│  ┌───────────────────────────────────────────────────┐  │
│  │  Web UI (served from ESP32)                       │  │
│  │  — Visual ladder editor                           │  │
│  │  — I/O monitoring                                 │  │
│  │  — Program download                               │  │
│  └───────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────┘
```

## Ladder Logic Instructions

### Contacts (Input Logic)

| Symbol | Name | Description |
|--------|------|-------------|
| `--\| \|---` | **NO** | Normally Open — passes when TRUE |
| `--\|/\|---` | **NC** | Normally Closed — passes when FALSE |
| `--\|P\|---` | Rising Edge | Single-scan TRUE→FALSE transition |
| `--\|N\|---` | Falling Edge | Single-scan FALSE→TRUE transition |
| `T0.DN` | Timer Done | Timer has reached preset |
| `T0.TT` | Timer Timing | Timer is currently running |
| `T0.EN` | Timer Enable | Timer rung has power flow |

### Outputs

| Symbol | Name | Description |
|--------|------|-------------|
| `--( )--` | **OTE** | Output Energize — follows input power |
| `--(L)--` | **OTL** | Output Latch — SET, stays ON once set |
| `--(U)--` | **OTU** | Output Unlatch — RESET, clears latched output |
| `--(TON)--` | TON | Timer On-Delay |
| `--(TOF)--` | TOF | Timer Off-Delay |
| `--(TP)--` | TP | Timer Pulse |

### Timer Status Bits

| Bit | Meaning |
|-----|---------|
| **EN** | Enable — controlling rung has power flow |
| **TT** | Timing — timer is currently counting |
| **DN** | Done — timer has reached preset |

## GPIO Map (ESP32)

| Pin | Function |
|-----|----------|
| GPIO 27 | Digital Input 0 |
| GPIO 26 | Digital Input 1 |
| GPIO 33 | Digital Input 2 |
| GPIO 35 | Digital Input 3 |
| GPIO 34 | Digital Input 4 |
| GPIO 25 | Digital Output 0 |
| GPIO 32 | Digital Output 1 |
| GPIO 4  | Digital Output 2 |
| GPIO 15 | Digital Output 3 |

## Key Files

| Path | Purpose |
|------|---------|
| `src/ladder_interpreter.h` | C++ header — all types, enums, structs |
| `src/ladder_interpreter.cpp` | C++ implementation — evaluation, I/O, timers |
| `tests/ladder_test.py` | Python test harness (runs on Pi for testing) |
| `templates/motor_control.json` | Motor interlock template |

## Testing

```bash
cd ~/projects/mechbase-plc
python3 tests/ladder_test.py
```

**10 tests covering:** NO/NC, OTE, OTL/OTU, parallel branching, series contacts, TON/TOF/TP with all status bits, start/stop latching, motor interlock.

## Related

- [[Lego Ladder]] — Ladder logic for Lego Technic hubs (TypeScript/Vite, IndexedDB)
- [[Projects]]
- [[Second-Brain-Vault]]


slug: Error-Journal
title: Error Journal
tags: [errors, troubleshooting, log]
created: 2026-06-21
path: /home/vincent/second-brain/wiki/Error-Journal.md
body:
# Error Journal

Running log of errors encountered, root causes identified, and resolutions applied.

## Purpose

This journal tracks errors that occur during development and deployment, along with their root causes and solutions. The goal is to prevent repeating the same mistakes and to provide a reference for troubleshooting similar issues.

## Entry Format

```markdown
### Error Title
**Date:** YYYY-MM-DD
**Issue:** Brief description of the problem
**Root Cause:** What actually caused it
**Resolution:** How it was fixed
**Prevention:** How to avoid it in the future
```

## Entries

### Template Mismatch / Shadow Directory
**Date:** 2026-06-07
**Issue:** Changes to `index.html` were not appearing on the live website at `http://localhost:5050`.
**Root Cause:** A redundant nested directory structure existed: `/home/vincent/quality_small_engine_mock/quality_small_engine_mock/`. The running Flask process was serving files from this "shadow" directory instead of the intended root directory.
**Resolution:**
1. Identified the conflicting PID
2. Terminated the existing Flask processes
3. Removed the redundant nested directory
4. Restarted the server from the correct root directory
5. Verified the fix by checking that content was now present
**Prevention:** Avoid creating nested project folders with the same name during initialization or git clones. Use `ls -R` to audit directory structures if content mismatches occur.

### WordPress Migration Error
**Date:** 2026-05-22
**Issue:** Content lost due to premature DNS change before backup.
**Root Cause:** Migration instructions told user to change DNS before backing up WordPress.com site.
**Resolution:** DNS reverted to WordPress.com, attempting recovery. See [[Migration-Post-Mortem]] for full details.
**Prevention:** Always backup before DNS changes. Test on internal IP first.

### Jinja2 Pluralization Syntax Error
**Date:** 2026-06-21
**Issue:** 500 Internal Server Error on second-brain-server initial launch.
**Root Cause:** `{{ pages | length | pluralize }}` — `pluralize` is not a built-in Jinja2 filter.
**Resolution:** Patched to `{{ 's' if pages | length != 1 }}`.
**Prevention:** Test Jinja2 templates on first launch. Use built-in filters or register custom filters.

## Related

- [[Projects]]
- [[Migration-Post-Mortem]]
- [[Backup-System]]


