Commit 8255191

mo khan <mo@mokhan.ca>
2026-01-29 22:21:40
chore: add user stories for improving UX
1 parent 7532d36
.elelem/backlog/015-consistent-terminal-spacing.md
@@ -0,0 +1,33 @@
+As a `user`, I `want consistent blank line spacing in terminal output`, so that `the interface feels polished and predictable`.
+
+# SYNOPSIS
+
+Audit and standardize blank lines between all terminal output sections.
+
+# DESCRIPTION
+
+Currently, the number of blank lines between sections varies depending on the
+order of events during a session. Sometimes there are 2 blank lines, sometimes
+1, leading to an inconsistent visual experience.
+
+This story involves:
+1. Auditing all places that write to the terminal
+2. Establishing spacing rules (e.g., 1 blank line between sections)
+3. Ensuring consistent application of those rules
+
+# SEE ALSO
+
+* [ ] lib/elelem/terminal.rb - Primary output methods
+* [ ] lib/elelem/agent.rb - May have direct output calls
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] Single blank line between distinct output sections
+* [ ] No double blank lines appear in any scenario
+* [ ] No missing blank lines between sections
+* [ ] Spacing is consistent regardless of event order
+* [ ] Visual audit of common workflows passes
.elelem/backlog/016-tool-header-wrapping.md
@@ -0,0 +1,49 @@
+As a `user`, I `want tool headers to handle long parameters gracefully`, so that `the output remains readable without ugly line wrapping`.
+
+# SYNOPSIS
+
+Truncate or format tool header parameters to prevent multi-line wrapping.
+
+# DESCRIPTION
+
+When tools are invoked with long parameters (e.g., long file paths, large
+content), the header line wraps awkwardly across multiple lines, making
+the output hard to read.
+
+Options to consider:
+1. Truncate parameters with ellipsis (e.g., `content: "Lorem ipsum..."`)
+2. Show only parameter names, not values
+3. Limit total header width to terminal width
+4. Multi-line but intentionally formatted (key: value on separate lines)
+
+# SEE ALSO
+
+* [ ] lib/elelem/toolbox.rb - `header` method
+* [ ] lib/elelem/terminal.rb - Output formatting
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] Tool headers never wrap unintentionally
+* [ ] Long string parameters are truncated with ellipsis
+* [ ] Parameter preview length is configurable or sensible default
+* [ ] Full parameters still visible in verbose/debug mode if needed
+* [ ] Headers remain informative (user knows what tool is running)
+
+## Examples
+
+| Actual (current) | Expected (new) |
+|------------------|----------------|
+| `+ execute({"command" => "bin/test"})` | `+ execute(bin/test)` |
+| `+ interview({"question" => "Excellent! So the priority order is..."})` (multi-line) | `+ interview("Excellent! So the priority order is..."...)` |
+| `+ write("README.md", "Hello world, this is my very long paragraph.")` | `+ write("README.md", "Hello world, this is"...)` |
+
+**Rules:**
+1. Strip hash syntax (`{"key" => value}`) - show values directly
+2. For single-param tools, show value without key name
+3. Truncate strings at ~50 chars with `...`
+4. For multi-param tools: `+ tool(param1, param2, ...)`
+5. File paths: show full path (usually short enough)
.elelem/backlog/017-pager-integration.md
@@ -0,0 +1,63 @@
+As a `user`, I `want long output paged without losing scrollback`, so that `I can control reading pace AND copy full context from tmux later`.
+
+# SYNOPSIS
+
+Pipe output through `glow` for markdown rendering, then to a pager that preserves terminal scrollback.
+
+# DESCRIPTION
+
+When agent output is long, the user needs to control reading pace (pager behavior)
+but also needs the full output preserved in terminal scrollback for later reference
+(e.g., copying from tmux buffer, scrolling up to review earlier output).
+
+## Flow
+
+1. Agent starts streaming response
+2. Output piped through `glow` (markdown rendering)
+3. Rendered output piped to `less -RX` or `glow -p`
+4. User reads with pager controls (j/k, space, etc.)
+5. User quits pager (q)
+6. **Full rendered output remains in terminal scrollback**
+7. Next section/prompt appears below
+8. User can scroll up in terminal/tmux and see everything
+
+## Key Insight
+
+Standard `less` uses "alternate screen" which hides output on exit.
+The `-X` flag disables this, preserving output in scrollback.
+
+Recommended pager: `less -RXF`
+- `-R`: Preserve ANSI colors
+- `-X`: Don't use alternate screen (preserve scrollback)
+- `-F`: Quit immediately if content fits on screen
+
+Or: `glow -p` (glow's built-in pager, need to verify scrollback behavior)
+
+## Trigger
+
+Pager activates when output exceeds terminal height.
+
+# SEE ALSO
+
+* [ ] lib/elelem/terminal.rb - Output methods
+* [ ] `$PAGER` environment variable
+* [ ] `IO.console.winsize` for terminal dimensions
+* [ ] `glow` - Markdown rendering CLI
+* [ ] `less -RXF` - Pager that preserves scrollback
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] Long output pauses for reading (pager behavior)
+* [ ] After quitting pager, full output visible in terminal scrollback
+* [ ] tmux `capture-pane -p -S -` captures all previous output
+* [ ] Markdown rendered via `glow` before paging
+* [ ] ANSI colors preserved
+* [ ] Short output prints directly (no pager overhead)
+* [ ] Works correctly when stdout is not a TTY (no pager)
+* [ ] Default pager: `less -RXF` (preserves scrollback)
+* [ ] User can override with `$PAGER` (but should include `-X` equivalent)
+* [ ] User can disable paging entirely via config
.elelem/backlog/018-slash-commands-everywhere.md
@@ -0,0 +1,44 @@
+As a `user`, I `want slash commands available at any prompt`, so that `I can use /shell or other commands when the agent asks me a question`.
+
+# SYNOPSIS
+
+Enable slash command processing at every `Terminal#ask` call, not just the main REPL.
+
+# DESCRIPTION
+
+Currently, slash commands like `/shell` only work at the main agent prompt.
+When the agent asks a question (e.g., via the interview tool), the user
+cannot access these commands.
+
+Example scenario:
+1. Agent asks: "Should I commit this to git?"
+2. User types `/shell`
+3. User drops into shell, runs `git commit -m "fix bug"`, exits
+4. Shell history/output is captured and returned as the answer
+5. Agent knows the user committed the changes
+
+Behavior:
+- All `Terminal#ask` calls should process slash commands
+- `/shell` captures command history and output from the subshell
+- Result is returned as the "answer" to the prompt
+- Other commands (`/help`, `/context`, etc.) work contextually
+
+# SEE ALSO
+
+* [ ] lib/elelem/terminal.rb - `ask` method
+* [ ] lib/elelem/commands.rb - Slash command registry
+* [ ] lib/elelem/agent.rb - REPL command processing
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] Slash commands recognized at any `Terminal#ask` prompt
+* [ ] `/shell` drops user into interactive shell
+* [ ] Shell session output/history captured on exit
+* [ ] Captured output returned as the prompt answer
+* [ ] `/help` shows available commands at any prompt
+* [ ] Tab completion works for slash commands at any prompt
+* [ ] Regular text input still works normally
.elelem/backlog/019-interruptibility.md
@@ -0,0 +1,42 @@
+As a `user`, I `want to interrupt the agent with CTRL+C`, so that `I can stop and redirect when the agent goes off track`.
+
+# SYNOPSIS
+
+CTRL+C stops generation, discards partial response, returns to fresh prompt.
+
+# DESCRIPTION
+
+When the agent is generating a response or executing tools, the user may
+realize it's going in the wrong direction. Currently, interruption behavior
+may be inconsistent or leave the conversation in an awkward state.
+
+Desired behavior:
+1. User presses CTRL+C during agent response
+2. Generation stops immediately
+3. Partial response is discarded (not added to context)
+4. User returns to a fresh prompt
+5. User can then redirect, edit context, or continue
+
+This pairs well with context editing (story 020) - after interrupting,
+the user may want to prune context before continuing.
+
+# SEE ALSO
+
+* [ ] lib/elelem/agent.rb - Response handling, REPL
+* [ ] lib/elelem/conversation.rb - Context management
+* [ ] Signal handling for SIGINT
+* [ ] .elelem/backlog/020-context-editing.md - Related feature
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] CTRL+C stops agent response immediately
+* [ ] Partial response is not added to conversation context
+* [ ] User returns to fresh prompt after interrupt
+* [ ] Tool execution in progress is cancelled cleanly
+* [ ] No orphaned processes or broken state after interrupt
+* [ ] Multiple rapid CTRL+C presses handled gracefully
+* [ ] Clear visual indication that response was interrupted
.elelem/backlog/020-persistent-prompt.md
@@ -0,0 +1,41 @@
+As a `user`, I `want a persistent prompt showing current state`, so that `I always know the agent is ready for input`.
+
+# SYNOPSIS
+
+Always-visible prompt indicator showing mode and readiness state.
+
+# DESCRIPTION
+
+During long operations or after scrolling output, it can be unclear whether
+the agent is ready for input. A persistent or always-visible prompt helps
+orient the user.
+
+Possible approaches:
+1. Status line at bottom of terminal (like vim/tmux)
+2. Clear prompt redraw after all output
+3. Spinner/indicator that transitions to prompt when ready
+
+Information to show:
+- Current mode (plan/design/build/review/verify)
+- Ready state (waiting for input vs. processing)
+- Token usage or cost (optional)
+- Current branch or project context (optional)
+
+# SEE ALSO
+
+* [ ] lib/elelem/terminal.rb - Prompt rendering
+* [ ] lib/elelem/agent.rb - State management
+* [ ] ANSI escape sequences for cursor positioning
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] Prompt always visible or redrawn after output
+* [ ] Current mode displayed in prompt
+* [ ] Clear visual distinction between ready and processing states
+* [ ] Prompt survives terminal resize
+* [ ] Works correctly with pager integration (story 017)
+* [ ] No visual glitches during rapid output
.elelem/backlog/021-context-editing.md
@@ -0,0 +1,56 @@
+As a `user`, I `want to view, delete, and edit context entries`, so that `I can manually prune or summarize the conversation`.
+
+# SYNOPSIS
+
+`/context` command to list, delete, and edit conversation entries.
+
+# DESCRIPTION
+
+As conversations grow, the context can become bloated with irrelevant
+entries or verbose tool output. The user should be able to:
+
+1. **View** context as a numbered list with role and preview
+2. **Delete** entries interactively or by number
+3. **Edit** a single entry in `$EDITOR`
+
+Example session:
+```
+> /context
+1. [system] You are a developer... (245 tokens)
+2. [user] Fix the login bug
+3. [assistant] I'll look at auth.rb... (89 tokens)
+4. [tool] read auth.rb → 450 lines (1200 tokens)
+5. [assistant] The issue is on line 42... (156 tokens)
+
+> /context delete
+  [ ] 1. [system] You are a developer...
+  [x] 4. [tool] read auth.rb → 450 lines
+  
+Deleted 1 entry.
+
+> /context edit 3
+# Opens entry 3 in $EDITOR, saves changes back to context
+```
+
+# SEE ALSO
+
+* [ ] lib/elelem/conversation.rb - Context storage
+* [ ] lib/elelem/commands.rb - Slash command registry
+* [ ] .elelem/backlog/009-enhanced-interview-tool.md - Multi-select UI
+* [ ] .elelem/backlog/019-interruptibility.md - Related workflow
+
+# Tasks
+
+* [ ] TBD (filled in design mode)
+
+# Acceptance Criteria
+
+* [ ] `/context` shows numbered list with role and preview
+* [ ] Each entry shows approximate token count
+* [ ] `/context delete` opens interactive multi-select
+* [ ] `/context delete 3,4,5` deletes by number
+* [ ] `/context edit N` opens entry N in `$EDITOR`
+* [ ] Edited content replaces original entry
+* [ ] Empty edit (delete all content) removes the entry
+* [ ] System prompt (entry 1) protected from deletion
+* [ ] Changes reflected immediately in conversation