Planning:
- Clear stance: no built-in planning mode
- Alternative: write plans to PLAN.md files
- Persists across sessions, can be versioned
- Example provided showing structured approach
Auto-compaction:
- Added alternative: switch to bigger context model (Gemini)
- Can summarize session with larger model mid-session
- Clear stance: no built-in to-dos
- Rationale: they confuse models more than help
- Alternative: stateful TODO.md file with checkboxes
- Simple example provided
- Agent can read/update file as needed
- Check if --system-prompt argument is a valid file path
- Load file contents if it exists, otherwise use as literal text
- Works in both interactive and single-shot modes
- Project context and datetime still appended automatically
- Document in README with examples
- Changed package name from @mariozechner/coding-agent to @mariozechner/pi-coding-agent
- Updated README installation command
- Binary name 'pi' remains the same
- Avoids conflict with existing @mariozechner/pi (pods package)
- State upfront: pi does not support MCP
- Provide minimal working example (README + bash script)
- Show simple usage pattern
- Remove verbose explanations
fix(tui): don't show duplicate URL when link text equals href
- Rename 'Available Tools' to 'Tools' with 'Built-in Tools' subsection
- Add 'MCP & Adding Your Own Tools' section
- Explain bash/code approach vs MCP servers
- Highlight token efficiency and composability benefits
- Link to blog post for detailed examples
- Document unrestricted filesystem and command access
- Explain no permission checks or safety rails
- Warn about prompt injection risks
- Provide mitigation suggestions
- Clear about design philosophy and use at own risk
- Use result.details.diff from tool execution (same as TUI)
- Apply proper color coding for added/removed/context lines
- Remove unused generateDiff function
- Match TUI's diff rendering approach
- Remove statusContainer.clear() from clearEditor()
- Loading animation should only be removed when agent finishes
- Ctrl+C once should only clear editor text, not status
- Context files now appended to system prompt
- Added current date/time to system prompt
- Added current working directory to system prompt
- Date/time and cwd placed at end of system prompt
- Updated README to reflect system prompt integration
- Walk up parent directories to load all AGENT.md/CLAUDE.md files
- Load global context from ~/.pi/agent/AGENT.md or CLAUDE.md
- Load order: global → top-most parent → ... → cwd
- Prefer AGENT.md over CLAUDE.md in each directory
- Each context file injected as separate message
- Updated README with detailed documentation
- Sessions are no longer created immediately on startup
- Session files only created after at least 1 user message and 1 assistant response
- Prevents empty session files when agent is launched and immediately quit
- Messages are queued until session is initialized
- Continue/resume modes properly mark sessions as already initialized
Session reconstruction only needs:
- type: 'session' - session metadata
- type: 'message' - conversation history
- type: 'thinking_level_change' - thinking level changes
- type: 'model_change' - model changes
Events like agent_start/end, tool_execution_start/end are not needed for
session reconstruction and only added bloat. This reduces session file size
significantly and speeds up writes.
- text mode: only outputs final assistant message text (default)
- json mode: streams all events as JSON (same as session manager writes)
- rpc mode: JSON output + listens for JSON input on stdin for headless operation
- Suppress informational messages in json/rpc modes
- Add generateDiffString() function in edit tool to create unified diffs with line numbers and 4 lines of context
- Store only the formatted diff string in tool result details instead of full file contents
- Update tool-execution renderer to parse and colorize the diff string
- Filter out message_update events from session saving to prevent verbose session files
- Add markdown nested list and table rendering tests
**Improved output messages:**
1. File fits within limits: Just outputs content (no notices)
2. Lines get truncated: Shows "Some lines were truncated to 2000 characters for display"
3. File doesn't fit limit: Shows "N more lines not shown. Use offset=X to continue reading"
4. Offset beyond file: Shows "Error: Offset X is beyond end of file (N lines total)"
5. Both truncations: Combines both notices with ". " separator
**Comprehensive test coverage:**
- Files within limits (no notices)
- Large files (line truncation)
- Long lines (character truncation)
- Offset parameter
- Limit parameter
- Offset + limit together
- Invalid offset (out of bounds)
- Combined truncations (both notices)
All 17 tests passing ✓
- Default limit of 2000 lines per read
- Maximum line length of 2000 characters (truncates longer lines)
- Add optional offset and limit parameters for pagination
- Show truncation notice with instruction to continue reading
- Plain text output (no line numbers)
Examples:
- `read path/to/file` - reads first 2000 lines
- `read path/to/file offset=2001` - continues from line 2001
- `read path/to/file limit=100` - reads only 100 lines
This prevents extremely large files from overwhelming context.
Changed export success/error messages to match the style used for thinking level changes:
- Use Spacer(1) instead of empty Text for proper blank line spacing
- Use chalk.dim() for success message instead of chalk.green()
- Add left padding (1, 0) to match other system messages
- Removed checkmark/x symbols for cleaner look
Now "Session exported to: filename.html" appears dimmed with proper spacing, just like "Thinking level: off"
**Header improvements:**
- Changed title from "pi coding-agent session" to "pi v{version}"
- Smaller, more compact header (16px instead of 20px)
- Info items now stack vertically with consistent labels (80px width)
- Reduced padding and spacing for cleaner look
- Labels aligned to left, values aligned to baseline
The header is now much less cramped and easier to read.
**Click-to-expand functionality:**
- Truncated tool outputs are now clickable to show full content
- Works for bash (>5 lines), read (>10 lines), write (>10 lines)
- Displays "... (N more lines) - click to expand" hint in cyan
- Smooth toggle between preview and full output
- Cursor changes to pointer on hover
**System prompt and tools display:**
- Added system prompt section with yellow header on dark brownish background
- Shows all available tools with names and descriptions
- Both sections appear before messages for context
- Subtle yellow/brown theme (rgb(60, 55, 40)) that's not too bright
The HTML export now provides better interactivity for large outputs and gives full context about the agent's configuration.
Complete overhaul of export-html.ts to replicate the TUI renderer's visual design:
**Exact TUI color matching:**
- User messages: rgb(52, 53, 65) dark slate background
- Tool pending: rgb(40, 40, 50) dark blue-gray
- Tool success: rgb(40, 50, 40) dark green
- Tool error: rgb(60, 40, 40) dark red
- Body background: rgb(24, 24, 30) very dark
- Text colors matching chalk: cyan for paths, dimmed gray for output
**Tool formatting (matching ToolExecutionComponent):**
- bash: Bold `$ command`, dimmed output (max 5 lines)
- write: Bold header with cyan path, line count, content preview (max 10 lines)
- read: Bold header with cyan path, content preview (max 10 lines)
- edit: Bold header with cyan path, unified diff with line numbers
- All tools show "... (N more lines)" indicators
**Additional improvements:**
- Use session filename + .html for default output
- Shorten paths with tilde notation (~)
- Replace tabs with 3 spaces
- Monospace font matching terminal aesthetic
- Minimal, clean design with no borders/boxes
- Print-friendly styles
The HTML export now looks identical to the TUI version.
- Add exportSessionToHtml function that generates beautifully formatted HTML exports
- HTML includes session metadata, all messages, tool calls, tool results, thinking blocks, and images
- Support for ANSI color codes in tool output (converted to HTML)
- Self-contained with inline CSS (dark theme, responsive design, print-friendly)
- Add /export slash command to TUI with optional filename parameter
- Add agent and coding-agent to dev script for watch mode
- Increment coding-agent version to 0.6.1
Usage: /export [optional-filename.html]
- Move lit from dependencies to peerDependencies in web-ui to prevent multiple Lit instances being loaded
- Update mini-lit from 0.1.8/0.1.10 to 0.2.0 in root package.json and web-ui/package.json
- Install @tailwindcss/vite in web-ui/example
- Run biome formatting fixes across codebase
This resolves HMR custom element re-registration errors caused by duplicate Lit registries.
- Add NO_IMAGE to error finish reasons in Google provider
- Fix non-null assertion after optional chaining in Anthropic provider
- Migrate biome config to 2.3.5
- Ignore Tailwind CSS file from biome checks
- Bump all packages to version 0.6.0
Tools now resolve with error messages in content blocks rather than
rejecting the promise. This matches the expected behavior where tools
always return a result, with errors indicated in the text content.
- read: Return error content for missing files
- edit: Return error content for missing files, text not found, multiple matches
- bash: Return error content for command failures, timeouts, and aborts
- All tools now include required details field in error results
Tool results now use content blocks and can include both text and images.
All providers (Anthropic, Google, OpenAI Completions, OpenAI Responses)
correctly pass images from tool results to LLMs.
- Update ToolResultMessage type to use content blocks
- Add placeholder text for image-only tool results in Google/Anthropic
- OpenAI providers send tool result + follow-up user message with images
- Fix Anthropic JSON parsing for empty tool arguments
- Add comprehensive tests for image-only and text+image tool results
- Update README with tool result content blocks API
- SessionManager now collects text from all user and assistant messages
- Added allMessagesText field containing concatenated message text
- Search now matches against all messages in a session
- More powerful session discovery (e.g., search "write file" finds any session discussing file writing)
- Add search input at top - filters sessions as you type
- Add scrolling with max 5 visible sessions at a time
- Add scroll indicator showing position (e.g., (3/15))
- Add blank line spacing between session items
- Ctrl+C now exits process (process.exit(0)) instead of canceling
- Escape still cancels and returns to main menu
- Enter in search box selects current session
- Custom SessionList component with 2 lines per item
- First line: message text (bold when selected)
- Second line: metadata (time · message count) in dim
- Blue › cursor for selected item
- Added "Resume Session" header
- Handle Ctrl+C (‹x03›) in SelectList for consistency
- Improved date formatting (38 minutes ago, 8 hours ago, etc.)
- Add SIGINT handler to allow Ctrl+C to exit during session selection
- Remove hardcoded 60-char truncation, let SelectList handle dynamic truncation
- Simplify date format (5m, 2h, 3d instead of "5m ago")
- Make metadata more compact (5msg instead of "5 msgs")
- New SessionSelectorComponent to browse and select sessions
- Lists sessions sorted by last modified date
- Shows first message, created/modified dates, message count
- Automatically truncates long messages and formats dates
- Adds --resume/-r flag to CLI
- Session selector integrates with main flow
Session manager changes:
- Add ThinkingLevelChangeEntry and ModelChangeEntry types
- Add saveThinkingLevelChange() and saveModelChange() methods
- Update loadThinkingLevel() to also check for thinking_level_change events
(not just session headers)
TUI changes:
- Pass SessionManager to TuiRenderer constructor
- Call saveThinkingLevelChange() when user changes thinking level via /thinking
- Store session manager as instance variable for future use
This ensures thinking level changes during a session are persisted
and correctly restored on --continue.
Thinking selector fix:
- Replace hardcoded 50-character borders with DynamicBorder component
that adjusts to viewport width
- Prevents crash when terminal is resized narrow
Text/Markdown rendering fixes:
- Fix Markdown wrapSingleLine to check if adding next character would
exceed width BEFORE adding it (was checking AFTER, causing lines to
be 1 character too long)
- Add word truncation in Text component for words longer than
contentWidth (prevents long unbreakable words from exceeding width)
These fixes prevent "Rendered line exceeds terminal width" errors.
SelectList fixes:
- Use hardcoded visual width for arrow prefix instead of string length
which includes ANSI codes
- Truncate scroll indicator text to prevent exceeding terminal width
- Fixes crash when terminal is resized narrow and arrow keys are pressed
Thinking level fix:
- Restore thinking level even if it's "off" (removed !== "off" check)
- This ensures the thinking level selector shows the correct state on continue