| name | portfolio-work-auditor |
| description | Analyze engineering portfolio work-item datasets for portfolio mix, SLA aging, duplicate handling, and release readiness. Use when Codex must produce schema-constrained JSON answers from provided work-item, mix-target, SLA-policy, release, milestone, blocker, or dependency data while avoiding stale mirror/export fields. |
Portfolio Work Auditor
Core Workflow
- Read the prompt and the answer template before querying data. Treat the template as the output contract.
- Load the authoritative task data made available by the user or runtime notes. Use structured parsing for JSON and SQL results.
- Ignore stale mirror/export fields for business truth unless the prompt explicitly asks to report them. Prefer current work item fields such as
status, closed_at, duplicate_of, work_type, labels, title, release_id, and milestone_id.
- Build the analysis cohort first, then calculate metrics from that set. Do not calculate from story points unless the prompt explicitly asks for story-point weighting.
- Sort and round exactly as requested by the template. Return only the requested JSON when the prompt says not to include prose.
Portfolio Category Classification
Classify each primary work item into exactly one category.
Use these signals in order, while treating labels or titles containing stale, mirror, or export as warnings that the signal may be a trap:
Security: security/compliance work, including real vulnerability, CVE, auth, encryption, compliance, audit-evidence, or security-review intent. Security and Compliance work types usually land here. Generic feature/refactor/dependency work can still be security if the title and labels show a genuine security purpose.
Reliability: reliability, incident, bug, outage, latency, flaky, postmortem, recovery, retry, guardrail, or operational repair work. This can override generic Feature, Enhancement, or Chore types when the item is clearly about reliability work.
TechDebt: refactor, dependency, migration, cleanup, deprecation, chore, and maintenance work when there is no stronger security or reliability purpose.
NewFeature: feature, enhancement, rollout, customer-facing capability, and product polish work when no stronger category applies.
When security and reliability signals conflict, prefer the category that is the actual work objective in the title, not a stale or incidental label.
Closed Portfolio Mix
Use this procedure for quarter-based closed-work mix reviews:
- Filter by the prompt's quarter using
closed_at.
- Filter by the exact teams and product areas in scope.
- Include primary closed work only: non-null
closed_at, status not Duplicate or Cancelled, and no duplicate_of.
- Include all rows that satisfy the real scope. Do not discard ordinary-looking same-scope rows just because other rows have generated-looking IDs.
- Exclude same-scope duplicates, records pointing at another work item, and cancelled records from the denominator. Report them in the requested exclusion or distractor fields.
- Count items by category. Compute actual percentages as
count / total * 100.
- Convert mix target fractions to percentage points before calculating gaps.
gap = actual_pct - target_pct.
- Round percentages and gaps to one decimal place unless the template says otherwise.
- List under-invested categories with negative gaps from most negative to least negative. Break ties in the template's category order.
- For rebalance actions, use the largest negative gap as the primary category. If a secondary/source category is requested, use the largest positive gap. If an owner team is requested, use team-level category evidence from the included work and the wording of the prompt to choose the team responsible for correcting that deficit.
SLA Aging Audits
Use this procedure for SLA reliability/security audits:
- Filter by the prompt's teams.
- Classify category from authoritative work-item fields using the category rules above; include only the requested SLA categories.
- Exclude cancelled records and duplicate records from the primary population. Treat any record with
duplicate_of as a duplicate even if its status is not Duplicate.
- Include primary work that was open as of the audit date, regardless of age:
created_at <= as_of and either closed_at is missing or closed_at > as_of.
- Also include primary work closed in the recent closed window, inclusive of both the window start and the audit date.
- For closed items, evaluate overdue status at
closed_at. For open-as-of items, evaluate overdue status at as_of.
- A due date equal to the evaluation date is not overdue. Use
due_at < evaluation_date.
- Compute breach rate as
overdue_primary_count / included_primary_count, rounded to three decimals.
- For aging buckets, age each included primary item from
created_at to closed_at for recent closed items, otherwise from created_at to as_of.
- Count missing owners among included primary records with no owner.
- Build duplicate clusters from duplicate records in the same SLA scope and time population. Group by canonical
duplicate_of, sort clusters by primary_id, and sort duplicate IDs.
- Team overdue counts include overdue primary records and are sorted alphabetically by team.
- Hotspots are team-owner pairs with the most overdue primary records. Use
UNASSIGNED for missing owners.
- Escalation queues should include overdue primary work in severity order (
S1, S2, S3, S4), then earliest due_at, then stable ID order unless the prompt specifies a different priority rule.
Release Readiness
Use this procedure for release-readiness assessments:
- Use release, milestone, work item, blocker, and dependency records as separate authoritative sources. Do not use stale mirrored release fields as truth.
- Primary release work excludes duplicates, cancelled items, and records pointing at another primary via
duplicate_of.
- Treat
Closed, Done, Verified, and Deployed as complete statuses. Treat Backlog, In Progress, Review, and Reopened as non-complete.
- For each milestone, count complete primary work and total primary work, then compute
completion_pct = complete / total * 100, rounded to one decimal.
- Compute release readiness score as all complete primary release work divided by all primary release work, rounded to three decimals.
- Gating work item IDs are sorted non-complete primary release work item IDs unless the prompt narrows the gating definition.
- Count unresolved high-impact blockers by exact cause text. Use unresolved records with no resolution and severity equivalent to high or critical impact.
- For critical dependency chains, start from release work and follow dependency relations that indicate readiness blocking or validation-critical work. Include ordered paths that end at a non-complete dependency target; omit paths ending at complete dependencies. Sort chains lexicographically by the full path.
- Use
NO_SHIP when unresolved critical/high blockers or non-complete gating work remain. Use SHIP_WITH_WATCH for lower-impact unresolved risk with otherwise complete readiness. Use SHIP only when the primary work is complete and no unresolved readiness blockers remain.
Output Discipline
- Match the template keys exactly and avoid additional properties when a schema forbids them.
- Sort ID lists lexicographically unless the template requests chronological ordering.
- For chronological ordering, sort by date first and ID second.
- Preserve exact cause strings, category names, team names, and enum values from the data or template.
- Use JSON booleans and nulls, not string equivalents.