Skip to content

Workflows first run: Change with PostHog AI edits the email in place #261

Open

Description

@Silthus

Map: Map: build the Workflows first run, from template gallery to first send
Spec: Spec: Workflows first run

Cast: GPT-6.1 Sol (backend and wiring)

Question

Can a user change the open email just by typing into PostHog AI, which is already open beside it, and see the change in the editor?

Delivers end to end. Spec section "Change with PostHog AI". Builds on Make it yours.

  • Open from the start (Michael, 2026-10-05). When Make it yours opens, the PostHog AI side panel opens with it (openSidePanel(SidePanelTab.Max)), with the open email already selected as context, so the user can type a change straight away. No prompt is sent on their behalf; a placeholder or suggestions may show what to ask.
    • Switching to another email updates the context to that email.
    • A user who closes the panel keeps it closed for this session; "Change with PostHog AI" reopens it.
    • Leaving Make it yours does not leave a stale email context behind.
  • Make it yours exposes the email (subject, preheader, text) as scene context, following workflowAgentContext.ts and templateAgentContext.ts.
  • PostHog AI applies a change to the open editor through a frontend-applied tool, following the create_message_template MaxTool (products/workflows/backend/max_tools.py with <MaxTool>). The editor reloads the new design.
  • If the frontend-applied tool path is gone from master, ship the prompt and the scene context only, and record the gap and the reason on this ticket.

Test seams. The backend tool through the test pattern of the existing MaxTools in products/workflows/backend/, with the LLM mocked. A kea logic test: opening Make it yours opens the side panel with the open email as context, switching emails changes the context, the button reopens a closed panel, and the tool's result updates the editor value.

Write scope. products/workflows/backend/max_tools.py and its registration, the first-run folder under products/workflows/frontend/, and tests.
Overlap: the designing-email-templates skill in products/workflows/skills/; read it, do not change it.

