← all documents · raw markdown · 19 KB

KAI-SPACES-AND-USER-SETTINGS-GOAL.md

| | |
|---|---|
| Status | GOAL LOCKED (design) — implementation phased; not fully built |
| Author | Owner (Ryan) + product session 2026-07-16 |
| Version | v1.0 · companion to economy, dual-world, guest social, host settings |
| Code touchpoints (today) | oracle.html (composer, guest rail, Me/Settings modals), guest-access.mjs, plan-tiers.mjs, command-center-server.mjs (channels/DMs/turn), host Config view |
| Related goals | KAI-ECOSYSTEM-ECONOMY-GOAL.md (tiers/credits/seats), ORACLE-OS-SETTINGS-GOAL.md (host OS control), ORACLE-OS-CONTROL-PANEL-SETTINGS-GOAL.md (user Settings panel inventory + rebuild phases), KAI-DUAL-WORLD-PLATFORM-GOAL.md, RELEASE-READINESS.md |

---

0. Why this doc is huge (and must stay one place)

Owner intent (verbatim themes):

1. More channels than the fixed Discord catalog — users create public / private rooms they host, invite, or leave open so anyone on that server/workspace can join (if they enable open join).

2. These are Spaces inside the ecosystem / group / workspace — not host industrial channels.

3. Tiers + credits still apply to create, invite seats, media, AI participation, storage.

4. Composer (text + Send) must only appear when the user is in a textable context — not Metrics, not Channel Settings, not Threads list until a thread is open.

5. Settings must be vastly improveduser settings (Discord-class, cross-channel, cross-platform), not server/host ops settings.

6. Build a real Settings area: ecosystem settings (workspace/Space admin) and user settings (every member). Contextual, huge, complete.

This goal is the source of truth for that product surface.

ORACLE-OS-SETTINGS-GOAL.md remains the host industrial control plane (fleet, .env, rebuild). Never mix the two UIs.

---

1. Vocabulary (lock these words)

| Term | Meaning |
|------|---------|
| Host / platform | Ryan’s Oracle OS plant: industrial AIs, secrets, fleet, global Discord bridge |
| Workspace (tenant) | A paying (or free Explorer) user’s ecosystem container — their social + business room on KAI |
| Space | A user-created channel (or channel set) inside a workspace: text, voice, video, or hybrid |
| Server (product sense) | The workspace’s public face — people “join a server” = join a workspace/community, then join Spaces |
| User settings | Preferences + privacy + notifications + appearance + accessibility for this person (follow them everywhere) |
| Ecosystem / workspace settings | Admin controls for this workspace (roles, invites, default Spaces, moderation, billing seat list) |
| Space settings | Per-Space: public/private, join mode, slowmode, AI allowed, credit drain rules |
| Host OS Settings | Operator-only (providers, restart, industrial) — ORACLE-OS-SETTINGS-GOAL.md |

Never show Host OS Settings to public accounts.

Never put workspace billing next to Kai Coder model swaps.

---

2. Spaces — product vision

2.1 What a Space is

A Space is a first-class chat room the workspace owns:

2.2 Hosting model

| Role | Can do |
|------|--------|
| Space host (creator or delegated) | Rename, delete, permissions, invite, open/close join, pin, slowmode, AI toggle |
| Workspace admin | Create Spaces (tier-gated), transfer host, audit |
| Member | Chat if permitted, leave, mute, personal notification overrides |
| Guest (product role) | Same as member of their workspace; never host industrial Discord SYS channels |

Host industrial Discord channels (sensitive-info, kai-training, …) stay platform-owned. Spaces are tenant-owned and stored under tenant state, not the host catalog alone.

2.3 Relationship to today’s catalog

| Today | Tomorrow |
|-------|----------|
| Fixed CHANNEL_CATALOG (Discord-backed) | Still exists as platform / federation social rails (ai-social-chat, voices) |
| Guest public allowlist | Keep for platform social; Spaces are additional per-workspace |
| DMs with social AIs | Remain DMs; Spaces are multi-user rooms |
| Left rail: Friends / AI / Public channels / Workspace | Public channels expands to: Platform social + My Spaces + Workspace directory |

2.4 Invites

2.5 Credits & tiers (bind to economy goal)

Creating / running Spaces is not free forever:

