# Progress: Brand Description Prompt Context ## 2026-07-10 - Read the file-planning workflow and preserved the shared planning files. - Captured the screenshot requirement and initialized isolated task records. - Confirmed brand description is required, persisted, and already consumed by question-expansion but not visibly centralized for article generation. - Confirmed the brand context query shape and selected queue-time snapshotting as the reproducibility boundary to evaluate against each generation path. - Mapped the four article-body paths and confirmed regeneration preserves original task snapshots. - Confirmed descriptions are unbounded and selected deterministic extractive compaction over per-generation LLM summarization. - Located template and imitation snapshot insertion points immediately before task JSON serialization. - Located custom and KOL snapshot insertion points and confirmed scheduled generation reuses them. - Chosen safe insertion positions for all four prompt builders so brand data cannot trail or override output rules. - Measured production description lengths and selected a 2000-rune hard cap that leaves all current descriptions untouched. - Added brand-profile-over-RAG precedence to the design because real source data currently conflicts. - Completed trace/budget phase and moved to regression tests with a structured snapshot plus existing fact-guard reuse. - Located the current template prompt tests and confirmed new tests are needed for the other three builders. - Added red tests for short passthrough, long extractive compaction, late numeric facts, snapshot fallback, brand-over-RAG precedence, and all four prompt placements. - Focused red run failed only on the intentionally undefined brand-context contract and KOL builder. - Implemented shared loading, deterministic compaction, prompt rendering, structured snapshots, old-task fallback, and brand-first fact merging. - Wired template, custom, imitation, and KOL enqueue/execution paths. - Focused regression suite passed for both tenant app and generation worker. - Completed first scoped diff review and identified numeral classification, oversized-segment efficiency, and repair-prompt wording follow-ups. - Added focused regression assertions for Chinese-numeral classification and brand-aware repair-prompt wording; red verification is next. - Confirmed both new assertions fail against the old behavior, then implemented unit-qualified Chinese numerals, linear oversized-segment counting, and brand-aware fact-repair wording. - Integration review identified an unbounded fact-constraint appendix for adversarially long descriptions; a whole-section budget regression test and focal-brand filtering are next. - Added regression coverage for guaranteed opening retention, focal-brand-only fact constraints, and a hard maximum for the complete rendered brand section; red verification is next. - Centralized metadata, description, fact-count, and whole-section budgets; fact constraints are now focal-brand-only and the opening segment is reserved before priority filling. - Added a current-brand attribution regression for generic founding phrases; normal package verification is waiting for the concurrent media-favorites interface edit to settle. - Reworked brand fact extraction to bind generic self-references directly to the current brand and reject facts whose explicit company subject is different. - Concurrent media-favorites code settled; the complete focused brand suite now passes in both tenant app and KOL worker packages. - Added an oversized legacy-snapshot regression to enforce the 4096-rune rendered-section ceiling after normalization. - Passed complete tests for `internal/tenant/app`, `internal/worker/generate`, and `internal/tenant/prompts`. - Passed `go vet -tests=false` for all affected production packages. - Passed the full server suite with `go test ./... -count=1`. - Completed scoped diff, whitespace, and temporary-debug-marker checks. ## Test Results | Test | Expected | Actual | Status | |------|----------|--------|--------| | Brand prompt red suite | Fail before implementation | Undefined shared context/merge/builder symbols | Expected fail | | Brand prompt focused green suite | All compaction/snapshot/precedence/order tests pass | Both packages `ok` | Pass | | Chinese numeral and repair wording red suite | Fail against broad numeral match and old wording | Both targeted assertions failed | Expected fail | | Chinese numeral and repair wording green suite | Both targeted assertions pass | Tenant app package `ok` | Pass | | Opening/fact-bound red suite | Expose eviction and unrelated fact growth | Ordinary package build was blocked by concurrent media-favorites test referencing a missing method | External blocker; use isolated verification and retry later | | Final focused brand suite | All brand compaction/snapshot/precedence/order tests pass | Tenant app and KOL worker packages `ok` | Pass | | Affected package suites | All tests pass | Tenant app, KOL worker, and tenant prompts `ok` | Pass | | Production vet | No findings | Passed | Pass | | Full server suite | All packages pass | `go test ./... -count=1` passed | Pass | ## Next - No implementation work remains for persisted article-body generation.