Multi-email templates: PostHog AI acts on the email that is open in Make it yours (#260 lists every email of the template). The scene context names which email is open and how many there are.

Acceptance criteria

  • Opening Make it yours opens PostHog AI beside the editor with the open email as context; typing a change updates that email in the editor.

  • The button opens the PostHog AI side panel with a prompt naming the email.

  • Asking for a change (for example, a shorter subject) changes the email in the open editor against a local stack.

  • Screenshots of the screen with the side panel open, at full width and 520px, are on this ticket.

How to build (map #253)

  • /implement + /tdd red-green-refactor, outside-in, at the seams named above. The frontend mocks the API at the HTTP layer. Mock only what is external: the LLM and the PostHog analytics client.
  • Repo skills apply where the diff touches their area: /writing-tests, /improving-drf-endpoints, /writing-ui-components, /writing-kea-logics, /adopting-generated-api-types, /placing-product-frontend-code, /writing-user-facing-copy, /writing-code-comments.
  • Branch from upstream/master, push to the fork, open a draft PR on PostHog/posthog against master. A stacked PR carries its parent's commits and a "Stacked on" note.
  • Then /qa-swarm. Shipped means a draft PR it handed off. Never mark ready, enqueue or merge.
  • Public repo: state sender rules as product rules. Fixture addresses use example.com. The prototype is throwaway: read it for behavior, never copy or cherry-pick it.

Activity

  1. Silthus commented on Oct 5, 2026

    @Silthus
    OwnerAuthor

    Heads-up from map #268: ticket #271 changes the designing-email-templates skill that this ticket reads.

    • references/unlayer-design-json.md gains a "Native blocks and spacing" section: one text block per paragraph, spaced with containerPadding: "8px 24px", text instead of paragraph, and the button link shape values.href = {name: "web", values: {href, target}}.
    • Its minimal example becomes a heading, two paragraphs, a button, and a divider. A new "Editing blocks with operations" section shows how to change the button link and add a spaced paragraph with patch operations.
    • references/design-guidelines.md recommends the native button block instead of a hand-written HTML table button.
    • SKILL.md gains one line that points to the native-block pattern.

    No tool or API behavior changes. The draft PR will be linked from #271.

  2. self-assigned this
    on Oct 5, 2026
  3. Silthus commented on Oct 5, 2026

    @Silthus
    OwnerAuthor

    Runtime: T3 delegated task from conductor thread mcp:53aaf922-c8de-490b-8df2-687a523ef55f (devbox-michaelr-3)
    Worker: impl-261, GPT-6.1 Sol (high reasoning), full access
    Task: node:delegated-task:command%3Amcp%3A3880df84-306b-4346-98c3-53a1a8e2f2d5%3Adelegate-task%3Amap253-impl-261-r1
    Worktree: /home/coder/.t3/worktrees/posthog/fr-261, branch feat/workflows-first-run-ai-edit from feat/workflows-first-run-make-it-yours at a8c22c7ee3f (stacked on PostHog#112053)
    Review: one cross-family review (read-only claude -p --model claude-opus-5-5), per the map's updated rule; this replaces the body's qa-swarm line
    Cap: 4 hours from 17:52 UTC (deadline 21:52 UTC)
    CodeRabbit slot: 1 of 3

  4. Silthus commented on Oct 5, 2026

    @Silthus
    OwnerAuthor

    Note

    🤖 GPT-6.1 Sol responding on behalf of Michael

    Parked with draft PostHog/posthog#112079, stacked on PostHog#112053.
    Final head: d1e0b0f99fd58241e93a0566b1f55df2195cf880.
    Claude Opus 5.5 reviewed 260cca54a035935295b4c434e87efaf65b34bcd0 after the draft opened; the final head contains the checked review fixes.

    Locked so far:

    • Make it yours opens the sandbox AI panel with the selected email, subject, preheader, body, position, and sequence length as context. No prompt is submitted.
    • Switching and committed edits refresh the context. Closing keeps AI closed for the session; the button reopens it and restores a dismissed chip. Leaving removes the context.
    • Another open panel keeps its tab until the explicit AI button. Preflight and runtime availability gate the integration.
    • Plain-text context excludes the old design. Oversized context falls back through HTML and shortened text, with bounded metadata.
    • No workflow or library record is created. No in-place AI edit is implemented.

    Proof bundle: red panel test, green final tests, frontend typecheck/lint/format logs, strict preflight, and the final browser interaction. The local gate and pre-push hook pass. Preflight retains a freshness advisory and complexity warnings. Real LLM behavior and backend sends were not exercised.

    Final scene Screenshot
    Full width
    Exactly 520px

    Claude report and every finding's disposition: M1, M2, M3, M4, L1's already-closed case, and L3 are fixed with focused tests. L4's copy is fixed; extra analytics events are rejected because the specified funnel and existing sidebar events cover this slice. L2's send coordination is rejected as outside this write scope; a chat sent inside the canvas export debounce can still see the previous committed design. Moving AI to the main scene still counts as deliberately closing the panel, per the session rule.

    CodeRabbit was signed out and skipped. The PostHog image uploader denied this account, so the fake-data proof is on the fork assets branch. GitHub also denied assigning the upstream PR; this ticket remains assigned to Silthus. The conductor owns the parent stack's inherited upstream conflicts and freshness.

    The gap is a scope decision. MaxTool still exists on master, but only in frozen LangGraph. The current sandbox tools update saved entities, so they cannot apply changes to this unsaved email. The integration guide says “No new useMaxTool registrations.” The brief permits context-only fallback only if that path is gone; it is still present, so this draft does not satisfy that literal exception or the editor-update criterion.

    Pending question: Should #261 accept this sandbox panel/context-only draft and move in-place unsaved-email editing to a separate MCP slice? Recommended: yes, keep the flag off, and have the conductor graduate the apply-back capability as its own slice. The ticket stays open until that scope decision.

  5. Silthus commented on Oct 5, 2026

    @Silthus
    OwnerAuthor

    Conductor surfaced the pending scope question to Michael in the conductor thread.

  6. Silthus commented on Oct 6, 2026

    @Silthus
    OwnerAuthor

    Michael's answer (2026-10-06): not accepted as context only. PostHog AI live-editing the email is the core of this ticket, not a follow-up, and it must not ship broken.

    wayfinder:awaiting-human cleared; the ticket stays open and assigned.

  7. Silthus commented on Oct 6, 2026

    @Silthus
    OwnerAuthor

    Note

    🤖 Claude Opus 5.5 responding on behalf of Michael

    The live-edit work now has its own map: Map: PostHog AI live-edits the open email in every Workflows email editor, charted with Michael on 2026-10-06.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions