@mnemonik/shared 6.2.2 → 6.2.4

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.
@@ -4,14 +4,8 @@
4
4
  * This is the SINGLE SOURCE OF TRUTH for MCP instructions.
5
5
  * Shared instruction content imported by the server.
6
6
  *
7
- * Version: 2.103
8
- * Updated: 2026-07-11
9
- *
10
- * v2.103 — Removed the model-facing initialize imperative. MCP initialize
11
- * runs before actor/project/host orchestration can be classified, so
12
- * it cannot safely own bootstrap timing. Config-B/C bootstrap belongs
13
- * to hooks/proxy; the project-resolved response path owns Config-A.
14
- * Returning an empty string makes the server omit `instructions`.
7
+ * Version: 2.102
8
+ * Updated: 2026-06-29
15
9
  *
16
10
  * v2.102 — Strengthened the self-bootstrap trigger to a compelling imperative.
17
11
  * The v2.101 phrasing ("At the start of a session, unless ... call ...")
@@ -88,15 +82,24 @@
88
82
  *
89
83
  * Token-optimised rewrite (superseded by later instruction rewrites).
90
84
  */
91
- /** MCP initialize intentionally carries no model-facing orchestration. */
85
+ /**
86
+ * Get MCP instructions, respecting MNEMONIK_INSTRUCTIONS_ENABLED env var.
87
+ * Set MNEMONIK_INSTRUCTIONS_ENABLED=false to disable for testing.
88
+ *
89
+ * Reads env through globalThis so this package compiles cleanly without
90
+ * `@types/node` (shared package's tsconfig doesn't include it, which made
91
+ * IDEs flag `process` as an unknown global even though the workspace
92
+ * tsc resolution found it).
93
+ */
92
94
  export declare function getMcpInstructions(): string;
93
95
  /**
94
96
  * Raw instructions content (always returns the content, ignores env var).
95
97
  * Use getMcpInstructions() for production code.
96
98
  */
97
- export declare const MCP_INSTRUCTIONS_RAW = "";
99
+ export declare const MCP_INSTRUCTIONS_RAW = "If your context does not contain a block beginning \"Mnemonik project context (cached\", call session_bootstrap before replying or taking any other action \u2014 e.g. session_bootstrap({ cwd: \"/absolute/path/to/project\" }), where cwd is the real absolute path to the project root you are working in (required; the call fails without it \u2014 substitute your actual path, not the example). It loads this project's prior decisions, open tasks, and policies. If that block is already present, do not call session_bootstrap; the context is already loaded.";
98
100
  /**
99
101
  * Default export for convenience.
102
+ * Note: This respects the MNEMONIK_INSTRUCTIONS_ENABLED env var.
100
103
  */
101
104
  export declare const MCP_INSTRUCTIONS: string;
102
105
  //# sourceMappingURL=instructions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAIH,0EAA0E;AAC1E,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,KAAuB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAuB,CAAC"}
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+iBAAuB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAuB,CAAC"}
@@ -4,14 +4,8 @@
4
4
  * This is the SINGLE SOURCE OF TRUTH for MCP instructions.
5
5
  * Shared instruction content imported by the server.
6
6
  *
7
- * Version: 2.103
8
- * Updated: 2026-07-11
9
- *
10
- * v2.103 — Removed the model-facing initialize imperative. MCP initialize
11
- * runs before actor/project/host orchestration can be classified, so
12
- * it cannot safely own bootstrap timing. Config-B/C bootstrap belongs
13
- * to hooks/proxy; the project-resolved response path owns Config-A.
14
- * Returning an empty string makes the server omit `instructions`.
7
+ * Version: 2.102
8
+ * Updated: 2026-06-29
15
9
  *
16
10
  * v2.102 — Strengthened the self-bootstrap trigger to a compelling imperative.
17
11
  * The v2.101 phrasing ("At the start of a session, unless ... call ...")
@@ -88,9 +82,22 @@
88
82
  *
89
83
  * Token-optimised rewrite (superseded by later instruction rewrites).
90
84
  */
