OpenProgram Docs

Repository structure implementation

Implementation map

ResponsibilityLocationBoundary
Agent core and SDKopenprogram/Shared runtime code
HTTP and WebSocket serveropenprogram/interfaces/server/server.py assembles; the modules beside it own transport handlers and helpers; routes, Agent profiles included, are grouped by product domain under routes/
Web applicationapps/web/Source; generated assets are staged for serving and packaging
Desktop applicationapps/desktop/Electron lifecycle, native integration, embedded browser, packaging
Python CLIopenprogram/interfaces/cli/Parser, commands, interactive execution, setup
Ink terminal UIapps/cli/Node workspace and terminal UI build
Release assemblyscripts/release/Runtime construction, asset staging, release verification
Repository maintenancescripts/One folder per purpose: local instances, publishing, generators, checks, maintenance commands, documentation builder, test selection, benchmarks, Git hooks

Entries and compatibility

EntryRuns
openprogram, python -m openprogram, python -m openprogram.interfaces.cliopenprogram.interfaces.cli.application.main
python -m openprogram.interfaces.serverA foreground Server

Every importer, tests and scripts included, names the real module. Editable installs and wheels both need no PYTHONPATH.

Core-to-interface ports

The core never imports an interface. It calls a port the interface registers when it loads.

PortCarriesRegistered by; if nothing is
openprogram/host/resources/desktop_link.pyDesktop windows and Pages: binding, resolving, capturing, closing, sending a command to one exact connectionws_actions/webtab.py. An agentic subprocess installs its parent bridge on the same port and forwards Page requests without loading the Server. Unregistered: as if no client were connected.
openprogram/runtime/interface_link.pyClient notices (goal, todo, open work, title, branch list, native window and execution-stream frames, context ring), the Server's in-memory session, HEAD moves that update it, the busy check for session migration, shipped documentation pagesserver_runtime/interface_link.py, registered by server.py. Unregistered: as if no client were connected.
openprogram/runtime/channel_link.pySending to a channel conversation (reminders, always-on reports), accounts and peer bindings for always-on delivery, the running channel turn chat_send posts intointerfaces/channels/link_registration.py, on import of openprogram.interfaces.channels. Unregistered: raises ChannelsUnavailable, recorded as a failed send.
openprogram/runtime/speech_link.pySpeech to text for computer-use recordingsinterfaces/speech/link_registration.py, on import of openprogram.interfaces.speech. Unregistered: raises SpeechUnavailable, a TranscriptionError the tool reports as not transcribed.

The worker runner imports channels and speech before its job dispatcher starts, the Server when it loads, a CLI turn before running tools in process.

Only composition roots import an interface: openprogram/__main__.py runs the CLI; openprogram/operations/worker/runner.py starts the Server, its runtime and frontend. The core interface import contract scans every module, function-local and string imports included.

Logic that lives in the core and the Server imports
LogicLocation
Session graphopenprogram/state/store/session/graph/
Execution DAG projection, live progressopenprogram/runtime/execution/projections/dag.py
/spawn, /mergeopenprogram/runtime/conversation/turn_runtime/slash_actions.py
Runtime-control submissionopenprogram/runtime/execution/control/submission.py
Model listingopenprogram/models/listing/
Credential maskingopenprogram/host/security/credential_mask.py
Installer, dependencies and the installed App
  • scripts/install-release.sh stays the public installer entry; its implementation is under scripts/release/.
  • The root npm workspace and lock coordinate Web, Desktop and CLI. Do not assume a separate lock or install below an application.
  • A dependency patch keeps the application manifest, root lock and installed version aligned. Integrating duplicate dependency branches keeps both ancestries without duplicating the version change.
  • The lock keeps transitive entries installed consumers need, optional graphs included. A clean installer exit does not prove consumers load, so public consumer import checks accompany cold installation, and the combined source runs the shared verification manifest before publication.
  • The default runtime uses port 18100 and ~/.openprogram. Layout changes preserve packaging and installed imports as well as source-checkout execution.

Verification

uv run --locked --extra dev python -m pytest -q tests/contracts/repository/test_repository_layout.py

The contract checks directory ownership, application locations and compatibility, not runtime behaviour. An implementation change also exercises the affected public CLI or HTTP/WebSocket entry, builds a wheel and checks imports outside the checkout, and verifies affected packaging. Contributor checks and the test-system design select the gates.

Documentation changes rebuild first, because the checker reads docs/_site/:

python -m scripts.docs_site.build
python -m scripts.docs_site.checklinks

Module organization and file-operation safety

UnitRule
Feature moduleOwns its types, state and private helpers
FolderOne concern: modules that share a meaning sit in a sub-package named for what they are for. None is made for one or two files, and none is a utility bucket
Large fileSplits at independently testable responsibilities; public entries stay stable; no wildcard forwarding, duplicate implementations or dynamic source execution to meet a line count

File-operation contract

OperationRule
ClipboardEntries identify their source project; cross-project paste is unavailable until an explicit transfer operation exists
MutationActs on the selected entry. Symbolic-link targets are never implicitly renamed or deleted; unsafe paths fail without changing either entry
DeletionRecoverable where supported. Exporting an unsaved draft does not authorize erasing the only confirmed copy; an unconfirmed browser download keeps the local draft
RefreshRepeats the active search with its unchanged query, with request-generation isolation

Public WebSocket regression tests cover symbolic links; mounted Web tests cover clipboard ownership, active-search refresh and draft preservation.

