This document is the short operational memory for ExplainFlow. It describes the current architecture, where Gemini is used, and the constraints that matter for demos and deployments.
ExplainFlow has two user-facing paths:
-
Advanced Studio
- Extract a structured content signal from source text or source assets.
- Build a script pack and stream scene generation over SSE.
- Attach claim refs, evidence refs, and source media to the generated scenes.
-
Quick
- Build a lightweight four-block artifact quickly.
- Optionally derive a Proof Reel from those blocks.
- Keep latency low and avoid heavy replanning passes.
Current defaults are intentionally split by job type:
gemini-3.1-pro-preview- structural extraction
- heavier planning and review
gemini-3-flash-preview- fast text-heavy Quick paths
- source normalization and lighter precompute work
gemini-3-pro-image-preview- image generation and interleaved multimodal scene/image output
Do not rename model IDs casually. Quota availability and behavior vary by project. Validate changes against the actual project quotas before switching defaults.
True mixed text+image generation is supported, but long first-token latency can break browser and proxy timeouts. The practical pattern is:
- plan first
- generate scene by scene
- stream partial progress early
If streaming appears broken, verify infrastructure timeouts before assuming the generation code is wrong.
- Scene narration must be raw spoken copy, not markdown or assistant framing.
- Structured extraction should stay JSON-first.
- Claim refs and evidence refs are part of the product, not just debug metadata.
- Quick overrides should stay deterministic and local unless explicitly upgrading the UX.
The product value is not only generation quality. It is also proof:
- extract grounded claims and evidence
- propagate refs into artifacts and scenes
- surface those refs in the UI
- reuse them in Proof Reel selection
Any refactor that makes outputs prettier but weakens traceability is a regression.
- Cloud Run and similar environments need timeout headroom for streaming generation.
- Gemini quotas differ sharply across projects and billing setups.
- Large source uploads need guardrails; transcript-backed video is the safest current demo path.
- Prefer centralized model constants over scattered hardcoded model IDs.
- Prefer shared frontend API base configuration over inline localhost URLs.
- Keep repo-facing docs aligned with the actual shipped architecture.
This repo uses two different remotes:
fork= personal working repo (ExplainFlow-local)origin= canonical repo (ExplainFlow)
Default rule:
- Do normal feature work on
codex/*branches and push tofork. - Do not assume a push to
forkupdatesorigin/main.
Before saying a change is “on main”, verify:
git fetch origingit log --oneline origin/main -n 1
When a commit from a fork branch must be applied to origin/main:
- Do not switch the shared working tree to
main. - Do not touch
.obsidian/workspace.json. - Do not use
git reset --hard,git clean -fdx, orrmto solve branch-switch issues. - Use a separate detached worktree from
origin/main.
Recommended pattern:
git worktree add --detach /tmp/explainflow-main-merge origin/main
cd /tmp/explainflow-main-merge
git cherry-pick <commit-sha>
git push origin HEAD:mainGCP Project: explainflow
- Canonical Location:
us-central1(Registry and Deployment). - Artifact Registry Host:
us-central1-docker.pkg.dev - Image URLs:
us-central1-docker.pkg.dev/explainflow/explainflow-repo/explainflow-api:latestus-central1-docker.pkg.dev/explainflow/explainflow-repo/explainflow-web:latest
- Aligned Files: Both
cloudbuild.yamlandterraform/main.tfare standardized on these URLs.
- Registry Hygiene: Do not reintroduce
us-docker.pkg.devreferences. The oldusrepository has been deleted; onlyus-central1is canonical. - Infrastructure Constraints: Cloud Run timeouts must remain at 300s (mandated for multimodal streaming).
- Secrets: Use Secret Manager (
explainflow-gemini-api-key) for runtime keys; do not commit secrets to code or.envfiles in production. - Verification: Always verify that image URLs in
cloudbuild.yamlandterraform/main.tfmatch before any deployment automation.