# BF51 — Growth, Comparison, Ollama, AI and Search Implementation Ledger

## Objective
Ship one cumulative BF51 release on top of BF50.23/R6 that improves search authority, comparison pages, Bing favicon/indexing, Ollama/local-AI choice, AI robustness, and Live PDF observability without breaking existing TeXise editor/compiler/storage/collaboration/export behavior.

## Autonomous execution
Use `plans/AUTONOMOUS_EXECUTION_HANDOFF.md`. Execute → Verify → Diagnose/Fix → Verify → Continue. Do not pause for routine confirmation. Before practical chat-context exhaustion, finish the current safe subtask and generate a complete continuation prompt.

## Completed baseline
- BF49/BF50 cumulative source guard behavior.
- Configurable Free project limit (`TEXISE_FREE_PLAN_LIMIT`, default 5).
- BF50.23 Live PDF R6 fail-closed instant overlay over authoritative R5.
- R6 TypeScript 6 and Biome fixes.
- Existing autonomous handoff rule in root `AGENTS.md` and `plans/AUTONOMOUS_EXECUTION_HANDOFF.md`.

## BF51 phases
1. Baseline freeze and release snapshot.
2. Canonical TeXise public product facts.
3. Canonical comparison/evidence registry and route metadata derivation.
4. Bing favicon + legacy index + IndexNow hardening.
5. Three-class AI execution semantics: Browser Local / Ollama Local Service / BYOK AI.
6. Ollama adapter, local connection client, model discovery, host validation.
7. CSP/CORS/browser-security handling for loopback Ollama.
8. Ollama AI Settings UX and connection/model controls.
9. Route Ollama through configured AI, Suggest, Review and Paper Memory-compatible paths without cloud fallback.
10. Ollama docs + AI docs + public marketing terminology.
11. Ollama tests and release guards.
12. Migrate existing comparison pages to evidence-backed schema.
13. Add Texposit, Bibby, Murfy, Octree and Papeeria comparisons.
14. Redesign `/compare` hub and add comparison guide pages.
15. Add migration/FAQ/source verification sections.
16. R6 observability and benchmark hooks; only safe measured eligibility improvements.
17. Shared AI structured-output recovery/validation hardening.
18. Paper Memory / AI Review public positioning alignment.
19. SEO/schema/sitemap/index consolidation and IndexNow changed-URL publishing.
20. BF51 cumulative release guard and full non-regression verification.
21. Package one top-level `public_html/`, compute SHA-256, final report.

## Current phase
Phase 20–21 release certification and packaging. BF51 feature implementation is complete in `/mnt/data/texise_bf51_work/public_html`; final dependency-free validation is green except for historical failures reproduced unchanged in the BF50.23 baseline. Packaging is the remaining local phase.

## Non-negotiable decisions
- Canonical user terminology is `BYOK AI`, never `BOYK` or `BYOK cloud AI` as a feature name.
- Ollama is local-service execution, not BYOK/cloud.
- Selecting Ollama never silently falls back to cloud AI.
- HTTP Ollama targets are loopback-only by default; arbitrary LAN HTTP is rejected.
- Privacy Mode may use browser-local and Ollama context; it blocks BYOK cloud context.
- Ollama uses existing OpenAI-compatible completion protocol internally, but user-facing setup requires no API key.
- All comparison content stays under `/compare`.
- Competitor unknowns are `Not verified`, not negative claims.
- Time-sensitive competitor data carries source + verification date.
- R5/manual compile/export/SyncTeX remain authoritative; R6 remains disposable/fail-closed.

## External production gates
Workspace dependencies are not bundled in source archive. Final production certification still requires provisioned `pnpm lint:ci`, `pnpm test:ci`, `pnpm build`, `pnpm local-ci-check`, relevant real-browser Playwright, production HTTP favicon/SEO checks, and real Ollama browser smoke testing.


## BF51 completion checkpoint — 2026-08-28
### Completed phases
- Canonical comparison/evidence registry drives browser comparison content, SSR SEO and sitemap routes.
- Nine direct comparisons and four workflow guides are implemented under `/compare`.
- Bing/favicon hardening, legacy `/latex-templates` redirect checks, IndexNow key ownership and post-health changed-URL submission are implemented.
- AI execution modes are Browser Local AI, Ollama local service and BYOK AI. Ollama is keyless, loopback-only, Privacy Mode compatible and never silently falls back to cloud.
- Ollama Settings UX, model discovery/connection tests, AI Suggest/Review routing, Paper Memory compatibility and `/docs/ollama` are implemented.
- R6 local-only diagnostics are implemented without telemetry or eligibility expansion; exact R5 remains authoritative.
- Shared bounded AI structured-output recovery is used by AI writing/review and Paper Memory while semantic/evidence validation remains separate.
- BF51 source guard/regression, static release-audit integration and production SEO health script are implemented.
- Legacy cumulative-guard marker comments were removed; BF33–BF50 guards now explicitly accept BF51 release identities.

