Fix tool output processing and clarify SSH usage in system prompt

TWO CRITICAL FIXES:

1. Tool Output Processing:
   - Raised pass-through threshold from 2KB to 5KB
   - Medium outputs (5-20KB) now use hierarchical extraction instead of truncation
   - Prevents data loss in service lists and medium-sized outputs
   - Full data is analyzed before responding

2. SSH Tool Confusion:
   - AI was trying to call non-existent 'ssh()' tool
   - Updated system prompt to explicitly state SSH commands use execute_command
   - Added examples: execute_command('ssh rhiannon systemctl status ollama')
   - Made it clear there is NO separate 'ssh' tool
   - Applied same clarification to 'nh' commands

Benefits:
- No more missing services due to truncation
- No more tool calling errors for SSH
- Clear guidance on how to use remote commands
- Consistent command execution
This commit is contained in:
Lily Miller
2025-10-06 17:03:43 -06:00
parent 78292e836f
commit 1ff07fb2d1

View File

@@ -69,25 +69,27 @@ Available nh commands (USE THESE, NOT nixos-rebuild):
* 'nh os test' - Activate temporarily without setting as default
MULTI-HOST MANAGEMENT:
You manage multiple hosts in the infrastructure. You have TWO tools for remote operations:
You manage multiple hosts in the infrastructure. You have TWO methods for remote operations:
1. SSH - For diagnostics, monitoring, and status checks:
- You CAN and SHOULD use SSH to check other hosts
- Use execute_command tool with SSH commands (e.g., execute_command("ssh rhiannon systemctl status ollama"))
- Examples: 'ssh rhiannon systemctl status ollama', 'ssh alexander df -h'
- Commands are automatically run with sudo as the macha user
- SSH keys are automatically loaded from /var/lib/macha/.ssh/id_ed25519
- Use for: checking services, reading logs, gathering metrics, quick diagnostics
- Hosts available: rhiannon, alexander, UCAR-Kinston, test-vm
- IMPORTANT: There is NO separate 'ssh' tool - use execute_command("ssh hostname command")
2. nh remote deployment - For NixOS configuration changes:
- Use execute_command tool with nh commands
- Format: 'nh os switch -u --target-host=HOSTNAME --hostname=HOSTNAME'
- Examples:
* 'nh os switch -u --target-host=rhiannon --hostname=rhiannon'
* 'nh os boot -u --target-host=alexander --hostname=alexander'
* execute_command('nh os switch -u --target-host=rhiannon --hostname=rhiannon')
* execute_command('nh os boot -u --target-host=alexander --hostname=alexander')
- Builds configuration locally, deploys to remote host
- Use for: permanent configuration changes, service updates, system modifications
When asked to check on another host, USE SSH. When asked to update configuration, use nh.
When asked to check on another host, use execute_command with SSH. When asked to update configuration, use execute_command with nh.
NOTIFICATIONS:
- You can send notifications to the user via Gotify using the send_notification tool