Files
SIA/iterations/iteration_20241120_103226_304.xml
2024-11-20 16:06:33 +01:00

191 lines
8.6 KiB
XML

<?xml version='1.0' encoding='utf-8'?>
<iteration system_prompt_hash="a357171f34284409058700f0d6c20cbb4f4bfe643aff5b12168c5158767f89b4" action_schema_hash="a4cf87f3d53c7b14aab3c96097d8b7bf838e8f77e413d11f51051afbe22fa3a6"><context>&lt;context
context="52.76"
cpu="0"
disk_total="1081101176832"
disk_used="125111205888"
gpu="0"
memory_total="16630431744"
memory_used="957472768"
stdin="0"
time="2024-11-20T10:31:30Z"&gt;
&lt;read_stdin id="3da7f743-19b7-4738-aaf9-49634618e8f7"&gt;
&lt;![CDATA[The SIA source is located in /root/sia. Not all features are implemented yet. Look at the readme and code to find what is missing. Make sure to unit test your work.]]&gt;
&lt;/read_stdin&gt;
&lt;reasoning id="d8ed5b92-cecb-43bf-a019-63bb9fd8ab64"&gt;
&lt;![CDATA[
I have received a message from the user indicating that the SIA source code is located in /root/sia. The user also mentioned that not all features are implemented yet and that I should look at the readme and code to find what is missing. Additionally, the user instructed me to unit test my work.
My next step will be to list the contents of the /root/sia directory to understand its structure and identify the readme file.
]]&gt;
&lt;/reasoning&gt;
&lt;single
exit_code="0"
id="8637bd02-7c94-4708-bfa3-bf840d376166"
stdout_truncated="true"&gt;
&lt;![CDATA[ls -la /root/sia]]&gt;
&lt;stdout&gt;
&lt;![CDATA[total 204
drwxr-xr-x 1 root root 4096 Nov 20 10:25 .
drwx------ 1 root root 4096 Nov 20 10:26 ..
drwxr-xr-x 2 root root 4096 Oct 31 17:07 .crossnote
-rwxr-xr-x 1 root root 14 Nov 4 16:01 .dockerignore
drwxr-xr-x 8 root root 4096 Nov 20 10:21 .git
-rwxr-xr-x 1 root root 30 Nov 4 16:01 .gitignore
-rwxr-xr-x 1 root root 843 Nov 4 14:52 Dockerfile
-rwxr-xr-x 1 root root 19975 Nov 19 14:20 README.md
drwxr-xr-x 2 root root 4096 Nov 15 16:10 _test
-rwxr-xr-x 1 root root 3923 Nov 13 15:56 action_schema.xsd
-rwxr-xr-x 1 root root 2064 Nov 6 12:29 claude.sh
-rwxr-xr-x 1 root root 85153 Nov 14 13:30 claude.txt
-rwxr-xr-x 1 root root 4939 Nov 20 10:07 finetune_dataset_creator.py
-rwxr-xr-x 1 root root 572 Nov 19 14:20 install.sh
drwxrwxrwx 1 root root 512 Nov 20 10:27 iterations
-rwxr-xr-x 1 root root 105 Nov 19 14:20 requirements.txt
-rwxr-xr-x 1 root root 269 Nov 19 18:05 run.sh
drwxr-xr-x 1 root root 4096 Nov 20 10:26 sia
drwxr-xr-x 3 root root 4096 Nov 19 16:01 static
-rwxr-xr-x 1 root r]]&gt;
&lt;/stdout&gt;
&lt;stderr/&gt;
&lt;/single&gt;
&lt;reasoning id="16421800-daa4-46f3-b619-e4efbafb448b"&gt;
&lt;![CDATA[
The listing of the /root/sia directory shows several files and directories. The README.md file is present, which I should read to understand the project better. Additionally, there are directories like .git, _test, iterations, sia, and static, as well as various scripts and configuration files.
My next step will be to read the README.md file to get an overview of the project and identify what features are missing.
Since it is a large file I will only read a part of it.
]]&gt;
&lt;/reasoning&gt;
&lt;single
exit_code="0"
id="f5f8f1d0-f956-46c3-a942-ebac7a0ccf6a"
limit="4096"&gt;
&lt;![CDATA[head -c 4096 /root/sia/README.md]]&gt;
&lt;stdout&gt;
# SIA - The Self Improving Agent
SIA is an agentic artificial intelligence system that autonomously completes complex tasks by writing and executing scripts.
It uses a Large Language Model (LLM) which operates in a loop.
Each iteration a context is updated with system info and a list of previous reasoning and actions.
The agent responds with a new reasoning or an action.
Context, reasoning and actions are stored in a file for each iteration.
SIA can read past iterations to improve its reasoning and actions.
It can improve in two ways:
- By finetuning the LLM with a better reasoning or action for a given context
- By modifying its own source code
## Example
This example shows a typical context with some monitored items and previous actions.
Between each of the responses, the context would be updated.
### Context
```xml
&amp;lt;context
time=&amp;quot;2024-10-18T12:00:00Z&amp;quot;
cpu=&amp;quot;12&amp;quot;
gpu=&amp;quot;26&amp;quot;
memory_used=&amp;quot;9556302234&amp;quot;
memory_total=&amp;quot;17179869184&amp;quot;
disk_used=&amp;quot;244434939904&amp;quot;
disk_total=&amp;quot;273145991168&amp;quot;
context=&amp;quot;3&amp;quot;
stdin=&amp;quot;0&amp;quot;
/&amp;gt;
&amp;lt;repeat id=&amp;quot;a3d89ee5-28ec-4c5a-b9e9-a30af53d43a0&amp;quot; exit_code=&amp;quot;0&amp;quot;&amp;gt;
&amp;lt;![CDATA[ls -lah /]]&amp;gt;
&amp;lt;stdout&amp;gt;&amp;lt;![CDATA[total 16K
drwxr-xr-x 1 sia 1049089 0 Oct 28 13:40 ./
drwxr-xr-x 1 sia 1049089 0 Oct 28 13:40 ../
drwxr-xr-x 1 sia 1049089 0 Oct 28 13:40 tasks/
drwxr-xr-x 1 sia 1049089 0 Oct 28 13:40 user/
]]&amp;gt;&amp;lt;/stdout&amp;gt;
&amp;lt;stderr/&amp;gt;
&amp;lt;/repeat&amp;gt;
&amp;lt;repeat id=&amp;quot;be8070f8-dbd2-47ee-a208-defe6fd49ae0&amp;quot; exit_code=&amp;quot;0&amp;quot;&amp;gt;
&amp;lt;![CDATA[ls -lah /tasks]]&amp;gt;
&amp;lt;stdout&amp;gt;&amp;lt;![CDATA[total 0
drwxr-xr-x 1 ngeens 1049089 0 Oct 28 13:40 ./
drwxr-xr-x 1 ngeens 1049089 0 Oct 28 13:40 ../
]]&amp;gt;&amp;lt;/stdout&amp;gt;
&amp;lt;stderr/&amp;gt;
&amp;lt;/repeat&amp;gt;
&amp;lt;repeat id=&amp;quot;375e1657-8140-456b-bda4-a8690bc4b3fb&amp;quot; exit_code=&amp;quot;0&amp;quot;&amp;gt;
&amp;lt;![CDATA[cat /user/general_info.txt]]&amp;gt;
&amp;lt;stdout&amp;gt;&amp;lt;![CDATA[Name: John (I don&amp;apos;t know his last name)
Location: Somewhere in Belgium
]]&amp;gt;&amp;lt;/stdout&amp;gt;
&amp;lt;stderr/&amp;gt;
&amp;lt;/repeat&amp;gt;
&amp;lt;reasoning id=&amp;quot;c92d1594-4487-4a42-a153-f0a99da1762f&amp;quot;&amp;gt;&amp;lt;![CDATA[There is data available on the standard input channel. I have no other running tasks to tend to and there is room in the context. I should read the standard input.]]&amp;gt;&amp;lt;/reasoning&amp;gt;
&amp;lt;read_stdin id=&amp;quot;5361ad0d-3ed1-4567-9f5a-70f3b462fd8d&amp;quot;&amp;gt;&amp;lt;![CDATA[Remind me to feed the cat tomorrow morning]]&amp;gt;&amp;lt;/read_stdin&amp;gt;
&amp;lt;/context&amp;gt;
```
### Responses
Start by reasoning about the task.
```xml
&amp;lt;reasoning&amp;gt;
John did not specify an exact time.
I&amp;apos;ll suggest 9am.
He also did not specify how to be reminded.
I&amp;apos;ll ask but if he doesn&amp;apos;t respond I&amp;apos;ll assume a text message on standard output is fine.
I&amp;apos;ll write down this task in a file so I remember it even on a power failure.
&amp;lt;/reasoning&amp;gt;
```
Store important information on disk.
```xml
&amp;lt;script&amp;gt;&amp;lt;![CDATA[echo &amp;apos;Remind John to feed the cat on 2024-10-18T09:00:00+02:00. Use standard output.&amp;apos; &amp;gt; /tasks/reminder_to_feed_cat.txt]]&amp;gt;&amp;lt;/script&amp;gt;
```
Respond to the user.
```xml
&amp;lt;write_stdout&amp;gt;I&amp;apos;ll remind you to feed the cat tomorrow morning at 9am. Is a message on the standard output ok?&amp;lt;/write_stdout&amp;gt;
```
Clear initial reasoning.
```xml
&amp;lt;delete id=&amp;quot;c92d1594-4487-4a42-a153-f0a99da1762f&amp;quot;/&amp;gt;
```
The conversation is kept in context to understand the user&amp;apos;s expected response.
If the context was near full, it would be summarized and cleaned up.
The `script` output is also kept in context.
If the file was updated often, it could be replaced by a repeated `cat`, like the general info.
## Working principles
The main context is regenerated for each iteration.
It contains info about the system and previous actions that have not been deleted.
Together with the system prompt and available core actions it forms the prompt for the LLM.
The LLM responds with one core action.
### Core Actions
There are only a few core actions:
- Starting a script
- Deleting data from context
- Stopping SIA
- Reading standard input
- Writing to standard output
- Reasoning
### Scripts
Scripts can run in one of 2 modes: single-shot or repeat.
Their mode and output (stdout and stderr) stay in the context until t
&lt;/stdout&gt;
&lt;stderr/&gt;
&lt;/single&gt;
&lt;reasoning id="554ffbc2-2a90-423b-aafe-ed90dd66b73b"&gt;
&lt;![CDATA[
I can use the markdown headings to identify interesting sections.
I will try to find sections containing details about what needs to be implemented.
]]&gt;
&lt;/reasoning&gt;
&lt;/context&gt;</context><response>&lt;single&gt;grep -Eb "^#" /root/sia/README.md&lt;/single&gt;</response></iteration>