Skip to content

[v0.5] Add terminal pane as a window leaf #49

Description

@owainlewis

Goal: Add an embedded terminal pane that fits the existing window model instead of creating a separate AI subsystem.

Context: The PRD’s agent strategy is composition: a coding agent runs in a real terminal pane and edits files on disk.
This should land only after the split/window model exists, because the pane should be another window leaf drawn into a rectangle.

Proposed approach:

  • Add a terminal content type beside file-buffer windows.
  • Spawn a shell in a PTY with the repo working directory as the default directory.
  • Route input to the PTY when the terminal pane is focused.
  • Render the PTY grid through the same renderer boundary used for editor windows.
  • Resize the PTY when its pane rectangle changes.
  • Add one command to create/open a terminal pane from the current layout.
  • Keep the first pass shell-only; running Claude Code or another agent is just what the user types inside the pane.

Acceptance criteria:

  • A command creates a terminal pane in the current window layout.
  • Focused terminal panes receive typed input and display shell output.
  • Focus can move between file windows and terminal panes.
  • Resizing splits updates the terminal pane size without corrupting the display.
  • Closing the pane cleans up the child process or leaves a clear, intentional process policy.
  • Exiting Cortex restores the outer shell cleanly.
  • Existing file-window editing, saving, splits, tabs, and reload behavior still work.

Verification:

  • Run cargo test.
  • Manually open a terminal pane, run pwd, run a command that prints multiple lines, resize the terminal, focus a file pane, edit/save, and quit.
  • Manually confirm the outer shell is usable after exit.

Out of scope:

  • AI provider integration.
  • Agent protocol APIs.
  • Chat UI.
  • Multiplexer features beyond this editor pane.
  • Scrollback search.
  • Multiple shell profiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfactory-blockedCannot proceed until a named blocker is resolved

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions