snipara-companion 3.2.27 → 3.2.28

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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  Release notes for `snipara-companion`, newest first.
4
4
 
5
+ ## New In 3.2.28
6
+
7
+ - Adds bounded Outcome Loop retrieval correlation to generated Codex, Claude,
8
+ Cursor, VS Code/Continue, and generic HTTP MCP references through
9
+ `SNIPARA_SESSION_ID` / `X-Snipara-Session-Id`.
10
+ - Prints the active correlation session during `init` and documents the
11
+ explicit `correlation_context.session_id` fallback for MCP clients that
12
+ cannot inject environment-backed headers.
13
+ - Keeps the correlation identifier telemetry-only and project-scoped; it does
14
+ not alter authentication or authorization.
15
+
5
16
  ## New In 3.2.27
6
17
 
7
18
  - Scopes `context-control drift` dirty Git detection to the ProjectContext
package/README.md CHANGED
@@ -49,6 +49,18 @@ Use this after `create-snipara` activation. `create-snipara` remains the
49
49
  canonical engine for first workspace setup; Companion owns the repeatable local
50
50
  continuity loop after that.
51
51
 
52
+ ## Retrieval And Outcome Correlation
53
+
54
+ `snipara-companion init` creates and prints a bounded workspace session ID.
55
+ Export it as `SNIPARA_SESSION_ID` before starting Codex, Claude, Cursor, VS Code,
56
+ Continue, or another HTTP MCP client. Generated configs forward it as
57
+ `X-Snipara-Session-Id`, while canonical execution events use the same Companion
58
+ session automatically. Clients without environment-backed headers can pass the
59
+ same value as `correlation_context.session_id` on retrieval tools.
60
+
61
+ The identifier is opaque, project-scoped telemetry. It does not grant access or
62
+ change authorization, and explicit per-call correlation remains authoritative.
63
+
52
64
  Example output excerpt:
53
65
 
54
66
  ```text
package/dist/index.js CHANGED
@@ -5641,6 +5641,7 @@ Claude Code should apply this workflow automatically for project-specific work;
5641
5641
 
5642
5642
  - Bound Snipara project: \`${projectSlug}\`
5643
5643
  - Hosted MCP endpoint: \`${buildHostedMcpEndpoint(projectSlug)}\`
5644
+ - Keep \`SNIPARA_SESSION_ID\` equal to the active Companion session. Generated MCP configs send it as \`X-Snipara-Session-Id\`; when a client cannot send that header, pass the same value as \`correlation_context.session_id\` on retrieval tools.
5644
5645
  - At the start of substantial work, validate the hosted MCP surface with a tool-oriented call, then use \`snipara_recall\` and a targeted \`snipara_context_query\` before falling back to local search.
5645
5646
  - Do not treat empty MCP resources/templates as an outage. If the tool surface looks incomplete, call \`snipara_help(list_all=true)\` and compare exact tool names.
5646
5647
  - Use \`snipara_context_query\` for docs, business context, architecture notes, runbooks, and source truth. Use \`snipara_get_chunk\` for exact cited sections when references are returned.
@@ -5660,6 +5661,7 @@ function buildSharedWorkflowInstructionBlock(projectSlug, client) {
5660
5661
  This workspace is bound to Snipara project \`${projectSlug}\` for ${formatClientName(client)}. Agents should use Snipara automatically for project-specific context, decisions, and workflow state.
5661
5662
 
5662
5663
  - Hosted MCP endpoint: \`${buildHostedMcpEndpoint(projectSlug)}\`
5664
+ - Keep \`SNIPARA_SESSION_ID\` equal to the active Companion session. Generated MCP configs send it as \`X-Snipara-Session-Id\`; when a client cannot send that header, pass the same value as \`correlation_context.session_id\` on retrieval tools.
5663
5665
  - At the start of substantial work, validate the hosted MCP surface with a tool-oriented call, then use \`snipara_recall\` and a targeted \`snipara_context_query\` before falling back to local search.
5664
5666
  - Do not treat empty MCP resources/templates as an outage. If the tool surface looks incomplete, call \`snipara_help(list_all=true)\` and compare exact tool names.
5665
5667
  - Use \`snipara_context_query\` for docs, business context, architecture notes, runbooks, and source truth. Use \`snipara_get_chunk\` for exact cited sections when references are returned.
@@ -5911,6 +5913,7 @@ function generateCodexConfigString(projectSlug) {
5911
5913
  type = "streamable_http"
5912
5914
  url = "https://api.snipara.com/mcp/${projectSlug}"
5913
5915
  bearer_token_env_var = "SNIPARA_API_KEY"
5916
+ env_http_headers = { "X-Snipara-Session-Id" = "SNIPARA_SESSION_ID" }
5914
5917
  `;
