03 Theme Architecture - Source Excerpt 02 - wp-content/plugins/fftac-ai-engine/inc/ai-content.php
Summary
This source excerpt begins near wp-content/plugins/fftac-ai-engine/inc/ai-content.php and preserves the surrounding evidence from Wiki.FFTAC.org/raw/system-archives/anti-christ.org/docs-archive/2026-05-10/docs/03-theme-architecture.md.
**Source path:** Wiki.FFTAC.org/raw/system-archives/anti-christ.org/docs-archive/2026-05-10/docs/03-theme-architecture.md
See [14-participants-database-integration.md](14-participants-database-integration.md).
### `wp-content/plugins/fftac-ai-engine/inc/ai-content.php`
This file owns AI-facing content and prompt metadata:
- AI operating protocols
- AI examples, default personas, inquiry protocols, and hidden server prompts
- command-map, prompt-lane, response-contract, and next-route records
- AI console interface copy, workspace/session/share copy, and default AI page content
### `wp-content/plugins/fftac-ai-engine/inc/ai-engine.php`
This file owns AI server behavior:
- `Settings -> FFTAC AI Engine` for the Foundation OpenAI API key, model/defaults, and editable response-flavor overrides
- configured model, default flavor/protocol, key limits, and response payload construction
- encrypted Foundation key and personal user-key storage
- signed-in AJAX chat, personal-key, and output-sharing handlers
- safe prompt/history sanitization, output extraction, share formatting, and notices
Change AI console copy, personas, protocols, key policy, AJAX behavior, OpenAI payloads, or output sharing here.
### `wp-content/plugins/fftac-membership/inc/membership.php`
This file owns the front-end membership system.
It handles:
- membership page provisioning
- `Settings -> FFTAC Membership` page selectors for the membership portal and members area
- portal URLs and redirect normalization
- login, registration, recovery, logout, and profile update handlers
- members-only access control
- dashboard and admin-bar restrictions for non-admin members
Change authentication and protected-content rules here.
### `inc/template-tags.php`
This file owns shared post/publication helpers:
- posted date output
- post record IDs
- publication classification, series, track, and topic helpers
- reading time
- archive intro copy
- single/excerpt file guidance for publication tracks
Change journal card metadata or single-post research handoffs here.
## Theme Templates
### Public Templates
- `front-page.php`
- `page.php`
- `template-manifesto.php`
- `template-philosophy.php`
- `template-ai-engine.php`
- `template-review-notices.php`
- `template-research.php`
- `template-governance.php`
- `template-texts.php`
- `template-symbols.php`
- `template-standards.php`
- `template-downloads.php`
- `template-about.php`
- `template-questions.php`
- `template-contact.php`
- `template-support.php`
- `template-join.php`
- `template-journal.php`
- `template-sitemap.php`
### Membership Templates
- `template-membership-portal.php`
- `template-members-area.php`
### Standard WordPress Templates
- `home.php`
- `single.php`
- `archive.php`
- `search.php`
- `searchform.php`
- `404.php`
- `comments.php`
- `index.php`
## Shared Shell
- `header.php` owns the header, primary navigation, topic map, Research Navigator shell, account/support routes, and breadcrumb placement.
- `footer.php` owns footer navigation, auxiliary governance links, Signals signup, and footer framing.
- `page.php` is the fallback for normal pages and non-specialized provisioned pages.
## Assets
### Styles
`assets/css/theme.css` is the main stylesheet for the entire theme, including public pages, membership, research filters, search, downloads, forms, responsive behavior, and reduced-motion fallbacks.
### Scripts
`assets/ts/theme.ts` is the source for all theme-owned client-side behavior. It compiles to `assets/js/theme.js`, which WordPress serves.
The script handles mobile navigation, topic map behavior, Research Navigator interactions, keyboard shortcuts, research filters, URL-sync behavior, the signed-in AI console, local AI conversation history, browser-local workspace briefs, AI session usage meters, transcript copy/export/import, JSON and Markdown transcript exports, local session snapshots, prompt-lane loading, safe rich AI transcript rendering, fullscreen AI console state, protocol selection, AI follow-up prompt actions including research handoffs, personal-key save/remove AJAX, AI output copying/sharing, starter prompts, form feedback, character counters, password reveal controls, browser audio briefings, the research lens quiz, reduced-motion-safe scrolling/visual motion, and theme-owned analytics events.
Use `npm.cmd run build:assets` or `powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build-theme-assets.ps1` after editing `assets/ts/theme.ts`. Do not hand-edit the generated `assets/js/theme.js` except while debugging a compiled artifact.
### Images And Downloads
Theme artwork lives in `assets/images/`.
Lightweight public reusable assets live in the theme at `assets/downloads/`, currently the seal files and text guides.
Large public media assets live in the `FFTAC Media Assets` plugin at `wp-content/plugins/fftac-media-assets/assets/downloads/`, including posters, wallpapers, preview images, material studies, and the bundled press kit.
`scripts/generate-brand-assets.ps1` rebuilds the large media library into the media plugin and syncs the small seal/link-guide assets back to the theme. `scripts/build-deploy-zips.ps1` builds the theme zip, the Foundation Core plugin zip, the AI Engine plugin zip, the Membership plugin zip, the media plugin zip, and the full-site package.
## Tests
- `tests/bootstrap.php` provides local WordPress stubs.
- `tests/run.php` runs dependency-free theme tests.
- `scripts/test-theme.ps1` runs PHP syntax checks, JavaScript syntax checks, and the theme test suite.
## Content Flow
The normal pattern is:
1. Define copy and datasets in `wp-content/plugins/fftac-foundation-core/inc/foundation-content.php`.
2. Provision or resolve pages, routes, forms, exports, and metadata in `wp-content/plugins/fftac-foundation-core/inc/foundation.php`.
3. Render the public view through `page.php` or a dedicated `template-*.php`. Philosophy-specific presentation belongs in `template-philosophy.php`; the reusable philosophy data remains in `wp-content/plugins/fftac-foundation-core/inc/foundation-content.php`.
4. Add shared post helpers in `inc/template-tags.php` when publication cards or single posts need consistent behavior.
5. Style in `assets/css/theme.css`.
6. Add client-side behavior in `assets/ts/theme.ts`, then compile `assets/js/theme.js`.
7. Update docs when structure, routes, public data, or responsibilities change.
## Launch Visibility
Foundation Core defaults launch visibility to `public` so production deploys are indexable when WordPress Search Engine Visibility also allows indexing. Use `Settings -> FFTAC Foundation`, the `ANTICHRIST_ENGINE_LAUNCH_VISIBILITY` constant, the matching environment variable, or the `antichrist_engine_launch_visibility` option to set `preview` or `private` only for staging, review, or intentionally hidden environments. Valid modes are `private`, `preview`, and `public`; WordPress Search Engine Visibility still has to allow indexing.
## Security And Readiness
`wp-content/plugins/fftac-foundation-core/inc/foundation.php` sends baseline HTTP security headers: `X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`, `X-Permitted-Cross-Domain-Policies`, `Permissions-Policy`, and `Strict-Transport-Security` on HTTPS requests. Host-level TLS policy, CDN caching, WAF rules, malware scanning, and bot mitigation remain production infrastructure work.
Admin settings live under `Settings -> FFTAC Foundation`, `Settings -> FFTAC AI Engine`, and `Settings -> FFTAC Membership`. The internal WordPress admin page at `Tools -> FFTAC Launch Readiness` summarizes launch visibility, WordPress search visibility, provisioned pages, private form storage, admin-only intake export readiness, research API/export mapping, security headers, support destination, AI key state and cost posture, analytics event hooks, and the go-live operations checklist. It also provides CSV downloads for all launch intake or each intake source plus a plain-text launch handoff export for operators.
## Performance And Accessibility Defaults
`functions.php` owns shared image-loading helpers and adds lazy-loading/async-decoding defaults to WordPress attachment images. Hard-coded theme image markup should use `antichrist_engine_get_image_loading_attributes()` and `antichrist_engine_get_image_attribute_markup()` instead of repeating loading, decoding, and fetch-priority attributes by hand.
Decorative imagery should use empty alt text and `aria-hidden="true"`. Keep `assets/ts/theme.ts` reduced-motion-aware when adding scripted scrolling or visual movement, compile `assets/js/theme.js`, and keep the `prefers-reduced-motion` CSS block current when new animation or transition systems are added.
## Analytics Events