Open source · self-hosted · Docker

BSF186 Agent

Drop photos of your home into a Google Drive folder. The agent lists what it sees, values it, splits it into goods you bring now and goods that follow, and writes a filled CBSA BSF186 Personal Effects Accounting Document back into the same folder.

Download latest (.zip) Source code on GitHub

For settlers, former residents and seasonal residents moving to Canada.

What it does

How it works

  1. You add photos to a Google Drive folder.
  2. The agent downloads only photos not yet in processed_photos.csv.
  3. Claude lists the items in each batch of photos.
  4. A second Claude call merges duplicates across all photos, applies your "now vs. later" rule and estimates values in CAD.
  5. The agent fills BSF186 and uploads …-filled.pdf, …-goods-to-follow.pdf and the CSV ledger to the folder.

Requirements

Install

1. Get the code

git clone https://github.com/IceSkatingCoach/bsf186-agent.git
cd bsf186-agent

Or download the zip and unpack it.

2. Add the blank form

Save the CBSA form as template/bsf186-eng.pdf.

3. Configure

cp .env.example .env
cp profile.example.json profile.json

In .env set ANTHROPIC_API_KEY and DRIVE_FOLDER_ID (the last part of the folder URL, without ?usp=sharing). In profile.json enter your name, addresses, dates, status (former_resident, settler or seasonal_resident), family members, and the rule for which goods travel now and which follow.

4. Connect Google Drive

  1. In Google Cloud Console, enable the Google Drive API.
  2. Configure the OAuth consent screen, add yourself as a user, and publish the app (apps left in Testing lose their login after 7 days).
  3. Create an OAuth client ID of type Desktop app and save the JSON as secrets/client_secret.json.
  4. Sign in once:
    docker compose run --rm -p 8765:8765 agent python agent.py auth
    Open the printed URL and approve. The token is stored in data/token.json.

5. Run

# one check, to test
docker compose run --rm agent python agent.py once

# keep running in the background, checking every 10 minutes
docker compose up -d --build
docker compose logs -f

Files the agent writes

FileWhereContents
<prefix>-filled.pdfDrive folderBSF186 plus itemized List A and List B
<prefix>-goods-to-follow.pdfDrive folderTwo copies of List B with a box for the CBSA stamp
processed_photos.csvDrive folder and data/filename, md5, Drive file id, status, processed_at
extracted_items.jsondata/Items found per photo, reused when new photos arrive

To re-read a photo, delete its row from data/processed_photos.csv. To start over, also delete data/extracted_items.json.

Privacy and cost

Important

This is not a CBSA product. Values are estimates and the item list comes from photos, so review every line, add serial numbers, and correct quantities before you sign. Remove the "Notes for importer" section before submitting. Vehicles must also meet Transport Canada import rules.