5915
5918
  }
5916
5919
  function generateGenericMcpReferenceString(client, projectSlug) {
@@ -5920,7 +5923,8 @@ function generateGenericMcpReferenceString(client, projectSlug) {
5920
5923
  name: "snipara",
5921
5924
  url: `https://api.snipara.com/mcp/${projectSlug}`,
5922
5925
  headers: {
5923
- "X-API-Key": "${SNIPARA_API_KEY}"
5926
+ "X-API-Key": "${SNIPARA_API_KEY}",
5927
+ "X-Snipara-Session-Id": "${SNIPARA_SESSION_ID}"
5924
5928
  }
5925
5929
  },
5926
5930
  null,
@@ -5935,7 +5939,8 @@ function generateGenericMcpReferenceString(client, projectSlug) {
5935
5939
  type: "http",
5936
5940
  url: `https://api.snipara.com/mcp/${projectSlug}`,
5937
5941
  headers: {
5938
- "X-API-Key": "${SNIPARA_API_KEY}"
5942
+ "X-API-Key": "${SNIPARA_API_KEY}",
5943
+ "X-Snipara-Session-Id": "${SNIPARA_SESSION_ID}"
5939
5944
  }
5940
5945
  }
5941
5946
  }
@@ -5995,6 +6000,7 @@ async function callSniparaTool(name: string, args: Record<string, unknown>): Pro
5995
6000
  headers: {
5996
6001
  "Content-Type": "application/json",
5997
6002
  "X-API-Key": SNIPARA_API_KEY,
6003
+ "X-Snipara-Session-Id": process.env.SNIPARA_SESSION_ID || "",
5998
6004
  },
5999
6005
  body: JSON.stringify({
6000
6006
  jsonrpc: "2.0",
@@ -6561,12 +6567,13 @@ async function initCommand(options) {
6561
6567
  existingProjectId: existingConfig.projectId,
6562
6568
  selectedProject
6563
6569
  });
6570
+ const sessionId = `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
6564
6571
  saveConfig(
6565
6572
  {
6566
6573
  apiKey,
6567
6574
  apiUrl: existingConfig.apiUrl,
6568
6575
  projectId: projectIdentifier,
6569
- sessionId: `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
6576
+ sessionId,
6570
6577
  client: selectedClient
6571
6578
  },
6572
6579
  { cwd: projectDir, scope: "workspace" }
@@ -6688,6 +6695,10 @@ async function initCommand(options) {
6688
6695
  console.log(`Companion config: ${configPaths.companion}`);
6689
6696
  console.log(`Selected project: ${formatProjectChoice(selectedProject)}`);
6690
6697
  console.log(`Selected client: ${formatClientName(selectedClient)}`);
6698
+ console.log(`Correlation session: ${sessionId}`);
6699
+ console.log(
6700
+ "Export SNIPARA_SESSION_ID with this value before starting the MCP client so served context and execution outcomes share one bounded session."
6701
+ );
6691
6702
  if (options.withHooks) {
6692
6703
  console.log("\nNext steps:");
6693
6704
  if (hookClient === "cursor") {
@@ -821,6 +821,15 @@ Mistral generates MCP-first files (`MISTRAL.md`, Vibe config, Le Chat connector
821
821
  reference, and LangChain `ChatMistralAI.bindTools` snippets); Mistral request
822
822
  hooks are model request hooks, not local agent lifecycle hooks.
823
823
 
824
+ All generated HTTP/SSE references include a bounded correlation header sourced
825
+ from `SNIPARA_SESSION_ID`. Set it to the session printed by `init` before
826
+ starting Codex, Claude, Cursor, VS Code/Continue, GLM, or another generic MCP
827
+ host. The hosted server uses the header only for project-scoped retrieval
828
+ telemetry and ignores invalid values. If the host cannot inject environment
829
+ headers, pass the same value as `correlation_context.session_id` on
830
+ `snipara_context_query`, `snipara_recall`, `snipara_search`, `snipara_ask`, and
831
+ `snipara_get_chunk`.
832
+
824
833
  OpenClaw hooks remain separate:
825
834
 
826
835
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snipara-companion",
3
- "version": "3.2.27",
3
+ "version": "3.2.28",
4
4
  "description": "Local-first CLI that asks your repo what breaks before an AI coding agent edits it.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {