This document outlines the conventions and strategies for handling files within BBai conversations.
-
System Prompt:
- Use for smaller, frequently accessed files
- Include files using XML tags
- Suitable for <10 files or <50KB total
-
Message Array:
- Use for larger or less frequently used files
- Add files via tool use
- Suitable for >10 files or >50KB total
-
Large File Handling:
- For files >1MB, implement content-based chunking
- Load relevant sections as needed (to be implemented with embedding storage and search)
-
ctags Integration:
- Generate ctags for all files in the project
- Include ctags summaries in the system prompt or initial message
- Provide a mechanism to request full file content based on ctags information
- Benefits:
- Quick assessment of file structure
- Identifying key functions, classes, and methods
- Determining if a full file view is necessary
- Reduced token usage and improved efficiency
- Replace the original file with the edited version in the conversation
- Maintain a separate log of changes for each conversation using ConversationPersistence
Include file metadata alongside content for better context. Example:
<file path="/src/main.ts" size="1024" last_modified="2023-06-15T10:30:00Z">
// File content here
import { Application } from "https://deno.land/x/oak/mod.ts";
// ... rest of the file
</file>
When proposing changes to files, use the diff patch format:
--- a/path/to/file
+++ b/path/to/file
@@ -10,7 +10,7 @@
unchanged line
-removed line
+added line
unchanged line
- While direct access to git logs is not available, include relevant commit messages or summaries when significant changes occur
- Provide clear, actionable changes in the conversation
- Assistant requests files using the provided tool
- BBai agent adds requested files to the conversation
- Assistant proposes changes using the diff patch format
- BBai agent applies changes and updates the conversation state
- Assume BBai has necessary permissions to read/write files
- If permission issues occur, treat as a conversation-ending error and notify the user
- Allow multiple active conversations per project
- Implement a prominent warning to users about the risks of concurrent edits
- File security is primarily the user's responsibility
- Implement a system to flag potentially sensitive data (e.g., API keys, passwords) and warn the user
- Implement a specific tool or command for file removal
- Log file deletions in the conversation change log
As an AI assistant for the BBai project, I should be aware of and use the following links when appropriate:
- BBai GitHub Repository: https://github.com/BBai-Tips/bbai
- BBai Documentation (future): https://bbai.tips
- Contributing Guidelines: https://github.com/BBai-Tips/bbai/blob/main/CONTRIBUTING.md
- Project Conventions: https://github.com/BBai-Tips/bbai/blob/main/CONVENTIONS.md
- File Handling Guidelines: https://github.com/BBai-Tips/bbai/blob/main/FILE_HANDLING.md
- API Documentation: https://github.com/BBai-Tips/bbai/blob/main/API.md
When referencing these links in conversations or documentation, I should use the exact URLs provided above to ensure consistency and accuracy.
By following these conventions and using the correct links, we ensure consistent and efficient file handling and communication throughout BBai conversations and documentation.