Repository navigation
Description
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/:
DraftWithAiButton.tsx— modal +POST /campaigns/:id/ai-dm/draftusePageHeaderDraftWithAi.tsx— wires the button intoPageHeaderoverflow/secondary actions (Responsive page headers: preserve hierarchy and 44px touch targets on mobile #707)useDraftWithAiAvailable.ts— self-gates on DM + enabled AI-DM seat (co_dm/driver)
Expected behavior
Parity with other world-building surfaces:
- 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).
- 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
CoDmDraftTargetwithtimeline_event(ortimeline). - Add
timeline_eventtoProposableEntityType+ proposal create/update schemas. CoDmService: map target →timeline_evententity type; validate againstTimelineEventCreate; supportcountfor batch drafts (likenpc).DraftWithAiButton: addTARGET_*copy for timeline; wireTimelinePageheader (mirrorStorylinesPageinline button orusePageHeaderDraftWithAi).- Extend
draft_contentMCP tool description/enum. - E2E: follow
apps/web/e2e/tests/storylines-draft-affordance.spec.ts/ai-dialog-accessibility.spec.tspatterns.
Phase 2 — edit-with-AI (per event)
- Co-DM endpoint (or draft variant) that files an
updateproposal withentityIdset, pre-filled snapshot from the open event, and AI-generated delta inpayload(today Co-DM only filescreateproposals). - UI: button in the timeline event edit form (
EventForm/ edit toolbar inTimelinePage.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
- Co-DM: 'Draft with AI' entry points on authoring surfaces + AI attribution in the proposals queue #341 — Co-DM "Draft with AI" entry points on authoring surfaces (timeline was missed)
- Co-DM authoring via the approval queue: AI-generated NPCs, encounters, maps, story beats, recaps — always proposals #313 — Co-DM authoring via approval queue
- IA: 'Draft a beat with AI' lives on Quests, but beats belong to Storylines — misplaced and Storylines has no draft affordance #639 — precedent for placing draft affordance on the surface that owns the entity type (Storylines/beats)
- The MCP/AI surface, campaign summary, and proposal paths never caught up to the v0.6/0.7 systems (inventory, timeline, discussion, scheduling) #257 — MCP timeline tools exist; proposal/draft path still incomplete for timeline
- Storylines: AI 'Draft a beat' files a quest proposal, not a story beat #1307 — related mismatch where beat drafts file as quest proposals (watch for similar entity-type mapping decisions)
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_eventcreate 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_contentMCP tool acceptstimeline_eventtarget. - Accessibility: dialog focus trap, aria labels match AI drafting and mode disclosures: fix modal, popover, focus, and control accessibility #812 patterns.
Activity
AwsomeFox commentedon Aug 11, 2026
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-draftingBranch:
codex/backlog-1310-timeline-ai-draftingPR: #2207
Latest head:
ed0cf8211Plan
codex/backlog-1310-timeline-ai-draftingCoDmDraftTargetto includetimeline_eventin@campfire/schematimeline_eventtoProposableEntityTypeand proposal schemas in@campfire/schema&ProposalsServiceCoDmServiceto supporttimeline_eventdraft generation and proposal filingTimelinePageheaderAcceptance criteria
CoDmDraftTargetsupportstimeline_eventTimelinePageheadertimeline_eventproposals in the approval queueValidation
npm run test -w apps/server/npm run test:component -w apps/webnpm run lint && npm run typecheckReview
Notes
Blocker
feat(ai): add Co-DM 'Draft with AI' and per-event edit affordance for…