chore: add planning notes for brand kit and agent starter work

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 22:19:28 +08:00
parent 71a1b3ace4
commit 59f2b02458
3 changed files with 142 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
# Task Plan: Server-Backed Brand Kit Canvas Context
## Goal
Persist Brand Kits by authenticated user, bind one optional Brand Kit to each project/canvas, expose a canvas-header selector, and make every Agent Chat turn and newly created thread use the selected kit as authoritative creative context.
## Current Phase
Phase 5
## Phases
### Phase 1: Architecture Discovery
- [x] Map Brand Kit frontend state, project persistence, chat/thread creation, and generation context flow
- [x] Confirm API generation, storage-driver, schema, and test patterns
- **Status:** complete
### Phase 2: API and Domain Design
- [x] Update the `.api` contract before generated code
- [x] Define user-owned Brand Kit storage and project binding invariants
- [x] Define server-side prompt injection behavior for all project chat sessions
- **Status:** complete
### Phase 3: Backend Implementation
- [x] Generate handlers/types from the validated API specification
- [x] Implement memory and PostgreSQL Brand Kit persistence keyed by user ID
- [x] Persist and expose project `brandKitId`
- [x] Inject selected Brand Kit into Agent Chat and new-thread context
- [x] Add backend tests and API documentation
- **Status:** complete
### Phase 4: Frontend Integration
- [x] Replace local-only Brand Kit persistence with authenticated API persistence
- [x] Add canvas-title Brand Kit selector with None and user-owned kits
- [x] Add a Brand Kit selector to the Home prompt composer, including an empty create action
- [x] Keep Brand Kit editor, defaults, and project binding synchronized
- **Status:** complete
### Phase 5: Verification
- [x] Run API validation, generation checks, Go tests/build, frontend typecheck/build
- [ ] Verify CRUD, user isolation, project binding, chat context, and selector behavior
- [ ] Inspect desktop and mobile browser layouts
- **Status:** in_progress
### Phase 6: Delivery
- [ ] Review scope, generated files, and prohibited product references
- [ ] Provide preview URL and concise implementation notes
- **Status:** pending
## Invariants
- Brand Kits are owned and queried only through the authenticated user ID from request context.
- A project may reference zero or one Brand Kit owned by the same user.
- Selecting None clears the binding without deleting the Brand Kit.
- Server-side Agent Chat context is derived from the persisted project binding, never trusted from a client-supplied prompt.
- Home may request a Brand Kit ID only from the authenticated user's list; the server revalidates ownership before binding it.
- Deleting a Brand Kit clears project bindings to it.
## Errors Encountered
| Error | Attempt | Resolution |
|-------|---------|------------|
| zsh rejected an unmatched `HomePage/*.css` glob | 1 | Replaced the glob with explicit files discovered via `rg --files`. |
| Assumed `CanvasWorkspace/index.css`, which does not exist | 1 | Locate the workspace stylesheet from its imports before reading it. |
| `rg` treated a pattern beginning with `-- name:` as a flag | 1 | Use `rg -- <pattern>` when searching SQLC query annotations. |
| Assumed `AuthProvider.tsx` instead of the component directory entry | 1 | Locate the file with `rg --files` before any further auth-provider reads. |
| PostgreSQL package test failed after adding project mapping because text conversion helpers were not yet defined | 1 | Add nullable `pgtype.Text` conversion helpers and rerun the package tests. |
| One patch to remove a temporary `err = nil` line used the wrong surrounding field name | 1 | Reapplied the patch against the exact current lines; no code change was lost. |
| Workspace import patch assumed a nonexistent `BrandMark` import | 1 | Located the actual import block and applied the selector change against current source. |
| First i18n patch used an inexact Chinese source string | 1 | Re-read the locale file and patched the exact key/value context. |