"version": 1,
"timestamp": "2026-04-09T19:05:16Z",
"hash": "sha256:a44c513a4a934748deb220fdf59a86fffb739e8e9b48f4a377a2d63b6273c4e7",
"questions": [
"Should clicking a shot group label select all its clips (replacing current selection), or should it toggle/add to existing selection (shift-click behavior)?",
"Should the agent system prompt explicitly instruct the LLM to prefer same-shot operations when all selected clips share a shot, or is the structured context sufficient for the LLM to infer this?",
"For the 'place-after-selected' part of the duplicate workflow \u2014 should the agent automatically place the duplicated clip after the last clip in the same shot group, or after the specific selected clip? (These differ when a shot has multiple clips and only one is selected.)"
],
"success_criteria": [
{
"criterion": "describeTimeline() output includes a 'Shot groups:' section listing each pinned shot group with shotId, shotName, trackId, clipIds, and mode when pinnedShotGroups exist in config",
"priority": "must"
},
{
"criterion": "Each clip line in describeTimeline() includes shot= when the clip belongs to a pinned shot group",
"priority": "must"
},
{
"criterion": "SelectedClipPayload accepts optional shot_id and shot_name fields without breaking existing consumers",
"priority": "must"
},
{
"criterion": "buildSelectedClipsPrompt() includes shot info in selected clip lines when shot_id/shot_name are present",
"priority": "must"
},
{
"criterion": "Clicking a shot group label in the timeline selects all clips in that group",
"priority": "must"
},
{
"criterion": "Frontend agent invocation payload includes shot_id and shot_name for clips that belong to pinned shot groups",
"priority": "must"
},
{
"criterion": "executeDuplicateGeneration() uses shot_id from selectedClips when available, skipping the findShotForGenerations DB lookup",
"priority": "must"
},
{
"criterion": "All existing tests in supabase/functions/ai-timeline-agent/ continue to pass",
"priority": "must"
},
{
"criterion": "New unit tests cover: describeTimeline with/without shot groups, buildSelectedClipsPrompt with shot context, duplicate-generation with shot_id from payload",
"priority": "must"
},
{
"criterion": "New frontend test covers shot group click-to-select in TimelineCanvas",
"priority": "should"
},
{
"criterion": "System prompt mentions shot context guidance for the LLM",
"priority": "should"
},
{
"criterion": "No new files exceed ~300 lines",
"priority": "should"
},
{
"criterion": "Manual smoke test: select shot group \u2192 send agent message \u2192 verify agent response references the shot context",
"priority": "info"
}
],
"assumptions": [
"Single-click on a shot group label selects all clips in that group, replacing the current selection. Shift-click would add to selection.",
"Shot names are available from the pinnedShotGroups config + a shots lookup (already done in useShotGroups). The agent-side can resolve names from the DB if not passed from the frontend.",
"The existing SelectedClipPayload type is shared between frontend and edge function \u2014 adding optional fields is backwards-compatible.",
"The describeTimeline() function currently receives only config and registry. Adding pinnedShotGroups info requires no signature change since pinnedShotGroups is already part of TimelineConfig.",
"The duplicate/edit/place workflow described in the system prompt (prompts.ts:154-158) does not need new tools \u2014 it needs better context so the existing tools work reliably with shot semantics.",
"Tests will use Vitest (already configured in the project) and follow existing test patterns in loop.test.ts and tool-calls.test.ts."
],
"structure_warnings": []
}
"passed": false,
"criteria_check": {
"count": 13,
"items": [
{
"criterion": "describeTimeline() output includes a 'Shot groups:' section listing each pinned shot group with shotId, shotName, trackId, clipIds, and mode when pinnedShotGroups exist in config",
"priority": "must"
},
{
"criterion": "Each clip line in describeTimeline() includes shot= when the clip belongs to a pinned shot group",
"priority": "must"
},
{
"criterion": "SelectedClipPayload accepts optional shot_id and shot_name fields without breaking existing consumers",
"priority": "must"
},
{
"criterion": "buildSelectedClipsPrompt() includes shot info in selected clip lines when shot_id/shot_name are present",
"priority": "must"
},
{
"criterion": "Clicking a shot group label in the timeline selects all clips in that group",
"priority": "must"
},
{
"criterion": "Frontend agent invocation payload includes shot_id and shot_name for clips that belong to pinned shot groups",
"priority": "must"
},
{
"criterion": "executeDuplicateGeneration() uses shot_id from selectedClips when available, skipping the findShotForGenerations DB lookup",
"priority": "must"
},
{
"criterion": "All existing tests in supabase/functions/ai-timeline-agent/ continue to pass",
"priority": "must"
},
{
"criterion": "New unit tests cover: describeTimeline with/without shot groups, buildSelectedClipsPrompt with shot context, duplicate-generation with shot_id from payload",
"priority": "must"
},
{
"criterion": "New frontend test covers shot group click-to-select in TimelineCanvas",
"priority": "should"
},
{
"criterion": "System prompt mentions shot context guidance for the LLM",
"priority": "should"
},
{
"criterion": "No new files exceed ~300 lines",
"priority": "should"
},
{
"criterion": "Manual smoke test: select shot group \u2192 send agent message \u2192 verify agent response references the shot context",
"priority": "info"
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Timeline summary context: the plan assumes backend timeline config already carries shot names, but pinnedShotGroups only stores shotId/trackId/clipIds/mode, so describeTimeline() cannot emit shot names without an additional shot lookup or a widened input contract.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Checked /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/types/index.ts and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/hooks/useShotGroups.ts; shot names are resolved from separate shots data, not from timeline config.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-002",
"concern": "Selected-clip payload plumbing: Recurring debt: the plan updates some payload types but misses the stored attachment path, so shot_id/shot_name would be dropped by AgentChat send mapping and by attachment persistence/recovery across turns.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Checked /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/components/AgentChat/AgentChat.tsx, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/hooks/useAgentSession.ts, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/types/agent-session.ts, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/loop.ts, and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/selectedClips.ts.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-003",
"concern": "Same-shot semantics: the plan only applies direct shot_id to duplicate_generation, but shot resolution for travel defaults, active references, task shot reuse, and video-travel LoRAs still goes through findShotForGenerations(), so the feature remains only partially first-class.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Checked /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/loop.ts, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts, and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/tools/loras.ts.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
}
],
"recommendation": "ITERATE",
"rationale": "The repo state does not support executing this plan as written. FLAG-001 is real: PinnedShotGroup only carries shotId, trackId, clipIds, and mode in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/types/index.ts, while shot names are resolved separately in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/hooks/useShotGroups.ts; backend describeTimeline() currently only receives config and registry in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/tools/timeline.ts, so emitting shot names needs an explicit lookup/map and also needs the view_timeline tool path updated. FLAG-002 is also real: shot metadata would be dropped unless the plan updates both immediate send mapping in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/hooks/useAgentSession.ts and stored attachment persistence/recovery in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/loop.ts, plus the shared attachment types in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/types/agent-session.ts. FLAG-003 remains material because same-shot resolution is still derived from findShotForGenerations() in the main loop, create-task flow, and LoRA flow, not just duplicate-generation. The plan is also stale on frontend selection: single-click shot-group selection and its canvas test already exist in /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineCanvas.tsx and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineCanvas.test.tsx. Revise the plan before execution.",
"signals_assessment": "Weighted score is 5.0 on iteration 1 with clean preflight posture: project exists, is writable, and required tooling is available. There is no negative trajectory yet, but all three significant flags remain open and the current repository evidence confirms them rather than weakening them. The main risk is not environmental blockage; it is plan incompleteness and drift from current code.",
"warnings": [
"TimelineCanvas already single-click selects shot-group clips and already has coverage for that behavior; adding a new onShotGroupSelect prop would likely duplicate existing behavior.",
"If backend timeline summaries need shot names, the revision must account for both prompt construction and the runtime view_timeline tool handler, not just the loop-time summary.",
"Same-shot semantics should be centralized around selected clip shot metadata or a shared resolver; patching only duplicate_generation leaves runAgentLoop, create-task, and set_lora inconsistent."
],
"settled_decisions": [
{
"id": "SD-001",
"decision": "Reuse the existing shot-group selection path instead of adding a new canvas callback.",
"rationale": "TimelineCanvas already calls onSelectClips(group.clipIds) on shot-group label click, and there is already a test asserting that behavior."
},
{
"id": "SD-002",
"decision": "Treat shot names as external data that must be supplied to backend timeline description explicitly.",
"rationale": "TimelineConfig.pinnedShotGroups does not include shot names; backend summary code cannot infer them without a lookup or widened contract."
},
{
"id": "SD-003",
"decision": "Plumb shot metadata through both transient request payloads and persisted chat attachments.",
"rationale": "Agent continuation recovers selected clips from stored user-turn attachments, so updating only the invoke body would lose shot_id/shot_name across turns."
}
],
"override_forced": false,
"orchestrator_guidance": "First iteration; follow gate recommendation: ITERATE. Verify unresolved flags against the plan and project code before accepting.",
"robustness": "standard",
"signals": {
"iteration": 1,
"idea": "Implement first-class shot selection and structured timeline context for the video editor agent: single-click shot-group selection, agent payloads with shot and clip timeline metadata, reliable same-shot semantics, and a duplicate/edit/place-after-selected workflow with tests.",
"significant_flags": 3,
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Timeline summary context: the plan assumes backend timeline config already carries shot names, but pinnedShotGroups only stores shotId/trackId/clipIds/mode, so describeTimeline() cannot emit shot names without an additional shot lookup or a widened input contract.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-002",
"concern": "Selected-clip payload plumbing: Recurring debt: the plan updates some payload types but misses the stored attachment path, so shot_id/shot_name would be dropped by AgentChat send mapping and by attachment persistence/recovery across turns.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-003",
"concern": "Same-shot semantics: the plan only applies direct shot_id to duplicate_generation, but shot resolution for travel defaults, active references, task shot reuse, and video-travel LoRAs still goes through findShotForGenerations(), so the feature remains only partially first-class.",
"category": "completeness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [],
"weighted_score": 5.0,
"weighted_history": [],
"plan_delta_from_previous": null,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 1. Weighted score trajectory: 5.0. Plan deltas: n/a. Recurring critiques: 0. Resolved flags: 0. Open significant flags: 3.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"flag_resolutions": [],
"resolved_flag_ids": [],
"resolution_summary": ""
}
{
"id": "FLAG-001",
"severity": "significant",
"status": "open",
"concern": "Timeline summary context: the plan assumes backend timeline config already carries shot names, but pinnedShotGroups only stores shotId/trackId/clipIds/mode, so describeTimeline() cannot emit shot names without an additional shot lookup or a widened input contract.",
"evidence": "Checked /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/types/index.ts and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/hooks/useShotGroups.ts; shot names are resolved from separate shots data, not from timeline config."
},
{
"id": "FLAG-002",
"severity": "significant",
"status": "open",
"concern": "Selected-clip payload plumbing: Recurring debt: the plan updates some payload types but misses the stored attachment path, so shot_id/shot_name would be dropped by AgentChat send mapping and by attachment persistence/recovery across turns.",
"evidence": "Checked /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/components/AgentChat/AgentChat.tsx, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/hooks/useAgentSession.ts, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/src/tools/video-editor/types/agent-session.ts, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/loop.ts, and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/selectedClips.ts."
},
{
"id": "FLAG-003",
"severity": "significant",
"status": "open",
"concern": "Same-shot semantics: the plan only applies direct shot_id to duplicate_generation, but shot resolution for travel defaults, active references, task shot reuse, and video-travel LoRAs still goes through findShotForGenerations(), so the feature remains only partially first-class.",
"evidence": "Checked /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/loop.ts, /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/tools/create-task.ts, and /Users/user_c042661f/Documents/reigh-workspace/reigh-app/supabase/functions/ai-timeline-agent/tools/loras.ts."
}
]