|
2 | 2 |
|
3 | 3 | This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
4 | 4 |
|
5 | | -# Semantic Workbench Developer Guidelines |
6 | | - |
7 | | -## Common Commands |
8 | | -* Build/Install: `make install` (recursive for all subdirectories) |
9 | | -* Format: `make format` (runs ruff formatter) |
10 | | -* Lint: `make lint` (runs ruff linter) |
11 | | -* Type-check: `make type-check` (runs pyright) |
12 | | -* Test: `make test` (runs pytest) |
13 | | -* Single test: `uv run pytest tests/test_file.py::test_function -v` |
14 | | - |
15 | | -## Code Style |
16 | | -### Python |
17 | | -* Indentation: 4 spaces |
18 | | -* Line length: 120 characters |
19 | | -* Imports: stdlib → third-party → local, alphabetized within groups |
20 | | -* Naming: `snake_case` for functions/variables, `CamelCase` for classes, `UPPER_SNAKE_CASE` for constants |
21 | | -* Types: Use type annotations consistently; prefer Union syntax (`str | None`) for Python 3.10+ |
22 | | -* Documentation: Triple-quote docstrings with param/return descriptions |
23 | | - |
24 | | -## Tools |
25 | | -* Python: Uses uv for environment/dependency management |
26 | | -* Linting/Formatting: Ruff (Python) |
27 | | -* Type checking: Pyright (Python) |
28 | | -* Testing: pytest (Python) |
29 | | -* Package management: uv (Python)Ok. |
| 5 | +# Knowledge Transfer Assistant |
| 6 | + |
| 7 | +A sophisticated dual-mode assistant that facilitates collaborative knowledge sharing between Coordinators (knowledge creators) and Team members (knowledge receivers) within the Semantic Workbench platform. |
| 8 | + |
| 9 | +## Core Architecture |
| 10 | + |
| 11 | +### Dual-Mode Operation |
| 12 | +The assistant operates in two distinct modes with role-specific capabilities: |
| 13 | + |
| 14 | +1. **Coordinator Mode**: Creates and manages knowledge packages, responds to information requests, shares files |
| 15 | +2. **Team Mode**: Accesses shared knowledge, requests information, tracks learning progress |
| 16 | + |
| 17 | +### Cross-Conversation Communication |
| 18 | +The system manages three types of conversations: |
| 19 | +- **Coordinator Conversation**: Personal workspace for knowledge creation |
| 20 | +- **Shareable Team Conversation**: Template conversation (never directly used) |
| 21 | +- **Team Conversation(s)**: Individual conversations for each team member |
| 22 | + |
| 23 | +### Key Components |
| 24 | + |
| 25 | +- **Knowledge Transfer Manager** (`assistant/domain/`): Orchestrates the entire knowledge transfer lifecycle |
| 26 | +- **Share Manager** (`assistant/files.py`): Handles file synchronization across conversations |
| 27 | +- **Storage System** (`assistant/storage.py`, `assistant/storage_models.py`): Persistent state management |
| 28 | +- **UI Tabs** (`assistant/ui-tabs/`): Real-time visual dashboards showing transfer status |
| 29 | +- **Notification System** (`assistant/notifications.py`): Cross-conversation communication |
| 30 | + |
| 31 | +### Core Artifacts |
| 32 | +- **Knowledge Brief**: Introductory overview for team members |
| 33 | +- **Knowledge Digest**: Auto-updating LLM-generated information repository |
| 34 | +- **Learning Objectives**: Structured goals with specific outcomes |
| 35 | +- **Information Requests**: Team member questions with priority levels |
| 36 | + |
| 37 | +## Development Commands |
| 38 | + |
| 39 | +### Basic Operations |
| 40 | +```bash |
| 41 | +# Install dependencies |
| 42 | +make install |
| 43 | + |
| 44 | +# Run all tests |
| 45 | +make test |
| 46 | + |
| 47 | +# Run specific test with verbose output |
| 48 | +uv run pytest tests/test_file.py::test_function -v |
| 49 | + |
| 50 | +# Manual inspector test |
| 51 | +python tests/test_inspector.py |
| 52 | + |
| 53 | +# Type checking |
| 54 | +make type-check |
| 55 | + |
| 56 | +# Code quality |
| 57 | +make lint |
| 58 | +make format |
| 59 | +``` |
| 60 | + |
| 61 | +### Assistant Management |
| 62 | +```bash |
| 63 | +# Start assistant service |
| 64 | +make start |
| 65 | + |
| 66 | +# Docker operations |
| 67 | +make docker-build |
| 68 | +make docker-run-local |
| 69 | +``` |
| 70 | + |
| 71 | +## Project Structure |
| 72 | + |
| 73 | +### Core Implementation (`/assistant/`) |
| 74 | +- `assistant.py`: Main assistant with dual-role event handling |
| 75 | +- `config.py`: Role-specific prompt templates and configuration |
| 76 | +- `storage.py` & `storage_models.py`: Persistent state management |
| 77 | +- `conversation_share_link.py`: Cross-conversation linking and synchronization |
| 78 | +- `files.py`: File synchronization via ShareFilesManager |
| 79 | +- `respond.py`: Response generation logic |
| 80 | +- `common.py`: Role detection and common utilities |
| 81 | + |
| 82 | +### Agentic (`/assistant/agentic/`) |
| 83 | +- `team_welcome.py`: Team welcome message generation |
| 84 | +- `coordinator_support.py`: Coordinator guidance and support |
| 85 | +- `analysis.py`: Analysis functionality |
| 86 | + |
| 87 | +### Domain Logic (`/assistant/domain/`) |
| 88 | +- `share_manager.py`: Share creation, joining, and cross-conversation coordination (`ShareManager` class) |
| 89 | +- `knowledge_brief_manager.py`: Brief creation and management (`KnowledgeBriefManager` class) |
| 90 | +- `knowledge_digest_manager.py`: Auto-updating digest system (`KnowledgeDigestManager` class) |
| 91 | +- `learning_objectives_manager.py`: Learning goal tracking (`LearningObjectivesManager` class) |
| 92 | +- `information_request_manager.py`: Team question handling (`InformationRequestManager` class) |
| 93 | +- `audience_manager.py`: Audience definition and management (`AudienceManager` class) |
| 94 | + |
| 95 | +### Tools (`/assistant/tools/`) |
| 96 | +- `information_requests.py`: Information request handling |
| 97 | +- `learning_objectives.py`: Learning objective management |
| 98 | +- `learning_outcomes.py`: Outcome tracking |
| 99 | +- `progress_tracking.py`: Transfer progress monitoring |
| 100 | +- `share_setup.py`: Share link creation |
| 101 | + |
| 102 | +### UI Tabs (`/assistant/ui-tabs/`) |
| 103 | +- `brief.py`: Knowledge transfer status dashboard |
| 104 | +- `learning.py`: Learning objectives tracking |
| 105 | +- `sharing.py`: Sharing status monitoring |
| 106 | +- `debug.py`: Debug information panel |
| 107 | + |
| 108 | +### Configuration (`/assistant/text_includes/`) |
| 109 | +Role-specific prompts and instruction templates: |
| 110 | +- `coordinator_role.txt` & `coordinator_instructions.txt`: Coordinator mode configuration |
| 111 | +- `team_role.txt` & `team_instructions.txt`: Team mode configuration |
| 112 | +- `knowledge_digest_prompt.txt`: LLM prompts for digest generation |
| 113 | + |
| 114 | +## Key Dependencies |
| 115 | + |
| 116 | +- `semantic-workbench-assistant`: Core assistant framework |
| 117 | +- `assistant-extensions[attachments]`: File attachment support with dashboard cards |
| 118 | +- `content-safety`: Content moderation capabilities |
| 119 | +- `openai-client`: LLM integration for knowledge digest generation |
| 120 | + |
| 121 | +## Development Guidelines |
| 122 | + |
| 123 | +### Code Philosophy |
| 124 | +The project follows a "wabi-sabi" philosophy emphasizing: |
| 125 | +- Ruthless simplicity with minimal abstractions |
| 126 | +- Present-moment focus rather than future-proofing |
| 127 | +- Trust in emergence from simple, well-defined components |
| 128 | +- Direct library integration with minimal wrappers |
| 129 | + |
| 130 | +### Code Style |
| 131 | +- Use 4 spaces for indentation |
| 132 | +- Maximum line length: 120 characters |
| 133 | +- Follow PEP 8 naming conventions |
| 134 | +- Use type annotations consistently |
| 135 | +- Write docstrings for functions and classes |
| 136 | + |
| 137 | +### Quality Assurance |
| 138 | +Always run the full quality check before submitting changes: |
| 139 | +```bash |
| 140 | +make lint && make type-check && make test |
| 141 | +``` |
| 142 | + |
| 143 | +### Important Development Notes |
| 144 | +- Use `uv` for all Python script execution to ensure correct environment |
| 145 | +- Keep ConversationRole enum consistent across all files |
| 146 | +- Use Optional typing for parameters that might be None |
| 147 | +- Update tests when changing functionality - never skip or remove tests |
| 148 | +- Access logs in `.data/logs/` directory (timestamped, latest sorted last) |
| 149 | +- Never make git commits - leave that to QA review process |
| 150 | + |
| 151 | +## Testing |
| 152 | + |
| 153 | +The test suite covers: |
| 154 | +- Artifact loading and management (`test_artifact_loading.py`) |
| 155 | +- Inspector functionality (`test_inspector.py`) |
| 156 | +- File sharing and synchronization (`test_share_manager.py`) |
| 157 | +- Storage system operations (`test_share_storage.py`) |
| 158 | +- Tool functionality (`test_share_tools.py`) |
| 159 | +- Team mode operations (`test_team_mode.py`) |
| 160 | + |
| 161 | +Run tests with: |
| 162 | +```bash |
| 163 | +# All tests |
| 164 | +make test |
| 165 | + |
| 166 | +# Specific test file |
| 167 | +uv run pytest tests/test_share_manager.py -v |
| 168 | + |
| 169 | +# Single test function |
| 170 | +uv run pytest tests/test_share_manager.py::test_file_sync -v |
| 171 | +``` |
0 commit comments