{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "content": {
      "default": {
        "dir": ".",
        "attachmentFolderPath": "./"
      },
      "type": "object",
      "properties": {
        "dir": {
          "default": ".",
          "type": "string",
          "scope": "project",
          "agentSettable": false,
          "reload": "boot",
          "defaultScope": "project",
          "description": "Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart."
        },
        "attachmentFolderPath": {
          "default": "./",
          "type": "string",
          "scope": "project",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project",
          "description": "Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'."
        }
      },
      "additionalProperties": {}
    },
    "appearance": {
      "default": {
        "preview": {
          "autoOpen": true
        }
      },
      "type": "object",
      "properties": {
        "theme": {
          "type": "string",
          "enum": [
            "light",
            "dark",
            "system"
          ],
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project."
        },
        "language": {
          "type": "string",
          "enum": [
            "system",
            "en",
            "zh-Hans",
            "zh-Hant",
            "hi",
            "es",
            "ar",
            "fr",
            "bn",
            "pt-BR",
            "id",
            "ur",
            "ko"
          ],
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content."
        },
        "colorThemeLight": {
          "type": "string",
          "pattern": "^[a-z0-9-]{1,32}$",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized', or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project."
        },
        "colorThemeDark": {
          "type": "string",
          "pattern": "^[a-z0-9-]{1,32}$",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of 'dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized', or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project."
        },
        "colorTheme": {
          "type": "string",
          "pattern": "^[a-z0-9-]{1,32}$",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project."
        },
        "colorThemeEnabled": {
          "type": "boolean",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on."
        },
        "customTheme": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: the scheme's display name."
            },
            "author": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: the scheme's author credit, carried through from an imported base16 scheme."
            },
            "variant": {
              "type": "string",
              "enum": [
                "dark",
                "light"
              ],
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted."
            },
            "base00": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base00 — default background, as a #rrggbb hex string."
            },
            "base01": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base01 — alt background — cards, popovers, sidebar, as a #rrggbb hex string."
            },
            "base02": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base02 — selection background, borders, as a #rrggbb hex string."
            },
            "base03": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base03 — comments, invisibles, as a #rrggbb hex string."
            },
            "base04": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base04 — secondary text, as a #rrggbb hex string."
            },
            "base05": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base05 — default foreground, as a #rrggbb hex string."
            },
            "base06": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base06 — light foreground, as a #rrggbb hex string."
            },
            "base07": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base07 — lightest foreground, as a #rrggbb hex string."
            },
            "base08": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base08 — red — variables, tags, diff deleted, as a #rrggbb hex string."
            },
            "base09": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base09 — orange — numbers, constants, as a #rrggbb hex string."
            },
            "base0A": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base0A — yellow — classes, search highlight, as a #rrggbb hex string."
            },
            "base0B": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base0B — green — strings, diff inserted, as a #rrggbb hex string."
            },
            "base0C": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base0C — cyan — support, escapes, quotes, as a #rrggbb hex string."
            },
            "base0D": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base0D — blue — functions, headings, accent, as a #rrggbb hex string."
            },
            "base0E": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base0E — magenta — keywords, storage, as a #rrggbb hex string."
            },
            "base0F": {
              "type": "string",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Custom theme: base16 base0F — deprecated markers, embedded tags, as a #rrggbb hex string."
            }
          },
          "additionalProperties": {}
        },
        "preview": {
          "default": {
            "autoOpen": true
          },
          "type": "object",
          "properties": {
            "autoOpen": {
              "default": true,
              "type": "boolean",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope)."
            }
          },
          "additionalProperties": {}
        },
        "sidebar": {
          "type": "object",
          "properties": {
            "showHiddenFiles": {
              "default": false,
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators."
            },
            "showOnlyMarkdownFiles": {
              "default": false,
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators."
            },
            "showSkillsSection": {
              "default": true,
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators."
            },
            "showOkFolders": {
              "default": false,
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators."
            },
            "showSkillGroups": {
              "default": true,
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators."
            },
            "pinnedProjectSkills": {
              "default": [],
              "type": "array",
              "items": {
                "type": "string"
              },
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators."
            },
            "pinnedGlobalSkills": {
              "default": [],
              "type": "array",
              "items": {
                "type": "string"
              },
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project."
            }
          },
          "additionalProperties": {}
        }
      },
      "additionalProperties": {}
    },
    "editor": {
      "default": {
        "wordWrap": true,
        "previewTabs": true
      },
      "type": "object",
      "properties": {
        "wordWrap": {
          "default": true,
          "type": "boolean",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope)."
        },
        "previewTabs": {
          "default": true,
          "type": "boolean",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope)."
        }
      },
      "additionalProperties": {}
    },
    "agents": {
      "default": {
        "autoApproveOkTools": true
      },
      "type": "object",
      "properties": {
        "autoApproveOkTools": {
          "default": true,
          "type": "boolean",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."
        }
      },
      "additionalProperties": {}
    },
    "autoSync": {
      "default": {
        "mode": null,
        "enabled": null,
        "default": null
      },
      "type": "object",
      "properties": {
        "mode": {
          "default": null,
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "off",
                "follow",
                "full",
                "pull"
              ],
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean."
            },
            {
              "type": "null"
            }
          ]
        },
        "enabled": {
          "default": null,
          "anyOf": [
            {
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared."
            },
            {
              "type": "null"
            }
          ]
        },
        "resumeMode": {
          "type": "string",
          "enum": [
            "follow",
            "full",
            "pull"
          ],
          "scope": "project-local",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project-local",
          "description": "When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared."
        },
        "default": {
          "default": null,
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string",
                  "enum": [
                    "off",
                    "follow",
                    "full",
                    "pull"
                  ]
                }
              ],
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": {}
    },
    "terminal": {
      "default": {
        "enabled": null
      },
      "type": "object",
      "properties": {
        "enabled": {
          "default": null,
          "anyOf": [
            {
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": {}
    },
    "slides": {
      "default": {
        "enabled": false
      },
      "type": "object",
      "properties": {
        "enabled": {
          "default": false,
          "type": "boolean",
          "scope": "user",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "user",
          "description": "Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."
        }
      },
      "additionalProperties": {}
    },
    "telemetry": {
      "default": {
        "localSink": {
          "enabled": true,
          "spans": {
            "maxBytes": 52428800
          },
          "logs": {
            "maxBytes": 26214400
          },
          "attributeDenylist": [
            "authorization",
            "auth.token",
            "auth.bearer",
            "cookie",
            "set-cookie",
            "x-api-key",
            "password",
            "secret"
          ]
        },
        "skillInstallReports": {
          "enabled": true
        }
      },
      "type": "object",
      "properties": {
        "localSink": {
          "default": {
            "enabled": true,
            "spans": {
              "maxBytes": 52428800
            },
            "logs": {
              "maxBytes": 26214400
            },
            "attributeDenylist": [
              "authorization",
              "auth.token",
              "auth.bearer",
              "cookie",
              "set-cookie",
              "x-api-key",
              "password",
              "secret"
            ]
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."
            },
            "spans": {
              "default": {
                "maxBytes": 52428800
              },
              "type": "object",
              "properties": {
                "maxBytes": {
                  "default": 52428800,
                  "type": "number",
                  "scope": "project",
                  "agentSettable": false,
                  "reload": "live",
                  "defaultScope": "project",
                  "description": "Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB)."
                }
              },
              "additionalProperties": {}
            },
            "logs": {
              "default": {
                "maxBytes": 26214400
              },
              "type": "object",
              "properties": {
                "maxBytes": {
                  "default": 26214400,
                  "type": "number",
                  "scope": "project",
                  "agentSettable": false,
                  "reload": "live",
                  "defaultScope": "project",
                  "description": "Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB)."
                }
              },
              "additionalProperties": {}
            },
            "attributeDenylist": {
              "default": [
                "authorization",
                "auth.token",
                "auth.bearer",
                "cookie",
                "set-cookie",
                "x-api-key",
                "password",
                "secret"
              ],
              "type": "array",
              "items": {
                "type": "string"
              },
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist."
            }
          },
          "additionalProperties": {}
        },
        "skillInstallReports": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "user",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "user",
              "description": "Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off."
            }
          },
          "additionalProperties": {}
        }
      },
      "additionalProperties": {}
    },
    "lossCapture": {
      "default": {
        "enabled": true,
        "maxBytes": 12582912
      },
      "type": "object",
      "properties": {
        "enabled": {
          "default": true,
          "type": "boolean",
          "scope": "project",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project",
          "description": "Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."
        },
        "maxBytes": {
          "default": 12582912,
          "type": "number",
          "scope": "project",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project",
          "description": "Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB)."
        }
      },
      "additionalProperties": {}
    },
    "bridge": {
      "default": {
        "backgroundThrottle": {
          "enabled": true
        },
        "deferGuard": {
          "enabled": true
        },
        "lossDetector": {
          "enabled": true
        },
        "fixedPoint": {
          "enabled": true
        },
        "preDrain": {
          "enabled": true
        },
        "flushOnHide": {
          "enabled": true
        }
      },
      "type": "object",
      "properties": {
        "backgroundThrottle": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression."
            }
          },
          "additionalProperties": {}
        },
        "deferGuard": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression."
            }
          },
          "additionalProperties": {}
        },
        "lossDetector": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression."
            }
          },
          "additionalProperties": {}
        },
        "fixedPoint": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression."
            }
          },
          "additionalProperties": {}
        },
        "preDrain": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression."
            }
          },
          "additionalProperties": {}
        },
        "flushOnHide": {
          "default": {
            "enabled": true
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": true,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression."
            }
          },
          "additionalProperties": {}
        }
      },
      "additionalProperties": {}
    },
    "search": {
      "default": {
        "semantic": {
          "enabled": false,
          "baseUrl": "https://api.openai.com/v1",
          "model": "text-embedding-3-small"
        }
      },
      "type": "object",
      "properties": {
        "semantic": {
          "default": {
            "enabled": false,
            "baseUrl": "https://api.openai.com/v1",
            "model": "text-embedding-3-small"
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": false,
              "type": "boolean",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."
            },
            "baseUrl": {
              "default": "https://api.openai.com/v1",
              "type": "string",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."
            },
            "model": {
              "default": "text-embedding-3-small",
              "type": "string",
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions)."
            },
            "dimensions": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991,
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus."
            },
            "similarityFloor": {
              "type": "number",
              "minimum": 0,
              "maximum": 1,
              "scope": "project-local",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project-local",
              "description": "Optional hard cutoff: drop any \"by meaning\" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap."
            }
          },
          "additionalProperties": {}
        }
      },
      "additionalProperties": {}
    },
    "contentRules": {
      "default": {
        "markdownlint": {
          "enabled": false
        },
        "frontmatter": {
          "enabled": false,
          "schemas": []
        },
        "okf": {
          "enabled": false,
          "generate": {
            "index": false
          }
        }
      },
      "type": "object",
      "properties": {
        "markdownlint": {
          "default": {
            "enabled": false
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": false,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Whether the markdownlint plugin (body rules) contributes diagnostics."
            }
          }
        },
        "frontmatter": {
          "default": {
            "enabled": false,
            "schemas": []
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": false,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics."
            },
            "schemas": {
              "default": [],
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "appliesTo": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ]
                  },
                  "file": {
                    "type": "string"
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "file"
                ]
              },
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path)."
            }
          }
        },
        "okf": {
          "default": {
            "enabled": false,
            "generate": {
              "index": false
            }
          },
          "type": "object",
          "properties": {
            "enabled": {
              "default": false,
              "type": "boolean",
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write."
            },
            "rules": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": "boolean"
              },
              "scope": "project",
              "agentSettable": false,
              "reload": "live",
              "defaultScope": "project",
              "description": "Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on."
            },
            "generate": {
              "default": {
                "index": false
              },
              "type": "object",
              "properties": {
                "index": {
                  "default": false,
                  "type": "boolean",
                  "scope": "project",
                  "agentSettable": false,
                  "reload": "live",
                  "defaultScope": "project",
                  "description": "Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild."
                }
              }
            }
          }
        }
      },
      "additionalProperties": {}
    },
    "validation": {
      "default": {
        "links": "warning",
        "fileTreeIndicators": true
      },
      "type": "object",
      "properties": {
        "links": {
          "default": "warning",
          "type": "string",
          "enum": [
            "off",
            "warning",
            "error"
          ],
          "scope": "project",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project",
          "description": "How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity."
        },
        "fileTreeIndicators": {
          "default": true,
          "type": "boolean",
          "scope": "project",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project",
          "description": "Whether the file tree tints and badges files that have validation problems."
        }
      },
      "additionalProperties": {}
    },
    "linkPreviews": {
      "default": {
        "enabled": true
      },
      "type": "object",
      "properties": {
        "enabled": {
          "default": true,
          "type": "boolean",
          "scope": "project-local",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project-local",
          "description": "Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on."
        }
      },
      "additionalProperties": {}
    },
    "server": {
      "default": {
        "bind": [
          "127.0.0.1"
        ],
        "allowExternal": false
      },
      "type": "object",
      "properties": {
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535,
          "scope": "project",
          "agentSettable": false,
          "reload": "boot",
          "defaultScope": "project",
          "description": "TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart."
        },
        "bind": {
          "default": [
            "127.0.0.1"
          ],
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "scope": "project-local",
          "agentSettable": false,
          "reload": "boot",
          "defaultScope": "project-local",
          "description": "Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart."
        },
        "externalUrl": {
          "type": "string",
          "pattern": "^https?:\\/\\/",
          "scope": "project",
          "agentSettable": false,
          "reload": "boot",
          "defaultScope": "project",
          "description": "Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart."
        },
        "allowExternal": {
          "default": false,
          "type": "boolean",
          "scope": "project-local",
          "agentSettable": false,
          "reload": "boot",
          "defaultScope": "project-local",
          "description": "Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead."
        },
        "openBrowser": {
          "type": "boolean",
          "scope": "project-local",
          "agentSettable": false,
          "reload": "boot",
          "defaultScope": "project-local",
          "description": "Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared."
        },
        "idleShutdown": {
          "anyOf": [
            {
              "type": "string",
              "const": "off"
            },
            {
              "type": "string",
              "pattern": "^[1-9]\\d*(s|m|h)$"
            }
          ],
          "scope": "project-local",
          "agentSettable": false,
          "reload": "live",
          "defaultScope": "project-local",
          "description": "Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared."
        }
      },
      "additionalProperties": {}
    }
  },
  "additionalProperties": {}
}
