Release, Installation and Runtime Layout
Status: proposal (2026-11-19); S1, S2, S3a, S3b, S4, S5a, S5b and S5c built (2026-11-19, run natively on macOS only; Linux and Windows unverified), the rest not built. This documen
Status: proposal (2026-11-19); S1, S2, S3a, S3b, S4, S5a, S5b and S5c built (2026-11-19, run natively on macOS only; Linux and Windows unverified), the rest not built. This document defines Orquelo's release artifacts, the layout of an installation in ~/.orquelo, the configuration file, plugin create/read/update/delete, the multi-tenant, multi-user data layout, and starting, restarting, reloading, upgrading and graceful shutdown. The owner settled part of section 12 on 2026-11-19; the remaining questions are settled before implementation, and cases come first through vq spec per AGENTS.md section 13.
1. Background and goals
Current state (checked in code, 2026-11-19):
- ◆The Host runs from the repository as
./bin/orquelo serve -c examples/feishu.yamlwithstate_dir: ../data/feishu; secrets live in~/.config/orquelo/feishu.env, sourced by hand. There is no release artifact, installer or process supervision. - ◆At 11:09 on 2026-11-19 the Agent ran
kill 89629in its own shell and then tried to restart; theORQUELO_SHELLguard (commit0412480) refused the restart and the Feishu Host stayed down for more than five hours. The root cause is no supervisor: nothing brings a killed Host back. - ◆Already built: one
host.lockper state directory;orquelo reloadswitches to a new generation through thecontrol_requeststable; on exit in-flight runs get 10 seconds before they are cancelled, and the rest is left to restart recovery; every data table carriestenant_id/user_id; the tenant comes fromconnections[].tenant; each plugin instance has a privateDataDir(state_dir/plugins/<instance>);orquelo plugin install/uninstall/add/enable/disable/removeexist.
Goals:
- One command installs or upgrades:
curl -fsSL …/install.sh | sh, andinstall.ps1on Windows. - A fixed, predictable layout:
ORQUELO_HOME(default~/.orquelo), with program, configuration, plugins, data, logs and cache kept apart. orquelofinds its configuration without-c.- The Host is supervised by the system service manager (launchd / systemd --user / Windows scheduled task) and comes back after being killed or crashing; restart, upgrade and graceful shutdown each have defined semantics.
- File data of many tenants and users is kept in per-tenant and per-user directories whose paths the Host decides, so a plugin cannot reach another user's directory.
Non-goals (deferred until a real scenario): multiple nodes, a remote plugin market, several versions of one plugin side by side, a system-wide install (/opt, /etc, /var/lib), container images, one database per tenant, a Windows Service.
2. Prior art
| Topic | Projects | What we take |
|---|---|---|
| Install script | rustup, Bun, Deno, uv | curl | sh into the user's home without root; sha256 check; add bin to PATH by default through the shell startup files or the Windows user Path; --no-modify-path opts out and prints the hint (owner, 2026-12-04, for orq; terminal UI section 6.5) |
| Version switching | rustup toolchains, nvm, Homebrew Cellar | immutable releases/<version>/, bin/orquelo points at the current one; upgrading switches the link |
| Layout | Grafana (conf/data/logs/plugins), Gitea (custom/data/log), Jenkins JENKINS_HOME | one HOME variable governs everything; configuration, data, logs and plugins never mix |
| Configuration lookup | Codex CODEX_HOME, Claude Code CLAUDE_CONFIG_DIR, kubectl KUBECONFIG | flag > environment variable > default path under HOME |
| Plugin management | VS Code extensions, Grafana grafana cli plugins, Helm plugins, Claude Code /plugin | an installed package is distinct from an enabled instance; manifest plus pinned source and digest |
| Supervision | Ollama, Syncthing, Tailscale, brew services | supervised by launchd / systemd / a scheduled task; crashes are restarted; start at boot is a switch of its own |
| Reload and exit | nginx (HUP reloads, QUIT drains), Caddy, PostgreSQL (smart/fast/immediate), Kubernetes termination grace | stop admission → drain → cancel → force, each further signal escalating |
| Upgrade and migration | Gitea, Grafana, PostgreSQL | back up the database before migrating; refuse to open a newer database with an older binary |
| Multi-tenant data | Grafana org_id, Mattermost team_id, Nextcloud data/<user>/ | one database with tenant columns; files in per-tenant/per-user directories, easy to export and delete |
3. Release artifacts
- ◆GitHub Releases (
jazy333/orquelo). The repository is private for now and will be open-sourced: while private, the installer fetches files throughgh release download(a signed-ingh) orGITHUB_TOKEN(release asset download through the GitHub API); once public, through anonymouscurl. The script supports both. Each version publishesorquelo_<version>_<os>_<arch>.tar.gz(.zipon Windows) fordarwin/arm64,darwin/amd64,linux/amd64,linux/arm64andwindows/amd64, pluschecksums.txt(sha256). Signatures (minisign or cosign) come with the open-source release. - ◆Contents: the
orquelobinary;plugins/, the manifest and process plugin directories shipped with the release (such asrail-12306andorquelo-docs);LICENSE;THIRD_PARTY.md, the notices of included third-party material;VERSION;deps/<plugin>/, what builtin plugins need beside the binary, listed with sha256 inscripts/shipped-deps.txt(the model worker and ONNX Runtime indeps/onnx, the models of local OCR and of local speech indeps/parse-ocranddeps/parse-speech; nothing on macOS amd64). Builtin plugins are compiled into the binary. - ◆Versions follow semver;
version,commitanddateare injected with-ldflags -X, andorquelo versionprints them with theschema_version.plugin.HostVersionreads the injected value. - ◆
make releasecross-compiles withgo buildand packs the archives with a script; no goreleaser (section 9 of AGENTS.md: avoid new dependencies). The CI workflow (.github/workflows/ci.yml) builds, vets and tests natively on Linux, macOS and Windows on every push and pull request (native model APIs, section 7); it does not build or upload releases.
4. Install and upgrade
Installing and running are two separate things (decided 2026-11-19). Installing only puts a version on disk and switches to it, both the first install and every later version update; running (start, stop, restart, start at boot) is section 9. Installing never turns on start at boot; the one overlap is that an upgrade triggers the graceful restart of section 9 when the Host is running under supervision.
One command for the first install and for upgrades:
- ◆Before anything is installed, a bootstrap script:
install.sh(macOS/Linux),install.ps1(Windows). The script only downloads and checks, then callsorquelo install --archive <file>from the archive. The install logic exists once, in Go, shared by the three platforms and testable; each script is about 60 lines. - ◆Once installed:
orquelo install [--version V | --archive FILE]; without arguments it installs the latest version.
curl -fsSL https://github.com/jazy333/orquelo/releases/latest/download/install.sh | sh # once open source
gh release download -R jazy333/orquelo -p install.sh -O - | sh # while private
orquelo install # upgrade to the latest
orquelo install --archive dist/orquelo_0.2.0_darwin_arm64.tar.gz # a version just built hereSources: a GitHub release (through gh or GITHUB_TOKEN while private), or a local archive given with --archive (the output of make release, for trying a new version on this machine, offline installs and remote deployment). Both are checked against the sha256 in checksums.txt next to them (or --sha256) and abort on a mismatch. Development builds carry the commit in their version (such as 0.1.0+dev.68abce9.<build time>), so each build gets its own version directory.
Steps of orquelo install:
- Check the archive.
- Unpack into a temporary directory, then rename it to
releases/<version>/; skip when that version exists (--forcereplaces it). - First install: create the section 5 layout; write the configuration and
secrets.env(0600) withorquelo initwhen missing, never overwriting existing ones. - Upgrade: run
serve --preflight(section 9) with the new binary against the existing configuration and data; on failure stop, leaving the current version in place. - Switch
bin/orquelo: on Unix atomically replace the symbolic link; on Windows rename the runningbin\orquelo.exetoorquelo.exe.old(Windows allows renaming a running file), copy the new one, and delete.oldat the next start. - When the Host runs under supervision, perform the graceful restart of section 9 and wait for the new Host to report
ready(120 seconds by default). If it is not ready in time and the database was not migrated, switch back to the previous version, restart once more and report the failure; if the database was migrated, do not switch back (the old version cannot open the new database) and report the failure with the backup path for the operator. releases/keeps at most 3 versions (the current one plus the two most recent before it), deleting older ones by install time; the running and the current version are never deleted.
Database migration happens when the new Host starts: it first backs up with VACUUM INTO to data/backups/orquelo-<old version>-<time>.db. All pending migrations then run in one transaction that takes the write lock first: a database is never left half-migrated, and processes that open a new database at once, such as serve and a CLI command, wait for each other instead of running a migration twice. A binary whose known schema_version is below the database's refuses to start and points at the backups; there is no automatic down-migration.
Code signing on macOS: the Go linker gives orquelo an ad-hoc signature whose identifier is a.out and which changes with every build; macOS therefore treats each new version as a new program, and the grants for speech recognition, accessibility, screen recording and the like must be given again after every install. A stable signature alone does not help: macOS keys the grants of a bare command-line binary by its path, and each version has its own (found on the live Host on 2026-11-30). So before step 2 renames the directory to releases/<version>/, orquelo install moves the freshly unpacked binary into an app bundle, Orquelo Host.app/Contents/MacOS/orquelo, whose Info.plist names it ai.orquelo.host and gives the reason macOS shows for each protected service a task may ask for (speech recognition, microphone, camera, control of other apps, contacts, calendars, reminders, photos, location, Bluetooth, the local network, user folders and other volumes), in English and Chinese, since macOS kills a bundled app that asks for one without its reason, signs the bundle with a code-signing certificate of the keychain under that identifier (what the desktop agent does with ai.orquelo.desktop), and leaves releases/<version>/orquelo as a link to it; bin/orquelo and the service still start that path, and the binary finds its release from inside the bundle. macOS then keys the grants by the identifier and the certificate, and later versions inherit them. ORQUELO_SIGN_IDENTITY names the certificate (by name or SHA-1 hash); when it is not set, the keychain's single code-signing certificate is used, and none or several leave the bare, ad-hoc signed binary in place, say why and let the install proceed; a setting that matches no certificate, or a failing codesign, aborts and the current version stays. The result's signed_by is the certificate used. A self-signed certificate is enough, no Developer ID: in Keychain Access, Certificate Assistant creates a self-signed certificate of type Code Signing (the desktop agent uses the one named Orquelo Desktop Dev; both can share it). A version already installed is not signed again. Other targets have no such step.
Scriptable: every install command runs unattended (--yes skips confirmations, --json prints the result, failures exit non-zero), so an operator or an Agent can deploy over ssh.
Deploying to a Linux or Windows machine (over ssh; Windows needs OpenSSH Server enabled, with commands run in PowerShell):
make release VERSION=0.2.0 # archives for each platform plus checksums.txt in dist/
scp dist/orquelo_0.2.0_linux_amd64.tar.gz dist/checksums.txt host:/tmp/
ssh host 'mkdir -p /tmp/oq && tar -xzf /tmp/orquelo_0.2.0_linux_amd64.tar.gz -C /tmp/oq \
&& /tmp/oq/orquelo install --archive /tmp/orquelo_0.2.0_linux_amd64.tar.gz --yes'
scp secrets.env host:orquelo/config/secrets.env # secrets are copied separately, never on a command line
ssh host 'orquelo/bin/orquelo autostart on && orquelo/bin/orquelo start'A later upgrade only copies the new archive and runs orquelo install --archive … remotely. There is no orquelo deploy command for now: these steps go into the documentation and the orquelo-cli skill, and a command is considered once remote deployment is used repeatedly and the steps have settled.
Uninstall: orquelo uninstall turns start at boot off, stops the Host and deletes bin/, releases/ and cache/; it keeps config/, data/, plugins/ and logs/. --purge deletes those too, after a second confirmation when interactive; scripts must spell out --purge --yes.
5. Layout
ORQUELO_HOME defaults to ~/.orquelo on macOS and Linux and to %USERPROFILE%\.orquelo on Windows (decided 2026-11-19, the same as macOS/Linux; a hidden directory since 2026-11-20, the owner's choice, was ~/orquelo).
~/.orquelo/
├── bin/orquelo → ../releases/0.2.0/orquelo
├── releases/<version>/ read-only: binary, shipped plugins/ and skills/, VERSION
├── config/
│ ├── orquelo.yaml the operator's configuration (the admin plugin writes here too, with revisions)
│ └── secrets.env secrets as environment variables, 0600, read by the Host itself
├── skills/ system-level skills; third-party ones in skills/third-party/ ([install levels](/en/docs/install-levels))
├── plugins/ system-level plugins (first of plugin_dirs); third-party ones in plugins/third-party/
├── data/ state_dir: all state of one Host
│ ├── orquelo.db SQLite (WAL) with tenant_id/user_id columns
│ ├── secret.key encryption key, 0600
│ ├── host.lock single-Host lock
│ ├── host.json pid, version, start time, supervisor, status (written while running)
│ ├── instances.json snapshot of instance status
│ ├── backups/ pre-migration and manual backups
│ ├── host/<instance>/ Host-scoped instance data (such as a channel token cache)
│ └── tenants/<tenant>/
│ ├── shared/ tenant data that belongs to no single user
│ │ ├── instances/<instance>/ shared instance data (such as a team knowledge index)
│ │ ├── skills/<name>/ tenant-level skills
│ │ ├── plugins/<name>/ tenant-level plugins
│ │ ├── artifacts/<id> artifacts without an owning user (such as system notices)
│ │ └── workspaces/<conv>/ a group chat's conversation workspace
│ └── users/<user>/
│ ├── instances/<instance>/ the user's private instance data (such as Memory, skill drafts)
│ ├── skills/<name>/ user-level skills, seen only by the user's runs
│ ├── plugins/<name>/ user-level plugins
│ ├── artifacts/<id> artifacts made by the user's runs
│ └── workspaces/ the user's workspaces and worktrees
├── logs/ orquelo.jsonl (rotated by size), service.log (the supervisor's stdout/stderr)
├── deps/<plugin>/ plugin prerequisites (npm/uv packages and the like, `${PLUGIN_DEPS}`; rebuilt by `plugin doctor`)
├── cache/ downloads and install staging
└── tmp/ temporary files, cleaned at startRules:
- ◆
releases/is read-only and an upgrade never changes an old version. Shipped plugins load fromreleases/<current>/plugins, afterplugins/, so a user-installed plugin of the same name wins (the same ordering asplugin_dirstoday). - ◆No state is written outside
data/;cache/andtmp/may be deleted at any time. - ◆Tenants and users appear in paths only by opaque Host-generated IDs (
default,us_…), never names or open_ids. - ◆One HOME runs one Host. Tests or a second bot use another HOME:
ORQUELO_HOME=~/.orquelo-test orquelo serve.
6. Configuration
Lookup order: -c FILE > $ORQUELO_CONFIG > $ORQUELO_HOME/config/orquelo.yaml. Every command follows it, so -c becomes optional. The development setup (-c examples/feishu.yaml, relative paths resolved against the file's directory) keeps working.
A new variable, ${ORQUELO_HOME}, is always available to ${ENV} expansion. Defaults written by orquelo init:
state_dir: ${ORQUELO_HOME}/data
env_file: ${ORQUELO_HOME}/config/secrets.env # new: read by the Host at start and reload
plugin_dirs: [${ORQUELO_HOME}/plugins] # the shipped plugin directory is always appended last
log: {dir: ${ORQUELO_HOME}/logs}
locale: zh-CN
shutdown_grace: 30s # new, see section 9
restart_slow_after: 2m # a longer /restart is reported as unusually long; 0 off
watch_config: true # new: reload automatically after the file is saved
environment: {} # new: non-sensitive process environment (PATH, proxies), see section 11
tenants: # new, see section 8
- {id: default, name: Default}
plugins: []
connections: []- ◆The Host reads
env_fileitself, without a shellsource, systemdEnvironmentFileor launchd environment, so a manual start and a service start behave the same. Its variables feed only${…}expansion and never enter the process environment, so shell tools do not see them (in line with the decision to withhold Host secrets from the shell). A variable already in the process environment wins. - ◆Sensitive options are still best kept with
orquelo secret set(encrypted in the database);secrets.envholds start-up credentials such as channel and model keys. - ◆Automatic reload (
watch_config, on by default): the configuration file andenv_fileare watched; 1 second after the last change the file is validated. If it passes, a new generation takes over (as withorquelo reload); if not,config.reload_rejectedis logged, the current configuration keeps serving and admin conversations get a notice. A half-saved file fails validation and has no effect. Upgrading the binary (including the builtin plugins compiled into it) still needs a restart. - ◆The configuration stays one file.
orquelo config validatechecks without starting;orquelo config editopens$EDITOR, then validates and reloads on save. Revisions and rollback stay asconfig history|rollback. - ◆No
conf.d/merging: the admin plugin writes back to the single file, and several files would make the target of a write ambiguous.
7. Plugin create, read, update, delete
Plugins have two layers, and commands are split by layer (two command groups, decided 2026-11-19): the package (a plugin directory on disk, by name) and the instance (an entry in the configuration, by ID).
| Operation | Package (orquelo plugin …) | Instance (orquelo instance …) |
|---|---|---|
| Create | install SOURCE (built) | add ID PLUGIN [-uses] [-option] (built, formerly plugin add) |
| Read | list, show NAME (new: source, version, digest, roles, which instances use it), search (built) | list, show ID (new: status, roles, uses, scope, effective configuration with sensitive values masked) |
| Update | install -upgrade (built), check, doctor, approve | set ID KEY=VALUE…, unset ID KEY (new: edit the instance config, validated against config_schema), enable/disable (built) |
| Delete | uninstall NAME (built; refused while an instance uses it) | remove ID [-force] (built; refused while referenced) |
- ◆Every change goes through the existing
manage.Manager: atomic write-back, a revision, and a reload request to a running Host. Without a running Host only the file changes. - ◆
plugin add|enable|disable|removestay as aliases ofinstance …for one version, with a deprecation note. - ◆Removing an instance does not delete its data at once: the data moves to
data/trash/<instance>-<time>/and is purged whenretentionexpires;remove -purgedeletes it now. An instance removed by mistake can get its data back. - ◆Permission tiers follow the
orquelo-cliskill: read commands are open to any operator; changing commands from the Agent's shell go through the Host's manage grant and approval (the existinggrants: [manage]).
Third-party plugins and outside paths:
- ◆Install levels: skills and plugins install at the system, tenant, user or workspace level (the workspace's
.orquelo/skillsand.orquelo/plugins), chosen at install time; locations, approvals, visibility, names and implicit instances are in install levels for skills and plugins. Source, commit and digest are recorded in the database, and changed files need a newapprove(built); third parties get no extra permissions and no fewer checks. Options that differ per user keep using per-principal secrets (Caller.GetSecret, built). - ◆Prerequisites: npm/uv and similar dependencies a plugin declares go into
~/.orquelo/deps/<plugin>/(todaystate_dir/deps/<plugin>), notcache/, because deleting them makes the plugin unusable;orquelo plugin doctorrebuilds them when lost. System packages (apt, brew and the like) still install only after confirmation. - ◆Code downloaded at run time: MCP servers started with
npxoruvxdownload code on first run into npm's or uv's own cache. The Host pointsnpm_config_cache,UV_CACHE_DIRand the like at~/.orquelo/cache/<plugin>/for plugin processes, so downloads stay inside HOME and can be cleaned; versions should be pinned in the manifest (such as12306-mcp@1.2.3), otherwise each start may fetch different code, and the documentation flags that as a risk. - ◆Referencing outside directories:
skilldirpaths(such as~/.agents/skills,~/.claude/skills) andplugin_dirsentries outside HOME are only referenced, never copied, so they are outside backups,home importand remote deployment, and their changes do not go throughapprove. Configuration validation notes paths outside HOME; when they must move with the Host or be subject to approval,orquelo plugin install DIRcopies them in. - ◆Writing paths: configuration paths may use
~,${ORQUELO_HOME}and environment variables, resolved per platform; documentation examples never hardcode POSIX paths.
8. Multi-tenant, multi-user data
Tenant model. Several tenants are supported this round (decided 2026-11-19, one node). Tenants become a top-level configuration item:
tenants:
- id: acme
name: Acme Inc.
locale: zh-CN
admins: [{connection: feishu-acme, user: ou_xxx}] # tenant admins
limits: {tokens_per_user_per_day: 2000000}
connections:
- {id: feishu-acme, tenant: acme, transport: feishu-acme, …}- ◆A tenant is bound only through a connection and never inferred from a message, plugin or model payload (AGENTS.md section 7). The existing
connections[].tenantfield is unchanged; an ID referenced but not listed intenantsfails validation, and withouttenantsthere is onlydefault. - ◆Four roles: the operator (the OS user owning HOME, using the CLI), Host admins (the top-level
admins, meaning what they mean today: from a conversation they may stop, restart and upgrade the Host and manage plugins, affecting every tenant), tenant admins (tenants[].admins, managing only their tenant's users, sessions and approvals, never restarting the Host), and users. - ◆Plugin instances belong to the whole Host by default; the existing
scopelimits them to some connections and so to some tenants. Instances are not copied per tenant.
Database. Still one SQLite database whose data tables carry tenant_id and user_id (built). One database per tenant waits for multiple nodes.
File data. Three Host-computed directories replace today's single DataDir:
| Scope | Path | Who gets it |
|---|---|---|
| Host | data/host/<instance>/ | the instance itself (plugin.Context.DataDir, meaning unchanged) |
| Tenant | data/tenants/<t>/shared/instances/<instance>/ | only when the call's trusted context belongs to tenant t |
| User | data/tenants/<t>/users/<u>/instances/<instance>/ | only when the call acts for user u |
- ◆Plugins get tenant and user directories through
plugin.Env.TenantDir(tenant)andEnv.UserDir(principal)(ADR 0010), filled only from the principal the Host gave them, never from an id they choose. The designedCaller.Dirbecame path patterns onEnv, since observers and similar calls have noCaller. An instance that already hasplugins/<instance>/keeps using it (plugins keep absolute paths in it, such as git worktrees); new instances usehost/<instance>/. (Built, S5a: tenants configuration, tenant admins, artifacts per user, Memory's user and conversation directories, moving and deleting files when users merge or are forgotten.) - ◆Artifacts are stored per user: in
tenants/<t>/users/<u>/artifacts/, where<u>is the user of the run that made it (artifacts.user_idin the database, already written from the run). An artifact made in a group chat also belongs to the user who started the run; who may read it is decided by the database record and grants, not by the path. Artifacts without an owning user go totenants/<t>/shared/artifacts/. Deleting or exporting a user then handles their artifacts with the directory. - ◆A conversation's scratch workspace lives with its owner: a direct chat's under the person's directory (
tenants/<t>/users/<u>/instances/<localenv>/conversation/…), a group's under the tenant's (shared/instances/<localenv>/conversation/…); one kept in the old place moves there with its files on first use, andscratch_expiryandscratch_quota_mbstill apply. A configuredrootordir,per: shared/principal, named workspaces and git worktrees are not moved (a worktree's absolute path is recorded in its repository). (Built, S5c.) - ◆Merging users (
identity link): the Host moves the merged user's directories into the kept user's, renaming and keeping conflicting files, recorded in the same operation as the database rows so it can be redone after an interruption. - ◆Deleting a user (
sessions forget, lateruser delete) deletes that user's directories; export (orquelo tenant export T) packstenants/T/with the tenant's database rows; deleting a tenant needs a second confirmation from the operator. - ◆The honest boundary: every tenant runs under one OS user, and the isolation is logical. Shell and file tools are not a sandbox: a user with full
localenvaccess can read the whole HOME. Serving untrusted tenants requires restricted tools for them (safe-shell, a sandbox plugin), and the documentation says so.
Skills and plugins users develop. Drafts of skills and plugins users develop in conversations go to the author's directory automatically (the workshop uses Caller.Dir(user), i.e. users/<u>/instances/<workshop>/drafts/); publishing chooses a level, the user level by default. Locations, approvals and visibility per level are in install levels for skills and plugins.
9. Supervision and lifecycle
Goals (decided 2026-11-19): start at boot; come back after a crash or a kill; let Host admins restart gracefully from Feishu or the console (and the TUI later), and a restart must never leave the Host down.
Run commands: orquelo start|stop|restart|status and orquelo autostart on [--at-login]|off. start first registers the service definition when it is missing (so the Host always runs supervised and a crash is restarted), then starts it through the service manager; autostart only decides whether it starts by itself at boot or login. orquelo serve stays as the foreground form (development, debugging), and a Host started that way is not supervised.
How start at boot works: autostart on starts at boot by default; --at-login starts after the user logs in instead:
| System | At boot (default) | At login (--at-login) |
|---|---|---|
| macOS | /Library/LaunchDaemons/ai.orquelo.host.plist with UserName set to the current user; installed once with sudo | ~/Library/LaunchAgents/ai.orquelo.host.plist, no sudo |
| Linux | ~/.config/systemd/user/orquelo.service plus loginctl enable-linger (starts at boot without a login) | the same unit without linger |
| Windows | a scheduled task triggered at system start, running as the current user with S4U (no stored password; local resources and network only) | a scheduled task triggered at the user's logon |
- ◆Both run
<HOME>/bin/orquelo serveas the current user and restart it on a non-zero exit: launchdKeepAlive: {SuccessfulExit: false}; systemdRestart=on-failure,RestartSec=3,StartLimitIntervalSec=0(never giving up after repeated failures); the Windows task's command restarts orquelo itself 3 seconds after a non-zero exit and ends after exit 0, so the rule does not depend on how Task Scheduler counts failures.TimeoutStopSec(launchd'sExitTimeOut) isshutdown_graceplus 15 seconds. The service name derives from the installation directory (ai.orquelo.host.<hash>), so two installations on one machine never clash.orquelo stopandorquelo restartdo not go through the service manager: they write a control request the Host carries out itself, so they need no administrator rights on any platform; the macOS at-boot form is a LaunchDaemon, whose installation andstartneedsudoonce, and the command prints what to run. (Built, S3a.) - ◆The service sets
ORQUELO_SUPERVISOR=launchd|systemd|schtasks; the Host records it inhost.jsonand uses it to decide whether it can restart. - ◆
orquelo statusshows, beside today's run and delivery counts, the version, pid, start time, whether it is supervised, whether it starts at boot, and the last exit reason fromhost.json; while the Host runs, each connection that reported its health, up or down since when and why (ADR 0019).
Signals and commands:
| Action | Command | Unix signal | Meaning |
|---|---|---|---|
| Reload configuration | orquelo reload, saving the configuration file (watch_config) | SIGHUP | hot reload: a new generation takes over, in-flight runs stay on the old one (built; SIGHUP changes from "exit" to "reload") |
| Graceful stop | orquelo stop | SIGTERM, SIGINT | phases 1–5 below, exit code 0, the supervisor does not start it again |
| Fast stop | a second signal | same | skip draining and cancel in-flight runs at once |
| Immediate exit | a third signal | same | do not wait for plugins; what remains is left to restart recovery |
| Restart | orquelo restart, /restart in a conversation | — | see "Graceful restart"; exit code 75 for the supervisor to start it again |
Graceful restart. The CLI, Feishu and the console share one path: each only writes a control_requests(kind=restart) row, and the Host carries it out:
- Authorization:
/restartin a conversation is accepted only from Host admins (the top-leveladmins, through any linked account); tenant admins and users are told they may not (stable error coderestart.forbidden). The CLI counts as the operator.orquelo restartfrom the Agent's shell is refused (section 10). - Preflight (no restart unless it passes): unsupervised (running in the foreground as
orquelo serve) → refused, pointing at running it withorquelo start. The binary about to start (the new version during an upgrade) runsorquelo serve --preflight: load and validate the configuration, readenv_file, open the database read-only and check that itsschema_versionis compatible, check that the plugins load and, by serve's own check, that each connection's instances play their roles (a runtime that is a trigger fails here, not at the start). Any failure refuses the restart with the concrete reason, and the Host keeps serving. - Notice: the requester is told "restarting: N runs will continue from their checkpoints, M will end" (localized message key
host.restarting), and the requester's conversation is recorded. - Stop: the graceful stop of phases 1–5 below, exit code 75.
- Report: once the new Host has started and finished recovery, it tells the requester's conversation "restarted: version, downtime" (
host.restarted, sent once). When the downtime exceedsrestart_slow_after(default 2m, 0 off; a value without a unit or a negative one is refused), it says instead that the restart took unusually long and what most of the time went to: waiting for runs, for the plugins to stop, or starting again (host.restarted_slow). The stopping Host stamps the notice when the drain ends and when the plugins are stopped. (Built.)
While the Host is stopped nothing in a conversation can receive /restart; only the start at boot, the crash restart or the operator's CLI (orquelo start, over ssh too) can start it. The documentation and the help of /restart say so.
Phases of a graceful stop (each logged as host.shutdown_phase):
- Stop admission: the Host admits no new events: a transport's submit gets the retryable
host.stopping(retry_after_ms30000), httpapi answers 503 withRetry-After, and Feishu, given the error, redelivers later (deduplicated bymessage_id; the platform's redelivery is not verified live). Transports keep running through the drain and stop after it, so answers to approvals and deliveries go on. Events already in the inbox stay and are handled after the restart. (Built, S3a.) - Drain runs: wait up to
shutdown_grace(default 30s, replacing the fixed 10s) for in-flight runs. Runs waiting for an answer are parked at once (built). Runs of runtimes that declareresumableare paused at once (built): their nextCommitstores the step and returnsrun.paused, the runtime returns it, and the run is left running with that checkpoint for restart recovery, so a step is never cut short and the drain does not wait for the whole run. A pause that lands on the final step finishes the run. A run that reaches no step boundary within the grace is cancelled like the others. - Flush deliveries: queued deliveries (including the notice of step 3 above) keep sending within the remaining grace; what is unsent is continued by the Worker after the restart, never by rerunning the runtime.
- Stop plugins: first services and MCP servers, then process plugins:
shutdown(2 seconds), then stdin closed,SIGTERMafter 5 seconds and a kill after 5 more; on Windows, which has noSIGTERM, the kill comes 5 seconds after stdin closes. Each step is logged asplugin.stop_step(built). - Finish: checkpoint the database WAL and close it, release
host.lock, markhost.jsonstoppedwith the exit reason, and exit.
Runs still going when the grace ends are handled by the existing restart recovery: resumable runtimes continue from their checkpoint, other runs fail and the user is told; tool calls left started in the ledger are reported as unknown and never resent.
10. Fixing "the Agent killed its own Host"
Three independent layers:
- Supervision as the backstop (the real fix): with section 9, however the Host is killed it is back within seconds and runs restart recovery.
- A proper path for the Agent:
orquelo restartin the Agent's shell stays refused and says to ask an admin to send/restartin the chat (section 9); theorquelo-cliskill says "to restart, ask an admin for /restart, never kill". The designed "restart from the shell after an admin's approval" is dropped by the owner's decision (2026-11-19, section 12): the shell does not know its run or conversation, and an approval outside the runtime needs a new interaction mechanism, while an admin's/restartalready covers restarting from a conversation (2026-11-19). (Built, S3b.) - Refusing self-kill commands:
localenvsetsORQUELO_SHELL=1andORQUELO_HOST_PIDin the shell; thebash/powershelltool (including!commands in a conversation, decided 2026-11-19) refuses before running akill/pkill/killall/taskkill/Stop-Processcommand naming the Host's pid,$ORQUELO_HOST_PID,orquelo serveororquelo.exe, or killingorqueloby name, with the hint of layer 2. This is best effort and does not catch every spelling; layer 1 is the guarantee. (Built, S3b.)
11. The development setup is a deployment too
The Feishu bot on this machine and any other long-running Host are ordinary installations, no different from a remote machine (decided 2026-11-19); only the first time is the existing configuration and data migrated. orquelo serve -c examples/….yaml in the repository is kept for development, debugging and veruqelo case runs, and no longer carries the live bot.
The everyday development loop:
make install-local # build this platform's archive (version such as 0.1.0+dev.68abce9.<build time>), then orquelo install --archiveorquelo install runs the preflight, switches versions and restarts gracefully (sections 4 and 9); no more manual kill, nohup and source. What this gains:
- ◆The live bot is isolated from the working tree: shipped plugins load from
releases/<version>/plugins/, a snapshot taken at build time; uncommitted changes in the working tree do not affect the live bot, nor make a plugin unavailable withchanged_since_approvedat the next start. - ◆Plugin approval moves to install time:
orquelo installlists shipped plugins whose digest differs from the approved record; the operator confirms (--yescounts as confirming) before the version switches. The installer does not write a running Host's database: the approvals go todata/approvals.pending.json, which the new Host records at start, before loading plugins. Until it restarts, the running Host keeps the shipped plugins and shipped dependencies (deps/<plugin>/) of the release it started from, through every reload, so a switch never leaves it reading plugin files it has not approved. - ◆Concurrent installs are serialized: several Agent sessions may deploy at once.
orquelo installholds~/.orquelo/install.lock; a later one waits or reports "another install is in progress"; every install and restart appears in the recent history oforquelo status(version, requester, time).
Process environment: a Host started by the service manager does not inherit the login shell's environment, so proxies (such as 127.0.0.1:17897) and PATH (node, go, gofmt and the like) go missing. The configuration gains environment:, listing non-sensitive process environment variables that the Host sets on itself, on the plugin processes it starts and on the commands of the shell tool, at start and again on every reload (a variable no longer listed gets back its earlier value; commands already running keep theirs; configuration section 6):
environment:
PATH: /opt/homebrew/bin:/usr/local/go/bin:/usr/bin:/bin
HTTPS_PROXY: http://127.0.0.1:17897
NO_PROXY: localhost,127.0.0.1orquelo init and home import read PATH and the proxy variables from the current shell and write them after asking. Secrets still go only into secrets.env or the secret store, never into environment.
First migration: orquelo home import --from data/feishu --config examples/feishu.yaml [--env ~/.config/orquelo/feishu.env]: (Built, S5b. Where it differs from the steps below: plugin_dirs entries inside the state directory (such as installed/) are copied to ~/.orquelo/plugins, other entries stay as absolute paths instead of being dropped; backups/ is not copied; --home DIR names the installation.)
- Requires the source Host to be stopped (takes its
host.lock). - Copies the configuration to
config/orquelo.yaml: relative paths become${ORQUELO_HOME}/…;plugin_dirsentries pointing at the repository'splugins/are dropped (those plugins now come from the shipped directory); plugins indata/feishu/installed/(such aslearned-skills) move into the store~/.orquelo/plugins/;environmentis filled in. - After asking, copies the env file to
config/secrets.env(0600). - Copies the database with
VACUUM INTOand copiessecret.keyand the plugin approvals; movesplugins/<instance>/,artifacts/and workspaces into the section 8 layout (instance data whose owner cannot be determined goes tohost/<instance>/); rewrites workspace and artifact paths stored as absolute paths in the database. - Leaves the source directory untouched, so going back is possible; finishes by suggesting
orquelo startandorquelo autostart on. After the migration the oldnohupstart is no longer used.
12. Decisions (2026-11-19)
- HOME on Windows is
%USERPROFILE%\.orquelo. - The repository is private for now and will be open-sourced; the installer supports both
gh/GITHUB_TOKENand anonymous download (sections 3 and 4). - Several tenants are supported this round (section 8); requirement D01 is updated to match.
SIGHUPbecomes a configuration reload;watch_configis on by default, so saving the configuration file hot-reloads it (section 6).- The system service manager supervises the Host and starts it at boot by default; in a conversation only Host admins may
/restart; a restart runs a preflight first, does not happen if it fails, and reports when done (section 9). - Packages and instances get two command groups,
orquelo plugin …andorquelo instance …(section 7). - Installing and running are separate:
orquelo installhandles the first install and version updates (also for trying a new build here and for deploying to Linux/Windows over ssh), andorquelo start|stop|restart|status|autostarthandle running (sections 4 and 9). - The development setup is an installation too:
home importmigrates the existing configuration and data once, andmake install-localdeploys afterwards (section 11). - Personal skills take effect as soon as the author publishes, without approval; plugin code needs a Host admin's approval at every level (section 8).
- Code comes first; native Linux and Windows environments are provided later, and until then those platforms are reported as unverified.
- Skills and plugins can be installed and used at all four levels, system, tenant, user and workspace; given an address, a bare skill installs directly with the level chosen (install levels).
- No "orquelo restart from the shell after an admin's approval": the bot's shell refuses restart, stop and start, and asks an admin to send
/restartin the chat (section 10).
13. Slices and acceptance
Each slice is its own commit, with cases from vq spec first, including one e2e case through a real channel. Estimated production code: about 2.5k lines.
| Slice | Content | Acceptance |
|---|---|---|
| S1 | ORQUELO_HOME, configuration lookup, ${ORQUELO_HOME}, env_file, new init defaults | every command works without -c; variables from secrets.env never appear in a shell tool's environment |
| S2 | injected version, make release, make install-local, the install lock, approving shipped plugins at install time, install.sh/install.ps1, orquelo install|uninstall, deployment documentation | natively on three systems: fresh install, repeated install, --archive install of a local build, abort on a bad checksum, no switch after a failed preflight, upgrade switch, replacing the running exe on Windows, backup before migration, older binary refuses a newer database; deploying over ssh to one Linux and one Windows machine |
| S3 | start|stop|restart|status, autostart on|off (at boot/at login), restart and /restart, preflight, SIGHUP and watch_config hot reload, shutdown_grace and the five-phase stop, section 10 | natively on three systems: the Host runs after a machine reboot; it recovers after kill -9; an admin's /restart in Feishu gets "restarting" and "restarted", a non-admin is refused; a failed preflight (a bad configuration) does not restart and the Host keeps serving; in-flight runs finish within the grace or resume from a checkpoint; deliveries never rerun the runtime; saving a bad configuration has no effect |
| S4 | plugin list/show, instance list/show/set/unset, instance data to trash | after a change the revision count grows and the Host has reloaded; a set violating the schema is refused |
| S5 | ADR 0010 Caller.Dir, per-tenant/per-user directories, moving files when users merge or are deleted, home import | two users cannot reach each other's directories; a merge redone after an interruption gives the same result; Feishu e2e passes after importing data/feishu |
| S6 | Install levels: skill install, --to, the four-level skill source, implicit instances, workspace trust | section 9 of that document |
Section 8 of the architecture has the budget row "release, installation and lifecycle" (approved by the owner on 2026-11-19, raising the total, with goal mode, to 55k).