Skip to content

feat: AI Chat with Bedrock #123

@yimsk

Description

@yimsk

Summary

AI Chat using Bedrock Converse API + Tool Use. Query AWS resources with natural language.

Tools (6)

Tool Purpose Implementation
list_services List 69 services Registry
list_resources List resource types Registry
query_resources List resources DAO.List()
get_resource_detail Get resource detail DAO.Get()
tail_logs CloudWatch Logs FilterLogEvents
search_aws_docs AWS documentation AWS Docs API

UI Modes

Overlay Mode (context-aware)

Invoke from any view with keybind. AI knows current context.

┌─────────────────────────────────────────────┐
│ ResourceBrowser (dimmed)                     │
│ ┌─────────────────────────────────────────┐ │
│ │ 💬 AI Chat                         [Esc] │ │
│ │ Context: ec2/instances/i-0abc123        │ │
│ │───────────────────────────────────────── │ │
│ │ You: What is this instance for?         │ │
│ │ AI: This is a web server in prod VPC... │ │
│ │ > [input]                               │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────┘

Fullscreen Mode (:chat)

Dedicated chat view for longer conversations.

Context Awareness

Current View Auto Context
ResourceBrowser service, resource_type, selected item
DetailView full resource detail
LogView log_group, current filter
ServiceBrowser none (general chat)

Persistence

Phase 1: Session History

~/.config/claws/chat/
├── sessions/
│   ├── 2026-01-07-abc123.json
│   └── 2026-01-07-def456.json
└── current.json
  • Keep last N sessions (default: 10)
  • :chat history - list past sessions
  • :chat resume - resume session

Phase 2 (future): Resource Notes

  • AI auto-saves important findings per resource
  • Show "AI Notes" section in DetailView

Implementation

New Files

  • internal/ai/bedrock.go - Converse API wrapper (streaming)
  • internal/ai/tools.go - Tool definitions + executor
  • internal/ai/session.go - Session persistence
  • internal/view/chat_overlay.go - Overlay component
  • internal/view/chat_view.go - Fullscreen chat

Key Decisions

  • Read-only: List/Get only, no destructive operations
  • DAO-based: 163 resources, grows with DAOs
  • Model: Configurable (Sonnet/Haiku)

Tasks

  • Bedrock Converse API wrapper (streaming)
  • Tool definitions + executor
  • Context extraction from views
  • Chat overlay component
  • Fullscreen chat view
  • Session persistence
  • Config: model, region, max_sessions
  • Keybind integration

Open Questions

  • Overlay keybind: A? ?a?
  • Default model: Sonnet vs Haiku
  • Max context tokens to send

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions