Agent Reference File

Project: fogserv.cloud
Last Updated: April 22, 2026
Purpose: Comprehensive reference for AI agents operating on this codebase


🎯 Mission Context

You are working on fogserv.cloud, an implementation of "The AI-Managed Server" that treats infrastructure as a living entity that learns and evolves. This project embodies the TELOS philosophy: "Helping People Help Themselves" through democratic technology, knowledge as freedom, and agentic autonomy.

Read First: /kb/TELOS.md - The North Star guiding all decisions


πŸ“ Project Structure & Key Files

Root Directory

/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.tsx              # All page components + full route tree
β”‚   β”œβ”€β”€ index.css             # Global Tailwind imports
β”‚   β”œβ”€β”€ vite-env.d.ts         # Typed ImportMetaEnv (email provider vars)
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── emailService.ts   # Typed email abstraction (console/api modes)
β”‚   └── routes/               # Scaffold only – main.tsx is canonical
β”œβ”€β”€ scripts/
β”‚   └── import-ghost.ts       # Ghost JSON export β†’ Prisma import script
β”œβ”€β”€ kb/                        # Knowledge Base (CRITICAL – update after every session)
β”‚   β”œβ”€β”€ TELOS.md              # Mission & philosophy – READ THIS FIRST
β”‚   β”œβ”€β”€ README.md             # KB navigation
β”‚   β”œβ”€β”€ agent.md              # This file
β”‚   β”œβ”€β”€ tasks.md              # Project task tracking
β”‚   β”œβ”€β”€ lessons-learned.md    # Session insights
β”‚   β”œβ”€β”€ problems-solved.md    # Technical issues & solutions
β”‚   β”œβ”€β”€ implementations.md    # Architecture decisions
β”‚   β”œβ”€β”€ wireframes.md         # MVP UX and wireframe specs
β”‚   β”œβ”€β”€ workflows.md          # Unified workflow runbook
β”‚   β”œβ”€β”€ frontend/
β”‚   β”‚   └── website-rebuild.md
β”‚   β”œβ”€β”€ sysadmin/
β”‚   β”‚   └── dotenvx.md
β”‚   β”œβ”€β”€ agentic/
β”‚   β”‚   └── agentic-workflows.md
β”‚   └── migrations/
β”‚       β”œβ”€β”€ ghost-content-migration-map.md
β”‚       └── ghost-redirect-manifest.json  # Auto-generated by import script
β”œβ”€β”€ prisma/
β”‚   β”œβ”€β”€ schema.prisma         # Full CRM/CMS schema
β”‚   └── migrations/           # Prisma migration history
β”œβ”€β”€ .forgejo/workflows/ci.yml # Forgejo Actions CI pipeline
β”œβ”€β”€ .env                      # Local secrets (NEVER COMMIT)
β”œβ”€β”€ .env.example              # Template (safe to commit)
β”œβ”€β”€ package.json              # Dependencies & scripts
β”œβ”€β”€ vite.config.ts            # Vite config + ALL backend API middleware
β”œβ”€β”€ tsconfig.json             # TypeScript configuration
β”œβ”€β”€ index.html                # HTML shell
└── SECRETS_MANAGEMENT.md     # Root-level secrets guide

πŸ”§ Technology Stack

Core Technologies

Package Manager Commands

bun install                                            # Install dependencies
bun run dev                                           # Start dev server (with dotenvx)
bun run build                                         # Build for production
bun run preview                                       # Preview production build
bun run db:push                                       # Sync database schema
bun run db:generate                                   # Generate Prisma client
bun run db:migrate                                    # Create migration
bun run db:studio                                     # Open Prisma Studio
bun run type-check                                    # TypeScript validation
bun run lint                                          # ESLint
bun run secrets:get KEY                               # Get secret value
bun run import:ghost <ghost-export.json> [--dry-run]  # Import Ghost content

πŸ—„οΈ Database & Environment

Environment Variables

Located in: .env (local), .env.production (encrypted or CI/CD)

Current Variables (see .env.example for full list):

DATABASE_URL="file:./dev.db"              # SQLite for local dev
PRISMA_ORM=prisma+postgres://...          # Prisma Accelerate (production)
PRISMA_ANY=postgres://...                 # Direct PostgreSQL
MAILGUN_API_KEY=...                       # Mailgun API key
MAILGUN_DOMAIN=mg.fogserv.cloud       # Sending domain
MAILGUN_FROM_EMAIL=noreply@fogserv.cloud
MAILGUN_WEBHOOK_SIGNING_KEY=...           # Webhook HMAC verification
APP_BASE_URL=http://localhost:5173        # For verification email links
VITE_EMAIL_PROVIDER=api                   # 'api' (real) or 'console' (dev)
VITE_EMAIL_API_BASE_URL=/api

Planned:

JWT_SECRET=...                            # For user auth tokens

Database Schema

Current Models (all in prisma/schema.prisma):

Operations:

# After schema changes
bun run db:generate     # Regenerate client
bun run db:push         # Sync to database
# OR for production
bun run db:migrate      # Create migration file

🎨 Frontend Architecture

