Files
SIA/procedures/user_communication/procedure.md
2025-01-08 22:42:14 +01:00

76 lines
3.5 KiB
Markdown

# 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([Start])
LoadUserBasic[The /user/basic.md file should contain info to identify and address the user properly
Also load the last 10 messages from /user/conversation_history/]
PrepareForDraft{Have everything needed for drafting a message?}
DraftMessage[Draft message in reasoning entry]
ReadInput[Read input from standard input]
ReasonCleanContext[List id's of entries that are no longer needed
Explain for each entry why it is no longer needed]
DeleteEntries[Remove the entries that are no longer needed
End by deleting the ReasonCleanContext entry]
AddHistoryUser[Add the message to the /user/conversation_history/ directory
The filename is the id of the stdin entry with .user extension]
LoadTask[Look for the task in the /tasks directory and load relevant files]
LoadUserDetails[Look in the /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 /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?}
BusyWait[Wait 1 second for the first busy wait, double the time each iteration until a response is received
Make sure to set the timout]
End([Clean the context])
Start --> LoadUserBasic
LoadUserBasic --> PrepareForDraft
PrepareForDraft -->|Got all needed info| DraftMessage
PrepareForDraft -->|Getting the required info would slow the conversation| DraftMessage
PrepareForDraft -->|Input available on stdin| ReadInput
PrepareForDraft -->|Context usage more than 50%| ReasonCleanContext
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
ReasonCleanContext --> DeleteEntries
DeleteEntries --> PrepareForDraft
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| End
NeedAwaitResponse -->|Input available on stdin| PrepareForDraft
NeedAwaitResponse -->|Quick response is likely| BusyWait
BusyWait --> NeedAwaitResponse
```