@@ -104,7 +104,8 @@ if (hasHandoffSpec) {
104104 if (specMatch) {
105105 handoffSpec = JSON .parse (specMatch[1 ])
106106 // handoffSpec contains: { source, session_id, session_folder, summary,
107- // implementation_scope[], code_anchors[], key_files[], key_findings[], decision_context[] }
107+ // implementation_scope[], code_anchors[], key_files[], key_findings[], decision_context[],
108+ // exploration_artifacts: { exploration_codebase, explorations, perspectives, research, deep_dives[] } }
108109 // implementation_scope[]: { objective, rationale, priority, target_files[], acceptance_criteria[], change_summary }
109110 console .log (` [Handoff] From ${ handoffSpec .source } session ${ handoffSpec .session_id } ` )
110111 console .log (` [Handoff] ${ handoffSpec .implementation_scope .length } scoped items with acceptance criteria` )
@@ -124,8 +125,47 @@ needsExploration = workflowPreferences.forceExplore ? true
124125 task .modifies_existing_code )
125126
126127if (! needsExploration) {
127- // manifest absent; LP-Phase 3 loads with safe fallback
128- // If handoffSpec exists, it provides pre-scoped implementation context
128+ // Bridge: Build manifest from analyze session's exploration artifacts
129+ if (isAnalysisSource && handoffSpec? .exploration_artifacts ) {
130+ const artifacts = handoffSpec .exploration_artifacts
131+ const explorationEntries = []
132+ let idx = 1
133+ const artifactMapping = [
134+ { key: ' exploration_codebase' , angle: ' codebase-discovery' },
135+ { key: ' explorations' , angle: ' analysis-findings' },
136+ { key: ' perspectives' , angle: ' multi-perspective' },
137+ { key: ' research' , angle: ' external-research' }
138+ ]
139+ artifactMapping .forEach (({ key, angle }) => {
140+ if (artifacts[key] && file_exists (artifacts[key])) {
141+ explorationEntries .push ({
142+ angle, file: artifacts[key].split (' /' ).pop (),
143+ path: artifacts[key], source_schema: ' analyze' , index: idx++
144+ })
145+ }
146+ })
147+ if (artifacts .deep_dives ? .length > 0 ) {
148+ artifacts .deep_dives .forEach (divePath => {
149+ if (file_exists (divePath)) {
150+ const name = divePath .match (/ explorations\/ (. + )\. json$ / )? .[1 ] || ` deep-dive-${ idx} `
151+ explorationEntries .push ({
152+ angle: name, file: ` ${ name} .json` ,
153+ path: divePath, source_schema: ' analyze' , index: idx++
154+ })
155+ }
156+ })
157+ }
158+ if (explorationEntries .length > 0 ) {
159+ Write (` ${ sessionFolder} /explorations-manifest.json` , JSON .stringify ({
160+ session_id: sessionId, task_description, timestamp: getUtc8ISOString (),
161+ complexity, exploration_count: explorationEntries .length ,
162+ source: ' analyze-with-file' , source_session: handoffSpec .session_id ,
163+ explorations: explorationEntries
164+ }, null , 2 ))
165+ console .log (` [Analyze Bridge] ${ explorationEntries .length } artifacts from ${ handoffSpec .session_id } ` )
166+ }
167+ }
168+ // If no manifest built; LP-Phase 3 loads with safe fallback
129169 proceed_to_next_phase ()
130170}
131171` ` `
0 commit comments