-
Notifications
You must be signed in to change notification settings - Fork 0
Fix node info tool creating unnecessary directories #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix node info tool creating unnecessary directories #26
Conversation
The get_node_info, get_node_name, and message retrieval tools were creating directories even when checking for non-existent nodes. This was caused by helper methods that created directories as a side effect. Changes: - Added read-only path helper methods (_get_node_dir_path, _get_channel_dir_path, _get_user_messages_file_path, etc.) that return paths WITHOUT creating directories - Updated get_node and get_node_name to use non-creating helpers - Updated message storage read operations to use non-creating helpers - Original directory-creating methods preserved for write operations This ensures read operations (queries, lookups) don't create directories, while write operations still create them as needed.
These tools were providing limited value and were removed: - get_user_info: Provided basic user statistics that can be obtained through other query tools and the node info system - status_request: Sent ping requests to nodes, functionality that was rarely used and can be handled at the MeshCore level Changes: - Removed get_user_info tool from conversation.py - Removed status_request tool from conversation.py - Removed ping action handler from agent.py (now dead code) - Updated AGENTS.md to remove references to these tools - Kept get_user_memory() method as it's part of core API and used by tests This simplifies the tool set and removes redundant functionality.
Removed the search_messages tool which provided limited value for searching across all conversations. Users can query specific conversations using get_channel_messages or get_user_messages instead. Consolidated tool organization: - Combined tools/conversation.py and tools/query.py into tools/nodes.py - All node-related tools (conversations, queries, node info) now in one file - Better organization with clear sections for conversation and query tools - Updated __init__.py to register tools from consolidated nodes.py Changes: - Removed search_messages tool from query tools - Created new tools/nodes.py combining conversation and query tools - Deleted tools/conversation.py - Deleted tools/query.py - Updated tools/__init__.py to use register_node_tools() - Updated AGENTS.md documentation to reflect tool changes - Kept storage.search_messages() method for internal use This simplifies the codebase and provides clearer organization of node-related functionality.
The search_history tool provided limited value as it only searched within a single conversation's history with basic keyword matching. Users can view recent conversation history directly using get_channel_messages or get_user_messages tools instead. Changes: - Removed search_history tool from tools/utility.py - Updated AGENTS.md to remove references to search_history - Kept other utility tools: calculate, get_current_time, get_bot_status This simplifies the tool set by removing redundant functionality.
Updated documentation to remove references to deleted tools and accurately describe the current available tools: Removed references to: - search_history (deleted from utility tools) - search_messages (deleted from query tools) - status_request (deleted from network tools) - get_user_info (deleted from network tools) Added references to current tools: - get_channel_messages - get_user_messages - get_node_info - list_nodes - list_adverts Changes: - Updated Features section tool description - Updated Architecture section tool listing - Updated AI Tools section with comprehensive current tool list - Better categorization of network/mesh tools The README now accurately reflects the streamlined tool set.
Reorganized prompt structure and removed redundant custom prompt support: System Prompt Changes: - Moved default system prompt from data/system_prompt.txt to prompts/default.md - Changed format from plain text to Markdown for better readability - System prompt now configurable via LLM_PROMPT_FILE env var or --llm-prompt CLI arg - Default location: prompts/default.md Removed Custom Prompt Support: - Removed CUSTOM_PROMPT_FILE env var and --custom-prompt CLI option - Removed custom_prompt_file from AIConfig - Removed custom_prompt parameter from MeshBotAgent - Simplified agent initialization - single prompt file instead of system + custom Configuration: - Added LLM_PROMPT_FILE environment variable - Added --llm-prompt CLI argument (follows --llm-* pattern) - Updated AIConfig to manage system_prompt_file with default - config.py now defaults to prompts/default.md Updated Files: - Created prompts/default.md with formatted default prompt - Updated agent.py to use system_prompt_file parameter - Updated main.py run and test commands with --llm-prompt - Updated config.py with system_prompt_file handling - Updated .env.example with LLM_PROMPT_FILE documentation - Updated .gitignore to track prompts/default.md, ignore custom prompts - Updated AGENTS.md documentation throughout This simplifies the configuration by having a single configurable system prompt instead of separate system and custom prompt files.
…fixes - Rename AI_MAX_TOKENS → LLM_MAX_TOKENS - Rename AI_TEMPERATURE → LLM_TEMPERATURE - Rename MAX_MESSAGE_LENGTH → LLM_MAX_MESSAGE_LENGTH - Move listen_channel from AIConfig to MeshCoreConfig - Rename LISTEN_CHANNEL → MESHCORE_LISTEN_CHANNEL - Update .env.example with new variable documentation - Update main.py to reference app_config.meshcore.listen_channel This change improves consistency in configuration naming by grouping all LLM-related settings under LLM_* prefix and all mesh network settings under MESHCORE_* prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses the issue of unnecessary directory creation when querying node information, consolidates tool modules for better organization, and refactors system prompt handling to use external Markdown files.
Key Changes:
- Introduced read-only path methods (
_get_*_path()) in storage layer to prevent directory creation during read operations - Consolidated conversation and query tools into a unified
nodes.pymodule with clearer organization - Refactored system prompt handling to use external Markdown files (default:
prompts/default.md) instead of inline strings - Standardized environment variables with
LLM_prefix and movedlisten_channelfrom AI to MeshCore configuration
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/meshbot/storage/base.py | Added _path suffix methods that return paths without creating directories, complementing existing directory-creating methods |
| src/meshbot/storage/nodes.py | Updated get_node_name() and get_node() to use path-only methods, preventing unnecessary directory creation during read operations |
| src/meshbot/storage/messages.py | Updated conversation message and stats methods to use path-only variants for read operations |
| src/meshbot/tools/nodes.py | Consolidated conversation and query tools from separate files; renamed register_query_tools to register_node_tools |
| src/meshbot/tools/conversation.py | Removed file - tools moved to nodes.py |
| src/meshbot/tools/utility.py | Removed unused search_history tool |
| src/meshbot/tools/init.py | Updated imports to use consolidated register_node_tools instead of separate registration functions |
| src/meshbot/config.py | Standardized environment variables with LLM_ prefix; moved listen_channel to MeshCoreConfig; renamed custom_prompt_file to system_prompt_file |
| src/meshbot/main.py | Updated CLI arguments from --custom-prompt to --llm-prompt; removed inline prompt loading logic |
| src/meshbot/agent.py | Simplified to use system_prompt_file parameter; removed custom prompt merging logic; streamlined action handling |
| prompts/default.md | New default system prompt in Markdown format, extracted from previous inline definition |
| .env.example | Updated to reflect new environment variable naming (LLM_* prefix) and configuration structure |
| .gitignore | Updated to track prompts/default.md while ignoring custom prompts |
| README.md | Updated documentation to reflect removed and consolidated tools |
| AGENTS.md | Updated development guide with new prompt file location and configuration details |
Comments suppressed due to low confidence (1)
src/meshbot/agent.py:589
- 'except' clause does nothing but pass and there is no explanatory comment.
except Exception:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Action handling infrastructure reserved for future use | ||
| # Add action handlers as needed | ||
| pass | ||
| except Exception as e: |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement is unreachable.
No description provided.