DEEP DIVE — Agent Loop (gyandoot-agent): - Real conversation loop with interactive (run()) and non-interactive (run_conversation()) modes - Retry logic with exponential backoff and error classification (RateLimit, Auth, Timeout, ServerError, ContextOverflow) - Context window management — token estimation, 75% threshold compression - 7 built-in tools: Read, Write, Edit, Bash, Grep, Find, Ls - BashTool with destructive-command security blocks - ContextCompressor — prune tool results, summarize middle messages DEEP DIVE — Memory (gyandoot-memory): - Real MemPalace with ~/.gyandoot/palace/wings/<wing>/ directory tree - Daily transcript files (YYYY-MM-DD_transcript.md) with append-only format - L0/L1 identity persistence (< 157 tokens for L0) - Session digest to drawer.md - File persistence support for transcripts and identity store DEEP DIVE — Core (gyandoot-core): - GyandootConfig with TOML deserialization for all sections - ConfigLoader with env > profile > file > default chain - Rich types: Message, ToolCall, ToolResult, SessionId - Comprehensive error types with thiserror derive DEEP DIVE — Providers (gyandoot-providers): - Provider trait with chat/chat_stream/models - OpenAI provider with streaming SSE and function calling - Anthropic provider with Messages API + tool use - Ollama provider with merge_system/no_tools auto-detect - SseParser, StreamEvent, TokenStream for SSE parsing - ProviderFactory for creation from config NEW — TUI crate (gyandoot-tui): - Banner: Kapil-approved robot head ASCII art with ANSI colors - Setup wizard: 7 providers, interactive config, connection test - Terminal helpers: spinner, confirm, text input, selection menu - Ratatui TUI: keyboard input, commands, status display All 12 crates + CLI binary compile with 0 errors.
1.8 KiB
1.8 KiB
GyanDoot Agent Development Guide
Overview
This guide documents conventions for developing and extending GyanDoot CLI/TUI tools.
gyandoot-tui Conventions
Module Structure
src/lib.rs— Re-exports all public APIsrc/banner.rs— ASCII art banner display (primary robot head + fallback box)src/setup.rs— Interactive setup wizard for provider configurationsrc/terminal.rs— Terminal helpers (spinner, confirm, text input, selection menu, status)src/tui.rs— Ratatui-based TUI main loop with event handling
Banner
- Primary banner uses Kapil's approved robot head ASCII art with 4-bit ANSI colors
- Fallback banner is a compact box used in pipe mode
print_banner()auto-detects pipe mode viaattybanner_plain()returns uncolored text for TUI display
Setup Wizard
- Flow: Banner → Provider Selection → Per-provider Config → Summary → Connection Test → Save
- Uses crossterm for raw input (not dialoguer)
- Provider auto-detect: localhost Ollama sets
merge_system=true,no_tools=true - Config saved to
~/.config/gyandoot/config.toml
Terminal Helpers
progress_spinner()— Runs a closure with a spinner animationconfirm_prompt()— y/n question with optional defaulttext_input()— Raw-mode text input with backspace/enter/esc supportselection_menu()— Numbered menu returning index or Noneshow_status()— Colored status display (success/error/warning/info)
TUI
- Three modes: Normal, Input, Command
- Keyboard shortcuts:
q/Esc to quit,ifor input mode,:or/for commands - Commands:
/help,/clear,/banner,/quit,/status - Uses ratatui with crossterm backend
- Enters/leaves alternate screen on start/exit
CLI Integration
gyandoot setup— Runs the setup wizard (non-async, terminal I/O)gyandoot tui— Launches the ratatui TUI interface