← FinaloopCONTENT HISTORY

Update to Finaloop

Snapshot Nov 21, 2026 · 13:43 UTC · version 0.2.3

Collection source: downloaded plugin package.

WHAT CHANGED

First saved snapshot

No earlier snapshot is available to establish a change.

Save Finaloop and check future changes in Following.

Up to 3 plugins free · no card required.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "description": "For Inventory IQ (unit tracking) users: allocate an additional / indirect cost (freight, duties, insurance, pallet fees...) across purchase-order lines by a unit of measure the user chooses — weight, volume, units, pallets, or any custom measure — or by a manual split, instead of Finaloop's default automatic allocation by value. Keeps each product's measures per company for reuse. Everything goes through the Finaloop MCP (purchase-order API); POs in a locked year are never edited. Trigger words: allocate cost, indirect cost, additional cost, landed cost allocation, allocate by weight, allocate by volume, allocate by CBM, split freight, split shipping cost, duties allocation, container cost, manual allocation, product weight, product volume, unit of measure, Inventory IQ allocation.\n",
  "included_files": [],
  "name": "allocate-po-costs",
  "skill_md_contents": "---\nname: allocate-po-costs\ndescription: >\n  For Inventory IQ (unit tracking) users: allocate an additional / indirect cost (freight, duties, insurance,\n  pallet fees...) across purchase-order lines by a unit of measure the user chooses — weight, volume, units,\n  pallets, or any custom measure — or by a manual split, instead of Finaloop's default automatic allocation\n  by value. Keeps each product's measures per company for reuse. Everything goes through the Finaloop MCP\n  (purchase-order API); POs in a locked year are never edited. Trigger words: allocate cost, indirect cost,\n  additional cost, landed cost allocation, allocate by weight, allocate by volume, allocate by CBM, split\n  freight, split shipping cost, duties allocation, container cost, manual allocation, product weight, product\n  volume, unit of measure, Inventory IQ allocation.\n---\n\n# Inventory IQ — allocate an indirect cost by weight / volume / manual split\n\n**Why this exists:** Finaloop splits a PO's indirect costs across its lines by value (product cost). Many costs —\nfreight, duties, pallet fees — really follow weight, volume or piece count. This skill lets the user pick the\nbasis (or split by hand), computes the per-line amounts, and saves them on the PO as a manually allocated cost.\n\nEverything goes through the Finaloop MCP (`search` / `introspect` → `validate` → `execute`, plus\n`update_purchase_order`). Field names below are real; re-check enum values and required args with `introspect`\nrather than guessing. No code or runtime is required: the math in step 7 is plain arithmetic — do it carefully,\nshow your work, and check the sums before saving.\n\n## Before you start\n\nCheck the Finaloop connection first:\n\n- **No Finaloop tools, or they need sign-in:** tell the user how to connect for the app they are using, then stop:\n  - Claude Desktop or claude.ai: Customize > Plugins > Finaloop ai > Connectors > Connect\n  - Claude Code: run `/mcp` and sign in to Finaloop\n  - Codex: run `codex mcp login finaloop`\n  - Anything else: open the app's plugin settings and connect Finaloop\n- **Connected, but `update_purchase_order` isn't among the tools:** tell the user this workflow isn't available on\n  their Finaloop plan, then stop.\n\n## Flow at a glance\n\nSetup (once, reused): the user gives per-product measurements (step 1).\nEvery run: 2 which POs → 3 which cost (existing or new per PO) → 4 allocation basis → 5 which products →\n6 measurements present for all of them? → 7 compute + preview → 8 confirm, save, verify.\n\n## Ground rules\n\n- **Never write without an explicit yes.** Always show the full before → after split and ask \"OK to apply?\".\n- One company at a time. If the user has several, ask which.\n- Plain business language to the user: no ids, enum values, field names.\n- **Locked year:** a PO whose production (in-progress) date is before the company's\n  `lockStatus.minimumAllowedEventTime` cannot change its costs. Skip it, tell the user, never work around it.\n  If the API still refuses with `LOCKED_PERIOD`, say the period is closed in the books.\n- Only cost-adding types are allocated here: SHIPPING, DUTIES_AND_TAX, INSURANCE, VENDOR_FEES,\n  CUSTOM_FEES_AND_SERVICES, PALLET_COSTS, SHIPPING_SURCHARGE, PRODUCTION_COSTS, PRODUCTION_LABOR_COSTS, GENERAL,\n  OTHER. Discounts / credits are not \"additional costs\" — send the user to the app for those.\n- A measure-based or manual allocation is saved as a **manual allocation** on the PO. Tell the user: from then on\n  the app shows that cost as manually allocated, and changing the PO's lines or costs later means re-doing the\n  allocation (in the app, or with this skill again).\n- Dropshipping POs: the API refuses content changes — skip and say so. Drafts: allowed, but ask first.\n- Never hand-patch a number to make the API accept a payload. If a total doesn't reconcile, recompute.\n\n## Step 1 — Product measures (per company, reused every run)\n\nA measure is a **per-unit** number for a product, in a named column: `weight_kg`, `volume_cbm`,\n`pallets_per_unit`, `weight_lb`, `cartons_per_unit`… **Any name the user wants; the name carries the unit.** A\nproduct can have several measures at once; each column is a separate basis the user can pick in step 4. Two\nbuilt-in bases need no table: `units` (quantity) and `value` (product cost — Finaloop's default).\n\nThe measures table: `product id | SKU | product name | measure columns…`, one row per product.\n\n**Where it lives** — depends on where this skill runs:\n- If files can be written (e.g. a scratch or project folder), keep it at\n  `<work folder>/inventoryiq-cost-allocation/<companyId>/measures.csv` and reload it at the start of every run.\n- Otherwise keep it as a markdown table in the conversation / project knowledge: at the end of every run, print\n  the full updated table and ask the user to save it and paste it back next time.\n\n1. If a table exists, load it and tell the user which measures are known and how many products have each.\n2. If it doesn't, or the user wants to add a measure / update values:\n   - List the catalog: `products2(input: { companyId, limit: 100, offset, sort: { field: SKU, direction: ASC },\n     filter: { attributes: [ACTIVE] } }) { products { id sku displayName } hasNext }` — page while `hasNext`.\n   - Accept a pasted table / CSV / spreadsheet (`sku, weight_kg, volume_cbm, …`) or values typed in chat. Match\n     on SKU (exact, trimmed), fall back to product name. **Store by product id**, so duplicate SKUs (several\n     products sharing one SKU) are told apart by name. List rows that matched no product. Never guess a value.\n   - Units must be consistent inside one column (all kg, or all lb). Adding a measure = adding a column;\n     existing columns stay.\n   - Save the table, show a summary (products covered / missing per measure).\n3. Values given later for new products (step 6) are added to the same table.\n\n## Step 2 — The user picks the POs (never guess)\n\nAsk how they want to point at the POs — one of:\n\n- **Specific POs** — one or many names (e.g. \"PO-12, PO-15, PO-18\"):\n  `supplyChainPurchaseOrders(input: { companyId, filters: { searchField: \"<name>\", includeDrafts: true },\n  sort: { field: PLACEMENT_DATE, direction: DESC }, offset: 0, limit: 50 })`. Names not found → list them back.\n- **All POs carrying a cost type** — e.g. \"every PO with duties from 2026\", optionally narrowed by vendor.\n  There is no API filter on cost type: page `supplyChainPurchaseOrders` with `filters: { inProgressDate: { from, to },\n  vendorIds, includeDrafts: true }`, `limit: 100`, while `hasNext`, requesting\n  `purchaseOrders { id displayName placementDate inProgressDate isDraft isDropshipping supplyChainStatus\n  vendor { name } totalCount totalQuantity indirectLineItems { type cost hasAutomaticAllocation } }`, and keep the\n  POs whose `indirectLineItems[].type` matches. For a large company insist on a date range or vendor.\n- **A filter** — vendor, placement / production date range, status.\n\nLock check: `company(args: { companyId }) { name lockStatus { minimumAllowedEventTime } }`; a PO with\n`inProgressDate < minimumAllowedEventTime` is locked.\n\n**Confirm the POs.** Show a table: PO name, vendor, placement date, production date, status, lines, existing\nadditional costs (type + amount + automatic/manual), locked yes/no. Locked and dropshipping POs are listed as\nexcluded. Ask **\"These POs — correct?\"** and let the user add / drop. Nothing proceeds until they say yes.\n\nThen read every confirmed PO in full (this is the data the save in step 8 is rebuilt from):\n\n```graphql\nquery($companyId: ID!, $purchaseOrderId: ID!) {\n  supplyChainPurchaseOrder(input: { companyId: $companyId, purchaseOrderId: $purchaseOrderId }) {\n    id companyId displayName placementDate inProgressDate isDraft isDropshipping notes\n    vendor { id name }\n    customer { id contactName phoneNumber contactEmail addressLine1 country city state zipCode }\n    attachments { id filename url }\n    directLineItems { id product { id sku displayName } quantity vendor { id } directCostPerUnit directCostTotal note\n      indirectCostPerUnit landedCostPerUnit\n      indirectCostsAllocation { indirectLineItem { id } allocatedCostPerUnit } }\n    indirectLineItems { id type cost vendor { id name } isDefaultVendor hasAutomaticAllocation shipmentId }\n    shipmentGroups { id displayName notes linkedShipment { id } contents { lineItem { id } quantity } }\n    directCostTotal indirectCostTotal discountCostTotal landedCostTotal\n  }\n}\n```\n\n## Step 3 — Review and confirm the cost\n\nTwo cases; ask which (or infer from what they said, then confirm):\n\n- **Re-allocate a cost already on the POs** — show per PO each cost line: type, vendor, amount, current\n  allocation (automatic by value / manual) and today's split per line (`allocatedCostPerUnit × quantity`). The\n  user picks which cost line(s) to re-split and may correct the amount. A reused line keeps its id.\n- **Add a new cost** — collect **cost type** (plain words → type: \"freight\" → SHIPPING, \"customs\" →\n  DUTIES_AND_TAX…), **vendor** (`vendors(input: { companyId, searchTerm }) { id name }`; several matches → ask;\n  the PO's own vendor when they say \"same vendor\"), **total amount** (home currency, > 0). With several POs ask\n  whether the amount is one grand total to split across POs, or a per-PO amount.\n\n**Confirm the cost.** One table: PO, cost type, vendor, amount before → after. Ask **\"These costs and amounts —\ncorrect?\"**\n\n## Step 4 — The user picks the allocation basis\n\nAsk: **automatic by a measure, or manual?**\n\n- **Automatic** — list the bases available: every measure column in the table, with its coverage of the\n  products on the confirmed POs (\"weight_kg — 14 of 16 products\"), plus `units` and `value`. The user picks\n  **one** basis for this run.\n- **Manual** — amounts or percentages per line (or per PO, then per line). Must add up to the total / 100%;\n  lines not mentioned get 0.\n- **Value (Finaloop's default)** for a *new* cost — the simple path is\n  `update_purchase_order(companyId, purchaseOrderId, indirectCosts: [<all existing order-level costs> + new one])`;\n  `indirectCosts` **replaces** the order-level costs, so resend the existing ones; the server splits by value.\n  Refused with MANUAL_ALLOCATIONS_WOULD_RESET when the PO already has a manual allocation → use step 7/8 with\n  basis = value.\n\n## Step 5 — Which products share the cost: all, or some?\n\nAsk: **all products on these POs, or only some?** (duties only on imported lines, pallet fees only on bulky\nSKUs…). Show the resulting line list per PO and confirm. Excluded lines get **0** of this cost — say so.\n\n## Step 6 — Are the measurements there for every included product?\n\nFor the chosen basis, list every included product with no value in the table (new products are the usual\ncase). Ask for those values **before allocating** — only those products. Add them to the table so next time\nthey're known. If the user can't provide one: exclude that line (0 of the cost) or switch basis. The preview\nstates which lines are excluded and why.\n\n## Step 7 — Compute and preview\n\nWork in exact decimals (write amounts with all digits; don't round intermediate steps). Per PO:\n\n**7a. Weight of each included line** — `w_i = quantity_i × measure_i`\n(`units`: `w_i = quantity_i`; `value`: `w_i = quantity_i × directCostPerUnit_i`). Excluded lines: `w_i = 0`.\n\n**7b. Grand total across several POs** (only when the user gave one total): PO share = `total × ΣwPO / Σw all`,\nrounded to 2 decimals, the last PO taking `total − sum of the others` so they add up exactly. Then treat each PO\nwith its share.\n\n**7c. Line totals** — `T_i = amount × w_i / Σw`, rounded to 2 decimals; the **last included line** takes\n`amount − sum of the others` so `ΣT_i = amount` exactly. Manual: `T_i` = the user's amounts (percent × amount,\n2 decimals, last line absorbs the rounding).\n\n**7d. Per-unit with remainder** — the API stores a per-unit amount for every unit but the last, and a\n\"remainder\" for the last unit, so a line total is exact:\n`perUnit_i = round8(T_i / quantity_i)`, `lastUnit_i = round8(T_i − perUnit_i × (quantity_i − 1))`.\n(8 decimals; for quantity 1 both equal `T_i`.) Check: `perUnit_i × (quantity_i − 1) + lastUnit_i = T_i`.\n\n**7e. Other costs on the PO keep their allocation.** For every other cost line: if it is automatic\n(`hasAutomaticAllocation: true`), its totals per line are its cost split by value (7a–7d with basis value, on\n*all* lines); if manual, its per-line total is the stored `allocatedCostPerUnit × quantity` (last line absorbs\nany rounding so the cost sums exactly). Discounts/credits (DISCOUNT, CREDIT) are negative allocations.\n\n**7f. Per-line fields the API validates** (4-decimal tolerance, except direct-cost totals, which must match\nexactly), for each line:\n- `indirectCostPerUnit` = Σ perUnit of all cost-adding costs; `remainderIndirectCostPerUnit` = Σ lastUnit.\n- `discountCostPerUnit` / `remainderDiscountCostPerUnit` = the same for discounts/credits, as positive numbers.\n- `landedCostPerUnit` = direct + indirect − discount (per unit); `remainderLandedCostPerUnit` the same with the\n  remainder values.\n- `directCostTotal` = the line's value from the step-2 read, resent unchanged; `indirectCostTotal` = indirectCostPerUnit × (qty − 1) +\n  remainderIndirectCostPerUnit; `discountCostTotal` likewise; `landedCostTotal` = direct + indirect − discount.\n\n**7g. PO totals** — `directCostTotal` = the PO's value from the step-2 read, resent unchanged; `indirectCostTotal` = Σ cost-adding `cost`;\n`discountCostTotal` = Σ discount/credit `cost` (positive); `landedCostTotal` = direct + indirect − discount.\nCross-check: Σ line `indirectCostTotal` = PO `indirectCostTotal`; Σ line `landedCostTotal` = PO `landedCostTotal`;\nfor each cost line, Σ over lines of `perUnit × (qty − 1) + lastUnit` = its `cost`.\n\n**Preview** to the user, per PO: SKU, product, qty, measure total (`w_i`), share %, amount of this cost before →\nafter, landed cost per unit before → after, totals row. Say which lines are excluded. Then ask **\"OK to apply?\"**.\n\n**Worked example** — duties 500 by volume_cbm, 4 lines:\n\n| SKU | Qty | cbm/unit | w = qty×cbm | T (2dp) | perUnit (8dp) | lastUnit |\n|---|---|---|---|---|---|---|\n| 897 | 1 | 0.015 | 0.015 | 31.51 | 31.51 | 31.51 |\n| 40915 | 11 | 0.008 | 0.088 | 184.87 | 16.80636364 | 16.8063636 |\n| 130692 | 3 | 0.025 | 0.075 | 157.56 | 52.52 | 52.52 |\n| 12345667 | 5 | 0.012 | 0.060 | 126.06 (last: 500 − 373.94) | 25.212 | 25.212 |\n\nΣw = 0.238; 500 × 0.015 / 0.238 = 31.5126… → 31.51; etc. Check 40915: 16.80636364 × 10 + 16.8063636 = 184.87 ✓.\n\n## Step 8 — Save\n\nOnly after a clear yes. Build the input from the step-2 read + step-7 numbers — **every existing line, cost,\nshipment group, attachment, note and customer field is resent unchanged**; only the allocated cost and the\ncomputed numbers change:\n\n```graphql\nmutation($input: UpsertSupplyChainPurchaseOrderInput!) {\n  upsertSupplyChainPurchaseOrder(input: $input) {\n    __typename\n    ... on UpsertSupplyChainPurchaseOrderSuccess { purchaseOrderId }\n    ... on SupplyChainPurchaseOrderValidationError { code message }\n  }\n}\n```\n\n`input` shape (run `introspect UpsertSupplyChainPurchaseOrderInput` for the full type):\n- `id`, `companyId`, `displayName`, `shouldValidateDisplayName: false`, `placementDate`, `inProgressDate`,\n  `vendorId`, `notes`, `isDraft`, `isDropshipping`, `attachments: [{ id, filename, url }]`,\n  `customer` (only when the PO has a customer id; omit otherwise).\n- `directLineItems: [{ id, productId, quantity, vendorId, directCostPerUnit, note,\n  indirectCostsAllocation: [{ indirectLineItemId, allocatedCostPerUnit: perUnit, remainderAllocationCostPerUnit: lastUnit }\n  — one entry per cost line on the PO, including the ones with 0],\n  indirectCostPerUnit, remainderIndirectCostPerUnit, discountCostPerUnit, remainderDiscountCostPerUnit,\n  landedCostPerUnit, remainderLandedCostPerUnit, directCostTotal, indirectCostTotal, discountCostTotal,\n  landedCostTotal }]` — allocations for DISCOUNT/CREDIT lines are sent **negative**.\n- `indirectLineItems: [{ id, type, cost, vendorId, isDefaultVendor, hasAutomaticAllocation, shipmentId? }]` —\n  the allocated cost gets `hasAutomaticAllocation: false` (new cost: a fresh UUID as `id`,\n  `isDefaultVendor` = vendor is the PO's vendor); all others exactly as read.\n- `shipmentGroups: [{ id, displayName, notes, supplyChainShipmentId: linkedShipment.id,\n  contents: [{ lineItemId, quantity }] }]` — as read.\n- `directCostTotal`, `indirectCostTotal`, `discountCostTotal`, `landedCostTotal` from 7g.\n\n`validate` the operation, then `execute`. One PO at a time; a failure on one doesn't stop the others — report each.\n\n**Verify:** re-read the PO (`supplyChainPurchaseOrder` with `indirectLineItems { type cost hasAutomaticAllocation }\ndirectLineItems { product { sku } quantity indirectCostTotal landedCostPerUnit indirectCostsAllocation\n{ indirectLineItem { type } allocatedCostPerUnit } } indirectCostTotal landedCostTotal`) and confirm the cost's\namount, the manual flag, and each line's allocation equal the preview. Report before → after per PO in plain\nwords. If anything differs, say so — don't re-save silently.\n\nFinally, if the measures table isn't stored in a file, print the full updated table for the user to keep.\n\n## Errors in plain words\n\n| API says | Tell the user |\n|---|---|\n| LOCKED_PERIOD | That PO's period is closed in the books; its costs can't change. |\n| PAYMENT_GROUPS_WOULD_BE_DROPPED | This change would unlink payments recorded against the PO. Stop; do it in the app, or only on explicit confirmation resend with `acknowledgedLinkedEntityDeletionIds` = the group ids named. |\n| MANUAL_ALLOCATIONS_WOULD_RESET | (from `update_purchase_order`) the PO already has a manual allocation; use the full save in step 8. |\n| INDIRECT_COST_TYPE_NOT_ALLOWED / INVALID_INDIRECT_COST | That cost type isn't allowed on this PO. |\n| DROPSHIPPING_NOT_EDITABLE | Dropshipping POs can't be edited here. |\n| MISSING_DIRECT_COST / MISSING_PLACEMENT_DATE / MISSING_VENDOR | The PO is missing a product cost / date / vendor; add it in the app first. |\n| \"… does not match computed total …\" | Your arithmetic is off; redo step 7 checks. Never nudge a number to pass. |\n| UNSUPPORTED_MANAGEMENT_METHOD | The company isn't on Inventory IQ (unit tracking); this skill doesn't apply. |\n\n## Alternative: cost on a shipment instead of the PO\n\nIf the cost belongs to a supply-chain shipment (one freight invoice for a container carrying several POs), the\nshipment API takes manual allocations as plain totals per PO line — same 7a–7c math, no per-unit fields:\n`upsertSupplyChainShipment(input: { …shipment as read…, costs: [{ id, type, cost, vendorId,\nmanualAllocations: [{ directLineItemId, totalAllocated }] }] })`. Offer it when the user talks about a shipment or\ncontainer rather than a PO.\n"
}

SHA-256 of public snapshot: 5c16fa30e5be0ab60156b8aeae0028ef1701688b9dbc853282417f57f8c3711c