bmrc-audit-workbench

Implements audit actions, ledger writes, and inventory helpers for the BMRC audit page.

2|Updated Dec 24, 2025
One-click install
npx skills add https://github.com/iv-zhang/BMRC-Logistics --skill bmrc-audit-workbench-iv-zhang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bmrc-audit-workbench
Source: https://github.com/iv-zhang/BMRC-Logistics/tree/main/.claude/skills/bmrc-audit-workbench
Command: npx skills add https://github.com/iv-zhang/BMRC-Logistics --skill bmrc-audit-workbench-iv-zhang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working on the BMRC Logistics audit page risk breaking analytics and inventory invariants because every audit action must perform a triple write (inventory change, inventory_logs row, auditEvents ledger entry) and follow strict shipment, move, and report/fix semantics that are easy to get wrong. ## Core Features & Use Cases - Five audit actions with sanctioned helpers: Count (submitAuditEntries), Move (moveItemLocation/moveItemsBulk), Shipment (addShipment), Report (reportItemIssue), and Fixed (recordItemFix), all living in app/lib/audit-actions.ts and audit-helpers.ts. - Triple-write enforcement: Every action writes the inventory change, an inventory_logs row, and an auditEvents ledger entry via recordAuditEvent, with removeUndefined() wrapping for Firestore safety. - Domain rules: Sealed batches for bag-tracked items, zero-stock tombstone batches for box-tracked items, zone lock handling, canUserAudit permissions, monthly audit cycles, and restock analysis. - Use Case: When adding a new audit field or action, follow the checklist: add a headless helper with the triple write, wire the drawer UI to it, and run npm run test:invariants to verify INV-1/2/3/4/12. ## Quick Start Ask the assistant to add a new audit action or modify an existing one in the BMRC audit workbench following the triple-write rule and helper conventions.

Frequently Asked Questions about bmrc-audit-workbench

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new audit action to the BMRC audit page?▼

Add a helper function in app/lib/audit-actions.ts or audit-helpers.ts that performs the triple write: the inventory change, an inventory_logs row, and an auditEvents ledger entry. Then wire the drawer UI in audit-action-drawer.tsx to call that helper, keeping it headless for emulator tests.

What is the triple-write rule for inventory audit actions?▼

Every audit action must write three things: the inventory change itself, an inventory_logs row with who/what/when details, and an auditEvents ledger entry via recordAuditEvent. Skipping any write silently breaks usage metrics and reconciliation analytics.

How does addShipment handle bag-tracked versus box-tracked items?▼

Bag-tracked items receive a new sealed batch since batches are their stock source of truth. Box-tracked items get an atomic unopenedBoxes increment plus a zero-stock metadata tombstone batch when lot and expiry were recorded.

Why does Firestore reject my audit action payload?▼

Firestore rejects documents containing undefined field values. Wrap all audit payloads in removeUndefined() before writing so optional fields that are not set are stripped from the document.

Can I update an item's storageLocation directly with updateDoc?▼

No, never updateDoc a storageLocation directly. Use moveItemLocation or moveItemsBulk, which resolve the destination zone, reject unknown zone IDs per INV-12, and sync the legacy location and room mirrors.

How do audit permissions and zone locks work in BMRC Logistics?▼

canUserAudit grants access to admins and quartermasters always, and to others via the canAudit flag set with setAuditPermission. acquireZoneLock and releaseZoneLock prevent two members from auditing the same zone simultaneously.