# PIL Barak · Read-only Front Office

A read-only map of the office front office that became a working read model, a Hebrew app and an MCP server for agents: 37 live dBase/BDE tables, 1,409 clients, 47,870 active register rows, 70,923 copied documents, a Hebrew RTL Barak 360 app and 10 read-only MCP tools over a SELECT-only PostgreSQL role.

**Status:** Private · Projects · 2026

- **Local checkout:** `/Users/simon/Developer/pil` (branch `main`, last commit 0d85944, 2026-11-07 — Document the Barak 360 app README)
- **Uncommitted changes:** 35 file(s) at brief generation time
- **Repository:** https://github.com/ShimonNavon/pil
- **On another machine:** `git clone https://github.com/ShimonNavon/pil` — the paths below are Simon's Mac
- **Review #16:** https://ai-pricing.navonsimon.com/#/barak360
- **Review #15:** https://ai-pricing.navonsimon.com/#/barakcopy
- **PIL office:** https://projects.navonsimon.com/p/pil-office
- **Note:** Internal office work · Barak stays read-only · read model built, Barak 360 and its MCP server live on the Mac · second copy verifying.

## Stack

dBase III/IV .DBF through Borland BDE (source), Tevel Barak 11.35, RustFS / S3-compatible bucket, rustfs-mcp (official RustFS MCP, pull from the bucket), PostgreSQL 17 read model, Python 3.12 + FastAPI, MCP server (read-only tools), Hebrew RTL app, Read-only

## Start here

- `mapping/barak/inventory.json` — 37 live tables, every field with type/length/encoding, row counts, keys, integrity and document resolution
- `mapping/barak/data-dictionary.md` — readable dictionary grouped by module, with the Hebrew business vocabulary and measured data-quality findings
- `mapping/barak/documents.md` — QUOT + files/חלוקות archives, register-to-file resolution, legacy path aliases and the exception lists
- `mapping/barak/findings.md` — 17 findings that change the plan, each with evidence and consequence
- `office-refresh/BARAK-COPY-PLAN.md` — the seven-wave copy and replacement plan, with gates, verification, risks and decisions
- `office-refresh/barak-copy.html` — the one-page wall diagram: source, copy, destination, waves and gates
- `~/Developer/barak-study/` — the study scripts and raw extracts, outside the repo; contains row-level data and is never published
- `mapping/barak/gui/gui-map.md` — GUI pass: app shell, 16 screens, workflows, hotkeys, permissions and the replacement blueprint
- `mapping/barak/gui/screens.json` — every captured screen with fields, columns, actions, tables and notes
- `mapping/barak/gui/menus.json` — the full 94-item menu tree from a read-only Win32 enumeration
- `read-model/README.md` — built read model: 37 raw tables / 80,820 rows, 70,923-file index, counts, scripts and controls
- `read-model/SCHEMA.md` — column and view contract for the read-only app, including source_table/source_record citations
- `office-refresh/BARAK360.md` — the read-only Hebrew app: screens, run/stop, identity gate and limits
- `office-refresh/RUSTFS-MCP.md` — the official RustFS MCP on the Mac: build flags, SSH tunnel to win01:9000, private credentials file, wrapper, opencode registration, the 6 tools, the verified pull and the boundary
- `office-refresh/barak360/API.md` — FastAPI endpoints and response conventions consumed by the app
- `office-refresh/barak360/README.md` — the app README: data, screens, run/stop, MCP tools, API, read-only guarantees, film/post and limits
- `office-refresh/barak360/mcp_server.py` — read-only MCP server over the same barak_ro role: meta, clients, client 360, pipeline, activities, documents, exceptions, unregistered, search, staff

## Commands

- **Project brief:** `python3 ~/Developer/my-projects/tools/brief.py "PIL Barak"`
- **Read the plan:** `sed -n '1,240p' ~/Developer/pil/office-refresh/BARAK-COPY-PLAN.md`
- **Copy status:** `ssh win01 '"C:/barak-copy/.venv/Scripts/python.exe" "C:/barak-copy/barak_copy.py" status'`
- **Verify the copy:** `ssh win01 '"C:/barak-copy/.venv/Scripts/python.exe" "C:/barak-copy/barak_copy.py" verify --sample 50'`
- **Read model checks:** `ssh win01 '"C:/Users/USER/magic-copy/.venv/Scripts/python.exe" "C:/OfficeRefresh/read-model/verify.py"'`
- **Run Barak 360:** `ssh -N -L 5433:127.0.0.1:5432 win01-pg  # then cd ~/Developer/pil/office-refresh/barak360 && ./start.sh`
- **MCP check:** `cd ~/Developer/pil/office-refresh/barak360 && ./.venv/bin/python mcp_server.py --check`
- **Verify the second copy:** `python3 ~/Backups/verify-second-copy.py`
- **RustFS MCP check:** `opencode mcp list   # rustfs; tunnel: ssh -f -N -L 9100:127.0.0.1:9000 win01`

