Skip to content

feat(016): kasmos v2.0.0 — Go/bubbletea agent orchestrator TUI#2

Merged
brkastner merged 26 commits intomainfrom
charm
Feb 18, 2026
Merged

feat(016): kasmos v2.0.0 — Go/bubbletea agent orchestrator TUI#2
brkastner merged 26 commits intomainfrom
charm

Conversation

@brkastner
Copy link
Contributor

Summary

Complete rewrite of kasmos from a Rust/Zellij MCP orchestrator to a Go/bubbletea terminal UI for managing concurrent OpenCode agent sessions. This is the full implementation of feature 016 across 13 work packages in 3 waves.

What's New

  • Full-screen TUI built with bubbletea v2 + lipgloss v2, responsive 4-mode layout (tooSmall/narrow/standard/wide)
  • Worker lifecycle: spawn, kill, restart, continue OpenCode sessions with live output streaming
  • Task sources: spec-kitty (YAML frontmatter), GSD (checkbox markdown), ad-hoc manual mode
  • AI helpers: failure analysis and prompt generation via headless OpenCode workers
  • Batch spawn for unassigned tasks with multi-select dialog
  • Session persistence to .kasmos/session.json with debounced atomic writes and --attach resume
  • Daemon mode (-d) with human or NDJSON output, --spawn-all for CI/automation
  • Setup command for dependency validation and agent scaffolding

Implementation

  • 13 work packages across 3 waves, all verified
  • Final review: 41 PASS, 4 WARN, 0 FAIL — all warnings addressed in cleanup commit
  • Test coverage across worker, task, persist, setup, and tui packages
  • README fully rewritten for the new Go architecture

Packages

Package Purpose
cmd/kasmos/ Cobra CLI, flags, setup subcommand
internal/tui/ bubbletea model/update/view, layout, keys, dialogs, daemon
internal/worker/ Backend interface, subprocess (opencode), output buffer
internal/task/ Source interface + spec-kitty, GSD, ad-hoc adapters
internal/persist/ Session snapshot and atomic persistence
internal/setup/ Dependency validation and agent scaffolding

Remove old Rust/Zellij-era specs (011-014). Add TUI design artifacts
(layout, mockups, keybinds, styles) and technical research (interfaces,
schemas, message types, package structure) for the Go/bubbletea rewrite.
…ator

Phase 0+1 planning artifacts:
- plan.md: 3-wave implementation plan (core TUI, task sources, daemon/persistence)
- research.md: consolidated research decisions (6 key decisions with rationale)
- data-model.md: entity definitions, state machines, interface contracts
- quickstart.md: development bootstrap and workflow guide

Updated project memory for Go rewrite:
- constitution.md v2: Go/bubbletea stack, opencode harness, testing standards
- architecture.md: new package structure, worker lifecycle, message flow
- AGENTS.md: Go build commands, updated repository layout
Wave 1 (WP01-06): Core TUI + worker lifecycle
Wave 2 (WP07-11): Task sources + worker management
Wave 3 (WP12-13): Daemon mode + persistence

Each WP references specific tui-technical.md sections and has
clear scope boundaries for independent coder agent sessions.
WP01: go.mod with all deps, cmd/kasmos/main.go with cobra + minimal
bubbletea program, signal handling, alt screen.

WP02: internal/worker/ package - WorkerBackend interface,
SubprocessBackend (os/exec), Worker state machine, OutputBuffer
ring buffer, session ID extraction, WorkerManager with atomic IDs.
Full test suite passes including -race.
internal/tui/ package with 6 files: model.go (Model + Init/Update/View),
layout.go (4 breakpoints, responsive dimension math), styles.go (full
Charm bubblegum palette, gradient title, indicators, badges),
keys.go (26 bindings, ShortHelp/FullHelp, context-dependent states),
messages.go (22 message types for full event catalog),
panels.go (header, empty table, welcome viewport, status bar, help overlay).

