# Harness standard

A harness is a self-contained agentic program in its own repository. Anything in `~/.openprogram/programs/` exposing functions through `<pkg>/agentics/__init__.py` is one. No host file is edited; OpenProgram bundles none, and the host names none.

```
<Harness-Repo>/          what openprogram programs install puts in programs/
└── <pkg>/               importable package; folder name == import name
    ├── __init__.py      marks it a package
    └── agentics/
        └── __init__.py  entry point, exposes PROGRAM_ENTRIES
```

A folder that does not match is silently ignored. Install from a directory, Git URL or GitHub `owner/repo`: [Installing programs](https://fzkuji.github.io/OpenProgram/docs/capabilities/installing-programs.html). Loader: `openprogram/programs/_host/registry.py`. Recorded sources: `openprogram/programs/_host/sources.py`.

## Entry point

```
"""Entry point for the Foo harness."""
try:
    from .foo_agent import foo_agent, foo_helper
    PROGRAM_ENTRIES = [foo_agent, foo_helper]
except Exception:          # missing optional dep, unsupported platform
    PROGRAM_ENTRIES = []
```

Importing fires the `Agent` method decorators, which register into the shared tool registry; the list is also the declared public surface. Cause of a failed load: `OPENPROGRAM_DEBUG_REGISTRY=1`.

## Conformance

| Rule | Detail |
| --- | --- |
| Package | Inner `<pkg>/` folder name equals import name; the harness root goes on `sys.path`. A hyphenated repository folder is fine. |
| `PROGRAM_ENTRIES` | Always defined, even as `[]` |
| `try`/`except` | Mandatory: imports that fail yield `[]`, never a raised error. Lets a harness be cloned before its dependencies. |
| Import cost | No model download, network or GUI grab at import |
| Runtime | From the host: a method runs on the Runtime of its call, uses `llm()` / `agent()`, and declares no `runtime` parameter. A second model is a second Agent instance configured where the run starts. Never build a provider or read `ANTHROPIC_API_KEY` on the in-host path. A separate standalone CLI may call `create_runtime(...)`. |
| Configuration | Works with zero configuration; no required file, wizard or first-run prompt |
| State | `get_state_dir() / "harnesses" / "<pkg>"` from `openprogram.state.paths`. Never the retired `~/.agentic` or another hardcoded home path. |
| `openprogram` | Not a Git dependency: `pip install <harness>` would re-fetch and possibly downgrade the host. Document it as an assumption. |
| Own dependencies | Declared in `pyproject.toml` or `requirements.txt`; installed by the harness's install step, never automatically by the host. Heavy or native ones behind an extra. |
| Platform | Unsupported here is `PROGRAM_ENTRIES = []`, through the `except` or a `platform.system()` check, never `NotImplementedError` at import. Detect backends at runtime (`shutil.which`, `importlib.util.find_spec`); per-OS setup in the README. |

**Configuration convention**

The standard is the mechanism, not the parameters.

| Kind | Where |
| --- | --- |
| Varies per call | Function argument with a default |
| Machine-level | Environment variable with the harness's prefix, documented in its README, such as `WAH_VAULT` |

```
from openprogram import Agent

class HarnessAgent(Agent):
    method_options = {"foo_agent": {"tool": True, "name": "foo_agent"}}

    def foo_agent(self, task: str, max_steps: int = 15) -> dict:
        ...
```

```
[project.optional-dependencies]
ocr = ["easyocr"]
```

**Vendored packages**

A harness may vendor sibling packages such as `third_party/`. The host takes the one package with an `agentics/` sub-package as the entry; the others ride along on `sys.path`.

## Discovery

| When | What |
| --- | --- |
| Startup | Imports every matching folder |
| While running | The web worker polls the Programs directory and recorded sources every 2 seconds and runs the same discovery; `POST /api/programs/refresh` is the same path. New tools broadcast `programs:changed`, so UIs list them without a restart. |
| Removing or replacing | Needs a worker restart: rescanning only adds harness tools |

## Implementation status

| Harness | Gap |
| --- | --- |
| Wiki | Entry point, `PROGRAM_ENTRIES` and `try`/`except` are present. Default vault path still uses the retired `~/.agentic/memory/wiki`. Still declares `openprogram @ git+…`. |
