# Output contract Human output may evolve for clarity. Machine output is a versioned compatibility surface. Values in the examples illustrate schema shape and do not assert current repository state. Timestamps are normalized to UTC. Fractional seconds are retained when present, with insignificant trailing zeroes omitted; whole-second values retain the compact `YYYY-MM-DDTHH:MM:SSZ` form shown below. Timestamps captured from the local system clock are limited to microsecond precision so binary floating-point artifacts do not appear in either output mode. The version schema is: ```json { "schema": "org.camlet.version.v1", "result": { "name": "camlet", "version": "0.1.0-dev" } } ``` ## Repository context `camlet context --json` emits `org.camlet.context.v1`: ```json { "schema": "org.camlet.context.v1", "result": { "repository": { "root": "/work/camlet" }, "git": { "head": "055bce9f3785aba0158eb715c742d2030e9594eb", "branch": "main", "dirty": false }, "jujutsu": { "commit": "155bce9f3785aba0158eb715c742d2030e9594eb", "change_id": "otmymxotwxxovyssvunptzltqoromspn", "bookmarks": ["feat/offline-context"] }, "surfaces": [ { "forge": "tangled", "remote": "tangled", "repository": { "kind": "did", "value": "did:plc:rvyb4oxpswgjgdvvncihletw" }, "tracking_ref": "refs/remotes/tangled/main", "revision": "055bce9f3785aba0158eb715c742d2030e9594eb", "relation": { "kind": "equal", "ahead": 0, "behind": 0 } } ], "agreement": "equal", "observation": "local_tracking_refs" } } ``` `jujutsu` is `null` when Jujutsu is unavailable or the repository is not a Jujutsu workspace. A surface `revision` is `null` and its relation is `missing` when its branch tracking ref does not exist. In a detached Git checkout, including a colocated Jujutsu working copy, `git.branch` is `null`; recognized surfaces remain in the result, but their `tracking_ref` and `revision` are `null` and their relation is `missing` because Camlet cannot infer a branch-specific tracking ref. Relation values are `equal`, `ahead`, `behind`, `diverged`, and `missing`. Agreement values are `equal`, `out_of_sync`, `incomplete`, `diverged`, and `unconfigured`. Any known divergent relation makes the aggregate `diverged`, even when another surface is missing. Otherwise missing evidence makes it `incomplete`; ahead or behind relations make it `out_of_sync`; and only entirely equal observations make it `equal`. This schema reports local observations only. `observation: local_tracking_refs` means Camlet did not contact or fetch from any forge. Git and Jujutsu fields remain separate because a colocated Jujutsu working-copy commit can differ from Git `HEAD`. ## Repository view `camlet repo view --json` emits `org.camlet.repo.v1`: ```json { "schema": "org.camlet.repo.v1", "result": { "repository": { "did": "did:plc:rvyb4oxpswgjgdvvncihletw", "description": "Correctness- and interoperability-oriented Tangled CLI", "labels": [], "created_at": "2026-07-25T19:59:48Z" }, "ownership": { "owner_did": "did:plc:wrl7x5yocird6ep6472fkm3a", "record_key": "camlet", "record_uri": "at://did:plc:wrl7x5yocird6ep6472fkm3a/sh.tangled.repo/camlet", "record_cid": "bafyreigbooo2di2ztxyk2hama6lf42gxaudybxijwpcllsfadeymjvgtqq" }, "services": { "knot": "https://knot1.tangled.sh", "pds": "https://tngl.sh" }, "observation": { "observed_at": "2026-07-26T19:45:47Z", "freshness": "latest_record_served_at_observation", "authorities": [ "plc_directory", "knot_describe_repo", "owner_pds_record" ] } } } ``` `created_at` belongs to the repository record. `observed_at` is the client observation time. `latest_record_served_at_observation` means Camlet omitted the optional CID constraint and validated the latest record version returned by the owner PDS; it does not claim index visibility or global freshness. All three authorities must agree before Camlet emits the document. ## Repository list `camlet repo list --json` emits `org.camlet.repo-list.v1`: ```json { "schema": "org.camlet.repo-list.v1", "result": { "owner": { "did": "did:plc:bbbbbbbbbbbbbbbbbbbbbbbb", "pds": "https://pds.example" }, "repositories": [ { "repository": { "did": "did:plc:aaaaaaaaaaaaaaaaaaaaaaaa", "description": "A repository", "labels": [], "created_at": "2026-01-02T03:04:05Z" }, "ownership": { "record_key": "project", "record_uri": "at://did:plc:bbbbbbbbbbbbbbbbbbbbbbbb/sh.tangled.repo/project", "record_cid": "bafyreigfkphxytbcofvk7bjh622rep55av3l3anzp2isioecbidkgzjzkm" }, "services": { "knot": "https://knot.example" } } ], "observation": { "observed_at": "2026-01-02T03:05:00Z", "enumeration": "owner_pds_complete_pagination", "snapshot": "non_atomic", "authorities": [ "plc_directory", "owner_pds_records", "knot_describe_repo" ] } } } ``` Repositories are ordered by their case-sensitive record key. An owner with no repository records succeeds with an empty `repositories` array. Every returned record has been verified against its repository DID document and knot; one invalid, unavailable, or inconsistent record fails the command instead of producing partial output. `owner_pds_complete_pagination` means Camlet followed PDS cursors until the cursor field was absent. It does not claim a transactional snapshot: the owner's AT repository may change between pages or while knot ownership is being verified. The command does not consult Bobbin and makes no aggregated-index visibility claim. ## Issue list `camlet issue list --json` emits `org.camlet.issue-list.v1`: ```json { "schema": "org.camlet.issue-list.v1", "result": { "repository": { "did": "did:plc:aaaaaaaaaaaaaaaaaaaaaaaa" }, "filter": { "state": "all" }, "issues": [ { "id": "3example", "record": { "uri": "at://did:plc:bbbbbbbbbbbbbbbbbbbbbbbb/sh.tangled.repo.issue/3example", "cid": "bafyreigfkphxytbcofvk7bjh622rep55av3l3anzp2isioecbidkgzjzkm", "created_at": "2026-01-02T03:04:05Z" }, "content": { "title": "Example issue", "body": "Example body" }, "derived": { "state": "open", "state_updated_at": null, "comment_count": 1, "source": "bobbin" } } ], "observation": { "observed_at": "2026-01-02T03:05:00Z", "source": { "kind": "bobbin", "endpoint": "https://api.tangled.org" }, "enumeration": "bobbin_complete_pagination", "snapshot": "non_atomic", "completeness": "indexed_observation_only", "coverage": { "before": { "ready": true, "events_processed": 100000, "last_cursor": 110000 }, "after": { "ready": true, "events_processed": 100010, "last_cursor": 110010 } } } } } ``` Issue order follows complete descending Bobbin pagination. The record key is a human-facing ID, while the AT URI is the unique machine identity. Optional CID, body, and state-update fields are `null` when absent. Derived state and comment count are Bobbin observations, not independently verified source records. `bobbin_complete_pagination` means Camlet followed every cursor exposed during the request. `indexed_observation_only` means that neither an empty list nor `ready: true` establishes authoritative issue absence. The before and after coverage objects bracket the non-atomic traversal. ## Issue view `camlet issue view --json ISSUE_AT_URI` emits `org.camlet.issue.v1`. The result contains the verified repository identity, current author-PDS issue record, derived state with its accepted state-record provenance, source-PDS-verified comments, and the Bobbin coverage observations that bracket relation enumeration. The complete field schema and normative example are defined in [the issue-view protocol contract](protocol/issue-view-contract.md#machine-output-contract). Optional CIDs, body text, state-record provenance, state-update time, original comment text, and reply references are JSON `null` when absent. Empty state or comment observations do not establish authoritative relation absence. ## Errors After command-line parsing succeeds, commands using `--json` emit failures as `org.camlet.error.v1`: ```json { "schema": "org.camlet.error.v1", "error": { "category": "external_tool", "code": "git.timeout", "message": "Git timed out while locating the repository" } } ``` Machine errors are written to standard output so callers can decode the same stream on success and failure. Human errors are written to standard error. Cmdliner-owned failures such as an unknown option or missing required positional argument occur before the command can select its output contract; they retain Cmdliner's diagnostic and exit behavior. Value validation owned by Camlet, including `--timeout`, `--state`, identities, AT URIs, and service origins, does use the JSON error contract. Stable exit codes are `2` for usage errors, `3` for configuration errors, `4` for not-found errors, `5` for authentication errors, `6` for authorization errors, `7` for transport errors, `8` for protocol errors, `9` for external-tool errors, `10` for consistency errors, `11` for conflict errors, and `70` for internal errors. Shared boundary failures use neutral code namespaces: `identity.*` for identity input, `transport.*` for network and local HTTP failures, and `protocol.*` for transport-level response contract violations. Operation-specific semantic failures retain command namespaces such as `repo.*`. Every machine-enabled command documents its schema and stable error categories. Secrets, authorization headers, cookies, app passwords, refresh tokens, and webhook secrets must never occur in either human or machine errors.