### Verification
- BF50 source guard: PASS.
- BF51 source guard: PASS.
- BF51 regression: 6/6 PASS.
- BF50 R6 regression: 3/3 PASS.
- Static release audit: 389/389 PASS.
- Branding audit: PASS (677 production-facing text files).
- TypeScript 5.8.3 syntax transpile: 17/17 changed TS/TSX files PASS.
- Changed JS/MJS `node --check`: 34 files PASS.
- Changed shell `bash -n`: 3 files PASS.
- Comparison JSON/package JSON/tsconfig JSONC parsing: PASS.
- Diff whitespace and temporary-artifact scans: PASS.
- Manual `ProjectCompileService`: byte-identical to BF50.23 baseline.
- PDF export uses authoritative `workspace?.pdf`; R6 `instantPatch` is viewer-only.
- Runtime hardening: 97/102 PASS with the same five historical failures as BF50.23; no BF51-only failure.
- R14 regression: 22/23 in BF51 and 22/23 in BF50.23; same historical Hotfix10 Cloud Compile wording failure.
- SaaS static audit: same one historical CMS Markdown-sanitization failure as BF50.23.

### Remaining local work
- Re-run final validation after ledger edits.
- Create one-root `public_html/` BF51 ZIP, verify archive/source file counts and required BF51 artifacts, compute SHA-256.

### Mandatory production gates
Provisioned server must run workspace custom validation/typecheck (`tsgo`), Biome lint, unit/integration tests, production build, Chromium R4/R5/R6 E2E, production favicon/SEO HTTP checks and a real Ollama browser smoke test.

## BF51.1 production-hardening checkpoint — 2026-08-29

### Completed
- Ollama local-service AI now distinguishes locally installed models from Ollama remote/cloud-backed models using `remote_model`, `remote_host` and `/api/show`, and validates the selected model before manuscript context is sent.
- Generic LaTeX/JSON control-word collision recovery replaces the finite command allow-list; semantic/citation/evidence validation remains separate.
- R6 diagnostics now include viewer accept/reject outcomes, warm-up failures and isolated instant-worker idle disposal; R5/manual Compile/export/SyncTeX remain authoritative.
- Comparison guides own membership/methodology/verdicts/FAQ in the canonical registry; capability rows have addressable official-source provenance; sitemap entries use verification dates as `lastmod`.
- `/compare/*` receives substantive initial HTML generated from the canonical registry, with React retaining the interactive runtime.
- Comparison claims no longer hard-code the Free-plan default project count. `TEXISE_FREE_PLAN_LIMIT` remains authoritative at runtime.
- IndexNow supports optional `TEXISE_INDEXNOW_URLS_FILE` changed-URL manifests while preserving the canonical fallback and non-fatal deployment behavior.
- BF51.1 app-shell identity is `texise-app-shell-r14-28-20-buildfix51-1-v1`; production dist coherency parsing supports point-build cache identities.
- Added BF51.1 Ollama deterministic browser E2E, BF51.1 regression/source guard, comparison audit and BF51.1 release-audit contract.

### Verification status
- BF50 R6 regression: 3/3 PASS.
- BF51 regression: 6/6 PASS.
- BF51.1 regression: 6/6 PASS.
- BF50/BF51/BF51.1 cumulative source guards: PASS.
- Comparison audit: PASS (9 competitors, 4 guides).
- Public comparison SEO tests: 20/20 PASS.
- Static release audit: 390/390 PASS after BF51.1 contract integration.
- Runtime hardening: 97/102, exactly matching BF51's historical five failures after point-build release-coherency repair.
- R14.28.20 regression: 22/23, same historical aggregate BF50 guard failure as BF51 baseline.
- SaaS static audit: same historical CMS Markdown-sanitization failure as BF51 baseline.

### Deferred measured/non-blocking improvements
- R6 project-file copy optimization remains measurement-driven; do not redesign the warm worker filesystem until BF51.1 diagnostics provide real project-scale latency/memory evidence.
- Per-comparison custom Open Graph artwork is optional conversion polish and not a release gate.

### External production gates
Provisioned server must run custom validation, TypeScript 6 `tsgo`, Biome, full unit/integration tests, production build, Chromium R4/R5/R6, BF51.1 Ollama browser E2E, real Ollama smoke certification, production compare initial-HTML/SEO checks, favicon/Bingbot HTTP health, legacy redirects and IndexNow ownership/submission.

## BF51.1 release-orchestration completion — 2026-08-29

### Additional release gaps closed
- Formal `e2e:release` now includes `src/latex-ollama-bf51-1.e2e.ts`; the Ollama E2E is no longer merely present in source. BF51.1 regression/source/audit contracts enforce the runner wiring.
- `release:seo-production` now derives all 13 direct/guide comparison routes from the canonical registry, requires substantive prerender markers for every comparison page, and verifies `/docs/ollama`.
- Added `pnpm run release:ollama-local` (`scripts/verify-ollama-local.mjs`) for real loopback Ollama certification. It verifies `/api/version`, `/api/tags`, rejects `remote_model`/`remote_host`, validates `/api/show` completion capability and performs a real `/v1/chat/completions` request.
- The Ollama smoke verifier was self-tested against a temporary local compatible server for both successful local inference and remote/cloud rejection.
- `scripts/run-release-quality.mjs` report identity now names BF51.1/BF51/BF50 cumulatively.

