Engineering Portfolio Analysis
Core Workflow
- Read the user prompt,
environment_access.md, and the requested answer template before calculating. - Replace
<TASK_ENV_BASE_URL>with the base URL fromenvironment_access.md. - Fetch only the documented endpoints needed for the task. Use
GET /api/work-itemsfor broad filtering and per-item endpoints only to verify specific records. UsePOST /api/queryonly when direct endpoints are insufficient, and include the documentedX-Env-Tokenheader. - Treat the answer template as the output contract. Match required keys, ordering notes, enum values, rounding, and whether arrays are sorted by ID, date, category order, or priority.
- Return only the JSON object unless the prompt explicitly allows prose.
Authoritative Fields
- Use
status,created_at,closed_at,due_at,duplicate_of,team,product_area,work_type,labels,title,owner,severity,priority,release_id, andmilestone_idas source-of-truth fields. - Ignore stale mirror/export fields such as
mirror_statusfor state andlegacy_categoryfor portfolio category. - Treat labels such as
stale-exportandpapertrailas metadata, not category signals. - Use these complete statuses when a task asks whether work is complete:
Closed,Done,Verified, andDeployed. - Treat
Duplicate, any non-nullduplicate_of, andCancelledas non-primary records unless the output template asks to report them as exclusions or duplicate clusters.
Primary Records And Exclusions
- A primary work item has
statusother thanDuplicateorCancelledandduplicate_of == null. - A duplicate record is any item with
status == "Duplicate"or a non-nullduplicate_of. Report it in duplicate exclusions or clusters when it otherwise matches the task scope. - A cancelled record is excluded from primary counts and reported separately when the template has a cancelled/distractor field.
- Build duplicate clusters as
{primary_id, duplicate_ids}usingduplicate_ofas the canonical id; sort cluster primary ids and duplicate ids lexicographically unless the template says otherwise.
Portfolio Category Resolver
Assign every primary portfolio item to exactly one category using this precedence. Check work_type, labels, and meaningful title tokens; do not use legacy_category.
Security:work_typeisSecurityorCompliance, or labels/title contain security signals such assecurity,auth,encryption,cve, orcompliance.Reliability:work_typeisReliability,Incident, orBug, or labels/title contain reliability signals such asreliability,incident,outage,latency, orflaky.TechDebt:work_typeisRefactor,Dependency, orChore, or labels/title contain tech-debt signals such asrefactor,cleanup,migration, ordependency.NewFeature:work_typeisFeatureorEnhancement, or labels/title contain feature signals such asfeature,rollout, orcustomer-request.
If signals conflict, keep the first category in the precedence list.
Portfolio Mix Reviews
- Parse the requested quarter, teams, product areas, and target
scope_id. - Include primary work whose
teamandproduct_areaare in scope, whoseclosed_atfalls inside the requested quarter, and whosestatusis a complete status. - Order included ids by
closed_atascending then id ascending unless the template requires a different stable order. - Fetch the mix-target row by the requested
scope_idwhen present. Target fields are fractions; convert them to percentage points before comparing. - Count included items by resolved category, not story points.
- Compute actual percentage as
category_count / total_included * 100, rounded as requested. Compute gap asactual_pct - target_pct. - List under-invested categories where gap is negative, ordered from most negative to least negative.
- For rebalance recommendations, choose the largest negative gap as the primary category. If a secondary category is requested, use the next largest negative gap. Use a maintain-current-mix action only when there are no negative gaps, and a data-quality action only for unresolved scope/category conflicts.
SLA Aging Audits
- Parse scoped teams, category list, as-of date, and recent closed window.
- Resolve each work item category with the portfolio category resolver, then keep scoped primary items whose category is in the SLA category list.
- Include open primary items active as of the as-of date and primary items closed within the recent window ending on the as-of date. Use an inclusive window start of
as_of - recent_closed_window_days. - For age calculations, use
as_of - created_atfor open items andclosed_at - created_atfor recently closed items. - Bucket age in days as
0-3,4-7,8-14,15-30, and31+. - Mark an open item overdue when
due_at < as_of. Mark a closed item overdue whenclosed_at > due_at. - Sort id lists lexicographically unless the template asks for an escalation queue.
- For team overdue counts, group overdue primary records by team and sort teams alphabetically.
- For owner/team hotspots, group by
(team, owner), usingUNASSIGNEDfor missing owners. Choose the largest overdue count and break ties deterministically by team then owner. - Compute breach rate as
overdue_primary_count / included_primary_count, rounded to the template precision. - For escalation queues, sort overdue primary work by severity rank
S1,S2,S3,S4, then by earliestdue_at, then lower numericpriority, then id.
Release Readiness
- Fetch releases, milestones, work items, blockers, and dependencies. Identify the requested release and its milestones from authoritative release and milestone data.
- Build primary release work from work items assigned to the release or one of its milestones, excluding duplicate and cancelled records.
- For each release milestone, count primary work assigned to that milestone.
complete_primaryis the count with a complete status;primary_totalexcludes duplicate and cancelled work. Sort milestone rows by milestone id and round completion percentages as requested. - Compute readiness score as total complete primary release work divided by total primary release work, rounded to the template precision.
- Count unresolved high-impact blockers for the requested release where
resolved_at == null, status is not resolved, and severity isHighorCritical. Key counts by exactcausetext. - Do not list every incomplete release item as gating by default. Gating ids are non-complete primary release items that have unresolved high-impact blockers or are blocked by a critical dependency chain.
- Build critical dependency chains from dependency relations that indicate readiness, validation, security review, or audit evidence risk. Start from blocked primary release work, follow dependencies in order, ignore duplicate/cancelled terminal records, and include only chains that end at a non-complete primary dependency. Sort chains lexicographically by the full id path.
- Use
NO_SHIPwhen non-complete gating work or unresolved high-impact release blockers remain. UseSHIP_WITH_WATCHwhen no hard gate remains but incomplete primary work or unresolved lower-impact blockers still need monitoring. UseSHIPonly when primary work is complete and no unresolved release blockers remain.
Final Checks
- Re-read the template before finalizing to verify all required fields are present and no extra fields are included.
- Verify rounding by doing arithmetic from raw counts, not from previously rounded percentages.
- Verify duplicate/cancelled ids were not counted in primary denominators.
- Verify output ordering exactly matches the prompt or template.