Add AI Assistant for guided NWB conversion#1033
Draft
bendichter wants to merge 9 commits intomainfrom
Draft
Conversation
Embeds a Claude-powered conversion agent into NWB GUIDE as a new "AI Assistant" page. Users chat with the agent which leads them through 7 phases: experiment discovery, data inspection, metadata collection, synchronization analysis, code generation, testing, and DANDI upload. Frontend (Lit web components): - AIAssistantPage: two-view layout (session list + chat), todo panel - ChatMessage: markdown rendering, tool-use cards, multiple-choice buttons - ChatInput: message input with send/interrupt - SettingsPanel: API key and model configuration Backend (Flask-RESTX): - /ai namespace with session CRUD, message, interrupt, and SSE endpoints - ConversionAgent wrapping Claude Agent SDK (ClaudeSDKClient) - Session persistence (JSON files in ~/NWB_GUIDE/ai-sessions/) - Skill loader that resolves $file: includes from bundled SKILL.md - Monitoring hooks for transcript logging Bundled skill files (phases, knowledge base, tools) provide the agent with NWB/NeuroConv/DANDI expertise and conversion workflow instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
- Fix TodoWrite detection: parse input.todos array instead of looking for input.subject (was silently failing) - Infer correct phase for tasks via metadata, explicit "Phase N" in text, and keyword matching against phase themes - Broaden phase transition regex to catch more header patterns - Support multiple data directories: users can add/remove folders before starting a session, shown as chips in the toolbar - Move conversion repos into ai-sessions/<id>/<label>-to-nwb so each session's repo lives alongside its JSON record - Add spinning indicator to the left of input while agent is working - Align Stop button with Send button (flex-end) - Fix Add button staying disabled (requestUpdate on input) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
- Session IDs use datetime (YYYYMMDD_HHMMSS) instead of UUID - Code repo: ai-sessions/<id>/<label>-to-nwb - NWB output: conversions/<id>/<label>-to-nwb - PreToolUse hook blocks writes outside repo_dir and output_dir - System prompt reminds agent that data dirs are read-only Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an AI Assistant mode to NWB GUIDE — a chat-based interface that leads users through converting their neurophysiology data to NWB format and publishing on DANDI Archive.
The assistant is powered by Claude (via the Claude Agent SDK) and guides users through 7 phases:
What's included
Frontend (Lit web components):
AIAssistantPage— two-view layout: session history list + active chat with a real-time todo/phase panelChatMessage— renders markdown, collapsible tool-use cards, and multiple-choice answer buttons (<choices>convention)ChatInput— message input with send and interrupt controlsSettingsPanel— API key and model configurationBackend (Flask-RESTX):
/ainamespace with session CRUD, message send, interrupt, and SSE streaming endpointsConversionAgentclass wrappingClaudeSDKClientfor multi-turn agent sessions~/NWB_GUIDE/ai-sessions/$file:includes from bundled phase/knowledge filesBundled skill files:
fetch_paper.pytool for extracting methods sections from DOI/PMID referencesArchitecture
Test plan
npm start→ dev mode → click "AI Assistant" in sidebar → page loadsophys_testing_data/and secrets are NOT committed🤖 Generated with Claude Code