{"id":112001,"plugin_id":"plugin_asdk_app_69250fb6281c819195b52a1556b0060c","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-24T00:11:13.452Z","digest":"33606785a8f9ce021991dc66972f804178f0d563e2995364fc3c71216d4bd0ca","against":null,"payload":{"description":"Find and complete missing items on your transactions — receipts, memos,\naccounting categories, funds, and attendees. Use when: 'missing receipts',\n'upload receipt', 'attach receipt', 'receipt sweep', 'add memo',\n'categorize transactions', 'missing items', 'transaction cleanup',\n'fix my transactions', 'set tracking category', 'assign to fund',\n'bulk memo update', 'receipt compliance'. Do NOT use for: approving\ntransactions (use ramp-approval-dashboard), vendor documents like W-9s or\ncontracts (use ramp-manage-vendors), or spend reporting (use ramp-spend-analysis).","included_files":[],"name":"ramp-complete-expenses","skill_md_contents":"---\nname: ramp-complete-expenses\narea: Cards and Spend\nsupported_surfaces: [cli, mcp]\ndescription: |-\n  Find and complete missing items on your transactions — receipts, memos,\n  accounting categories, funds, and attendees. Use when: 'missing receipts',\n  'upload receipt', 'attach receipt', 'receipt sweep', 'add memo',\n  'categorize transactions', 'missing items', 'transaction cleanup',\n  'fix my transactions', 'set tracking category', 'assign to fund',\n  'bulk memo update', 'receipt compliance'. Do NOT use for: approving\n  transactions (use ramp-approval-dashboard), vendor documents like W-9s or\n  contracts (use ramp-manage-vendors), or spend reporting (use ramp-spend-analysis).\n---\n\n## Non-Negotiables\n\n- **Pass `--rationale` on every command** — it is a required field on these agent-tools (a non-empty string, max 1024 chars). With `--json`, supply it as a `\"rationale\"` key in the body. Omitting it returns `HTTP 422 (DEVELOPER_INVALID_SCHEMA)`, in both agent and human modes.\n- Scope to the user's own transactions by default (`--transactions_to_retrieve my_transactions`) unless they explicitly request broader access.\n- Show the transaction details before editing. Never blind-edit.\n- Never upload a receipt without confirming the match — wrong receipt on wrong transaction is worse than no receipt.\n- For bulk edits or receipt sweeps, present the plan and confirm before executing.\n- Use `ramp transactions missing {uuid}` as the reliable check for whether a receipt is attached — it returns `missing_receipt: true/false` in real time. The `receipt_uuids` field in the list response can be used as a quick filter, but it may be stale (e.g., remaining null even after a successful upload+attach).\n- Receipts must be **base64-encoded** for upload. Accepted types: PNG, JPEG, PDF, HEIC, WEBP.\n- **MCP receipt uploads have a 3 MB decoded-file cap** (3,145,728 bytes). Do not retry an oversized file with the MCP tool; have the user upload it through the Ramp web or mobile app, or forward it from their work email to `receipts@ramp.com`.\n- `receipts attach` is CLI-only. MCP callers must provide `transaction_uuid` during `upload-receipt-file` so the receipt is uploaded and attached in one call.\n- The `--user_submitted_fields` flag tracks provenance — include it to mark which fields the user explicitly provided vs agent-inferred.\n- All CLI flags use **underscores**, not hyphens (e.g., `--from_date`, `--transaction_uuid`).\n\n## `--rationale` is required\n\nEvery command in this skill maps to an agent-tool endpoint that **requires** a\n`rationale`: a non-empty string (max 1024 chars) explaining why you are making\nthe call. Pass it as `--rationale \"...\"`, or include a `\"rationale\"` key in the\n`--json` body. It is required for **both** agent (`--agent`) and human\n(`agent=false`) invocations — omitting it is the #1 cause of `HTTP 422` errors on\nthese tools. The examples below all include it; keep it on every call.\n\n## Workflow\n\n### Step 1: Find transactions needing attention\n\n```bash\nramp transactions list --transactions_to_retrieve my_transactions \\\n  --from_date {start} --state cleared --rationale \"Find transactions needing cleanup\" --agent --page_size 50\n```\n\nFor any transaction, check what's missing:\n\n```bash\nramp transactions missing {transaction_uuid} --rationale \"Check missing items on the transaction\"\n```\n\nReturns `missing_receipt` (bool), `missing_memo` (bool), and `missing_accounting_items` (an array of objects, not category-name strings). Each object has this shape:\n\n```json\n{\n  \"category_name\": \"QuickBooks Online Department\",\n  \"category_id\": \"category-uuid\"\n}\n```\n\nPresent results grouped by what's missing:\n\n```\nNeeds attention: 8 transactions ($4,520 total)\n\n  Missing receipts (3):\n    $1,200  United Airlines     2026-03-01\n    $  800  Hilton Hotels       2026-03-03\n  Missing memos (5): ...\n  Missing accounting categories (2): ...\n```\n\n### Step 2: Fill memos\n\nBefore writing memos manually, check if Ramp has suggestions:\n\n```bash\nramp transactions memo-suggestions {transaction_uuid} --rationale \"Fetch AI-suggested memos\"\n```\n\nReturns `memos[]` — an array of suggested memo strings based on the transaction context. Present suggestions and let the user confirm or edit, then:\n\n```bash\nramp transactions edit {transaction_uuid} --memo \"Q2 team offsite catering\" --rationale \"Add the user's memo\"\n```\n\nTo clear a memo, pass an empty string: `--memo \"\"` (note: `--rationale` itself must never be empty).\n\n### Step 3: Assign to a fund/spend allocation\n\n```bash\nramp transactions edit {transaction_uuid} --fund_uuid {fund_uuid} --rationale \"Assign transaction to the chosen fund\"\n```\n\nTo find available funds:\n\n```bash\nramp funds list --funds_to_retrieve MY_FUNDS --include_balance --rationale \"List funds to assign the transaction\" --agent\n```\n\n### Step 4: Set tracking categories (accounting codes)\n\nFirst, get available categories and their options:\n\n```bash\n# List categories\nramp accounting categories --rationale \"List tracking categories\" --agent\n\n# List options for a specific category (use UUID from above)\nramp accounting category-options {tracking_category_uuid} --rationale \"List options for the tracking category\" --agent --page_size 50\n```\n\nThen edit via `--json` (tracking categories aren't exposed as named flags).\n\n**Important:** When using `--json`, you must include both `rationale` and `transaction_uuid` in the body. The `--json` flag bypasses the CLI's automatic injection of the positional arg and the `--rationale` flag, so a `--json` body without a `\"rationale\"` key returns `HTTP 422`.\n\n```bash\nramp transactions edit --json '{\n  \"rationale\": \"Set the tracking category the user chose\",\n  \"transaction_uuid\": \"{transaction_uuid}\",\n  \"tracking_category_selections\": [\n    {\n      \"category_uuid\": \"{category_uuid}\",\n      \"option_selection\": \"{option_uuid}\"\n    }\n  ],\n  \"user_submitted_fields\": [\"tracking_category_selections\"]\n}'\n```\n\nNote: the field names inside `tracking_category_selections` are `category_uuid` and `option_selection` — NOT `tracking_category_uuid` / `tracking_category_option_uuid` (those are the names returned by the categories list endpoint, not the edit endpoint).\n\n### Step 5: Set attendees\n\n```bash\nramp transactions edit --json '{\n  \"rationale\": \"Record attendees for this expense\",\n  \"transaction_uuid\": \"{transaction_uuid}\",\n  \"attendee_selections\": {\n    \"non_ramp_attendees\": [\n      {\"attendee_name\": \"Jane Smith\", \"attendee_email\": \"jane@company.com\"}\n    ],\n    \"include_self_as_attendee\": false\n  },\n  \"user_submitted_fields\": [\"attendee_selections\"]\n}'\n```\n\n### Step 6: Upload receipts\n\nWhen the user has a receipt file and wants to attach it to a transaction:\n\n```bash\n# Base64 encode the file (agent does this)\n# For a file at /path/to/receipt.pdf:\nbase64 -i /path/to/receipt.pdf | tr -d '\\n'\n\n# Upload and auto-attach in one step\nramp receipts upload \\\n  --content_type \"application/pdf\" \\\n  --filename \"receipt.pdf\" \\\n  --file_content_base64 \"{base64_string}\" \\\n  --transaction_uuid {txn_uuid} --rationale \"Upload the receipt\"\n```\n\nThe response returns `receipt_uuid` and `attached_to_transaction: true/false`.\n\nFor CLI callers, omitting `--transaction_uuid` uploads the receipt without attaching it. The CLI can attach it later with:\n\n```bash\nramp receipts attach {receipt_uuid} {transaction_uuid} --rationale \"Attach the receipt to the transaction\"\n```\n\nDelayed attachment is not available over MCP. MCP callers must include `transaction_uuid` in the upload request; otherwise the uploaded receipt cannot be attached through this MCP workflow.\n\n**Bulk upload from a directory** of receipt images/PDFs:\n\n```bash\n# For each file:\n# 1. Determine MIME type from extension (.pdf → application/pdf, .png → image/png, .jpg → image/jpeg)\n# 2. Base64 encode: base64 -i <file> | tr -d '\\n'\n# 3. Match to a transaction by inferring merchant/date from filename or content\n# 4. Upload with -n (dry run) first to verify\n\nramp receipts upload \\\n  --content_type \"image/png\" \\\n  --filename \"uber-2026-03-01.png\" \\\n  --file_content_base64 \"{base64}\" \\\n  --transaction_uuid {txn_uuid} -n --rationale \"Upload the receipt\"\n\n# If correct, upload for real (without -n)\n```\n\n### Step 7: Handle missing receipts without a file\n\nIf the user doesn't have a receipt and wants to provide a reason:\n\n```bash\nramp transactions explain-missing {transaction_uuid} --reason \"Lost receipt — vendor confirmed purchase via email\" --rationale \"Record why the receipt is missing\"\n```\n\nOr generate a link to the missing receipt affidavit form (the user must complete it manually in the browser):\n\n```bash\nramp transactions flag-missing {transaction_uuid} --rationale \"Generate a missing-receipt affidavit link\"\n```\n\n## Receipt Matching Heuristics\n\nWhen matching receipt files to transactions:\n\n- **Filename patterns**: `merchant-YYYY-MM-DD.pdf`, `YYYY-MM-DD-merchant.png`, etc.\n- **Amount matching**: If the receipt shows an amount, match to transactions within ±$1 at that merchant on that date.\n- **Date matching**: Receipt date should be within 1-2 days of `transaction_time`.\n- **One receipt per transaction**: Before each upload, re-check the live state with `ramp transactions missing {transaction_uuid}` and skip when `missing_receipt` is `false`. Do not rely on `receipt_uuids` from an earlier list response — it can be stale (see Gotchas) and would trigger a duplicate upload of a recently attached receipt.\n\nFlag uncertain matches as \"possible match — verify\" rather than auto-uploading.\n\n## MIME Type Reference\n\n| Extension | Content type |\n|---|---|\n| `.png` | `image/png` |\n| `.jpg`, `.jpeg` | `image/jpeg` |\n| `.pdf` | `application/pdf` |\n| `.heic` | `image/heic` |\n| `.webp` | `image/webp` |\n\n## Bulk Cleanup Workflow\n\nFor cleaning up many transactions at once:\n\n1. Fetch all transactions in the period\n2. Check `missing_items` on each (or batch-check via individual calls)\n3. Group by what's missing: memo, accounting, receipt\n4. Present summary: \"12 transactions need memos, 5 need accounting categories, 3 need receipts\"\n5. For memos: fetch suggestions for each, present them, let user confirm or edit\n6. For categories: if most transactions share a category, offer to bulk-apply\n7. For receipts: match files per the heuristics above, dry-run first, confirm the plan\n8. Execute sequentially, report progress\n\n## Provenance Tracking\n\nThe `--user_submitted_fields` flag tells Ramp which fields the user explicitly provided. This matters for compliance — it distinguishes user intent from agent inference.\n\nInclude it when setting fields via `--json`:\n\n```bash\nramp transactions edit --json '{\n  \"rationale\": \"Add the user's memo\",\n  \"transaction_uuid\": \"{transaction_uuid}\",\n  \"memo\": \"Client dinner with Acme team\",\n  \"user_submitted_fields\": [\"memo\"]\n}'\n```\n\nValid values: `attendee_selections`, `attendee_uuids`, `fund_uuid`, `memo`, `tracking_category_selections`, `trip_selection`.\n\nWhen using named flags (`--memo`, `--fund_uuid`), provenance is tracked automatically.\n\n## Pagination\n\nIf `pagination.next_cursor` is not null in the JSON envelope, there are more results:\n\n```bash\nramp transactions list --transactions_to_retrieve my_transactions \\\n  --from_date {start} --state cleared --agent --page_size 50 \\\n  --next_page_cursor \"{cursor}\" --rationale \"List the user's transactions\"\n```\n\n## Example Session\n\n```\nUser: I have a bunch of transactions that need cleanup\n\nAgent: Let me check what's missing on your recent transactions.\n> ramp transactions list --transactions_to_retrieve my_transactions \\\n>   --from_date 2026-03-01 --state cleared --rationale \"Find transactions needing cleanup\" --agent --page_size 50\n\nFound 8 transactions. Checking missing items on each...\n> ramp transactions missing {uuid} --rationale \"Check missing items\" (×8)\n\nSummary:\n  5 need memos\n  2 need accounting categories\n  1 needs a receipt\n\nLet me get AI-suggested memos for the 5:\n> ramp transactions memo-suggestions {uuid} --rationale \"Fetch suggested memos\" (×5)\n\nTransaction                              Suggested memo\n$135  Facebook Ads     2026-03-02       \"Q1 paid social campaign\"\n$220  AWS              2026-03-05       \"March infrastructure costs\"\n$89   Uber             2026-03-10       (no suggestion)\n\nWant to accept these suggestions, edit them, or write your own?\n\nUser: Accept Facebook and AWS. The Uber was a client dinner ride.\n\nAgent: Updating 3 transactions:\n> ramp transactions edit {fb-uuid} --memo \"Q1 paid social campaign\" --rationale \"Apply accepted memo suggestion\"\n> ramp transactions edit {aws-uuid} --memo \"March infrastructure costs\" --rationale \"Apply accepted memo suggestion\"\n> ramp transactions edit {uber-uuid} --memo \"Client dinner transportation\" --rationale \"Set memo from user input\"\n\nDone. Now the receipt: United Airlines, $1,200 on 2026-03-05.\n\nUser: It's at ~/Downloads/united-mar5.pdf\n\nAgent: > base64 -i ~/Downloads/united-mar5.pdf | tr -d '\\n'\n> ramp receipts upload --content_type \"application/pdf\" \\\n>   --filename \"united-mar5.pdf\" \\\n>   --file_content_base64 \"{base64}\" \\\n>   --transaction_uuid \"abc-123\" -n --rationale \"Upload the receipt\"\n\nDry run looks correct — uploading to United Airlines ($1,200) on 2026-03-05.\nProceed?\n\nUser: yes\n\nAgent: > ramp receipts upload --content_type \"application/pdf\" ...\nReceipt uploaded and attached (receipt_uuid: def-456).\n2 transactions still need accounting categories — want to tackle those next?\n```\n\n## When NOT to Use\n\n- **Approving or rejecting items** — use ramp-approval-dashboard\n- **Vendor documents (W-9s, contracts, COIs)** — use ramp-manage-vendors\n- **Company-wide spend reporting** — the CLI is scoped to your own data; use ramp-spend-analysis or the Ramp dashboard\n\n## Gotchas\n\n| Issue | Fix |\n|---|---|\n| `HTTP 422 \"API error 422: There was an error.\"` | You omitted `rationale`. It's a required field on these agent-tools (`DEVELOPER_INVALID_SCHEMA`) — add `--rationale \"...\"`, or a `\"rationale\"` key in the `--json` body. Required for both agent and human (`agent=false`) calls. Not a permissions problem. |\n| `--dry_run` succeeds but the real call 422s | `--dry_run` only prints the body; it does not validate it. Confirm `rationale` is present before sending. |\n| `amount` is a formatted string (\"$135.40\") | Strip \"$\" and \",\" for numeric operations |\n| `--state` values are lowercase | Use `cleared`, `pending`, `declined` — not uppercase |\n| Tracking categories require `--json` | Named flags only cover `--memo` and `--fund_uuid`. When using `--json`, include both `rationale` and `transaction_uuid` in the body. |\n| Category field names differ between endpoints | `accounting category-options` returns `tracking_category_option_uuid`, but `transactions edit` expects `category_uuid` + `option_selection` |\n| `memo-suggestions` may return empty | Not all transactions have enough context for suggestions |\n| `accounting category-options` paginates with integers | Unlike other endpoints, the cursor is a number, not a string |\n| `--transactions_to_retrieve` is required | Always include it on `transactions list`. Use `my_transactions` for personal, `all_transactions_across_entire_business` for admin scope |\n| Searching for specific transactions | Use `--reason_memo_merchant_or_user_name_text_search \"query\"` (min 3 chars) |\n| Large receipt files may hit shell arg limits | CLI: for files >100KB, write base64 to a temp file and use `--json` with the content read from file. MCP: decoded files over 3 MB are rejected; hand them off to the Ramp web/mobile app or `receipts@ramp.com`. |\n| Delayed receipt attachment | `receipts attach` is CLI-only. MCP callers must include `transaction_uuid` during upload. |\n| Duplicate upload risk | Re-check `ramp transactions missing {uuid}` immediately before uploading; skip when `missing_receipt` is `false`. `receipt_uuids` alone can be stale. |\n| Comment on a transaction | `ramp general comment {uuid} --ramp_object_type transaction --message \"text\" --rationale \"Add a comment for the user\"` |\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}