# Organization Config

Source: https://obsvra.com/docs/organization-config

> Share settings across a team: where SpiceGrinder finds an organization bundle, and how its policy, preferences, formats and libraries apply.

> © 2026 Obsvra. This document describes SpiceGrinder and is provided to help you evaluate and use it. It is not a license to reproduce, adapt, or use this material to build a competing product or service. Full terms: the SpiceGrinder EULA.

## Discovery

1. `SPICEGRINDER_ORG_HOME` environment variable  
2. `-Dspicegrinder.org.home=/path`

## Bundle layout

```text
org-home/
  manifest.properties      # org.id, version
  policy.properties        # governance rules
  preferences.properties   # org default prefs
  colors.properties        # optional: org node colors
  component-weights.properties  # optional: org complexity-score weights
  formats.properties       # optional: org data point formats
  libraries/               # Import search roots
```

## Postures

| Posture | When |
|---------|------|
| `SOLO` | No org home |
| `SOLO_WITH_NOTE` | Org home present, **Free** edition (ignored, logged) |
| `PRODUCTION` | Pro/Enterprise + org loaded |
| `DEV` | Pro/Enterprise + org + `SPICEGRINDER_DEV_MODE=true` (if policy allows) |

## Dev mode

```bash
export SPICEGRINDER_DEV_MODE=true
# or -Dspicegrinder.dev.mode=true
```

Allows extra scan packages beyond the org allowlist when `components.dev_mode.allowed=true` and `components.dev_mode.allow_extra_scan_packages=true`. The second defaults to true, but an organization can set it to false to keep dev mode available while still denying extra packages. Still cannot write into `com.obsvra.spicegrinder.*`. Shadowing org short names stays denied by default.

## Import resolution order

1. Organization `libraries/`  
2. Directory of the importing model  
3. Optional project root (`ModelLoader.setProjectRoot`)  
4. User library paths (if `libraries.local_override` permits)

Absolute paths outside org/project/model roots require `libraries.allow_absolute_external_paths=true`.

A relative `file`, `../` included, must land inside a root: the importing top-level model's own folder, its project root, or a library folder (the organization's `libraries/`, or the user's `library.paths` when policy allows them). The project root (local root) of a model loaded from a file is the first of: `--local-root DIR` given to the command (the desktop app passes its Local root setting this way); `project.root` in `~/.spicegrinder/preferences.properties` (an absolute path; empty by default); the nearest folder at or above the model that contains a `.spicegrinder-root` file (its content is ignored; a staged release's top folder has one); the top of the Git work tree the model is in. With none of these, only the model's own folder counts. A relative import is looked for beside the model, then in the project root, then in the library folders. `FlatFile` data files and `Email` word lists use the same local root (see the Component Library Reference). A model sent as text with no folder of its own (the Service API, the MCP tools) has `project.root` as its project root when that is set (so a server's owner can narrow it), else the working directory, unless that is the filesystem root. Real paths are compared whole segment by segment, symlinks resolved, and every file an import pulls in is held to the top-level model's roots. So with `~/sg/.spicegrinder-root`, a model in `~/sg/models/myOrg` can import `../businessObj/person.xml`, while a `../` chain or a symlink that leaves every root is refused with `Import path leaves its root: <path as written>`. Absolute paths are unchanged in solo mode, and `libraries.allow_absolute_external_paths` governs them in an organization. Separately, if an imported file cannot be parsed, the error names the file and the line and column but never quotes the file's content.

## Inspecting library paths

`list --library-paths` prints the library folders in the order above (the organization's `libraries/` first, then user paths). `list --add-library-path PATH` and `--remove-library-path PATH` edit the user's own paths. When the organization's policy denies `libraries.local_override`, adding or removing a user path is refused (exit 2), any user paths already configured are ignored, and `--library-paths` says so (`userPathsIgnored` in `--json`). The MCP server's `configure_library_path` tool follows the same policy. See [ComponentLibraryApp.md](https://obsvra.com/docs/componentlibraryapp).

## Enforcement

`enforcement.mode=warn|enforce|audit_only` (default **warn** for pilots).

## Settings your organization can set, and whether users may change them

An organization can supply any of the four settings files: `preferences.properties`, `colors.properties`, `component-weights.properties` and `formats.properties`. Each setting then resolves in the same order: SpiceGrinder's built-in value, then the organization's, then the user's own file in `~/.spicegrinder`. A user's value only applies if the organization's rules allow it.

For each setting you choose whether the organization's value is a **default** (users may change it) or **enforced** (they may not). With no rule, a setting is a default, so the user can change it. Put the choice in `policy.properties`:

```properties
key.<pattern>.mode = default | warn | enforce | audit_only
```

| Mode | What happens when a user (or a model file) overrides the setting |
|------|------------------------------------------------------------------|
| `default` | The override applies, silently. |
| `warn` | The override applies, and a warning is printed to stderr. |
| `enforce` | The override is **ignored**, and a warning is printed to stderr. |
| `audit_only` | The override applies, and it is reported as audited on stderr. |

The pattern matches `<file>.<key>`, where `<file>` is `preferences`, `colors`, `weights` or `formats` and `*` matches any run of characters, dots included. When more than one rule matches, the most specific one (the one with the most literal characters) wins, so you can lock a group and open one exception:

```properties
key.formats.*.mode=enforce
key.formats.format.phone.*.mode=default
key.colors.*.mode=default
key.weights.*.mode=warn
key.preferences.scan.packages.mode=enforce
```

Examples of qualified keys: `preferences.last.model.dir`, `colors.color.filter.core.fill`, `weights.com.obsvra.spicegrinder.core.defaults.generators.Beta`, `formats.format.phone.en_US`.

A per-key rule beats `preferences.locked_keys`, `preferences.local_override` and the global `enforcement.mode` for that key. Keys with no rule still follow those older rules, so an existing bundle behaves as before.

**Model files.** A node's `format` parameter (Address, Person, Email, Phone, CreditCard) overrides the template `formats.format.<type>.<locale>`, so the rule for that key applies to it too. If the key is enforced, the node's `format` is ignored, a warning is printed, and the model still loads with the organization's template.

A node's `locale` parameter (Phone, Email, CreditCard and PersonAssembler) picks which locale's template is used, so it is an override of the default locale, the key `formats.format.locale`. A rule on that key decides it the same way: enforced, and a `locale` other than the default is ignored with a warning and the default locale is used; `warn` applies it with a warning. A `locale` equal to the default is not an override. A `formats.*` rule covers it too, and a more specific `key.formats.format.locale.mode` overrides the `formats.*` rule. (An Address takes its locale from its country column, not a parameter, so this doesn't apply to it.)

### Seeing what is in effect

`list --settings` (add `--json` for a machine-readable report) prints the organization's name and version, every rule, and each setting with its effective value, where that value came from (built-in, organization or user), the rule that governs it, and any value of the user's that an `enforce` rule ignored. Use `--scope preferences|colors|weights|formats` or `--key PREFIX` to narrow it. See [ComponentLibraryApp.md](https://obsvra.com/docs/componentlibraryapp).

### Choosing default or enforced

* **Enforce** what has to be the same in every output: data point formats that downstream systems parse, and any preference that points at a shared location.
* **Leave as a default** what is a matter of taste or a personal workflow: node colors, view options, the last folder used.
* **Warn** for a setting you want people to notice they changed but not be stopped from changing, for example while you are piloting a new default, or the complexity-score weights when people re-measure on their own hardware.
* **audit_only** when you need a record of overrides but no friction.
* Start a pilot with `warn`, look at what people actually override, then move the keys that matter to `enforce`.