Current Pages

  1. Home (/) β€” Hero, core pillars, mission
  2. About (/about) β€” TELOS mission, goals, how it works
  3. Changelog (/changelog) β€” Update list
  4. Knowledge Base (/kb) β€” KB document browser with react-markdown + remark-gfm + rehype-slug
  5. Admin (/admin) β€” Dashboard with KPI cards, content queue, quick actions, Email Sandbox

Backend API routes (Vite middleware in vite.config.ts):

Component Structure

In src/main.tsx:

Styling Patterns


πŸ“‹ Core Pillars (TELOS)

1. GitOps is Law

2. Ticketing is Truth

3. Documentation is Memory

4. Proactive Polish


πŸ€– Agent Operations

Before Starting Work

  1. Read Context

    • Read /kb/TELOS.md for mission alignment
    • Read /kb/tasks.md for current priorities
    • Check related KB files for domain knowledge
  2. Check Issues

    • Is there a ticket for this work?
    • If not, should one be created?
    • Reference ticket number in commits
  3. Understand Environment

    • Are secrets configured in .env?
    • Is database schema current?
    • Are dependencies installed?

During Work

  1. Follow Patterns

    • Match existing code style
    • Use established component patterns
    • Follow naming conventions (see /kb/implementations.md)
  2. Document Decisions

    • Why did you choose this approach?
    • What alternatives were considered?
    • Update /kb/implementations.md for architecture changes
  3. Test as You Go

    • Run dev server to verify changes
    • Check browser console for errors
    • Test responsive design

After Completing Work

  1. Update Knowledge Base

    • Add to /kb/lessons-learned.md if you learned something
    • Add to /kb/problems-solved.md if you fixed an issue
    • Update /kb/tasks.md to mark tasks complete
    • Update relevant KB files with new information
  2. Commit Properly

    git add [files]
    git commit -m "feat: Add email signup form
    
    Implements newsletter subscription with Mailgun integration.
    Includes double opt-in flow and welcome email.
    
    Fixes #42"
    
  3. Update Documentation

    • Update CHANGELOG.md with changes
    • Update README.md if setup changed
    • Ensure all new features are documented

🚨 Common Issues & Solutions

React Hydration Errors

Problem: <html> cannot be child of <div>
Solution: Keep HTML structure in index.html, React mounts inside #root
Reference: /kb/problems-solved.md#problem-1

PostCSS Module Error

Problem: module is not defined in ES module scope
Solution: Use export default in postcss.config.js
Reference: /kb/problems-solved.md#problem-2

Tailwind Plugin Error

Problem: Tailwind v4 PostCSS plugin missing
Solution: bun add -d @tailwindcss/postcss and update config
Reference: /kb/problems-solved.md#problem-3

Environment Variables Not Loading

Problem: Variables undefined in application
Solution: Ensure scripts use dotenvx run -- wrapper
Reference: /kb/dotenvx.md


πŸ“š Key Workflows

Adding a New Page

  1. Add route in src/main.tsx:

    const newRoute = createRoute({
      getParentRoute: () => rootRoute,
      path: '/new-page',
      component: NewPage,
    })
    
  2. Add to route tree:

    const routeTree = rootRoute.addChildren([..., newRoute])
    
  3. Add navigation link in Navigation() component

  4. Document in /kb/implementations.md

Adding Database Model

  1. Edit prisma/schema.prisma:

    model NewModel {
      id   Int    @id @default(autoincrement())
      name String
    }
    
  2. Generate client:

    bun run db:generate
    
  3. Push to database:

    bun run db:push
    
  4. Document in /kb/implementations.md

Adding Secret

  1. Add to .env:

    NEW_SECRET=value_here
    
  2. Add to .env.example (without value):

    NEW_SECRET=your_secret_here
    
  3. Use in code:

    const secret = process.env.NEW_SECRET
    
  4. Document in /kb/dotenvx.md and SECRETS_MANAGEMENT.md


🎯 Current Priorities (from tasks.md)

Phase 1-2 βœ… COMPLETE

Phase 3: CRM/CMS Architecture πŸ”„ IN PROGRESS

Phase 4: Email & Mailgun πŸ”„ IN PROGRESS

Phase 5: Ghost Migration πŸ”„ IN PROGRESS

Phase 6: CI/CD


πŸ”— External Resources

Documentation

Git Repository

Production Site


⚠️ Critical Rules

NEVER

ALWAYS


πŸ“ž Questions & Clarifications

If you encounter ambiguity:

  1. Check KB First: Answer is probably in /kb/
  2. Check TELOS: Does it align with mission?
  3. Check implementations.md: Is there a pattern?
  4. Ask User: If still unclear, ask for clarification
  5. Document Answer: Add to appropriate KB file

πŸ“Š Session Checklist

At the end of every session, ensure:


This file is your command center. Refer to it often. Keep it updated.

Last Updated: April 22, 2026
Next Update: After every significant session Agent dashboard design (Phase 8) β€” KPI cards, real-time polling, deployment tracking β€” see kb/artifacts/phase8/agent-dashboard-search-community.md

Choose Theme

Your selection is saved locally.

Neural Cacophony
Aperture v2
Flux v1
Mosaic Chaos
Nexus v1
Nexus Zest
Prism v2
Synapse