Package extraction map (on-paper, pre-Trained)
Boundary plan for pulling shared packages out of apps/jg. No code moves yet —
this is the agreed target so the extraction is fast (and synthesized best-of-breed)
when Trained lands as the second consumer. Confidence reflects how much a single app
(jg) can tell us; LOW items genuinely need a 2nd app to resolve.
Source of truth for the Rust side: apps/jg/docs/architecture/target-architecture.md
(core = application core + pure sublayer; shell owns I/O; narrow ports, not Device).
→ packages/ui (design system) — HIGH confidence
Section titled “→ packages/ui (design system) — HIGH confidence”The cleanest extraction. Generic UI primitives + their storybook.
Ui/*: Button, Card, Icon, TextInput, NavBar, ListRow, Sheet, Screen, EmptyState, ErrorBanner, Text, Toggle, Loading, Tokens, DevicePreview, Gesture/DirectionalDragBook.elm+ allBook/*Chapter.elm(the UI-kit storybook)- Pairs with the Tailwind v4
@themetokens insrc/input.css - Supersedes Planter’s
7hoenix/u7(mine it for Dropdown/Tooltip/Animation/Effects ideas)
→ packages/app-core (architecture) — MEDIUM-HIGH
Section titled “→ packages/app-core (architecture) — MEDIUM-HIGH”Framework, not UI, not jg-domain.
Effect.elm,Reply.elm,Js.elm(port interop),Auth.elm,Session.elm,DeepLink.elm,DevWeb.elm(dev-web harness shim)
needs the 2nd app to draw the line — LOW
Section titled “needs the 2nd app to draw the line — LOW”Command.elm— split: the generic dispatch/Reply machinery → app-core; the jg-specific command variants → jg. The split point is only clear once Trained’s command set sits beside jg’s.Notifications.elm,Sync.elm,Haptic.elm— shared Tauri infra vs jg-specific? TBD.Main.elm— jg’s bootstrap stays in jg, but its shape may seed an app-core scaffold.
stays in apps/jg (SRS domain) — HIGH
Section titled “stays in apps/jg (SRS domain) — HIGH”Entry,Entries,Firing,Firings,Interaction,Interactions,Reclassify,RotationPage/*(Anchor, Capture, Detail, Entries, List, Login)Generated/*(per-app codegen output)
Rust (per target-architecture.md)
Section titled “Rust (per target-architecture.md)”→ packages/tauri-core — scaffolding only
Section titled “→ packages/tauri-core — scaffolding only”crates/apitransport pattern (Command JSON → service → Response envelope,DispatchSideEffect)generate_elmcodegen binary- Generic ports (
Clock), thePorts/Device-aggregate concept, dispatch wiring build.rsiOS linker / env baking
stays in apps/jg (SRS core) — HIGH
Section titled “stays in apps/jg (SRS core) — HIGH”crates/core:events,domain(Entry/Shape/Interaction/Firing),projection,srs,services/*(capture/classify/notifications/auth), the Classifier- The pure sublayer + use-case services are jg’s domain, not shared
→ packages/worker — HIGH (with a split)
Section titled “→ packages/worker — HIGH (with a split)”worker/Cloudflare auth: Apple OAuth, JWT + sliding expiry, R2 event store → shared- jg’s LLM endpoints (classify/similarity/reindex via Vectorize) → likely jg-specific; separate the generic auth/session worker from jg’s app endpoints
Sequencing
Section titled “Sequencing”- Land
apps/trained(history-preserving, same recipe). - Extract HIGH-confidence packages from the jg+Trained pair (
uifirst, thenworker,tauri-core), updating both apps to consume viaelm.jsonsource-directories / path deps. - Resolve LOW-confidence items (
Commandsplit, Notifications/Sync/Haptic) using both apps’ real usage.