agentleFS
MarcoPorcellatoMarcoPorcellato/matryca-plumber/.cursor/rules/07-env-example.mdc

matryca-plumber / rules

Cursor rule99 starsChanged 4 months agoApache-2.0View on GitHub

Keep .env.example in sync when adding or changing environment variables (operator vs advanced tiers).

  • Reads credentials

The file

We split this 07-env-example.mdc into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When you add, rename, or change the default of any environment variable read from os.environ / load_plumber_lint_config_from_environ / UI …

    line 8
  2. Very specific:

    Do not edit the operator's local .env unless they explicitly ask.

    line 19
  3. Very specific:

    Default (code): must match the actual fallback in code (plumber_config.py, module _DEFAULT_*, or _map_bool(..., True)).

    line 42
  4. Very specific:

    If the env change is user-visible, also add a bullet under CHANGELOG.md ## [Unreleased] per .cursor/rules/06-auto-changelog.mdc.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
07-env-example.mdc
---
description: Keep .env.example in sync when adding or changing environment variables (operator vs advanced tiers).
globs: src/**/*.py,.env.example
---

# `.env.example` maintenance (mandatory)

When you **add, rename, or change the default** of any environment variable read from `os.environ` / `load_plumber_lint_config_from_environ` / UI `_ENV_KEY_MAP`, update [`.env.example`](.env.example) in the **same task** — without waiting for the user to ask.

## When to update

| Trigger | Action |
|---------|--------|
| New `os.environ.get("MATRYCA_…")`, `_env_int`, `_map_bool(env, …)`, or `_*_ENV = "…"` in `src/` | Add key to `.env.example` in the correct tier |
| Changed Python default (e.g. `DEFAULT_*`, `_map_*` fallback, dataclass default) | Update **Default (code)** comment; adjust **Template** only if the safe install profile should change |
| New Settings field → `_ENV_KEY_MAP` in `ui_server.py` | Document under **Operator essentials** (UI-exposed keys) |
| Variable becomes **deprecated** or **reserved** (not read) | Move to deprecated block; add to `tests/test_env_example_coverage.py` `_ALLOWLIST_UNREAD` if still listed |

Do **not** edit the operator's local `.env` unless they explicitly ask.

## File structure (two tiers)

```text
[Header + legend]
=== OPERATOR ESSENTIALS ===     ← paths, LLM, thermal, map-reduce, low-priority, basic UI token
=== ADVANCED / HIGH IMPACT ===  ← explicit WARNING banner; mutating lint, compression, MCP, flock, limits, edge
```

- **Operator essentials:** settings mirrored in the Sovereign UI or needed on day one (`LOGSEQ_GRAPH_PATH`, LLM URL/model, thermal, map-reduce, `MATRYCA_PLUMBER_LOW_PRIORITY_MODE`, `MATRYCA_UI_TOKEN` / LAN basics).
- **Advanced / high impact:** mutating graph behavior, security surface expansion, diagnostics that leak data, or tuning that can corrupt prompts/cache — prefix section with a clear **do not change unless you understand the risk** banner.

## Per-key comment block (required)

```bash
# <What it does — one sentence>. <src/module.py>
# Default (code): <value when unset/empty in Python>
# Template: <value on the line below for new installs; omit line if same as Default (code)>
# Range / notes: <clamps, security, when to enable>  (optional)
KEY=value
```

- **Default (code)** must match the actual fallback in code (`plumber_config.py`, module `_DEFAULT_*`, or `_map_bool(..., True)`).
- **Template** is the safe 16GB / test-vault profile (often `false` for mutating lint). If Template differs from Default (code), state both.
- Cite the resolving function or file path (e.g. `src/agent/llm_client.py`).

## LLM key precedence (document in header)

- `LLM_BASE_URL` / `LLM_MODEL_NAME` override `MATRYCA_LM_*` when non-empty; Settings UI persists `LLM_*`.

## Verification (same task)

```bash
uv run pytest tests/test_env_example_coverage.py -q --no-cov
```

Fix allowlist only for **reserved** (`MATRYCA_LLM_PROMPT_CACHE_MODE`) or **deprecated** (`MATRYCA_LM_INSTRUCTOR_*`) keys not read by runtime.

## Changelog

If the env change is user-visible, also add a bullet under `CHANGELOG.md` `## [Unreleased]` per [`.cursor/rules/06-auto-changelog.mdc`](06-auto-changelog.mdc).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.