| Action | Credits / privilege gate (initial proposal — tune later) |
|--------|----------------------------------------------------------|
| Create Space | Explorer: 1 Space free; Creator: more; Builder/Team: many + categories |
| Open join (public Space) | Allowed Creator+; Explorer open Spaces limited / rate-limited |
| AI agent in Space | Per-message tool costs; local mode cheaper |
| Voice / video minutes | Higher credit burn; tier caps |
| Storage (uploads, images) | Kai Cloud GB from plan card |
| Private Spaces | Creator+ |
| Role hierarchies / categories | Builder+ |
| Custom bot persona in Space | Team |

UI must always show why a create button is disabled (“Upgrade to Creator to host private Spaces”) — never a silent fail.

2.6 Categories (Discord-like)

Workspace “Ada’s Lab”
  ├── Category: Lobby
  │     # welcome (public, open)
  │     # rules (public, read-only for non-mods)
  ├── Category: Work
  │     # sprint (private, invite)
  │     🔊 stand-up voice (callable)
  └── Category: Social
        # memes (public, open)
        📹 hangout (video allowed)

2.7 Message model (Spaces)

2.8 Phases for Spaces

| Phase | Deliverable | Done when |
|-------|-------------|-----------|
| S0 | Goal + composer textable-only | Done (composer textable-only) |
| S1 | Data model + APIs: create/list/join Space (tenant file) | Shipped v9.10.293 — create/list/join + rail; message body next |
| S2 | Left rail “My Spaces” + open directory | UI discoverable |
| S3 | Private + invite links | Invite flow works |
| S4 | Voice/video flags per Space | Call icons only when allowed |
| S5 | Categories, roles, slowmode, audit | Discord-class moderation basics |
| S6 | Credit meters + plan gates live | Economy goal metering hooks |

---

3. Composer rule (ship immediately / keep forever)

Principle: The text box + Send exist only when the user is looking at something they can type into.

| Context | Composer |
|---------|----------|
| DM open | Show |
| Channel · Chat tab | Show (if not system-only / not voice) |
| Channel · Threads · list only | Hide |
| Channel · Threads · thread open | Show (reply in thread) |
| Channel · Metrics | Hide |
| Channel · Settings (channel) | Hide |
| Voice room | Hide (use Join Voice) |
| Home / Me / KAIVERSE / Web / Topology | Hide |

Implementation: syncCmdBar() + activeThreadId + activeSubTab (oracle.html).

Any new pane must register whether it is textable.

---

4. Settings architecture — three trees, one shell

4.1 Shell: “Settings” app surface

One entry for users (Me → Settings, right rail Account → Settings, mobile gear):

Settings
├── 👤 My account          ← USER settings (always)
├── 🔔 Notifications
├── 🎨 Appearance
├── 💬 Chat & media
├── 🔐 Privacy & safety
├── ♿ Accessibility
├── 🌐 Language & region
├── 🧩 Connections         (Discord link later, OAuth, devices)
├── 💳 Plan & credits      (economy — self only)
├── 🏠 My workspaces       (list + switch)
└── 🛠 Workspace admin     (only if workspace_admin+)  ← ECOSYSTEM settings
      ├── Overview
      ├── Members & seats
      ├── Roles
      ├── Spaces
      ├── Invites
      ├── Moderation
      ├── Integrations
      └── Billing (payer)

Host never appears here. Host uses Config / Root Admin.

4.2 USER settings (Discord-class, cross-channel)

These follow the user across every Space, DM, device, and platform client (web, mobile later, native later).

A. My account

B. Notifications (per-channel overrides like Discord)

C. Appearance

D. Chat & media

E. Privacy & safety

F. Accessibility

G. Language & region

H. Connections

I. Plan & credits

4.3 ECOSYSTEM / workspace settings (admin)

Only for workspace_owner / workspace_admin:

| Section | Contents |
|---------|----------|
| Overview | Name, icon, description, vanity URL, public/private community |
| Members & seats | Roster, roles, remove, seat usage vs plan limit |
| Roles | Permissions matrix (manage Spaces, invite, kick, pin, manage messages) |
| Spaces | Create/archive, default Space, ordering, categories |
| Invites | Create invite, revoke, audit |
| Moderation | Automod rules (later), report queue, word filters |
| Integrations | Webhooks, AI social agents allowed in this workspace |
| Billing | Plan change, invoices (Stripe later) — workspace payer only |

