OpenProgram Docs

Repository structure

OpenProgram/
  apps/
    web/         Next.js Web application
    desktop/     Electron desktop application
    cli/         Ink terminal client
  openprogram/   Agent core, Python SDK and the Python interfaces
    interfaces/server/  FastAPI, HTTP, WebSocket, authentication, static hosting
    interfaces/cli/     Python CLI: parser, dispatch, Rich fallback, setup
  tests/         Python tests: layer / product domain / feature
  docs/          User documentation and design records
  scripts/       Development, validation and release tools
  references/    Reference implementation snapshots
  website/       Official website source
  translations/  Root README in other languages
  pyproject.toml Single Python aggregate-project configuration
  uv.lock        Sole Python lockfile
  package.json   npm workspace entry
  package-lock.json  Sole npm workspace lockfile

Principles

PrincipleMeans
Core and applications are separateCore domains never depend on applications. The core holds no compatibility namespace: Server and CLI modules are imported as openprogram.interfaces.server.* and openprogram.interfaces.cli.*.
Split along verifiable boundariesMove code only when it has independent inputs, outputs and test entries. A mixin, manager or facade made only because a file is long is not a split. Inside a package, modules that share a meaning sit in a sub-package named for what they are for; no folder for one or two files, no utility bucket.
Public interfaces stay stableCLI commands, HTTP/WS protocols, ports, user-data directories, necessary Python imports. Each application is moved, verified and committed on its own.
Design is apart from implementation recordsThis page is the long-term structure; Repository structure implementation holds locations, compatibility and verification. Git holds history.

Python core and packaging

AspectRule
Core top levelOnly independently explainable domains: runtime/, programs/, models/, state/, host/, extensions/, operations/, interfaces/. Sub-capabilities live in their domain, such as Context's Git DAG in runtime/context/git/.
Serverroutes/, ws_actions/, server_runtime/ and top-level modules; openprogram.interfaces.server.server assembles the app. Every module has one name and one copy of its state.
CLIapps/cli/ holds only the Ink client (src/, tests/, package.json). openprogram.interfaces.cli re-exports main and build_parser from application.py.
DistributionOne user-installable openprogram wheel with core, Server and Python CLI, found by package discovery, so wheels, editable installs and checkouts share one layout. No memberless [tool.uv.workspace], no three public distributions.
packages/Not created. Reconsider only when a second shared package has a stable public entry and at least two consumers.
Profile stateTool configuration, favorites and the like are written to ~/.openprogram[-profile]/, never stored as source or wheel seeds. Compatibility reads check only the legacy openprogram/webui/ location, copy once into profile state and never depend on Server module paths.
SkillsNone shipped; Programs provides built-in workflows. openprogram/extensions/skills/ only loads AgentSkills-compatible skills from remote caches, plugins, ~/.openprogram/skills/ and <cwd>/skills/. No skills_bundled/ or hidden copy.
Teststests/<layer>/<product-domain>/test_*.py, layer chosen by the strongest actual dependency. A domain with many tests has feature folders named after the source package or concern they exercise, such as tests/unit/context/compaction/, tests/unit/store/session/, tests/component/execution/control/ and tests/e2e/web/chat/; a feature folder holds at least three tests. See Testing system.
Not structure__pycache__/, .DS_Store, build artifacts and Finder conflict copies stay ignored. User-installed programs/packages/ checkouts are product data and survive reorganization.

Node workspaces and scripts

