@j0hanz/cortex-mcp 0.1.2 → 0.1.3

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.
@@ -1,49 +1,49 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="1.2" stroke-linecap="round"
2
- stroke-linejoin="round" role="img" aria-label="brain">
3
- <style>
4
- path,
5
- circle,
6
- rect,
7
- line,
8
- polyline,
9
- polygon {
10
- stroke: #000000;
11
- }
12
-
13
- @media (prefers-color-scheme: dark) {
14
-
15
- path,
16
- circle,
17
- rect,
18
- line,
19
- polyline,
20
- polygon {
21
- stroke: #FFFFFF;
22
- }
23
- }
24
- </style>
25
-
26
- <g>
27
- <!-- Outer silhouette -->
28
- <path d="M9 4.2c-2.2 0-4 1.7-4 4v1.1c-1 .6-1.7 1.7-1.7 3 0 1.6 1 2.9 2.4 3.3v.9c0 2.2 1.8 4 4 4h2.3" />
29
- <path d="M15 4.2c2.2 0 4 1.7 4 4v1.1c1 .6 1.7 1.7 1.7 3 0 1.6-1 2.9-2.4 3.3v.9c0 2.2-1.8 4-4 4H12" />
30
-
31
- ```
32
- <!-- Midline split (subtle) -->
33
- <path d="M12 5.1v15.1" />
34
-
35
- <!-- Left hemisphere folds -->
36
- <path d="M8.8 7c-1.2.1-2.2 1.1-2.2 2.4" />
37
- <path d="M9.3 10.1c-1.4 0-2.6 1.1-2.6 2.6" />
38
- <path d="M9.6 13.4c-1.2.2-2.1 1.2-2.1 2.5" />
39
- <path d="M10.3 16.4c-1.1 0-2 .7-2.4 1.7" />
40
-
41
- <!-- Right hemisphere folds -->
42
- <path d="M15.2 7c1.2.1 2.2 1.1 2.2 2.4" />
43
- <path d="M14.7 10.1c1.4 0 2.6 1.1 2.6 2.6" />
44
- <path d="M14.4 13.4c1.2.2 2.1 1.2 2.1 2.5" />
45
- <path d="M13.7 16.4c1.1 0 2 .7 2.4 1.7" />
46
- ```
47
-
48
- </g>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="1.2" stroke-linecap="round"
2
+ stroke-linejoin="round" role="img" aria-label="brain">
3
+ <style>
4
+ path,
5
+ circle,
6
+ rect,
7
+ line,
8
+ polyline,
9
+ polygon {
10
+ stroke: #000000;
11
+ }
12
+
13
+ @media (prefers-color-scheme: dark) {
14
+
15
+ path,
16
+ circle,
17
+ rect,
18
+ line,
19
+ polyline,
20
+ polygon {
21
+ stroke: #FFFFFF;
22
+ }
23
+ }
24
+ </style>
25
+
26
+ <g>
27
+ <!-- Outer silhouette -->
28
+ <path d="M9 4.2c-2.2 0-4 1.7-4 4v1.1c-1 .6-1.7 1.7-1.7 3 0 1.6 1 2.9 2.4 3.3v.9c0 2.2 1.8 4 4 4h2.3" />
29
+ <path d="M15 4.2c2.2 0 4 1.7 4 4v1.1c1 .6 1.7 1.7 1.7 3 0 1.6-1 2.9-2.4 3.3v.9c0 2.2-1.8 4-4 4H12" />
30
+
31
+ ```
32
+ <!-- Midline split (subtle) -->
33
+ <path d="M12 5.1v15.1" />
34
+
35
+ <!-- Left hemisphere folds -->
36
+ <path d="M8.8 7c-1.2.1-2.2 1.1-2.2 2.4" />
37
+ <path d="M9.3 10.1c-1.4 0-2.6 1.1-2.6 2.6" />
38
+ <path d="M9.6 13.4c-1.2.2-2.1 1.2-2.1 2.5" />
39
+ <path d="M10.3 16.4c-1.1 0-2 .7-2.4 1.7" />
40
+
41
+ <!-- Right hemisphere folds -->
42
+ <path d="M15.2 7c1.2.1 2.2 1.1 2.2 2.4" />
43
+ <path d="M14.7 10.1c1.4 0 2.6 1.1 2.6 2.6" />
44
+ <path d="M14.4 13.4c1.2.2 2.1 1.2 2.1 2.5" />
45
+ <path d="M13.7 16.4c1.1 0 2 .7 2.4 1.7" />
46
+ ```
47
+
48
+ </g>
49
49
  </svg>
package/dist/index.js CHANGED
File without changes
@@ -1,131 +1,131 @@
1
- # CORTEX-MCP INSTRUCTIONS
2
-
3
- These instructions are available as a resource (internal://instructions) or prompt (get-help). Load them when unsure about tool usage.
4
-
5
- ---
6
-
7
- ## CORE CAPABILITY
8
-
9
- - Domain: Multi-level reasoning engine that decomposes queries into structured thought chains at configurable depth levels (basic, normal, high).
10
- - Primary Resources: Reasoning sessions (in-memory, 30-minute TTL), thought chains, progress notifications.
11
- - Tools: `reasoning.think` (WRITE — creates/extends sessions with generated thoughts).
12
-
13
- ---
14
-
15
- ## PROMPTS
16
-
17
- - `get-help`: Returns these instructions for quick recall.
18
- - `reasoning.basic`: Prepare a basic-depth reasoning request (3–5 thoughts).
19
- - `reasoning.normal`: Prepare a normal-depth reasoning request (6–10 thoughts).
20
- - `reasoning.high`: Prepare a high-depth reasoning request (15–25 thoughts).
21
- - `reasoning.continue`: Continue an existing reasoning session with a follow-up query.
22
-
23
- ---
24
-
25
- ## RESOURCES & RESOURCE LINKS
26
-
27
- - `internal://instructions`: This document.
28
- - `reasoning://sessions`: List all active reasoning sessions with metadata (JSON).
29
- - `reasoning://sessions/{sessionId}`: Inspect a specific session's thoughts and metadata (JSON). Supports auto-completion on `sessionId`.
30
-
31
- ### Resource Subscriptions
32
-
33
- - The server supports `resources/subscribe` for real-time change notifications on individual resources.
34
- - Subscribe to `reasoning://sessions/{sessionId}` to receive `notifications/resources/updated` when thoughts are added or revised.
35
- - Use subscriptions to monitor session progress without polling.
36
-
37
- ---
38
-
39
- ## PROGRESS & TASKS
40
-
41
- - Include `_meta.progressToken` in requests to receive `notifications/progress` updates during reasoning.
42
- - Task-augmented tool calls are supported for `reasoning.think`:
43
- - `execution.taskSupport: "optional"` — invoke normally or as a task.
44
- - Send `tools/call` with `task` to get a task id.
45
- - Poll `tasks/get` and fetch results via `tasks/result`.
46
- - Use `tasks/cancel` to abort a running task.
47
- - For `high` level, progress is emitted every 2 steps to reduce noise; `basic` and `normal` emit after every step.
48
-
49
- ---
50
-
51
- ## THE "GOLDEN PATH" WORKFLOWS (CRITICAL)
52
-
53
- ### WORKFLOW A: Sequential Reasoning
54
-
55
- 1. Call `reasoning.think` with `{ query: "...", level: "basic" | "normal" | "high" }`.
56
- 2. Read `result.thoughts` for the accumulated reasoning chain (each call appends at most one new thought).
57
- 3. Repeat calls with the same `sessionId` until `result.totalThoughts` is reached.
58
- NOTE: Choose level based on query complexity — `basic` for straightforward questions, `high` for multi-faceted analysis.
59
-
60
- ### WORKFLOW B: Multi-Turn Reasoning (Session Continuation)
61
-
62
- 1. Call `reasoning.think` with `{ query: "initial question", level: "normal" }` — note the returned `sessionId`.
63
- 2. Call `reasoning.think` with `{ query: "follow-up", level: "normal", sessionId: "<id>" }` to append the next thought.
64
- 3. Repeat until `result.totalThoughts` is reached, then read `reasoning://sessions/{sessionId}` for the full chain.
65
- NOTE: The `level` MUST match the original session level. Mismatches return `E_SESSION_LEVEL_MISMATCH`.
66
-
67
- ### WORKFLOW C: Controlled Depth Reasoning
68
-
69
- 1. Call `reasoning.think` with `{ query: "...", level: "normal", targetThoughts: 8 }` to set the session's planned step count.
70
- 2. Repeat calls with the returned `sessionId` until `result.totalThoughts` is reached.
71
- NOTE: `targetThoughts` must fall within the level range (basic: 3–5, normal: 6–10, high: 15–25). Out-of-range values return `E_INVALID_THOUGHT_COUNT`.
72
-
73
- ### WORKFLOW D: Async Task Execution
74
-
75
- 1. Call `reasoning.think` as a task (send `tools/call` with `task` field) for long-running `high`-level reasoning.
76
- 2. Poll `tasks/get` until status is `completed` or `failed`.
77
- 3. Retrieve the result via `tasks/result`.
78
- 4. Use `tasks/cancel` to abort if needed.
79
-
80
- ---
81
-
82
- ## TOOL NUANCES & GOTCHAS
83
-
84
- `reasoning.think`
85
-
86
- - Purpose: Generate a multi-step reasoning chain for a given query at a specified depth level.
87
- - Input:
88
- - `query` (string, 1–10,000 chars): The question or problem to reason about.
89
- - `level` (enum: `basic` | `normal` | `high`): Controls reasoning depth and token budget.
90
- - `targetThoughts` (int, 1–25, optional): Override automatic step count. Must fit within the level range.
91
- - `sessionId` (string, 1–128 chars, optional): Continue an existing session. Level must match.
92
- - Output: `{ ok, result: { sessionId, level, thoughts[], generatedThoughts, requestedThoughts, totalThoughts, tokenBudget, tokensUsed, ttlMs, expiresAt, createdAt, updatedAt, summary } }`
93
- - Side effects: Creates or modifies an in-memory session. Sessions expire after 30 minutes of inactivity.
94
- - Gotcha: Each call appends at most one thought. When continuing a session, `generatedThoughts` reflects only the newly added thought (0 or 1), not the cumulative total.
95
- - Gotcha: `requestedThoughts` is the effective requested count for this run: it equals `targetThoughts` when provided, otherwise `totalThoughts`.
96
- - Gotcha: Token counting is approximate (UTF-8 byte length ÷ 4), not true tokenization.
97
- - Gotcha: Without `targetThoughts`, the planned step count (`totalThoughts`) is determined by a heuristic based on query length and structural complexity (punctuation markers, keywords like "compare", "analyse", "trade-off").
98
- - Limits: Level ranges — basic: 3–5 thoughts (2K token budget), normal: 6–10 (8K), high: 15–25 (32K).
99
-
100
- ---
101
-
102
- ## CROSS-FEATURE RELATIONSHIPS
103
-
104
- - Use `reasoning.basic` / `reasoning.normal` / `reasoning.high` prompts to construct a correctly parameterized `reasoning.think` call.
105
- - Use `reasoning.continue` prompt to construct a session-continuation call — it enforces `sessionId` and `level` pairing.
106
- - After calling `reasoning.think`, read `reasoning://sessions/{sessionId}` to retrieve the full session state including all accumulated thoughts.
107
- - Use `reasoning://sessions` to discover active sessions before attempting continuation — avoids `E_SESSION_NOT_FOUND`.
108
-
109
- ---
110
-
111
- ## CONSTRAINTS & LIMITATIONS
112
-
113
- - Sessions are in-memory — all data is lost on process restart.
114
- - Session TTL: 30 minutes from last update. Expired sessions cannot be recovered.
115
- - Maximum query length: 10,000 characters.
116
- - Token budget enforcement is approximate (character-based proxy, not true tokenization).
117
- - stdio transport only — no HTTP endpoint available.
118
- - Reasoning steps are structural decompositions, not LLM-generated content.
119
- - `targetThoughts` must be an integer within the level's min/max range.
120
-
121
- ---
122
-
123
- ## ERROR HANDLING STRATEGY
124
-
125
- - `E_SESSION_NOT_FOUND`: Session expired or never existed. Call `reasoning://sessions` to list active sessions, or start a new session without `sessionId`.
126
- - `E_SESSION_LEVEL_MISMATCH`: Requested level differs from the existing session. Use the same level as the original session, or start a new session.
127
- - `E_INVALID_THOUGHT_COUNT`: `targetThoughts` is outside the level range. Check ranges: basic (3–5), normal (6–10), high (15–25).
128
- - `E_ABORTED`: Reasoning was cancelled via abort signal or task cancellation. Retry with a new request if needed.
129
- - `E_REASONING`: Unexpected engine error. Check the error `message` field for details and retry.
130
-
131
- ---
1
+ # CORTEX-MCP INSTRUCTIONS
2
+
3
+ These instructions are available as a resource (internal://instructions) or prompt (get-help). Load them when unsure about tool usage.
4
+
5
+ ---
6
+
7
+ ## CORE CAPABILITY
8
+
9
+ - Domain: Multi-level reasoning engine that decomposes queries into structured thought chains at configurable depth levels (basic, normal, high).
10
+ - Primary Resources: Reasoning sessions (in-memory, 30-minute TTL), thought chains, progress notifications.
11
+ - Tools: `reasoning.think` (WRITE — creates/extends sessions with generated thoughts).
12
+
13
+ ---
14
+
15
+ ## PROMPTS
16
+
17
+ - `get-help`: Returns these instructions for quick recall.
18
+ - `reasoning.basic`: Prepare a basic-depth reasoning request (3–5 thoughts).
19
+ - `reasoning.normal`: Prepare a normal-depth reasoning request (6–10 thoughts).
20
+ - `reasoning.high`: Prepare a high-depth reasoning request (15–25 thoughts).
21
+ - `reasoning.continue`: Continue an existing reasoning session with a follow-up query.
22
+
23
+ ---
24
+
25
+ ## RESOURCES & RESOURCE LINKS
26
+
27
+ - `internal://instructions`: This document.
28
+ - `reasoning://sessions`: List all active reasoning sessions with metadata (JSON).
29
+ - `reasoning://sessions/{sessionId}`: Inspect a specific session's thoughts and metadata (JSON). Supports auto-completion on `sessionId`.
30
+
31
+ ### Resource Subscriptions
32
+
33
+ - The server supports `resources/subscribe` for real-time change notifications on individual resources.
34
+ - Subscribe to `reasoning://sessions/{sessionId}` to receive `notifications/resources/updated` when thoughts are added or revised.
35
+ - Use subscriptions to monitor session progress without polling.
36
+
37
+ ---
38
+
39
+ ## PROGRESS & TASKS
40
+
41
+ - Include `_meta.progressToken` in requests to receive `notifications/progress` updates during reasoning.
42
+ - Task-augmented tool calls are supported for `reasoning.think`:
43
+ - `execution.taskSupport: "optional"` — invoke normally or as a task.
44
+ - Send `tools/call` with `task` to get a task id.
45
+ - Poll `tasks/get` and fetch results via `tasks/result`.
46
+ - Use `tasks/cancel` to abort a running task.
47
+ - For `high` level, progress is emitted every 2 steps to reduce noise; `basic` and `normal` emit after every step.
48
+
49
+ ---
50
+
51
+ ## THE "GOLDEN PATH" WORKFLOWS (CRITICAL)
52
+
53
+ ### WORKFLOW A: Sequential Reasoning
54
+
55
+ 1. Call `reasoning.think` with `{ query: "...", level: "basic" | "normal" | "high" }`.
56
+ 2. Read `result.thoughts` for the accumulated reasoning chain (each call appends at most one new thought).
57
+ 3. Repeat calls with the same `sessionId` until `result.totalThoughts` is reached.
58
+ NOTE: Choose level based on query complexity — `basic` for straightforward questions, `high` for multi-faceted analysis.
59
+
60
+ ### WORKFLOW B: Multi-Turn Reasoning (Session Continuation)
61
+
62
+ 1. Call `reasoning.think` with `{ query: "initial question", level: "normal" }` — note the returned `sessionId`.
63
+ 2. Call `reasoning.think` with `{ query: "follow-up", level: "normal", sessionId: "<id>" }` to append the next thought.
64
+ 3. Repeat until `result.totalThoughts` is reached, then read `reasoning://sessions/{sessionId}` for the full chain.
65
+ NOTE: The `level` MUST match the original session level. Mismatches return `E_SESSION_LEVEL_MISMATCH`.
66
+
67
+ ### WORKFLOW C: Controlled Depth Reasoning
68
+
69
+ 1. Call `reasoning.think` with `{ query: "...", level: "normal", targetThoughts: 8 }` to set the session's planned step count.
70
+ 2. Repeat calls with the returned `sessionId` until `result.totalThoughts` is reached.
71
+ NOTE: `targetThoughts` must fall within the level range (basic: 3–5, normal: 6–10, high: 15–25). Out-of-range values return `E_INVALID_THOUGHT_COUNT`.
72
+
73
+ ### WORKFLOW D: Async Task Execution
74
+
75
+ 1. Call `reasoning.think` as a task (send `tools/call` with `task` field) for long-running `high`-level reasoning.
76
+ 2. Poll `tasks/get` until status is `completed` or `failed`.
77
+ 3. Retrieve the result via `tasks/result`.
78
+ 4. Use `tasks/cancel` to abort if needed.
79
+
80
+ ---
81
+
82
+ ## TOOL NUANCES & GOTCHAS
83
+
84
+ `reasoning.think`
85
+
86
+ - Purpose: Generate a multi-step reasoning chain for a given query at a specified depth level.
87
+ - Input:
88
+ - `query` (string, 1–10,000 chars): The question or problem to reason about.
89
+ - `level` (enum: `basic` | `normal` | `high`): Controls reasoning depth and token budget.
90
+ - `targetThoughts` (int, 1–25, optional): Override automatic step count. Must fit within the level range.
91
+ - `sessionId` (string, 1–128 chars, optional): Continue an existing session. Level must match.
92
+ - Output: `{ ok, result: { sessionId, level, thoughts[], generatedThoughts, requestedThoughts, totalThoughts, tokenBudget, tokensUsed, ttlMs, expiresAt, createdAt, updatedAt, summary } }`
93
+ - Side effects: Creates or modifies an in-memory session. Sessions expire after 30 minutes of inactivity.
94
+ - Gotcha: Each call appends at most one thought. When continuing a session, `generatedThoughts` reflects only the newly added thought (0 or 1), not the cumulative total.
95
+ - Gotcha: `requestedThoughts` is the effective requested count for this run: it equals `targetThoughts` when provided, otherwise `totalThoughts`.
96
+ - Gotcha: Token counting is approximate (UTF-8 byte length ÷ 4), not true tokenization.
97
+ - Gotcha: Without `targetThoughts`, the planned step count (`totalThoughts`) is determined by a heuristic based on query length and structural complexity (punctuation markers, keywords like "compare", "analyse", "trade-off").
98
+ - Limits: Level ranges — basic: 3–5 thoughts (2K token budget), normal: 6–10 (8K), high: 15–25 (32K).
99
+
100
+ ---
101
+
102
+ ## CROSS-FEATURE RELATIONSHIPS
103
+
104
+ - Use `reasoning.basic` / `reasoning.normal` / `reasoning.high` prompts to construct a correctly parameterized `reasoning.think` call.
105
+ - Use `reasoning.continue` prompt to construct a session-continuation call — it enforces `sessionId` and `level` pairing.
106
+ - After calling `reasoning.think`, read `reasoning://sessions/{sessionId}` to retrieve the full session state including all accumulated thoughts.
107
+ - Use `reasoning://sessions` to discover active sessions before attempting continuation — avoids `E_SESSION_NOT_FOUND`.
108
+
109
+ ---
110
+
111
+ ## CONSTRAINTS & LIMITATIONS
112
+
113
+ - Sessions are in-memory — all data is lost on process restart.
114
+ - Session TTL: 30 minutes from last update. Expired sessions cannot be recovered.
115
+ - Maximum query length: 10,000 characters.
116
+ - Token budget enforcement is approximate (character-based proxy, not true tokenization).
117
+ - stdio transport only — no HTTP endpoint available.
118
+ - Reasoning steps are structural decompositions, not LLM-generated content.
119
+ - `targetThoughts` must be an integer within the level's min/max range.
120
+
121
+ ---
122
+
123
+ ## ERROR HANDLING STRATEGY
124
+
125
+ - `E_SESSION_NOT_FOUND`: Session expired or never existed. Call `reasoning://sessions` to list active sessions, or start a new session without `sessionId`.
126
+ - `E_SESSION_LEVEL_MISMATCH`: Requested level differs from the existing session. Use the same level as the original session, or start a new session.
127
+ - `E_INVALID_THOUGHT_COUNT`: `targetThoughts` is outside the level range. Check ranges: basic (3–5), normal (6–10), high (15–25).
128
+ - `E_ABORTED`: Reasoning was cancelled via abort signal or task cancellation. Retry with a new request if needed.
129
+ - `E_REASONING`: Unexpected engine error. Check the error `message` field for details and retry.
130
+
131
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/cortex-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "mcpName": "io.github.j0hanz/cortex-mcp",
5
5
  "author": "Johanz",
6
6
  "license": "MIT",