feat: Active Knowledge Collection — structured AI-guided data gathering#1
Draft
jakobengdahl wants to merge 4 commits into
Draft
feat: Active Knowledge Collection — structured AI-guided data gathering#1jakobengdahl wants to merge 4 commits into
jakobengdahl wants to merge 4 commits into
Conversation
874ae5c to
4834778
Compare
- Add ActiveKnowledgeCollection system node type to schema (amber #F59E0B, FunnelFill icon) - Add system_prompt_prefix support to chat API (ChatRequest, ChatService, ChatProcessor) - Pass effective_system_prompt through tool_use chain in ChatProcessor - Add FunnelFill icon to FloatingToolbar registry and AKC special handling - Add getCollectConfig() and sendCollectChatMessage() to api.js client - Update sendChatMessage() to support systemPromptPrefix option Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Xo4bjR6ro2p6umTF4eyyQ
- Add GET /collect/{short_name} redirect to /web/?collect={short_name}
- Add GET /api/collect/{short_name} endpoint to look up AKC config by short_name
- Search graph for ActiveKnowledgeCollection nodes and match by metadata.short_name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Xo4bjR6ro2p6umTF4eyyQ
- App.jsx: add AKC handlers (create, save, edit), kiosk routing via AppRoot, AKC intro overlay for ?akc= mode, systemPromptPrefix prop passed to ChatPanel when AKC config is active - ChatPanel.jsx: accept systemPromptPrefix prop and thread it through all four sendChatMessage calls to support ?akc= collection mode - FloatingToolbar.jsx: register FunnelFill icon and AKC node type - CreateActiveKnowledgeCollectionDialog.jsx: new dialog with basic info, intro text, AI prompt, per-type permissions table, and copyable URLs - CollectKioskView.jsx: full-screen kiosk chat UI for /collect/ route - CollectKioskView.css: dark-themed styles for the kiosk view - backend/chat_logic.py: system_prompt_prefix support in process_message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Xo4bjR6ro2p6umTF4eyyQ
Security (blockers):
- Validate short_name path param with regex [a-z0-9-] + URL-encode in
redirect to prevent path-traversal and query-string injection
- Move AI prompt resolution server-side: chat endpoint now accepts
collection_short_name; server looks up the AKC node and builds the
system prompt prefix — prompt never leaves the server
- Add max_length=8000 to system_prompt_prefix as defence-in-depth
- Remove prompt field from GET /api/collect/{short_name} response
- Raise AKC node scan limit from 200 to 500 to avoid silent truncation
Feature correctness:
- ?akc= full-app mode now passes collection_short_name to ChatPanel
(previously only passed the raw prompt, silently dropping permissions)
- CollectKioskView uses collectionShortName option to sendChatMessage
instead of building and transmitting the full prompt text client-side
React/code quality:
- Wrap CollectKioskView.handleSend in useCallback; capture conversation
history synchronously before state updates to fix stale-closure bug
- Replace deprecated onKeyPress with onKeyDown in CollectKioskView
- Use crypto.randomUUID() message keys instead of array index
- Move EXCLUDED_TYPES constant to module scope in CreateAKCDialog
- Remove dead sendCollectChatMessage duplicate from api.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Xo4bjR6ro2p6umTF4eyyQ
4834778 to
c0d261c
Compare
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
Introduces the Active Knowledge Collection feature: a mechanism for setting up structured, AI-guided data collection sessions that reuse the graph's full CRUD capabilities through a custom AI prompt and a dedicated kiosk UI.
What's new
ActiveKnowledgeCollectionnode type — new system node (amber#F59E0B,FunnelFillicon) stored in the schema alongsideAgentandEventSubscription. Key metadata fields:short_name— unique URL slug (e.g.q1-partner-feedback)introduction_text— shown to the user before the chat startsprompt— custom system prompt injected into the AI assistantnode_type_permissions— per-type create/update/delete flagsCreate/Edit dialog (
CreateActiveKnowledgeCollectionDialog) — 4-section form:Kiosk UI (
CollectKioskView) — full-screen AI chat at/collect/<shortName>:introduction_text) → chatprompt+ formatted permissions as system prefix?akc=<shortName>full-app mode — regular graph UI with:systemPromptPrefixBackend:
GET /api/collect/{short_name}— looks up AKC config by slugGET /collect/{short_name}— server-side redirect to/web/?collect=…system_prompt_prefixfield added to the chat API (ChatRequest→ChatService→ChatProcessor), prepended to the base system prompt for every LLM call including tool-use follow-upsTest plan
ActiveKnowledgeCollectionnode via the toolbar or canvas drop — dialog opens with all 4 sections/collect/<shortName>→ spinner → intro overlay → chat; AI uses the custom prompt/web/?akc=<shortName>→ intro dialog → graph + ChatPanel uses the custom prompt/web/?collect=<shortName>→ server redirects to kiosk viewActiveKnowledgeCollectionnode → edit dialog opens with pre-filled data🤖 Generated with Claude Code
https://claude.ai/code/session_014Xo4bjR6ro2p6umTF4eyyQ
Generated by Claude Code