@@ -153,6 +153,27 @@ If DeepWiki is available (`deepwiki_feature_to_symbol_index` exists in doc-index
153153
154154** Graceful degradation** : If DeepWiki unavailable → log warning → skip symbol injection → continue flow.
155155
156+ ### Phase 1.8: Persist Doc Context Package
157+
158+ After building doc_context (including symbol_docs from Phase 1.7), persist it as a reusable context package:
159+
160+ 1 . Bundle doc_context into JSON structure:
161+ ``` json
162+ {
163+ "affected_features" : [" feat-auth" ],
164+ "affected_requirements" : [" REQ-001" , " REQ-002" ],
165+ "affected_components" : [" tech-auth-service" ],
166+ "architecture_constraints" : [" ADR-001" ],
167+ "index_path" : " .workflow/.doc-index/doc-index.json" ,
168+ "symbol_docs" : [... ]
169+ }
170+ ```
171+
172+ 2 . Write to session folder: ` {sessionFolder}/.process/doc-context-package.json `
173+ 3 . Store relative path for task.json population: ` ../.process/doc-context-package.json `
174+
175+ ** Error handling** : If write fails → log warning → continue without context package (backward compatible).
176+
156177---
157178
158179## Phase 2: Doc-Index-Guided Exploration (NEW)
@@ -318,6 +339,93 @@ Agent(subagent_type="cli-lite-planning-agent", prompt="
318339")
319340```
320341
342+ ### 4.3.1 Populate Task Artifacts (TASK-002)
343+
344+ After task generation, enrich each TASK-* .json with artifacts[ ] field:
345+
346+ 1 . Load doc-index.json from ` .workflow/.doc-index/doc-index.json `
347+ 2 . For each task, extract feature_ids from task.doc_context
348+ 3 . Filter doc-index features/requirements matching task scope:
349+ - Match by feature_ids in task.doc_context.feature_ids
350+ - Include linked requirements via requirementIds
351+ - Include linked components via componentIds
352+ 4 . Populate task.artifacts[ ] with filtered references:
353+
354+ ``` json
355+ {
356+ "artifacts" : [
357+ {
358+ "type" : " feature_spec" ,
359+ "source" : " doc-index" ,
360+ "path" : " .workflow/.doc-index/feature-maps/auth.md" ,
361+ "feature_id" : " feat-auth" ,
362+ "usage" : " Reference for authentication requirements"
363+ },
364+ {
365+ "type" : " requirement" ,
366+ "source" : " doc-index" ,
367+ "path" : " .workflow/.doc-index/doc-index.json#requirements[0]" ,
368+ "feature_id" : " feat-auth" ,
369+ "requirement_id" : " REQ-001" ,
370+ "usage" : " Acceptance criteria source"
371+ },
372+ {
373+ "type" : " component_doc" ,
374+ "source" : " doc-index" ,
375+ "path" : " .workflow/.doc-index/tech-registry/auth-service.md" ,
376+ "component_id" : " tech-auth-service" ,
377+ "usage" : " Implementation reference"
378+ }
379+ ]
380+ }
381+ ```
382+
383+ ** Loading pattern** (following brainstorm pattern from action-planning-agent.md:200-214):
384+ - Load doc-index.json once for catalog
385+ - Filter by task-relevant feature IDs (1-3 per task)
386+ - Only include artifacts directly referenced in task scope
387+ - Use relative paths from task file location
388+
389+ ### 4.3.2 Populate Context Package Path (TASK-001)
390+
391+ Set context_package_path field in each TASK-* .json:
392+
393+ ``` json
394+ {
395+ "context_package_path" : " ../.process/doc-context-package.json"
396+ }
397+ ```
398+
399+ Relative path from ` .task/TASK-*.json ` to ` .process/doc-context-package.json ` .
400+
401+ ### 4.3.3 Add Navigation Links Block (TASK-003)
402+
403+ Add links{} navigation block to each TASK-* .json for improved discoverability:
404+
405+ ``` json
406+ {
407+ "links" : {
408+ "plan" : " ../plan.json" ,
409+ "doc_index" : " ../../.doc-index/doc-index.json" ,
410+ "feature_maps" : [
411+ " ../../.doc-index/feature-maps/auth.md"
412+ ],
413+ "related_tasks" : [
414+ " TASK-002.json" ,
415+ " TASK-003.json"
416+ ]
417+ }
418+ }
419+ ```
420+
421+ ** Path computation** :
422+ - ` plan ` : Relative path from ` .task/TASK-*.json ` to ` plan.json ` (sibling of .task/)
423+ - ` doc_index ` : Relative path to ` .workflow/.doc-index/doc-index.json `
424+ - ` feature_maps ` : Paths to feature-map docs from task.doc_context.feature_docs
425+ - ` related_tasks ` : Task IDs from task.depends_on or tasks sharing same feature_ids
426+
427+ ** Backward compatibility** : links{} is optional field (task-schema allows additionalProperties).
428+
321429### 4.4 Output Schema: plan.json
322430
323431Follows ` plan-overview-base-schema ` with ddd-specific ` doc_context ` extension:
0 commit comments