## Trap Doors

- `context-key-matrix.ts` — INVARIANT: RunContext keys may contain dots. BREAKS: edge-reader rows truncate nested keys and hide real consumers. ENFORCE: `data-flow-trace-a.test.js` dotted-key analyzer contract. PATTERN_SHAPE: `condition="context.<key.with.dots>=<value>"`; INVARIANT: supplemental `ATTRACTOR_CTX` scans must preserve dotted keys in tool and prompt text. BREAKS: writer/reader matrix drops nested keys emitted outside `context_on_*`. ENFORCE: `plumbus-frame-analyzer-contract.test.js` dotted-key contract. PATTERN_SHAPE: `ATTRACTOR_CTX:<key.with.dots>=...|${ATTRACTOR_CTX_<key.with.dots>}`; INVARIANT: edge reader extraction must scan every `&&` context clause, including `!=`. BREAKS: later-clause readers vanish from the matrix. ENFORCE: `plumbus-frame-analyzer-contract.test.js` multi-clause contract. PATTERN_SHAPE: `condition="context.<k>=... && context.<k2>!=..."`.
- `diamond-routing.ts` — INVARIANT: Diamond conditions must parse dotted RunContext keys as one key. BREAKS: routing cells disappear for nested-key gates. ENFORCE: `data-flow-trace-a.test.js` dotted-key analyzer contract. PATTERN_SHAPE: `^context\\.[\\w.]+=(.+)$`; INVARIANT: enumeration must union edge-expected values with observed writer values per key. BREAKS: edge-only branch states vanish from covered/stuck cells. ENFORCE: `data-flow-trace-a.test.js` edge-only-value contract. PATTERN_SHAPE: `keySetsForEdges(...)` deriving values from observed map without `edge.condition.expectedValue`; INVARIANT: edge routing must evaluate every `&&` context clause and honor `!=`. BREAKS: multi-clause routes disappear or forbidden states look routable. ENFORCE: `plumbus-frame-analyzer-contract.test.js` multi-clause contract. PATTERN_SHAPE: `condition="context.<k>=... && context.<k2>!=..."`.

## Module Export Catalog (R-CMD B-AUDIT)

Per-module entry points exported from `extension/src/lib/`. Each entry pins a one-line invariant; deeper invariants for the principal exports live in the trap-door entries above.

- `context-key-matrix.ts` → `buildContextKeyMatrix` — analyzer pass: cross-frame RunContext key writer/reader matrix (see trap door above).
- `diamond-routing.ts` → `buildDiamondRouting` — analyzer pass: diamond-condition routing matrix (see trap door above).
- `cycles.ts` → `buildCycles` — analyzer pass: strongly-connected components in the attractor graph; trivial single-node cycles excluded.
- `engine-keys-registry.ts` → `loadEngineKeysRegistry`, `isEngineWritten`, `isUserWritten` — typed registry loader at `extension/data/engine-injected-keys.json` is the source of truth for engine-vs-user RunContext-key classification across `plumbus-frame-analyzer`. ENFORCE: `extension/tests/engine-keys-registry.test.js`.
- `is-record.ts` → `isRecord` — canonical `value is Record<string, unknown>` boundary type-guard for parsed JSON.
- `findings.ts` (shared analyzer types) → `Finding`, `FrameId`, `Severity`, `maxSeverity`, `structuralEqual`, `selectFix` — `Severity` is `'P0'|'P1'|'P2'|'P3'|'P4'`; `maxSeverity` returns the strictest (lowest-numbered); `structuralEqual` dedupes findings by semantic identity (file + rule + location), not object identity; `selectFix` picks the highest-priority candidate fix from a list.
- `generative-audit.ts` → `shouldRunGenerativeAudit` — kill-switch helper that returns `false` whenever `PLUMBUS_GENERATIVE_AUDIT === 'off'`, honouring the `pickle-rick-claude/CLAUDE.md` Override 6 environment variable.
- `linear-comment.ts` → `emitCrossTicketRegressionLinearComment` — emits Linear comments via the configured `PICKLE_LINEAR_COMMAND` parsed argv (no shell). No-op when the command is absent. ENFORCE: `extension/tests/linear-integration.test.js`.
- `monitor-mode.ts` → `respawnMonitorWindowForMode` — phase-boundary respawn always passes the inferred monitor mode (`pickle|meeseeks|council|refinement|szechuan-sauce|anatomy-park`); never defaults to `'pickle'` for microverse phases. ENFORCE: `extension/tests/monitor-mode-resilience.test.js`.
