feat: TUI fixes, background process improvements, skill management - #6
Merged
Conversation
added 24 commits
July 13, 2026 21:46
- Add grep and glob tools to identity.md capabilities - Add codebase search guidance section - Update README with agent loop safety features (compaction, loop detection, truncation safety) - Fix glob ripgrep invocation (remove broken exclusion args)
- Edit tool: multi-edit (edits[] array), 4-strategy fuzzy matching fallback (trailing WS, smart quotes, Unicode dashes, whitespace collapse), diff display with before/after line counts - New ls tool: directory listing with tree formatting and depth control - New question tool: structured interactive user prompts with options - Per-tool approval gates: config.approval wired to bash/powershell/write/ edit/delete (allow/ask/deny modes) - Todo persistence: SQLite-backed via memory.DB, survives session restarts - Todo priority levels: high/medium/low with formatted display - Updated identity, AGENTS, and README docs for all new capabilities
- webfetch tool: URL fetch with HTML-to-text conversion, 2 MiB cap, 30s timeout - background_process tool: start/list/status/logs/stop/restart with 200 KB rolling output buffer per process, cross-platform shell support - task tool: sub-agent spawning with restricted tools (no memory, todo, or nested tasks), 5-minute timeout, max 25 iterations - Follow-up queue: FollowUps channel for queuing messages between iterations - Steering: Steer channel for high-priority mid-turn message injection - Process manager in internal/process/ with concurrent-safe lifecycle - Updated identity, AGENTS, and README docs
When renderTree encounters a line with no tree-drawing prefix characters (such as '(empty directory)' from the ls tool), treeDepth returns 0 which empties the node stack, causing stack[-1] panic. Clamp depth to minimum 1 so the root node always remains as parent.
- Add question modal with rounded border rendering in the TUI View - Wire QuestionTool.Handler in runAgentForTUI via AgentMsg channel - Questions display sequentially: type answer in input, press Enter to advance - Accumulate answers per question and send back via channel on completion - Escape cancels question answering - Fall back to default stdin handler for REPL mode - Fix renderTree depth=0 panic guard (minimum depth 1)
Moving handler setup from runAgentForTUI to runTUI ensures the handler is configured before the first prompt is submitted. The handler closure captures agentCh which is also created during TUI startup.
Handler now returns immediately with placeholder answers instead of blocking on respCh. This tests whether the message delivery from handler to TUI via agentCh works — if the question modal appears in the TUI, the channel forwarding is correct and the issue is in the response path. If the modal does NOT appear, the issue is in TUI message processing.
Handler now uses select with timeout instead of blocking channel receive. If TUI responds within 30 seconds, real answer is returned. Otherwise placeholder '(no response)' is returned. This eliminates the deadlock while still allowing interactive answers when the TUI message path works.
The TUI question modal approach required bubbletea p.Send() to deliver messages cross-goroutine, which failed (the question tool always timed out with '(no response)'). Simplified: remove all TUI question UI code and let the default stdin/stderr handler work everywhere. The question tool prints to stderr and reads from stdin, which works in both REPL and TUI modes.
Bubbletea owns stdin in TUI mode, so os.Stdin reads block forever. Set a handler that prints the question to stderr for visibility and returns '(please answer in chat)' immediately. The model will re-ask the question in plain text via the chat, and the user answers in the TUI input field.
Instead of '(please answer in chat)', return the full question text so the model can render the questions in the TUI chat area. The model will display them and ask the user to respond in the input field.
…l results verbatim The model was summarizing question output instead of displaying it to the user. Updated identity.md to explicitly require verbatim display of all options and ask the user to type choices in their next message.
The TUI question modal approach was fundamentally incompatible with bubbletea's stdin ownership. Removed all TUI question-specific code and restored the identity prompt. The question tool works via the default stdin/stderr handler in CLI (REPL) mode.
… UX improvements - Register TaskTool and BackgroundProcessTool in TUI startup (were only in REPL path) - Fix process manager deadlock: appendLog called while holding info.mu (sync.Mutex not reentrant) - Fix cmd.Wait() race: wait for pipe reads to complete before calling Wait (per Go docs) - Fix restart action: skip stop step if process is not running - Render streaming content through renderMarkdown instead of raw chatWrap - Render task tool results as markdown with sub-agent indication (description from args) - Add runtime environment context (OS/arch/shell) to system prompt - Add line break after table in renderMarkdown output - Wrap thinking/reasoning text to viewport width - Remove ctrl+y copy-as-md functionality
- Add skills.Create() to write new SKILL.md files with frontmatter - Add skills.Edit() to update existing skill description/body - Extend skill tool with 'list', 'create', 'edit' actions (backward-compatible 'load' default) - Add tests for Create, Edit, duplicate rejection, partial updates - Update identity.md with skill management guidance
buchenberg
added a commit
that referenced
this pull request
Aug 4, 2026
…#131) * refactor: complete CtxMgr/Persister/Hooks migration, remove deprecated Loop fields * refactor: decompose Loop struct into LoopConfig + LoopState sub-types (P0 #1) Split the ~70-field Loop struct into: - LoopConfig: 32 immutable config fields (Model, MaxIterations, ContextWindow, etc.) - LoopState: 14 mutable runtime fields (Messages, TotalTokens, etc.) - Loop: ~28 dependency/internals (Provider, Registry, CtxMgr, Persister, etc.) Renamed options.LoopConfig -> AgentConfig and WithLoopConfig -> WithAgentConfig to avoid collision with the new LoopConfig sub-struct type. Addresses ARCHITECTURE-REVIEW.md P0 #1 'Refactor Loop struct into composed types.' * refactor: decompose runMiddleware into logical helpers (P0 #2) Extracted 7 focused methods from the ~320-line runMiddleware: - publishDone / teardown: deferred cleanup (broker, persister, hooks) - initMessages: conversation initialization and session-start hooks - buildTurnRequest: PrepareStep middleware + request construction + MaxTurns - guardContextBeforeCall: pre-flight compaction + payload guard - recordTurnSpanAttrs: OTel span attribute population - executeToolPhase: tool truncation, execution, conflict detection, PostTool runMiddleware reduced from ~320 lines to ~180 lines with clear delegation. * refactor: clarify turn vs iteration naming (P1 #4) Renamed across all packages: - MaxIterations -> MaxLoopCycles (hard limit on total loop cycles) - MaxTurns -> MaxToolTurns (when tools are stripped) - WrapUpAhead -> WrapUpThreshold (wrap-up notice threshold) - WrapUpTurns -> WrapUpThreshold (config yaml alias) - injectWrapUp -> injectWrapUpNotice YAML tags preserved for backward compat ('max_iterations', 'max_turns', 'wrap_up_turns' remain unchanged). Touches: agent, config, pipeline, tools, subagent, cmd/yaah packages. * docs: update ARCHITECTURE-REVIEW with implementation status * fix: gofmt cmd/yaah/agent_frame.go
buchenberg
added a commit
that referenced
this pull request
Aug 7, 2026
…anup - Thread pane width through renderMarkdown via GetInnerRect().Dx() instead of hard-coded 80 columns (CodeRabbit #6) - Update architecture review: tui2 markdown entry now says tviewmd instead of glamour (#4), model-picker wiring is partial not missing (#5) - Add language identifiers to unlabeled code fences in plan (#markdownlint) - Phase 1 text already replaced by checkmarked completion in amended commit
buchenberg
added a commit
that referenced
this pull request
Aug 7, 2026
* feat: extract tviewmd markdown renderer and wire into tui2 Replace glamour+TranslateANSI in tui2 with native tview color-tag rendering via the published github.com/buchenberg/tviewmd module (v0.1.0). The tviewmd module (14 files, MIT) provides: - CommonMark + GFM parsing via goldmark - chroma syntax highlighting for fenced code blocks - tview color-tag backend (no ANSI round-trip) - 23 tests + fuzz (315k+ executions, zero panics) Adds architecture review (docs/architecture-review.md) and implementation plan (.agents/plans/tui2-hardening/PLAN.md). * feat: extract tviewmd markdown renderer and wire into tui2 Replace glamour+TranslateANSI in tui2 with native tview color-tag rendering via the published github.com/buchenberg/tviewmd module (v0.1.0). The tviewmd module (14 files, MIT) provides: - CommonMark + GFM parsing via goldmark - chroma syntax highlighting for fenced code blocks - tview color-tag backend (no ANSI round-trip) - 23 tests + fuzz (315k+ executions, zero panics) Adds architecture review (docs/architecture-review.md) and implementation plan (.agents/plans/tui2-hardening/PLAN.md). * fix: address PR review — dynamic markdown width, stale docs, plan cleanup - Thread pane width through renderMarkdown via GetInnerRect().Dx() instead of hard-coded 80 columns (CodeRabbit #6) - Update architecture review: tui2 markdown entry now says tviewmd instead of glamour (#4), model-picker wiring is partial not missing (#5) - Add language identifiers to unlabeled code fences in plan (#markdownlint) - Phase 1 text already replaced by checkmarked completion in amended commit * docs(architecture): add deep-dive review of tui2 internals Expand the architecture review with a comprehensive §4 section covering `internal/tui2`'s package topology (~19 subpackages), the flat-factory component pattern, and an analysis of the imperative widget tree model with its strengths (simplicity, zero abstraction overhead) and weaknesses (no lifecycle standardization, lack of isolation via shared *App). Update the §3 recommendation to reference the new deep-dive section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major batch of fixes and features for the TUI, background process tool, and skill system.
TUI Fixes
Background Process Fixes
Skill Management (New)
System Prompt
Docs