Configuration

Customize OpenContext with a config file.

Config File

Create .opencontext.jsonc or .opencontext.json in your project root:

.opencontext.jsonc
{
  // Custom storage path
  "path": ".opencontext",

  // Disable write operations
  "readOnly": false,

  // Pause all tool access
  "disabled": false,

  // Auto-generate index.md
  "autoIndex": true,

  // Write guard settings
  "guard": {
    "enabled": true,
    "maxFileSizeKb": 50,
    "strictPatternCheck": true
  }
}

Supports JSONC (JSON with Comments). If no config file exists, OpenContext uses sensible defaults.

Options

OptionTypeDefaultDescription
pathstring".opencontext"Directory path for storing context files
readOnlybooleanfalseDisable write operations (save_context)
disabledbooleanfalsePause all tool access
autoIndexbooleantrueAuto-generate index.md with topic metadata
guard.enabledbooleantrueEnable write guard validation
guard.maxFileSizeKbnumber50Maximum file size in KB
guard.strictPatternCheckbooleantrueCheck for forbidden prompt injection patterns

Example Configs

Read-only mode

{ "readOnly": true }

Custom path

{ "path": ".project-context" }

Strict guard

{ "guard": { "maxFileSizeKb": 100, "strictPatternCheck": true } }