Empty remaining Python (read path first; write is v2) #14

Open
opened 2026-08-13 21:09:18 +01:00 by eSlider · 2 comments
Owner

Why

~3.2k lines of Python remain vs ~8.8k Go. Search/HTTP/git/web are Go. Python still does Ladybug write, mail/md convert, facts, and CLI get/stats/eval via ExecFile.

D6: write stays Python until the Go Ladybug add path is safe. Do not port kblib.upsert_leaf in v1.

Inventory (tracked)

Still real Python:

  • bin/kb/index + kblib.py — rebuild / FTS+HNSW write
  • bin/mail/import + mailconv.py — JSON→md (docling)
  • bin/md/import + mdleaves.py — mistune leafs
  • bin/facts/{extract,audit,crm} — 2-source facts
  • bin/kb/{get,stats,eval} — read path (HTTP already has get/stats)
  • bin/chats/refresh-linkedin-session — CDP
  • bin/ci/semver

Shims only: bin/web/search, bin/git/import, bin/mail/index_mail.
Go wrappers that still exec Python: brain/{index,get,stats,eval}.go, mail/import.go, markdown/import.go.

Slices (one PR each)

  1. bin/brain/{get,stats,eval}.go call internal/brain (cgo). No ExecFile to bin/kb/*. Python bin/kb/{get,stats,eval} stay as fallbacks until CI has ladybug.
  2. bin/markdown/import.go — real Go leaf split (or keep wrap until mistune port).
  3. bin/mail/import.go — real Go convert; docling stays isolated subprocess until OCR issue 6.
  4. bin/facts/*.go shebangs (issue 13 remainder).
  5. Compose profile index (issue 4): Python only in that image; API image has no CPython.
  6. brain/add write path = v2 after upsert+index tests. Then delete kblib write.

Test

  • Layout: get.go/stats.go/eval.go must not contain ExecFile or bin/kb/.
  • Eval control questions live in a cgo-free package (CI).
  • go test ./... still cgo-free. Recall gate in CI may keep bin/kb/eval until ladybug is on the runner.

Related: #4 sidecar, #7 adapters, #13 facts shebang.

## Why ~3.2k lines of Python remain vs ~8.8k Go. Search/HTTP/git/web are Go. Python still does Ladybug **write**, mail/md convert, facts, and CLI get/stats/eval via `ExecFile`. D6: write stays Python until the Go Ladybug add path is safe. Do not port `kblib.upsert_leaf` in v1. ## Inventory (tracked) Still real Python: - `bin/kb/index` + `kblib.py` — rebuild / FTS+HNSW write - `bin/mail/import` + `mailconv.py` — JSON→md (docling) - `bin/md/import` + `mdleaves.py` — mistune leafs - `bin/facts/{extract,audit,crm}` — 2-source facts - `bin/kb/{get,stats,eval}` — read path (HTTP already has get/stats) - `bin/chats/refresh-linkedin-session` — CDP - `bin/ci/semver` Shims only: `bin/web/search`, `bin/git/import`, `bin/mail/index_mail`. Go wrappers that still exec Python: `brain/{index,get,stats,eval}.go`, `mail/import.go`, `markdown/import.go`. ## Slices (one PR each) 1. `bin/brain/{get,stats,eval}.go` call `internal/brain` (cgo). No `ExecFile` to `bin/kb/*`. Python `bin/kb/{get,stats,eval}` stay as fallbacks until CI has ladybug. 2. `bin/markdown/import.go` — real Go leaf split (or keep wrap until mistune port). 3. `bin/mail/import.go` — real Go convert; docling stays isolated subprocess until OCR issue 6. 4. `bin/facts/*.go` shebangs (issue 13 remainder). 5. Compose profile `index` (issue 4): Python only in that image; API image has no CPython. 6. `brain/add` write path = v2 after upsert+index tests. Then delete `kblib` write. ## Test - Layout: `get.go`/`stats.go`/`eval.go` must not contain `ExecFile` or `bin/kb/`. - Eval control questions live in a cgo-free package (CI). - `go test ./...` still cgo-free. Recall gate in CI may keep `bin/kb/eval` until ladybug is on the runner. Related: #4 sidecar, #7 adapters, #13 facts shebang.
Author
Owner

Slice 1 in review: GitHub https://github.com/eSlider/2dph/pull/18bin/brain/{get,stats,eval}.go call internal/brain (cgo). Python bin/kb/{get,stats,eval} stays CI fallback. Control questions in internal/brain/rank.

Slice 1 in review: GitHub https://github.com/eSlider/2dph/pull/18 — `bin/brain/{get,stats,eval}.go` call `internal/brain` (cgo). Python `bin/kb/{get,stats,eval}` stays CI fallback. Control questions in `internal/brain/rank`.
Author
Owner

Slice 1 merged: GitHub https://github.com/eSlider/2dph/pull/18 (54201d8). bin/brain/{get,stats,eval}.gointernal/brain. Python bin/kb/{get,stats,eval} remains CI fallback.

Still open on this issue: markdown/import Go, mail/import Go, facts shebangs (also #13), Compose index profile (#4), write path brain/add = v2.

Slice 1 merged: GitHub https://github.com/eSlider/2dph/pull/18 (`54201d8`). `bin/brain/{get,stats,eval}.go` → `internal/brain`. Python `bin/kb/{get,stats,eval}` remains CI fallback. Still open on this issue: markdown/import Go, mail/import Go, facts shebangs (also #13), Compose `index` profile (#4), write path `brain/add` = v2.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eSlider/2dph#14