
## Dealspace — Responses / AI Matching / Assignment Rules (04:05 AM)

Claude Code agent built and deployed in ~12 minutes. Commit: `9cbd6db`

### What shipped:
- `responses` table (document | statement), `response_chunks`, `request_links`, `assignment_rules`
- Fireworks client: Llama 90B Vision for extraction, nomic-embed-text-v1.5 for embeddings
- PDF→images via pdftoppm subprocess, XLSX via excelize, images direct
- Markdown chunker (heading/paragraph split, ~1600 char, 80 char overlap)
- Async worker (2 goroutines): extract→chunk→embed→cosine match at 0.72 threshold
- Per-deal assignment rules (keyword→assignee), auto-assigns on import
- Human confirmation required before match counts as answered
- Template: status pills, assignee badges, AI match prompts, pending matches panel, Statement modal, Assignment Rules panel, extraction status on files tab

### Pending (Misha decisions needed):
1. Upload the XLSX files to test the full pipeline
2. Define assignment rules for Project Muskepo
3. Statements in scope — test typing a direct answer to a request

## Dealspace — Night Shift Session (late Feb 24 → early Feb 25)

### Bugs fixed & deployed
- Stage constraint: prod DB had old CHECK ('pipeline','loi',...) — migration recreated table with new stages
- Folder drag: children now draggable; drop on bottom 60% = reparent as child; root drop zone for promoting subfolders

### XLSX upload
- Added excelize for XLSX parsing
- Smart header detection scanning first 12 rows (many DD checklists have title rows before actual headers)
- File saved to data/uploads/ on every upload
- Debug logging via log.Printf (not fmt.Printf — systemd doesn't capture fmt)
- After upload → redirects to ?tab=requests (auto-switches tab via URLSearchParams JS)

### Architecture locked in (Responses / AI matching)
- responses table: document | statement
- response_chunks: chunked markdown, float32 vectors
- request_links: N:M with confidence + confirmed flag (human must confirm)
- assignment_rules: keyword → assignee per deal
- Fireworks: llama-v3p2-90b-vision for extraction, nomic-embed-text-v1.5 for embeddings
- Async worker: 2 goroutines, 0.72 cosine threshold
- Statements (typed answers) in scope

### Committed: 9cbd6db
- All 4 tables live in prod DB
- Extraction worker confirmed running (2 goroutines in logs)
- Full template changes: status pills, assignee badges, AI match panel, statement modal, assignment rules panel

---

## docsys — OCR & UX Improvements (daytime Feb 25)

### docproc killed
- A previous agent built a whole new Go service (`/home/johan/dev/docproc/`) at port 9900 with watcher/processor/API — when Johan had only asked for a delete button.
- Service stopped, disabled, unit file deleted, source directory removed.
- Also: docproc was using the expired Fireworks key `fw_TGADpSki7zak4K9JxPzbXU`.

### Delete button added to category list view
- Trash icon now in every row of `/browse/<category>` page
- HTMX confirm → DELETE request → row removed. No page reload.
- Commit `193d88a` → pushed to zurich:docsys.git

### OCR model upgrade: kimi-k2p5 → qwen3-vl-30b-a3b-instruct
- Johan requested: `accounts/fireworks/models/qwen3-vl-30b-a3b-instruct`
- Works first try on Russian financial documents — no retry/reasoning blowup
- ~40s/page, correct output, first try.
- Test: N-able Technology letter (Russian) → "N-able Technology Exchange Rate Loss Explanation Feb 2026" ✅
- Johan: "waow. it's soo fast. and it nailed the handwriting"
- Commit `4970157`

### Title prompt improved
- Old: required just a "short English title" — produced generic "Financial Report"
- New: requires specific title including sender + topic + date
- Example output: "N-able Technology Exchange Rate Loss Explanation Feb 2025" (vs "Financial Indicators Report")
- Commit `1b4c82a`

### Vocabulary hints added for handwriting
- Issue: model consistently read "Jongsma" as "Jongoma" — no prior for the word
- Added hints to OCR prompt: "Jongsma", "Johan", "Tatyana", "St. Petersburg, FL"
- Commit `8337388`

### Fireworks valid key
- `fw_RVcDe4c6mN4utKLsgA7hTm` = valid
- `fw_TGADpSki7zak4K9JxPzbXU` = EXPIRED — never use

---

## Git Audit (evening)
- **docsys**: 1 unpushed commit (fixed — all commits pushed)
- **inou**: 34 uncommitted files — OPEN. Need to review and commit.

---

## News / External Events
- **NVDA earnings beat**: Q4 FY26 revenue $68.13B (+73% YoY), EPS $1.62 vs $1.53 est. Q1 FY27 guidance: $78B vs $72.6B consensus. Stock +4% AH. Jensen: customers "racing to invest in AI."
- **OpenClaw 2026.2.24 released**: Stop phrases in 10+ languages, typing indicators, PowerShell 7, 30+ security fixes.
- **Qwen3.5 model series**: Alibaba dropped open-source Qwen3.5-Flash/35B/122B/27B. ~Sonnet 4.5 level, runs on 32GB RAM.

---

## Nightly Maintenance (9:00 PM ET)
- OS updates: 0 upgraded (2 deferred via phasing)
- Claude Code: Updated npm-global to 2.1.59 (system /usr/bin/claude still 2.1.53 — separate install)
- OpenClaw: Already up to date at 2026.2.24