### Final local verification after release-orchestration fixes
- BF50 R6 regression: 3/3 PASS.
- BF51 regression: 6/6 PASS.
- BF51.1 regression: 6/6 PASS.
- BF50/BF51/BF51.1 guards: PASS.
- Comparison audit: PASS (9 competitors, 4 guides).
- Public SEO: 20/20 PASS.
- Public index: 3/3 PASS.
- SaaS migrations: 2/2 PASS.
- Static release audit: 390/390 PASS.
- Branding/provenance: PASS.
- Runtime hardening: 97/102, matching the known BF51 historical five failures.
- R14.28.20: 22/23, matching the known historical aggregate failure.

### Remaining external certification
- Provisioned workspace `pnpm` install/typecheck/Biome/unit/build.
- Formal browser `e2e:release` (now including BF51.1 Ollama).
- Real deployed HTTPS browser→local Ollama CORS/local-network test.
- `TEXISE_OLLAMA_MODEL=<local-model> pnpm run release:ollama-local`.
- `pnpm run release:seo-production` against the deployed origin.

## BF51.2 — Texposit-style Ollama workflow

- Supersedes the previous no-cloud-fallback UX by explicit user request.
- Ollama remains a browser→user-computer integration; no TeXise-server Ollama runtime is introduced.
- AI Assistant and AI Settings automatically probe `localhost:11434` and discover local models.
- AI Assistant exposes **Use Local Ollama** plus a model selector.
- If Ollama is unreachable, TeXise falls back to the last configured BYOK AI profile when Privacy Mode is off; otherwise it fails closed.
- BF51.1 remote/cloud Ollama model blocking remains mandatory.
- Documentation migration 22 mirrors the Texposit setup flow and custom-model guidance.

## BF51.3 Ollama Cloud
- Ollama Cloud-backed models are selectable when Privacy Mode is off; verified Local Ollama remains available under Privacy Mode.
- AI Settings/Assistant, Review provenance, docs, comparison evidence, migration 23 and browser E2E were updated.
- Server architecture remains browser→user Ollama; no TeXise server Ollama daemon/proxy.

## BF51.4 — Public Change Log CMS — 2026-08-29

### Completed
- Added MySQL-backed `/change-log` page settings and dated Draft/Published change events through migration 24.
- Added public `/api/change-log` returning published events newest-first and resolving the configurable `{{TEXISE_FREE_PLAN_LIMIT}}` token.
- Added `/admin/change-log` with page-copy editing plus dated event create/edit/delete and Draft/Published controls.
- Added administrator audit events for settings update and event create/update/delete operations.
- Added external footer, public search, sitemap, SSR/SEO metadata, substantive initial HTML and production SEO verification for `/change-log`.
- Added the Change log entry to the Admin dashboard/navigation.
- Added BF51.4 app-shell identity `texise-app-shell-r14-28-20-buildfix51-4-v1` and cumulative installer/deployment/release-quality guard wiring.
- Corrected crawler-visible Change log rendering so the Free-plan token resolves identically to the hydrated API path.

### Verification
- BF51.4 focused regression: 5/5 PASS.
- BF50/BF51/BF51.1/BF51.2/BF51.3/BF51.4 cumulative source guards: PASS.
- Public SEO: 21/21 PASS.
- Public sitemap/index: 3/3 PASS.
- SaaS migrations: 2/2 PASS.
- SaaS router: 7/7 PASS.
- Static release audit: 393/393 PASS.
- JS/MJS syntax: 39 changed files PASS.
- Shell syntax: 3 changed scripts PASS.
- TS/TSX transpile syntax: 2/2 PASS.
- Diff whitespace diagnostics: PASS.
- ProjectCompileService remains byte-identical to BF51.3 (`eb2646b07abee000a32182a909b6cdd219318a6b683f32debac217355a7a5d3c`).
- Runtime hardening and R14 broad suites were restored to BF51.3 baseline parity after narrowly updating stale current-release predicates; no BF51.4-specific broad-suite regression remains.

### External production gates
- Provisioned dependency install/custom validation.
- TypeScript 6 `tsgo` workspace checks.
- Biome lint.
- Full unit/integration suite.
- Production build and release browser E2E.
- Production `/change-log` API/SSR/SEO/database smoke test after migration 24.


### BF51.4 Fix 3 — Ollama Local Network Access on demand
- Removed AI Assistant / AI Settings open-time probes of `localhost:11434`.
- Ollama discovery no longer runs during passive app startup, even when Ollama was saved previously. It starts only from explicit **Use Ollama**, provider selection, manual refresh, or an actual AI request while Ollama is already the selected provider.
- Added browser E2E source contract requiring zero Ollama discovery requests before explicit selection.
- Added schema/docs migration 25 and public Change log event describing the permission behavior.
- Change log prerender is paint-guarded until the production SaaS stylesheet is ready, preventing the raw unstyled SSR flash while retaining substantive initial HTML for SEO.
- Preserved Local/Ollama Cloud distinction, Privacy Mode, BYOK outage fallback and user-browser → user-Ollama architecture.
