Problem
Invoke-LLMSwarm currently returns:
Synthesis = $synth.Content # raw string
(see Public/Invoke-LLMSwarm.ps1:138)
Consumers get an opaque blob. There is no programmatic way to access the synthesizers reasoning, conclusions, per-task references, or token breakdown without string-parsing.
Proposed shape
Replace the single string with a [PSCustomObject] with sub-properties:
Synthesis = [PSCustomObject]@{
PSTypeName = "PwrCortex.SwarmSynthesis"
Summary = <short one-paragraph conclusion>
Content = <full synthesizer response text>
KeyFindings = <List[string]> # extracted bullet points
References = <List[SwarmTaskRef]> # which Tasks[i] each finding came from
Provider = <string>
Model = <string>
InputTokens = <int>
OutputTokens = <int>
TotalTokens = <int>
ElapsedSec = <double>
StopReason = <string>
}
Where SwarmTaskRef is @{ TaskIndex; TaskPrompt; Excerpt }.
Implementation
- In
Invoke-LLMSwarm, instead of storing $synth.Content, build the structured object from the [LLMResponse] returned by the synthesis call.
- Ask the synthesizer to return its conclusions as a JSON block (or parse bullet lines) so
KeyFindings/References can be populated reliably. Fallback: empty lists, Content always populated.
- Update
CLAUDE.md and Invoke-LLMSwarms .OUTPUTS section.
- Update
Enter-LLMChat:192 which passes $swResult.Synthesis into chat history — needs $swResult.Synthesis.Content.
Acceptance
(Invoke-LLMSwarm ...).Synthesis.KeyFindings returns a list.
(Invoke-LLMSwarm ...).Synthesis.References[0].TaskIndex resolves.
- Backwards compatibility is explicitly broken (
Synthesis was a string, now an object). Release as feat!: / major bump per release-please rules.
Related
- Sibling issue: Replace Write-Host console UI with .format.ps1xml views
Problem
Invoke-LLMSwarmcurrently returns:(see
Public/Invoke-LLMSwarm.ps1:138)Consumers get an opaque blob. There is no programmatic way to access the synthesizers reasoning, conclusions, per-task references, or token breakdown without string-parsing.
Proposed shape
Replace the single string with a
[PSCustomObject]with sub-properties:Where
SwarmTaskRefis@{ TaskIndex; TaskPrompt; Excerpt }.Implementation
Invoke-LLMSwarm, instead of storing$synth.Content, build the structured object from the[LLMResponse]returned by the synthesis call.KeyFindings/Referencescan be populated reliably. Fallback: empty lists,Contentalways populated.CLAUDE.mdandInvoke-LLMSwarms.OUTPUTSsection.Enter-LLMChat:192which passes$swResult.Synthesisinto chat history — needs$swResult.Synthesis.Content.Acceptance
(Invoke-LLMSwarm ...).Synthesis.KeyFindingsreturns a list.(Invoke-LLMSwarm ...).Synthesis.References[0].TaskIndexresolves.Synthesiswas a string, now an object). Release asfeat!:/ major bump per release-please rules.Related