A vertical slice to bootstrap the product loop on the canonical zopu-code repo. Primitives (packages/primitives, all tested + lint/type clean): - GitRemoteRuntime: Gitea REST client (createIssue, createBranch, createPullRequest, listIssues, getIssue) as an Effect context service with a fetch-backed transport. Live-verified against puter/zopu-code. - GitLocalRuntime: clone, addWorktree, commit, push, currentBranch, setRemoteUrl over a pluggable Shell (host subprocess now, AgentOS VM exec later). Tested against real temp git repos. - agent-os: Codex support via @agentos-software/codex-cli — codexSoftware bundle (codex+git), makeCodexAgentOsConfig(), codexSessionEnv() for the OpenAI base URL/key. Env: - GITEA_URL/GITEA_TOKEN wired into convex.ts and convex.config.ts. - .env.example documents the self-hosted git section. Agents (packages/agents): - zopu-dev: development agent that creates issues on the canonical repo and starts autonomous work runs. git-remote tools (create/list/branch/PR) wired to GitRemoteRuntime; start_workflow tool enqueues a work run. - flue run zopu-dev verified live (lists/creates issues on real Gitea). Backend (packages/backend): - workflows.startIssueWork mutation: fetches a Gitea issue server-side and admits a queued work run. The Codex VM spawn body is the next step.
Convex Backend
This directory contains the Convex control plane for the app and daemon runtime. Generated files under _generated/ are maintained by Convex and should not be edited by hand.
Daemon Control Plane
schema.tsdefines daemon definitions, high-churn daemon presence, leased daemon commands, append-only command events, and the sampletodostable.daemons.tsmanages stable daemon definitions withupsert,get, andlist.daemonRuntime.tsrecords daemon session lifecycle:connect,heartbeat,disconnect,recordEvent, and bounded event listing.daemonCommands.tsowns the command queue:enqueue,available,claim,start,succeed,fail,cancel, and bounded command listing.
Commands are claimed by daemon session. Preserve the claimedBySessionId ownership checks, leaseExpiresAt expiry semantics, terminal statuses, and bounded query results when changing this flow.
Usage
Convex functions are exposed by file path through the generated api object, for example api.daemonCommands.enqueue or api.daemonRuntime.connect. Run bun run dev:server from the repository root to start the development deployment, and bun run dev:setup when configuring Convex for the first time.