README.md (6822B)
1 # Dave - The Nostr AI Assistant 2 3 Dave is an AI-powered assistant for the Nostr protocol, built as a Notedeck application. It provides both a simple conversational interface for querying Nostr data and a full-featured agentic coding environment with Claude Code integration. 4 5 <img src="https://cdn.jb55.com/s/73ebab8f43804da8.png" width="50%"/> 6 7 ## Overview 8 9 Dave serves two purposes: 10 11 1. **Nostr Assistant** - A conversational interface that can search, analyze, and present Nostr notes using natural language 12 2. **Agentic IDE** - A multi-agent development environment with Claude Code integration for coding tasks 13 14 You can use either mode depending on your needs—simple chat for quick Nostr queries, or agentic mode for software development workflows. 15 16 ## Features 17 18 ### Core Features 19 20 - [x] Interactive 3D avatar with WebGPU rendering 21 - [x] Natural language conversations with AI 22 - [x] Query and search the local Nostr database for notes 23 - [x] Present and render notes to the user 24 - [x] Tool-based architecture for AI actions 25 - [x] Multiple AI providers (OpenAI, Anthropic, Ollama) 26 - [ ] Context-aware searching (home, profile, or global scope) 27 - [ ] Anonymous [lmzap](https://jb55.com/lmzap) backend 28 29 ### AI Modes 30 31 - **Chat Mode** - Simple OpenAI-style conversational interface for Nostr queries 32 - **Agentic Mode** - Full IDE with permissions, sessions, scene view, and Claude Code integration 33 34 ### Multi-Agent System (Agentic Mode) 35 36 - **RTS-Style Scene View** - Visual grid-based view for managing multiple agents simultaneously 37 - **Focus Queue** - Priority-based system for agent attention (NeedsInput > Error > Done) 38 - **Auto-Steal Focus** - Automatically cycle through agents requiring attention 39 - **Session Management** - Multiple independent AI sessions with per-session working directories 40 - **Subagent Support** - Track and display Task tool subagents within chat history 41 42 ### Claude Code Integration (Agentic Mode) 43 44 - **Interactive Permissions** - Allow/Deny tool calls with diff view for file changes 45 - **Auto-Accept Rules** - Configurable rules for automatically accepting safe operations: 46 - Small edits (2 lines or less by default) 47 - Read-only bash commands (grep, ls, cat, find, etc.) 48 - Cargo commands (build, check, test, fmt, clippy) 49 - **Plan Mode** - Toggle plan mode with `Ctrl+M` for architectural planning 50 - **Session Resume** - Resume previous Claude Code sessions from filesystem 51 - **AskUserQuestion Support** - Answer multi-choice questions from the AI 52 53 ### Keyboard-Driven Workflow (Agentic Mode) 54 55 | Shortcut | Action | 56 |----------|--------| 57 | `1` / `2` | Accept / Deny permission requests | 58 | `Shift+1` / `Shift+2` | Accept / Deny with custom message | 59 | `Escape` | Interrupt AI (double-press to confirm) | 60 | `Ctrl+Tab` / `Ctrl+Shift+Tab` | Cycle through agents | 61 | `Ctrl+1-9` | Jump to agent by number | 62 | `Ctrl+T` | New agent | 63 | `Ctrl+Shift+T` | Clone agent (same working directory) | 64 | `Ctrl+N` / `Ctrl+P` | Focus queue navigation (higher/lower priority) | 65 | `Ctrl+D` | Toggle Done status in focus queue | 66 | `Ctrl+M` | Toggle plan mode | 67 | `Ctrl+\` | Toggle auto-steal focus | 68 | `Ctrl+G` | Open external editor for input | 69 | `Ctrl+V` | Toggle scene view | 70 | `Delete` | Delete selected agent | 71 72 ### UI Components 73 74 - **Diff View** - Syntax-highlighted diff for Edit/Write tool permission requests 75 - **Status Badges** - Visual indicators for plan mode, agent status, and keybinds 76 - **Keybind Hints** - Contextual hints shown when Ctrl is held 77 - **Directory Picker** - Select working directory when creating sessions 78 - **Session Picker** - Resume existing Claude Code sessions 79 - **Compaction Status** - Visual indicator when `/compact` is running 80 81 ### External Integration 82 83 - **IPC Spawn** - Create agents from external tools via Unix domain socket 84 - **`notedeck-spawn` CLI** - Spawn agents from terminal: `notedeck-spawn /path/to/project` 85 86 ## Technical Details 87 88 Dave uses: 89 90 - Egui for UI rendering 91 - WebGPU for 3D avatar visualization (optional) 92 - Claude Agent SDK for agentic workflows 93 - OpenAI API / Anthropic API / Ollama for chat mode 94 - NostrDB for Nostr note storage and querying 95 - Tokio for async operations 96 - Unix domain sockets for IPC 97 98 ## Architecture 99 100 Dave is structured around several key components: 101 102 1. **UI Layer** - Handles rendering with scene view and chat panels 103 2. **Avatar** - 3D representation with WebGPU rendering 104 3. **Session Manager** - Manages multiple independent AI sessions 105 4. **Focus Queue** - Priority-based attention system for multi-agent workflows 106 5. **AI Backend** - Pluggable backends (Claude, OpenAI, Ollama) 107 6. **Tools System** - Provides structured ways for the AI to interact with Nostr data 108 7. **Auto-Accept Rules** - Configurable permission auto-approval 109 8. **IPC Listener** - External spawn requests via Unix socket 110 9. **Session Discovery** - Finds resumable Claude sessions from `~/.claude/projects/` 111 112 ## Getting Started 113 114 ### Chat Mode (OpenAI/Ollama) 115 116 1. Clone the repository 117 2. Set up your API keys: 118 ``` 119 export OPENAI_API_KEY=your_api_key_here 120 # or for Ollama 121 export OLLAMA_HOST=http://localhost:11434 122 ``` 123 3. Build and run Notedeck with Dave 124 125 ### Agentic Mode (Claude Code) 126 127 1. Install Claude Code CLI: `npm install -g @anthropic-ai/claude-code` 128 2. Authenticate: `claude login` 129 3. Run Dave and select a working directory when creating a new agent 130 131 ## Configuration 132 133 Dave can be configured to use different AI backends: 134 135 - **OpenAI API** (Chat mode) - Set the `OPENAI_API_KEY` environment variable 136 - **Anthropic Claude** (Chat mode) - Set the `ANTHROPIC_API_KEY` environment variable 137 - **Ollama** (Chat mode) - Use a compatible model and set the `OLLAMA_HOST` environment variable 138 - **Claude Code** (Agentic mode) - Requires Claude Code CLI installed and authenticated 139 140 ## File Locations 141 142 - IPC Socket: 143 - Linux: `$XDG_RUNTIME_DIR/notedeck/spawn.sock` 144 - macOS: `~/Library/Application Support/notedeck/spawn.sock` 145 - Claude Sessions: `~/.claude/projects/<project-path>/` 146 147 ## Usage as a Reference 148 149 Dave serves as an excellent reference for developers looking to: 150 151 - Build conversational interfaces in Notedeck 152 - Implement 3D rendering with WebGPU in Rust applications 153 - Create tool-based AI agents that can take actions in response to user requests 154 - Query and present Nostr content in custom applications 155 - Build multi-agent systems with priority-based focus management 156 - Integrate Claude Code into custom applications 157 158 ## Contributing 159 160 Contributions are welcome! See the issues list for planned features and improvements. 161 162 ## License 163 164 GPL 165 166 ## Related Projects 167 168 - [nostrdb](https://github.com/damus-io/nostrdb) - Embedded database for Nostr notes 169 - [Claude Code](https://claude.ai/claude-code) - Anthropic's agentic coding tool 170 - [Claude Agent SDK](https://github.com/anthropics/claude-code) - SDK for Claude Code integration