@maind-dev/mcp-bridge 0.88.0 → 0.89.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
@@ -158,6 +158,8 @@ here; the standalone `maind-hook` binary they came from is retired (ADR-245).
158
158
  | `on-session-start` | `SessionStart` | Open a tracked session for the flat Tier-3 metrics |
159
159
  | `on-session-briefing` | `SessionStart` | Add the session briefing and the project conventions to the session context (see below; never blocks) |
160
160
  | `on-tool-use` | `PreToolUse` | Count tool calls; warn on stderr when token usage crosses your handoff thresholds (ADR-039) |
161
+ | `on-prompt-context` | `UserPromptSubmit` | Context at the prompt: matching project conventions and the file:line of symbols the prompt names — matched locally (see below) |
162
+ | `on-read-context` | `PreToolUse` (`Read`) | Context at a file read: who calls the file's symbols from other files, who imports it, and an outline when the Read covers only part of it |
161
163
  | `on-session-end` | `Stop` | Post session communication analytics; close and flush the tracked session |
162
164
  | `sync-config` | — | Pull your context thresholds from the server |
163
165
  | `flush` | — | Post queued Tier-3 metrics now |
@@ -168,6 +170,38 @@ Everything these post is gated server-side by Tier-3 consent
168
170
  Thresholds are set at <https://app.maind.dev/settings>; run `sync-config`
169
171
  afterwards on each machine.
170
172
 
173
+ ### Context at the moment (since 0.89.0)
174
+
175
+ Two hooks deliver context when it matters instead of only at session start
176
+ (ADR-363). Each is consented separately at `install`, and both run entirely on
177
+ this machine — no network call, nothing uploaded, nothing stored but an empty
178
+ once-per-session marker file per delivered item under `~/.maind/context/`.
179
+
180
+ - **`on-prompt-context`** reads the prompt text **locally** and matches it
181
+ against the project conventions MAIND already cached
182
+ (`.maind/conventions-cache.json` in the repo, or the session-briefing cache
183
+ `~/.maind/guard/briefing-cache.json`) and against symbol names in the repo's
184
+ code index (`.maind/code-index.sqlite`). It adds at most ~2,000 characters:
185
+ conventions whose terms the prompt uses (full text via `get_conventions`),
186
+ and where the symbols it names are defined. Slash commands, generated turns
187
+ and compaction summaries get nothing.
188
+ - **`on-read-context`** reads the **path** of the file the agent is about to
189
+ read — never its contents — and adds at most ~1,500 characters from the
190
+ index: which symbols other files call and from where (the import-resolved
191
+ graph), which files import it, and, for a partial Read, an outline of the
192
+ whole file. A full Read of a file nobody else uses gets nothing.
193
+
194
+ Both stay silent whenever they cannot be sure: no index, an index older than
195
+ the file (`mtime` + size, the indexer's own rule), an interrupted index run, an
196
+ older index schema, any error. Every delivery starts with
197
+ `[maind context · prompt]` or `[maind context · read]`, so a transcript scan can
198
+ count what arrived. The index itself is built once by `codebase_index` (or
199
+ `maind index`) and kept fresh by the `on-index-refresh` Stop hook; `doctor`
200
+ says when a wired context hook has no index or no SQLite backend to read it.
201
+ Under Cursor, which also runs the hooks in `~/.claude/settings.json`, both
202
+ print nothing (same detection as the session-start hook); a Cursor equivalent
203
+ is follow-up work.
204
+
171
205
  ## Claude Code: conventions at session start
172
206
 
173
207
  Claude Code cuts the MCP `instructions` after about 2,000 characters
@@ -265,6 +299,7 @@ appending it once and leaving it to age.
265
299
  | `~/.maind/state.json` | Hook subcommand state: tracked sessions, queued Tier-3 metrics, synced thresholds (mode 0600) |
266
300
  | `~/.maind/guard/agents-md-refresh.json` | When the Codex `AGENTS.md` conventions block was last checked, per project (path hashed; mode 0600) |
267
301
  | `~/.maind/guard/briefing-cache.json` | The last session briefing + conventions, for the session-start hook and the `AGENTS.md` block (12 h; mode 0600) |
302
+ | `~/.maind/context/<session>/` | Once-per-session markers of the context hooks: one empty file per delivered item, named by a hash; swept after 7 days |
268
303
 
269
304
  To rebind the bridge to a different account: delete the directory above (or run
270
305
  `--reauth`) and restart the bridge.