# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What this workspace is

`~/yumi` is a **consolidation workspace**: the existing baobab/MMD "Cowork" stack, the LLM
router, and the Hindsight memory system, copied verbatim into one place as the seed for the
"Yumi" product. It is **not yet rebranded and not yet a unified monorepo** — each top-level
subdir is its own git repository with its own history, run setup, and tests. Treat each subdir
as a separate project unless doing explicit cross-cutting work.

Per Ben (2026-06-21): copy everything first and **get it working; rebranding comes later.**
Do **not** rename MMD/baobab identifiers, package names, or remotes yet.

## Architecture in one read

- **Shared engine** — `services/mmd-cowork-core` (`@mmd/cowork-core`): conversation store, auth
  helpers, agent tools, connector wrappers, text formatting.
- **Shared static config** — `services/mmd-cowork-config` (`@mmd/cowork-config`): MCP server
  definitions + allowlists, skill bundles, surface metadata, credential references.
- **Shared API host** — `apps/mmd-cowork-mobile` serves `/api/conversations`; all surfaces sync
  projects/chats through it.
- **Surfaces (flavors)** — `apps/open-cowork-mmd` (Electron desktop, local SQLite cache),
  `apps/mmd-cowork-mobile` (web/PWA), `services/mmd-cowork-m365` (packaging), `services/mmd-cowork-office`
  (Outlook/Teams add-in).
- **LLM router** — `services/mmd-llm-gateway` (LiteLLM): every surface talks to one gateway.
- **Memory** — `services/hindsight`: durable agent memory and knowledge banks.

Read the real architecture doc **before any cross-app change**:
`services/mmd-cowork-core/docs/COWORK_ARCHITECTURE.md`. New flavors must reuse the shared
contracts — never create a parallel memory, project, or chat-history implementation.

## Working rules (workspace-specific)

- **Don't rebrand** MMD/baobab → Yumi yet — that is a deliberate later phase.
- Each subdir keeps its own git history; do not squash them into one repo yet.
- **Secrets:** several subdirs contain `.env`, `.sesskey`, and config with keys (notably
  `services/hindsight/src/`). Never commit or share them; the root `.gitignore` excludes the
  common patterns — respect it. Always strip credentials from any git remote before pushing.
- **SSO** is not yet wired for Yumi; surfaces currently rely on MMD's Entra app registration.
  Google/Apple/Microsoft registrations are pending Ben's console work — see
  [config/sso/README.md](config/sso/README.md).
- Ben's global **server-only / real-SSO** verification rule applies to any live Cowork/portal
  check: use the real public SSO path, not localhost or bypassed auth, or report `blocked`.
- **Hindsight is canonical knowledge** for this stack — recall before concluding something
  doesn't exist; tags like `cowork-agent`, `mmd-portal`, `hindsight`, `llm-router`, `yumi`.

## Provenance

Every subsystem's source path, commit, branch, and uncommitted-file count is recorded in
[PROVENANCE.md](PROVENANCE.md). Check it before assuming a subdir matches its origin — several
were copied with uncommitted local changes.