91
- const INSTRUCTIONS_CONTENT = '';
92
- /** MCP initialize intentionally carries no model-facing orchestration. */
85
+ const INSTRUCTIONS_CONTENT = `If your context does not contain a block beginning "Mnemonik project context (cached", call session_bootstrap before replying or taking any other action — e.g. session_bootstrap({ cwd: "/absolute/path/to/project" }), where cwd is the real absolute path to the project root you are working in (required; the call fails without it — substitute your actual path, not the example). It loads this project's prior decisions, open tasks, and policies. If that block is already present, do not call session_bootstrap; the context is already loaded.`;
86
+ /**
87
+ * Get MCP instructions, respecting MNEMONIK_INSTRUCTIONS_ENABLED env var.
88
+ * Set MNEMONIK_INSTRUCTIONS_ENABLED=false to disable for testing.
89
+ *
90
+ * Reads env through globalThis so this package compiles cleanly without
91
+ * `@types/node` (shared package's tsconfig doesn't include it, which made
92
+ * IDEs flag `process` as an unknown global even though the workspace
93
+ * tsc resolution found it).
94
+ */
93
95
  export function getMcpInstructions() {
96
+ const env = globalThis.process
97
+ ?.env;
98
+ if (env?.MNEMONIK_INSTRUCTIONS_ENABLED === 'false') {
99
+ return '';
100
+ }
94
101
  return INSTRUCTIONS_CONTENT;
95
102
  }
96
103
  /**
@@ -100,6 +107,7 @@ export function getMcpInstructions() {
100
107
  export const MCP_INSTRUCTIONS_RAW = INSTRUCTIONS_CONTENT;
101
108
  /**
102
109
  * Default export for convenience.
110
+ * Note: This respects the MNEMONIK_INSTRUCTIONS_ENABLED env var.
103
111
  */
104
112
  export const MCP_INSTRUCTIONS = getMcpInstructions();
105
113
  //# sourceMappingURL=instructions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAEH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,0EAA0E;AAC1E,MAAM,UAAU,kBAAkB;IAChC,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,MAAM,oBAAoB,GAAG,8hBAA8hB,CAAC;AAE5jB;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,GAAG,GAAI,UAAyE,CAAC,OAAO;QAC5F,EAAE,GAAG,CAAC;IACR,IAAI,GAAG,EAAE,6BAA6B,KAAK,OAAO,EAAE,CAAC;QACnD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnemonik/shared",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "description": "Shared constants and utilities for Mnemonik packages",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -4,14 +4,8 @@
4
4
  * This is the SINGLE SOURCE OF TRUTH for MCP instructions.
5
5
  * Shared instruction content imported by the server.
6
6
  *
7
- * Version: 2.103
8
- * Updated: 2026-07-11
9
- *
10
- * v2.103 — Removed the model-facing initialize imperative. MCP initialize
11
- * runs before actor/project/host orchestration can be classified, so
12
- * it cannot safely own bootstrap timing. Config-B/C bootstrap belongs
13
- * to hooks/proxy; the project-resolved response path owns Config-A.
14
- * Returning an empty string makes the server omit `instructions`.
7
+ * Version: 2.102
8
+ * Updated: 2026-06-29
15
9
  *
16
10
  * v2.102 — Strengthened the self-bootstrap trigger to a compelling imperative.
17
11
  * The v2.101 phrasing ("At the start of a session, unless ... call ...")
@@ -89,10 +83,23 @@
89
83
  * Token-optimised rewrite (superseded by later instruction rewrites).
90
84
  */
91
85
 
92
- const INSTRUCTIONS_CONTENT = '';
86
+ const INSTRUCTIONS_CONTENT = `If your context does not contain a block beginning "Mnemonik project context (cached", call session_bootstrap before replying or taking any other action — e.g. session_bootstrap({ cwd: "/absolute/path/to/project" }), where cwd is the real absolute path to the project root you are working in (required; the call fails without it — substitute your actual path, not the example). It loads this project's prior decisions, open tasks, and policies. If that block is already present, do not call session_bootstrap; the context is already loaded.`;
93
87
 
94
- /** MCP initialize intentionally carries no model-facing orchestration. */
88
+ /**
89
+ * Get MCP instructions, respecting MNEMONIK_INSTRUCTIONS_ENABLED env var.
90
+ * Set MNEMONIK_INSTRUCTIONS_ENABLED=false to disable for testing.
91
+ *
92
+ * Reads env through globalThis so this package compiles cleanly without
93
+ * `@types/node` (shared package's tsconfig doesn't include it, which made
94
+ * IDEs flag `process` as an unknown global even though the workspace
95
+ * tsc resolution found it).
96
+ */
95
97
  export function getMcpInstructions(): string {
98
+ const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process
99
+ ?.env;
100
+ if (env?.MNEMONIK_INSTRUCTIONS_ENABLED === 'false') {
101
+ return '';
102
+ }
96
103
  return INSTRUCTIONS_CONTENT;
97
104
  }
98
105
 
@@ -104,5 +111,6 @@ export const MCP_INSTRUCTIONS_RAW = INSTRUCTIONS_CONTENT;
104
111
 
105
112
  /**
106
113
  * Default export for convenience.
114
+ * Note: This respects the MNEMONIK_INSTRUCTIONS_ENABLED env var.
107
115
  */
108
116
  export const MCP_INSTRUCTIONS = getMcpInstructions();