Empty dashboard renders matching V11 mockup. Resize, focus cycling,
help toggle all functional.
commands.go: spawnWorkerCmd, readWorkerOutput (goroutine + Send),
waitWorkerCmd, killWorkerCmd tea.Cmd constructors.

overlays.go: spawn dialog with role selector, prompt textarea,
files input. Centered with hot pink border + backdrop.

update.go: full lifecycle dispatch - spawn dialog submit,
workerSpawned/Output/Exited handlers, table selection sync,
viewport auto-follow, spinner and tick refresh.

panels.go: table rows from live workers with spinner status,
viewport shows selected worker output, real status bar counts.

main.go: SubprocessBackend init, NewModel(backend), SetProgram.
- Remove statusBar field mutation in renderStatusBar() (View must be pure)
- Export ExtractSessionID from worker package, delete duplicate in tui/update.go
- Remove unused statusBar field from Model struct
WP05: Continue dialog with parent info, quit confirmation with running
worker count, worker chain tree rendering (├─/└─/│ glyphs), viewport
chain references, updateKeyStates for Continue key.

WP07: Kill running workers (x key, 3s grace SIGTERM→SIGKILL), restart
failed/killed workers (r key, pre-filled spawn dialog).

WP08: internal/task/ package with Source interface, SpecKittySource
(YAML frontmatter parser + dependency resolution), GsdSource (checkbox
markdown), AdHocSource, DetectSourceType, CLI positional arg, full
test suite.

Review fixes: deduplicate TaskState/Task types (TUI now imports from
task package), guard done/in-progress tasks from retroactive blocking,
simplify state transition in workerSpawnedMsg handler.
WP06: Fullscreen viewport mode (f key toggle), auto-follow logic,
vim-style scroll controls (j/k/d/u/G/g), 4-phase key routing
refactor, context-dependent key activation, graceful shutdown
(kill all running workers on quit confirm).

WP10: kasmos setup subcommand with dependency validation (opencode,
git), agent definition scaffolding (.opencode/agents/ with planner,
coder, reviewer, release templates), idempotent file creation,
project root detection, full test suite.
WP09: Real task panel rendering with selection, status badges, and
worker assignment display. Batch spawn dialog with checkbox selection.
Worker-task association on spawn (InProgress) and exit (Done/Failed).
Dependency re-resolution on task completion. Task counts in status bar.

WP11: On-demand AI helpers - failure analysis (a key) spawns headless
reviewer worker to identify root cause + suggest fix. Prompt generation
(g key) spawns headless planner to generate implementation prompts.
Analysis viewport rendering with structured output. Restart with
suggested prompt flow.
…Panel

View purity: remove viewport.SetWidth/SetHeight from renderFullScreen
(redundant with resizeFullScreenViewport in Update), remove
selectedTaskIdx mutation from renderTasksPanel (use local clamped var).
WP12: Headless daemon mode (-d flag) with NDJSON and human-readable
event logging, TTY auto-detection, --spawn-all for batch execution,
auto-exit with aggregate stats, SIGPIPE handling.

WP13: Session persistence to .kasmos/session.json with debounced
atomic writes, --attach flag for session restore, orphan detection
(mark running workers as killed when PID dead), worker counter
reset, output tail preservation (last 200 lines), full test suite.
- Fix NextWorkerNum using manager.Counter() instead of len(workers)+1
- Remove 6 dead message types (tasksLoaded, taskStateChanged, etc.)
- Extract handleAnalysisModeKeys() to deduplicate 3 identical blocks
- Add analysis mode key disabling in updateKeyStates()
- Lower tooSmall layout threshold from 80x24 to 60x15
- Add TUI test suite (model defaults, layout breakpoints, key states, daemon formatting)
- Rewrite README to reflect Go/bubbletea rewrite (was Rust/Zellij)
- Bump version to v2.0.0
@brkastner brkastner merged commit 8d0a947 into main Feb 18, 2026
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