Skip to content

feat: TUI MCP bridge and quiet mode - #159

Merged
buchenberg merged 1 commit into
mainfrom
feat/tui-mcp-bridge-and-quiet-mode
Aug 6, 2026
Merged

feat: TUI MCP bridge and quiet mode#159
buchenberg merged 1 commit into
mainfrom
feat/tui-mcp-bridge-and-quiet-mode

Conversation

@buchenberg

Copy link
Copy Markdown
Owner

Summary

TUI MCP Bridge

Exposes a running \yaah tui\ session as an MCP server so external agents (Kilo, other yaah instances) can interact with it — sending prompts, pulling OTel traces, reading status, injecting steering, and triggering compaction.

  • New file: \cmd/yaah/serve_tools.go\ — extracted
    egisterServeTools\ from serve.go, added \steer\ and \compact\ tools
  • *\yaah tui --mcp-http 127.0.0.1:7334* — starts TUI + exposes MCP tools over HTTP (recommended transport; stdio mode available via --mcp)
  • Same bridge also wired to \yaah tui2\ (tview prototype)
  • 5 MCP tools: \yaah_prompt, \yaah_traces, \yaah_status, \yaah_steer, \yaah_compact\

TUI Quiet Mode (Ctrl+G / :verbose)

Hides reasoning blocks and tool output by default, reducing chat clutter. Toggle with \Ctrl+G\ or :verbose. Set \ ui: {verbose: true}\ in ~/.yaah/config.yaml\ to start in verbose mode.

  • Spinner, info bar, sub-agent brackets, and streaming text remain visible as activity signals
  • 4 new tests + migration of 10 existing render tests

Changed Files

File Change
\cmd/yaah/serve_tools.go\ New — extracted tools + steer/compact
\cmd/yaah/serve.go\ Removed \
egisterServeTools\ (moved)
\cmd/yaah/tui.go\ --mcp/--mcp-http\ flags, OTel setup, MCP server, verbose config
\cmd/yaah/tui2.go\ Same MCP bridge for tview TUI
\internal/config/load.go\ \TUIConfig\ struct
\internal/tui/model.go\ \�erbose\ field, \ToggleVerbose(), :verbose\ command
\internal/tui/render.go\ 3 \if m.verbose\ gates
\internal/tui/keymap.go\ \ctrl+g\ binding
\internal/tui/input.go\ Key dispatch + :verbose\ handler
\internal/tui/palette_component.go\ Help overlay entry
\internal/tui/tui_test.go\ Test migration + 4 new tests

Quality Gates

  • \go vet\ clean
  • \staticcheck\ clean
  • \gofmt\ clean
  • All tests pass

- Extract registerServeTools to serve_tools.go, add steer/compact tools
- Add --mcp/--mcp-http flags to yaah tui and yaah tui2
- Expose TUI session as MCP server: prompt, traces, status, steer, compact
- Add TUI quiet mode: hide reasoning and tool output by default
- Toggle verbose with Ctrl+G or :verbose command
- Config: tui.verbose in ~/.yaah/config.yaml
@buchenberg
buchenberg merged commit c56af0c into main Aug 6, 2026
4 checks passed
@buchenberg
buchenberg deleted the feat/tui-mcp-bridge-and-quiet-mode branch August 6, 2026 01:09
buchenberg added a commit that referenced this pull request Aug 7, 2026
- Deleted 4 implemented ADRs (0001-0004: engine-view separation, middleware
  pipeline, functional options, event-driven architecture) — all Accepted
  and fully implemented; content covered by architecture.md
- Deleted 5 implemented plan docs from .agents/plans/ (tui-mcp-bridge #159,
  tui-quiet-mode #159, tui2-task-pane-separation #160, max-iterations-dialog,
  web-ui-commands #162) — all features shipped
- Updated docs/adr/README.md and CONTRIBUTING.md to remove dead ADR links
- Fixed stale references to cmd/yaah/subagent_runner.go in architecture.md,
  PROMPT-INJECTION.md, and code-organization.md (now internal/agent/runner)
buchenberg added a commit that referenced this pull request Aug 7, 2026
#174)

* Split wiring.go builders and eliminate ContextManager state sync dance

Task #11: Split newAgentSessionWithOptions into focused builders
- wiring_otel.go: initOtel + wrapProviderWithOtel (extracted inline provider wrapping)
- wiring_mcp.go: initMCP (moved to its own file)
- wiring_prompt.go: buildSystemPrompt + buildMainPrompt (extracted inline prompt layers,
  memory enrichment, guidelines, directive injection, and quick-ref assembly)
- wiring.go slimmed from 396 to ~210 lines; removed dead layers.Skills assignment
  (was set after prompts.Build, never read)

Task #12: Complete ContextManager extraction — eliminate state sync dance
- Added State *LoopState pointer to ContextManager; compaction methods now read/write
  mutable state (Messages, PreviousSummary, token counts, compaction tracking) directly
  through the pointer instead of copy-in/copy-out
- Removed 9 duplicate state fields from ContextManager (Messages, PreviousSummary,
  LastPromptTokens, LastCachedPromptTokens, IneffectiveCompactions, LastCompactionTokens,
  CompactionBudgetMultiplier, CompactionSavingsHistory, CompactionForcedByOverflow)
- Eliminated 19-line sync dance in Loop.compactContext and 3-line dance in Loop.trimContext
- Removed redundant CtxMgr.Messages assignments in loop.go, tools.go, turn.go
  (now no-ops since CtxMgr.State points to Loop.State)
- ctxMgr() lazily sets State = &l.State when nil (backward compatible with tests)

* Address PR #174 review: OTel env flag, memoryGuidelines scope, budget multiplier init

- wiring_otel.go: evaluate YAAH_OTEL_ENABLED before the early return so
  the env flag can enable OTel when config disables it (pre-existing bug)
- wiring_prompt.go: move memoryGuidelines from package-level const into
  buildSystemPrompt function scope (no globals per AGENTS.md)
- lifecycle_init.go: initialize CompactionBudgetMultiplier=1.0 in ctxMgr()
  lazy path so Loop.Compact has a nonzero preservation budget before
  applyDefaults() runs

* docs: remove completed plans and implemented ADRs

Delete plan files for fully-implemented features (max iterations
dialog, TUI-MCP bridge, quiet mode, task pane separation) and the four
ADRs (engine-view separation, middleware pipeline, functional options,
event-driven architecture) whose content is now covered by
docs/architecture.md.

Update doc references across CONTRIBUTING.md, architecture.md, and
code-organization.md to point at architecture.md in place of the
retired ADRs, and fix stale file paths to reflect the recent runner
refactor (cmd/yaah/subagent_runner.go -> internal/agent/runner/).

* Delete implemented ADRs and plan docs, fix stale references

- Deleted 4 implemented ADRs (0001-0004: engine-view separation, middleware
  pipeline, functional options, event-driven architecture) — all Accepted
  and fully implemented; content covered by architecture.md
- Deleted 5 implemented plan docs from .agents/plans/ (tui-mcp-bridge #159,
  tui-quiet-mode #159, tui2-task-pane-separation #160, max-iterations-dialog,
  web-ui-commands #162) — all features shipped
- Updated docs/adr/README.md and CONTRIBUTING.md to remove dead ADR links
- Fixed stale references to cmd/yaah/subagent_runner.go in architecture.md,
  PROMPT-INJECTION.md, and code-organization.md (now internal/agent/runner)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant