From a4bc171c435216fe80e8793ff32d8583a24781e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 May 2026 14:15:26 +0000 Subject: [PATCH 1/4] Initial plan From 1d2968c53534de38f34e117b658c29fb620a322a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 May 2026 14:21:34 +0000 Subject: [PATCH 2/4] Add agent design loop proposal docs --- Terminal.Gui/Drivers/IDriver.cs | 12 +++++-- docfx/docs/agent-design-loop.md | 63 +++++++++++++++++++++++++++++++++ docfx/docs/index.md | 2 +- docfx/docs/toc.yml | 3 +- 4 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 docfx/docs/agent-design-loop.md diff --git a/Terminal.Gui/Drivers/IDriver.cs b/Terminal.Gui/Drivers/IDriver.cs index 4558cb4405..b6aa2aa56c 100644 --- a/Terminal.Gui/Drivers/IDriver.cs +++ b/Terminal.Gui/Drivers/IDriver.cs @@ -349,15 +349,21 @@ public interface IDriver : IDisposable ConcurrentQueue GetSixels (); /// - /// Gets a string representation of . + /// Gets a full-grid textual representation of . /// + /// + /// This returns the complete current screen grid and is suitable for deterministic snapshot/golden comparisons. + /// /// public string ToString (); /// - /// Gets an ANSI escape sequence representation of . This is the - /// same output as would be written to the terminal to recreate the current screen contents. + /// Gets an ANSI escape sequence representation of for terminal output. /// + /// + /// This output is intended for terminal replay and may include incremental escape-sequence behavior. + /// Prefer as the canonical source for snapshot/golden assertions. + /// /// public string ToAnsi (); diff --git a/docfx/docs/agent-design-loop.md b/docfx/docs/agent-design-loop.md new file mode 100644 index 0000000000..f7987d2199 --- /dev/null +++ b/docfx/docs/agent-design-loop.md @@ -0,0 +1,63 @@ +# Agent Design Loop (Proposal) + +This proposal adapts the WinUI plugin model ([microsoft/win-dev-skills](https://github.com/microsoft/win-dev-skills)) for the `gui-cs` ecosystem and incorporates the design-loop concept from [tig/winprint#73](https://github.com/tig/winprint/issues/73). + +## Problem + +AI agents can generate Terminal.Gui views, but they need a fast, reliable way to **see** what was rendered and share it with humans in chat-first workflows. + +## Proposed End State + +Create a new `gui-cs` repository (working name: `gui-cs/tui-dev-skills`) that provides a Copilot/Claude/Codex plugin with a focused TUI agent and skills. + +### Suggested repository layout + +```text +.github/plugin/ marketplace metadata +plugins/tui/ plugin manifest + agents/tui-dev/ orchestrator agent + skills/ focused skills +src/tools/ helper CLIs used by skills +``` + +### Suggested skill set + +- `tui-setup` - install/verify prerequisites for Terminal.Gui, `dotnet`, and `tuirec` +- `tui-design` - headless render + iterative layout refinement +- `tui-dev-workflow` - scaffold/build/run/fix inner-loop workflow +- `tui-snapshot` - capture/compare golden screen snapshots +- `tui-record` - produce GIF/video evidence using `tuirec` +- `tui-code-review` - TUI-specific review pass before commit +- `tui-session-report` - summarize what happened in an agent session + +## Design-loop contract across repos + +The design loop should be first-class and consistent: + +1. Agent edits view code +2. Agent renders offscreen in a deterministic terminal size +3. Agent captures the **full text grid** +4. Agent optionally rasterizes to PNG/GIF for human review +5. Accepted grid becomes a golden snapshot artifact + +## Required enhancements by repo + +### Terminal.Gui (this repo) + +- Preserve and document that `IDriver.ToString ()` is the canonical full-grid capture for snapshots/design review. +- Preserve and document that `IDriver.ToAnsi ()` is terminal-output-oriented and should not be used as the golden snapshot source. +- Keep headless rendering deterministic (fixed size + stable frame capture). + +### gui-cs/tuirec + +- Add a still-image/snapshot mode aligned with the same full-grid-first contract. +- Keep GIF/video record paths and snapshot paths compatible in keystroke scripting. + +### gui-cs/cli + +- Add commands that expose the loop as one-step workflows (build/run/render/snapshot/report). +- Emit structured outputs suitable for agent consumption. + +## Why this matters + +This turns TUI design review into a tight human+agent loop while simultaneously producing regression artifacts. The same render used for design feedback can be reused in CI snapshot tests. diff --git a/docfx/docs/index.md b/docfx/docs/index.md index 2b75a6b2ff..464bb6e44b 100644 --- a/docfx/docs/index.md +++ b/docfx/docs/index.md @@ -19,6 +19,7 @@ Welcome to the Terminal.Gui documentation! This comprehensive guide covers every ## Deep Dives - [ANSI Handling](~/docs/ansihandling.md) - Terminal escape sequence parsing, encoding, and state management +- [Agent Design Loop (Proposal)](~/docs/agent-design-loop.md) - Design for a gui-cs plugin-powered human+agent TUI co-design workflow - [Application](~/docs/application.md) - Application lifecycle, initialization, and main loop - [Arrangement](~/docs/arrangement.md) - View arrangement and positioning strategies - [Borders](~/docs/borders.md) - Border rendering, tab headers, LineCanvas auto-join, and focus-aware styling @@ -50,4 +51,3 @@ Welcome to the Terminal.Gui documentation! This comprehensive guide covers every ## API Reference For detailed API documentation, see the [API Reference](~/api/Terminal.Gui.ViewBase.yml). - diff --git a/docfx/docs/toc.yml b/docfx/docs/toc.yml index 84df95b59c..0dccf089a4 100644 --- a/docfx/docs/toc.yml +++ b/docfx/docs/toc.yml @@ -14,6 +14,8 @@ href: views.md - name: ANSI Handling href: ansihandling.md +- name: Agent Design Loop (Proposal) + href: agent-design-loop.md - name: Application href: application.md - name: Arrangement @@ -70,4 +72,3 @@ href: treeview.md - name: View href: View.md - From b3725a15a8970cce407209a391bb74493e012ad3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 May 2026 14:54:42 +0000 Subject: [PATCH 3/4] Add self-improvement feedback loop to agent design proposal --- docfx/docs/agent-design-loop.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docfx/docs/agent-design-loop.md b/docfx/docs/agent-design-loop.md index f7987d2199..1d4426c778 100644 --- a/docfx/docs/agent-design-loop.md +++ b/docfx/docs/agent-design-loop.md @@ -28,7 +28,7 @@ src/tools/ helper CLIs used by skills - `tui-snapshot` - capture/compare golden screen snapshots - `tui-record` - produce GIF/video evidence using `tuirec` - `tui-code-review` - TUI-specific review pass before commit -- `tui-session-report` - summarize what happened in an agent session +- `tui-session-report` - summarize what happened in an agent session, including what the agent learned ## Design-loop contract across repos @@ -40,6 +40,16 @@ The design loop should be first-class and consistent: 4. Agent optionally rasterizes to PNG/GIF for human review 5. Accepted grid becomes a golden snapshot artifact +## Self-improvement feedback loop + +The plugin should include a built-in path for agents to improve guidance over time: + +1. `tui-session-report` emits a structured "lessons learned" block (failures, recovery steps, missing docs, tool friction). +2. A dedupe step computes a stable fingerprint so repeated sessions with the same lesson do not create duplicates. +3. Only high-signal lessons open issues in the plugin repo (for example: seen in multiple sessions or marked as blocking). +4. Issue creation is rate-limited (for example: max N auto-filed issues per day) and labels items as `agent-feedback`. +5. Each issue links evidence (session id, logs/snapshots, repro steps) and a concrete proposed guidance/tooling update. + ## Required enhancements by repo ### Terminal.Gui (this repo) From 5138375585945a7bb1f92a9ef63607b7da1079c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 May 2026 17:48:35 +0000 Subject: [PATCH 4/4] Broaden design-loop proposal to full Terminal.Gui apps --- docfx/docs/agent-design-loop.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docfx/docs/agent-design-loop.md b/docfx/docs/agent-design-loop.md index 1d4426c778..f3b14f3fc9 100644 --- a/docfx/docs/agent-design-loop.md +++ b/docfx/docs/agent-design-loop.md @@ -4,7 +4,7 @@ This proposal adapts the WinUI plugin model ([microsoft/win-dev-skills](https:// ## Problem -AI agents can generate Terminal.Gui views, but they need a fast, reliable way to **see** what was rendered and share it with humans in chat-first workflows. +AI agents can generate Terminal.Gui apps, but they need a fast, reliable way to **see** what was rendered and share it with humans in chat-first workflows. ## Proposed End State @@ -23,7 +23,7 @@ src/tools/ helper CLIs used by skills ### Suggested skill set - `tui-setup` - install/verify prerequisites for Terminal.Gui, `dotnet`, and `tuirec` -- `tui-design` - headless render + iterative layout refinement +- `tui-design` - headless render + iterative app UX/layout refinement - `tui-dev-workflow` - scaffold/build/run/fix inner-loop workflow - `tui-snapshot` - capture/compare golden screen snapshots - `tui-record` - produce GIF/video evidence using `tuirec` @@ -34,12 +34,20 @@ src/tools/ helper CLIs used by skills The design loop should be first-class and consistent: -1. Agent edits view code +1. Agent edits app code (views, state, commands, and workflows) 2. Agent renders offscreen in a deterministic terminal size 3. Agent captures the **full text grid** 4. Agent optionally rasterizes to PNG/GIF for human review 5. Accepted grid becomes a golden snapshot artifact +## Scope and rollout + +The proposal should target full Terminal.Gui app development as the first milestone. + +1. **Phase 1 (now):** deeply optimize for Terminal.Gui app authoring and review. +2. **Phase 2:** generalize the same design-loop contracts to other .NET TUI frameworks. +3. **Phase 3:** extend the plugin model to non-.NET TUI frameworks where the same artifacts/contracts apply. + ## Self-improvement feedback loop The plugin should include a built-in path for agents to improve guidance over time: