@maind-dev/mcp-bridge 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -119,6 +119,54 @@ Everything these post is gated server-side by Tier-3 consent
119
119
  Thresholds are set at <https://app.maind.dev/settings>; run `sync-config`
120
120
  afterwards on each machine.
121
121
 
122
+ ## Codex: conventions via AGENTS.md
123
+
124
+ Measured on 2026-09-30 over 76 Codex rollouts: the MCP `instructions` never
125
+ reach the model as an instruction (0/76), while the maind block in `AGENTS.md`
126
+ does (74/76). For Codex, `AGENTS.md` is therefore the always-on channel for
127
+ your project conventions — and the bridge keeps that block current instead of
128
+ appending it once and leaving it to age.
129
+
130
+ - **What.** A managed block between `<!-- maind:conventions v1 begin -->` and
131
+ `<!-- maind:conventions v1 end -->`, placed inside the `## maind MCP
132
+ integration` section of `AGENTS.md`. Its lead line reads `Project conventions
133
+ — always-on policies served by maind; updated <date> by mcp-bridge <version>.
134
+ Managed block: …`; below it is the same severity-sorted conventions text the
135
+ Claude Code SessionStart hook injects, from the same local cache
136
+ (`~/.maind/guard/briefing-cache.json`). Capped at 6 000 characters at a line
137
+ boundary; what does not fit is named: `… (N more via get_conventions)`.
138
+ - **When.** `install` fills the block as soon as the pairing yields
139
+ conventions (own report row `preamble:AGENTS.md#conventions`; `skipped (no
140
+ conventions yet)` otherwise; `--dry-run` reads the cache only and reports
141
+ `would insert`). Every Codex session start refreshes it: after the MCP
142
+ handshake, off the hot path, at most once per 12 hours per project. The
143
+ session is recognised as Codex via `MAIND_CLIENT_FAMILY=codex` (the installer
144
+ writes it into `~/.codex/config.toml`) or detected from the client's
145
+ `initialize` frame. The file is rewritten only when the conventions changed —
146
+ a committed `AGENTS.md` does not churn for a date — and Codex has already
147
+ loaded `AGENTS.md` when the bridge starts, so a refresh reaches the *next*
148
+ session. A refresh prints one stderr line: `maind: AGENTS.md conventions
149
+ block refreshed (<n> conventions)`.
150
+ - **Only where the bridge installed it, only inside the repository.** The
151
+ block goes into the closest `AGENTS.md` between the session's working
152
+ directory and the root of its git repository (`git rev-parse
153
+ --show-toplevel`) that exists *and* carries the `## maind MCP integration`
154
+ header. The bridge never walks above the repository root — Codex reads
155
+ `AGENTS.md` from the repository root down to the working directory, so a
156
+ parent repository's file above a nested checkout is not this session's file
157
+ — never creates `AGENTS.md`, and never touches a file without the header.
158
+ Outside a git repository nothing is written. `MAIND_DEBUG=1` prints one line
159
+ when the repository has no such file. `CLAUDE.md`, `.cursorrules`,
160
+ `.windsurfrules` and `copilot-instructions.md` stay as they are — Claude Code
161
+ has the hook, and the readers of the others are not measured.
162
+ - **Opt-out.** `MAIND_NO_AGENTS_MD_REFRESH=1` in the bridge's environment (the
163
+ `env` table of the `maind` entry in `~/.codex/config.toml`). To get rid of
164
+ the block, set the opt-out and delete the two marker lines with everything
165
+ between them; without the opt-out the next refresh re-inserts it.
166
+ - **Measure, don't assume.** `maind sessions scan-conventions --client codex`
167
+ counts the Codex rollouts in which `=== Project Conventions` arrived as an
168
+ instruction.
169
+
122
170
  ## Where things live
123
171
 
124
172
  | Path | Purpose |
@@ -128,6 +176,7 @@ afterwards on each machine.
128
176
  | `%APPDATA%\maind\device-id` (Windows) | Same, on Windows |
129
177
  | `device-id`-sibling file `api-key` | API key returned by approve flow (mode 0600) |
130
178
  | `~/.maind/state.json` | Hook subcommand state: tracked sessions, queued Tier-3 metrics, synced thresholds (mode 0600) |
179
+ | `~/.maind/guard/agents-md-refresh.json` | When the Codex `AGENTS.md` conventions block was last checked, per project (path hashed; mode 0600) |
131
180
 
132
181
  To rebind the bridge to a different account: delete the directory above (or run
133
182
  `--reauth`) and restart the bridge.
@@ -161,6 +210,8 @@ Rarely useful outside maind's own development environments:
161
210
  | `MAIND_CLIENT_FAMILY` | unset | Forwards `X-Maind-Client-Family` (`claude-code`, `codex`, `copilot`, `cursor`, `windsurf`, …) so telemetry tracks the real upstream agent instead of generic `mcp-bridge` |
162
211
  | `MAIND_CLIENT_VERSION` | unset | Forwards optional `X-Maind-Client-Version` marker (max 64 chars) |
163
212
  | `MAIND_FUNCTIONS_ORIGIN` | maind's Supabase Edge Functions URL | Device-flow base URL |
213
+ | `MAIND_NO_AGENTS_MD_REFRESH` | unset | Set to `1` to stop the bridge from refreshing the conventions block in `AGENTS.md` for Codex sessions (see above) |
214
+ | `MAIND_DEBUG` | unset | Set to `1` for one diagnostic stderr line on the otherwise silent AGENTS.md skip (no file with the header inside the repository) |
164
215
  | `XDG_CONFIG_HOME` | `~/.config` (Linux/BSD) | Parent of the `maind/` config dir |
165
216
 
166
217
  ## License