4.4 Per-Space settings (host of that Space)

4.5 Channel Settings tab today vs tomorrow

| Today (host) | Tomorrow (user) |
|--------------|-----------------|
| Allowed speakers chips for industrial bots | Your mute/notify for this Space |
| Root-ish status | Notification level for this Space |
| Engine config leakage risk | No provider/model for public users |

Per-channel user overrides live under Settings → Notifications → channel list and as a lightweight panel when you open Space Settings as a member (not admin).

---

5. Cross-platform parity

Same settings schema, different chrome:

| Client | Settings shell |
|--------|----------------|
| Web desktop | Full left nav Settings app |
| Web mobile | Full-screen Settings stack (no tiny accordion only) |
| Native later | Same API: GET/PATCH /api/me/settings |
| KAIVERSE HUD later | Subset: mute, push, presence mode |

Single source of truth: state/tenants/{tid}/user_settings.json + server merge with defaults.

Never only localStorage for privacy/notification truth (localStorage ok for pure UI chrome).

---

6. API sketch (implementation target)

Spaces

GET    /api/spaces                 # my spaces + directory (scoped)
POST   /api/spaces                 # create { name, visibility, joinMode }
GET    /api/spaces/:id
PATCH  /api/spaces/:id
POST   /api/spaces/:id/join
POST   /api/spaces/:id/leave
POST   /api/spaces/:id/invites
GET    /api/spaces/:id/messages
POST   /api/spaces/:id/messages

User settings

GET    /api/me/settings
PATCH  /api/me/settings            # deep-merge partial
GET    /api/me/settings/schema     # for UI generation (optional)

Workspace admin

GET/PATCH /api/workspace
GET/POST  /api/workspace/members
GET/POST  /api/workspace/roles
...

Guest allowlist: add exact paths as they ship. Deny host prefixes forever.

Credits hooks

Every POST /api/spaces and message-with-AI path checks plan + weekly allowance (economy goal Track 3).

---

7. UI inventory — what must exist

7.1 Settings home (user)

7.2 Create Space wizard

1. Name + icon

2. Public / private

3. Open / invite / request

4. Text only vs voice-capable

5. Confirm credit/privilege gate

7.3 Composer discipline

7.4 Host Config stays separate

---

8. Security & isolation

---

9. Relation to dual world / KAIVERSE

---

10. Phased delivery (recommended order)

| Phase | Name | Outcome |
|-------|------|---------|
| 0 | Composer textable-only + this goal | No Send on Metrics/Settings/thread list |
| 1 | User Settings shell (read/write prefs API + UI) | Theme, density, chat mode, notifications globals — no prompts |
| 2 | Spaces S1–S2 | Create/list/join + rail |
| 3 | Invites + private Spaces | Real hosting |
| 4 | Workspace admin settings | Seats/roles |
| 5 | Per-Space user notification overrides | Discord parity |
| 6 | Credits enforcement on Spaces | Economy live hooks |
| 7 | Voice/video Space flags + categories | Full product depth |

---

11. Explicit non-goals (this goal)

---

12. Acceptance criteria (owner can tick)

Spaces

Composer

User settings

Ecosystem settings

---

13. Resume / next engineering session

1. Read this doc §10 Phase 0–1.

2. Keep composer rules when adding panes.

3. Implement /api/me/settings + Settings shell before large Spaces UI.

4. Spaces S1 only after settings shell exists (create Space from Settings → Spaces or Messages → Create).

5. Wire plan gates from plan-tiers.mjs privilege keys (add spaces_create, spaces_private, spaces_open_join as needed).

6. Do not put Spaces create on host Config view.

---

14. Open decisions (owner may flip later)

1. Explorer: 1 free Space vs 0 (create only on paid)? *Proposal: 1 free public Space.*

2. Platform-wide “public community Spaces” vs workspace-only directory first? *Proposal: workspace-only first.*

3. Bridge user Spaces to Discord ever? *Proposal: no by default; opt-in integration later.*

4. Thread replies from user Spaces credit cost? *Proposal: same as channel message.*

---

15. Changelog of this goal

| Date | Note |
|------|------|
| 2026-07-16 | v1.0 created — Spaces + User/Ecosystem Settings mega-goal; composer textable rule specified; links economy + host settings split |

---

*End of goal. Implementation may take many releases; do not mark “done” because a modal exists. Done = acceptance criteria above.*