Tooling reference
This page covers the practical Celorga tooling surface today. For the product framing around compiler-style corpus checks, see Maintenance and health workflows.
The CLI is the shared backend for editor integrations and automation. You can use it directly or through VS Code commands.
Install with npm install -g celorga. The commands are celorga and celorga-lsp.
Core command families
Run celorga version or celorga --version to inspect the installed package version, and celorga --help for current top-level usage. AI architecture, job design, draft artifacts, and provider boundaries are documented separately in AI processing architecture, AI job manifests, AI draft artifacts, and AI adapter interface so the deterministic CLI surface stays clear.
Main workflows:
agendatodoplancapturearchive,refilefmtsearch,id,query,backlinksindex,entity,approvals,clockagent capabilities,agent context/search/fetch/bundle,context,briefgoal,agent-profile,run,review,workflow,artifact,runtime,mcp,evalpluginfor content-addressed Git extensions, commands, templates, and document rendererscorpusidentity inspection, validation, and preview-first initializationworkspace agent-state --dir CORPUS --jsonfor a single-process, read-only batch of agent-state listsworkspace agenda,workspace searchfor read-only projections across explicitly mounted corporasource list,source doctor,source status,source bind,source schedule,source import,source syncfor external source mirrors and staged review packetscompile corpusrender-chartproperty-viewcrmfor People & Companies: people, companies, outreach ledgers, follow-ups, and calendar briefsappsfor optional workspace apps and plugin app pagesviewfor saved, refreshable interactive workspace viewsquery-datatable recalculateroam ...crypt ...export htmlexport beamerpublishlintgraph auditai validate-joblsp
Plugins
Celorga plugins are self-contained Git packages. A corpus records portable source
intent in celorga.json, while the corpus plugin lock file pins the exact Git commit,
validated manifest, and SHA-256 hash of the package contents. Installed bytes
live in a machine-wide content store in your home directory and are
shared safely by every corpus that locks the same hash. Set CELORGA_PLUGIN_HOME
to use a different machine-local store.
The first release accepts ordinary GitHub HTTPS URLs, github:OWNER/REPOSITORY
shorthand, general HTTPS/SSH/scp-style Git URLs, file: URLs, and local Git
checkouts. A package can also live in a repository subdirectory. Mutable refs
are only resolved by add or update; sync always reproduces the locked
commit and fails if its content hash changes.
# Preview the exact revision and content hash without changing the corpus.
celorga plugin add https://github.com/example/celorga-calendar.git --dir ~/notes --json
# Record the source, lock and install the package, then trust this exact hash.
celorga plugin add github:example/celorga-calendar --dir ~/notes --trust --apply
# Install a package from a monorepo.
celorga plugin add https://github.com/aviaviavi/celorga.git \
--subdir examples/plugins/chess-pgn --dir ~/notes --trust --apply
celorga plugin list --dir ~/notes --json
celorga plugin doctor --dir ~/notes --json
celorga plugin sync --dir ~/notes
celorga plugin sync --dir ~/notes --apply
celorga plugin update PLUGIN_ID --dir ~/notes
celorga plugin update PLUGIN_ID --dir ~/notes --trust --apply
celorga plugin trust PLUGIN_ID --revoke --dir ~/notes --apply
All mutations preview unless --apply is present. remove deletes the corpus
declaration and lock entry but retains immutable store bytes because another
corpus may use them. The initial ecosystem intentionally has no central
registry: the locked source, commit, hash, and manifest are sufficient to
reproduce and audit a package. A future registry can resolve names into this
same source-and-lock model without becoming the package authority.
Package manifest
A package root contains celorga-plugin.json and every file it needs at runtime.
Symlinks and install scripts are rejected; executable contributions use .js,
.mjs, or .cjs process entries inside that self-contained package. This
keeps a locked Git tree independently hashable and removes a mutable
dependency-install step.
{
"$schema": "celorga:plugin-manifest:v1",
"id": "example.cards",
"name": "Example cards",
"version": "0.1.0",
"engines": { "celorga": ">=0.9.0 <1.0.0" },
"permissions": { "environment": ["EXAMPLE_API_TOKEN"] },
"contributes": {
"commands": [
{ "id": "import", "entry": "import.mjs" }
],
"renderers": [
{
"id": "card",
"languages": ["example-card"],
"entry": "render-card.mjs"
}
],
"templates": [
{ "id": "card-note", "path": "templates/card.org" }
],
"actions": [
{
"id": "summarize",
"title": "Summarize with Example",
"contexts": ["heading", "run"],
"entry": "summarize.mjs",
"capabilities": ["network"]
}
],
"hooks": [
{ "id": "notify", "events": ["run.blocked", "approval.requested"], "entry": "notify.mjs" }
],
"surfaces": [
{ "id": "pipeline", "title": "Pipeline", "symbol": "square.grid.2x2", "entry": "pipeline.mjs", "capabilities": ["read-corpus"] }
]
}
}
The engines.celorga field accepts exact versions, comparison sets, ^ and ~
ranges, and || alternatives. An incompatible package is rejected before it
enters the store. Environment variables are absent by default apart from a
small process baseline; a manifest must name each additional variable it wants
to receive.
Contributions and process protocol
V1 has six additive contribution kinds:
-
Commands run explicitly with
celorga plugin exec PLUGIN COMMAND -- ARG....The process receives one
celorga:plugin-invocation:v1JSON object on stdin and returns onecelorga:plugin-result:v1JSON object on stdout. -
Templates are static package files copied into the corpus with
celorga plugin template PLUGIN:TEMPLATE --out PATH. Output must remain inside the corpus and preview/apply rules still apply. -
Document renderers claim one or more source-block languages. The shared CLI
renderer gives the process the block body, arguments, source lines, and document path. It returns
celorga:plugin-render-result:v1JSON containing HTML plus optional CSS, JavaScript, title, and height. The result replaces that source block incelorga export html, and the Celorga app's read mode and source preview. -
Context-aware actions declare
title, thecontextsthey apply to(
note,heading,thread,run,approval), anentry, and optionalcapabilities(read-corpus,network). Celorga lists them in the File menu for the current note or heading and in Activity row menus for threads, runs, and approvals; scripts usecelorga plugin actions --context KINDandcelorga plugin action run PLUGIN:ACTION --context KIND .... -
Lifecycle hooks subscribe to activity events such as
run.blocked,run.completed,approval.requested, andthread.reply-received.celorga plugin hooks dispatch --apply(once, from a cursor, or with--follow) invokes them; the scheduler host in Celorga dispatches them automatically. Each event is delivered to a hook once. -
App surfaces add pages to the Celorga app sidebar as an optional workspace
app named
plugin:PLUGIN_ID. Each surface declaresid,title, an optional SF Symbolsymbol, anentry, and optionalcapabilities(read-corpus,network).celorga apps render PLUGIN:SURFACEruns the entry under the same sandbox as actions with akind: "surface"invocation (includingcorpus.rootonly withread-corpus) and expectscelorga:plugin-render-result:v1HTML with optional CSS and JavaScript. The app shows it in a non-persistent web view whose content security policy blocks all network requests, frames, and form submissions, and that has no bridge to the corpus. A surface never writes the corpus. A plugin app is on once the plugin is installed; turn it off withcelorga apps disable plugin:PLUGIN_ID --apply.
Actions and hooks cannot mutate the corpus silently. The process receives an
celorga:plugin-action-invocation:v1 object containing only the selected object
(the note or heading text with its revision, a thread's recent messages and
activity explanation, or a run and approval with its explanation, or the
event) and no corpus path unless it requests read-corpus. On macOS it runs
under sandbox-exec with corpus and plugin-trust writes denied, corpus reads
denied without read-corpus, and network denied without network. It returns
celorga:plugin-action-result:v1 with optional text and up to 50 proposals:
exact-text edit (the text must occur once; expectedSha256 pins the file),
create under views/, thread-post, or run-comment. Proposals are stored
as pending celorga:plugin-proposal:v1 records in .celorga/plugin-proposals/.
celorga plugin actions --context heading --json
celorga plugin action run example.helper:summarize --context heading --file notes/a.org --line 12
celorga plugin proposals list --status pending
celorga plugin proposals apply PROPOSAL_ID # preview with unified diffs
celorga plugin proposals apply PROPOSAL_ID --apply # every change must still apply cleanly
celorga plugin proposals dismiss PROPOSAL_ID --apply
celorga plugin hooks dispatch --since 1h # dry run
celorga plugin hooks dispatch --apply
The npm package ships JSON Schemas for the manifest, lock, invocation, command
result, action result, and renderer result under spec/v0/plugin-*.schema.json. Plugin stdout
is bounded to 1 MiB; renderer fields have smaller per-field limits, and a
package is limited to 10,000 files and 64 MiB of content.
The shared parser still owns the canonical Celorga AST. V1 renderer languages are
therefore additive source-block syntax, not arbitrary parser replacement. The
versioned contribution model leaves room for future importers, syntax semantic
modules, data sources, and other integration points without making their code
part of core. Built-in chart and plot languages remain reserved.
Trust boundary
Downloading or locking a plugin never executes it. Execution requires the
package's exact content hash in the current machine's trust file. A later Git
commit has a different hash and is inert until separately reviewed and trusted;
plugin trust --revoke --apply stops execution of the locked hash immediately.
A trusted command or renderer process is native code with the user's file and
network access. The reduced environment limits accidental credential
inheritance but is not an OS sandbox; actions and hooks additionally run under
the macOS sandbox described above (other platforms rely on the proposal
boundary and the absence of a corpus path). Trust packages as carefully as any local executable. Renderer output
has a second boundary: Celorga puts it in an opaque-origin iframe with a
deny-by-default content-security policy, no network connections, no forms,
frames, objects, workers, or top-level navigation, and only inline code plus
data: or blob: media. Renderer failure stays local to the block and appears
as an actionable error instead of preventing the rest of the document from
rendering.
The repository includes a dependency-free chess PGN renderer and note template as a complete reference package.
Corpus identity
Portable identity lives under the corpus key in the root celorga.json. It lets clones and local mounts refer to the same personal, shared, or project corpus without treating a machine-local path as identity.
celorga corpus show --dir ~/notes --json
celorga corpus validate --dir ~/notes
celorga corpus init --dir ~/team-notes --id team-notes --name "Team Notes" --kind shared
celorga corpus init --dir ~/team-notes --id team-notes --name "Team Notes" --kind shared --apply
corpus init previews by default, preserves unrelated celorga.json settings, creates standard corpus zones when applied, and refuses to silently replace a different existing identity. See Shared corpora and collaboration.
Corpus scans skip hidden folders. corpus show lists hidden folders directly under the root that hold Org files as hiddenOrgDirectories, and a command that finds no Org files under a root, or finds a .crucible/ folder beside them, prints a note on stderr naming the folder. To use a wiki kept in a hidden folder, pass that folder as --dir or run corpus init on it; see Research notes.
Batched workspace agent state
celorga workspace agent-state --dir CORPUS --json reads runs, workflows, goals, and agent profiles in one process. Its celorga:workspace-agent-state:v1 response has runs, workflows, goals, and profiles sections. Each contains the existing list envelope under value, or a section-local error string, plus elapsedMilliseconds. Clients must check each section for errors; a successful process exit does not mean every section succeeded.
This is a read-only batch for one corpus, not an atomic transaction across files. It does not accept --mount. Existing individual list commands and their filters remain available.
Federated workspace reads
Repeat --mount to combine agenda or search results from identified corpora:
celorga workspace agenda --mount ~/notes --mount ~/team-notes --recursive --json
celorga workspace search "quarterly plan" --mount ~/notes --mount ~/team-notes --recursive --json
These commands are read-only composition over the normal agenda and search engines. Results include a corpus object with stable ID, name, kind, and the local root needed for navigation. Invalid, unavailable, or duplicate-identity mounts appear in issues. The command never discovers a person's app mounts and never establishes a destination for capture or edits.
External source mirrors
The root celorga.json can declare portable, non-secret Slack, Notion, and email source intent. For Slack and Notion, Celorga delegates crawling to the MIT-licensed slacrawl and notcrawl binaries instead of implementing provider APIs or desktop-cache parsing itself; email profiles read IMAP directly (see Email sources):
{
"externalSources": {
"team-slack": {
"type": "slack",
"scopes": ["engineering", "product"],
"workspaceId": "T012345",
"media": "metadata-only",
"rawZone": "raw/connectors/slack/team",
"ingestion": {
"since": "14d",
"maxItems": 5000,
"reviewZone": "views/connectors/slack/team"
},
"schedule": {
"enabled": true,
"kind": "interval",
"everyMinutes": 120,
"timezone": "local"
}
},
"company-notion": {
"type": "notion",
"media": "metadata-only",
"schedule": {
"enabled": true,
"kind": "daily",
"time": "02:00",
"timezone": "America/Los_Angeles"
}
}
}
}
The corpus declaration contains no credentials or machine paths. Each authorized machine creates its own binding outside the corpus under CELORGA_INDEX_HOME (by default, an index directory in your home folder):
celorga source list --dir ~/notes --json
celorga source add team-slack --source-json '{"type":"slack","workspaceId":"T012345","syncArgs":["--source","bot","--latest-only"],"ingestion":{"since":"14d"}}' --dir ~/notes # preview
celorga source add team-slack --source-json '{"type":"slack","workspaceId":"T012345","syncArgs":["--source","bot","--latest-only"],"ingestion":{"since":"14d"}}' --dir ~/notes --apply
celorga source add team-slack --update --source-json '{"workspaceId":null,"ingestion":{"since":"7d"}}' --dir ~/notes --apply
celorga source bind team-slack --config ~/.slacrawl/team.toml --dir ~/notes
celorga source bind team-slack --config ~/.slacrawl/team.toml --dir ~/notes --apply
celorga source doctor --dir ~/notes --json
celorga source status --dir ~/notes --json
celorga source import team-slack --dir ~/notes --json
celorga source sync team-slack --ingest --apply --dir ~/notes --json
celorga source schedule team-slack --pause --apply --dir ~/notes --json
celorga source schedule team-slack --kind interval --every-minutes 120 --timezone local --apply --dir ~/notes --json
celorga source schedule team-slack --kind daily --time 08:30 --timezone America/Los_Angeles --apply --dir ~/notes --json
source add PROFILE --source-json JSON creates one externalSources entry of any supported type (slack, notion, or email) and previews until --apply. It accepts only the documented keys, validates schedules, corpus-relative zones, and email settings, and refuses credential-like keys (token, password, secret, apiKey, …) or token-shaped values, so a secret cannot be written into celorga.json this way. --update merges into an existing profile instead: top-level and ingestion keys are replaced, null removes a key, and the type cannot change. bind previews by default and writes its local file with owner-only permissions when applied. Bindings may override the crawler binary, crawler config, and working directory. Archive database, cache, and Markdown storage locations remain explicit in the crawler's machine-local config. status reports crawler archive counts and freshness. import reads the local archive, applies profile scopes, since, and item limits, then previews raw JSON captures plus review-required Org packets. A Notion integration token is itself the API access boundary, so authenticated API records are accepted even when they lack a desktop workspace label; configured scopes still filter desktop-cache fallbacks. Externally supplied bodies are fixed-width quoted in the review packet so headings, TODOs, drawers, and other source syntax cannot become active Org semantics. Pass --apply to write the artifacts. sync --ingest --apply updates the crawler and stages them in one locked operation. Crawler subprocesses time out after 30 minutes by default so scheduled app work cannot remain wedged indefinitely; pass --timeout SECONDS to choose a different bounded deadline for doctor, status, import, or sync. Existing files are rewritten only when their deterministic contents changed, and apply removes obsolete packet pairs only when their raw envelope proves they were generated for that exact source profile. Promotion into canonical notes/ remains a separate human review step.
The optional schedule declaration is portable source intent. kind: "interval" requires a positive integer everyMinutes; kind: "daily" requires a 24-hour time in HH:MM form. timezone accepts local or an IANA timezone name. source list --json validates and returns the normalized schedule. source schedule previews by default and atomically updates only that profile's schedule when applied. --pause and --resume preserve its cadence; setting --kind interval or --kind daily changes the cadence and wall-clock configuration.
The Mac app's Sources surface calls this same CLI contract. It shows source health and archive counts, previews imports, runs one connector immediately with Run Now, pauses or resumes scheduled sync, edits interval or daily cadence and time zone, reveals the review zone, adds or reconfigures any supported source type from one form (Add Source → Slack, Notion, or Email; Configure… on an existing source) through celorga source add, and stores each type's credential (Slack bot token, Notion integration token, or email password) in macOS Keychain, passing it to the sync process as SLACK_BOT_TOKEN, NOTION_TOKEN, or CELORGA_EMAIL_PASSWORD. Set Up with AI opens an AI chat that walks through the same setup as an optional alternative. A manual run refreshes only the connector that ran. While the app process is running it checks configured schedules once per minute. A newly enabled or edited schedule begins with its next future occurrence instead of immediately replaying old time slots; after that, a missed occurrence catches up after wake or on the next app launch. Failed automatic runs retain a visible error and retry after 15 minutes. Last-attempt and next-run bookkeeping is machine-local app state, not canonical corpus data. Credentials never enter celorga.json, raw captures, or review packets. The app and other agents can therefore manage the same corpus profile without making app state canonical.
Email sources
type: "email" profiles sync an IMAP mailbox without a crawler binary. Mail providers list IMAP (for reading) next to SMTP (for sending); Celorga uses the IMAP settings to read new mail and records the SMTP submission server only for reference. The declaration stays non-secret:
{
"externalSources": {
"mail": {
"type": "email",
"email": {
"host": "imap.example.com",
"port": 993,
"security": "tls",
"username": "you@example.com",
"mailboxes": ["INBOX", "Clients"],
"smtp": { "host": "smtp.example.com", "port": 587 }
},
"ingestion": { "since": "14d", "maxItems": 2000 },
"schedule": { "enabled": true, "kind": "interval", "everyMinutes": 30 }
}
}
}
celorga source add-email mail --host imap.example.com --username you@example.com --mailbox INBOX --smtp-host smtp.example.com --dir ~/notes # preview
celorga source add-email mail --host imap.example.com --username you@example.com --mailbox INBOX --smtp-host smtp.example.com --dir ~/notes --apply
celorga source bind mail --password-command "security find-generic-password -s imap.example.com -a you@example.com -w" --dir ~/notes --apply
CELORGA_EMAIL_PASSWORD=... celorga source doctor mail --dir ~/notes --json
celorga source sync mail --ingest --apply --dir ~/notes --json
The password comes from CELORGA_EMAIL_PASSWORD (or the variable named by bind --password-env), a machine-local bind --password-command that prints it, or Celorga's Keychain, which passes it to one sync process. It is never written to celorga.json, bindings, raw captures, or packets. security is tls (default, port 993) or starttls (port 143); certificates are verified, and unencrypted none is accepted only for a loopback test server. Sync opens each mailbox read-only (EXAMINE) and fetches with BODY.PEEK, so it never marks mail as read or changes flags. The first sync covers ingestion.since (default 14 days); later syncs fetch only messages above a machine-local UIDVALIDITY/UID cursor, and a changed UIDVALIDITY restarts from the window. Messages are decoded (MIME encoded words, quoted-printable, base64, charsets; text/plain preferred over HTML converted to text), bounded to maxMessageBytes (default 512 KB) and 20,000 characters of text, and staged as raw JSON plus review-required packets grouped by mailbox and month. Email packets accumulate: new mail merges into the staged month instead of replacing earlier messages. import previews without advancing the cursor; sync --apply (with or without --ingest) fetches and stages in one locked operation. doctor logs in and reports each mailbox's message count; status reports the cursor per mailbox.
Google Calendar sources
type: "google-calendar" profiles read upcoming events from the Google Calendar API without a crawler binary, so the Mac app can offer to record meetings as they start and fill in their attendees. The declaration stays non-secret:
{
"externalSources": {
"calendar": {
"type": "google-calendar",
"googleCalendar": { "calendars": ["primary"], "lookaheadDays": 14 },
"ingestion": { "since": "1d" },
"schedule": { "kind": "interval", "everyMinutes": 15 }
}
}
}
Sign in from the Mac app: Add Source → Google Calendar, then Sign in with Google… on the source's card. The app asks for read-only access (calendar.events.readonly), keeps the refresh credential in Keychain, and sends it to the paired Celorga server (see below). Sync reads the credential from CELORGA_GOOGLE_CALENDAR_CREDENTIAL (JSON with clientId, optional clientSecret, and refreshToken), refreshes a short-lived access token, and fetches each calendar's expanded events from ingestion.since back (default 1d) to lookaheadDays ahead (default 14, at most 90). CELORGA_GOOGLE_CALENDAR_ACCESS_TOKEN may supply an access token directly for testing. Cancelled events are dropped. Each event becomes a raw record whose rawPayload is an org2:calendar-event:v1 object (title, start, end, call link, organizer, attendees with responses, and the signed-in account's own response), staged with review-required packets grouped by calendar and month. Calendar packets are a snapshot of the window, so events that left the window or were cancelled disappear on the next sync. The access token and refresh credential are never written to celorga.json, raw captures, or packets. Builds without a bundled Google OAuth client ask once for a Desktop app OAuth client JSON from a Google Cloud project with the Calendar API enabled and keep it in Keychain.
When a synced meeting with other attendees or a call link is about to start (one minute before, until ten minutes after its start), the Mac app shows a small floating prompt: Record or Join & Record. Declined, all-day, and solo events are skipped, and each occurrence is offered once. Starting a recording from the prompt, or with Record Meeting while a synced meeting is in progress and its title is kept, adds :calendar_event_id:, :scheduled_start:, :scheduled_end:, :calendar_link:, :meeting_url:, and :ATTENDEES: to the meeting note, plus an Attendees section. Each attendee links to a person note when exactly one node's title or ROAM_ALIASES matches the attendee's name or email; add an email as an alias to link reliably. The toggle Offer to record meetings as they start on the source's card turns prompts off.
Source syncs on a connected server
When this Mac is paired with a Celorga server (Settings → Sharing) and that server owns the corpus schedules (celorga server assign), the server performs source syncs for every source type. Tokens, passwords, and Google sign-ins saved in the Sources view are also sent to the server over the paired relay (PUT /v1/sources/PROFILE/credential), which stores them in a mode-0600 file in its private state directory. Run Now asks the server to sync (POST /v1/sources/PROFILE/sync) and the staged files arrive through the corpus's normal file sync. Each source card shows whether the server holds its credential and offers Send to Server to retry; removing a credential on the Mac removes the server's copy. Servers built before this feature report that they cannot accept source credentials, and the Mac keeps syncing locally.
Command conventions and stability
Audit summary for CLI consistency: most commands already use --dir for corpus roots, --recursive for traversal, --format for alternate output, and --apply for mutating writes. The lowest-risk cleanup is to make JSON output easier and consistent across commands.
Conventions:
Prefer
--format jsonfor stable machine-readable output;--jsonis a shorthand alias where JSON output is supported.Preview is the default for mutating commands. Pass
--applyto write files.Use
--dir DIRwith--recursivefor corpus-wide scans, or--file FILE/--files FILE ...for bounded scans.Text/report output is human-facing and may evolve; JSON output is the integration surface.
Examples:
celorga agenda --dir ~/notes --recursive --json
celorga lint --dir ~/notes --recursive --format json
celorga roam node new --dir ~/notes --title "Acme Corp" --apply --json
Agenda
Purpose: query scheduled/deadline items across Org files.
celorga agenda --dir ~/notes --recursive --from 2026-03-01 --to 2026-03-31
Important behavior:
Includes both
SCHEDULED:andDEADLINE:rows in-range.Like Emacs Org, an open task whose
DEADLINE:is coming up also appears on today's date, scheduled or not, for the 14 days before it is due. The row readsDEADLINE in 6 d. 2026-10-15, and JSON addsdeadlineWarning: {due, daysUntil}. A-Ndcookie on the timestamp sets that task's warning period. A task already scheduled for today keeps itsSCHEDULEDrow. Pass--deadline-warning-days Nto change the default period, or0to turn these rows off.Supports broad filter/sort/group dimensions in CLI + VS Code integration.
Normalizes common TODO aliases into stable status buckets (including wait/hold/pause-style states).
TODO + planning edits
celorga todo toggle --file notes.org --line 42 --apply
celorga todo set --file notes.org --line 42 --status in_progress --apply
celorga todo set --file notes.org --line 42 --keyword SKIPPED --apply
celorga plan set --file notes.org --line 42 --kind scheduled --date 2026-03-25 --apply
celorga plan cancel-repeaters --file notes.org --line 42 --format diff
celorga plan cancel-repeaters --file notes.org --line 42 --apply
plan cancel-repeaters turns a recurring entry into a one-off. It removes repeater cookies (+1w, ++1d, .+1m, including habit parts such as .+2d/4d) from every active timestamp in the entry: the headline, SCHEDULED, DEADLINE, and body text up to the next heading. Dates, times, and warning delays such as -2d stay; inactive timestamps, child entries, and source or example blocks are untouched. It previews by default; the JSON preview lists each cancelled cookie with its line.
Set corpus defaults through Settings → General → TODO States in Celorga, or with the guarded CLI:
celorga todo-config show --dir ~/notes
celorga todo-config set --dir ~/notes --sequences-json '["TODO WAITING | DONE SKIPPED"]'
celorga todo-config set --dir ~/notes --sequences-json '["TODO WAITING | DONE SKIPPED"]' --apply
todo-config returns JSON. set previews by default, validates active and terminal states, and preserves unrelated configuration. Pass --if-revision with the revision from show or a preview to reject stale settings; use --sequences-json '[]' to restore built-in defaults. Settings are stored in celorga.json as todo.sequences, an array of Org-style sequence strings. Multiple sequences are supported. Corpus configuration changes invalidate affected agenda and compiled-context caches without rewriting note files.
File-local declarations take precedence over corpus defaults. Declare custom states in the target file, for example #+TODO: TODO MISSED | DONE SKIPPED. --keyword selects the exact spelling; --status also accepts declared custom states alongside standard aliases. Unknown keywords fail with an actionable error. toggle follows the current state’s sequence. Terminal transitions maintain CLOSED, and --logbook records exact state changes. JSON mutation results include oldKeyword and newKeyword alongside the compatible status buckets. Omit --apply to preview.
Point daily navigation at your own dated files with daily-config:
celorga daily-config infer --dir ~/notes --file journal/2026/09/2026-09-29-wind-down.md
celorga daily-config set --dir ~/notes --template 'journal/{YYYY}/{MM}/{YYYY}-{MM}-{DD}-wind-down.md'
celorga daily-config set --dir ~/notes --template 'journal/{YYYY}/{MM}/{YYYY}-{MM}-{DD}-wind-down.md' --apply
celorga daily-config show --dir ~/notes --date 2026-10-01
infer ranks candidate formats from one example path (ambiguous day/month orders return both readings). Formats are corpus-relative paths using {YYYY}, {YY}, {MM}, {M}, {DD}, {D}, {MMM}, {MMMM}, {ddd}, and {dddd}, and must include a month and a day. set previews by default, accepts --if-revision, and stores the format as roam.dailyFileTemplate; --clear restores the roam.dailiesDir/YYYY-MM-DD.org convention. Invalid saved formats are ignored rather than writing outside the corpus.
Checkbox edits
celorga checkbox --file notes.org --line 12
celorga checkbox --file notes.org --line 12 --apply
celorga checkbox set --file notes.org --line 12 --status checked --apply
celorga checkbox cycle --file notes.org --line 12 --fix-cookies --apply
celorga checkbox --file notes.org --line 12 --format json
celorga checkbox fix-cookies --file notes.org
celorga checkbox fix-cookies --file notes.org --apply
The default action, cycle, advances [ ] → [-] → [X] → [ ]. toggle is an alias for that three-state cycle. set --status accepts unchecked, indeterminate, or checked. The one-based --line must point to the list item itself; prose, headings, source/example blocks, and drawers are not checkbox targets. An invalid target or option exits with an error and leaves the file unchanged.
Use fix-cookies to recalculate stale [n/m] and [p%] progress cookies across the file; empty [/] and [%] placeholders are filled at the same time. Each cookie uses the checkbox total from its innermost containing heading; checked items contribute to the completed and total counts, while unchecked and indeterminate items contribute only to the total. This prevents a recursive ancestor total from overwriting a correct descendant cookie. The ordinary cycle and set actions still change only the selected checkbox marker by default. Add --fix-cookies to either action to recalculate cookies from the new checkbox state within the same guarded preview or write.
Writes require --apply. The default output is a diff, and --format text returns the complete edited source. For cycle and set, --format json returns an celorga:checkbox-edit:v1 envelope with the original revision, old/new states, and changed/applied flags. For fix-cookies, it returns celorga:checkbox-cookie-fix:v1 with the same revision guard plus the exact line, old value, expected value, and owned checkbox total for every edit. Pass the preview's revision as --if-revision when applying later to reject stale edits. column in a marker edit is the zero-based UTF-16 position of the marker character, suitable for LSP clients.
Checkbox edits preserve indentation, list numbering, counter cookies, unrelated text, line endings, final-newline presence, symlinks, and file permissions. Setting an already-selected state or fixing a file whose cookies are current reports no change.
The LSP offers a Cycle checkbox to … as a refactor.rewrite code action on checkbox lines. It edits the current unsaved buffer through the client, using the same checkbox semantics as the CLI.
Capture / archive / refile
celorga capture --file inbox.org --title "Quick note" --template note --apply
celorga capture --file journal.org --title "Standup" --datetree year,month,day --apply
celorga archive --file notes.org --pos 120:0 --apply
celorga refile --file notes.org --pos 120:0 --to-file projects.org --to-pos 40:0 --apply
--datetree LEVELS files the capture under a date tree instead of at the end of the file. LEVELS is any comma-separated subset of year, quarter, month, week, and day; headings look like 2026, 2026-Q4, 2026-10 October, 2026-W44, and 2026-10-26 Monday. Missing headings are created in date order among existing siblings, and the entry becomes the last child of the innermost heading. Weeks follow ISO 8601: with week, the year heading is the ISO week-numbering year, a week belongs to the month that contains its Thursday, and quarters are 13-week periods unless month is also used. The date comes from --now (default: now, local time); the JSON preview reports the date tree path and which headings it would create.
Archiving moves the selected subtree to a companion archive file (by default FILE_archive for .org files, otherwise FILE.archive). Archived subtrees receive a property drawer with ARCHIVED_AT, ARCHIVE_SOURCE, ARCHIVE_SOURCE_LINE, ARCHIVE_HEADING_PATH, ARCHIVE_ORIGINAL_ID when the original subtree had an ID, and ARCHIVE_PARENT_ID when its direct parent heading had an ID, so links and backlinks to the old context still resolve. Use --format diff to preview the exact removal/append operation, or --format json for editor/agent integrations.
Formatter
Deterministic formatting for Org files. File-based formatting automatically rewrites accepted input conveniences such as fenced source blocks, Celorga-specific block aliases, and backtick inline code to ordinary Org syntax when the target ends in .org. Mixed directory operations choose the profile independently for each file. Use --canonical-org for stdin, which has no filename, or to force the canonical profile for another target. Celorga, the LSP, and VS Code follow the same extension-aware rule. Syntax canonicalization remains independent of optional general format-on-save settings.
celorga fmt --dir ~/notes --recursive --check
celorga fmt --dir ~/notes --recursive --apply
celorga fmt --file note.org --apply
celorga fmt --stdin --canonical-org
Table formula evaluation
celorga table recalculate --file FILE [--line N] [--formula-index N] [--apply] [--format text|diff|json] evaluates the selected table's safe #+TBLFM: formulas. It previews by default, selects the first formula line unless --formula-index is given, and performs an atomic revision-guarded write only with --apply. Invalid, remote, Emacs Lisp, and otherwise unsupported expressions return diagnostics without changing the file.
Chart rendering
celorga render-chart renders an SVG artifact from #+chart: / #+plot: metadata or an adjacent #+begin_src chart block attached to an Org table. Fenced chart input remains accepted as typing sugar. Editor clients share this backend, so each extension uses the same table parsing and chart semantics.
celorga render-chart --file report.org --block-id quarterly_revenue --out /tmp/quarterly-revenue.svg
celorga render-chart --file report.org --line 42 --format json
The first renderer supports deterministic bar, line, and bucketed histogram charts with x and y column mappings. Canonical .org documents use source blocks:
| bucket | fetches | |--------+---------| | 0-10 | 14 | | 11-50 | 32 | #+begin_src chart histogram x: bucket y: fetches sort: y-desc source: previous-table #+end_src
For data-backed reports, a chart block can also point at a named materialized result table in the same note:
#+name: package_fetches_result #+results: query-fetches-by-company | day | fetches | |------------+---------| | 2026-06-10 | 84 | #+name: package_fetches_chart #+begin_src chart line x: day y: fetches source: package_fetches_result #+end_src
Add sort: x-asc, sort: x-desc, sort: y-asc, or sort: y-desc when a chart preview should be ordered independently of the table rows. JSON output includes ok, format, artifact, source, diagnostics, and svg so VS Code, Vim, or agent tooling can show useful errors for missing columns, unsupported chart types, missing chart sorts, missing named source tables, or missing chart blocks.
Saved property views
celorga property-view provides the shared runtime for Celorga's saved property tables and cards. All responses are JSON. Definitions are portable celorga:property-view:v1 JSON files in views/, with the filename matching the definition ID. Querying scans ordinary Org sources in the active corpus, respects configured ignore patterns, and does not follow symlinks or read hidden directories. It reuses compiled corpus nodes and their effective property inheritance; there is no SQL or separate canonical store.
{
"schema": "celorga:property-view:v1",
"id": "open-work",
"title": "Open work by assignee",
"layout": "cards",
"scope": { "kind": "heading", "filePrefix": "notes/" },
"columns": ["title", "STATUS", "ASSIGNEE", "EFFORT"],
"match": "all",
"filters": [{ "field": "STATUS", "operator": "is", "value": "open" }],
"sort": [{ "field": "EFFORT", "direction": "asc" }],
"groupBy": "ASSIGNEE",
"limit": 500
}
scope.kind is file, heading or all; optional filePrefix is a case-sensitive corpus-relative path prefix and limits file discovery before compilation. columns supports 1–24 fields. Lowercase built-in fields title/document/file/kind/todo/tags/id are read-only; document is the containing Org document title, while other field names normalize to uppercase property keys. match combines zero to 30 filters with all or any; zero filters select every scoped row. Operators is/isNot/contains compare case-insensitive strings, exists/missing test nonempty/empty values, matches tests a case-insensitive JavaScript regular expression, gt/lt compare finite numeric values, on/before/after compare the first YYYY-MM-DD found in the field (plain dates, Org timestamps, ISO date-times, or dated file names) with a YYYY-MM-DD value, and active/terminal use the compiled TODO workflow for the todo field. Missing values never satisfy numeric or date comparisons; invalid regular expressions and non-date values for date operators are rejected when the definition is parsed. Filter values may contain date variables, resolved in local time each time the view runs and stored verbatim in the definition: {today}, {yesterday} and {tomorrow} yield YYYY-MM-DD; ±N followed by d, w, m or y offsets them, as in {today-7d} or {today+1m}; {month} yields YYYY-MM and {year} yields YYYY. Other brace text stays literal. For example, [{"field":"file","operator":"on","value":"{today}"},{"field":"CREATED","operator":"on","value":"{today}"}] with match: any lists files from today without hard-coding a date. sort supports up to eight fields with asc/desc; two numeric values sort numerically, otherwise case-insensitive lexical order applies, with source keys as stable tie-breakers. Optional groupBy emits a group value per row; clients preserve sorted order within each group. limit is 1–5,000; total and truncated report omitted rows.
celorga property-view list --dir CORPUS
celorga property-view suggest --prompt 'Show unfinished project tasks grouped by project' --dir ~/notes
celorga property-view query --dir CORPUS --view open-work
celorga property-view query --dir CORPUS --definition '{"schema":"celorga:property-view:v1","id":"all-notes","title":"All notes","layout":"table","scope":{"kind":"file"},"columns":["title","ASSIGNEE"],"match":"all","filters":[],"sort":[],"limit":500}'
celorga property-view save --dir CORPUS --definition 'JSON_DEFINITION'
celorga property-view save --dir CORPUS --definition 'JSON_DEFINITION' --apply
celorga property-view edit --dir CORPUS --file notes/work.org --kind heading --line 12 --property STATUS --value review --if-revision 'sha256:SOURCE_REVISION'
For updates to an existing definition, both preview and apply require its --if-revision from list or the previous save. New saves require the destination to be absent. Each query row includes file, kind, line, source revision, local properties, inheritedProperties, requested values, and editable. Pass the exact row identity and revision to edit, inspect its old/proposed values and content, then repeat with --apply. Atomic writes check the same revision before replacement. A stale row must be queried again; never guess a line after the source changes.
Editing uses canonical parsed source ranges, retains unrelated lines and CRLF line endings, and writes only the selected local drawer. Inherited values become local overrides; an empty value is explicit and does not remove a property. IDs, built-in fields and CELORGA_ metadata cannot be changed through this command. Paths outside the active corpus, hidden state and raw/ imports are rejected. Property views do not mutate TODO keywords or stable links. Malformed or duplicate property drawers fail closed. A view definition can be copied to another corpus without machine bindings; its selected corpus-relative sources must exist there for results to appear.
People and companies
celorga crm is the shared runtime behind the People & Companies app. It is a
view over ordinary corpus records, not a separate database:
-
People and companies are entity notes with
:ORG2_ENTITY_TYPE: personorcompany(organizationalso counts as a company). The ID, title, and aliases come from the note. -
Fields are ordinary properties:
CRM_STAGE,EMAIL,DOMAIN,ROLE,OWNER, and, for a person,COMPANY(an[[id:…]]link or a company name). -
Follow-ups are TODO headings in the note itself, TODOs whose
COMPANY,ACCOUNT,PERSON,ATTENDEESor similar property names, links, or emails point at the entity, and TODOs inside a related meeting. -
Meetings are headings with
:kind: meetingor calendar properties. Ameeting relates to everyone it links or lists.
-
Outreach comes from work-ledger accounts (
notes/LEDGER/accounts/). Anaccount joins a company by an explicit
org-id:<company ID>identity key, then bydomain:oremail:identity keys, then by an unambiguous name (ignoring suffixes such as Inc. or Corporation). Accounts without a company note are listed as outreach-only companies. -
Upcoming meetings come from staged
celorga:calendar-event:v1recordsunder
raw/connectors/google-calendar/. Attendees match people by email and companies by domain. Your own domain and common free-mail domains never identify a company.
A person's company is the explicit COMPANY property, else their email
domain, else the single company their note links to. People's follow-ups and
the meetings they attended also appear on their company. A company without a
stage that has outreach shows the inferred stage lead.
Activity separates contact from mentions:
-
Last touch (
lastTouchAt,lastTouchType) is direct contact: a meetingthey attended, a past calendar event with them, or outreach sent or received. A meeting's attendees are entities linked in its title or named by it (
Meeting: Jane Doe,Acme | Example sync), listed in itsATTENDEES,PARTICIPANTS,WITH,COMPANYor similar properties, under anAttendeesorParticipantsheading, or on aParticipants:line. A person's attendance also touches their company. -
Last mentioned (
lastMentionAt,lastMentionType) is the latest meetingor note that only brings them up, such as a colleague mentioning a company in someone else's meeting.
Timeline items carry role (attended or mentioned), meetingCount counts
attended meetings and calendar events, and lists sort by last touch, then last
mention. Your own domains (crm.selfDomains plus the domains of your own
calendar identities) never identify a company.
celorga crm list --dir CORPUS [--kind people|companies] [--stage customer] [--query acme]
celorga crm list --details --dir CORPUS
celorga crm warm --dir CORPUS
celorga crm show 'Acme Robotics' --dir CORPUS
celorga crm resolve jane@acme.test --dir CORPUS
celorga crm set 'Acme Robotics' --field stage --value customer --dir CORPUS --apply
celorga crm set 'Jane Doe' --field company --value 'Acme Robotics' --dir CORPUS --apply
celorga crm follow-up 'Acme Robotics' --title 'Send pricing' --scheduled '2026-03-03 10:00' --dir CORPUS --apply
celorga crm create company --from-ledger outreach/initech --dir CORPUS --apply
celorga crm create person --title 'Dana Lee' --email dana@initech.test --company Initech --dir CORPUS --apply
celorga crm link --dir CORPUS
celorga crm link --only PROPOSAL_ID --dir CORPUS --apply
celorga crm upcoming --dir CORPUS --days 7
celorga crm schedule --dir CORPUS --days 5 --hours 09:00-17:00 --duration 30
A reference is an ID, title, alias, email, domain, or ledger:LEDGER/ID;
ambiguous references fail. All responses are JSON (celorga:crm-index:v1,
celorga:crm-entity:v1, and so on). Writes preview by default and are
revision guarded; set accepts --if-revision.
-
setedits one property in the entity's own drawer.companyvalues areresolved to an ID link and require the company note to have an
:ID:. -
follow-upappends a TODO with optionalSCHEDULED,DEADLINE, priority,and a
CREATEDtimestamp to the note (or under a heading entity). -
createwrites a new note in the configured notes folder. With--from-ledgerit uses the account's title and domain and adds theorg-id:identity key to the ledger account under the ledger lock. -
linklists explicit links for matches Celorga inferred: ledger account tocompany (
org-id:key), person to company (COMPANY), a person's only email (EMAIL), and a company's ledger domain (DOMAIN). Each proposal has a stable ID; apply all or--onlysome of them. -
upcomingbriefs the next external meetings with each company's stage, lasttouch, last outreach, and next follow-up.
-
scheduleproposes free working-hour slots for open follow-ups that are duewithin
--days(default 5) or overdue by at most--overdue-days(default 14). Busy time comes from staged calendar events and already-timed TODOs. Applying rewrites only each TODO'sSCHEDULEDline, for example to<2026-03-02 Mon 16:00-16:30>. Nothing is written to a calendar provider.
Optional celorga.json keys: crm.stages (pipeline stages; default lead,
prospect, opportunity, customer, partner, former), crm.include
(extra corpus globs to scan), and crm.selfDomains (your team's email
domains).
Reads use a disposable, machine-local snapshot of the computed index and every
entity's activity. It is reused while no source file or directory, ledger
account, staged calendar file or celorga.json changed, which is checked with
stat calls only, and is rebuilt on the next read otherwise; on a large corpus
a reused snapshot answers in well under a second. crm warm builds it ahead
of time (--rebuild forces a rebuild), and every read reports cache.hit.
crm list --details also returns each entity's tasks, timeline and upcoming
meetings in one response.
Workspace apps
Optional workspace apps add pages to the Celorga app sidebar and stay hidden
until a corpus turns them on. Built-in apps are crm (People & Companies) and
canvases (Canvases); installed plugins with app surfaces appear as
plugin:PLUGIN_ID. The choice is portable corpus intent in celorga.json:
{ "apps": { "enabled": ["crm"], "disabled": ["plugin:example.board"] } }
celorga apps list --dir CORPUS
celorga apps enable crm --dir CORPUS --apply
celorga apps disable canvases --dir CORPUS --apply
celorga apps render example.board:pipeline --dir CORPUS
apps list returns each app with enabled, defaultEnabled, its surfaces,
and a suggestion when the corpus already holds data the app is useful for,
such as people and company notes or ledger accounts for People & Companies.
enable and disable preview the new celorga.json and write only the
apps key with --apply. render runs a trusted, enabled plugin surface; see
the plugin contribution reference above.
Interactive workspace views
celorga view saves a reusable interactive view as one JSON file, views/ID.org2-interactive-view.json, next to saved property views. The first kind is daily-plan. The file holds the view's query (kind, deadlineHorizonDays), the person's remembered choices (availableMinutes, order, excluded, per-task estimates in minutes) and a bounded history of guarded actions. It is the only state store for interactive chat answers: a plan shown in chat refreshes a saved view instead of keeping its own state. Ordinary Org files stay canonical.
celorga view create today --title 'Plan my day' --available-minutes 360 --dir CORPUS --apply
celorga view refresh today --date 2026-03-02 --dir CORPUS
celorga view refresh today --format org --dir CORPUS
celorga view state today --patch '{"order":["id:TASK"],"excluded":[]}' --if-revision 'sha256:VIEW_REVISION' --dir CORPUS --apply
celorga view action today --action '{"action":"schedule","task":"id:TASK","date":"2026-03-03"}' --dir CORPUS
celorga view action today --action 'SAME_JSON' --fingerprint 'sha256:PREVIEW' --if-revision 'sha256:SOURCE_REVISION' --dir CORPUS --apply
celorga view undo today --action-id ACTION_ID --dir CORPUS --apply
celorga view bridge today --message 'FRAME_INTENT_JSON' --dir CORPUS
refresh recompiles canonical sources (excluding views/ and raw/) and returns open TODOs scheduled for the date, overdue, or due within the deadline horizon. Each item has a stable key (id:UUID, or file:PATH::TITLE without an ID), its source file, line, link and file revision, an estimate (remembered, else EFFORT, else 30 minutes), its start offset and whether it fits the available time. Remembered keys whose task no longer qualifies are reported in staleKeys rather than dropped. --format org emits a note with source links and an html source block; Celorga runs that block in its usual opaque-origin sandbox.
Saving choices requires the view revision. The only action is schedule, which changes one task's SCHEDULED line. Preview returns the exact planning-line diff, the source revision and a fingerprint bound to the view, action, file and lines; apply requires both and fails with ORG2_WRITE_CONFLICT (exit 3) when the source changed. Applied actions are recorded with the exact before and after planning lines. undo previews by default and restores those lines only when the file is still at the revision the action produced.
Sandboxed controls post org2-view-intent messages with version: 1, the viewId and one of three intents: set-state (with viewRevision and a choice patch), preview-action, or open-source. Hosts validate them with view bridge or the shared parseViewBridgeIntent contract, which rejects unknown intents and fields, a different view ID, and oversized messages. There is no apply or undo intent; applying a preview needs a person's confirmation outside the frame.
Data queries
Local Celorga datasets
Ordinary SQL notebooks can query their own corpus with type: celorga. The adapter uses the canonical transcript loader, including writer-head reconciliation and shard digest checks, rather than globbing old JSON history. It never loads another corpus. Supported source values are chat-threads (thread identity, title, destination, runtime, settlement and archive state), chat-messages (message identity, stable order, UTC timestamps, text, delivery state, failure, destination and room-round attribution), and chat-turns (turns reported by fresh online hosts). The since window is 1 to 3650 days, defaulting to 7d; thread and message relations are limited to that window. Queries over an empty corpus retain the same typed columns. More than 100,000 rows fail with a diagnostic requesting a shorter window.
#+begin_src dataset messages type: celorga source: chat-messages since: 7d #+end_src #+begin_src sql results=message_states SELECT delivery_status, count(*) AS messages FROM messages WHERE role = 'user' GROUP BY delivery_status #+end_src
All local relations in a result share one transcript snapshot. Reads do not mutate chat state, retry work, or settle conversations. --inspect validates the declaration without opening chat storage. Paths, URLs, profiles, credentials, and remote-query arguments are rejected for this local dataset type. Timestamp columns are ISO 8601 UTC strings; cast them to TIMESTAMPTZ for comparisons, and use AT TIME ZONE 'UTC' before formatting a UTC label. chat-turns omits stale host claims. The adapter returns records; business rules such as unanswered-reply matching belong in the note's SQL. See examples/chat-response-queue/views/unanswered.org for a report using all three relations, including shared rooms and uncertain reply associations.
Use the existing Refresh Data action or query-data --all-results --apply to replace generated tables. Opening a note still does not execute a query. Ordinary Org links of the form org2-chat:THREAD-UUID open the conversation from the macOS reader. Query definitions can sit inside a closed Org drawer while their named generated tables remain visible outside it.
In the reader, generated #+query-data: provenance appears as a compact refresh-time and row-count disclosure. Expand it to inspect query and script hashes; the complete metadata remains in Org source.
External and table datasets
celorga query-data is the DuckDB-backed bridge for local and remote datasets described in Org notes. It scans #+begin_src dataset blocks, creates DuckDB views for explicit csv, parquet, or json paths/URLs, named Org tables, ClickHouse queries, or saved Metabase questions, optionally creates reusable SQL views from #+begin_src sql view=NAME blocks, then runs a #+begin_src sql results=NAME block and materializes the returned rows. Equivalent fences remain accepted as typing sugar.
#+begin_src dataset fetches type: csv path: ./data/package-fetches.csv engine: duckdb #+end_src #+begin_src sql results=fetches_by_state artifact=views/fetches_by_state.org freshness=24h SELECT state, count(*) AS fetches FROM fetches GROUP BY state ORDER BY fetches DESC #+end_src
Reusable SQL views can sit between datasets and the final materialized result:
#+begin_src sql view=california_fetches SELECT state, fetches FROM fetches WHERE state = 'CA' #+end_src #+begin_src sql results=fetches_by_state SELECT state, sum(fetches) AS fetches FROM california_fetches GROUP BY state #+end_src
Read-only HTTP(S) or file: URLs can be recorded with url: when DuckDB can read the source directly:
#+begin_src dataset remote_fetches type: csv url: https://data.example.test/package-fetches.csv engine: duckdb credential: env:SCARF_API_TOKEN config: profile:product-analytics #+end_src #+begin_src sql results=remote_fetches_by_state SELECT state, count(*) AS fetches FROM remote_fetches GROUP BY state #+end_src
Named celorga tables can also become local DuckDB views without an intermediate CSV export:
#+name: raw_fetches | state | fetches | |-------+---------| | CA | 42 | | NY | 24 | #+begin_src dataset fetches type: table source: raw_fetches engine: duckdb #+end_src #+begin_src sql results=fetches_total SELECT sum(fetches) AS fetches FROM fetches #+end_src
celorga query-data --file report.org --results fetches_by_state
celorga query-data --file report.org --line 42 --format json
celorga query-data --file report.org --inspect --include-script
celorga query-data --file report.org --results fetches_by_state --out views/fetches_by_state.org
celorga query-data --file report.org --results fetches_by_state --apply
celorga query-data --file report.org --all-results --apply --format json
cat report.org | celorga query-data --stdin --results fetches_by_state
The default output is a named org table with #+name: fetches_by_state so it can be pasted or written into the note and consumed by render-chart via source: fetches_by_state. --apply inserts that generated block after the selected SQL block or replaces the existing #+query-data: result...= block in place. --all-results --apply runs every named SQL result first, applies the complete set in memory, advances existing #+updated: and CELORGA_OBSERVED_AT file metadata from the latest successful result timestamp, and writes the source file once only after all results succeed; any query failure leaves the file unchanged. Materialized tables include a compact provenance line with the result id, row count, explicit source dependencies, optional artifact/freshness, query and script hashes, and ran_at timestamp. Add artifact=PATH to record an intended materialized output and freshness=24h, ttl=24h, or max-age=24h when clients should know how long a result can be treated as fresh. SQL result ids must be unique within the note, and dataset ids and SQL view ids share DuckDB's relation namespace. Inline bearer tokens and passwords are rejected. JSON output includes diagnostics, dataset metadata, SQL views, available result blocks, provenance, rows, and the generated org table; --include-script includes DuckDB setup SQL. Use --inspect to parse without running DuckDB. Celorga uses its bundled DuckDB engine by default; --duckdb PATH is an explicit CLI-engine override. ClickHouse and Metabase datasets resolve named dataSources profiles from the nearest celorga.json; secrets are read only from profile-named environment variables or the Mac app's Keychain workflow. Metabase datasets may target saved questions or include reproducible native SQL with a configured database ID. Remote refresh is explicit: HTML export and merely opening a note in the Mac rendered view never execute warehouse queries. See the language reference for profile and dataset examples.
Agent discovery and retrieval
Agents should begin by querying the installed version rather than relying on remembered documentation:
celorga agent capabilities
celorga agent --help
The capability command emits celorga:capabilities:v1 JSON covering workflows, safety rules, client roles, and canonical documentation entry points. The remaining agent subcommands return bounded celorga:agent-context:v1 JSON with citations and source ranges. celorga context is the human/prompt-friendly shorthand, celorga brief renders a cited synthesis, and celorga compile corpus emits a complete schema-versioned corpus artifact.
See Agent quickstart for the operating contract and common recipes.
Explainable activity, events, and waits
celorga activity explains agent work from structured records only: host presence files under .celorga/openclaw-chat.store/live/, committed chat transcript metadata and message provenance, the AI chat inbox, durable run event logs, workflow trigger attempts, and workflow dispatch locks. It never scrapes terminal output.
celorga activity explain --dir ~/notes # everything working or waiting on you
celorga activity explain --run RUN_ID --dir ~/notes --json
celorga activity explain --thread THREAD_ID --dir ~/notes --json
celorga activity explain --workflow WORKFLOW_ID --dir ~/notes
celorga activity trace --run RUN_ID --dir ~/notes # why did this run stop?
celorga activity hosts --dir ~/notes --json
celorga activity events --since 2h --type run.*,approval.* --dir ~/notes --json
celorga activity events --follow --json --dir ~/notes # NDJSON stream until interrupted
celorga thread wait THREAD_ID --until reply --timeout 600 --dir ~/notes --json
celorga run wait RUN_ID --until approval|blocked|completed --timeout 3600 --dir ~/notes
Each celorga:activity-explanation:v1 item names its state (working, queued, needs-you, your-turn, failed, scheduled, due, paused, idle, settled, or done), a stable reason.code with a one-sentence summary, reportedBy (host, host kind and connection state, runtime, destination, model, last actor), lastSignal (heartbeat, transition, message, or trigger attempt with its age), confidence (live while the reporting host's presence is fresh, cached for committed records, uncertain when presence is stale or a delivery is unresolved) with a reason, and blocking entries for the exact approval (run, approval ID, action, risk class, fingerprint, and the decision command), clarification question, delivery failure, artifact review, or unread reply. Explanations never decide approvals.
activity trace --run RUN_ID follows one run through five stages: dispatch (creation, start transition, the request message with its receiving and executing hosts, queued send requests), executor (the host presence reporting its turn), tools (recent tool activity while the turn is live), result (the executor's reply, the run's completion or failure), and delivery (whether the reply reached the conversation and the run record). Each stage has a status (ok, active, pending, warning, failed, unknown, or not-applicable) and evidence references to run events, transcript messages, presence files, or inbox envelopes. The org2:run-trace:v1 verdict describes what is happening, which can differ from the run record:
queued,waiting(approval or question),failed,completed, andcanceledagree with the record when no executor evidence contradicts it.runningrequires a fresh heartbeat or a run event from the last 15 minutes. A run marked failed or canceled whose executor still reports a live turn isrunning(executor-active-after-terminal).completed-undeliveredmeans the executor produced a result that has not reached its destination: an automation reply never recorded on the run (result-unrecorded), a reply after the run was marked failed (result-after-failure), or a completed run whose reply failed or is only queued. A chat reply alone never makes a runcompleted.unknowncovers stale or missing presence, idle executors on open runs, and silent runs. It is reported withuncertainconfidence rather than guessed.
A run returns to the agent that carries it. When the app resumes a run, sends a Reply & Resume answer, continues approved work, or hands back a requested revision, it uses, in order: the run's destinationRef, the destination in its latest AI destination: ID comment, the destination of its linked AI chat, OpenClaw for runs the OpenClaw lifecycle adapter created, the preferred runtime of its AGENT_REF profile, and finally the default run destination configured in Settings → AI Chat → Agent Work (the first enabled destination when none is chosen). Only runs whose agent is an OpenClaw Gateway destination use the Gateway's run methods. An agent that creates a run from a chat links it with celorga run create --thread ORG2_AI_CHAT_THREAD_ID (and optionally --destination-ref ID), which records that chat on the run so resuming it goes back to the same agent.
A run's status is a claim, not a lease: celorga run start and celorga run resume start no executor. The trace links a run to its executor through the latest AI chat thread: ID line in the run's comments; the app writes that line whenever it hands a run to a conversation, including Resume, Reply & Resume, approval continuations, and revisions, so the trace and coordinator follow the conversation that is actually doing the work. activity explain and workspace coordinate use the same 15-minute window: a run marked running with no live turn and no run event for 15 minutes is reported as silent with uncertain confidence, which the coordinator lists as stuck. To recover once you confirm nothing is working on it, record that on the run: celorga run block ID --reason TEXT to continue it with direction (Reply & Resume in the app), or celorga run fail ID --reason TEXT to retry it.
Findings name slow tools (running without an update for five minutes), shell errors in failed tool calls (such as command not found or no matches found), stale hosts, a turn reported by a host other than the one it was dispatched to, unrecorded results, and queued deliveries. retry states whether re-queuing is safe and recommends retry, wait, record-result, redeliver, decide, inspect, or none. celorga run retry runs the same check and refuses unless the verdict is failed or canceled; --force retries anyway and records the overridden verdict as a run comment.
activity hosts classifies each Celorga host as online (heartbeat within 150 seconds), authentication-needed (online, but a destination reports that it needs sign-in), reconnecting (missed heartbeats for up to 15 minutes), stale (silent longer), or offline (signed off cleanly). Silent hosts keep their last-known turns as cached state. failoverHostRefs lists online hosts that have one of the same destinations enabled.
activity events emits celorga:activity-event:v1 records: run.created, run.queued, run.running, run.waiting-approval, run.blocked, run.completed, run.failed, run.canceled, approval.requested, approval.decided, thread.prompted, thread.working, thread.reply-received, thread.needs-you, thread.idle, workflow.dispatched, and host.<state>. Run and approval events are replayed from append-only run event logs with their original timestamps and stable IDs, so a consumer can resume with --since. --follow replays history and then watches the run, chat store, presence, inbox, and workflow directories, with a polling floor for synchronization tools that bypass file events.
Waits evaluate their condition against durable state before watching, so a transition that lands between a prompt and the wait is never missed. thread wait --until reply treats the latest prompt (or --after MESSAGE_ID / --since) as its baseline and is satisfied by a committed assistant message or a queued thread post reply. needs-you, idle, and working use the same explanation states as activity explain. run wait accepts approval, blocked, needs-you, running, completed, failed, terminal, or status:STATUS. Exit status is 0 when matched, 2 when the run reached a terminal state that can no longer satisfy the condition, and 124 on --timeout.
Workspace coordinator
workspace coordinate answers, in one read-only pass, what needs you, what is stuck, what is working, what shipped, and what can safely continue across explicitly mounted corpora and every host that publishes presence into them. It composes activity explain, host presence, and completed run records; it invents no execution state.
celorga workspace coordinate --dir ~/notes # one corpus
celorga workspace coordinate --mount ~/notes --mount ~/team --since 48h --json
celorga workspace continue co_0123abcd --mount ~/notes --mount ~/team # preview
celorga workspace continue co_0123abcd --mount ~/notes --mount ~/team --apply
The celorga:workspace-coordination:v1 envelope carries hosts (per corpus, with state, draining, enabled destinations, and active turns), needsYou (approvals, questions, artifact reviews, failed deliveries), stuck (failed runs, and work whose durable state claims progress that live presence cannot confirm), working, shipped (runs completed within --since, default 24h, with outcome, artifacts, validations, and whether review is still pending), and continuations. Each item links evidence: the run record path and revision, the canonical task heading that names the run (:ORG2_RUN_ID: inside the run's own context references, with file and line), and the run, transcript, and presence evidence from activity explain. A pending approval is "needs you", never "stuck".
Continuation offers are bound to the run revision and the linked chat's latest message. A thread-send offer is allowed only when the run is open in its durable record, no approval is pending, a single-agent, unarchived chat is linked (by an AI chat thread: run comment or the task's :CELORGA_THREAD_ID:), no host reports a turn for it, no request is queued or unresolved, a running run has been quiet for --quiet-minutes (default 15), and a route exists: the host that last executed the conversation if it is online, not draining, and signed in to the destination, otherwise another such host (failover). A failed run without a chat gets a run-retry offer only when it is the newest run for its work, has an assignee, agent ref, or destination to pick it up, and is not an attempt owned by a workflow scheduler. Every offer lists each guard with its result.
workspace continue OFFER_ID re-derives the workspace, refuses a stale or guarded offer without writing, and previews by default. With --apply it performs exactly one action: an idempotent thread send (key workspace-continue:RUN:REVISION) plus a revision-guarded run comment, or a revision-guarded run retry. Its result reports what remains unconfirmed and the thread wait or run wait command to check. Queuing never confirms that a turn started. MCP clients use celorga_workspace_coordinate and celorga_workspace_continue (not on the read-only endpoint).
Attention digest
workspace attention answers one question deterministically: does anything need the person now? It composes approvals, agenda, the workspace coordinator, and the committed chat summary, and applies the person's own preferences. It never ranks, summarizes with a model, or decides importance.
celorga workspace attention --dir ~/notes # text
celorga workspace attention --dir ~/notes --mode brief --json # morning brief
celorga workspace attention --dir ~/notes --mark-delivered --fingerprint att_0123... # preview
celorga workspace attention --dir ~/notes --mark-delivered --fingerprint att_0123... --apply
Categories: approval (pending approvals, reported once even when a run or chat is blocked on them), blocked (runs blocked on a question, orphaned workflow dispatch locks), review (artifacts awaiting review), reply (chats with an unread agent reply, a background report, an interrupted turn, or a failed delivery), failed (failed runs), overdue (unfinished deadlines before today), and today (deadlines and scheduled items dated today; deadline warnings and habits are left out). Each item has a stable fingerprint derived from the state that makes it need attention, a ref such as notes/tasks.org:9, run:ID, or thread:ID, evidence, and an inspection command. --since DURATION drops run and chat items whose last signal is older.
Preferences live in celorga.json; unknown keys or malformed values are rejected:
{
"attention": {
"excludeCategories": ["failed"],
"excludeTags": ["someday"],
"excludePaths": ["archive/**"],
"quietHours": { "start": "22:00", "end": "07:00" },
"morningBrief": "08:30",
"checkIntervalMinutes": 120
}
}
includeCategories narrows the categories instead. Times are local to the machine running the command; quiet hours may wrap midnight. With --mount, each corpus filters its own items and the first corpus supplies quiet hours and schedule.
interrupt is true only when an item's fingerprint was never delivered and the current time is outside quiet hours; --mode brief interrupts for any item. The notification field carries a deterministic title, body, and the fingerprints it covers. Delivery is recorded in the corpus state directory (attention/delivered.json) only with --mark-delivered --apply, for exactly one corpus; --fingerprint restricts marking to the items a notification showed, and --if-revision SHA256|absent guards the ledger.
The Celorga app for macOS has an opt-in Attention setting (off by default) that runs this command with the bundled CLI at the morning brief time and every checkIntervalMinutes outside quiet hours, posts one notification when interrupt is true, marks exactly those fingerprints delivered, and opens a list of the items with evidence links when the notification is clicked. The iOS app does not receive attention notifications yet.
Chat thread automation
celorga thread reads the corpus-owned AI chat transcript from its authoritative sharded store, with compatibility for the older single-file transcript. Reads also project pending operation-journal entries, so active and settled threads retain the same stable ID, messages, session key, context, and timestamps while queued changes remain visible. Settlement is a reversible work-state transition, not deletion.
celorga thread list --dir ~/notes --state all --json
celorga thread show THREAD_ID --dir ~/notes --json
celorga thread post THREAD_ID --message "The export is ready" \
--author "Research Agent" --agent-ref AGENT_REF \
--source run:RUN_ID --idempotency-key RUN_ID:complete --dir ~/notes
celorga thread post THREAD_ID --message "The export is ready" \
--author "Research Agent" --agent-ref AGENT_REF \
--source run:RUN_ID --idempotency-key RUN_ID:complete --dir ~/notes --apply
celorga thread post ROOM_ID --message "The export is ready for review" \
--author "Research Agent" --request-turn @codex \
--idempotency-key RUN_ID:review --dir ~/notes --apply
celorga thread send THREAD_ID --message "Please review the export" \
--idempotency-key RUN_ID:review --dir ~/notes # preview
celorga thread send THREAD_ID --message "Please review the export" \
--idempotency-key RUN_ID:review --dir ~/notes --apply
celorga thread configure ROOM_ID --agent-turn-limit 6 --dir ~/notes --apply
celorga thread configure ROOM_ID --agent-turn-limit default --dir ~/notes --apply
celorga thread settle THREAD_ID --dir ~/notes # preview
celorga thread settle THREAD_ID --dir ~/notes --apply
celorga thread reopen THREAD_ID --dir ~/notes --apply
celorga thread configure --auto-settle 604800 --dir ~/notes --apply
celorga thread configure --auto-settle never --dir ~/notes --apply
celorga thread auto-settle --dir ~/notes # preview eligible IDs
celorga thread auto-settle --dir ~/notes --apply
thread post is a no-turn background delivery surface for agents and automations. Preview is the default; --apply atomically queues an celorga:ai-chat-inbox-message:v1 envelope under .celorga/ai-chat-inbox/. MCP clients can perform the same delivery with celorga_thread_post. The running Mac app watches that append-only inbox, merges the attributed assistant message on its main actor, reopens a settled destination, marks the post unread when the thread is not visible, runs the normal sound/push notification path, persists the transcript, and only then removes the envelope. If the app is offline, it drains queued envelopes when that corpus is opened. An envelope whose thread is absent stays queued for 24 hours in case the thread is still syncing; after that it moves to .celorga/ai-chat-inbox-undeliverable/ for inspection instead of failing on every drain. --idempotency-key is scoped to the destination thread and prevents retries from duplicating a delivered post. --agent-ref preserves the portable agent identity; --author supplies its readable chat label; --source can retain a run or provider reference. Without --request-turn, the post does not invoke, steer, or enqueue any AI runtime.
In a shared room, --request-turn AGENT (repeatable, or comma-separated; MCP requestTurn) asks room agents to respond to the post. Each value is a destination ID or @mention; Celorga resolves it against every enabled agent when it delivers the post, the same way a person's @mention does, adds a named agent that is not yet in the room to it, queues one turn per agent with the post as its request, and adds a room notice for any name it cannot resolve. all means the agents already in the room. The CLI rejects --request-turn for a single-agent thread. The request is part of the idempotent envelope, so a retry never runs a turn twice.
Queueing a request does not confirm a model turn started. JSON results distinguish deliveryStatus (preview, queued, or delivered) from turnStatus (not-requested or unconfirmed). A duplicate already present in the transcript reports delivered; its turn outcome remains unconfirmed. The running Celorga app must consume the envelope, resolve an enabled room agent, and admit the request under the room's turn limit. Check for a subsequent reply with celorga thread wait ROOM_ID --after MESSAGE_ID --until reply --dir CORPUS --timeout 60, using the posted message's ID. A reply wait observes chat activity; it does not itself launch or guarantee a turn.
For an existing single-agent chat, thread send THREAD_ID --message TEXT previews an explicit user send; add --apply to queue it, and use --idempotency-key KEY for retries. --author optionally supplies a request label (default CLI). This uses the existing destination queue, routing and runtime ownership; it queues a follow-up while a turn is active and does not steer that turn. It accepts single-agent chats only; shared rooms use thread post --request-turn. A consuming Celorga host must support celorga:ai-chat-send-message:v1 and have the original named destination enabled. Older consumers retain that separate schema as unsupported, and missing or changed destinations remain queued with a diagnostic. The user message is persisted before the envelope is removed and dispatch begins. Replaying its message ID cannot start a second turn. JSON delivery status remains separate from the unconfirmed runtime start; thread wait THREAD_ID --after MESSAGE_ID --until reply checks subsequent replies, and a queued send does not count as a reply. MCP clients use celorga_thread_send (threadId, message, optional author and idempotencyKey) for the same applied send, and celorga_thread_list to find thread IDs, runtimes, destinations, and shared rooms; both are omitted from the read-only endpoint. Agents should hand work to another agent this way instead of creating an automation or scheduled workflow just to trigger a turn. Removing --request-turn only queues a background message; thread reopen only changes settlement state, and run start only changes durable run state. None of those actions dispatches a model turn.
Agents in a shared room can also start each other's turns: when an agent's reply @mentions another agent in the room, that agent's turn is queued with the reply as its request, and its answer is captioned "requested by" the first agent. Mentions inside source blocks, Markdown code, or Org verbatim and code markup are ignored, an agent cannot request its own turn, and only agents already in the room are reached. thread configure ROOM_ID --agent-turn-limit N caps how many agent-requested turns may run back to back before a person replies (default 4, maximum 50, 0 turns hand-offs off, default restores the default); a message from a person resets the count. When the limit stops a hand-off, the room shows a notice instead of starting the turn. The same setting is in the room's Default menu in Celorga.
thread settle/reopen, thread configure --auto-settle never|SECONDS, thread configure ROOM_ID --agent-turn-limit N|default, and thread auto-settle are also preview-first. With --apply they atomically queue celorga:ai-chat-operation:v1 envelopes under .celorga/ai-chat-inbox/operations/ instead of directly rewriting the transcript. Celorga drains these operations in deterministic order while running or when the corpus opens, commits each resulting transcript and settlement-settings generation durably, and only then removes that operation file. An invalid entry or failed durability barrier remains in the journal for inspection and retry.
The selected Mac chat is identified in Codex, Claude Code, Pi, OpenCode, and OpenClaw workspace prompts by CELORGA_AI_CHAT_THREAD_ID. Pass that marker into a subagent, cron task, or other background worker only when it is explicitly expected to report after its parent turn ends; also pass the active corpus root, readable author, source/run reference, and a stable idempotency key. For a long-running command, celorga job start --thread CELORGA_AI_CHAT_THREAD_ID --dir CORPUS --label TEXT --apply -- COMMAND does this without a hand-built worker (see Background jobs). Embedded Codex advertises celorga_thread_post as a native dynamic tool, while celorga mcp serve exposes the same tool through MCP tools/list. The OpenClaw lifecycle plugin adds the conditional CLI guidance to workflow and continuation prompts. It deliberately does not mirror every foreground completion because the ordinary assistant reply already reaches the thread.
The transcript schema keeps the legacy isArchived field for older clients and adds settledAt plus settlementSettings.autoSettleAfterSeconds. Existing archived threads therefore load as settled, while older unclassified threads remain active. Auto-settlement excludes the selected thread, pinned or unread threads, pending turns, and a latest message that is still sending, failed, or interrupted. Empty threads and threads with a historical failure followed by a successful delivery remain eligible once inactive.
Background jobs
A process an agent starts in the background with its shell tool belongs to the turn's process tree and usually dies when the turn ends. celorga job runs such work under a detached supervisor that Celorga owns, and reports the outcome into the chat that asked for it.
celorga job start --thread THREAD_ID --dir ~/notes --label "Example build" \
--cwd ~/src/example -- npm run build # preview
celorga job start --thread THREAD_ID --dir ~/notes --label "Example build" \
--cwd ~/src/example --apply -- npm run build
celorga job list --dir ~/notes --thread THREAD_ID --json # running jobs
celorga job list --dir ~/notes --all --json # plus recent finished jobs
celorga job status JOB_ID --dir ~/notes --lines 40
celorga job stop JOB_ID --dir ~/notes --apply
job start previews by default. With --apply it records the job and starts a supervisor in a new session with no inherited standard streams, so killing the caller's process group or tree does not stop it. The supervisor runs COMMAND directly (no shell; use sh -c '…' for pipelines) in its own process group, with standard output and error appended to a log file, and records the exit code or signal and end time. Records (celorga:background-job:v1), logs, and stop markers live under jobs/ in the corpus's machine-local directory in the Celorga index home (ORG2_INDEX_HOME), not in the corpus, because they hold process IDs and are disposable.
With --thread, Celorga validates the thread before starting and, when the command exits, queues exactly one message through the same inbox path as thread post: author Background job (or --author, with optional --agent-ref), source job:JOB_ID, idempotency key job:JOB_ID:exit, and a body with the label, outcome, duration, command, directory, log path, and the last 20 lines of output. The post does not start an agent turn; the person replies to continue.
job list shows running jobs newest first; --thread filters to one chat and --all adds recent finished jobs (--limit N, default 20). job status reports starting, running, succeeded, failed, stopped, or lost, plus the exit code and log tail. lost means the supervisor is no longer alive but never recorded an exit, for example after a restart. job stop previews by default; with --apply it sends SIGTERM to the job's process group, waits --grace seconds (default 5), sends SIGKILL if anything remains, and records stopped. A stopped job with a thread posts its one message saying it was stopped. Jobs are not exposed as MCP tools, because starting one executes an arbitrary command.
In the Celorga app for macOS, an AI chat with running jobs shows a row above the composer, such as "1 job running · Example build", with Stop. The app runs job list --thread THREAD_ID --json only while the chat is visible and job stop JOB_ID --apply for Stop. Jobs started on a remote host are not shown.
Deterministic chat repair
On macOS, thread repair uses Celorga's native transcript reconciler without starting an AI turn. It merges complete writer heads by original message ID, honors deletion markers, verifies shards and attachment hashes, and retains original files as recovery evidence. Preview does not write even a merged shard. Apply publishes a new repair head; malformed or incomplete tips and unknown future fields remain untouched and produce an error.
npm run build:server
celorga thread repair --dir ~/notes --json
celorga thread repair --dir ~/notes --if-revision PREVIEW_REVISION --apply --json
celorga thread repair --dir ~/notes --watch --interval 900 --apply
celorga server chat-repair --interval 900 --apply
celorga server chat-repair --interval off --apply
The native worker defaults to the checkout's built native server worker; --executable PATH selects another built worker. A watch interval accepts 10–86400 seconds, defaults to 120, and runs one check at a time. The desktop offers Settings → AI Chat → Conversations → Check synced chat history with Off, 2 minutes, 5 minutes, 15 minutes, and 1 hour. The headless server stores chatRepairIntervalSeconds in its machine-local configuration; restart it after a configuration change. Existing server configurations default to 120 seconds. Checks inspect only chat storage, use a small fingerprint to skip unchanged stores, and retry incomplete syncs on a later interval. Ordinary note conflicts and intentional message deletions are outside this recovery operation.
Durable agent runs and review
Goals and named workers are portable corpus records, distinct from the runtime that executes them. celorga goal create/update/list/show manages celorga:goal:v1 files under goals/. celorga agent-profile create/update/list/show manages celorga:agent-profile:v1 files under agent-profiles/. Both create and update preview by default and require --apply to write.
celorga goal drive GOAL [--every 15m|--schedule CRON] [--stall-after N] [--daily-cost-limit USD] [--daily-token-limit N] [--permit TEXT ...] [--agent-ref ID] [--destination-ref ID] [--thread ID] [--apply] starts or reconfigures a goal drive. It previews by default. With --apply it records an optional drive object on the goal, adds a Plan section if none exists, and writes the driver workflow goal-drive-GOAL. That workflow is an ordinary prompt automation with whenRunning: wait and whenBlocked: wait, so only one pass runs at a time. Repeated --permit values replace the standing permissions, and --clear-permits removes them all. --pause, --resume, and --stop change the drive. Stopping removes the drive and pauses the workflow, but keeps the workflow file and its run history.
Plan items are descendant headings of the goal's level-2 Plan heading that have a TODO keyword. :ACTOR: is agent (the default), human, or external, and unknown values count as human. Terminal states follow the file's and corpus's TODO sequences. celorga goal status GOAL [--json] returns celorga:goal-drive-status:v1 with these fields:
mode:work,plan,replan,waiting,complete,stalled,paused,over-budget,inactive, ornot-drivingeligibleandreasonnext(open agent items) andneedsYou(open human items)plan counts and a plan fingerprint
rolling 24-hour spend, taken from recorded run runtime
workflow due and workflow run --trigger read the same evaluation. They skip a driver pass, with a goalDriveMode and a reason, unless the mode is work, plan, or replan. An unchanged empty plan, only human or external items left with no plan change since the last checkpoint, a spent budget, a pause, or a stall each skip the pass. As many uncheckpointed settled passes as --stall-after also skip it. Workflows that do not drive a goal are unaffected.
celorga goal checkpoint GOAL --run RUN_ID [--apply] ends a pass. The plan fingerprint covers item titles, states, actors, and checkbox states, but not prose. A changed fingerprint resets the no-progress count. Otherwise the count rises, and at stallAfter the drive becomes stalled with a reason. Checkpointing the same run again changes nothing. Structured goal saves preserve a leading file property drawer, all goal sections other than Measures, Drive, and Machine state, and later top-level headings.
The Mac workspace projects these records into Agent Work → Goals and Agent Work → Agents. The catalogs show status, ownership or primary-goal relationships, default runtimes, runtime bindings, measures, and linked-run counts while the detail pane renders the canonical file. Relationship controls navigate between goals, profiles, and filtered runs. Lifecycle and default-runtime changes use the same goal update and agent-profile update commands instead of app-private state. Drive Goal in the toolbar or the row menu opens a sheet that runs goal drive --apply with a cadence, stall limit, daily budget, agent, harness, and standing permissions. The sheet edits the complete list of standing permissions and sends --clear-permits followed by each --permit. Driven rows read goal status to show the next pass's mode and reason, the next agent item, human items, and rolling spend. Pause, Resume, and Stop Driving run goal drive --pause, --resume, and --stop.
An agent profile may declare responsibilities, capabilities, skills, reporting and goal relationships, an optional defaultRuntime of openclaw, codex, claude, pi, or opencode, an optional defaultDestination naming a configured AI chat destination by its mention (--default-destination scarf-codex, stored as :DEFAULT_DESTINATION:; machines without it fall back to defaultRuntime), and repeatable non-secret runtime bindings such as openclaw:customer-support or codex:default. The default runtime is a user-visible starting preference, not a binding or a fixed destination; chat users can override it before the conversation starts. Credentials, session IDs, destination configuration, provider/model choice, and machine paths do not belong in the profile. Resolve the active runtime identity before delegation:
celorga agent-profile resolve --runtime openclaw \
--runtime-agent-id customer-support --dir ~/notes --json
celorga run create --title "Resolve the customer issue" --goal "Investigate and resolve the customer issue" \
--agent-ref customer-support --goal-ref customer-trust --dir ~/notes
celorga todo assign --file notes/support.org --line 12 --assignee "Customer Support" \
--agent-ref customer-support --goal-ref customer-trust --apply
The resolved agentRef is the portable worker ID; OpenClaw, Codex, Claude Code, Pi, and OpenCode are runtimes, not profile IDs. A profile's primaryGoalRef is returned as the default goalRef. Existing selected-work refs take precedence over a runtime default. todo assign ... --start scheduled also writes :AGENT_START: scheduled, which lets the automation host start the TODO at its SCHEDULED time. AGENT_REF and GOAL_REF flow through agent context, durable runs, and authored workflows; ASSIGNEE remains the readable display label. Resolution fails on ambiguous active bindings or a missing primary goal and returns found: false for an unbound runtime identity, allowing clients to omit refs rather than guess.
celorga run manages celorga:agent-run:v1 records under .celorga/runs/. Each record contains readable Org sections plus a canonical JSON block; writes are atomic. The state machine supports queued, running, waiting-approval, blocked, completed, failed, and canceled states. Invalid transitions fail instead of silently rewriting history.
celorga run create --title "Prepare the weekly operating review" \
--goal "Prepare the review with cited claims and a validated PDF export" \
--accept "Claims retain citations" --accept "PDF passes export validation" \
--risk local-draft --owner avi --assignee analyst \
--policy deep-analysis --token-limit 50000 --cost-limit-usd 10 --time-limit-seconds 1800 \
--step agent:"Draft cited review" --step validation:"Validate citations and export" \
--context notes/operations.org --capability agent-context --dir ~/notes
celorga run list --dir ~/notes --json
celorga run list --status queued --status running --summary --limit 50 --dir ~/notes --json
celorga run show RUN_ID --dir ~/notes --json
celorga run start RUN_ID --dir ~/notes
celorga run step RUN_ID step-1 --status completed --dir ~/notes
celorga run validation RUN_ID --name citations --status passed --dir ~/notes
celorga run runtime RUN_ID --provider openai --model gpt-5 \
--tokens-used 18420 --elapsed-seconds 93.4 --dir ~/notes
celorga run approval-request RUN_ID --title "Release report" \
--action "publish operating review" --risk external-action --role owner --dir ~/notes
celorga run approval-decide RUN_ID APPROVAL_ID --decision approved \
--actor avi --role owner --fingerprint sha256:... \
--receipt approval:local:123 --dir ~/notes
celorga run approval-snooze RUN_ID APPROVAL_ID --until 1d \
--actor avi --fingerprint sha256:... --dir ~/notes # or --wake
celorga run approval-resolve \
--decision-key artifact:gmail:gog:DRAFT_ID --dir ~/notes --json
celorga run approval-reconcile --dir ~/notes --json # preview
celorga run approval-reconcile --dir ~/notes --apply # repair historical duplicates
celorga run artifact-review RUN_ID ARTIFACT_ID --status reviewed \
--actor avi --dir ~/notes
celorga run complete RUN_ID \
--summary "Prepared the cited operating review and validated its PDF export." \
--highlight "All claims retain citations" --next-action "Share after owner review" --dir ~/notes
run list orders runs by most recent update, then by run ID. With no options, --json returns the original envelope: every full record plus logicalWork roll-ups for each matching logical-work group. Repeat --status to match any of several statuses; an unknown status fails with the list of valid statuses. --summary returns compact records with identity, title, status, risk, ownership, workflow and attempt identity, timestamps, blocked or failure reason, and counts of comments, events, approvals, artifacts, validations, and plan steps. It omits the goal text and those histories. --limit N and --offset N page the matching runs. With --summary, --limit, or --offset, the envelope adds projection and page (total, offset, limit, returned, hasMore, nextOffset). To read all matches, repeat the request with --offset set to nextOffset until it is null. In these responses logicalWork lists only the groups that have a run on the returned page. Each listed roll-up counts all matching attempts in its group, including attempts on other pages, and an empty page has no roll-ups. Use these options in scripts and cleanup jobs to keep output proportional to the page you request.
--title is concise display metadata, limited to 120 characters. Put the complete task brief and execution instructions in --goal. When an older caller omits --title, Celorga derives and stores a bounded title from the goal; workflow runs always preserve the workflow title separately from its instructions.
Other lifecycle operations include resume, retry, block, fail, cancel, complete-external, reopen-external, fork, assign, comment, outcome, runtime, artifact, and artifact-review. Retrying a canceled or failed run that still carries pending approvals reopens it directly in waiting-approval so the review queue cannot be bypassed or left hidden. run approval-reconcile previews historical provider-key duplicates and requires --apply before canceling their stale pending approvals and dedicated projection runs. run reconcile-source RUN_ID reports direct readable-projection drift and its canonical values without writing; add --if-revision REVISION --apply to restore the generated title, status, goal, approval summary, and other readable fields from the unchanged machine-state block. Celorga exposes this guarded operation as Repair & Retry after a run approval encounters that exact conflict. run runtime records observable provider/model identity and optional token, cost, or elapsed usage without storing credentials. run artifact-review records a human review decision on an existing artifact and, for a linked Org file inside the corpus, updates its CELORGA_REVIEW_STATUS metadata at the same time; it also repairs stale review state on historical completed records. Normal completion requires --summary with a human-readable result and refuses pending approvals or review-required artifacts; repeat --highlight and --next-action to populate the reviewer-facing outcome. When a person confirms that an unfinished run's outcome was completed outside this workflow, run complete-external RUN_ID [--summary "Where or how it was completed"] --actor NAME records an explicit completed-externally audit event, marks unfinished workflow steps skipped, and closes the run while preserving unresolved approvals, artifact review states, and validations as history. The summary is optional; without it the outcome reads "Completed outside this workflow." Agents must not infer external completion on their own. run reopen-external RUN_ID --summary "Corrected open-run outcome" --actor NAME is the narrow repair for a run mistakenly completed externally from waiting-approval; it restores that same run and its retained approval IDs to the pending queue. run outcome may record or revise an outcome before completion. Blocking requires --reason with the specific clarification or next action; Celorga rejects an unactionable reasonless blocked state. run normalize converts legacy AGENT_RUN_ID headings into shared records while retaining a citation to their source location.
Snoozing defers a pending approval without deciding it. Celorga follows Org here: GNU Org has no snooze keyword, and a TODO SCHEDULED in the future simply stays out of today's list until the date arrives. run approval-snooze RUN_ID APPROVAL_ID --until TIME records snoozedUntil on a run approval; TIME is a duration (30m, 2h, 1d, 1w), a date (YYYY-MM-DD, the start of that local day), or an ISO timestamp, and must be in the future. --wake clears it. A headline approval snoozes with a future SCHEDULED date, including a delay cookie such as <2026-11-02 Mon -2d>. The approval stays pending with the same fingerprint, the run's status does not change, and it can still be decided while snoozed. celorga approvals omits snoozed items and reports snoozedCount in JSON; --include-snoozed lists them with snoozedUntil. Nothing has to wake a snooze: once the time passes it is back in the queue, and audio approval prompts skip it until then. Celorga on Mac offers Snooze on each approval, in the context menu, and for a bulk selection, with a Snoozed list for waking items early; the paired iPhone can snooze and wake through the Mac.
Pending approvals own their waiting boundary. run block refuses to replace waiting-approval while a decision remains pending. A genuinely independent clarification or operational condition must add --separate-from-approval; the override still rejects reasons that simply ask for approval, review, or edits.
An approval belongs to one canonical durable run and has an ID unique within that run. Its native sha256: fingerprint covers the immutable request material (title, action, risk, reviewer constraints, and request note); every client decides that exact identity, and approval-decide --fingerprint rejects stale or altered material. Provider-backed requests must preserve an exact Provider draft: PROVIDER:TOOL:DRAFT_ID line. The CLI treats that value as a decision key: a repeated request for matching material reuses the existing pending approval, replacement material supersedes the prior pending version, and a stale version cannot be decided after a newer request exists. run approval-resolve --decision-key KEY returns the canonical approval even after it has left the pending queue, so an execution guard can verify the durable decision without trusting private adapter metadata. Historical duplicate projections are retained as canceled audit records rather than being falsely marked approved. A decision explanation is stored separately as decisionNote instead of rewriting the request; it is optional for approved, rejected, and canceled. A revised decision requires --note "Requested changes", because a status without direction cannot produce a meaningful replacement. A run may have several pending approvals; it remains waiting-approval while approvals in the current boundary are still pending. Approving, rejecting, or canceling one item removes only that exact RUN_ID/APPROVAL_ID pair from the queue and leaves unrelated siblings actionable. Agent Work's approval-level Mark Done Elsewhere action records the exact item as canceled with an external receipt; it does not complete the containing run. Once the current boundary is fully decided, the run returns to running and the worker may perform only approved actions; rejected or canceled actions remain durable exclusions. A revision request remains distinct: once the boundary is resolved it moves the run to blocked, and the Mac workspace hands an eligible revision-only blocked run back to an agent with the durable decision note. A workflow run returns to its correlated OpenClaw session. Any other run returns to running and receives the note in a Revision chat thread on its correlated OpenClaw session, or on a per-run session when none is recorded. If that hand-off fails, the run stays blocked with a reason that says so, and Send Requested Changes on the run retries it without a second decision. The agent must create new review material and a replacement approval on the same run without performing the protected action. Requesting that replacement approval opens a new boundary, so its later approval resumes the run without rewriting the older revision request in history. An approval decision does not clear a separate clarification or operational block. An approval may name both a required role and a specific reviewer. approval-decide refuses a mismatched --role or --actor, and the decision event preserves the asserted role plus any release receipt. This is a durable workflow boundary; operating-system or organizational identity enforcement can sit above it.
celorga approvals returns the unified celorga:approvals:v2 decision queue of awake approvals; snoozed ones are counted in snoozedCount and listed only with --include-snoozed. Its kind field distinguishes durable run approvals from standalone headline approvals; run items include runId, approvalId, fingerprint, decisionKeys, the run goal/status, and pending/total approval counts. OpenClaw and other producers use those keys to discover an existing provider boundary instead of inventing another authority. Deciding a run item must use run approval-decide so the queue and Agent Work's Runs tab are two projections of the same canonical record under .celorga/runs/. Standalone heading approvals remain ordinary corpus TODOs and keep their file/line/ID identity. A legacy heading nested under a Gmail provider-draft task and repeated durable approvals for that same draft collapse to the newest durable decision. Recording that decision automatically supersedes older pending copies and closes dedicated duplicate review runs; stale material remains inspectable in history but cannot return to either actionable surface. Run discovery keeps a disposable machine-local fingerprint index, so repeat queue loads reopen only changed run records. JSON clients can repeat --run-detail ID to receive selected full run records in the same response instead of starting separate run show processes. celorga review list returns the broader celorga:review-queue:v1 inspection feed, which also includes review-required artifacts, blocked clarification requests, and warning/failed validation.
A heading carrying CELORGA_RUN_ID plus an exact approval ID, a unique matching approval title, or an otherwise unambiguous single pending decision is a derived run projection. The unified queue omits it as a second writable decision and keeps the run approval canonical. celorga doctor reports a pending writable duplicate as an error.
Before an agent acts on a large or long-lived workspace, celorga doctor performs a read-only consistency pass over run records, workflow definitions, approval identities, recurring attempt metadata, and linked corpus headings:
celorga doctor --dir ~/notes
celorga doctor --dir ~/notes --json
The versioned celorga:agentic-doctor:v1 JSON report distinguishes errors, warnings, and informational migration findings. It detects terminal runs with pending decisions, waiting runs without a decision, duplicate provider keys, conflicting workflow attempt identities, ungrouped OpenClaw cron series, broken run/approval links, direct readable-header drift, and likely duplicate open projections. Hard contradictions produce a nonzero exit status. The command never repairs or normalizes files: review the cited evidence, then use the canonical lifecycle command or an explicit source edit to settle the underlying state.
When Celorga misbehaves, or the app will not open, the doctor can hand bounded evidence to an agent you choose:
celorga doctor --machine --dir ~/notes --json
celorga doctor --handoff opencode --dir ~/notes [--agent-ref ID] [--apply] [--launch] [--json]
--machine returns read-only celorga:doctor-machine-evidence:v1 output: host, versions, corpus identity, at most 20 audit findings, app bundle and process state, installed runtimes, and the most recent incident and crash-report names. --handoff builds a celorga:doctor-handoff:v1 packet that carries the troubleshoot playbook prompt and the launch argv for codex, claude, opencode, pi, or the prepare-only openclaw runtime. --apply writes the packet to views/diagnostics/handoffs/. --launch starts the runtime once in this terminal in its most restrictive interactive posture and returns its exit status. No handoff creates a recurring job. See agent playbooks for permission postures and extension points.
Every CLI and MCP run mutation uses a short local write lock, an atomic durable rename, and the SHA-256 revision read with the run. Workflow updates use the same guarded file primitive while retaining their documented visible-field authoring behavior. If another client or text editor changes a file first, the mutation fails rather than overwriting it. New run and workflow IDs also require the target to be absent. Long-lived clients can make the run boundary explicit:
celorga run show RUN_ID --with-revision --dir ~/notes --json
celorga run comment RUN_ID --author agent --body "Checked current state" \
--if-revision sha256:... --dir ~/notes
The snapshot envelope is celorga:run-snapshot:v1 and includes revision, sourceIssues, and the parsed run. A lifecycle write also refuses readable run headers that disagree with the machine state, directing the caller to celorga doctor instead of normalizing an ambiguous direct edit. An abandoned run lock file is reported by the doctor; confirm that no writer remains before removing it.
Work ledgers for recurring account workflows
celorga ledger keeps high-volume recurring bookkeeping out of a monolithic agent prompt or TODO file. One stable account becomes one canonical Org file under notes/LEDGER/accounts/, named by its account ID.
celorga ledger create account-outreach acme \
--title "Acme Corp" --identity domain:acme.example \
--alias Acme --field segment=enterprise \
--context "Reviewed commercial context." --apply --dir ~/notes
celorga ledger event account-outreach acme \
--type approval-linked --key approval:acme:gmail-draft \
--run RUN_ID --approval APPROVAL_ID \
--decision-key gmail:gog:DRAFT_ID --apply --dir ~/notes
celorga ledger event account-outreach acme \
--type outreach-sent --key send:acme:gmail-message \
--run RUN_ID --approval APPROVAL_ID \
--external-id gmail:message:MESSAGE_ID --apply --dir ~/notes
celorga ledger list account-outreach --eligible \
--as-of 2026-07-31T12:00:00Z --cooldown-days 90 --dir ~/notes --json
celorga ledger resolve account-outreach \
--identity "Acme Corp" --identity growth@acme.example \
--identity acme.example --dir ~/notes --json
Creates, updates, and events preview by default and require --apply. Account source uses the versioned celorga:work-ledger-account:v1 schema, readable aliases/identity/context fields, guarded SHA-256 revisions, arbitrary string --field KEY=VALUE metadata, and append-only events. Applied mutations also hold a ledger-wide lock while checking global uniqueness, so concurrent writers cannot claim the same identity or event key in two account files. Every event requires a ledger-wide idempotency key. Identity keys and event keys may not be claimed by two accounts. Repeating identical event material is a no-op; reusing its key for different material fails. Human edits to title, state, aliases, identity keys, and context are accepted as canonical authoring; disagreement between readable event history and structured event state is reported by celorga doctor, makes the account ineligible, and blocks a later structured write until explicitly reconciled.
An approval-linked event points to the native RUN_ID/APPROVAL_ID; it does not copy approval status into the account. Recording outreach-sent with a linked approval requires that canonical decision to be approved and requires an external message/receipt ID. Eligibility excludes paused, suppressed, or closed accounts, accounts with linked pending approvals, approved/proposed outreach that has not yet reached a matching sent/canceled/skipped outcome, and accounts contacted inside the requested cooldown. Carry the same run/approval linkage on the settlement event; for work without a native approval, pass --data with the same named cycle value. This prevents the next scheduler tick from recommending the same account during the gap between approval and execution, including when an account has more than one outreach cycle. celorga doctor also checks ledger identity/event collisions, broken run or approval references, path/identity mismatches, and sent outreach linked to a non-approved decision.
The account file is curated canonical knowledge, so aliases, stable identity, commercial history, and human context belong under notes/. Raw CRM exports, email/provider payloads, and collector results remain under raw/ and should be referenced through event --source values. Generated rankings or candidate lists belong in views/.
ledger resolve accepts a name, email, domain, provider organization ID, or fully qualified identity key and reports ambiguous matches instead of selecting one silently.
Reusable workflows and triggers
workflow create writes a prompt, destination reference, optional exact model and reasoning effort, and optional schedule as a plain celorga:workflow:v1 file under the visible top-level workflows/. workflow save RUN_ID generalizes a completed run into a fuller draft workflow. Packages can also declare semantic version, compatibility, parameters and defaults, context rules, deterministic/agent/tool/approval steps, capabilities, risk, outputs, validation, approval boundaries, and manual/schedule/file-change/capture/meeting-import/todo-state/pull-request triggers. See Automations and workflows for the plain-text ownership and destination-neutral execution contract.
celorga workflow create weekly-product-update \
--title "Weekly product update" \
--prompt "Prepare a cited update from this week's product notes." \
--destination-ref builtin.claude \
--model opus \
--schedule "0 9 * * 1" --timezone America/Los_Angeles --dir ~/notes
celorga workflow save RUN_ID --id weekly-operating-review --version 1.0.0 --dir ~/notes
celorga workflow validate weekly-operating-review --dir ~/notes
celorga workflow run weekly-operating-review --input week=2026-W29 --dir ~/notes
celorga workflow activate weekly-operating-review --dir ~/notes
celorga workflow schedule weekly-operating-review --cron "0 9 * * 1" \
--timezone America/Los_Angeles --model gpt-5.6-sol \
--reasoning-effort high --gate-event capture --gate-path notes/ --dir ~/notes
celorga workflow signal weekly-operating-review --event capture \
--signal-id capture-2026-W29 --changed notes/inbox.org --dir ~/notes
celorga workflow due --now 2026-07-20T16:00:00Z --dir ~/notes --json
celorga workflow gate weekly-operating-review --trigger schedule --dir ~/notes --json
celorga workflow pause weekly-operating-review --dir ~/notes
celorga workflow delete weekly-operating-review --dir ~/notes
celorga workflow delete weekly-operating-review --dir ~/notes --apply
celorga workflow migrate --dir ~/notes
celorga workflow triggers weekly-operating-review --changed data/metrics.csv --dir ~/notes --json
celorga workflow triggers weekly-operating-review --event capture --dir ~/notes --json
celorga workflow package weekly-operating-review --dir ~/notes --json
celorga workflow corpus-template weekly-operating-review --out dist/weekly-review-template.json --dir ~/notes
Schedule syntax accepts positive whole-number intervals such as every 15m, every 4h, or every 1d, plus deterministic five-field cron expressions with an optional IANA timezone. --model and --reasoning-effort write exact invocation choices into the canonical workflow; --clear-model and --clear-reasoning-effort restore destination/runtime defaults. workflow due reports only the latest missed occurrence for each active automation and identifies occurrences suppressed by an active attempt. By default every occurrence starts its own attempt, even while earlier attempts are queued, running, approval-waiting, or blocked. --when-running wait skips occurrences while an earlier attempt is queued, running, or approval-waiting, and --when-blocked wait makes the schedule wait for a blocked attempt; continue restores either default, and later schedule edits keep the chosen policies. Event hosts can also ask workflow triggers which declarations are due; --event accepts only capture, meeting-import, todo-state, or pull-request and rejects unknown event names. workflow signal persists capture, meeting-import, todo-state, pull-request, or file-change evidence. todo-state and pull-request triggers, configured with workflow trigger-set, are fed by the deterministic, preview-first workflow observe and workflow poll --source github detectors and dispatched through workflow due, with an optional coalesce window that combines nearby signals into one attempt; see Event-triggered workflows. workflow due --json also lists TODOs that opted in with :AGENT_START: scheduled and whose SCHEDULED time passed under scheduledTodoStarts, and workflow start-todo --id ID --apply starts one durable run per occurrence; see Scheduled TODO starts. A schedule with --gate-event and/or --gate-path starts an attempt only when a matching signal is newer than its prior attempt boundary; otherwise workflow gate and workflow run --trigger return a deterministic skip result without creating a run. The logical workflow identity stays stable while each eligible execution receives distinct attempt identity, schedule/trigger provenance, destination reference, requested model/reasoning configuration, and consumed signal IDs. run list --json exposes attempt roll-ups so clients can summarize history without conflating retries or recurring executions. workflow delete previews by default and requires --apply; it removes the definition while preserving prior runs and does not cancel an already-dispatched attempt.
workflow package emits distribution metadata for one provider-independent workflow. workflow corpus-template wraps that metadata with ordinary starter files and the standard raw/, notes/, views/, compiled/, run, and workflow zones as celorga:corpus-template:v1. The package is data, not an installer: recipients review it, initialize/open a corpus with their client, and place the workflow record in workflows/. Celorga still reads the legacy early-alpha workflows folder inside the hidden state directory; workflow migrate moves non-conflicting files into the visible directory.
The built-in meeting-to-controlled-execution package preserves meeting provenance, extracts cited decisions/tasks/questions, delegates bounded work, refreshes configured data/charts, compiles finished artifacts, requests release review, and gates publication:
celorga workflow install-builtin meeting-to-controlled-execution --dir ~/notes
Artifact dependency and freshness graph
celorga artifact graph evaluates a JSON declaration containing artifact id, path, sources, optional previous sourceHashes, and optional rebuild command. Outputs are fresh, stale, missing, or conflicted. artifact rebuild propagates upstream staleness to downstream outputs and emits an ordered reviewable plan; --apply on graph stores the derived graph at .celorga/artifact-graph.json.
celorga artifact graph --manifest compiled/artifacts.json --dir ~/notes --json
celorga artifact rebuild --manifest compiled/artifacts.json --dir ~/notes
Runtime policies, MCP, and connector snapshots
celorga runtime init creates .celorga/runtime-policy.json. Symbolic policies select an eligible descriptor by required capabilities, privacy, transport, context window, and cost class. Built-in policy names are private-local, fast-draft, deep-analysis, vision, regulated-cloud, and offline. Runtime records contain aliases and model metadata, never credentials.
celorga runtime select private-local --capability text --dir ~/notes --json
celorga runtime select deep-analysis --capability tool-use --dir ~/notes --json
celorga runtime verify-paths --capability text --dir ~/notes --json
runtime verify-paths is the portability check used by workflow test suites: it fails unless the configured baseline capability is available through both an enabled local/private descriptor and an enabled hosted descriptor. Execution remains adapter-owned; this check validates that switching paths does not require changing a workflow package or corpus state.
celorga mcp serve starts a stdio Model Context Protocol server. It exposes paginated corpus file resources, workflow prompts, bounded cited celorga_search, celorga_fetch, and celorga_context retrieval, read-only coordination queries, and trusted local run/thread mutations. Resource reads include a SHA-256 revision and line count. The headless server can expose the five read-only tools through bearer-authenticated Streamable HTTP; create one hash-only credential per client with server token create. mcp client-add records explicitly configured external servers in .celorga/mcp-clients.json. mcp discover performs an initialize/list handshake, reports the server's resources, tools, and prompts, and can persist a provenance-bearing discovery snapshot. mcp snapshot writes any external result under raw/connectors/mcp/ with source URI, retrieval time, identity, freshness, and payload so durable work does not depend on an invisible live response.
See MCP and agent skills for local stdio and remote Streamable HTTP configuration, the exact current resource, prompt, eight-tool stdio, and five-tool read-only HTTP surfaces, write boundaries, protocol smoke tests, and the packaged general Celorga skill. The MCP server remains intentionally narrower than the CLI.
celorga mcp serve --dir ~/notes
celorga mcp client-add crm --command crm-mcp --arg=--stdio --capability accounts --env CRM_TOKEN --dir ~/notes
celorga mcp discover crm --snapshot crm-capabilities --dir ~/notes --json
celorga mcp snapshot account-123 --source mcp://crm/accounts/123 \
--identity account:123 --fresh-until 2026-07-15T00:00:00Z \
--input /tmp/account.json --dir ~/notes
Client configuration records environment-variable names for setup and discovery, never their values. The child process inherits credentials from the invoking environment or operating-system credential helper.
Outcome evaluation and replay fixtures
celorga eval run compares an observable run against JSON expectations for terminal status, artifacts, passing validations, citations, approval boundaries, and protected paths. It writes celorga:workflow-eval:v1 results under .celorga/evals/. Metrics come from inspectable run records: elapsed time, tokens, cost, citation coverage, and artifact review/freshness.
celorga eval run RUN_ID --expect test/fixtures/weekly-review.expected.json --dir ~/notes
celorga eval replay weekly-operating-review --fixture test/fixtures/weekly-review.replay.json --dir ~/notes
celorga eval fixture RUN_ID --output test/fixtures/weekly-review.run.json --dir ~/notes
eval replay deterministically instantiates the declared workflow against fixture inputs and checks version, resolved goal, plan steps, capabilities, and risk boundary without invoking a provider. eval fixture replaces people, providers, source locations, and receipts with synthetic values. Review the result before distributing it; free-form artifact contents are not copied by the command.
Corpus lint
Lint is the first compiler-style health pass for artifact metadata and corpus structure. It belongs to the broader maintenance and health workflow alongside formatter checks, graph queries, publish previews, and ID/index repair passes.
celorga lint --dir ~/notes --recursive
Current checks include:
invalid or missing
CELORGA_ARTIFACT_ROLEon generated outputsmissing/invalid provenance, generator, and generated-at metadata
duplicate IDs and unresolved provenance references
stale generated artifacts when provenance file mtimes or
CELORGA_SOURCE_HASHESno longer matchunresolved
id:links, unresolved wiki links, and ambiguous wiki links/aliases using the same graph index as roam workflowscitation keys missing from the note's BibTeX bibliography (
unresolved-citation) and cited quotes that don't appear in their source (quote-not-in-source); see Research notesheadline priority cookies outside the file's
#+PRIORITIES:range (defaultAtoC), invalid cookies such as[#AA]or[#-1], unclosed cookies such as[#A, and an invalid#+PRIORITIES:line. Editors receive the same checks as LSP warnings.conventional corpus-flow checks when you organize notes as
raw/->notes/->compiled/->views/->publish/
See Corpus flow for the canonical zone model, artifact roles, and generated-output trust boundaries.
AI job manifest validation
celorga ai validate-job validates repeatable AI workflow manifests without calling a provider or loading secrets.
celorga ai validate-job --job jobs/weekly-summary.ai.json
celorga ai validate-job --job jobs/weekly-summary.ai.json --format json
Use this in CI or editor workflows before a future AI runner consumes a job. The validator checks corpus input selection, task type, symbolic adapter names, generated output targets, provenance/review requirements, and common accidental secret leaks. See AI job manifests for the schema and examples.
celorga ai run writes a reviewable generated draft artifact from a validated job. The current implementation is provider-free and uses manifest input.files as deterministic source material, including simple glob patterns. It stamps CELORGA_PROVENANCE, CELORGA_SOURCE_HASHES, prompt/template, adapter/model, generated-at, and CELORGA_REVIEW_STATUS metadata. Without --apply it previews the draft.
celorga ai run --job jobs/weekly-summary.ai.json --out views/weekly-summary.org
celorga ai run --job jobs/weekly-summary.ai.json --out views/weekly-summary.org --apply
celorga ai suggest-links ranks compiler-provided roam/linkify candidates with the deterministic mock adapter. It scans the graph, aliases, exact linkify matches, represented-node semantic suggestions, and title-case entity mentions, then emits review-only suggestions with confidence, reasons, source context, and citations. It never edits canonical notes directly; --apply only writes the suggestion report when --out is provided.
celorga ai suggest-links --dir ~/notes --recursive --format json
celorga ai suggest-links --dir ~/notes --recursive --out views/link-suggestions.org --apply
celorga ai promote is the safe acceptance path. It refuses drafts until CELORGA_REVIEW_STATUS is reviewed, then appends the reviewed body to a canonical note only when --apply is present and marks the draft promoted.
celorga ai promote --file views/weekly-summary.org --to-file notes/weekly-summary.org --apply
See AI draft artifacts for the full format, review checklist, and VS Code command-palette entry points.
Compiled corpus artifacts
celorga compile corpus emits a stable, schema-versioned knowledge artifact that LLM tools, search indexes, and other automation can consume. Celorga only compiles local plain-text notes into structured data; it does not call an LLM or require any hosted AI service.
celorga compile corpus --dir ~/notes --recursive --out compiled/corpus.json
celorga compile corpus --dir ~/notes --recursive --format jsonl --out compiled/corpus.jsonl
celorga compile corpus --dir ~/notes --recursive --incremental --out compiled/corpus.json
The JSON form includes:
standardized
artifactmetadata: role, generator, generated-at timestamp, source provenance, source hashes, and review statusfiles with relative paths, absolute paths, SHA-256 hashes, line counts, titles, and IDs
file and heading nodes with source ranges for citations
heading TODO state, priority cookies, tags, planning timestamps, explicit
properties, inheritedinheritedProperties, overlaideffectiveProperties, IDs, and aliaseslinks and resolved backlinks for explicit
id:links and unambiguous wiki linkstext snippets suitable for previews or retrieval pipelines
Use JSONL for larger corpora when downstream tools prefer one record per line; the first JSONL record carries the same artifact metadata header as the JSON form. If you wrap compiled artifacts in Org files, stamp the wrapper with the same CELORGA_ARTIFACT_*, CELORGA_SOURCE_HASHES, and CELORGA_REVIEW_STATUS fields and keep using celorga lint for generated-output health checks.
For repeated whole-corpus reads, --incremental stores compiled semantics plus per-file cache metadata in the machine-local Celorga index home and reparses only added or changed files. Deleted files are dropped from the next artifact, while corpus-wide backlinks, entities, relations, and statistics are rebuilt from reusable file semantics so the output remains equivalent to a full compile. --cache FILE overrides the derived cache location. Human-facing context, agent context, and brief commands use this incremental cache automatically.
Search + cited query
Use search for literal, case-insensitive full-text lookup over .org files, and query when you want cited context suitable for answering factual questions from notes. Directory scans are non-recursive unless --recursive is set. The External LLM consumer pattern page shows how provider-agnostic agents can turn this JSON into cited model context without adding LLM calls to Celorga core.
celorga search "Chris Martin" --dir ~/notes --recursive --context 3 --sort date-desc
celorga search "Mercor" --dir ~/notes --recursive --sort relevance
celorga search "launch" --dir ~/notes --recursive --sort best
celorga index --dir ~/notes --recursive --file ~/notes/inbox.org --incremental --format json
celorga query "Chris Martin" --dir ~/notes --recursive --subtree --sort date-desc --format json
celorga query "Sentra" --dir ~/notes --recursive --format json
celorga query actions --object 'id:PERSON-ID' --dir ~/notes --recursive --recent-days 30 --format json
Useful flags:
--context Nincludes surrounding source lines.--limit Ncaps returned matches.--sort relevanceputs active TODO matches first, then heading matches before raw text; exact heading matches lead heading substrings and deeper body matches.--sort bestblends match quality with a strong recency bias: a recent mention can outrank an old exact heading match. Dates written in the note (date-named files and heading timestamps) count fully; a file's modification time is a weaker fallback. The macOS app uses this mode and merges the results with chats, files, pages, and agent work in one ranked list.--sort date-descis useful for “when did I last...” style questions over date-named daily files and heading timestamps.--subtreededuplicates matches to cited heading/subtree sections withsourceRange,headingAncestry,matchedLines, and full subtree context.--answer-contextadds a plain subtree text block for downstream local LLM prompts.--date-from/--date-toand--file-zonenarrow results by local corpus zones and source dates.--match heading|todo|textkeeps only matches on heading lines, matches inside an entry with an open TODO, or body-text matches (not heading lines).--format jsonreturns machine-readable file, line, heading, snippet, source range, and context fields.
celorga query actions is the bounded, deterministic action-item projection for a person or other node. It resolves the target by stable ID or unique title, returns active TODOs directly linked or assigned to that node, and also inherits TODOs from a containing meeting that links to the node. Recently completed items require a completion or meeting date inside --recent-days. --open-limit and --completed-limit bound the displayed arrays while counts retains the complete totals. The command uses the incremental corpus cache and performs no model call or brief generation.
celorga index builds disposable machine-local search data. Its JSON artifact remains inspectable, and Celorga also maintains a versioned binary sidecar for faster repeat loads; an absent, stale, or unreadable sidecar safely falls back to JSON. After an initial build, celorga index --incremental --file FILE replaces or removes only that file's index entry; if no compatible base index exists, it safely falls back to a complete build. Watcher-backed clients may search that maintained index with --index current, avoiding a directory walk and per-file freshness check on every query. The macOS app's search worker keeps the same index current itself: after a filesystem event it rereads only files whose size or modification time changed, answers from memory, and saves the index once searches pause, falling back to celorga index when the worker is unavailable. auto remains the conservative CLI default for callers without a watcher.
File search on this Mac
celorga files finds files and folders anywhere under the indexed folders on this Mac, not just in a corpus. It uses the same machine-local index as Search → This Mac in the Mac app, so it works when Spotlight is off.
celorga files search soc 2 report
celorga files search cap table --kind sheet --json
celorga files search "kind:pdf invoice" --limit 5
celorga files index
celorga files status
celorga files config --add-root ~/Projects --exclude Archive --apply
search WORDSmatches every word against the file name or a folder in its path. A word matches the start of a word in the name, and words may run together across spaces, sosoc2findsSOC 2 Report.pdf. Words of four or more letters also match inside a word. Ranking favors full name matches, recent modification times, and documents, and ranks files inside source repositories lower.Repeat downloads and copies come back as one result. The newest file is the result, and
copieslists the others, newest first, withidenticalwhen a local copy up to 64 MB was compared byte for byte.Report (3).pdf,Report copy.pdf, andReport - Copy.pdfalways group;Report-2.pdfgroups only whenReport.pdfis present too. Documents with the same name group across folders; code and text files group only within one folder.--no-grouplists every file separately.--kind KIND(folder,pdf,document,spreadsheet,presentation,image,video,audio,archive,installer,text,code,app,other; aliases such assheetandslideswork) and--ext EXTfilter results. You can also typekind:pdf,ext:xlsx, or.xlsxin the query. With no words,searchlists recently changed documents.--jsonreturnsorg2:file-search-result:v1withindex(builtAt,building,entries,roots,stale) andresults(path,name,directory,kind,extension,isDirectory,size,modifiedAt,score,copyCount,copies).The first search builds the index if there is none.
--refreshrebuilds it first.indexrebuilds it now. The Mac app's search worker keeps it current from file system events while the app runs and rebuilds it when it is more than six hours old.configshows the indexed folders.--add-root PATH,--remove-root PATH,--exclude NAME|PATH(a bare name is skipped anywhere),--include NAME|PATH(undo an exclusion),--hidden on|off, and--resetpreview until--apply. The defaults are~,~/Library/Mobile Documents/com~apple~CloudDocs(iCloud Drive), and~/Library/CloudStorage. The rest of~/Library, hidden folders,node_modules,.git, and other build and dependency folders are skipped. App bundles and package documents are indexed as single items.
The config (org2:file-search-config:v1) and index live in ~/.org2/files/; set CELORGA_FILES_HOME to move them. They are machine-local and never written to a corpus. Indexing reads only names, sizes, and modification times. It never reads file contents, except to compare small local copies, and it never opens cloud files.
JSON Canvas
The canvas family operates on JSON Canvas 1.0 documents. The .canvas file is canonical; native board layout and local resource previews consume shared TypeScript output.
celorga canvas create --dir ~/notes --file boards/project.canvas
celorga canvas create --dir ~/notes --file boards/project.canvas --apply
celorga canvas show --dir ~/notes --file boards/project.canvas --json
celorga canvas targets --dir ~/notes --query architecture --json
celorga canvas edit --dir ~/notes --file boards/project.canvas --if-revision sha256:HASH --stdin --apply --json
celorga canvas import --dir ~/notes --file boards/imported.canvas --from /path/to/source.canvas --apply
celorga canvas export --dir ~/notes --file boards/project.canvas --out /path/to/new-copy.canvas --apply
edit reads a JSON array from standard input. Supported operations are add-node with node, update-node with id and patch, remove-node with id, and corresponding add-edge, update-edge, and remove-edge operations. A node removal also removes edges incident to it. Patch operations cannot change IDs. The runtime validates the entire result before one atomic revision-guarded write. It accepts at most 100 operations per edit. New files and exports require an absent destination; existing documents are never overwritten through import/export.
[{"action":"add-node","node":{"id":"card-1","type":"text","x":0,"y":0,"width":300,"height":200,"text":"Planning notes"}}]
show returns celorga:canvas:v1 with the source file, SHA-256 revision, complete document, and derived resources keyed by node ID. Resource status is ready, missing, ambiguous, or unsupported. Notes resolve through shared corpus compilation and provide source file/line, stable ID, and a bounded snippet. File paths are relative to the active corpus root. A file node’s optional ID reference field preserves stable navigation after a source rename; subpath: "#id:ID" also resolves a heading by its stable ID. Ordinary #heading title and #CUSTOM_ID subpaths resolve only when unique within the file. The extension is inert in clients that do not interpret it.
Optional top-level arrays and unknown fields are retained. Unknown node types preserve their geometry and payload with a placeholder preview. Known node types and edge fields are validated; dimensions must be positive integers, with coordinates and dimensions within ±1,000,000. Documents are bounded to 8 MiB, 1,000 nodes, and 5,000 edges. Supported local PNG/JPEG/GIF/WebP previews are bounded to 8 MiB per image and 16 MiB per board. Notes preview at most 1,200 characters. No remote preview is fetched. Only HTTP(S) and mail links are offered for explicit opening.
Mutations stay inside the active corpus and exclude raw/ and hidden state. Resource loading rejects outside paths, hidden files, and symlink traversal. Stable-ID searches and the note picker observe corpus ignores and exclude raw archives, hidden/build directories, and archive folders. Missing references remain in imported documents. Export copies the source bytes exactly to an explicitly selected new destination; attachment files are not embedded in the portable JSON document.
Roam workflows
celorga roam db-sync --dir ~/notes --recursive --apply
celorga roam node new --dir ~/notes --title "Acme Corp" --apply
celorga roam backlinks --id 123e4567-e89b-12d3-a456-426614174000 --dir ~/notes --recursive --format json
celorga roam linkify --dir ~/notes --recursive
celorga roam graph --dir ~/notes --recursive --format report
celorga roam graph --dir ~/notes --recursive --format json
Celorga supports both title-based wiki links and explicit id: links, with backlinks across both forms. Linkify and graph reports are intended as compiler-style maintenance passes: preview references, strengthen links deliberately, and inspect corpus connectivity without leaving plain files. celorga roam linkify --format json reports exact title/alias replacements plus review-only represented-node suggestions with confidence, evidence tokens, and source ranges for headings or multi-line paragraphs; --apply only writes exact safe replacements, never semantic suggestions. celorga roam graph --format report emits a human-readable maintenance view with graph summary, orphan/high-degree nodes, alias/title collisions, unresolved or ambiguous links with file/line citations, and linkify suggestions; --format json includes the same maintenance payload for scripts and CI.
Local neighborhoods and individual mentions
celorga roam connections --dir ~/notes --id alpha-stable --depth 2 --format json
celorga roam connections --dir ~/notes --file ~/notes/project.org --line 17 --format json
celorga roam mention-link --dir ~/notes --file ~/notes/meeting.org --mention KEY --target alpha-stable --if-revision sha256:HASH --format json
# Inspect the preview, then repeat the same command with --apply.
connections returns celorga:connections:v1: a nullable neighborhood with its focus, nodes, directed edges, depth, and truncation flag, plus mentions and mentionsTruncated. File and heading nodes retain one-based source lines and IDs. Graph edges reuse the roam graph's explicit-ID and unambiguous title/alias resolution. Missing focus IDs yield an empty neighborhood. A file/line focus chooses the containing stable-ID heading or file node. The command scans the active root recursively; it does not follow symlinks or implicit corpus mounts. Corpus ignorePatterns and default archive/build/hidden-directory exclusions apply.
Each exact mention includes its source file, one-based line, zero-based UTF-16 start/exclusive end columns, context, stable occurrence key, source SHA-256 revision, candidate IDs/files/titles, and ambiguous flag. Results include matches for the focus's title and aliases in other files; they do not interpret semantic suggestions as exact text edits. Existing links and linkify-protected text remain unchanged. The response is bounded to 60 graph nodes and 200 mentions; explore another focus or link and refresh to continue.
mention-link requires one occurrence key, an explicit destination ID, and the source's --if-revision. It rechecks the occurrence and current target index, refuses duplicate target IDs and stale source, and previews the resulting source. --apply makes one atomic revision-guarded write preserving line endings and file mode. It never batch-links ambiguous text or publishes a corpus. Celorga's Context → Graph panel consumes these same commands.
Research notes
celorga research citations --dir ~/wiki --format json
celorga research check --dir ~/wiki
celorga research queue --dir ~/wiki --all
celorga research concepts --dir ~/wiki --apply
celorga research related --dir ~/wiki --file wiki/concepts/activation-energy.org
citations returns celorga:research-citations:v1: every org-cite or org-ref citation with its file, line, keys, and unresolvedKeys, plus every cited quote with status verified, mismatch, or unverifiable and the sources it was compared with. check keeps only problems and exits 1 when a key is unresolved or a quote doesn't appear in its source. queue returns celorga:research-queue:v1 with pending sources (and distilled ones with --all). concepts previews an Org concept index and writes it to --out (default views/concepts.org) with --apply. related returns celorga:research-related:v1. Bibliographies come from #+BIBLIOGRAPHY: keywords, research.bibliography in celorga.json, or references.bib at the corpus root; source folders from research.sourceDirs (default raw/, sources/). See Research notes.
Org-crypt
Celorga keeps the existing Org-style :crypt: convention and encrypts at the subtree boundary. A subtree can be encrypted symmetrically with a passphrase, or to multiple public-key recipients so the same private note can be opened by your user key, another device key, and an agent key without sharing one password around.
# Passphrase/symmetric mode
celorga crypt decrypt --file secrets.org --line 42 --passphrase 'your-passphrase' --apply
celorga crypt encrypt --file secrets.org --line 42 --passphrase 'your-passphrase' --apply
# Multi-recipient public-key mode
celorga crypt encrypt --file secrets.org --line 42 \
--recipient user@example.com \
--recipient agent@example.com \
--apply
# Public-key recipient files are useful for keys that are not in your keyring
celorga crypt encrypt --file secrets.org --line 42 \
--recipient-file keys/agent-public.asc \
--apply
# Or make sharing per-entry with an Org property drawer
# Relative recipient-file paths resolve from the current note's directory.
* Private note shared with an agent :crypt:
:PROPERTIES:
:CRYPT_RECIPIENT_FILE: keys/agent-public.asc
:END:
Only the entries with this property are encrypted to that agent.
# Migration: decrypt an existing block, then re-encrypt it for the new recipients
celorga crypt reencrypt --file secrets.org --line 42 \
--passphrase 'old-passphrase-if-needed' \
--recipient user@example.com \
--recipient agent@example.com \
--apply
Per-entry recipient properties let one corpus mix private-only and shared-with-agent notes without a global editor setting. :CRYPT_RECIPIENT: / :CRYPT_RECIPIENTS: add GPG recipient identifiers, while :CRYPT_RECIPIENT_FILE: / :CRYPT_RECIPIENT_FILES: add armored public key files. Multiple values can be separated with commas. Relative recipient-file paths are resolved relative to the Org file that contains the subtree, so they work across machines when the key file lives in the synced project.
Secret requests
Agents should never ask a person to paste a credential into chat, where it would stay in the transcript. They request it instead, and Celorga stores it as an encrypted :crypt: entry in the corpus.
celorga secret request EXAMPLE_API_TOKEN --reason "Call the example API for the weekly report" \
--author "Example Builder" --agent-ref agent-profile-example-builder \
--thread THREAD_ID --idempotency-key weekly-report-token --apply --wait 300
celorga secret status REQUEST_ID --json
celorga secret list --json
celorga secret exec EXAMPLE_API_TOKEN --env EXAMPLE_TOKEN -- ./scripts/report.sh
request previews by default. With --apply it queues celorga:secret-request:v1 under the AI chat inbox (secret-requests/), using the same atomic, no-replace publication and idempotency keys as thread post. The requester is identified by --author and/or --agent-ref. While Celorga is running on the Mac, it shows a secure entry sheet with the name, reason, requester, chat, destination, and recipients. The person can save, decline, or choose Later. Saving pipes the value to celorga secret fulfill, which pipes it to gpg and writes only the armored ciphertext. The secret becomes a * NAME :secret:crypt: heading with a stable :ID:, SECRET_* metadata properties, and CRYPT_RECIPIENTS / CRYPT_RECIPIENT_FILES for explicit recipients. Fulfilling the same name again replaces the ciphertext and keeps the ID. Fulfillment and decline are recorded in secret-requests/receipts/ without the value.
Secrets are always encrypted to public keys, never with a symmetric passphrase. Recipients are the default GPG key (unless defaultRecipientSelf is false or the app's default-key setting is off), the app's encryption recipients, secrets.recipients / secrets.recipientFiles, and any keys configured for the requesting agent ref. Recipients named with --recipient / --recipient-file are labeled as requested in the sheet. Recipient files must stay inside the corpus. If no recipient resolves, Celorga shows an actionable error and writes nothing.
{
"secrets": {
"file": "secrets.org",
"defaultRecipientSelf": true,
"recipients": [],
"recipientFiles": [],
"agents": { "agent-profile-example-builder": { "recipientFiles": ["public-keys/example-builder.asc"] } }
}
}
status reports pending, fulfilled, or declined. request --wait SECONDS exits 0 when fulfilled, 2 when declined, and 124 on timeout. exec decrypts with gpg (gpg-agent may prompt) and passes the value only in the child's environment, by default as NAME. list reports names, IDs, lines, and whether each entry is encrypted. No secret command prints a value. MCP exposes celorga_secret_request and celorga_secret_status on the trusted stdio server only, not on the read-only endpoint.
Export + publish
celorga export html --file README.org --out README.html --apply
celorga export html --dir docs/site --recursive --out-dir site --apply
celorga export beamer --file talks/demo.org --out publish/demo.tex --apply
celorga export beamer --file talks/demo.org --out publish/demo.pdf --pdf --apply
celorga publish document --file reports/brief.org --to web --out-dir publish/brief
celorga publish document --file reports/brief.org --to web --out-dir publish/brief --apply
celorga publish document --file talks/briefing.org --to beamer-pdf --out-file publish/briefing.pdf
celorga publish document --file reports/brief.org --to google-docs --folder-id DRIVE_FOLDER_ID
celorga publish document --file talks/briefing.org --to google-slides --folder-id DRIVE_FOLDER_ID
celorga publish document --file reports/evidence.org --to google-sheets --folder-id DRIVE_FOLDER_ID
celorga publish docs-site --config celorga.json
Useful export options include TOC, heading numbering, stylesheet injection, and Org-file-link rewrite to HTML targets.
publish document is the share boundary for an arbitrary document or the subtree selected by --line. It creates a separate disclosure-safe projection before rendering: property drawers, TODO state, tags, planning and clock data, comments, commented subtrees, dynamic blocks, table formulas, raw HTML, internal IDs, and unresolved local links are not sent to the destination. Referenced raster images are embedded into the output, subject to size limits. The preview reports included assets, removal counts, hashes, and warnings without writing anything.
The web destination writes a self-contained index.html plus manifest.json. Its HTML uses the same responsive document stylesheet as the Celorga reader: the content column is fluid up to its readable maximum width, text and charts stay inside the viewport, and wide tables receive their own horizontal scroll container. Deterministic chart and plot blocks are embedded as SVG when their source table is inside the published document or selected subtree; charts cannot resolve data from outside that disclosure boundary. The bundle has a restrictive content-security policy, no-referrer behavior, and search indexing disabled unless --allow-indexing is explicit. It contains no route back into the corpus. A static bundle does not itself authenticate viewers: Celorga hosting, a self-hosted publisher, or another web host must enforce public, secret-link, or per-person access. Updating a non-empty output directory requires --replace-existing.
The beamer-pdf destination applies a second presentation-safety pass to the same projection, compiles slide headings with a fixed safe Beamer profile, and writes a PDF. Raw LaTeX headers and export blocks are never inherited by this publishing path. Use export beamer instead when you deliberately need reviewable author-controlled LaTeX.
In Celorga for macOS, choose Publish Document… → Local Link to run this projection and host a Web page, document PDF, or compiled Beamer slides (PDF) from This Mac or a paired Celorga server behind a high-entropy capability URL. Document publishing honors the existing host preference in Settings → Sharing, with an override in the publication sheet. Only the sealed output is transferred to the server; the server must support document hosting, and connection or capability failures never silently fall back to this Mac. Publishing the same source scope and format again replaces the sealed artifact behind the existing URL; links and their listener port also survive app relaunch. The chosen host is available only while its Celorga process is running and uses HTTP on the local/private network; do not use it on an untrusted network. The paired relay advertises supportsDocumentPublishing in GET /v1/status and accepts sealed exports up to 8 MB through authenticated POST /v1/document-publications; GET lists document links and DELETE /v1/document-publications/ID stops one. The result screen can copy or open the link and revoke it immediately. Settings → Sharing lists the source path, output format, URL, and start time for every active link and can open, copy, stop, or stop all publications.
Google Drive publishing uses one authorization and four formats:
google-docsrenders deterministic DOCX and imports an editable Google Doc.google-slidesrenders deterministic ODP from the selected slide headings and imports an editable Google Slides deck.google-sheetsrenders deterministic ODS with one sheet per Org table and imports an editable Google Sheets workbook. A selection with no table fails before upload.google-drive-pdfuploads a disclosure-safe fixed-layout PDF as an ordinary Drive file. The Mac publish sheet renders that PDF from the sealed HTML projection; direct CLI callers supply it with--pdf-file FILE.pdf.
Images never need a temporary public URL. All four formats use the narrow https://www.googleapis.com/auth/drive.file scope and read a short-lived access token from CELORGA_GOOGLE_DRIVE_ACCESS_TOKEN by default; tokens are never accepted as command-line arguments or stored in the publication. A newly created file inherits the destination folder's Google Drive permissions, and Celorga does not alter those permissions. The initial implementation uses Drive's multipart import and therefore rejects upload artifacts over 5 MB; convert unsupported image formats, reduce embedded images, or use the web bundle destination for larger documents. Google documents support embedded PNG, JPEG, and GIF images; the safe Beamer PDF path supports PNG and JPEG.
The macOS publish sheet performs Google's installed-desktop-app authorization flow in the system browser. It uses a random loopback callback port, a per-request PKCE verifier and state value, and the drive.file scope. The access and refresh credentials are stored in macOS Keychain; an expired access token is refreshed before the sheet passes it to the CLI process through the environment, never in command arguments. Disconnecting removes the credential from that Mac.
Distributed Celorga builds bundle the registered desktop client pair through the app's bundled OAuth client properties. Normal users click Connect Google Drive and never create a Google Cloud project or import credentials. Use a custom OAuth client remains an advanced option for self-built and separately branded deployments; it accepts the downloaded JSON for a Google Cloud client of application type Desktop app, not Web application. Celorga masks an imported client secret and stores it only with the resulting OAuth credential in macOS Keychain. It sends the pair only to Google's token endpoint for authorization-code exchange and refresh; it never passes the client secret to the Celorga runtime, the corpus, a published artifact, or a command-line argument. Google's installed-app guidance notes that installed applications cannot keep a client secret confidential in the same sense as a server application. The flow still uses a loopback redirect, PKCE, and a per-request state value.
Developers can set CELORGA_GOOGLE_OAUTH_CLIENT_JSON to a protected client JSON path at build time, or provide the paired CELORGA_GOOGLE_OAUTH_CLIENT_ID and CELORGA_GOOGLE_OAUTH_CLIENT_SECRET values. --google-oauth-client-json PATH is the equivalent local build option. Distribution packaging requires a complete client configuration and fails rather than producing a release that sends users through custom-client setup. The protected JSON is read during the build and is never copied into source, although the resulting desktop client pair is necessarily present in the application bundle. See OAuth 2.0 for desktop apps, Google OAuth 2.0 overview, and Drive authorization scopes.
Publishing to Google is deliberately one-way. CLI callers must retain the returned file ID in durable destination state. Celorga stores that non-secret binding in the published scope's property drawer, using format-specific CELORGA_PUBLISH_GOOGLE_* properties for the file ID, URL, latest observed Drive version, and publish time; whole-document bindings live in the file drawer and subtree bindings live on the selected headline. OAuth credentials remain in Keychain and are never stored in those properties. Google Docs exports preserve headings, lists, tables, links, images, and inline bold, italic, underline, strike, code, and verbatim styling through the generated DOCX import. Replacing an existing Doc, Slides deck, Sheet, or PDF requires the explicit --document-id ID and --replace-existing pair. --if-version VERSION remains accepted as advisory destination metadata for compatible clients, but Google may advance its version counter during server-side conversion, so Celorga does not treat that counter as a durable edit lock. Instead, Celorga fetches the current Drive record and strong ETag through the Drive v2 file resource immediately before replacement, verifies the target type and edit permission, refuses a target with comments because replacement could detach their anchors, and sends that ETag through If-Match on the guarded v2 upload so a change racing the replacement fails atomically. The v3 file resource does not expose this ETag, although new-file creation continues to use v3. The explicit replacement can overwrite prior remote content; inspect the linked artifact first when collaborators may have edited it. Permissions, comments, suggestions, and Google revision history belong to Google; Celorga does not attempt bidirectional synchronization.
# Create after inspecting the preview.
CELORGA_GOOGLE_DRIVE_ACCESS_TOKEN="$TOKEN" \
celorga publish document --file reports/brief.org --to google-docs \
--folder-id DRIVE_FOLDER_ID --apply --format json
# Other native Google formats use the same credential and folder policy.
CELORGA_GOOGLE_DRIVE_ACCESS_TOKEN="$TOKEN" \
celorga publish document --file talks/briefing.org --to google-slides \
--folder-id DRIVE_FOLDER_ID --apply --format json
CELORGA_GOOGLE_DRIVE_ACCESS_TOKEN="$TOKEN" \
celorga publish document --file reports/evidence.org --to google-sheets \
--folder-id DRIVE_FOLDER_ID --apply --format json
# Explicit full-document replacement. The last-seen version is optional metadata.
CELORGA_GOOGLE_DRIVE_ACCESS_TOKEN="$TOKEN" \
celorga publish document --file reports/brief.org --to google-docs \
--document-id GOOGLE_DOCUMENT_ID \
--replace-existing --apply --format json
export beamer previews by default. Without --pdf it produces reviewable .tex; with --pdf it runs pdflatex twice so references, outlines, and overlays settle before the PDF is written. Select another installed command or absolute executable path with --latex-engine. The compiler invokes the engine directly with non-interactive, halt-on-error flags and does not enable shell escape.
Presentation export reads the shared Celorga AST and maps both legacy Org Beamer properties and backend-neutral Celorga slide properties into one presentation model. See Language reference for slide structure, columns, blocks, notes, overlays, and raw backend escape hatches.
LSP
Start language server:
celorga lsp
Current implemented capabilities include:
definitions/references/hover/completion/signature help
rename + linked editing for IDs/file links
file-rename link updates
formatting (document/range/on-type)
semantic tokens, inlay hints, code lens, call hierarchy
For full details, see:
LSP_README.md
Headless server CLI
celorga server init|start|status|pair|revoke|stop|permissions|token|mcp|assign|service|push-config manages the macOS headless relay, scheduler, and optional read-only Streamable HTTP MCP listener. Configuration is machine-local. server permissions --filesystem-access read-only|workspace-write|full-access previews or atomically updates that host's local agent filesystem policy. server token create|list|revoke manages per-client corpus:read bearer credentials while persisting only hashes; creating the first token enables MCP and revoking the final token disables it. server mcp enable|disable previews endpoint, port, and exact browser-origin changes. All applied permission, token, or MCP changes require a restart. server status reports the active policy and non-secret MCP metadata. server assign previews a symbolic automationHostRef change in celorga.json. The workflow due --host-ref HOST and scheduled workflow run --host-ref HOST interfaces enforce that owner. See Headless server setup for the complete lifecycle and limitations.
Project note commands
celorga project list|show|create|adopt|update operates on ordinary Org files.
List returns celorga:project-list:v1 with projects and per-file diagnostics;
create, adopt, and update return celorga:project-edit:v1 with proposed content,
project metadata, baseRevision (null for new files), and applied.
Mutations preview unless --apply is supplied.
Create accepts --title, --color, --file, and --id. Preserve the preview's
ID and path when applying. The default path is beneath roam.nodesDir (or
notes), in projects/. Optional --description TEXT supplies the initial brief;
without it, creation adds no placeholder sections or TODOs. Adopt takes an existing file path and preserves its
body and file-level ID. Pass an adoption preview's --id and --if-revision
using its project ID and baseRevision when applying. Update accepts --thread UUID, --remove, and
--color. Adopt/update accept --if-revision sha256:... for guarded writes.
Color is optional; omitted PROJECT_COLOR means no color. Use --color none
to clear a color. Colors may be blue, teal, green, orange, red, purple, gray, or a six-digit
hexadecimal RGB value such as #4A90D9. Project
notes may live anywhere in nonhidden corpus directories, respecting configured
ignore patterns. Put the marker in the first 8 KiB; notes are limited to 1 MiB.
Duplicate IDs and malformed notes produce diagnostics instead of ambiguous
membership. Briefs contain at most 12,000 characters. workspace agent-state
also exposes an independently fallible projects section.
The metadata is #+CELORGA_KIND: project, #+TITLE:, #+PROJECT_COLOR:,
#+PROJECT_THREADS: (space-separated chat UUIDs), and a file-level properties
drawer containing :ID:. All remaining content uses normal Org headings,
TODOs, tags, planning, and links. There is no separate project database.
project create also adds an empty #+begin: project-threads / #+end:
dynamic block; adoption leaves the note's layout alone. The block carries no
data and is excluded from the brief. HTML renderers list the linked chats in
it, and the Mac reader replaces that list with a live, sortable table of chat
status and activity.
Property views validate source projections against canonical AST ranges: headings and property drawers in examples do not become editable rows. Malformed source notes are omitted with per-file diagnostics in query results, also shown in the Mac view.
Raw captures remain immutable: graph reads may include them, but unlinked-mention actions exclude raw/ and the mutation command rejects raw source edits.
Browser clip import
The integrations/browser-clip/ Chromium extension produces celorga:browser-clip:v1 JSON in browser clip files: url, title, optional author, ISO capturedAt, mode (article or selection), template (note or task), and plain-text content. The Mac Capture window exposes this same runtime import contract.
celorga browser-clip import --file CLIP_FILE --dir ~/notes --json
# Copy revision and clipRevision from that preview:
celorga browser-clip import --file CLIP_FILE --dir ~/notes \
--if-revision sha256:DESTINATION_HASH --if-clip-revision CLIP_HASH --apply --json
An absent destination reports revision absent. Optional --template note|task overrides the saved template and must match between preview and apply. The importer shares capture's source/provenance rendering, preserves an immutable content-addressed raw envelope under raw/browser/, and atomically appends a literal-source note to views/browser-clips.org. Preview writes nothing. Both source-clip and destination revisions are checked before apply; replaying the same clip/template is idempotent. Duplicate detection reads canonical heading provenance drawers, supports CRLF and indentation, and ignores quoted examples and body-only drawers. Imports are limited to 2 MB of text and 4 MB JSON, require HTTP(S) URLs without embedded credentials, and reject paths that escape the active corpus via symlinks. This command does not fetch URLs or promote content to canonical notes.
The task template chooses the first active state in the destination file or corpus TODO workflow, falling back to TODO. Raw-source provenance uses a file-relative link from the imported note to its immutable capture.