# Inventory fifo period reconcile

`inventory-fifo-period-reconcile` · version 1.0.0 · Financial calculations · free, no key needed

Reconcile reported ending inventory and COGS against an exact periodic FIFO recomputation.

**Use when you need to: reconcile FIFO inventory · verify reported FIFO COGS · compare inventory workpaper.**

## Decide before calling

Read the [versioned contract](/v1/tools/inventory-fifo-period-reconcile/versions/1.0.0) and the supported scope below. Reuse `inventory-fifo-period-reconcile@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `inventory-fifo-period-reconcile@1.0.0` for reconcile FIFO inventory. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- reconcile FIFO inventory
- verify reported FIFO COGS
- compare inventory workpaper
- find FIFO valuation variance
- audit periodic FIFO totals
- check inventory reconciliation

## Not supported

- perpetual FIFO transaction processing
- tax or legal advice

## Behavior

- Periodic FIFO assigns the earliest available units to cost of goods sold and retains the latest units in ending inventory; it does not model intra-period sales.
- Layers sort by acquired_on ascending, then beginning before purchase, then zero-based input_index, then layer_id; input_index makes equal-date ties explicit and deterministic.
- Quantities and unit costs are canonical nonnegative decimal strings. All products and sums use integer/rational arithmetic; binary floating point is never used.
- output_scale is explicit (0 through 12). Rounding is final, independently for each displayed monetary total and layer extended cost; it is not per-unit or cumulative. Supported modes are half-up, half-even, half-down, up, down, ceiling and floor.
- Inputs are immutable. Output contains reference_version IAS-2-2024-25-27+periodic-FIFO-v1.
- Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice.

## Input

- `beginning_layers` (array of object, required): max items 500
- `purchases` (array of object, required): max items 500
- `physical_ending_quantity` (string, required): max length 32; pattern `^(0|[1-9][0-9]{0,17})(\.[0-9]{1,12})?$`
- `output_scale` (integer, required): min 0; max 12
- `rounding_mode` (one of "half-up", "half-even", "half-down", "up", "down", "ceiling", "floor", required)
- `reported` (object, required)

## Output

- `reference_version` (constant "IAS-2-2024-25-27+periodic-FIFO-v1", required)
- `computed` (object, required)
- `reported` (object, required)
- `ending_inventory_variance` (string, required)
- `cogs_variance` (string, required)
- `reconciled` (boolean, required)

## Limits

- max input bytes: 131072
- max layers per source: 500
- max layers: 1000
- max string bytes: 64
- max output bytes: 8192

## Example

Request input:

```json
{
  "beginning_layers": [
    {
      "layer_id": "B1",
      "acquired_on": "2026-01-01",
      "quantity": "10",
      "unit_cost": "2.00"
    }
  ],
  "purchases": [
    {
      "layer_id": "P1",
      "acquired_on": "2026-01-10",
      "quantity": "5",
      "unit_cost": "3.00"
    }
  ],
  "physical_ending_quantity": "6",
  "output_scale": 2,
  "rounding_mode": "half-up",
  "reported": {
    "ending_inventory": "17.00",
    "cogs": "18.00"
  }
}
```

Response:

```json
{
  "result": {
    "reference_version": "IAS-2-2024-25-27+periodic-FIFO-v1",
    "computed": {
      "reference_version": "IAS-2-2024-25-27+periodic-FIFO-v1",
      "available_quantity": "15",
      "ending_quantity": "6",
      "sold_quantity": "9",
      "goods_available_cost": "35.00",
      "ending_inventory": "17.00",
      "cogs": "18.00",
      "ending_layers": [
        {
          "layer_id": "B1",
          "source": "beginning",
          "input_index": 0,
          "acquired_on": "2026-01-01",
          "quantity": "1",
          "unit_cost": "2",
          "extended_cost": "2.00"
        },
        {
          "layer_id": "P1",
          "source": "purchase",
          "input_index": 0,
          "acquired_on": "2026-01-10",
          "quantity": "5",
          "unit_cost": "3",
          "extended_cost": "15.00"
        }
      ]
    },
    "reported": {
      "ending_inventory": "17.00",
      "cogs": "18.00"
    },
    "ending_inventory_variance": "0.00",
    "cogs_variance": "0.00",
    "reconciled": true
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "inventory-fifo-period-reconcile",
  "version": "1.0.0",
  "input": {
    "beginning_layers": [
      {
        "layer_id": "B1",
        "acquired_on": "2026-01-01",
        "quantity": "10",
        "unit_cost": "2.00"
      }
    ],
    "purchases": [
      {
        "layer_id": "P1",
        "acquired_on": "2026-01-10",
        "quantity": "5",
        "unit_cost": "3.00"
      }
    ],
    "physical_ending_quantity": "6",
    "output_scale": 2,
    "rounding_mode": "half-up",
    "reported": {
      "ending_inventory": "17.00",
      "cogs": "18.00"
    }
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/inventory-fifo-period-reconcile/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"beginning_layers":[{"layer_id":"B1","acquired_on":"2026-01-01","quantity":"10","unit_cost":"2.00"}],"purchases":[{"layer_id":"P1","acquired_on":"2026-01-10","quantity":"5","unit_cost":"3.00"}],"physical_ending_quantity":"6","output_scale":2,"rounding_mode":"half-up","reported":{"ending_inventory":"17.00","cogs":"18.00"}}'
```

The machine-readable contract is at [/v1/tools/inventory-fifo-period-reconcile/versions/1.0.0](/v1/tools/inventory-fifo-period-reconcile/versions/1.0.0).

### CLI

```sh
node cli.mjs run inventory-fifo-period-reconcile 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Inventory fifo periodic value](/tools/inventory-fifo-periodic-value): Value ending inventory and cost of goods sold under periodic FIFO with exact, reproducible layer retention.
- [Inventory fifo period close](/tools/inventory-fifo-period-close): Close a periodic FIFO inventory period with exact valuation and a balanced caller-mapped closing entry.
- [Cashflow irr](/tools/cashflow-irr): IRR of equally spaced cash flows with every root reported, the chosen root named and no-solution cases signalled.
- [Bond cashflow schedule](/tools/bond-cashflow-schedule): Coupon dates, coupons remaining, accrued days and accrued interest for a regular fixed-coupon bond (Excel COUP* rules).
- [Cashflow payback period](/tools/cashflow-payback-period): Payback period of periodic cash flows with linear interpolation, optional discounting and the cumulative path.
- [Cashflow xnpv](/tools/cashflow-xnpv): NPV of dated cash flows with the Excel XNPV 365-day exponent and an explicit valuation date.
