Skip to content

dimagi-internal/ace / skills/opp-closeout

opp-closeout

Verified

Close out a completed opportunity: pull its Connect invoices and open a Jira ticket to pay the LLO.

Opportunity Closeout

Process the financial closeout of a completed opportunity. Works on any Connect opportunity: one ACE built in a run, or a live program's opportunity named by its program context doc.

Inputs

ParameterUsed forResolver
opportunity_idthe opportunity whose invoices are pulledexplicit arg; default: runs/<run-id>/4-connect/connect-opp-setup.md; Phase 9's partner opportunity is phases.solicitation-management.products.selected_llo.opportunity_id. A multi-role run (skills/_worker-roles.md) has one opportunity per worker role — close out EACH: the primary's above, plus every phases.connect-setup.products.connect.role_opportunities.<key>.opportunity.id and any per-role partner opportunity the Phase 9 summary lists
organization_slugorg URL the invoice pages are read atexplicit arg; default: the run's holding org (runConnectOrgs()); else the program context doc
llo_name, llo_org_slugwho is paid (Jira summary, banking reference)explicit arg; default: run_state selected_llo; else the program context doc
run_idrun-bound mode: closeout record path + decisions rowsoptional; absent = live-program mode
out_folder_idwhere the closeout record goes in live-program modeexplicit arg when run_id is absent

Live-program mode (no run_id): Step 1 reads the opportunity live (connect_get_opportunity, connect_list_payment_units) instead of the run file; Step 4 writes the record to out_folder_id and logs it in the program context doc's Decisions. The decisions-log rows below are run-only.

Process

  1. Read opportunity details:

    • Run mode: opportunity config from ACE/<opp-name>/runs/<run-id>/4-connect/connect-opp-setup.md
    • Live-program mode: connect_get_opportunity({organization_slug, opportunity_id}) and connect_list_payment_units
    • Delivery/payment unit config
  2. Pull invoices from Connect for this opportunity via connect_list_invoices (and connect_get_invoice for any that need detail hydration). Invoice atoms are conservative in 0.8.1 — they return empty/stub records for opps that haven't been billed yet.

    • Get auto-generated invoices based on verified deliveries
    • Calculate total payment amount
    • If the invoice list is empty AND the opportunity has completed deliveries, the invoice page shape may have evolved since 0.8.1's probe — re-run scripts/probe-connect-invoice.ts to update the parser, or fall back to manual UI export until then.
  3. Create Jira ticket for payment processing:

    • Project: appropriate Jira project for Connect payments
    • Summary: "Payment: [Opportunity Name] — [LLO Name]"
    • Description: invoice details, amount, LLO banking info reference
    • Attach invoice documents
  4. Write closeout record to ACE/<opp-name>/runs/<run-id>/10-closeout/opp-closeout_invoices.md (live-program mode: out_folder_id):

    • Invoice details
    • Total amount
    • Jira ticket link

MCP Tools Used

  • Google Drive: drive_read_file, drive_create_file
  • Connect (ace-connect MCP, 0.8.1+):
    • connect_list_invoices — pull invoices for the opportunity
    • connect_get_invoice — hydrate invoice detail
  • Jira (Atlassian MCP): createJiraIssue

Mode Behavior

  • Auto: Pull invoices, create Jira ticket, proceed
  • Review: Present invoice details for verification before creating ticket

Dry-Run Behavior

When --dry-run is active:

  • Write the Jira ticket specification (project, summary, description, attachments) and invoice details to comms-log/dry-run-opp-closeout.md
  • Do not create the Jira ticket or pull invoices from Connect
  • State tracks as dry-run-success

Decisions Log

Review fields (schema v6 — REQUIRED). The decisions log is the run's review artifact (the build memo is retired). Every row this skill appends carries plain — one plain-language line for a programme partner who has never seen ACE — and, where the choice is visible somewhere a reviewer can open, check_at + correct_looks_like. The atom rejects a partner-facing row without plain, or with jargon in it. Rules, a worked row and the review_ask semantics: skills/_decisions-review-fields.md; field contract: docs/decisions-contract.md.

This skill writes load-bearing defaults to the per-run ACE/<opp-name>/runs/<run-id>/decisions.yaml. The bar criterion and schema live in skills/idea-to-pdd/SKILL.md § Decisions Log Convention (canonical authority). The list below catalogs decisions that commonly qualify under the bar for this phase — a working template, not a required set. The skill applies the bar criterion and emits whatever rows meet it; the catalog is a teaching device that improves over time.

Common load-bearing decisions for Phase 10

IDQuestionMap to surface
closeout-depthStandard summary vs. deep retrospective with cycle-grade re-anchor?cycle-grade-eval rubric input
learnings-summary-scopePer-opp only, or cross-opp pattern aggregation?learnings-summary skill output; ACE-wide pattern catalogue

The orchestrator's Phase Write-Back Verifier (agents/ace-orchestrator.md § Phase Write-Back Contract § Decisions log clause) enforces the contract; the renderer (skills/decisions-render) regenerates the gdoc at end of every phase.

Each row this skill writes uses phase: 10-closeout and skill: opp-closeout.

Terminology

The platform is Connect, never CommCare Connect — in every word this skill puts in front of a human. The full rule, including the carve-outs for CommCare the mobile app, CommCare HQ and code-level identifiers, is skills/_terminology.md. Read it before writing prose; it is binding on this skill's output.

Change Log

DateChangeAuthor
2026-04-28Replace HITL workaround with connect_list_invoices + connect_get_invoice (ace-connect 0.8.1). Note: invoice page shape was not yet probed at 0.8.1 ship; atoms return conservative defaults until the page has been observed liveACE team
2026-10-18Add ## Inputs as parameters (opportunity_id, organization_slug, LLO) with run defaults; live-program mode reads the opportunity live and records outside the run. ace#3148.ACE (build-vs-maintain audit)
2026-05-08Add ## Decisions Log section: 2 anchor rows (closeout-depth, learnings-summary-scope) + bar-criterion reference. Pairs with decisions-log PR #4 (Phase 3-10 writes).ACE team (decisions-log PR #4)
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 117kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall