The doc was still labeled 'design / not built' but Loki is live and in daily dogfood use: NL composer with project resolution, the 3-pane page, mic/attach/model-picker, and dispatch parity with Control. Add a verified 'Shipped state' note, resolve open questions 1-2, and mark the phased plan (1-3 done, 4 partial). Discovered by dogfooding FleetCrown via FleetCrown: this very doc fix was dispatched through Loki. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
10 KiB
Loki — the conversational command surface
Status: shipped (Phases 1–3 live; Phase 4 partial). This document started as the
design spec for the original vision and is retained as the rationale of record; the
Shipped state note below tracks what is actually live. See the loki/control
commit series in git history for the implementation.
Shipped state (verified in the running app)
The Loki page (/loki) is live and in daily use as a dogfood surface. Confirmed working:
- The command composer (§3): one natural-language field; resolves the project named in
the text (e.g. "for fleetcrown, …" scopes to the
fleetcrownproject) and routes the message to dispatch vs chat automatically. - The Loki page (§4): the 3-pane layout shipped as specced — conversation list (left), transcript (center) with the composer at the bottom, and the selectable Projects panel (right). Project tiles surface each project's active goal as a subtitle.
- Composer affordances (§4): microphone, file attach, and a model picker (defaults
to
Auto) are all present. - Dispatch parity (§5): a Loki dispatch produces the same
pending_command→ runner → agent-terminal path as a Control "Next best" click, and a dispatched message links back with "Open in Control →".
Open questions §6 #1 (chat vs command — both, routed by intent resolution) and #2 (dispatches go to the project's existing session; the conversation is the human-readable log) are resolved the way the doc was leaning. The remaining design notes below are kept for context.
This document covers two related-but-distinct ideas, kept in separate sections so they don't blur together:
- §3 — The command composer (one field; natural language; auto-selects the project you name; reduces decisions).
- §4 — The Loki page (a ChatGPT/Claude/Grok-style page: one composer, a conversation list, a project filter).
They converge (§5): the Loki page is where the composer lives, but the composer behaviour is also useful inside Control/Terminal, so it's specified on its own.
1. The problem: cognitive load
To make an agent do something today, the operator must hold the UI's structure in their head and make several decisions before any work starts:
- Which page? (Control vs Terminal vs Prompts.)
- Which project? (find + select the card.)
- Which action? (an intent button, or hand-write a prompt.)
That's 3 decisions + spatial memory of the app, every time. The north star is to drive that toward one decision, expressed in words: say what you want; the system figures out where and how.
"I want to do a code review for kivvi" → it selects kivvi and runs the review. No card hunting, no intent button, no prompt authoring.
2. The key architectural insight (why this is cheap)
Terminal, Control, and Loki are three rungs of one ladder — all of them are "tell an agent what to do," at decreasing cognitive cost:
| Rung | Surface | Input | Cognitive load | Who |
|---|---|---|---|---|
| Low-level | Terminal | raw keystrokes | high (you drive the shell) | power user, debugging |
| Mid-level | Control | pick project + intent | medium | operator managing the fleet |
| High-level | Loki | natural language | low (system infers) | everyone, default |
Loki does not need a new execution engine. It sits above the dispatch backend that already exists and that the autopilot loop already uses:
Loki composer → parse NL → { project, intent|prompt } → existing dispatch
(the same /api/control/dispatch + runner injectPty path we just hardened)
So Loki is a new front-end over the same backend. The composer's only new logic is resolution (NL → project + intent), which is one cheap LLM classification call.
3. The command composer (Thread C)
Behaviour:
- One text field. You type intent in natural language.
- Project resolution:
- If a project is explicitly selected (Loki right panel / Control card) → scope there.
- Else if the text names a project ("…for kivvi", "kivvi: …", "on revampit") → match
against the project registry (
agent-projects.conf/ entities) and auto-select it. - Else ambiguous → ask a one-tap disambiguation ("Which project?") rather than guess. (Later: bias toward the most-recent / most-active project; see §6.)
- Intent resolution: map the phrase to an existing
ORCHESTRATION_INTENTSid when it matches a known verb ("code review" → review, "fix types"/"tests" → test_and_fix, "next best"/"keep going" → next_best, "commit" → commit_push, "audit" → full_audit), otherwise pass the text through as a free-form prompt. SSOT for the verb→intent map lives next tosrc/config/control-intents.ts. - Resolution is a fast model call (cheap tier) returning
{ projectKey|null, intentId|null, prompt }; low-confidence → ask, don't assume.
Why it reduces load: collapses "page → project → action" into one sentence, and degrades gracefully (explicit selection always wins; ambiguity asks instead of misfiring).
4. The Loki page (Thread D)
A new top-level page above Terminal in the nav. Layout mirrors ChatGPT/Claude/Grok:
┌── left (collapsed nav) ──┬──────────── center ────────────┬──── right ────┐
│ Conversations │ Conversation transcript │ Projects │
│ • kivvi: review (2m) │ (messages: you ⇄ agent/Ivy) │ [x] kivvi │
│ • revampit: workshops │ │ [ ] revampit │
│ • orangecat: … │ │ [x] orangecat │
│ │ │ … │
│ │ ┌── composer ───────────────┐ │ (select/ │
│ │ │ 🎤 type a command… 📎 ⌄ │ │ deselect │
│ │ └────────────────────────────┘ │ filters │
│ │ mic · attach · model picker │ convos) │
└──────────────────────────┴─────────────────────────────────┴───────────────┘
- Left: the main nav minimizes to a conversation list (most-recent first), like ChatGPT threads.
- Center: the active conversation transcript + the composer (§3) at the bottom, with microphone (voice → transcribe → composer), file attach, and a model picker.
- Right: all projects, each selectable. Selecting/deselecting projects filters the conversation list to those projects (and scopes new messages to the selected set).
- Conversations are persistent threads, each tagged with 0..n projects. A message in a conversation either (a) is answered (chat with Ivy about the project) or (b) dispatches work to the project's agent — decided by the same intent resolution as §3.
5. How Loki relates to Control and Terminal
- Loki = the front door (low cognitive load, conversational). Becomes the default.
- Control = the dashboard (see every project's live state, autopilot toggles, the fleet at a glance). Loki links into it ("open kivvi in Control").
- Terminal = the workbench (raw shell, power use, debugging). Loki/Control link into it.
- A Loki "dispatch a command" and a Control "Next best" click produce the same
pending_command→ runner → PTY. One backend, three altitudes of UI.
6. Open questions (need George's call before building)
- Chat vs command vs both. Is a Loki message primarily talking about projects (Ivy answers) or commanding agents (work runs), or both in one thread? (Leaning: both, with intent resolution routing each message.)
- Conversation ↔ session. Does a conversation own a long-running agent session, or are dispatches fire-and-forget into the project's existing session? (Leaning: dispatches go to the project session; the conversation is the human-readable log + control thread.)
- Ambiguous project with no selection and no mention: ask, or default to most-recent/most- active? (Leaning: ask first; learn to pre-select later.)
- Model picker scope: which models, and does it map to agent adapters (Claude/Codex/etc.)?
- Voice + attachments: transcription provider; what attachments do for a dispatch (context files handed to the agent?).
7. Phased plan
- Phase 0 (done): server terminal made usable (input no longer scrambles); this doc.
- Phase 1 (done) — composer with NL resolution: natural-language →
{ project, intent|prompt }resolution shipped; naming a project in the text auto-scopes the dispatch. - Phase 2 (done) — Loki page scaffold: conversations + the 3-pane layout; composer wired to Phase-1 resolution; chat via Ivy; dispatch via the Control backend; projects panel on the right.
- Phase 3 (done) — affordances: microphone, file attach, and model picker are live.
- Phase 4 (partial) — learned context: project tiles surface each project's active goal; still open: pre-selecting the likely project from an unscoped message and surfacing suggested next commands (the cognitive-load north star).
8. Cross-references
- Engineering standards (non-negotiable): build this per
CONTRIBUTING.md→ "Engineering Standards" and the global standards imported inCLAUDE.md— SSOT, DRY, SoC, no god files, no hardcoded values, the four-layer design system, config-driven, first-principles. The resolver derives intent ids fromORCHESTRATION_TASK_INTENT_IDS; the composer reuses the existing dispatch path andui-*classes rather than re-rolling either. - Terminal parity / usability:
docs/terminal-parity.md(Thread A — separate concern). - Cleanup of organic-growth cruft:
docs/debt-reduction-roadmap.md(Thread B). - Dispatch backend Loki builds on:
docs/architecture/agent-execution-platform.md,src/config/control-intents.ts, the runner inject path (desktop/src/main/poller.ts).