@@ -481,7 +481,7 @@ func (t *Tools) RefineLoopback(currentPhase Phase, parentID, insight, newTitle,
481481 return childPath , nil
482482}
483483
484- func (t * Tools ) FinalizeDecision (title , winnerID , decisionContext , decision , rationale , consequences , characteristics string ) (string , error ) {
484+ func (t * Tools ) FinalizeDecision (title , winnerID string , rejectedIDs [] string , decisionContext , decision , rationale , consequences , characteristics string ) (string , error ) {
485485 defer t .RecordWork ("FinalizeDecision" , time .Now ())
486486
487487 body := fmt .Sprintf ("\n # %s\n \n " , title )
@@ -510,10 +510,27 @@ func (t *Tools) FinalizeDecision(title, winnerID, decisionContext, decision, rat
510510 }
511511
512512 if t .DB != nil {
513+ ctx := context .Background ()
513514 drrID := t .Slugify (title )
514- if err := t .DB .CreateHolon (context . Background () , drrID , "DRR" , "" , "DRR" , title , body , "default" , "" , winnerID ); err != nil {
515+ if err := t .DB .CreateHolon (ctx , drrID , "DRR" , "" , "DRR" , title , body , "default" , "" , winnerID ); err != nil {
515516 fmt .Fprintf (os .Stderr , "Warning: failed to create DRR holon in DB: %v\n " , err )
516517 }
518+
519+ // Create selects relation: DRR → winner
520+ if winnerID != "" {
521+ if err := t .createRelation (ctx , drrID , "selects" , winnerID , 3 ); err != nil {
522+ fmt .Fprintf (os .Stderr , "Warning: failed to create selects relation: %v\n " , err )
523+ }
524+ }
525+
526+ // Create rejects relations: DRR → each rejected alternative
527+ for _ , rejID := range rejectedIDs {
528+ if rejID != "" && rejID != winnerID {
529+ if err := t .createRelation (ctx , drrID , "rejects" , rejID , 3 ); err != nil {
530+ fmt .Fprintf (os .Stderr , "Warning: failed to create rejects relation to %s: %v\n " , rejID , err )
531+ }
532+ }
533+ }
517534 }
518535
519536 if winnerID != "" {
0 commit comments