## Deploy and where it runs

- Read model on win01 (PostgreSQL 17, barak_ro SELECT-only); Hebrew Barak 360 app on the Mac at http://127.0.0.1:8410 via an SSH DB tunnel, public at https://barak360.navonsimon.com/ through Cloudflare Tunnel and ubuntu01 edge nginx to the Mac tailnet, with a read-only MCP server on the Mac tailnet at http://100.125.119.73:8411/mcp (registered as pil in the shared MCP gateway). Barak and Magic remain the official record. Public review: https://ai-pricing.navonsimon.com/#/barakcopy · project page: https://projects.navonsimon.com/p/pil-barak.

## Current state

2026-11-07: read model, read-only app and MCP built. Bucket copy complete (70,923 objects / 51.30 GB, 0 failures); 37 raw tables / 80,820 rows; 70,923-file index; register 47,870 → 47,683 linked, 168 missing (165 paths + 3 blank), 17 outside, 2 extension drift, 5,695 unregistered. barak_ro is SELECT-only; Hebrew Barak 360 live on the Mac at 127.0.0.1:8410 with identity masked. MCP exposes 10 read-only tools and is shared through the registry as pil__*. Second copy is syncing/verifying on the Mac. No source writes; Barak stays the record. RustFS MCP (official rustfs-mcp, 6 tools) is built, tunnelled to win01:9000 and registered in opencode as rustfs; verified with 3 buckets, 74 objects under DATA/ and a 415-byte get_object pull. Barak 360 is public at https://barak360.navonsimon.com/ (password gate) since 2026-11-07; the Mac must be awake.

## Watch out

- Barak is read-only, always: no writes, renames, moves or deletes in B:\barakT or \\sql.
- The live tables are dBase III/IV .DBF through BDE, not Paradox; BDE artifacts (PDOXUSRS.NET, ABORT00.TVL, DBD\) caused the old label.
- Encoding is per table: cp862 for older tables (climain, clicall, clicont, climemo, clinote2) and cp1255 for newer ones (cliquot, clisla).
- There are no declared keys; relationships are inferred. Staff is stored by name, not ID.
- 168 register rows have no file in the copy (165 paths + 3 blank; 162 are one August 2026 batch, q54850-q55099); 5,695 copied files have no register row; 306 rows use legacy path aliases. Do not recreate or delete.
- Barak 360 uses barak_ro (SELECT only) and masks identity by default; leave BARAK360_ALLOW_IDENTITY off until the office signs the auth decision.
- The MCP server is read-only too and depends on the win01 tunnel and the Mac being awake; start it with ./start.sh in office-refresh/barak360.
- The royalty archive (files/חלוקות, 17,338 files / 21 GB) is not in the database; Excel remains the calculation record.
- Document files are now served from the RustFS copy on win01: the Barak 360 app streams them inline (/api/documents/{register_id}/file, /api/files/{file_id}/file) through the Mac's SSH tunnel on 127.0.0.1:9100, and the read-only `rustfs` MCP server (rustfs_ro_mcp.py) downloads the exact object for a register_id to ~/.cache/barak360/downloads with a SHA-256 check. No upload, create or delete; the raw rustfs-mcp binary also has write tools, so prefer the read-only server.
- Passwords in clisohen and the SMS credentials are clear text. Never copy them; re-create accounts and rotate.
- Mapped drives exist only in the logged-on desktop session; the copier and scheduler run there.

## Tags

Barak CRM, DBF/BDE, RustFS, PostgreSQL, FastAPI, MCP, Hebrew RTL, Read-only

---

Brief generated 2026-11-08 from `~/Developer/my-projects/context/`. Canonical URL: https://projects.navonsimon.com/context/pil-barak.md
