# Programs source categories

The explorer has two roots, `tools` and `applications`, and follows the installed source hierarchy under each. The browser never invents category paths.

## Rows

| Row | Evidence | Shows | Actions |
| --- | --- | --- | --- |
| `tools` | Directories beneath the installed package | The 11 purpose directories below | Read-only catalog |
| `tools/<purpose>/<source>` | Python source plus registration metadata | One callable: one row. Several callables: one expandable group of them. | Favorite and Use act on the callable |
| `tools/<purpose>/<package>` with entries | Packages in `registry.TOOL_PROGRAMS` (`tools/planning/goal`) | Expandable: registered entries and supporting source files | Favorite and Use act on the entry |
| `applications` | `registry.builtin_application_names()`, `program_directory.program_dirs()`, `catalog.records()`, `sources.owner_controlled_program_sources()` | One row per application, sorted by name; `origin` `builtin` or `installed`; `enabled` where tracked; `load_state` for a user package | Favorite and Use act on the entry; settings on the Applications page or `openprogram programs enable\|disable` |
| `applications/<name>/…` | Registered entries under the catalog path, then top-level Python files | Entries of kind `application`; supporting files as source rows. A harness clone has no children; its call logic is the repository analysis. | Existing call tree and graph |

A catalogued application whose source is a user package directory is that package's row; one inside another application's directory is its own row with `part_of`.

## Tool directories

| `openprogram/programs/tools/` | Modules | Packages |
| --- | --- | --- |
| `agents` | mixture_of_agents | agent, send_message |
| `code` | execute_code | lsp, semble |
| `computer_use` |  | computer_use |
| `files` | apply_patch, edit, glob, grep, list, read, terminal_use, write, write_stdin | bash, worktree |
| `interaction` | always_on_preference, always_on_report, always_on_schedule, ask_user, canvas, chat_send, clarify, handoff, send_file |  |
| `jobs` | routine | cron |
| `knowledge` | read_conversation | memory |
| `planning` |  | goal, open_work, plan_mode, todo |
| `runtime` | framework, help, plugin, program, resource, skill | mcp_meta |
| `system` |  | self_update |
| `web` | pdf, web_fetch | image_analyze, image_generate, web_search |

One implementation file is a module. Providers, prompts, actions, workers, shared state or several cooperating entries make a package, and one package may register several callables. Public callable names are unaffected by location.

## Behaviour

| Aspect | Behaviour |
| --- | --- |
| Expansion | Lazy, one level per `GET /api/programs/explorer` request, with `tools/…` and `applications/<name>/…` as callable-first rows |
| First selection | Root response `default_selection`: the first application, or the first tool |
| Singleton | `computer_use/computer_use/` has many files and one callable, so it is one row, not a wrapper plus that callable |
| Refresh | Rescans Programs and reloads the same endpoint |
| `GET /api/tools` | Runtime callables with MCP tools and display groups; defines no Programs folders |
| MCP | Rows with source `mcp` never appear; MCP Servers is their only page |
| Agentic Functions | Listed by public callable name; source path is only for static call analysis |
| `program_kind` | `tool`, `application`, `runtime_primitive` (the `agent` and `llm` call-graph nodes), or null for a supporting file. Use passes it as the launcher's `cat`. |
| Both roots | Favorites, chat launch, call tree and graph work the same |

## Application function calls

| Aspect | Behaviour |
| --- | --- |
| Source | Current package source on each request; starts at decorated public functions, follows local calls and package imports |
| Excluded | Tests, benchmarks, unrelated files, external libraries and object methods |
| Conditional calls | Labelled conditional, not a fixed sequence; tree and graph share the same nodes |
| Unresolved calls, limits | Reported. Package code is never executed for analysis. |
| Refresh | While the page is visible |
| Call tree | First three levels expanded; branch rows toggle with click, Enter or Space; choices survive refreshes for the selected Program; leaves and repeated references have no toggle |

## Application discovery and import

- A built-in or user directory is an application only with `__init__.py` or `application.json`. A symbolic link resolving outside its root is skipped. Registered nested entries stay visible through their category paths.
- User packages in `~/.openprogram/programs/` import built-ins at `openprogram.programs.tools.*` and `openprogram.programs.applications.*`, and helpers from `openprogram.programs._authoring`. `openprogram.programs.Agents` and `openprogram.programs.workflow` do not exist.
- App refresh keeps a valid explicit owner Programs catalog across build checkouts. A missing configured catalog needs repair and is never replaced by an empty build directory. Explicit relocation remains; first installation may establish the catalog.

## Direct function replies and input

A manually run function keeps its execution tree, with its persisted final answer as a Markdown body below, visible even with the tree collapsed. This adds no model call or conversation node. Summaries and takeover instructions stay readable; other values show as text or JSON; nested calls are unchanged. The selected execution detail follows status updates without opening the sidebar.

Empty function forms size from visible fields: a closed Advanced section contributes only its summary row.

**Alternatives and references**

| Reference | Model | Here |
| --- | --- | --- |
| OpenProgram registry | Regular and agentic functions in one callable surface with source metadata | Keep one runtime catalog; read-only source filters only in the management UI |
| Hermes toolsets | Named toolsets mean selection, not ownership | Tool profiles stay separate from source categories |
| [Claude Code](https://github.com/anthropics/claude-code) | Its internal tool tree is not published | Do not copy an unverifiable one-folder-per-tool assumption |
| [OpenAI Codex](https://github.com/openai/codex/tree/main/codex-rs/core/src/tools) | Handler files and submodules both appear | Same complexity-based split, no Rust-specific names |

Rejected: every callable in a directory, every source in one file, frontend-only categories, a second category registry, compatibility copies at old import paths, raw source-file browsing, duplicating MCP tools in Programs.

**Acceptance**

- Every shipped tool source lives under exactly one purpose directory, with no old top-level source.
- `computer_use` is directly visible, with logic path `tools/computer_use/computer_use`.
- The built-in browser is an application. Every application is listed under `applications/`.
- All registered callable names remain available.
- The packaged `gui_agent` entry begins a desktop run without an import error; application packages import no removed namespace.
- Covered by explorer and registry tests, an import smoke test, the Programs UI check, TypeScript compile and build.

## Implementation status

| Status | Items |
| --- | --- |
| Implemented | Purpose directories, mixed module and package discovery, singleton rows, source tracing, conditional edges, visible-page refresh. Regression tests cover source edits, entry selection and unresolved aliases. |
| Not verified | Installed-App visual check of the call view |
