Skip to content

feat: subagent tool, undo system, history compaction, TUI shortcuts#3

Open
OrionArch wants to merge 1 commit into
Planckbaka:mainfrom
OrionArch:feat/subagent-undo-compact-shortcuts
Open

feat: subagent tool, undo system, history compaction, TUI shortcuts#3
OrionArch wants to merge 1 commit into
Planckbaka:mainfrom
OrionArch:feat/subagent-undo-compact-shortcuts

Conversation

@OrionArch
Copy link
Copy Markdown

Summary

  • Subagent tool: New subagent_run tool for spawning stateless sub-agents that execute tasks in parallel within their own context window
  • Undo system: UndoHistoryManager with /undo command for multi-turn file edit rollback
  • History compaction: CompactActiveSession with /compact command to summarize older rounds and reclaim context window space
  • CompactHistory hook: Wired across all LLM adapters (Anthropic, OpenAI, Genkit)
  • TUI prefix shortcuts: ! (shell run), # (memory save), & (background run)
  • /skill command: List and inspect registered skills from ~/.iroha/skills/
  • Tests: Integration tests for compaction, unit tests for subagent handler and undo manager

Changed files (14 files, +833 / -20)

Core

  • pkg/agent/runner.go — undo manager, compact history hook, session_id context injection
  • pkg/agent/session_store.goCompactActiveSession implementation
  • pkg/agent/pool.go — refactored ExecuteMessageInDir, dynamic model getter hooks
  • pkg/agent/tools.go — registered subagent_run tool
  • pkg/agent/auto_review.go — added subagent_run to low-risk tool classification

New files

  • pkg/agent/tools_subagent.go — subagent spawn and execute handler
  • pkg/agent/tools_subagent_test.go — unit tests for subagent
  • pkg/agent/undo_test.go — unit tests for undo manager
  • pkg/agent/compaction_integration_test.go — integration tests for compaction

LLM adapters

  • pkg/llm/adapter.go — added CompactHistory to AdapterHooks interface
  • pkg/llm/anthropic.go, openai.go, genkit_adapter.go — call CompactHistory before message conversion

TUI

  • pkg/tui/update_keys.go — prefix shortcuts (!, #, &) and slash commands (/compact, /undo, /skill)

Test plan

  • go test ./pkg/agent/... — all existing and new tests pass
  • go test ./pkg/llm/... — retry and adapter tests pass
  • Manual TUI testing of !echo hello, #prefer dark mode, &npm run build, /compact, /undo, /skill
  • Verify subagent spawns correctly and returns summary

🤖 Generated with Claude Code

…rtcuts

- Add subagent_run tool for spawning stateless sub-agents in parallel
- Implement UndoHistoryManager for multi-turn file edit rollback with /undo command
- Add CompactActiveSession for session history compaction with /compact command
- Wire CompactHistory hook across all LLM adapters (Anthropic, OpenAI, Genkit)
- Add TUI prefix shortcuts: ! (shell), # (memory), & (background)
- Add /skill slash command to list and inspect registered skills
- Add integration and unit tests for compaction, subagent, and undo

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant