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
| Option | Type | Default | Description |
|---|---|---|---|
| path | string | ".opencontext" | Directory path for storing context files |
| readOnly | boolean | false | Disable write operations (save_context) |
| disabled | boolean | false | Pause all tool access |
| autoIndex | boolean | true | Auto-generate index.md with topic metadata |
| guard.enabled | boolean | true | Enable write guard validation |
| guard.maxFileSizeKb | number | 50 | Maximum file size in KB |
| guard.strictPatternCheck | boolean | true | Check for forbidden prompt injection patterns |
Example Configs
Read-only mode
{ "readOnly": true }Custom path
{ "path": ".project-context" }Strict guard
{ "guard": { "maxFileSizeKb": 100, "strictPatternCheck": true } }