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
Principle
Means
Core and applications are separate
Core 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 boundaries
Move 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 stable
CLI 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 records
This page is the long-term structure; Repository structure implementation holds locations, compatibility and verification. Git holds history.
Python core and packaging
Aspect
Rule
Core top level
Only 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/.
Server
routes/, 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.
CLI
apps/cli/ holds only the Ink client (src/, tests/, package.json). openprogram.interfaces.cli re-exports main and build_parser from application.py.
Distribution
One 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 state
Tool 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.
Skills
None 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.
Tests
tests/<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
Aspect
Rule
React versions
Web 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 homes
apps/<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 installer
scripts/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 paths
scripts/install.sh, scripts/install.ps1, scripts/install-release.sh, scripts/install-release.ps1: install commands and released builds fetch them by these paths.
Root files
Only the two ecosystems' entry files and lockfiles, project metadata and entry documentation. .github/ is repository infrastructure.
Large files
File
State
Rule
apps/desktop/main.js
Composition 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.js
Move 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.ts
A small aggregate; state, restoration, transfers, menus, events and surfaces are in bridge/; types in desktop-bridge-types.ts and desktop-transfer-types.ts
Keep the aggregate entry
Runtime state-machine modules
Concentrated invariants
Do not split by length; split only for independently verifiable responsibilities or duplicates. No mixin layer.
Large Web and Desktop check scripts
Fixtures, scenarios and structural assertions together
Extract shared fixtures and independent scenarios first; keep command entries; no test framework just to shorten files
Documentation
Kind
Where
User documentation
start/ install/ capabilities/ interfaces/ models/ integrations/ server/ reference/; public navigation and search
Current design
reference/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 records
Beside the design page and in reference/design/plans/: boundaries, verification, remaining work. Status together at the end; no copied design or commit logs.
One home
Engineering 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.
READMEs
Root: 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
Choice
Result
Reason
Root openprogram/ core plus apps/
Adopted
The core stays a top-level project entry; non-Python clients are visible under apps/
Move-only application migration
Adopted
Paths, builds, imports and scripts first; splitting later, to avoid concurrent behaviour changes
Organize design pages in subsystem folders
Adopted
A page's folder says which subsystem it belongs to; the old URL of a moved page stays in docs/redirects.json
Rename openprogram/ to backend
Rejected
It is the Agent core and SDK; Server is one application entry
Keep Server in openprogram/webui/
Rejected
Mixes server code, old static UI, build artifacts and Web naming
Split by fixed line count
Rejected
Line count is not a responsibility and yields forwarding-only modules
Dependency-injection framework
Rejected
Module functions and explicit parameters keep the boundaries
Move all applications in one commit
Rejected
Not reviewable
What must stay true
Layers
Boundary
Rule
Core package
openprogram/ outside interfaces/ has no FastAPI routes or WebSocket handlers; no frontend or Electron source, no persisted frontend build artifacts.
Interfaces
openprogram/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.
CLI
openprogram.interfaces.cli.main and build_parser stay importable, with the full command tree, console script and TUI.
Port
Default port 18100; one Worker serves API, WebSocket and Web static files, no dual-port Next.js Server.
Web and Electron
Browser and Electron load the same Web application; Electron-only capabilities go through preload/IPC.
Agent Harness
Agent 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
Boundary
Rule
Published docs
Every 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 navigation
Design 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 directories
Git-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 paths
READMEs, skills and install instructions name no deleted source-root paths; no root web/, desktop/ or cli/.
Package READMEs
Top-level Python package READMEs stay in sync with __init__.py docstrings.
Structural batches
Each structural batch is committed alone and passes directly affected tests before specification and quality re-review.