Module responsibilities
AreaSplit
Execution controlActivation, cancellation, waits, branch operations, recovery, safe points, on one service instance
Execution storageRecords, commands, events, state blobs, projections, finish repair, with one store and its transactions
Conversationsession_settings/ what a session or branch runs with; turn_admission/ typed text or an owner event becoming a turn; rewinds/ rewind, undo and redo; peer_agents/ turns agents run for each other; layer_registrations/ what the package registers with the layers below on import
Execution views, recovery and admissionprojections/ read-only views of run state (Activity, foreground, DAG, execution tree); recovery/ checkpoints, effects, startup and restart recovery; admission_input/ what is frozen on a turn or Job at admission
Contexttoken_accounting/ estimating, budgeting and reporting tokens; prompt_assembly/ system-prompt components, guides and per-turn notes; session_dag/ reading the DAG as model history; compaction/ fitting history into the window
Session storagefiles/ the files of a session directory and how they are placed, locked and written; reading/ transcript, export, search, summaries, provenance
Permissionsauto_mode/ Auto mode's review of an operation; approvals/ approval waits and their file preconditions; the decision vocabulary stays at the package top
Channelsinbound/ from a platform message to an agent turn; delivery/ getting a reply onto the platform
Provider utilitiesstreams/ the event stream of one response; http_transport/ clients, proxy, timeouts, rate limits; failures/ classifying a failed request and mending or failing it over
CLICommand modules sit in commands/capabilities/, commands/conversations/, commands/services/, commands/maintenance/ and commands/updates/; print_mode/ holds an openprogram --print run
Jobs, resource governance, Agent production execution, workflow runtime, session storageOperation modules share the owning instance and canonical module state
Desktop mainComposes window and IPC registration with modules for transfers, native views, layout, menus, downloads, overlays. The manifest includes nested modules; the refresh script keeps their relative paths
Web Desktop bridgeState, restoration, transfers, menus, events, surfaces; file-tree actions and query helpers keep the request lifecycle
Server runtimeOperations share the canonical Server state
Self-update verificationBinds the packaged WebSocket dispatch module that enforces its command restrictions; accepts previous package layouts for rollback
Server filesFile actions and turn-file history are separate packages
Authentication, self-updateAuthentication groups account and login orchestration; self-update groups verification, repair and delivery
TestsKeep their execution layer, add feature directories; discovery includes nested tests. Large check files keep all scenarios, common fixtures and deterministic discovery. Subprocess acceptance is integration layer. Relocation preserves collected test identities and installed imports
Test feature foldersNamed after the source package or concern they exercise. Unit: context/ (compaction, system_prompt, render, tool_results, statistics), store/ (session, file_history, project), webui/ (transcript, branches, chat, settings), providers/adapters/ (anthropic, openai, openai_codex), programs/tools/computer_use/. Component: store/ (session, file_history), execution/ (store, control), webui/ (transcript, owner_auth), providers/adapters/ (openai_codex, openai_completions, structured_output), config/ (windows, docs_site, office_editor). tests/e2e/web/: chat, files, browser_tabs, applications. A new folder is a package exactly when its parent is one
Application testsA test sits in the folder of what it exercises. A test that spans groups, and shared helpers, stay directly in the feature folder
apps/web/testsA second level inside a feature where the source has one: chat/messages/ (bubbles, cards, execution, list), chat/composer/ (attach, input, controls, submit), chat/transcript/ (rows, streaming, with the contract and replay tests beside them), browser/ (pip, control, bookmarks, web-tab), files/ (explorer, documents, paths), settings/ (providers, memory, scheduler, appearance), execution/ (activity, recovery, debugger), tabs/ (canvas, strip), ui/ (popups, rails)
apps/desktop/testsFollows apps/desktop/main: windows, web-views, self-update, terminal, worker
apps/cli/testsstartup, input, rendering, repl, commands
Activity panelapps/web/components/right-sidebar/running/ keeps the overview panel; pages/ the second-level pages (frame, row, geometry, wording, one page per kind); runs/ the run list and one run opened in place; agent-chart/ an Agent's time chart
Left wholeGenerated Yoga bindings, vendored Ink renderer, peer provider adapters, Desktop main's composition, native terminal rendering, cohesive route collections, checkpoint transactions, security HTTP policy

Direct code files (Python, JavaScript, TypeScript) per directory; feature subdirectories hold the rest.

DirectoryDirect code files
apps/web/lib7
apps/web/tests0
openprogram/operations/self_update3
openprogram/interfaces/server/routes7
tests/component/webui4
tests/unit/providers5
Release acceptance for structure changes
AreaRequirement
ReviewIndependent specification and quality review
PythonThree consecutive complete runs with four workers
Web and CLITests and type checks
Desktop and applicationsDesktop checks; application builds
Docs and browserDocumentation links; browser interaction tests
PackagingInstalled-wheel imports outside the checkout
Test cleanupUses the canonical SessionStore cache
Native recoveryWaits for actual startup and shutdown within explicit deadlines
External Office packOnly when that pack is supplied

Implementation status

AreaStateCovered by, or remaining
Application roots, CLI ownership, maintenance scriptsVerifiedWorkspace checks and installed-wheel acceptance
Server ownershipVerifiedGrouped routes, packaged assets and Server operations in the shared regression manifest
Desktop and Web decompositionVerifiedNative-view ownership, bridge state, transfer coordination, file operations and nested packaging keep executable coverage
Documentation structureUnder reference/design/One current topic owner
Release and installed AppPer targetInstalled-App checks and remote publication are separate from source regression results

Long files are not automatically pending work. A further split needs a separate responsibility and behavioural coverage.

Last updated · 2026-11-25