Skip to content

Timeline: add Co-DM 'Draft with AI' and per-event AI edit affordances #1310

Closed

Description

@AwsomeFox

Current state

The Timeline page (/c/:campaignId/timeline, apps/web/src/features/timeline/TimelinePage.tsx) supports full manual authoring — calendar editing, create/edit/delete in-world events, revision history, and visibility controls — but has no AI drafting affordances.

  • Page header: only "+ New event"; no "Draft with AI" button.
  • Event rows: only Edit / Delete in the edit form; no AI assist when editing an existing event's title, body, dates, or DM secret.
  • Timeline events are otherwise first-class: revision history (timeline_event), MCP CRUD tools (create_timeline_event, update_timeline_event, …), and search indexing all exist.

Meanwhile, peer authoring surfaces gained Co-DM draft entry points in #341 / #313:

Surface UI pattern Co-DM target
NPCs list usePageHeaderDraftWithAi → PageHeader secondary action npc
Locations list same location
Encounters list same encounter
Sessions list same (Draft a recap with AI) recap
Storylines inline DraftWithAiButton (#639) beat
Map panel inline DraftWithAiButton map
Timeline none not supported

Shared UI components live under apps/web/src/features/ai-dm/:

Expected behavior

Parity with other world-building surfaces:

  1. Page-level draft: A "Draft a timeline event with AI" (or generic "Draft with AI") button on the Timeline page header, self-gated like other surfaces. The AI drafts structured timeline event content and files it as a pending proposal for DM review — nothing writes to canon directly (Co-DM authoring via the approval queue: AI-generated NPCs, encounters, maps, story beats, recaps — always proposals #313).
  2. Per-event edit assist: When a DM opens Edit on an existing timeline event, an "Edit with AI" affordance (e.g. beside Save/Cancel) that sends the current event context + a brief to the co-DM and files an update proposal against that event — same approval-queue safety model.

Backend gaps (why this doesn't work today even if you drop in the button)

CoDmDraftTarget (packages/schema/src/index.ts) only allows:
npc | location | beat | recap | encounter | map | quest | faction — no timeline / timeline_event.

ProposableEntityType (apps/server/src/modules/proposals/proposal-records.service.ts) likewise omits timeline_event:
quest, npc, location, session, character, encounter, map, faction.

CoDmService (apps/server/src/modules/ai-dm/co-dm.service.ts) has per-target JSON shapes and validation in DRAFT_JSON_SHAPE / validate() — timeline is absent. The draft_content MCP tool mirrors the same enum.

Issue #257 (closed) added MCP timeline CRUD and calendar reads, but the Co-DM draft + proposal path for timeline was never wired. Timeline events use TimelineEventCreate / TimelineEventUpdate schemas (packages/schema/src/index.ts).

Suggested implementation sketch

Phase 1 — create drafts (page header)

  • Extend CoDmDraftTarget with timeline_event (or timeline).
  • Add timeline_event to ProposableEntityType + proposal create/update schemas.
  • CoDmService: map target → timeline_event entity type; validate against TimelineEventCreate; support count for batch drafts (like npc).
  • DraftWithAiButton: add TARGET_* copy for timeline; wire TimelinePage header (mirror StorylinesPage inline button or usePageHeaderDraftWithAi).
  • Extend draft_content MCP tool description/enum.
  • E2E: follow apps/web/e2e/tests/storylines-draft-affordance.spec.ts / ai-dialog-accessibility.spec.ts patterns.

Phase 2 — edit-with-AI (per event)

  • Co-DM endpoint (or draft variant) that files an update proposal with entityId set, pre-filled snapshot from the open event, and AI-generated delta in payload (today Co-DM only files create proposals).
  • UI: button in the timeline event edit form (EventForm / edit toolbar in TimelinePage.tsx), passing event id + current draft fields as context.
  • Proposal review UI (Proposal review UX: use labeled schema-driven editors with associated errors and preview #769) may need timeline-specific field labels.

Related issues

Test plan

  • With AI-DM seat enabled (co_dm mode), Timeline page shows gated "Draft with AI" button; hidden when seat off or user is not DM.
  • Drafting files one or more pending timeline_event create proposals; approving applies a new event; rejecting does not.
  • Edit-with-AI on an open event files an update proposal with correct before/after snapshot.
  • draft_content MCP tool accepts timeline_event target.
  • Accessibility: dialog focus trap, aria labels match AI drafting and mode disclosures: fix modal, popover, focus, and control accessibility #812 patterns.

Activity

  1. added
    enhancement
    theme: ai
    persona-audit
    complexity: XL
    priority: P3 low
    on Jul 24, 2026
  2. AwsomeFox commented on Aug 11, 2026

    @AwsomeFox
    OwnerAuthor

    Agent Workpad

    State: IN_PROGRESS
    Tool: codex
    Run ID: codex-20260810T212020Z-deliver
    Claim comment ID: 5248407357
    Claimed at: 2026-08-11T02:44:10Z
    Lease until: 2026-08-11T04:14:10Z
    Worker: coordinator
    Worktree: isolated worktree codex/backlog-1310-timeline-ai-drafting
    Branch: codex/backlog-1310-timeline-ai-drafting
    PR: #2207
    Latest head: ed0cf8211

    Plan

    • Create branch codex/backlog-1310-timeline-ai-drafting
    • Extend CoDmDraftTarget to include timeline_event in @campfire/schema
    • Add timeline_event to ProposableEntityType and proposal schemas in @campfire/schema & ProposalsService
    • Extend CoDmService to support timeline_event draft generation and proposal filing
    • Add "Draft with AI" button to TimelinePage header
    • Add unit, server, and component tests for timeline event AI drafting and proposals
    • Create PR and complete CI & review loops

    Acceptance criteria

    • CoDmDraftTarget supports timeline_event
    • DM can draft timeline events with AI from TimelinePage header
    • Drafted timeline events file as pending timeline_event proposals in the approval queue
    • All local tests and linters pass cleanly

    Validation

    • npm run test -w apps/server / npm run test:component -w apps/web
    • npm run lint && npm run typecheck

    Review

    • Complete feedback sweep
    • Reply to every substantive comment
    • Resolve addressed threads
    • Confirm no requested changes remain

    Notes

    Blocker

    • None
  3. added
    agent: claimed
    agent: codex
    on Aug 11, 2026
  4. removed
    agent: codex
    agent: claimed
    on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: XLenhancementpersona-auditpriority: P3 lowtheme: ai

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions