Skip to content

Commit f921306

Browse files
authored
KTA Cleanup for shareout (#636)
1 parent 9ae02c9 commit f921306

47 files changed

Lines changed: 639 additions & 602 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assistants/knowledge-transfer-assistant/CLAUDE.md

Lines changed: 137 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -2,176 +2,170 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5-
## Knowledge Transfer Assistant
5+
# Knowledge Transfer Assistant
66

7-
A dual-mode context transfer system that facilitates collaborative knowledge sharing between Coordinators and Team members in the Semantic Workbench. This assistant bridges information gaps through structured communication with shared artifacts, real-time updates, and bidirectional information flow.
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.
88

9-
## Architecture Overview
9+
## Core Architecture
1010

11-
### Dual Mode Operation
11+
### Dual-Mode Operation
12+
The assistant operates in two distinct modes with role-specific capabilities:
1213

13-
The assistant operates in two distinct conversation roles determined by metadata:
14-
15-
1. **Coordinator Mode**: Knowledge organizers create and manage knowledge bases, provide guidance, and respond to information requests
16-
2. **Team Mode**: Team members access shared knowledge, explore project context, and request additional information
17-
18-
**Role Detection**: Uses `detect_assistant_role()` to check conversation metadata `project_role` field. Capabilities are role-specific through tool registration.
19-
20-
### Conversation Structure
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
2116

17+
### Cross-Conversation Communication
2218
The system manages three types of conversations:
23-
24-
- **Coordinator Conversation**: Personal workspace for knowledge organizers
25-
- **Shareable Team Conversation**: Template conversation with share URL (never directly used)
26-
- **Team Conversation(s)**: Individual conversations for team members accessing shared knowledge
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
2722

2823
### Key Components
2924

30-
- `assistant/assistant.py`: Main assistant implementation with dual-role event handling
31-
- `assistant/manager.py`: Project state and artifact management (KnowledgeTransferManager)
32-
- `assistant/conversation_share_link.py`: Cross-conversation linking and synchronization
33-
- `assistant/inspectors/`: Modular inspector panel system (brief, learning, sharing, debug)
34-
- `assistant/notifications.py`: Cross-conversation notification and UI refresh system
35-
- `assistant/storage.py` & `assistant/storage_models.py`: Persistent state management
36-
- `assistant/config.py`: Role-specific prompt templates and configuration
37-
- `assistant/data.py`: Core data models and enums (including InspectorTab)
38-
39-
## Common Commands
40-
41-
- Build/Install: `make install`
42-
- Format: `make format` (runs ruff formatter)
43-
- Lint: `make lint` (runs ruff linter)
44-
- Type-check: `make type-check` (runs pyright)
45-
- Test: `make test` (runs pytest)
46-
- Single test: `uv run pytest tests/test_file.py::test_function -v`
47-
- Manual inspector test: `python tests/test_inspector.py` (test state inspector functionality)
48-
- Docker build: `make docker-build` (builds assistant container image)
49-
- Start assistant: `make start` (starts the assistant service)
50-
- Local docker run: `make docker-run-local` (runs assistant in Docker with local workbench)
51-
52-
## Development Notes
53-
54-
### Inspector Panel UI Refresh System
55-
56-
The assistant uses a sophisticated event-driven system to keep inspector panels synchronized across all conversations:
57-
58-
- **InspectorTab Enum**: Defines available inspector panels with their state IDs (`data.py`)
59-
- **refresh_current_ui()**: Updates inspector panels in the current conversation only
60-
- **refresh_all_project_uis()**: Updates inspector panels across all conversations in a project
61-
- **ProjectNotifier.notify_project_update()**: Sends notifications and refreshes UIs with optional tab targeting
62-
- **State Events**: Uses `AssistantStateEvent` with specific state IDs to trigger UI updates
63-
64-
**Key Pattern**: When updating project state, always call the appropriate refresh function with specific tabs:
65-
```python
66-
from .data import InspectorTab
67-
await ShareStorage.refresh_all_share_uis(context, share_id, [InspectorTab.BRIEF])
68-
```
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
6930

70-
### State Management
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
7136

72-
- **Cross-Conversation Linking**: Connects coordinator and team conversations through project IDs
73-
- **File Synchronization**: Automatic file sharing between linked conversations
74-
- **Artifact Storage**: Structured data models for project briefs, knowledge digests, and information requests
75-
- **Inspector Panel System**: Multi-panel real-time dashboard with specific state IDs:
76-
- `brief`: Knowledge brief and project overview
77-
- `objectives`: Learning objectives and outcomes
78-
- `requests`: Information requests and sharing status
79-
- `debug`: Debug information and project state
80-
- **UI Refresh Architecture**: Event-driven system using `AssistantStateEvent` with specific state IDs
81-
- **Auto-Update Knowledge Digest**: LLM-powered automatic extraction and updating of key information from conversations
37+
## Development Commands
8238

83-
### Auto-Update Knowledge Digest
39+
### Basic Operations
40+
```bash
41+
# Install dependencies
42+
make install
8443

85-
The system automatically extracts and updates key information from conversations:
44+
# Run all tests
45+
make test
8646

87-
- **Trigger**: Every Coordinator message automatically triggers `auto_update_knowledge_digest()`
88-
- **Process**: Analyzes chat history using LLM to extract important information
89-
- **Storage**: Updates the knowledge digest with extracted content marked as auto-generated
90-
- **UI Refresh**: Ensures debug panel refreshes after completion (both success and error cases)
91-
- **Pattern**: Always refreshes UI regardless of success/failure to maintain consistency
47+
# Run specific test with verbose output
48+
uv run pytest tests/test_file.py::test_function -v
9249

93-
### Configuration Templates
50+
# Manual inspector test
51+
python tests/test_inspector.py
9452

95-
The assistant supports two templates with unified codebase:
53+
# Type checking
54+
make type-check
9655

97-
- **Default Template**: Full project management with goals, criteria, and progress tracking
98-
- **Context Transfer Template**: Simplified knowledge sharing without formal project stages
99-
100-
### Key Artifacts
101-
102-
- **Project Brief**: Knowledge goals and success criteria
103-
- **Knowledge Digest**: Dynamically updated context repository (auto-generated from conversations)
104-
- **Learning Objectives**: Structured goals with specific learning outcomes
105-
- **Information Requests**: Bidirectional communication between coordinators and team members
106-
- **Inspector Panels**: Real-time multi-panel dashboard showing project state
56+
# Code quality
57+
make lint
58+
make format
59+
```
10760

61+
### Assistant Management
62+
```bash
63+
# Start assistant service
64+
make start
10865

109-
### Dependencies
66+
# Docker operations
67+
make docker-build
68+
make docker-run-local
69+
```
11070

111-
The assistant uses several key dependencies from the Semantic Workbench ecosystem:
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
112115

113116
- `semantic-workbench-assistant`: Core assistant framework
114-
- `assistant-extensions[attachments]`: File attachment support with dashboard cards and navigation
117+
- `assistant-extensions[attachments]`: File attachment support with dashboard cards
115118
- `content-safety`: Content moderation capabilities
116119
- `openai-client`: LLM integration for knowledge digest generation
117-
- `openai>=1.61.0`: Direct OpenAI API integration
118-
119-
### Project Structure
120-
121-
Key architectural files:
122-
- `/assistant/`: Core implementation files
123-
- `assistant.py`: Main assistant with dual-role event handling
124-
- `manager.py`: Project state and artifact management (KnowledgeTransferManager)
125-
- `conversation_share_link.py`: Cross-conversation linking and synchronization
126-
- `notifications.py`: Cross-conversation notification and UI refresh system
127-
- `data.py`: Core data models and enums (InspectorTab, RequestPriority, etc.)
128-
- `inspectors/`: Modular inspector panel system
129-
- `brief.py`: Brief inspector for knowledge transfer status
130-
- `learning.py`: Learning objectives inspector
131-
- `sharing.py`: Sharing status inspector
132-
- `debug.py`: Debug inspector
133-
- `common.py`: Common inspector utilities
134-
- `storage.py` & `storage_models.py`: Persistent state management
135-
- `config.py`: Role-specific prompt templates and configuration
136-
- `text_includes/`: Role-specific prompts and instruction templates
137-
- `assets/`: SVG icons and visual assets
138-
- `/docs/`: Design documentation including `DESIGN.md`, `DEV_GUIDE.md`, `JTBD.md`, and `WORKBENCH_NOTES.md`
139-
- `/tests/`: Comprehensive test suite with manual inspector testing support
140-
141-
## Code Style
142-
143-
### Python
144-
145-
- Indentation: 4 spaces
146-
- Line length: 120 characters
147-
- Imports: stdlib → third-party → local, alphabetized within groups
148-
- Naming: `snake_case` for functions/variables, `CamelCase` for classes, `UPPER_SNAKE_CASE` for constants
149-
- Types: Use type annotations consistently; prefer Union syntax (`str | None`) for Python 3.10+
150-
- Documentation: Triple-quote docstrings with param/return descriptions
151-
152-
## Tools
153-
154-
- Python: Uses uv for environment/dependency management
155-
- Linting/Formatting: Ruff (Python)
156-
- Type checking: Pyright (Python)
157-
- Testing: pytest (Python)
158-
- Package management: uv (Python)
159120

160-
## Testing
161-
162-
The assistant includes comprehensive test coverage:
163-
- `test_artifact_loading.py`: Artifact loading and management tests
164-
- `test_inspector.py`: State inspector functionality tests (can be run manually with `python tests/test_inspector.py`)
165-
- `test_share_manager.py`: File sharing and synchronization tests
166-
- `test_share_storage.py`: Storage system tests
167-
- `test_share_tools.py`: Tool functionality tests
168-
- `test_team_mode.py`: Team mode operation tests
169-
170-
## Philosophy
121+
## Development Guidelines
171122

172-
The codebase follows a **wabi-sabi philosophy** emphasizing:
123+
### Code Philosophy
124+
The project follows a "wabi-sabi" philosophy emphasizing:
173125
- Ruthless simplicity with minimal abstractions
174126
- Present-moment focus rather than future-proofing
175127
- Trust in emergence from simple, well-defined components
176128
- Direct library integration with minimal wrappers
177-
- Pragmatic trust in external systems
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+
```

assistants/knowledge-transfer-assistant/assistant/agentic/__init__.py

Whitespace-only changes.

assistants/knowledge-transfer-assistant/assistant/analysis.py renamed to assistants/knowledge-transfer-assistant/assistant/agentic/analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from openai.types.chat import ChatCompletionMessageParam
1313
from semantic_workbench_assistant.assistant_app import ConversationContext
1414

15-
from .config import assistant_config
16-
from .logging import logger
15+
from ..config import assistant_config
16+
from ..logging import logger
1717

1818

1919
async def detect_information_request_needs(context: ConversationContext, message: str) -> Dict[str, Any]:

assistants/knowledge-transfer-assistant/assistant/manager/coordinator_support.py renamed to assistants/knowledge-transfer-assistant/assistant/agentic/coordinator_support.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ..data import RequestStatus
1212
from ..logging import logger
1313
from ..storage import ShareStorage
14+
from ..domain.share_manager import ShareManager
1415

1516

1617
class CoordinatorSupport:
@@ -28,9 +29,7 @@ async def get_coordinator_next_action_suggestion(context: ConversationContext) -
2829
A user-facing suggestion string, or None if no suggestion is needed.
2930
"""
3031
try:
31-
from .share_management import ShareManagement
32-
33-
share_id = await ShareManagement.get_share_id(context)
32+
share_id = await ShareManager.get_share_id(context)
3433
if not share_id:
3534
logger.warning("No share ID found for this conversation")
3635
return None
@@ -91,4 +90,4 @@ async def get_coordinator_next_action_suggestion(context: ConversationContext) -
9190

9291
except Exception as e:
9392
logger.exception(f"Error generating next action suggestion: {e}")
94-
return None
93+
return None

assistants/knowledge-transfer-assistant/assistant/team_welcome.py renamed to assistants/knowledge-transfer-assistant/assistant/agentic/team_welcome.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
from openai.types.chat import ChatCompletionMessageParam
1313
from semantic_workbench_assistant.assistant_app import ConversationContext
1414

15-
from assistant.manager import KnowledgeTransferManager
15+
from assistant.domain import KnowledgeTransferManager
1616
from assistant.storage import ShareStorage
1717

18-
from .config import assistant_config
19-
from .logging import logger
18+
from ..config import assistant_config
19+
from ..logging import logger
2020

2121

2222
async def generate_team_welcome_message(context: ConversationContext) -> tuple[str, dict[str, Any]]:

0 commit comments

Comments
 (0)