AspectRule
React versionsWeb pins React 18, Ink CLI React 19. npm hoisting can leak shared peers, so the private root package declares exact React 18, react-reconciler 0.29 and type versions as layout constraints. CLI's React 19 and react-reconciler 0.33 stay in its workspace; it uses no third-party hook package that resolves React from the root.
Script homesapps/<name>/scripts/ for one application, scripts/ for cross-application tools, one folder per purpose: local-instances/ (the stable and development Apps), publishing/ (GitHub), generators/ (derived files), checks/ (checks and smoke runs), maintenance/ (hand-run tools for an installation's state), docs_site/, testing/, benchmarks/, git-hooks/, release/ (runtime, installer, release). Only the install entries lie directly in scripts/.
Public installerscripts/install-release.sh is a compatibility entry. In a full checkout it runs scripts/release/install-release.sh; downloaded alone, it fetches that file from the same verified repository and immutable tag into a temporary file, then runs it.
Fixed pathsscripts/install.sh, scripts/install.ps1, scripts/install-release.sh, scripts/install-release.ps1: install commands and released builds fetch them by these paths.
Root filesOnly the two ecosystems' entry files and lockfiles, project metadata and entry documentation. .github/ is repository infrastructure.

Large files

FileStateRule
apps/desktop/main.jsComposition root, about 2,000 lines; pure parts are in main/windows/menu-geometry.js, main/worker/worker-recovery-state.js, main/web-views/tab-transfer-validation.jsMove HTTP probing, process and window lifecycles, native WebView ownership, transfer coordination and menu hosting only with execution-level acceptance
apps/web/lib/desktop/desktop-bridge.tsA small aggregate; state, restoration, transfers, menus, events and surfaces are in bridge/; types in desktop-bridge-types.ts and desktop-transfer-types.tsKeep the aggregate entry
Runtime state-machine modulesConcentrated invariantsDo not split by length; split only for independently verifiable responsibilities or duplicates. No mixin layer.
Large Web and Desktop check scriptsFixtures, scenarios and structural assertions togetherExtract shared fixtures and independent scenarios first; keep command entries; no test framework just to shorten files

Documentation

KindWhere
User documentationstart/ install/ capabilities/ interfaces/ models/ integrations/ server/ reference/; public navigation and search
Current designreference/design/, one folder per subsystem; a large subsystem has one folder per topic group, such as providers/requests/, integrations/computer-use/, runtime/agent/ and ui/transcript-model/. Only the index and the framework overview sit directly in it. UI documents group into foundations, conversation editing, browser tabs, settings/catalog and workspace
Implementation recordsBeside the design page and in reference/design/plans/: boundaries, verification, remaining work. Status together at the end; no copied design or commit logs.
One homeEngineering records live only under docs/reference/design/, one per topic. Tool-generated plans and ledgers stay out of docs/; lasting content folds into the topic page. Plans current designs still reference are published in a Plans group.
READMEsRoot: the product, in English; its translations are in translations/. openprogram/README.md: the core SDK. openprogram/interfaces/server/, apps/web/, apps/desktop/, apps/cli/: each entry's current responsibilities, dependency directions and verification commands.

Choices

ChoiceResultReason
Root openprogram/ core plus apps/AdoptedThe core stays a top-level project entry; non-Python clients are visible under apps/
Move-only application migrationAdoptedPaths, builds, imports and scripts first; splitting later, to avoid concurrent behaviour changes
Organize design pages in subsystem foldersAdoptedA page's folder says which subsystem it belongs to; the old URL of a moved page stays in docs/redirects.json
Rename openprogram/ to backendRejectedIt is the Agent core and SDK; Server is one application entry
Keep Server in openprogram/webui/RejectedMixes server code, old static UI, build artifacts and Web naming
Split by fixed line countRejectedLine count is not a responsibility and yields forwarding-only modules
Dependency-injection frameworkRejectedModule functions and explicit parameters keep the boundaries
Move all applications in one commitRejectedNot reviewable

What must stay true

Layers

BoundaryRule
Core packageopenprogram/ outside interfaces/ has no FastAPI routes or WebSocket handlers; no frontend or Electron source, no persisted frontend build artifacts.
Interfacesopenprogram/interfaces/server, apps/web, apps/desktop and apps/cli each have their own entry, README, test and build commands. apps/tailnet is the Go sidecar behind Open from anywhere, built into the runtime by scripts/release/build-tailnet.py.
CLIopenprogram.interfaces.cli.main and build_parser stay importable, with the full command tree, console script and TUI.
PortDefault port 18100; one Worker serves API, WebSocket and Web static files, no dual-port Next.js Server.
Web and ElectronBrowser and Electron load the same Web application; Electron-only capabilities go through preload/IPC.
Agent HarnessAgent Harness imports openprogram without Server, Web or Desktop.

Build and state

  • No old static UI or old dual-port implementations; no Server or CLI compatibility namespace in the core.
  • Frontend build artifacts enter only ignored build or staging directories and final distributions.
  • Mutable profile state is outside the source tree and wheel; old package-local JSON is only upgrade input and is untracked.

Docs and repository

BoundaryRule
Published docsEvery folder under docs/ except build output and static-only folders is published; engineering records sit under docs/reference/design/; every public link is valid.
Design navigationDesign pages sit in the folder of their subsystem and navigation groups them by product capability; every retired URL has an entry in docs/redirects.json.
Top-level directoriesGit-tracked top-level directories are declared in the structure contract. Development scripts and README translations are not at the root; source-checkout module entries without implementation are listed by the contract.
Source-root pathsREADMEs, skills and install instructions name no deleted source-root paths; no root web/, desktop/ or cli/.
Package READMEsTop-level Python package READMEs stay in sync with __init__.py docstrings.
Structural batchesEach structural batch is committed alone and passes directly affected tests before specification and quality re-review.

Repository structure implementation

Last updated · 2026-11-25