# Context Layer — Terminal / Workspace Orchestration

**Packet:** `terminal-workspace-orchestration`
**Generated:** 2026-05-29
**Method:** `deep-research-foundations` (Research Diamond, 4 parallel field lanes)
**Repo placement:** `/a/src/Miadi-18/foundations/terminal-workspace-orchestration/` (consumed here; crosswalk note below)

---

## 1. What this packet grounds

The runtime published on PyPI as **`ironsilk`** (`v0.9.13`), historically **`hermes-navigator`**,
driven by the **`tide`** CLI (Python import path `hermes_navigator`). It gives a single
operator orientation across **many concurrent terminals** (tmux panes) spread over **many
repositories**, and a Next.js web surface inside Miadi that observes and (eventually)
navigates that activity.

This packet exists to ground three coupled decisions in recognized fields:

1. a **clearer, user-legible conceptual model + naming** (domain / project / workspace / session / pane);
2. a **redesign of the web observation + navigation UI** (`app/docs/miadi-agent/*`);
3. a **new TypeScript package** under `packages/` that embeds this runtime intelligence
   "at the runtime level" instead of shelling out to the CLI.

> Naming caution carried from the source request: the platform's own GitHub issues and
> some specs describe this surface in language that is **still being revised**. Treat issue
> text as *input*, not authority. The authoritative current contract is the code + STATUS.md
> as read on 2026-05-29, recorded below.

---

## 2. Canonical terms (current contract, as built)

Read directly from `runtime/hermes-navigator/hermes_navigator/{models,scene,cli}.py` and
`rispecs/tide-runtime/STATUS.md`.

| Term | Definition (as implemented) | Source of truth |
|------|------------------------------|-----------------|
| **Domain** | A logical project/identity (e.g. `miadi`, `aureon`). Detected per terminal via a signal chain: env var → tmux name → git remote → path prefix → heuristic. May carry a Medicine-Wheel `direction` and typed `relations` (R10). | `domain_detector.py`, `DomainConfig` |
| **Project** | A repository carrying `.miadi/tide.yaml`. `ProjectConfig.discover(path)` reads its `profile` and `scenes`. | `tui/project.py`, `tide project` |
| **Workspace** | A **reproducible layout**: which terminal/editor/browser windows to open for a project, parameterized by a `profile` (`coding`/`review`/`incident`/`research`), branch, and issue. Has `status` (`active`/`snapshot`/`archived`) and an optional `context_snapshot_id`. | `Scene`/`Workspace` in `scene.py` |
| **Scene** | **Deprecated alias for Workspace.** `WorkspaceStore = SceneStore`; `Scene.to_dict()` emits *both* `workspace_id` and `scene_id`; `tide scene` is documented as "Deprecated alias for `workspace`." Dual vocabulary is pervasive (`SceneProfile`/`WorkspaceProfile`, `SceneWindow`/`WorkspaceWindow`, …). | `scene.py`, `models.py`, `cli.py` |
| **Session** | A **named, resumable** tmux-backed continuation unit (R7). `NamedSession` holds `channel_history`, `context_refs` (snapshot ids), `continuation`, `status`. Resumable from desktop or (planned) Telegram. | `session_store.py`, `tmux_session.py` |
| **Pane / TerminalContext** | The live state of one tmux pane: `{pid, cwd, tmux_pane, domain_id?, domain_confidence(0–100), recent_commands[], is_active, captured_at}`. | `TerminalContext` |
| **Context snapshot** | R2 observation: all panes + desktop windows at a point in time, with a `domain_summary` count map. The web `tide-live` page renders exactly this. | `ContextSnapshot`, `context_engine.py` |
| **ECF** | Environment Context Fabric — the observation plane (`tide ecf observe`, `DesktopObserver`) plus the actuation plane (`Scene/WorkspaceLauncher`, controller-gated). | `desktop_observer.py`, `scene.py` |
| **Mode** | `observer` (safe default, read-only) vs `controller` (mutations: focus/send-keys/launch, approval-gated). | `NavigatorMode` |

**Authoritative hierarchy (STATUS.md, 2026-05-14):**

```
domain  →  workspace / project  →  session  →  pane
```

`Universe` is explicitly retired as an organizing term here. Confidence thresholds (int 0–100):
`40` display · `50` observer-focus · `70` controller-focus · `80` auto-action.

---

## 3. Current surfaces (current reality)

