From 10821d23178b4d63de5a2dbb9019b3d8a54e5f91 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 8 Oct 2026 10:38:05 -0700 Subject: [PATCH] zeroclaw, still trying to fine-tune things, getting closer. --- tasks/workstation/linux/software/zeroclaw.yml | 83 ++++++++++++------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/tasks/workstation/linux/software/zeroclaw.yml b/tasks/workstation/linux/software/zeroclaw.yml index 4db1d34..cac2a56 100644 --- a/tasks/workstation/linux/software/zeroclaw.yml +++ b/tasks/workstation/linux/software/zeroclaw.yml @@ -17,6 +17,9 @@ # # Models # - https://ollama.com/search +# +# References +# - https://docs.zeroclaw.com/master/en/reference/config.html # Currently only testing this on Arch based distros (pacman). - name: Workstation | Linux | Software | ZeroClaw @@ -27,17 +30,18 @@ ollama: ollama zeroclaw: zeroclaw zerocode: zerocode + llm_concurrency: "{{ ansible_processor_vcpus / 4 | round(0, method='ceil') | int }}" llm_installs: [] llm_micro_cpu: 1 llm_micro_ram: 2000 llm_micro: - { "model": "qwen3.5:0.8b", "provider": "qwen_35_0008" } - { "model": "qwen2.5-coder:0.5b", "provider": "qwen_25_coder_0005" } + - { "model": "qwen2.5-coder:1.5b", "provider": "qwen_25_coder_0015" } llm_small_cpu: 2 llm_small_ram: 4000 llm_small: - { "model": "qwen3.5:2b", "provider": "qwen_35_0020" } - - { "model": "qwen2.5-coder:1.5b", "provider": "qwen_25_coder_0015" } - { "model": "qwen2.5-coder:3b", "provider": "qwen_25_coder_0030" } llm_medium_cpu: 4 llm_medium_ram: 8000 @@ -113,7 +117,6 @@ ollama_runit_log_script: "{{ ollama_runit_log_dir }}/{{ runit_log_script }}" zeroclaw_runit_log_script: "{{ zeroclaw_runit_log_dir }}/{{ runit_log_script }}" - - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Micro ansible.builtin.set_fact: llm_installs: "{{ llm_installs + llm_micro }}" @@ -122,7 +125,7 @@ - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Micro | Uninstall ansible.builtin.set_fact: - llm_installs: "{{ llm_removals + llm_micro }}" + llm_removals: "{{ llm_removals + llm_micro }}" when: ansible_processor_vcpus < llm_micro_cpu or ansible_memtotal_mb < llm_micro_ram @@ -134,7 +137,7 @@ - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Small | Uninstall ansible.builtin.set_fact: - llm_installs: "{{ llm_removals + llm_small }}" + llm_removals: "{{ llm_removals + llm_small }}" when: ansible_processor_vcpus < llm_small_cpu or ansible_memtotal_mb < llm_small_ram @@ -146,7 +149,7 @@ - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Medium | Uninstalls ansible.builtin.set_fact: - llm_installs: "{{ llm_removals + llm_medium }}" + llm_removals: "{{ llm_removals + llm_medium }}" when: ansible_processor_vcpus < llm_medium_cpu or ansible_memtotal_mb < llm_medium_ram @@ -158,7 +161,7 @@ - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Large | Uninstalls ansible.builtin.set_fact: - llm_installs: "{{ llm_removals + llm_large }}" + llm_removals: "{{ llm_removals + llm_large }}" when: ansible_processor_vcpus < llm_large_cpu or ansible_memtotal_mb < llm_large_ram @@ -170,7 +173,7 @@ - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Huge | Uninstalls ansible.builtin.set_fact: - llm_installs: "{{ llm_removals + llm_huge }}" + llm_removals: "{{ llm_removals + llm_huge }}" when: ansible_processor_vcpus < llm_huge_cpu or ansible_memtotal_mb < llm_huge_ram @@ -182,7 +185,7 @@ - name: Workstation | Linux | Software | ZeroClaw | Facts | Merge | Giant | Uninstalls ansible.builtin.set_fact: - llm_installs: "{{ llm_removals + llm_giant }}" + llm_removals: "{{ llm_removals + llm_giant }}" when: ansible_processor_vcpus < llm_giant_cpu or ansible_memtotal_mb < llm_giant_ram @@ -190,6 +193,9 @@ ansible.builtin.debug: var: "{{ item }}" loop: + - ansible_processor_vcpus + - ansible_memtotal_mb + - llm_concurrency - llm_installs - llm_removals @@ -232,9 +238,12 @@ # Allow pulling LLMs for use with ZeroClaw. exec 2>&1 export HOME={{ user_user.home }} - export OLLAMA_KEEP_ALIVE=0 # default 5m - export OLLAMA_REQUEST_TIMEOUT=600 # default 300 - export OLLAMA_MAX_LOADED_MODELS=1 # default is 3 if using CPUs, or 3 * NumGPUs + export OLLAMA_KEEP_ALIVE=1h # default 5m + export OLLAMA_REQUEST_TIMEOUT=3600 # default 300 (unconfirmed, not in the list of --help vars) + export OLLAMA_LOAD_TIMEOUT=30m # default is 5m + export OLLAMA_MAX_LOADED_MODELS={{ llm_concurrency }} # default is 3 if using CPUs, or 3 * NumGPUs + export OLLAMA_MAX_QUEUE=999999999 # default is 512 (unconfirmed) + export OLLAMA_NUM_PARALLEL={{ llm_concurrency }} # default is 1 and applies per-model (unconfirmed) exec chpst -u {{ user }} ollama serve dest: "{{ ollama_runit_script }}" mode: "0755" @@ -283,7 +292,7 @@ #!/bin/sh -e # Allow using the ZeroClaw frontend. exec 2>&1 - exec chpst -u {{ user }} zeroclaw daemon + exec chpst -u {{ user }} zeroclaw daemon -v --log-level info dest: "{{ zeroclaw_runit_script }}" mode: "0755" @@ -327,20 +336,39 @@ - http://127.0.0.1:11434/ - http://127.0.0.1:42617/health - - name: Workstation | Linux | Software | ZeroClaw | Models | zeroclaw | Defaults - ansible.builtin.blockinfile: - path: "{{ user_user.home }}/.zeroclaw/config.toml" - marker: "# {mark} ANSIBLE MANAGED BLOCK | zeroclaw | Defaults" - insertbefore: BOF - block: | - default_provider = "ollama" - default_model = "qwen3.5:4b" - provider_timeout_secs = 3600 - state: present - create: false - backup: true - owner: "{{ user }}" - mode: "0644" + #- name: Workstation | Linux | Software | ZeroClaw | Config | zeroclaw | Root + # ansible.builtin.blockinfile: + # path: "{{ user_user.home }}/.zeroclaw/config.toml" + # marker: "# {mark} ANSIBLE MANAGED BLOCK | zeroclaw | Defaults" + # insertbefore: '(?m)^schema_version' + # block: | + # default_provider = "ollama" + # default_model = "qwen3.5:4b" + # provider_timeout_secs = 3600 + # state: present + # create: false + # backup: true + + #- name: Workstation | Linux | Software | ZeroClaw | Config | zeroclaw | Channels | header + # ansible.builtin.lineinfile: + # path: "{{ user_user.home }}/.zeroclaw/config.toml" + # insertbefore: '(?m)^[channels]' + # block: | + # message_timeout_secs = 3600 + # state: present + # create: false + # backup: true + + #- name: Workstation | Linux | Software | ZeroClaw | Config | zeroclaw | Channels + # ansible.builtin.blockinfile: + # path: "{{ user_user.home }}/.zeroclaw/config.toml" + # marker: "# {mark} ANSIBLE MANAGED BLOCK | zeroclaw | Channels" + # insertbefore: '(?m)^[channels]' + # block: | + # message_timeout_secs = 3600 + # state: present + # create: false + # backup: true - name: Workstation | Linux | Software | ZeroClaw | Models | ollama | Install ansible.builtin.shell: | @@ -395,11 +423,10 @@ [providers.models.ollama.ansible_{{ llm.provider }}] model = "{{ llm.model }}" timeout_secs = 3600 # 1 hour, default is 120 (2 minutes), issue happens between 5 and 6 minutes though. + context_window = 999999999 {% endfor %} state: present create: false backup: true - owner: "{{ user }}" - mode: "0644" when: ansible_pkg_mgr == "pacman"