Run the full onboarding flow. Returns the seeded EntityRegistry.
(
directory: str = ".",
config_dir: Path = None,
auto_detect: bool = True,
)
| 388 | |
| 389 | |
| 390 | def run_onboarding( |
| 391 | directory: str = ".", |
| 392 | config_dir: Path = None, |
| 393 | auto_detect: bool = True, |
| 394 | ) -> EntityRegistry: |
| 395 | """ |
| 396 | Run the full onboarding flow. |
| 397 | Returns the seeded EntityRegistry. |
| 398 | """ |
| 399 | # Step 1: Mode |
| 400 | mode = _ask_mode() |
| 401 | |
| 402 | # Step 1b: Embedding model (asked once on first run; choice persists in |
| 403 | # config.json so future loads don't re-prompt). |
| 404 | embedding_model = _ask_embedding_model() |
| 405 | from .config import MempalaceConfig |
| 406 | |
| 407 | MempalaceConfig(config_dir=config_dir).set_embedding_model(embedding_model) |
| 408 | |
| 409 | # Step 2: People |
| 410 | people, aliases = _ask_people(mode) |
| 411 | |
| 412 | # Step 3: Projects |
| 413 | projects = _ask_projects(mode) |
| 414 | |
| 415 | # Step 4: Wings (stored in config, not registry — just show user) |
| 416 | wings = _ask_wings(mode) |
| 417 | |
| 418 | # Step 5: Auto-detect additional people from files |
| 419 | if auto_detect and _yn("\nScan your files for additional names we might have missed?"): |
| 420 | directory = _ask("Directory to scan", default=directory) |
| 421 | detected = _auto_detect(directory, people) |
| 422 | if detected: |
| 423 | _hr() |
| 424 | print(f"\n Found {len(detected)} additional name candidates:\n") |
| 425 | for e in detected: |
| 426 | print( |
| 427 | f" {e['name']:20} confidence={e['confidence']:.0%} " |
| 428 | f"({', '.join(e['signals'][:1])})" |
| 429 | ) |
| 430 | print() |
| 431 | if _yn(" Add any of these to your registry?"): |
| 432 | for e in detected: |
| 433 | ans = input(f" {e['name']} — (p)erson, (s)kip? ").strip().lower() |
| 434 | if ans == "p": |
| 435 | rel = input(f" Relationship/role for {e['name']}? ").strip() |
| 436 | ctx = ( |
| 437 | "personal" |
| 438 | if mode == "personal" |
| 439 | else ( |
| 440 | "work" |
| 441 | if mode == "work" |
| 442 | else input(" Context — (p)ersonal or (w)ork? ") |
| 443 | .strip() |
| 444 | .lower() |
| 445 | .replace("w", "work") |
| 446 | .replace("p", "personal") |
| 447 | ) |