← Back to Pull requests

docs(openspec): propose shell and agent control for WebMux #337

Closed
unknown closed this pull request without merging on Nov 06, 2026 01:28 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 17:32 UTC
Author

Summary

OpenSpec change add-agent-shell-control: let scripts and CLI agents drive almost every WebMux feature from the shell. This PR contains only the specification (proposal, design, tasks, spec deltas); implementation follows in five topic PRs listed in tasks.md §0.

What the spec covers

  • Discovery: every session process (including ACP sidecars) gets WEBMUX_SOCKET and WEBMUX_BIN (the server's own os.Executable()), without touching PATH; CLI --socket, self alias, exit code 124 for timeouts.

  • Session control: api, kill/rm/rename, send (acknowledged submissions, --wait without the stale-state race), wait, logs, screen (client-side terminal emulation; the server still does none), events, dir, notify / notify --clear.

  • Launch aligned with the web UI: run --worktree/--new-worktree, auto workspace association, --start-side/--prompt/--init/--label/--json/--wait/--dry-run/--follow, auto-detach without a terminal; chat new = Quick Start; launch-config options.

  • Session metadata: GET /api/sessions/{id}/details, webmux get --field, unforgeable parentId for sessions created from inside a session, in-memory labels with ls filters.

  • Chat / workspace: chat send/watch/status/cancel/answer/switch, history (ls/resume/forget), runtime config and queue; repo incl. repo settings, worktree commands with home-page display (pin/unpin/home, same rules as the web), full launch-config CRUD, forward.

  • Help: one command table generates --help (English, 9 sections, ≥2 examples), help --json, bash/zsh/fish completion and the llms command reference; --help goes to stdout with exit 0 (fixes run/attach/ls/open).

  • {{webmux}}: the reserved variable becomes a short brief (session ID, executable/socket paths, llms.txt address, temp folder rule). The guide is served llms.txt-style at /llms.txt, /llms/<topic>.md, /llms-full.txt, rendered in memory (never written to disk); the temp-folder instructions move into /llms/artifacts.md, and the "临时文件夹" preset is replaced by "WebMux 工具".
  • Confirmed decisions are recorded in design.md (决策记录).

    Verification

  • go test ./internal/docguard passes. No code changed.
  • User stories

    No story changes in this PR (spec only). Implementation PRs will add a new story group for shell/agent control and update US-Q13 plus the quick command, artifacts and init instruction stories (tasks.md §8.1).

    ---
    _Generated by Claude Code_

    Diff: 320 lines (+240 / -80) across 4 files Reviewer: mzdluo123 Review duration: 476m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 320 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #337"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 41.9% (MEDIUM) · Higher = larger blast radius
    41.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%