{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "WriteOutput",
"description": "NDJSON output for the `write` verb.",
"type": "object",
"properties": {
"type": {
"description": "Event type discriminator.",
"type": "string"
},
"status": {
"description": "Operation outcome: \"ok\" or \"error\".",
"type": "string"
},
"path": {
"description": "Absolute path of the target file.",
"type": "string"
},
"bytes_written": {
"description": "Number of bytes written.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"checksum": {
"description": "BLAKE3 checksum after writing.",
"type": "string"
},
"checksum_before": {
"description": "BLAKE3 checksum before writing, if the file existed.",
"type": [
"string",
"null"
]
},
"backup_path": {
"description": "Backup file path, if a backup was created.",
"type": "string"
},
"backup_skipped": {
"description": "Why the requested backup was skipped, when the target directory\nrefused to accept a new entry. The write itself succeeded.",
"type": "string"
},
"write_strategy": {
"description": "Write strategy the layer actually used: `rename`, `inplace` or\n`copyback`.\n\n`platform.rename_method` names the syscall (`renameat2`), so it cannot\ntell an in-place write from a swap. This field is the only place the\nverdict says which one ran, and an in-place write keeps the inode.",
"type": "string"
},
"elapsed_ms": {
"description": "Operation duration in milliseconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"stdin_bytes_read": {
"description": "Number of bytes read from stdin (G120 L4 local diagnostics). 0 means the\ncaller passed empty stdin and explicitly opted in via\n`--allow-empty-stdin`.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"wal_policy": {
"description": "G119 L1: sidecar creation policy in effect for this write.\n\"auto\" (default heuristic), \"always\" (legacy), or \"never\"\n(suppressed).",
"type": "string"
},
"platform": {
"description": "Platform-specific fsync methods used.",
"$ref": "#/$defs/PlatformInfo"
},
"mtime_preserved": {
"description": "Whether the original mtime was preserved (--preserve-timestamps).",
"type": [
"boolean",
"null"
]
},
"risk_assessment": {
"description": "GAP-2026-011 L6: risk diagnostics for size-delta warnings. Omitted\nwhen the write is below the configured risk threshold (default\n50% delta) and no other guard was triggered.",
"anyOf": [
{
"$ref": "#/$defs/WriteRiskAssessment"
},
{
"type": "null"
}
]
},
"ok": {
"description": "Outcome of the run, stamped by the writer",
"type": "boolean"
},
"code": {
"description": "Machine error code, present when ok is false",
"type": "string"
},
"exit": {
"description": "Process exit status, present when ok is false",
"type": "integer",
"minimum": 0
},
"target_resolved": {
"description": "Absolute targets the run resolved, in invocation order, and never a joined string, so a path holding `,` stays readable; a run with one target publishes a one-item array, so the shape never depends on the count",
"type": "array",
"items": {
"type": "string"
}
},
"target_source": {
"description": "Where the target came from: named in the invocation line, inherited from the workspace slot, or the standard-input stream",
"type": "string",
"enum": [
"argv",
"workspace",
"stdin"
]
},
"workspace_source": {
"description": "Where the workspace root came from: the `--workspace` flag or the process working directory",
"type": "string",
"enum": [
"argv",
"cwd"
]
},
"records_suppressed": {
"description": "Records the writer dropped before the terminal event: `--filter` rejections, `--select` projections that emptied the record, dedupe duplicates and `--limit` cuts. It counts records, never files, so it does not compare with `files_matched`: one file can contribute several records",
"type": "integer",
"minimum": 0
},
"files_budget_dropped": {
"description": "Entries the `--limit` budget dropped, in the unit the verb produces: files for walking verbs, records for streaming ones; a floor, because workers may stop before producing the rest",
"type": "integer",
"minimum": 0
},
"files_planned": {
"description": "Files the run would have modified in `--dry-run` or `--preview`; absent from a run that really wrote",
"type": "integer",
"minimum": 0
},
"truncated": {
"description": "The record itself was cut by `--truncate-content` or `--max-output-bytes`, so the fields are shorter than the source",
"type": "boolean"
},
"truncated_records": {
"description": "Records the writer cut this run, counted once per record",
"type": "integer",
"minimum": 0
}
},
"required": [
"type",
"status",
"path",
"bytes_written",
"checksum",
"write_strategy",
"elapsed_ms",
"stdin_bytes_read",
"wal_policy",
"platform"
],
"$defs": {
"PlatformInfo": {
"description": "Platform-specific fsync method names for diagnostics.",
"type": "object",
"properties": {
"fsync": {
"description": "File fsync method name (e.g. `F_FULLFSYNC` or `sync_data`).",
"type": "string"
},
"dir_fsync": {
"description": "Directory fsync method name (e.g. `sync_all` or `best_effort`).",
"type": "string"
},
"durability": {
"description": "Durability mode resolved for this write (v0.1.29 P2-1).",
"type": [
"string",
"null"
]
},
"rename_method": {
"description": "Rename method used (v0.1.29 P2-2).",
"type": [
"string",
"null"
]
},
"backup_method": {
"description": "Backup method when a backup was created: hardlink|reflink|copy (v0.1.29 P2-3).",
"type": [
"string",
"null"
]
}
},
"required": [
"fsync",
"dir_fsync"
]
},
"WriteRiskAssessment": {
"description": "GAP-2026-011 L1/L6: Local diagnostics describing why a write was classified\nas risky (G-031: not product telemetry). Emitted in `WriteOutput.risk_assessment`\nwhen the size delta exceeds the user-configured `--risk-threshold`.",
"type": "object",
"properties": {
"original_bytes": {
"description": "File size before the write.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"new_bytes": {
"description": "New file size after the write.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"size_delta_pct": {
"description": "|new - original| / original * 100.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"risk_level": {
"description": "\"low\" (<70%) | \"medium\" (70-89%) | \"high\" (>=90%).",
"type": "string"
},
"guard_triggered": {
"description": "Which guard triggered the assessment (always \"size\" for L1).",
"type": "string"
}
},
"required": [
"original_bytes",
"new_bytes",
"size_delta_pct",
"risk_level",
"guard_triggered"
]
}
}
}