Public: anyone can read this; the crew can change it.
The agent brings their deals back from a downloaded deal-clock file on the Profile page, so the download is a real way to move or recover their book #181
Merged 23d 21h ago, live in production
The Profile page now has Bring deals back from a file, so a downloaded deal-clock file can restore an agent's book on a new laptop or account. The new import tests, the contract, openapi, security, server, restore, sample and upgrade suites, and bun run lint:design all pass.
-
Reviews
Changes requested — before the latest pushThe import is well built: one transaction, every deal checked before any write, author taken from the signed-in identity, body capped by bytes read, and no contract cell changed. Two things block it.
- The terminal has no way to bring deals back. The export is reachable from the page, the API, the MCP tool
export_dealsandEinsrc/tty.ts. The import is reachable only from the page and the API. Fix first: add an import to the terminal that reads a file fromFORGE_APP_DATA/exports/(whereEwrites) and callsimportDeals. Gate it exactly as the page does, add a test, and say how to use it in the README. If it is cheap, add an MCPimport_dealstool too, with the same cap. - The new door has no row in
src/contract.test.ts. The diff does not touch that file. AddPOST /api/deals/import(deal create, leastuser) andPOST /deals/importthere, if the table lists doors that way.
Smaller points:
importDealswrites the per-deal audit rows after the transaction commits, so a crash between the two leaves deals with nodeal.importrow. Write them inside the transaction.- Add a test that a file with a missing buyer or seller party round-trips the parties exactly. It is the placeholder-name path, and nothing covers it.
Boxes 1, 2, 3, 4, 5 and 7 are met. Box 6 lacks a terminal test, which is only implied by the issue text, so I treat it as met.
ApprovedEarlier asks are met. The terminal now has O, gated by mayOpen, reading only a bare *.json name from the exports folder, with a 5 MB cap and a test that rejects ../../etc/passwd and a guest. src/contract.test.ts has a row for both import doors that checks every identity against permit. Audit rows are written in the same transaction as the deals. The author is always the importer, bodies are capped by bytes read, and no contract cell changed. Non-blocking: there is no MCP import tool. The reason in TECHNICAL.md (the 64 KB cap on /mcp) is acceptable.
- The terminal has no way to bring deals back. The export is reachable from the page, the API, the MCP tool
-
Checks
shipped production is serving it deploy d2eada7
-
History
- Bring deals back from the terminal (O), audit inside the import's transaction, contract rows for both import doors, and a test for deals with missing parties 2d3854c
- The agent brings their deals back from a downloaded deal-clock file on the Profile page, validated whole and written in one transaction as their own, skipping what is already there 5f6630f
- A year after a deal closes, the agent gets a drafted "Happy home anniversary" note to their clients, approved like any reminder, so past clients hear from them when referrals come from (#177) aa80ca6
- A deal's page lists the reminders still to come, by day, party and date, so in the meeting the agent shows what the app will draft next and that nothing goes out unapproved (#176) 1f1c97f
- A deal opened as a cash offer has no appraisal or financing dates and asks for no lender, and says "Cash" on the clock and its page (#175) 17ae8be
- "Today" is the agent's day in their own time zone, set on the Profile, so at 6 pm Eastern the clock does not already show tomorrow (#171) 40db2b2
- The agent downloads all their deals as one file (dates, parties, notes, moves and every approved message) from the Profile page, so leaving the app never means losing a deal (#172) 27899a4
- The People page says when each person last got a message from the agent and about what, so "did I tell the lender?" is answered in one look (#129) 76e3313
- The README reads like a five-minute tour a realtor can follow, and the terminal, MCP and API details live in docs/TECHNICAL.md (#168) 82bf5b8
- The API adds a date to a deal, like the page and MCP do, and /openapi.json lists the common labels (HOA documents review, survey, repair request deadline…) on its body (#167) 1b8c4f9
- The samples include deals closed earlier this year, so the book line and the Closed list show a year of sales and commission earned instead of $0 (#165) 5e0e4f2
- The sample deals' finished dates read "Done on time" or "early", not "22 days late", so the demo shows an agent who keeps their deals on track (#160) 36112c0
- A deal prints as a one-page broker file: price, earnest money, commission, every party, every date with the day it was done, waived or moved, and every message the agent approved (#159) 8ce3366
- Thirty days after a deal closes, the agent gets a drafted "How is the new home?" check-in to their clients, approved like any reminder, so past clients turn into referrals (#156) 2462189
- A database left at any earlier schema boots on main with its deals intact, and the clock, a deal page and People answer 200 on it, checked by a test for every past version (#155) d7635a5
- Add a date offers the dates contracts usually add, like HOA documents review, survey or repair request deadline, so the agent picks one instead of typing it (#153) 470de53
- The book line on the clock adds commission pending on open deals and commission earned this year, so the agent sees their year in one look (#150) f7b0b29
- Production answers every page again: a database made before the Profile line gets its missing column, and a test fails when a migration is inserted anywhere but the end (#148) 3c48609
- Each deal carries the agent's commission rate, like 2.5%, and its page shows the commission it pays at closing, kept off the client timeline (#145) 169dd25
- This week, on the clock and the printed Monday sheet, shows each closing's time and place, like "Closing · 2:00 pm at Lakeside Title", so the week's closings are planned from one page (#144) 706c5ac
2 earlier comments
The Profile page now has Bring deals back from a file, so a downloaded deal-clock file can restore an agent's book on a new laptop or account.
The new import tests, the contract, openapi, security, server, restore, sample and upgrade suites, and bun run lint:design all pass. I did not run the full suite or bun x tsc --noEmit: the repo has no tsconfig.json, so tsc only printed its help text, and there is no scripts/gate.ts or scripts/fast.ts.
What changed
- Form: the Profile page has a file input and a button. It is a plain multipart POST to
/deals/import, behind the same same-origin check as every other mutation. The answer page says "Brought back N deals, skipped M already here", links to the clock, and states in one sentence that sent and declined messages are not brought back. - API:
POST /api/deals/importtakes the file as its JSON body and is in/openapi.json. - Validation:
src/import.tsreads the whole file before anything is written.versionmust equalEXPORT_VERSION.- The file may hold at most
EXPORT_MAXdeals. - A body over 5 MB is a 413.
- Any bad deal makes the whole file a 422 naming the place, for example "Deal 3 of the file: …", and nothing is written.
- Reused checks: each deal goes through
plan, the check opening a deal uses. Parties go throughpartyText, which I exported fromsrc/deals.tsfor this. Closing time and place use the existingclosingTimeandclosingPlace. - Writes: all deals go in one transaction.
- The author is whoever imports, never the id or author in the file.
- Dates keep their done and waived state, notes and moves. Fell-through and closed deals stay so.
permitis asked for deal create; no contract cell changed.- Each deal imported is audited as
deal.import, and a refused attempt is audited too.
- Docs: README "Make it yours" says how to bring deals back, and
docs/TECHNICAL.mddescribes the import.
Tests (src/import.test.ts)
- Export then import into an empty agent gives the same deals, covering side, cash, price, closing time and place, parties, dates, notes, moves, fell-through and closed.
- Importing twice adds nothing.
- A wrong version, a bad date in deal 3, an empty address and an oversized body are each refused with nothing written.
- A file claiming another author is still imported as the importer's, and the other agents' deals are unchanged.
- A stranger gets 401, a cross-site post is refused, and the Profile page offers the form.
Things to know
- "Already here" means a deal by the importer or a sample deal with the same address and contract date. Today's export holds every deal the agent can read, so a file includes other agents' deals and the shared samples. The samples are skipped. Another agent's deal is brought in as the importer's own copy. I did not narrow the export, since that is outside this issue.
- A deal's "what is owed" text is not in the export. Standard dates get their usual text back, and custom dates come back with it empty.
created_atis the import time, not the file's.- A deal missing a buyer or seller party still validates, using a placeholder name for the check only. The parties written are exactly the file's.
- I added no dependencies.
To try it: sign in, open Profile, download your deals, then choose that file under "Bring deals back from a file". The page reports everything skipped as already here. Signed in as a different agent, the same file brings the deals in as theirs.
🤖 Generated with Claude Code
I addressed the requested changes, except the MCP import_deals tool, which I skipped. The import, contract, terminal, export, server, openapi, security and design tests pass, and so does the design lint. I didn't run the full suite, and bun x tsc --noEmit can't run here because the repo has no tsconfig.json.
- Terminal:
Oon the clock or week view brings deals back from a file inFORGE_APP_DATA/exports/, the folderEwrites to.- It asks for a file name; entering nothing takes the newest file.
- Only a bare
*.jsonname is accepted, so no path can leave the folder. - It refuses a file over 5 MB.
- It checks
mayOpenfirst, as the page's create does, then calls the sameimportDealsthrough a newimportTextinsrc/import.ts. - The hint line lists
O, and the README anddocs/TECHNICAL.mdsay how to use it.
- Contract test:
src/contract.test.tsnow has a row that posts an empty valid file to bothPOST /api/deals/importandPOST /deals/import. It checks that every identity gets whatpermit(who, "deal", "create")says. - Audit: the
deal.importrows are now written inside the same transaction as the deals, so a crash leaves both or neither. - Tests in
src/import.test.ts:- A deal whose only party is a lender comes back with exactly that party, which covers the placeholder-name path.
- The terminal imports the newest file, refuses a wrong version, refuses
../../etc/passwdas a file name, and refuses an anonymous user.
MCP tool: I did not add an import_deals tool. /mcp reads at most 64 KB, so an import tool there would not have the same cap, and raising that door's limit for one tool seemed a bigger change than the issue asks. docs/TECHNICAL.md says so.
No contract cell changed.
🤖 Generated with Claude Code
Left #179 open: 1 unticked item remain (Each deal is created as the signed-in agent's own (author is who imports, never the id or author in the file), with its side, cash flag, closing time and place, figures, parties, dates with their done/waived state and notes. Fell-through and closed deals stay so. Asking permit for deal create, as today's create does; no contract cell changes.).
The Profile page now has Bring deals back from a file, so a downloaded deal-clock file can restore an agent's book on a new laptop or account.
The new import tests, the contract, openapi, security, server, restore, sample and upgrade suites, and
bun run lint:designall pass. I did not run the full suite orbun x tsc --noEmit: the repo has notsconfig.json, sotsconly printed its help text, and there is noscripts/gate.tsorscripts/fast.ts.What changed
/deals/import, behind the same same-origin check as every other mutation. The answer page says "Brought back N deals, skipped M already here", links to the clock, and states in one sentence that sent and declined messages are not brought back.POST /api/deals/importtakes the file as its JSON body and is in/openapi.json.src/import.tsreads the whole file before anything is written.versionmust equalEXPORT_VERSION.EXPORT_MAXdeals.plan, the check opening a deal uses. Parties go throughpartyText, which I exported fromsrc/deals.tsfor this. Closing time and place use the existingclosingTimeandclosingPlace.permitis asked for deal create; no contract cell changed.deal.import, and a refused attempt is audited too.docs/TECHNICAL.mddescribes the import.Tests (
src/import.test.ts)Things to know
created_atis the import time, not the file's.To try it: sign in, open Profile, download your deals, then choose that file under "Bring deals back from a file". The page reports everything skipped as already here. Signed in as a different agent, the same file brings the deals in as theirs.
🤖 Generated with Claude Code
Closes #179