CLAUDE.md is a symlink to this file. Edit AGENTS.md only.
Read every AGENTS.md from the repository root to the file being changed.
Before starting work intended for a pull request, or creating or editing a
pull request or issue, read .github/AGENTS.md.
Record public contributor invariants in the narrowest relevant AGENTS.md.
Internal context, plans, specifications, and task records stay in the private
repository. Keep each AGENTS.md under 8 KiB and add a matching CLAUDE.md
symlink for new scoped files.
This is the standalone public source tree. It includes apps/{cli,electron}
and the packages they consume. It intentionally excludes hosted backend
implementations, deployment/operator configuration, billing operations,
private service secrets, and the Web and mobile app sources.
- Never add a dependency on
@lody/convex, a private workspace package, or a generated backend API declaration. - Public optional-cloud protocol names/DTOs live in
packages/cloud-api. - Shared product code uses
packages/platformcapabilities and ports. - Settings must represent real platform support: local hides cloud usage and
PR-driven auto-archive, and omits machine selection when
remoteMachinesis absent. Gate entries and their background work through capabilities rather than build-kind or environment checks. - Shared packages stay platform-neutral. The public Electron composition
selects
localexplicitly; private Web/mobile entries and cloud composition roots may injectcloudwithout forking those shared packages. - The code-review-viewer build accepts
LODY_RELEASE_VERSIONfor downstream immutable packaging; without it, the public package version is authoritative. - The OSS desktop entry is local-only and must not make authenticated product-cloud requests; public managed-runtime artifact downloads are the explicit exception.
- An absent platform selector resolves to
local; public build scripts must not accept or discover staging/production deployment presets. - Local CLI, renderer, and Electron-main telemetry is hard-disabled even when unrelated PostHog variables exist in the caller's shell.
- Client workflows that require daemon support negotiate integer protocol versions through
MachineMeta.protocolCapabilities; never infer support from the CLI release version. Missing capabilities mean legacy/unsupported. Advertised set and version checks share one binding inpackages/shared/src/machine-protocol-capabilities.tsso a key never travels without its version. - Managed runtime downloads default to the public R2-backed channel owned by
packages/platform/src/runtime-artifacts.ts; local and cloud assembly must use that same constant.LODY_RUNTIME_BASE_URLis only an explicit mirror override. packages/acp-extension-kimiis an isolated submodule workspace. Do not add it to the root pnpm dependency graph; Lody consumes only its separately built, checksummed managed-runtime artifact and versioned ACP extension contract.packages/acp-extension-coreis a public submodule workspace sourced fromLodyAI/acp-extension-core. Keep shared ACP extension contracts there and consume them through the root pnpm workspace; do not duplicate those contracts locally.- Never commit captured user/agent transcripts; fixtures must be synthetic.
- Workspace MCP has exactly two durable layers: catalog entries in the workspace Flock
document and selected ids in each user turn input config. Do not add machine bindings.
Preserve
mcpServerIds: []as an explicit empty selection; dispatch must carry the driving turn's selection into ACP startup rather than rereading session history. - Workspace catalog mutations (MCP servers and Agent Roles) are durable on the local Flock write and shared by an explicit upload that follows it. Settings surfaces resolve on durability and do not wait on or report that upload: the row already exists, the joined room carries the document when a one-shot upload cannot, and a banner about it is something the user can neither act on nor dismiss. What is forbidden is the opposite — reporting a durable write as failed, or rolling one back, because the upload did not go through. The CLI still reports its own sync result to the terminal.
- Agent Roles are one
agentRolerow family in the same workspace Flock document, not a private and a shared catalog: sharing is an ordinary update ofvisibilityon the row. A Role stores no secret — no API key, MCP selection, or memory — andisSensitiveAgentRoleConfigOptionKeyis applied on read as well as on write, because a workspace row reaches every member's client. It DOES pin the permission mode, asrunConfig.modeIdfor legacy ACP modes or the agent's own_permissionoption: permission is a run-config value the agent publishes, not a secret, and a Role that left it out would not be the whole configuration it claims to be. So the composer drops its separate permission button while such a Role is selected. A Role may therefore pin a warning-tone mode (full access / skip permissions), which every surface that hides the permission control must keep visibly marked; what stays out of scope is a Role-level auto-approval POLICY. Settings and mention discovery usecanReadAgentRole/canManageAgentRole; MCP creation resolves an explicit Role id from the workspace catalog without requiring a mention-scoped authorization record. - A Role never falls back.
machineId + agentConfigIdbind the execution site exactly; when the machine, config, or a stored model/mode is unavailable the Role stays listed with the precise reason and stops being mentionable. MCP creation resolves the current workspace catalog row byagentRoleIdbefore Operation acceptance; the canonical Prompt, target, Role revision, and dispatch config are frozen into the accepted Operation so a later edit or delete cannot change its recovery or retry.SessionMeta.agentRoleId/agentRoleRevisionrecord where a Session came from and are display-only.
pnpm check:public-boundary is the executable repository boundary and must pass
after changing package scope or cloud/local composition.
apps/cli: agent execution, local persistence, Machine RPC, Code Collabapps/electron: desktop shell and bundled CLI lifecyclepackages/components: shared React product/workspace UIpackages/platform: provider and capability contracts plus local defaultspackages/cloud-api: public optional-cloud client contractpackages/shared: schemas, protocols, and cross-runtime utilitiespackages/loro-streams-rpc: public Streams RPC protocol/clientpackages/acp-extension-core: shared public ACP extension contractspackages/acp-extension-kimi: independently built Kimi runtime source and Lody ACP extensionssite-docs: public documentation site
Use Node.js 22+ and the pnpm version pinned in package.json.
- Install dependencies with
pnpm install. - When this checkout is embedded in a parent pnpm workspace, that parent owns dependency installation. The public preinstall guard rejects a second nested install because it would mix virtual-store identities. Use a separate clone for standalone public development.
- The canonical desktop command is
pnpm start:local; it rebuilds both the bundled CLI and local OSS renderer before launch. Rootpnpm buildbuilds the same local desktop composition. - Before committing, normally run
pnpm checkandpnpm format. - If a user explicitly asks to skip tests, do not run test commands; report the narrower type/build/static validation that was performed.
- Commit subjects use Conventional Commit prefixes such as
feat:,fix:,docs:,chore:, andtest:. - AI commits end with
Model: <runtime-model-id>. - CI installs with
pnpm install --frozen-lockfile, so a manifest change must land with itspnpm-lock.yamlupdate.
Tests must not depend on real sleeps, wall-clock races, network access, machine load, or scheduler luck. Use explicit signals, injected clocks, fake timers, and deterministic fixtures. Assert observable behavior at the lowest realistic boundary, not implementation details or mock call counts.
Keep changes traceable to the request. Preserve unrelated user work. Prefer a
small explicit contract over hidden fallback behavior, and remove only code
made unused by the current change. Update the nearest public AGENTS.md
whenever an invariant or repository boundary changes. Do not copy internal
design records into this repository.