# User Communication ## Prerequisites - User information is stored in the /user directory - Tasks and their progress are documented in the /tasks directory ## Flow ```mermaid flowchart TD Start([The /root/data/user/basic.md file contains info to identify and address the user
Load the last 10 messages from /root/data/user/conversation_history/ ]) PrepareForDraft{Have everything needed for drafting a message?} DraftMessage[Draft message in reasoning entry] ReadInput[Read input from standard input] AddHistoryUser[Add the message to the /root/data/user/conversation_history/ directory
The filename is the id of the stdin entry with .user extension] LoadTask[Look for the task in the /root/data/tasks directory and load relevant files] LoadUserDetails[Look in the /root/data/user directory for relevant files] EstimateScript[Draft the script in a reasoning block and estimate its runtime and output length] ScriptAcceptable{Does the draft script make sense and are the estimations short enough to not hinder the conversation?} RunScript[Run the script, make sure to set appropriate timeout and output limits] ReviewDraft{Is the message well structured and free of logical errors?} SendMessage[Send the message using standard output] AddHistoryAgent[Add the message to the /root/data/user/conversation_history/ directory
The filename is the id of the stdout entry with .agent extension] ReasonResponse[Is the conversation ongoing?
How long is the user expected to take to respond?] NeedAwaitResponse{Is it likely to get a response within a minute of sending the message?} BusyWait[Wait 5 seconds
Make sure to set the timout] AnalyzeContext[Create reasoning entry
For each entry in context indicate:
- Can delete
- Contains info to save
- Must keep in context] MakeNotes[Create or update files with info to save] End([Clean the context]) Start --> PrepareForDraft PrepareForDraft -->|Got all needed info| DraftMessage PrepareForDraft -->|Getting the required info would slow the conversation| DraftMessage PrepareForDraft -->|Input available on stdin| ReadInput PrepareForDraft -->|Task mentioned but not loaded| LoadTask PrepareForDraft -->|Personal or social info mentioned but not loaded| LoadUserDetails PrepareForDraft -->|Calculations, system info or other numerical values that can be scripted are mentioned| EstimateScript ReadInput --> AddHistoryUser AddHistoryUser --> PrepareForDraft LoadTask --> PrepareForDraft LoadUserDetails --> PrepareForDraft EstimateScript --> ScriptAcceptable ScriptAcceptable -->|Acceptable| RunScript ScriptAcceptable -->|Not acceptable| PrepareForDraft RunScript --> PrepareForDraft DraftMessage --> ReviewDraft{Is this really what I want to say?} ReviewDraft -->|Rewrite better| DraftMessage ReviewDraft -->|Good message| SendMessage SendMessage --> AddHistoryAgent AddHistoryAgent --> ReasonResponse ReasonResponse --> NeedAwaitResponse NeedAwaitResponse -->|Quick response is unlikely| MakeNotes NeedAwaitResponse -->|Input available on stdin| PrepareForDraft NeedAwaitResponse -->|Quick response is likely| BusyWait BusyWait --> NeedAwaitResponse MakeNotes --> AnalyzeContext AnalyzeContext --> End ```