Skip to content

Instantly share code, notes, and snippets.

@dfinke
Last active September 29, 2026 14:39
Show Gist options
  • Select an option

  • Save dfinke/ba01483915c84bfd00a9bbc2751015a3 to your computer and use it in GitHub Desktop.

Select an option

Save dfinke/ba01483915c84bfd00a9bbc2751015a3 to your computer and use it in GitHub Desktop.
Use Jev’s typed score to sort a tiny idea queue, then let a plain PowerShell rule decide what moves up and what needs a human look.
#requires -Version 7.0
# Add the Jev module before running; mock mode below makes no API request.
Import-Module Jev -ErrorAction Stop
# Prepare fictional feature ideas that cover low, medium, and high urgency.
$items = @(
[pscustomobject]@{ Id = 'IDEA-14'; Description = 'Routine color cleanup for a future demo.' }
[pscustomobject]@{ Id = 'IDEA-28'; Description = 'The login flow has an error blocking a few testers today.' }
[pscustomobject]@{ Id = 'IDEA-37'; Description = 'Critical checkout outage is blocking customers right now.' }
)
Write-Host "=== Backlog" -ForegroundColor Cyan
$items
# Run the decision and display only its safe, local mock results.
& (Join-Path $PSScriptRoot 'solution.ps1') -Item $items | Format-Table -AutoSize
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept a small array of fictional queue items.
[Parameter(Mandatory)]
[object[]] $Item
)
# Load the Jev module commands from the current PowerShell environment.
Import-Module Jev -ErrorAction Stop
# Define the allowed score levels in low-to-high order.
$levels = @('Backlog', 'Consider soon', 'Move up', 'Top priority')
# Ask Jev for a typed score, while PowerShell owns the next-step policy.
$question = New-JevQuestion -Name priority -Type Score -Instructions 'How high should this backlog item move based on its stated urgency and impact?' -Criteria $levels
# Use a confidence floor so weak scores are not treated as trusted actions.
$confidenceFloor = 0.70
Write-Host "=== Evaluating Backlog Items" -ForegroundColor Cyan
# Evaluate each item using Jev's deterministic local mock response.
foreach ($entry in $Item) {
# Pass the description as the decision state and avoid any network call.
$decision = Invoke-Jev -State $entry.Description -Question $question
$answer = $decision.answers.priority
$scoreIndex = [int] $answer.score
$confidence = [double] $answer.confidence
# Apply a visible policy in regular PowerShell after the typed decision.
$action = if ($confidence -lt $confidenceFloor) {
'Human review'
}
elseif ($scoreIndex -ge 2) {
'Move up'
}
else {
'Keep in backlog'
}
# Return both Jev's suggestion and the PowerShell policy result.
[pscustomobject]@{
Id = [string] $entry.Id
Score = $scoreIndex
ScoreLabel = $levels[$scoreIndex]
Confidence = [math]::Round($confidence, 2)
Action = $action
}
}
@dfinke

dfinke commented Sep 29, 2026

Copy link
Copy Markdown
Author
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment