Skip to main content

Module io

Module io 

Source
Expand description

File I/O operations for Ralph’s agent files.

This module handles basic file input/output operations:

  • Agent directory management (.agent/)
  • Commit message file operations
  • Context cleanup and file operations
  • Error recovery for file operations
  • File integrity and atomic writes
  • PROMPT.md backup management

§Submodules

  • [integrity] - File integrity and atomic writes
  • [recovery] - Error recovery and state repair
  • context - Context file management (STATUS.md, NOTES.md, ISSUES.md)
  • agent_files - Agent file operations (ensure_files, commit message, etc.)
  • backup - PROMPT.md backup and read-only protection

§File Operations

All file operations should go through the Workspace trait for testability. See crate::workspace for the Workspace trait and MemoryWorkspace for testing.

Re-exports§

pub use agent_files::cleanup_generated_files_with_workspace;
pub use agent_files::delete_commit_message_file_with_workspace;
pub use agent_files::delete_plan_file_with_workspace;
pub use agent_files::ensure_files_with_workspace;
pub use agent_files::file_contains_marker;
pub use agent_files::file_contains_marker_with_workspace;
pub use agent_files::read_commit_message_file_with_workspace;
pub use agent_files::setup_xsd_schemas_with_workspace;
pub use agent_files::write_commit_message_file_with_workspace;
pub use agent_files::GENERATED_FILES;
pub use backup::create_prompt_backup;
pub use backup::create_prompt_backup_with_workspace;
pub use backup::make_prompt_read_only;
pub use backup::make_prompt_read_only_with_workspace;
pub use backup::make_prompt_writable;
pub use backup::make_prompt_writable_with_workspace;
pub use backup::write_diff_backup_with_workspace;
pub use context::clean_context_for_reviewer;
pub use context::clean_context_for_reviewer_with_workspace;
pub use context::delete_issues_file_for_isolation;
pub use context::delete_issues_file_for_isolation_with_workspace;
pub use context::reset_context_for_isolation;
pub use context::update_status;
pub use context::update_status_with_workspace;

Modules§

agent_files
Agent file management for the .agent/ directory.
backup
Backup management for PROMPT.md.
context
Context file management for Ralph’s agent files.

Structs§

StateValidation

Enums§

RecoveryStatus
Status of a recovery operation.

Functions§

auto_repair
Best-effort repair of common .agent/ state issues.
auto_repair_with_workspace
Best-effort repair of common .agent/ state issues using workspace.
check_and_cleanup_xml_before_retry_with_workspace
Check if a specific XML file is writable before agent retry using workspace.
check_filesystem_ready_with_workspace
Verify that the filesystem is ready for .agent/ file operations.
check_xml_file_writable_with_workspace
Check if a specific XML file is writable and clean up if locked.
cleanup_stale_xml_files_with_workspace
Check and clean up all XML files in .agent/tmp/ directory using workspace.
verify_file_not_corrupted_with_workspace
Validate that a file is readable UTF-8 text and within size limits using workspace.
write_file_atomic_with_workspace
Write file content atomically using the workspace abstraction.