| Surface | Path | State |
|---------|------|-------|
| CLI | `tide` (`ironsilk` 0.9.13) | Working: `context`, `detect`, `focus`, `daemon`, `ecf`, `workspace`(`scene`), `session`, `project`, `operator`, `mode`, `service`, `doctor`, `studio` |
| Web — live, flat | `app/docs/miadi-agent/tide-live/page.tsx` | Real data via `exec("tide context --format json")`; renders panes grouped by `domain_id`, large **"unknown"** bucket, click-to-inspect. |
| Web — structured mock | `app/docs/miadi-agent/navigator/page.tsx` (+ `_wheel`/`_sessions`/`_widget`/`_data.ts`) | Rich intended UI (Medicine-Wheel domain map, session sidebar, hierarchical tree, approval cards) but fed by **hardcoded `_data.ts`**. |
| Web — terminal mock | `app/docs/miadi-agent/terminal-ios/` | Separate terminal-styled mock surface. |
| API routes | `app/api/tide/{context,peek,steer}/route.ts` | Thin `exec()` wrappers around `tide … --format json` with a **hardcoded** `/home/jgi/anaconda3/bin/tide` path. |
| Components | `components/tide/{pane-card,pane-inspector,domain-badge}.tsx` | `PaneData` model; `ConfidenceBar` (note: treats confidence as a number — verify 0–1 vs 0–100 against CLI output). |
| Package stub | `packages/tide/AGENTS.md` (`@miadi/tide`) | **Stub only** — points at the ironsilk source; no client/types/transport yet. |
| Specs | `rispecs/tide-runtime/00–12 + STATUS.md` (ironsilk); condensed mirror in Miadi-18 `rispecs/tide-runtime/` and `rispecs/hermes-agent-runtime/` | UI surface (05) is authoritative R6a direction; overlay impl "not started"; architecture mandates **Unix-socket → daemon**, not `exec()`. |

**Key structural observation:** the intended structured UI already exists (the `navigator` mock),
and live data already exists (`tide-live`). They have not yet been joined, and the transport
the specs call for (daemon socket) is not the transport the web layer uses (`exec`).

---

## 4. Fields in scope (MECE decomposition)

Four lanes, mutually exclusive, collectively covering the three decisions:

| Lane | Field | Grounds |
|------|-------|---------|
| `human-computer-interaction-activity-workspace-model.md` | HCI — Activity-Based Computing & workspace/space/session taxonomy | The naming + nesting model; retiring scene≡workspace |
| `terminal-multiplexing-and-session-persistence.md` | Terminal multiplexers, session persistence, layout managers (inspiration survey) | `tide` session/workspace verbs; resume UX |
| `multi-entity-observability-and-dashboards.md` | Information design for many live entities ("single pane of glass", k9s/Grafana, Shneiderman's mantra) | The `tide-live` redesign; the "unknown" bucket |
| `runtime-integration-and-api-evolution.md` | Software architecture: Python↔TS integration, package boundaries, SemVer/deprecation | The `@miadi/<pkg>` package; killing the `exec()`; naming migration |

Provenance / knowledge-organization is **crosswalked** (not re-researched) to the existing
Storyweaver packet field `knowledge-organization-archives-and-provenance/` for session/snapshot
persistence and append-only registries.

---

## 5. Source quality rules

- Prefer peer-reviewed HCI/InfoVis venues (CHI, UIST, CSCW, TOCHI, IEEE VIS), standards
  (SemVer, OpenAPI, protobuf), official tool docs, and primary source repos.
- Strong practitioner engineering writing is acceptable for the "inspiration survey" lane.
- Every source carries `verified: true|false` — `true` only when confirmed via live web this
  session, else it is a training-knowledge reference to be re-checked before formal citation.
- Sources collected in `source-ledger.yaml`; each ties to a claim or decision.

---

## 6. Crosswalk, indexing, provenance

- **Sibling packet:** `foundations/` (root) is the **Storyweaver** packet (13-agent storytelling
  pipeline). This packet is a *distinct topic*; it shares three fields by name
  (HCI/IA, MAS/orchestration, knowledge-organization/provenance) and should crosslink rather
  than duplicate their `field.md` content.
- **Mighty Eagle registry:** `/usr/local/src/mightyeagle/foundations` is the higher-level
  steward; a crosswalk entry there may reference this packet once stabilized.
- **QMD:** packet content is markdown and indexable; federate after synthesis is verified.
- **Related issues (input only, NOT authoritative — may be revised):** `jgwill/Miadi#265`
  (Navigator master), `#250` (ECF), `#290` service, `#291` overlay, `#292` window mapping,
  `#293` polling cost, `#294` workspace registry/launcher, `#300` operator slices, `#326`
  release gate. Confirm against code before relying on any of these.
