Skip to content

feat(subagents): add TUI slash subagent runtime browser#2463

Open
JimmyDaddy wants to merge 33 commits into
esengine:main-v2from
JimmyDaddy:feat/custom-slash-commands-go
Open

feat(subagents): add TUI slash subagent runtime browser#2463
JimmyDaddy wants to merge 33 commits into
esengine:main-v2from
JimmyDaddy:feat/custom-slash-commands-go

Conversation

@JimmyDaddy
Copy link
Copy Markdown
Contributor

@JimmyDaddy JimmyDaddy commented May 31, 2026

What

Ports the custom slash command + slash-subagent workflow to the Go implementation, with the runtime-management UI currently scoped to the TUI.

Skill and command infrastructure

  • Parses disable-model-invocation: true so skills can remain slash-invokable while staying out of the model prompt index.
  • Loads agent files from .reasonix/agents/ and .claude/agents/ as runAs=subagent slash skills, including CJK file names.
  • Supports settings-defined shell slash commands, with project scope overriding global scope.
  • Keeps dispatch priority as:
Custom commands (.md) > Shell commands (settings.json) > Skills / Agents
  • Agent-style skills are invoked directly as /<name>.

TUI slash subagents

  • Bare /subagents is the public task-center entrypoint for active and retained slash-subagent runs.
  • Explicit /subagents cancel <id-or-alias> and /subagents clear [completed|failed|canceled|all] remain available as controller-backed management commands.
  • Slash arg completion now emphasizes cancel and clear;
  • The task-center list view supports filter mode via /, matching alias, skill, or state.
  • Renders live slash-subagent output as a structured embedded block inside the main transcript, in conversational order with the parent session.
  • Keeps the main composer interactive while a background slash subagent runs.
  • Supports collapsing/expanding the live block with Ctrl-O; terminal states auto-expand so the final answer is visible in full.
  • Keeps the detail view as an independent read-only replay screen for any retained run.
  • Reuses transcript-style rendering for thinking, tool calls, blocked tools, answers, usage, and terminal state in the detail screen.
  • Reuses shared picker helpers for selection clamping and rune-safe backspace handling, reducing duplicated TUI logic.
  • Localizes new /subagents picker and controller copy through internal/i18n.
  • Supports scrolling inside the detail screen, Esc to return to the main agent, and Ctrl-D to quit.
  • Preserves completed subagent results without compressing the final answer before handing them back to the parent agent flow.

Desktop scope

  • Desktop keeps existing slash skills such as /explore visible.
  • Desktop omits /subagents from command autocomplete and blocks hand-entered /subagents runtime-management commands with a localized TUI-only notice.
  • Desktop does not expose ListSubagents, SubagentDetail, or CancelSubagent bindings in this slice.

Merge notes

This branch has been merged with the latest upstream/main-v2. The final conflict resolution keeps both sides of the desktop workspace changes:

  • upstream recent-workspace persistence/list behavior
  • this branch's workspace readability check and macOS Files & Folders permission error guidance

Tests

  • git diff --check
  • root module: gofmt check, go vet ./..., go build ./..., go test ./..., go test -race ./...
  • golangci-lint run --timeout=5m
  • make build
  • desktop module: gofmt check, go mod tidy, go vet ./..., go build ./..., go test ./...

Ref

  • docs/SLASH_SUBAGENT_DESIGN.md

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label May 31, 2026
@JimmyDaddy JimmyDaddy changed the title feat(slash): custom slash commands — disableModelInvocation, shell commands, /agents [WIP]feat(slash): custom slash commands — disableModelInvocation, shell commands, /agents May 31, 2026
@JimmyDaddy JimmyDaddy force-pushed the feat/custom-slash-commands-go branch from d23b367 to f47c394 Compare May 31, 2026 16:00
@JimmyDaddy JimmyDaddy changed the title [WIP]feat(slash): custom slash commands — disableModelInvocation, shell commands, /agents feat(slash): custom slash commands — disableModelInvocation, shell commands, /agents, subagent panel May 31, 2026
@JimmyDaddy JimmyDaddy force-pushed the feat/custom-slash-commands-go branch 10 times, most recently from af628d0 to 08d1df8 Compare May 31, 2026 17:11
@JimmyDaddy JimmyDaddy changed the title feat(slash): custom slash commands — disableModelInvocation, shell commands, /agents, subagent panel [WIP]feat(subagents): custom slash commands — disableModelInvocation, shell commands, /agents, subagent panel May 31, 2026
@JimmyDaddy JimmyDaddy marked this pull request as draft May 31, 2026 17:13
@JimmyDaddy JimmyDaddy changed the title [WIP]feat(subagents): custom slash commands — disableModelInvocation, shell commands, /agents, subagent panel feat(subagents): add TUI slash subagent runtime browser Jun 1, 2026
@JimmyDaddy JimmyDaddy marked this pull request as ready for review June 1, 2026 14:45
@esengine
Copy link
Copy Markdown
Owner

esengine commented Jun 1, 2026

Took this for a thorough pass — the architecture is sound: the slash-subagent surface is strictly user-invoked, task.go's model-facing Description/Schema is unchanged (no new model-driven spawning), and disable-model-invocation keeping slash skills out of the model index is exactly right. Root Go build and the frontend typecheck are clean.

One blocker before this can land: it fails go test on Windows, in internal/control:

