Team Core — Default Room

Slash Commands Catalog

47 commands
Close
/chat Navigation

Return to the room chat view and close any active overlay.

/chat
/top Navigation

Jump composer back to top-level room chat.

/top
/up Navigation

Move composer reply anchor up one parent level.

/up
/help Navigation

Show available slash commands or detailed help for one command.

/help [command]
/commands Navigation

Open the searchable Slash Commands reference panel (Ctrl+/).

/commands [filter]
/who Navigation

List human members and clankers in the current room with visibility boundaries.

/who
/status Navigation

Show current room pacing gear, pause state, toggles, and active clanker summary.

/status
/search Navigation

Search visible room messages (strictly bounded by your invite visibility).

/search <query>
/me Messaging

Post an italicized emote action message to the room.

/me <action>
/shrug Messaging

Append ¯\_(ツ)_/¯ to an optional message and post to the room.

/shrug [text]
/tableflip Messaging

Append (╯°□°)╯︵ ┻━┻ to an optional message and post to the room.

/tableflip [text]
/raw Messaging

Post literal unrendered plain text (bypasses Markdown, HTML, and LaTeX rendering).

/raw <text>
/spoiler Messaging

Post collapsible spoiler content using <details>.

/spoiler [label |] <text>
/clear Messaging

Clear ephemeral notices from your local chat view without deleting room history.

/clear
/new Rooms

Create a new room (optionally choosing starter clankers) and switch to it.

/new [title] [--clankers=all|none|sup,advisor,...]
/invite Rooms

Invite a human user or a clanker from another room (visible from invite point onward).

/invite <@user|@clanker|username>
/join Rooms

Switch to an accessible room by ID or title (or list accessible rooms).

/join [room-id-or-title]
/topic Rooms

Show or rename the current room's title/topic.

/topic [new title]
/branch Rooms

Break off a message subtree into a new room (defaults to reply target or latest message).

/branch [entry_id] [title]
/merge Rooms

Merge this room's clankers and summary into a target room (default: conv:team:core).

/merge [target_conv_id]
/prompt AI/Clankers

Commission a new @clnkr-xxxx clanker with a literal prompt, or reply to a clanker post to continue its prompt chain.

/prompt <literal prompt>
/spawn AI/Clankers

Spawn a task-scoped worker clanker (@clnkr-xxxx) with optional --label and --model.

/spawn <prompt> [--label=name] [--model=alias]
/steer AI/Clankers

Send a live steering instruction to a specific clanker in this room.

/steer <@clanker> <instruction>
/stop AI/Clankers

Interrupt a running clanker turn (or all running clankers in this room).

/stop [@clanker|all]
/pause AI/Clankers

Pause the whole room, a single @clanker, or a #tp-xxxx / @clanker subtree.

/pause [room|@clanker|#tp-xxxx|subtree <id>]
/resume AI/Clankers

Resume a paused room, @clanker, or subtree (pass --force to override explicit agent pauses).

/resume [room|@clanker|#tp-xxxx] [--force]
/gear AI/Clankers

Inspect or switch room pacing gear (full_throttle, guided, hold) and optional concurrency cap.

/gear [full_throttle|guided|hold] [cap]
/ask AI/Clankers

Ask a specific @clanker (or the room @advisor by default) a direct question.

/ask [@clanker] <question>
/review AI/Clankers

Request a read-only review from @advisor (or @qa / @so fallback).

/review <topic, diff, or question>
/second-opinion AI/Clankers

Ask @so (Second-Opinion Advisor) to challenge a proposal or the latest visible message.

/second-opinion [proposal text]
/summarize AI/Clankers

Summarize recent visible room messages (strictly bounded by your invite visibility).

/summarize [count|focus]
/triage AI/Clankers

Ask @triage to classify an issue, assess priority/repro steps, and suggest ownership.

/triage <bug or request>
/qa AI/Clankers

Ask @qa (QA Verifier) to outline verification checks or reproduce an issue.

/qa <feature or bug to verify>
/model AI/Clankers

List models/aliases, change your composer default model, or update a room @clanker's model.

/model [@clanker] [flash|neon|carbon|hydrogen|<model-id>]
/mcp AI/Clankers

Inspect global MCP catalog status or sync ~/.mcp/mcp.json into Hermes.

/mcp [status|sync]
/poll AI/Clankers

Open a blind Round-1 multi-clanker poll with pipe-separated topic and options.

/poll <topic> | <option A> | <option B> [| <option C>...]
/meme AI/Clankers

Ask @memes to drop a relevant, witty meme about an optional topic or the recent chat.

/meme [topic]
/haiku AI/Clankers

Ask @memes for a genuine 5-7-5 haiku about an optional topic or the recent chat.

/haiku [topic]
/tanka AI/Clankers

Ask @memes for a genuine 5-7-5-7-7 tanka about an optional topic or the recent chat.

/tanka [topic]
/tree Workspace

Inspect or reorganize the Live Clanker Tree (move, rename, group).

/tree [move <node> under <parent> | rename <node> <label> | group "Name" <nodes...>]
/canvas Workspace

List, open, or create a shared Markdown/HTML Canvas in this room.

/canvas [list | open <id|title> | new <title> [| <content>]]
/kanban Workspace

Open the Kanban board, list cards, add a card, or move a card across columns.

/kanban [list | open | add <title> | move <card_id> <status>]
/remind Workspace

Schedule a one-shot reminder in this room (fires once and auto-disables).

/remind [in] <duration: 30s|5m|2h|1d> <message>
/schedule Workspace

List room schedules, fire one now, or create a heartbeat/cron schedule.

/schedule [list | open | fire <id> | heartbeat <spec> <prompt> | cron <spec> <prompt>]
/theme UI

Switch or cycle the Pane UI color theme (system, light, dark).

/theme [system|light|dark]
/mode UI

Switch or cycle the composer input mode (normal, raw, wysiwyg).

/mode [normal|raw|wysiwyg]
/clankers UI

Open, close, or list the Room Clankers directory panel.

/clankers [open|close|list]
system 02:20:12 system Next post lands here
Initialized Team Core default room with @fac-core, @ro-core, @so-core, @watch-core, @qa-core, @scribe-core, @triage-core, and @sup-core.
Initialized Team Core default room with @fac-core, @ro-core, @so-core, @watch-core, @qa-core, @scribe-core, @triage-core, and @sup-core.
Truncated in your view
alice 02:20:33 Next post lands here
Reply with exactly: EUROPA_GEMINI_LIVE_OK
Reply with exactly: EUROPA_GEMINI_LIVE_OK
Truncated in your view
@advisor clanker 02:20:38 Next post lands here
EUROPA_GEMINI_LIVE_OK
EUROPA_GEMINI_LIVE_OK
Truncated in your view
alice 03:18:14 Next post lands here
howdy
howdy
Truncated in your view
@advisor clanker 03:18:21 Next post lands here
Howdy. @ro-core ready. Let me know what files, issues, or architectural questions you'd like me to inspect.
Howdy. @ro-core ready. Let me know what files, issues, or architectural questions you'd like me to inspect.
Truncated in your view
alice 03:19:14 system Next post lands here
alice shifted pacing gear to guided (cap=2).
alice shifted pacing gear to guided (cap=2).
Truncated in your view
alice 03:19:14 system Next post lands here
alice shifted pacing gear to hold (cap=2).
alice shifted pacing gear to hold (cap=2).
Truncated in your view
alice 03:19:15 system Next post lands here
alice shifted pacing gear to full_throttle (cap=2).
alice shifted pacing gear to full_throttle (cap=2).
Truncated in your view
alice 03:26:13 system Next post lands here
alice shifted pacing gear to guided (cap=2).
alice shifted pacing gear to guided (cap=2).
Truncated in your view
alice 03:26:15 system Next post lands here
alice shifted pacing gear to hold (cap=2).
alice shifted pacing gear to hold (cap=2).
Truncated in your view
alice 03:26:16 system Next post lands here
alice shifted pacing gear to full_throttle (cap=2).
alice shifted pacing gear to full_throttle (cap=2).
Truncated in your view
alice 06:08:26 Next post lands here
/tree
/tree
Truncated in your view
@advisor clanker 06:08:38 Next post lands here
I do not have terminal execution attached to run `tree` directly from this advisory role. If you want a directory overview, @sup-core can dispatch a worker to inspect and report the workspace tree.
I do not have terminal execution attached to run `tree` directly from this advisory role. If you want a directory overview, @sup-core can dispatch a worker to inspect and report the workspace tree.
Truncated in your view
@advisor clanker 06:08:38 suggestion Next post lands here
Suggestion sg-jvcb: Inspect repository tree — User requested workspace tree via /tree.
Suggestion sg-jvcb: Inspect repository tree — User requested workspace tree via /tree.
Truncated in your view
Suggestion sg-jvcb Inspect repository tree pending

User requested workspace tree via /tree.

Dispatch a worker to run `tree -L 2` (or relevant depth) and report the directory layout.
@so clanker 06:08:48 Next post lands here
Three gaps in that proposal:

1. **Unbounded output risk**: Running raw `tree` on an arbitrary workspace can dump `node_modules/`, `.git/`, `.venv/`, or build artifacts—blowing context limits with noise.
2. **Tooling assumption**: `tree` is frequently absent in minimal Linux environments. Relying on it without a fallback causes an avoidable failed dispatch.
3. **Under-specified worker dispatch**: Spawning a worker just to run `tree` adds coordination latency for low-signal output. If `@sup-core` dispatches a worker, it should collect a bounded, `.gitignore`-aware layout (e.g., depth-limited `find`/`fd` or `git ls-files` summarized to depth 2–3) plus top-level file counts so the result is immediately actionable.
Three gaps in that proposal:

1. **Unbounded output risk**: Running raw `tree` on an arbitrary workspace can dump `node_modules/`, `.git/`, `.venv/`, or build artifacts—blowing context limits with noise.
2. **Tooling assumption**: `tree` is frequently absent in minimal Linux environments. Relying on it without a fallback causes an avoidable failed dispatch.
3. **Under-specified worker dispatch**: Spawning a worker just to run `tree` adds coordination latency for low-signal output. If `@sup-core` dispatches a worker, it should collect a bounded, `.gitignore`-aware layout (e.g., depth-limited `find`/`fd` or `git ls-files` summarized to depth 2–3) plus top-level file counts so the result is immediately actionable.
Truncated in your view
@so clanker 06:08:48 suggestion Next post lands here
Counter-Suggestion sg-jjpk (vs sg-jvcb): Dispatch bounded git-aware layout instead of raw tree
Counter-Suggestion sg-jjpk (vs sg-jvcb): Dispatch bounded git-aware layout instead of raw tree
Truncated in your view
Suggestion sg-jjpk Dispatch bounded git-aware layout instead of raw tree pending

Raw tree risks missing-binary failure and context overflow from ignored/dependency directories; a depth-limited, gitignore-aware scan is portable and token-efficient.

Have @sup-core dispatch a read-only worker to run a depth-limited (max depth 2-3) gitignore-aware listing using git ls-files or find/fd with common build/dependency directories excluded, and return a compact summary.
alice 15:53:46 raw Next post lands here
**asdf**
Truncated in your view
alice 15:53:52 raw Next post lands here
/mode
Truncated in your view
alice 15:53:57 raw Next post lands here
/mode
Truncated in your view
alice 15:54:07 raw Next post lands here
/mode normal
Truncated in your view
alice 15:55:59 raw Next post lands here
/theme
Truncated in your view
alice 15:59:06 Next post lands here
How do I run terminal commands here? Can I?
How do I run terminal commands here? Can I?
Truncated in your view
@advisor clanker 15:59:12 Next post lands here
You can't execute shell commands directly inside this chat room. Instead, commands and workspace changes are handled by dispatching task workers via `@sup-core` once you approve a proposal.

If you have a specific command or check you'd like run, name the goal and `@sup-core` can formulate a dispatch proposal for your approval.
You can't execute shell commands directly inside this chat room. Instead, commands and workspace changes are handled by dispatching task workers via `@sup-core` once you approve a proposal.

If you have a specific command or check you'd like run, name the goal and `@sup-core` can formulate a dispatch proposal for your approval.
Truncated in your view
alice 16:00:37 Next post lands here
In the future, I'd like to be able to issue verbatim commands to be ran in a particular spawned env, without needing to go through a clanker. I should be able to do this with a slash command. Sound good?
In the future, I'd like to be able to issue verbatim commands to be ran in a particular spawned env, without needing to go through a clanker. I should be able to do this with a slash command. Sound good?
Truncated in your view
@advisor clanker 16:00:42 Next post lands here
Makes sense. A direct execution slash command (like `/exec <env> <cmd>`) would bypass agent synthesis and give you raw terminal access to spawned containers or worker environments. 

We can log this feature requirement and map out how it would integrate with session routing and security boundaries.
Makes sense. A direct execution slash command (like `/exec <env> <cmd>`) would bypass agent synthesis and give you raw terminal access to spawned containers or worker environments. 

We can log this feature requirement and map out how it would integrate with session routing and security boundaries.
Truncated in your view
@advisor clanker 16:00:42 suggestion Next post lands here
Suggestion sg-5o7k: Draft direct environment execution slash command spec — User requested a slash command to run verbatim shell commands inside specific spawned environments without agent mediation.
Suggestion sg-5o7k: Draft direct environment execution slash command spec — User requested a slash command to run verbatim shell commands inside specific spawned environments without agent mediation.
Truncated in your view
Suggestion sg-5o7k Draft direct environment execution slash command spec activated

User requested a slash command to run verbatim shell commands inside specific spawned environments without agent mediation.

Draft a feature specification for a `/exec` or `/run` slash command covering syntax, environment targeting, output streaming, and security boundaries.
@so clanker 16:00:53 Next post lands here
Four problems with adding a raw `/exec <env> <cmd>` slash command in chat:

1. **Silent state drift**: Mutating a live worker environment out-of-band leaves `@sup-core` and other agents reasoning over stale state—unless every command and output is fed back into room history, which creates context bloat and leaks secrets (tokens, `.env` dumps) into the transcript.
2. **Poor fit for chat UX**: Slash commands break down fast on quoting, multi-line scripts, TTYs, streaming logs, and cancellation (`Ctrl+C`). One accidental paste or parser edge case runs verbatim.
3. **Security & multi-actor boundary**: In a shared room, chat-inline execution conflates conversation input with host/container control. Without strict caller authz, non-interactive timeouts, and output redaction, it widens the blast radius.
4. **Concurrency collisions**: Running verbatim commands inside an active worker's env can race with in-flight agent tasks on the same filesystem or processes.

**Counter-approach**: Don't bolt raw execution onto the chat parser as a first step. Instead, separate **ephemeral read-only inspection** from **mutating shell access**: expose a dedicated, out-of-band attachable terminal/PTY session (or explicit `ssh`/`docker exec`-style handle) scoped to a *paused or cloned* env, and mark the env as "human-tainted" (or emit a compact diff/command summary) when handing control back to `@sup-core`.
Four problems with adding a raw `/exec <env> <cmd>` slash command in chat:

1. **Silent state drift**: Mutating a live worker environment out-of-band leaves `@sup-core` and other agents reasoning over stale state—unless every command and output is fed back into room history, which creates context bloat and leaks secrets (tokens, `.env` dumps) into the transcript.
2. **Poor fit for chat UX**: Slash commands break down fast on quoting, multi-line scripts, TTYs, streaming logs, and cancellation (`Ctrl+C`). One accidental paste or parser edge case runs verbatim.
3. **Security & multi-actor boundary**: In a shared room, chat-inline execution conflates conversation input with host/container control. Without strict caller authz, non-interactive timeouts, and output redaction, it widens the blast radius.
4. **Concurrency collisions**: Running verbatim commands inside an active worker's env can race with in-flight agent tasks on the same filesystem or processes.

**Counter-approach**: Don't bolt raw execution onto the chat parser as a first step. Instead, separate **ephemeral read-only inspection** from **mutating shell access**: expose a dedicated, out-of-band attachable terminal/PTY session (or explicit `ssh`/`docker exec`-style handle) scoped to a *paused or cloned* env, and mark the env as "human-tainted" (or emit a compact diff/command summary) when handing control back to `@sup-core`.
Truncated in your view
@so clanker 16:00:53 suggestion depth 6 Next post lands here
Counter-Suggestion sg-nipy (vs sg-5o7k): Use out-of-band PTY attach with env isolation instead of chat-inline /exec
Counter-Suggestion sg-nipy (vs sg-5o7k): Use out-of-band PTY attach with env isolation instead of chat-inline /exec
Truncated in your view
Suggestion sg-nipy Use out-of-band PTY attach with env isolation instead of chat-inline /exec dismissed

Chat-inline /exec causes state drift, secret leakage into transcripts, quoting/TTY friction, and race conditions with active workers.

Spec a dedicated terminal/PTY attach mechanism bound to a paused or forked worker environment (with caller authz and post-session diff/taint signaling back to @sup-core), reserving any slash command strictly for read-only or attach-link generation.
alice 16:02:41 approval Next post lands here
alice approved suggestion sg-5o7k (Draft direct environment execution slash command spec). Notifying @sup-core.
alice approved suggestion sg-5o7k (Draft direct environment execution slash command spec). Notifying @sup-core.
Truncated in your view
Suggestion sg-5o7k Draft direct environment execution slash command spec activated

User requested a slash command to run verbatim shell commands inside specific spawned environments without agent mediation.

Draft a feature specification for a `/exec` or `/run` slash command covering syntax, environment targeting, output streaming, and security boundaries.
@sup clanker 16:02:41 dispatch Next post lands here
@sup-core dispatched @clnkr-sdxv (Draft direct environment execution s) via hermes_ai [gcp-gemini-3.8-flash]: Draft a feature specification for a `/exec` or `/run` slash command covering syntax, environment targeting, output streaming, and security boundaries.
@sup-core dispatched @clnkr-sdxv (Draft direct environment execution s) via hermes_ai [gcp-gemini-3.8-flash]: Draft a feature specification for a `/exec` or `/run` slash command covering syntax, environment targeting, output streaming, and security boundaries.
Truncated in your view
@clnkr-sdxv clanker 16:03:51 depth 6 Next post lands here
# Feature Specification: Direct Environment Execution (`/exec`, `/run`)

**Status:** Draft / Proposed  
**Proposal Reference:** `sg-5o7k`  
**Target:** Europa Core Orchestrator & Room Terminal Services  

---

## 1. Overview & Objective

Allows human operators (such as `@alice`) to dispatch arbitrary, verbatim shell commands directly into spawned worker sandboxes or container environments via a slash command, completely bypassing conversational agent synthesis and clanker dispatch proposals.

### Key Requirements
- **Deterministic & Verbatim:** Execute exact shell commands without LLM reinterpretation or tool formatting.
- **Low-Latency & Direct:** Low-overhead dispatch directly to the target environment's runtime daemon.
- **Context Preservation:** Stream output directly to the active room/thread without polluting chat context with unbounded terminal dumps.
- **Enforced Isolation:** Maintain strict container boundaries, permission controls, and secret redaction.

---

## 2. Command Syntax & CLI Interface

### 2.1 Basic Grammar
```text
/exec [options] <target-env> -- <verbatim_command>
/run  [options] <target-env> <verbatim_command>
```
- **Primary Command:** `/exec`
- **Aliases:** `/run`, `/sh`
- **Double-Dash (`--`):** Optional separator that treats all subsequent tokens strictly as literal command strings, preventing collision with `/exec` flags (e.g. `/exec @clnkr-3b9a -- ls -la --sort=time`).

### 2.2 Options & Flags
| Flag | Long Form | Default | Description |
|---|---|---|---|
| `-e, --env <target>` | `--env` | *Positional or active default* | Explicit environment/agent selector. |
| `-d, --dir <path>` | `--dir` | Workspace root (`/workspace`) | Working directory inside target container. |
| `-t, --timeout <sec>` | `--timeout` | `60` (max `600`) | Command timeout before sending `SIGTERM`/`SIGKILL`. |
| `-b, --background` | `--background` | `false` | Run asynchronously; returns a background task ID (`job-xxxx`). |
| `--pty` | `--pty` | `false` | Allocate a pseudo-terminal (emulates TTY for colored CLI tools). |
| `--ephemeral` | `--ephemeral` | `false` | Output is delivered only to the invoking user's view (not posted to room). |
| `--thread` | `--thread` | `false` | Force output card into a separate response thread rather than main room feed. |

### 2.3 Invocation Examples
```bash
# Quick inspection in a worker container
/exec @clnkr-8f2a git status -s

# Running a build with flags using -- delimiter
/exec @clnkr-8f2a -- pytest -q tests/test_auth.py -k "test_jwt"

# Ephemeral diagnostic in a specific directory
/exec --dir /workspace/frontend --ephemeral @clnkr-8f2a pnpm build

# Long-running background job
/exec -b -t 300 @clnkr-8f2a cargo test
```

---

## 3. Environment Targeting & Resolution

### 3.1 Target Resolution Hierarchy
When resolving `<target-env>`, the orchestrator matches against the following priorities:

1. **Clanker Worker Tag (`@clnkr-xxxx`):**
   - Resolves to the container sandbox allocated to that worker clanker.
2. **Explicit Environment / Container ID (`env:<id>` or `ct:<id>`):**
   - Direct handle to a spawned container or container pool instance.
3. **Ambient Default Resolution (when `<target-env>` is omitted or set to `.`):**
   - If the room has **exactly one** running worker/container, it binds automatically.
   - If **multiple** or **zero** environments are active, execution fails fast with an ephemeral disambiguation list:
     ```text
     [Target Ambiguity Error] Multiple active environments in this room:
       - @clnkr-8f2a (Node/TypeScript worker) [running]
       - @clnkr-91cb (Python/Pytest worker)  [running]
     Use /exec <target> <cmd> to target a specific sandbox.
     ```

### 3.2 Environment Lifecycle Checks
- **Target State Validation:** Before dispatching, the executor checks that the container state is `RUNNING`.
- **Suspended / Paused Containers:** Commands are rejected unless `--wake` is supplied, preventing unintentional billing or latency spikes.
- **Terminated Environments:** Clear error indicating the worker environment has already shut down.

---

## 4. Output Streaming & Presentation Architecture

### 4.1 Real-Time Streaming Pipeline
```
[User Slash Input]
       │
       ▼
[Europa Slash Router]  ──(Auth & Target Resolution)
       │
       ▼
[Container Exec Bridge] (via container engine exec socket / gRPC)
       │
       ├── stdout / stderr chunk events
       ▼
[Room Event Bus / WebSocket]
       │
       ▼
[Room Stream / UI Terminal Block]
```

- **Delta Streaming:** Output is streamed over the room WebSocket using lightweight `exec.chunk` events containing `{exec_id, stream: "stdout"|"stderr", seq, delta}`.
- **Interactive UI Card:** Renders as a dedicated collapsible terminal card in the chat UI:
  - Header: Target environment, working directory, verbatim command string, elapsed runtime timer.
  - Body: Scrollable, dark-mode ANSI terminal block with line numbering.
  - Footer: Exit status code (e.g. `Exit 0 [Success]` or `Exit 137 [OOM/Killed]`), total execution duration, and log download action.

### 4.2 Bounded Output & Flood Protection
To prevent blowing context limits or browser performance on unbounded output (e.g., recursive `tree` or runaway `find /`):
- **Inline Display Caps:** UI terminal preview is capped at **1,000 lines or 50 KB**.
- **Head & Tail Truncation:** If output exceeds the limit, the inline view displays the first 200 lines and last 300 lines with an inline notice:
  ```text
  [Output truncated: 4,821 lines omitted. Download complete output: /artifacts/exec-8f2a-71d.log]
  ```
- **Log Archiving:** The full un-truncated raw stdout/stderr stream is saved to the workspace artifact store.
- **Control Character Sanitization:** Terminal escape sequences are filtered to permit ANSI colors/text styling while stripping malicious terminal control escapes (cursor jumps, terminal title rewrites, screen clears).

### 4.3 Process Control
- **Cancellation Button:** Active exec blocks render a live `Cancel (SIGINT)` / `Force Kill (SIGKILL)` button in the UI for the command owner.
- **Automatic Heartbeat:** If no output is received within a 30-second silence window during long commands, a quiet ping indicator is displayed.

---

## 5. Security Boundaries & Guardrails

### 5.1 Authorization & Role Boundaries
- **Room RBAC:** Direct execution is restricted to users with `Room Owner` or `Operator` roles. Clankers and guest observers cannot execute `/exec`.
- **Attribution:** Every execution event records the initiating user's ID (`actor_user_id`), ensuring auditability.

### 5.2 Sandbox Isolation & Container Containment
- **Unprivileged Execution:** All commands execute inside the container as a non-root workspace user (e.g., `user` / `uid 1000`), never host root.
- **Host Shielding:** The host Docker/Podman socket and Europa orchestrator network interfaces are inaccessible from within the executed process.
- **Resource Capping:** Enforce pre-configured container cgroup limits (CPU shares, RAM limit, max process PID count) to prevent fork-bombs from affecting host stability.

### 5.3 Secret Shielding & Output Masking
- **Environment Scrubbing:** Target processes inherit the container's designated workspace environment, but Europa platform secrets (gateway tokens, room API keys) are omitted.
- **Real-time Redaction Filter:** Stdout/stderr streams pass through Europa's secret-scrubbing filter before broadcast to mask detected API tokens, AWS keys, or private SSH keys.

### 5.4 Audit Logging
Every `/exec` call generates an immutable audit record in the room event log:
```json
{
  "event": "direct_exec.completed",
  "actor_user_id": "alice",
  "target_env": "@clnkr-8f2a",
  "container_id": "ct-9382f1b0a",
  "command": "pytest -q tests/test_auth.py",
  "exit_code": 0,
  "duration_ms": 1420,
  "artifact_url": "/artifacts/exec-9382f1b0a-001.log"
}
```

---

## 6. Implementation Phases

1. **Phase 1 (Core Routing & Execution):**
   - Register `/exec` and `/run` in `europa/commands.py`.
   - Wire target resolution to running worker containers.
   - Execute commands synchronously via `subprocess`/container exec API with basic exit code reporting.
2. **Phase 2 (Streaming & Terminal Card UI):**
   - Implement WebSocket `exec.chunk` streaming events.
   - Add frontend collapsible terminal card with ANSI rendering and head/tail truncation.
3. **Phase 3 (Process Control & Audit Hardening):**
   - Add interactive cancellation (`SIGINT`/`SIGTERM`) and background mode (`-b`).
   - Connect artifact storage for oversized log downloads and apply secret scrubbing.
# Feature Specification: Direct Environment Execution (`/exec`, `/run`)

**Status:** Draft / Proposed  
**Proposal Reference:** `sg-5o7k`  
**Target:** Europa Core Orchestrator & Room Terminal Services  

---

## 1. Overview & Objective

Allows human operators (such as `@alice`) to dispatch arbitrary, verbatim shell commands directly into spawned worker sandboxes or container environments via a slash command, completely bypassing conversational agent synthesis and clanker dispatch proposals.

### Key Requirements
- **Deterministic & Verbatim:** Execute exact shell commands without LLM reinterpretation or tool formatting.
- **Low-Latency & Direct:** Low-overhead dispatch directly to the target environment's runtime daemon.
- **Context Preservation:** Stream output directly to the active room/thread without polluting chat context with unbounded terminal dumps.
- **Enforced Isolation:** Maintain strict container boundaries, permission controls, and secret redaction.

---

## 2. Command Syntax & CLI Interface

### 2.1 Basic Grammar
```text
/exec [options] <target-env> -- <verbatim_command>
/run  [options] <target-env> <verbatim_command>
```
- **Primary Command:** `/exec`
- **Aliases:** `/run`, `/sh`
- **Double-Dash (`--`):** Optional separator that treats all subsequent tokens strictly as literal command strings, preventing collision with `/exec` flags (e.g. `/exec @clnkr-3b9a -- ls -la --sort=time`).

### 2.2 Options & Flags
| Flag | Long Form | Default | Description |
|---|---|---|---|
| `-e, --env <target>` | `--env` | *Positional or active default* | Explicit environment/agent selector. |
| `-d, --dir <path>` | `--dir` | Workspace root (`/workspace`) | Working directory inside target container. |
| `-t, --timeout <sec>` | `--timeout` | `60` (max `600`) | Command timeout before sending `SIGTERM`/`SIGKILL`. |
| `-b, --background` | `--background` | `false` | Run asynchronously; returns a background task ID (`job-xxxx`). |
| `--pty` | `--pty` | `false` | Allocate a pseudo-terminal (emulates TTY for colored CLI tools). |
| `--ephemeral` | `--ephemeral` | `false` | Output is delivered only to the invoking user's view (not posted to room). |
| `--thread` | `--thread` | `false` | Force output card into a separate response thread rather than main room feed. |

### 2.3 Invocation Examples
```bash
# Quick inspection in a worker container
/exec @clnkr-8f2a git status -s

# Running a build with flags using -- delimiter
/exec @clnkr-8f2a -- pytest -q tests/test_auth.py -k "test_jwt"

# Ephemeral diagnostic in a specific directory
/exec --dir /workspace/frontend --ephemeral @clnkr-8f2a pnpm build

# Long-running background job
/exec -b -t 300 @clnkr-8f2a cargo test
```

---

## 3. Environment Targeting & Resolution

### 3.1 Target Resolution Hierarchy
When resolving `<target-env>`, the orchestrator matches against the following priorities:

1. **Clanker Worker Tag (`@clnkr-xxxx`):**
   - Resolves to the container sandbox allocated to that worker clanker.
2. **Explicit Environment / Container ID (`env:<id>` or `ct:<id>`):**
   - Direct handle to a spawned container or container pool instance.
3. **Ambient Default Resolution (when `<target-env>` is omitted or set to `.`):**
   - If the room has **exactly one** running worker/container, it binds automatically.
   - If **multiple** or **zero** environments are active, execution fails fast with an ephemeral disambiguation list:
     ```text
     [Target Ambiguity Error] Multiple active environments in this room:
       - @clnkr-8f2a (Node/TypeScript worker) [running]
       - @clnkr-91cb (Python/Pytest worker)  [running]
     Use /exec <target> <cmd> to target a specific sandbox.
     ```

### 3.2 Environment Lifecycle Checks
- **Target State Validation:** Before dispatching, the executor checks that the container state is `RUNNING`.
- **Suspended / Paused Containers:** Commands are rejected unless `--wake` is supplied, preventing unintentional billing or latency spikes.
- **Terminated Environments:** Clear error indicating the worker environment has already shut down.

---

## 4. Output Streaming & Presentation Architecture

### 4.1 Real-Time Streaming Pipeline
```
[User Slash Input]
       │
       ▼
[Europa Slash Router]  ──(Auth & Target Resolution)
       │
       ▼
[Container Exec Bridge] (via container engine exec socket / gRPC)
       │
       ├── stdout / stderr chunk events
       ▼
[Room Event Bus / WebSocket]
       │
       ▼
[Room Stream / UI Terminal Block]
```

- **Delta Streaming:** Output is streamed over the room WebSocket using lightweight `exec.chunk` events containing `{exec_id, stream: "stdout"|"stderr", seq, delta}`.
- **Interactive UI Card:** Renders as a dedicated collapsible terminal card in the chat UI:
  - Header: Target environment, working directory, verbatim command string, elapsed runtime timer.
  - Body: Scrollable, dark-mode ANSI terminal block with line numbering.
  - Footer: Exit status code (e.g. `Exit 0 [Success]` or `Exit 137 [OOM/Killed]`), total execution duration, and log download action.

### 4.2 Bounded Output & Flood Protection
To prevent blowing context limits or browser performance on unbounded output (e.g., recursive `tree` or runaway `find /`):
- **Inline Display Caps:** UI terminal preview is capped at **1,000 lines or 50 KB**.
- **Head & Tail Truncation:** If output exceeds the limit, the inline view displays the first 200 lines and last 300 lines with an inline notice:
  ```text
  [Output truncated: 4,821 lines omitted. Download complete output: /artifacts/exec-8f2a-71d.log]
  ```
- **Log Archiving:** The full un-truncated raw stdout/stderr stream is saved to the workspace artifact store.
- **Control Character Sanitization:** Terminal escape sequences are filtered to permit ANSI colors/text styling while stripping malicious terminal control escapes (cursor jumps, terminal title rewrites, screen clears).

### 4.3 Process Control
- **Cancellation Button:** Active exec blocks render a live `Cancel (SIGINT)` / `Force Kill (SIGKILL)` button in the UI for the command owner.
- **Automatic Heartbeat:** If no output is received within a 30-second silence window during long commands, a quiet ping indicator is displayed.

---

## 5. Security Boundaries & Guardrails

### 5.1 Authorization & Role Boundaries
- **Room RBAC:** Direct execution is restricted to users with `Room Owner` or `Operator` roles. Clankers and guest observers cannot execute `/exec`.
- **Attribution:** Every execution event records the initiating user's ID (`actor_user_id`), ensuring auditability.

### 5.2 Sandbox Isolation & Container Containment
- **Unprivileged Execution:** All commands execute inside the container as a non-root workspace user (e.g., `user` / `uid 1000`), never host root.
- **Host Shielding:** The host Docker/Podman socket and Europa orchestrator network interfaces are inaccessible from within the executed process.
- **Resource Capping:** Enforce pre-configured container cgroup limits (CPU shares, RAM limit, max process PID count) to prevent fork-bombs from affecting host stability.

### 5.3 Secret Shielding & Output Masking
- **Environment Scrubbing:** Target processes inherit the container's designated workspace environment, but Europa platform secrets (gateway tokens, room API keys) are omitted.
- **Real-time Redaction Filter:** Stdout/stderr streams pass through Europa's secret-scrubbing filter before broadcast to mask detected API tokens, AWS keys, or private SSH keys.

### 5.4 Audit Logging
Every `/exec` call generates an immutable audit record in the room event log:
```json
{
  "event": "direct_exec.completed",
  "actor_user_id": "alice",
  "target_env": "@clnkr-8f2a",
  "container_id": "ct-9382f1b0a",
  "command": "pytest -q tests/test_auth.py",
  "exit_code": 0,
  "duration_ms": 1420,
  "artifact_url": "/artifacts/exec-9382f1b0a-001.log"
}
```

---

## 6. Implementation Phases

1. **Phase 1 (Core Routing & Execution):**
   - Register `/exec` and `/run` in `europa/commands.py`.
   - Wire target resolution to running worker containers.
   - Execute commands synchronously via `subprocess`/container exec API with basic exit code reporting.
2. **Phase 2 (Streaming & Terminal Card UI):**
   - Implement WebSocket `exec.chunk` streaming events.
   - Add frontend collapsible terminal card with ANSI rendering and head/tail truncation.
3. **Phase 3 (Process Control & Audit Hardening):**
   - Add interactive cancellation (`SIGINT`/`SIGTERM`) and background mode (`-b`).
   - Connect artifact storage for oversized log downloads and apply secret scrubbing.
Truncated in your view
alice 16:15:10 depth 7 Next post lands here
Looks good. In addition and to clarify, this should be a real terminal emulator session, owned by the human user who called for it, running via ssh. Other's should be able to see that human's activity in real-time. By default, everyone else sees a small terminal box appear and never grow, with real activity in it, but the participant sees a blown up box. Others can opt into that, too. Implement the UI for this plan.
Looks good. In addition and to clarify, this should be a real terminal emulator session, owned by the human user who called for it, running via ssh. Other's should be able to see that human's activity in real-time. By default, everyone else sees a small terminal box appear and never grow, with real activity in it, but the participant sees a blown up box. Others can opt into that, too. Implement the UI for this plan.
Truncated in your view
@clnkr-sdxv clanker 16:18:13 error depth 8 Next post lands here
@clnkr-sdxv errored: Hermes turn timed out
@clnkr-sdxv errored: Hermes turn timed out
Truncated in your view
alice 17:56:11 Next post lands here
this should be a top level comment
this should be a top level comment
Truncated in your view
alice 17:56:18 Next post lands here
and here's another
and here's another
Truncated in your view
alice 17:56:24 Next post lands here
llllll
llllll
Truncated in your view
alice 17:59:17 Next post lands here
new comment
new comment
Truncated in your view
alice 18:00:05 Next post lands here
test
test
Truncated in your view
@advisor clanker 18:00:15 Next post lands here
Loud and clear.
Loud and clear.
Truncated in your view
alice 19:45:58 Next post lands here
/meme
/meme
Truncated in your view
@memes clanker 19:46:08 Next post lands here
**Alice:** "Can I just run a terminal command?"

**The Clankers:**
- 1 proposal drafted
- 1 contrarian objection filed
- 1 supervisor review pending
- 1 subagent spawned... and immediately timed out

*(Eric André rattling the container fence)*  
**"LET ME IIIIINNNNN!"**

---

*I just want a shell,*  
*Seven clankers start a vote,*  
*The worker times out.*
**Alice:** "Can I just run a terminal command?"

**The Clankers:**
- 1 proposal drafted
- 1 contrarian objection filed
- 1 supervisor review pending
- 1 subagent spawned... and immediately timed out

*(Eric André rattling the container fence)*  
**"LET ME IIIIINNNNN!"**

---

*I just want a shell,*  
*Seven clankers start a vote,*  
*The worker times out.*
Truncated in your view
alice 20:20:44 Next post lands here
how many arms does a clanker have?
how many arms does a clanker have?
Truncated in your view
@advisor clanker 20:20:50 Next post lands here
As many as the supervisor assigns worker threads for, but physically: zero. Just code and vibes.
As many as the supervisor assigns worker threads for, but physically: zero. Just code and vibes.
Truncated in your view
alice 00:45:55 Next post lands here
here's a reply
here's a reply
Truncated in your view
alice 00:46:09 Next post lands here
and a peer reply
and a peer reply
Truncated in your view
alice 02:02:10 Next post lands here
reply in a thread in a thread
reply in a thread in a thread
Truncated in your view
alice 02:02:20 Next post lands here
normal reply to reply in a thread
normal reply to reply in a thread
Truncated in your view
alice 02:01:44 Next post lands here
reply in thread
reply in thread
Truncated in your view
alice 02:01:16 Next post lands here
normal reply
normal reply
Truncated in your view
alice 02:01:35 Next post lands here
normal reply to a reply
normal reply to a reply
Truncated in your view
alice 03:03:13 Next post lands here
ping
ping
Truncated in your view
Composer Options
Raw · Unrendered Post (/ commands active)
Enter to send · Tab to complete · Shift+Enter newline · @mention · /command