# Data Directory This directory stores all data files for the AI-Tutor system, including knowledge bases, user data, logs, etc. ## 📁 Directory Structure ``` data/ ├── knowledge_bases/ # Knowledge base storage └── user/ # User activity data ├── solve/ # Problem-solving results ├── question/ # Generated questions ├── research/ # Research reports and cache ├── co_writer/ # Interactive IdeaGen documents ├── notebook/ # Notebook records ├── guide/ # Guided-learning sessions └── run_code_workspace/ # Code execution workspace ``` ## 📋 Directory Description ### knowledge_bases/ Stores all knowledge base data files for the AI-Tutor system. ### user/ Stores all user-generated data and output files. #### solve/ Problem-solving module output directory containing results from problem-solving tasks. #### question/ Question generation module output directory containing generated questions and validation results. #### research/ Research module output directory containing research reports and cache data. #### co_writer/ Co-Writer module output directory for interactive IdeaGen documents. #### notebook/ Notebook data storage containing notebook records and indices. #### guide/ Guided-learning module output directory containing learning session data. #### run_code_workspace/ Code execution workspace for temporarily storing files generated by code execution. ## 🔧 Configuration Data directory paths are configured in `config/main.yaml`: ```yaml paths: user_data_dir: "./data/user" knowledge_bases_dir: "./data/knowledge_bases" run_code_workspace_dir: "./data/user/run_code_workspace" ``` ## 📝 Notes 1. **Backup Important Data**: Recommend regularly backing up `knowledge_bases/` and important user data 2. **Version Control**: Recommend adding `data/` directory to `.gitignore` to avoid committing large files 3. **Disk Space**: Knowledge bases and user data may occupy significant disk space, clean old data regularly 4. **Permission Management**: Ensure application has read/write permissions 5. **Path Consistency**: All modules use unified path configuration, avoid hardcoded paths ## 🔗 Related Modules - **Knowledge Base Management**: `src/knowledge/` - Knowledge base creation, updates, queries - **User Data**: Each functional module automatically manages its corresponding user data directory - **Logging System**: `src/core/logging/` - Unified logging management ## 🛠️ Maintenance Operations ### Clean Old Data ```bash # Clean old user data directories (customize based on retention policy) # Replace the pattern with your actual naming convention, e.g.: # find data/user -type d -regex '.*_[0-9]{8}.*' -mtime +30 -exec rm -rf {} \; find data/user -type d -name "*_YYYYMMDD*" -mtime +30 -exec rm -rf {} \; # Clean temporary workspace files find data/user/run_code_workspace -type f -mtime +7 -delete ``` ### Backup Knowledge Base ```bash # Backup entire knowledge base directory tar -czf knowledge_bases_backup_$(date +%Y%m%d).tar.gz data/knowledge_bases/ # Backup specific knowledge base tar -czf kb_backup.tar.gz data/knowledge_bases/{kb_name}/ ``` ### Restore Knowledge Base ```bash # Restore knowledge base tar -xzf knowledge_bases_backup_20250101.tar.gz -C data/ ```