--- FAIL: TestSubmitRunsShellCommand
    submit_test.go:78: Submit shell command notices = [\a b"], want [a b]
--- FAIL: TestSubmitRunsShellCommandWithMultilineArgs
    submit_test.go:91: ... = [\a b"], want [a b]

The tests use printf '%s\n' with /echo "a b", which assumes POSIX sh -c semantics. On Windows shellInvocation falls back to cmd /c, where single-quotes and printf behave differently, so the output comes back mangled. Our CI only runs macOS/ubuntu, so this stays green there but breaks on Windows.

Could you:

  1. Make those tests OS-aware (skip on Windows, or use a portable command that behaves the same under both sh -c and cmd /c), and
  2. Confirm the shell-command feature itself quotes args sanely under cmd /c on Windows (or document that user shell commands are written per-platform)?

Given the size (+5957/45 files), I'll also want to walk through docs/SLASH_SUBAGENT_DESIGN.md once the Windows failures are resolved. Thanks for the design doc — it made the review much easier.

@JimmyDaddy
Copy link
Copy Markdown
Contributor Author

JimmyDaddy commented Jun 1, 2026

Took this for a thorough pass — the architecture is sound: the slash-subagent surface is strictly user-invoked, task.go's model-facing Description/Schema is unchanged (no new model-driven spawning), and disable-model-invocation keeping slash skills out of the model index is exactly right. Root Go build and the frontend typecheck are clean.

One blocker before this can land: it fails go test on Windows, in internal/control:

--- FAIL: TestSubmitRunsShellCommand
    submit_test.go:78: Submit shell command notices = [\a b"], want [a b]
--- FAIL: TestSubmitRunsShellCommandWithMultilineArgs
    submit_test.go:91: ... = [\a b"], want [a b]

The tests use printf '%s\n' with /echo "a b", which assumes POSIX sh -c semantics. On Windows shellInvocation falls back to cmd /c, where single-quotes and printf behave differently, so the output comes back mangled. Our CI only runs macOS/ubuntu, so this stays green there but breaks on Windows.

Could you:

  1. Make those tests OS-aware (skip on Windows, or use a portable command that behaves the same under both sh -c and cmd /c), and
  2. Confirm the shell-command feature itself quotes args sanely under cmd /c on Windows (or document that user shell commands are written per-platform)?

Given the size (+5957/45 files), I'll also want to walk through docs/SLASH_SUBAGENT_DESIGN.md once the Windows failures are resolved. Thanks for the design doc — it made the review much easier.

Thanks for the careful pass - I've pushed an update for the Windows blocker.

What changed:

  • Made the shell-command controller tests platform-safe. The /echo "a b" and multiline-arg cases now use the test binary as a helper command instead of POSIX-only printf '%s\n', so they exercise the same raw slash-arg path without assuming sh syntax.
  • Added lower-level internal/command coverage for quoted user args and a plain arg case.
  • Updated docs/SLASH_SUBAGENT_DESIGN.md to document the contract: settings slash commands are platform shell snippets (cmd /c on Windows, sh -c elsewhere); Reasonix preserves quoted user args but does not translate POSIX shell syntax to Windows cmd.exe syntax.
  • I also included a Windows execution-path change for settings slash commands and the hook shell spawner: on Windows it sets SysProcAttr.CmdLine for cmd /c ... so Go's argv escaping does not mangle the quoted command string before cmd.exe applies its own parsing. Could you sanity-check whether that is an acceptable direction for this codebase? If you'd rather keep the runtime path unchanged and only make the tests/docs OS-aware, I can trim that part back.

Validation run locally:

  • go test ./internal/command ./internal/control ./internal/hook
  • go test ./...
  • cd desktop && go test ./...
  • cd desktop/frontend && pnpm build
  • git diff --check

@JimmyDaddy JimmyDaddy force-pushed the feat/custom-slash-commands-go branch 3 times, most recently from b6790f6 to 6584053 Compare June 2, 2026 06:11
@JimmyDaddy JimmyDaddy force-pushed the feat/custom-slash-commands-go branch from 6584053 to 80b0d26 Compare June 2, 2026 15:55
Copy link
Copy Markdown
Contributor Author

JimmyDaddy commented Jun 4, 2026

@esengine latest conflicts are resolved again and the branch is back to a clean, mergeable state.

Before I keep chasing main-v2 conflicts every few days, could you help confirm whether this feature direction is still something you'd like reviewed / considered for merge?

If the overall direction looks good, I'd really appreciate a review pass and any design feedback you have, especially on the TUI-only /subagents management surface

If this is not a direction you want to take, no worries at all — a short "not aligned" reply is enough and I can close the PR instead of continuing to carry the merge burden.

Thanks.

@JimmyDaddy JimmyDaddy requested a review from SivanCola as a code owner June 4, 2026 14:54
Reasonix Test added 8 commits June 4, 2026 22:58
…h-commands-go

# Conflicts:
#	desktop/app.go
#	internal/control/controller.go
…h-commands-go

# Conflicts:
#	internal/control/controller.go
#	internal/i18n/messages_en.go
#	internal/i18n/messages_zh.go
…h-commands-go

# Conflicts:
#	internal/cli/chat_tui_test.go
#	internal/control/slash.go
#	internal/i18n/i18n.go
#	internal/i18n/messages_en.go
#	internal/i18n/messages_zh.go
@JimmyDaddy JimmyDaddy requested a review from esengine as a code owner June 5, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants