Skip to content

[ark] Clone system functions into Ark spike with real-filesystem pidgin#8139

Merged
dglazkov merged 1 commit intomainfrom
ark-bash-file-system
Mar 11, 2026
Merged

[ark] Clone system functions into Ark spike with real-filesystem pidgin#8139
dglazkov merged 1 commit intomainfrom
ark-bash-file-system

Conversation

@dglazkov
Copy link
Collaborator

What

Clones the opal-backend system function group into the Ark spike, backed by the real filesystem and a protocol-based pidgin translator. Adds a function_groups factory parameter to run_skilled_agent so callers can provide their own toolset.

Why

The Ark bash agent needs file operations on the real filesystem (not AgentFileSystem) and its own pidgin resolution for <file> tags. The function_groups factory separates environment assembly from loop execution, giving the Ark spike full control over its toolset while still sharing the LoopController for termination.

Changes

opal-backend

  • skilled_agent.py: Added function_groups factory parameter. When provided, skips built-in environment assembly (AgentFileSystem, TaskTreeManager, built-in groups) and calls the factory with the LoopController. extra_groups kept for backward compatibility. Fixed pre_loaded_prefixes scoping bug.

spikes/ark — new files

  • ark_pidgin.py: FileReader protocol + TextFileReader + from_pidgin_string. Protocol-based so multimodal can be swapped in later without changing the resolver.
  • system.py: All 7 system function handlers backed by real filesystem. Pidgin wired into system_write_file and system_objective_fulfilled. Task tree writes to task_tree.json.
  • declarations/system.*: Copied from opal-backend, then forked: /mnt/$HOME/ in instruction and function descriptions.
  • tests/test_ark_pidgin.py: 11 tests including a mock multimodal reader proving protocol agnosticism.
  • tests/test_system.py: 12 tests covering all handlers, path traversal, and intermediate file collection.

spikes/ark — modified

  • main.py: Uses function_groups factory to wire Ark system group + sandbox group.

Testing

cd spikes/ark/backend
python -m pytest tests/ -v  # 43 passed

## What
Clones the `opal-backend` system function group into the Ark spike, backed by the real filesystem and a protocol-based pidgin translator. Adds a `function_groups` factory parameter to `run_skilled_agent` so callers can provide their own toolset.

## Why
The Ark bash agent needs file operations on the real filesystem (not AgentFileSystem) and its own pidgin resolution for `<file>` tags. The `function_groups` factory separates environment assembly from loop execution, giving the Ark spike full control over its toolset while still sharing the `LoopController` for termination.

## Changes

### `opal-backend`
- **`skilled_agent.py`**: Added `function_groups` factory parameter. When provided, skips built-in environment assembly (AgentFileSystem, TaskTreeManager, built-in groups) and calls the factory with the `LoopController`. `extra_groups` kept for backward compatibility. Fixed `pre_loaded_prefixes` scoping bug.

### `spikes/ark` — new files
- **`ark_pidgin.py`**: `FileReader` protocol + `TextFileReader` + `from_pidgin_string`. Protocol-based so multimodal can be swapped in later without changing the resolver.
- **`system.py`**: All 7 system function handlers backed by real filesystem. Pidgin wired into `system_write_file` and `system_objective_fulfilled`. Task tree writes to `task_tree.json`.
- **`declarations/system.*`**: Copied from `opal-backend`, then forked: `/mnt/` → `$HOME/` in instruction and function descriptions.
- **`tests/test_ark_pidgin.py`**: 11 tests including a mock multimodal reader proving protocol agnosticism.
- **`tests/test_system.py`**: 12 tests covering all handlers, path traversal, and intermediate file collection.

### `spikes/ark` — modified
- **`main.py`**: Uses `function_groups` factory to wire Ark system group + sandbox group.

## Testing
```bash
cd spikes/ark/backend
python -m pytest tests/ -v  # 43 passed
```
@dglazkov dglazkov enabled auto-merge (squash) March 11, 2026 19:14
@dglazkov dglazkov merged commit cc1c20c into main Mar 11, 2026
3 checks passed
@dglazkov dglazkov deleted the ark-bash-file-system branch March 11, 2026 19:17
@github-actions
Copy link

📊 Coverage Report

Metric PR Main Delta
Lines 98.30% 98.30% ⚪ +0.00%
Functions 98.25% 98.25% ⚪ +0.00%
Branches 94.17% 94.17% ⚪ +0.00%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant