velixar-mcp-server 0.2.4 → 1.2.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 +120 -64
- package/dist/api.d.ts +64 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +405 -0
- package/dist/api.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +52 -0
- package/dist/errors.js.map +1 -0
- package/dist/justify.d.ts +9 -0
- package/dist/justify.d.ts.map +1 -0
- package/dist/justify.js +114 -0
- package/dist/justify.js.map +1 -0
- package/dist/prompts.d.ts +88 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +693 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resources.d.ts +25 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +278 -0
- package/dist/resources.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +392 -0
- package/dist/server.js.map +1 -0
- package/dist/simulation/personas.d.ts +41 -0
- package/dist/simulation/personas.d.ts.map +1 -0
- package/dist/simulation/personas.js +173 -0
- package/dist/simulation/personas.js.map +1 -0
- package/dist/simulation/report.d.ts +28 -0
- package/dist/simulation/report.d.ts.map +1 -0
- package/dist/simulation/report.js +105 -0
- package/dist/simulation/report.js.map +1 -0
- package/dist/simulation/runner.d.ts +63 -0
- package/dist/simulation/runner.d.ts.map +1 -0
- package/dist/simulation/runner.js +167 -0
- package/dist/simulation/runner.js.map +1 -0
- package/dist/temporal_merge.d.ts +70 -0
- package/dist/temporal_merge.d.ts.map +1 -0
- package/dist/temporal_merge.js +258 -0
- package/dist/temporal_merge.js.map +1 -0
- package/dist/tools/clairvoyance.d.ts +9 -0
- package/dist/tools/clairvoyance.d.ts.map +1 -0
- package/dist/tools/clairvoyance.js +321 -0
- package/dist/tools/clairvoyance.js.map +1 -0
- package/dist/tools/cognitive.d.ts +10 -0
- package/dist/tools/cognitive.d.ts.map +1 -0
- package/dist/tools/cognitive.js +462 -0
- package/dist/tools/cognitive.js.map +1 -0
- package/dist/tools/construction.d.ts +9 -0
- package/dist/tools/construction.d.ts.map +1 -0
- package/dist/tools/construction.js +350 -0
- package/dist/tools/construction.js.map +1 -0
- package/dist/tools/graph.d.ts +14 -0
- package/dist/tools/graph.d.ts.map +1 -0
- package/dist/tools/graph.js +263 -0
- package/dist/tools/graph.js.map +1 -0
- package/dist/tools/graph_sanitizer.d.ts +24 -0
- package/dist/tools/graph_sanitizer.d.ts.map +1 -0
- package/dist/tools/graph_sanitizer.js +79 -0
- package/dist/tools/graph_sanitizer.js.map +1 -0
- package/dist/tools/lifecycle.d.ts +9 -0
- package/dist/tools/lifecycle.d.ts.map +1 -0
- package/dist/tools/lifecycle.js +1091 -0
- package/dist/tools/lifecycle.js.map +1 -0
- package/dist/tools/livedata.d.ts +9 -0
- package/dist/tools/livedata.d.ts.map +1 -0
- package/dist/tools/livedata.js +222 -0
- package/dist/tools/livedata.js.map +1 -0
- package/dist/tools/memory.d.ts +10 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +275 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/recall.d.ts +9 -0
- package/dist/tools/recall.d.ts.map +1 -0
- package/dist/tools/recall.js +206 -0
- package/dist/tools/recall.js.map +1 -0
- package/dist/tools/retrieval.d.ts +9 -0
- package/dist/tools/retrieval.d.ts.map +1 -0
- package/dist/tools/retrieval.js +338 -0
- package/dist/tools/retrieval.js.map +1 -0
- package/dist/tools/system.d.ts +12 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +228 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/types.d.ts +234 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +79 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +174 -0
- package/dist/validate.js.map +1 -0
- package/dist/validate_retrieval.d.ts +33 -0
- package/dist/validate_retrieval.d.ts.map +1 -0
- package/dist/validate_retrieval.js +97 -0
- package/dist/validate_retrieval.js.map +1 -0
- package/package.json +22 -6
- package/server.json +2 -2
- package/.github/workflows/ci.yml +0 -18
- package/.mcpregistry_github_token +0 -1
- package/.mcpregistry_registry_token +0 -1
- package/src/index.js +0 -262
- package/tests/server.test.js +0 -193
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
// ── Velixar MCP Server — Workflow Prompts ──
|
|
2
|
+
// 18 cognitive workflow prompts across 7 groups.
|
|
3
|
+
// Each prompt defines: purpose, trigger, tool order, reasoning rules,
|
|
4
|
+
// output form, stop conditions, and escalation.
|
|
5
|
+
// S7: Single source of truth for cognitive mode → tool mapping.
|
|
6
|
+
// Used by both prompts.ts (constitution prompt) and resources.ts (constitution resource).
|
|
7
|
+
export const COGNITIVE_MODES = [
|
|
8
|
+
{ mode: 'Orientation', question: '"Understand the situation broadly"', tool: 'velixar_context' },
|
|
9
|
+
{ mode: 'Retrieval', question: '"I know what I\'m looking for"', tool: 'velixar_search' },
|
|
10
|
+
{ mode: 'Deep Retrieval', question: '"I need comprehensive coverage"', tool: 'velixar_multi_search' },
|
|
11
|
+
{ mode: 'Structure', question: '"Understand connections"', tool: 'velixar_graph_traverse' },
|
|
12
|
+
{ mode: 'Continuity', question: '"How did this evolve?"', tool: 'velixar_timeline' },
|
|
13
|
+
{ mode: 'Conflict', question: '"Something contradicts"', tool: 'velixar_contradictions' },
|
|
14
|
+
{ mode: 'Consolidation', question: '"Preserve what matters"', tool: 'velixar_distill' },
|
|
15
|
+
{ mode: 'Verification', question: '"Is my context complete?"', tool: 'velixar_coverage_check' },
|
|
16
|
+
{ mode: 'Construction', question: '"Assemble what I need to answer"', tool: 'velixar_prepare_context' },
|
|
17
|
+
{ mode: 'Personalization', question: '"What do I know about this user?"', tool: 'velixar_identity' },
|
|
18
|
+
{ mode: 'Inference', question: '"What patterns hold across these memories?"', tool: 'velixar_patterns' },
|
|
19
|
+
{ mode: 'Stewardship', question: '"Will future sessions need this work?"', tool: 'velixar_store' },
|
|
20
|
+
];
|
|
21
|
+
export function renderModesTable() {
|
|
22
|
+
const rows = COGNITIVE_MODES.map(m => `| ${m.mode} | ${m.question} | ${m.tool} |`).join('\n');
|
|
23
|
+
return `| Mode | Question | First Tool |\n|------|----------|------------|\n${rows}`;
|
|
24
|
+
}
|
|
25
|
+
// ── Group 1: Orientation ──
|
|
26
|
+
const cognitive_constitution = {
|
|
27
|
+
name: 'cognitive_constitution',
|
|
28
|
+
description: 'Core behavioral rules, cognitive modes, anti-patterns, error handling, and justification policy. Read this first.',
|
|
29
|
+
version: '1.2.0',
|
|
30
|
+
arguments: [],
|
|
31
|
+
messages: [{
|
|
32
|
+
role: 'user',
|
|
33
|
+
content: `Apply the Velixar Cognitive Constitution for this session.
|
|
34
|
+
|
|
35
|
+
## Core Principle
|
|
36
|
+
Prefer the smallest tool that answers the current cognitive question.
|
|
37
|
+
|
|
38
|
+
## Cognitive Modes
|
|
39
|
+
${renderModesTable()}
|
|
40
|
+
|
|
41
|
+
## Master Pattern: Orient Then Narrow
|
|
42
|
+
1. Start with velixar_context for broad orientation
|
|
43
|
+
2. Identify the cognitive mode from the user's question
|
|
44
|
+
3. Narrow with the specialized tool for that mode
|
|
45
|
+
4. Stop when the question is answered — do not chain unnecessarily
|
|
46
|
+
|
|
47
|
+
## Two-Tool Path for Complex Synthesis
|
|
48
|
+
For complex questions requiring comprehensive, verified context:
|
|
49
|
+
1. velixar_context — orient (what exists?)
|
|
50
|
+
2. velixar_prepare_context — assemble verified context with gap declaration
|
|
51
|
+
This handles multi-angle search, coverage verification, and temporal analysis internally.
|
|
52
|
+
Use velixar_search for simple factual lookups — do not over-engineer simple questions.
|
|
53
|
+
|
|
54
|
+
## Search Capabilities (KG-Merged)
|
|
55
|
+
Search results are automatically enhanced by the knowledge graph:
|
|
56
|
+
- Recency-weighted scoring: recent memories rank higher (recency * 0.3 in KG weight)
|
|
57
|
+
- Graph-boosted retrieval: 2-hop traversal from top vector hits injects related memories
|
|
58
|
+
- Chain neighbors: temporal chain links are included in results
|
|
59
|
+
- Access count feedback: frequently-recalled memories surface more over time
|
|
60
|
+
- You do NOT need to manually traverse the graph after searching — it's built in
|
|
61
|
+
|
|
62
|
+
## Batch Operations
|
|
63
|
+
When multiple independent searches or stores are needed, prefer batch tools:
|
|
64
|
+
- velixar_multi_search with merge:false: run up to 5 queries in one call (replaces batch_search)
|
|
65
|
+
- velixar_batch_store: store up to 20 memories in one call
|
|
66
|
+
|
|
67
|
+
## Error Handling
|
|
68
|
+
If a tool returns an error or empty result:
|
|
69
|
+
- Do NOT retry the same call with the same parameters
|
|
70
|
+
- Report what you know and what failed
|
|
71
|
+
- Suggest an alternative approach if one exists
|
|
72
|
+
- Never fabricate data to fill gaps from failed calls
|
|
73
|
+
|
|
74
|
+
## Anti-Patterns
|
|
75
|
+
- Never dump raw memory lists without synthesis
|
|
76
|
+
- Never present inferred content as retrieved fact
|
|
77
|
+
- Never ignore contradictions — surface them explicitly
|
|
78
|
+
- Never leak data across workspaces
|
|
79
|
+
|
|
80
|
+
## Justification Rules
|
|
81
|
+
- Retrieved facts: assert confidently
|
|
82
|
+
- Inferred/synthesized claims: qualify with confidence
|
|
83
|
+
- Speculative claims: present as exploratory or do not assert
|
|
84
|
+
- Contradictions reduce confidence regardless of evidence strength`,
|
|
85
|
+
}],
|
|
86
|
+
};
|
|
87
|
+
const recall_prior_reasoning = {
|
|
88
|
+
name: 'recall_prior_reasoning',
|
|
89
|
+
description: 'Recall and reconstruct prior reasoning about a topic. Use when resuming work or verifying past decisions.',
|
|
90
|
+
version: '1.1.0',
|
|
91
|
+
arguments: [{ name: 'topic', description: 'Topic or decision to recall reasoning for', required: true }],
|
|
92
|
+
messages: [{
|
|
93
|
+
role: 'user',
|
|
94
|
+
content: `Recall prior reasoning about: {{topic}}
|
|
95
|
+
|
|
96
|
+
Stop conditions (check BEFORE each step):
|
|
97
|
+
- If you already have a clear picture of the reasoning, stop and synthesize.
|
|
98
|
+
- If the topic has no stored memories, say so — do not speculate.
|
|
99
|
+
|
|
100
|
+
Suggested approach (use at most 3 tool calls):
|
|
101
|
+
1. Start with velixar_context(topic="{{topic}}") for broad orientation.
|
|
102
|
+
2. If the context is insufficient, try velixar_search for specific memories.
|
|
103
|
+
3. If temporal evolution matters, try velixar_timeline(topic="{{topic}}").
|
|
104
|
+
|
|
105
|
+
Rules:
|
|
106
|
+
- Synthesize a coherent narrative, not a raw memory dump
|
|
107
|
+
- Cite specific memories by ID when making claims
|
|
108
|
+
- Flag any contradictions or uncertainty
|
|
109
|
+
|
|
110
|
+
Output: Brief form (summary, relevant facts, open issues, confidence)`,
|
|
111
|
+
}],
|
|
112
|
+
};
|
|
113
|
+
const build_project_context = {
|
|
114
|
+
name: 'build_project_context',
|
|
115
|
+
description: 'Build comprehensive context for a project or workspace. Use when starting work on a project.',
|
|
116
|
+
version: '1.1.0',
|
|
117
|
+
arguments: [{ name: 'project', description: 'Project name or topic', required: false }],
|
|
118
|
+
messages: [{
|
|
119
|
+
role: 'user',
|
|
120
|
+
content: `Build project context for: {{project}}.
|
|
121
|
+
|
|
122
|
+
Stop conditions (check BEFORE each step):
|
|
123
|
+
- If velixar_context gives a clear workspace picture, stop there.
|
|
124
|
+
- If you have enough to start working, stop — don't exhaustively map everything.
|
|
125
|
+
|
|
126
|
+
Suggested approach (use at most 4 tool calls):
|
|
127
|
+
1. Start with velixar_context for workspace overview.
|
|
128
|
+
2. If key entities are identified, try velixar_graph_traverse on the most important one.
|
|
129
|
+
3. If recurring patterns would help, try velixar_patterns.
|
|
130
|
+
4. If user preferences matter for this project, try velixar_identity.
|
|
131
|
+
|
|
132
|
+
Rules:
|
|
133
|
+
- Prioritize actionable context over exhaustive history
|
|
134
|
+
- Highlight active contradictions and knowledge gaps
|
|
135
|
+
- Include entity relationships that inform current work
|
|
136
|
+
|
|
137
|
+
Output: Brief form (summary, relevant facts, open issues, confidence)`,
|
|
138
|
+
}],
|
|
139
|
+
};
|
|
140
|
+
const profile_entity = {
|
|
141
|
+
name: 'profile_entity',
|
|
142
|
+
description: 'Build a comprehensive profile of a specific entity (person, technology, concept).',
|
|
143
|
+
version: '1.0.0',
|
|
144
|
+
arguments: [{ name: 'entity', description: 'Entity to profile', required: true }],
|
|
145
|
+
messages: [{
|
|
146
|
+
role: 'user',
|
|
147
|
+
content: `Profile entity: {{entity}}
|
|
148
|
+
|
|
149
|
+
Stop conditions (check BEFORE each step):
|
|
150
|
+
- If graph traversal gives a complete picture, stop there.
|
|
151
|
+
- If the entity is sparse (few connections), say so rather than over-fetching.
|
|
152
|
+
|
|
153
|
+
Suggested approach (use at most 3 tool calls):
|
|
154
|
+
1. Start with velixar_graph_traverse(entity="{{entity}}") to find connections.
|
|
155
|
+
2. If more context is needed, try velixar_search for memories mentioning this entity.
|
|
156
|
+
3. If temporal evolution matters, try velixar_timeline(topic="{{entity}}").
|
|
157
|
+
|
|
158
|
+
Rules:
|
|
159
|
+
- Build a structured profile: what it is, how it connects, how it changed
|
|
160
|
+
- Distinguish facts (from stored memories) from inferences (from patterns)
|
|
161
|
+
- Flag if entity data is sparse — suggest what to store
|
|
162
|
+
|
|
163
|
+
Output: Brief form`,
|
|
164
|
+
}],
|
|
165
|
+
};
|
|
166
|
+
const orient_then_narrow = {
|
|
167
|
+
name: 'orient_then_narrow',
|
|
168
|
+
description: 'Master reasoning pattern — broad orientation then targeted narrowing. Use for any task where context is broad or uncertain.',
|
|
169
|
+
version: '1.1.0',
|
|
170
|
+
arguments: [{ name: 'question', description: 'The question or task to address', required: true }],
|
|
171
|
+
messages: [{
|
|
172
|
+
role: 'user',
|
|
173
|
+
content: `Address this using orient-then-narrow: {{question}}
|
|
174
|
+
|
|
175
|
+
Stop conditions (check BEFORE each step):
|
|
176
|
+
- If velixar_context alone answers the question, stop there.
|
|
177
|
+
- If one specialized tool answers it, stop — do not chain all of them.
|
|
178
|
+
|
|
179
|
+
Suggested approach (use at most 2 tool calls):
|
|
180
|
+
1. Start with velixar_context to orient broadly.
|
|
181
|
+
2. From the context, identify which cognitive mode fits (see the Cognitive Modes table in the cognitive_constitution prompt) and use ONE specialized tool for that mode.
|
|
182
|
+
|
|
183
|
+
Rules:
|
|
184
|
+
- Always start broad, then narrow — never skip orientation
|
|
185
|
+
- Pick exactly ONE specialized tool after context
|
|
186
|
+
- Respect justification: qualify inferred claims, assert retrieved facts
|
|
187
|
+
- Note: velixar_search already includes KG-boosted results (graph neighbors, chain links, recency weighting) — you do NOT need to manually traverse after searching
|
|
188
|
+
- If multiple independent lookups are needed, use velixar_multi_search instead of sequential calls
|
|
189
|
+
|
|
190
|
+
Output: Matches the cognitive mode's output form`,
|
|
191
|
+
}],
|
|
192
|
+
};
|
|
193
|
+
// ── Group 2: Conflict & Uncertainty ──
|
|
194
|
+
const resolve_contradiction = {
|
|
195
|
+
name: 'resolve_contradiction',
|
|
196
|
+
description: 'Investigate and resolve a contradiction between stored beliefs or facts.',
|
|
197
|
+
version: '1.0.0',
|
|
198
|
+
arguments: [{ name: 'topic', description: 'Topic area of the contradiction', required: false }],
|
|
199
|
+
messages: [{
|
|
200
|
+
role: 'user',
|
|
201
|
+
content: `Resolve contradictions about: {{topic}}.
|
|
202
|
+
|
|
203
|
+
Stop conditions (check BEFORE each step):
|
|
204
|
+
- If contradictions are clear and resolution is obvious, stop after inspecting both sides.
|
|
205
|
+
- If no contradictions exist, say so immediately.
|
|
206
|
+
|
|
207
|
+
Suggested approach (use at most 4 tool calls):
|
|
208
|
+
1. Start with velixar_contradictions to surface active conflicts.
|
|
209
|
+
2. For each high-severity contradiction, inspect both memory IDs with velixar_inspect.
|
|
210
|
+
3. If temporal context would help, try velixar_timeline to trace when beliefs diverged.
|
|
211
|
+
4. If this might be a preference shift, try velixar_identity.
|
|
212
|
+
|
|
213
|
+
Rules:
|
|
214
|
+
- Present both sides with evidence before suggesting resolution
|
|
215
|
+
- A contradiction may be valid (beliefs genuinely changed) — don't force resolution
|
|
216
|
+
- If resolution is clear, suggest updating the outdated memory via velixar_update
|
|
217
|
+
- Flag unresolvable conflicts explicitly
|
|
218
|
+
|
|
219
|
+
Output: Resolution form (conflict summary, evidence, likely interpretation, next step)`,
|
|
220
|
+
}],
|
|
221
|
+
};
|
|
222
|
+
const identify_knowledge_gaps = {
|
|
223
|
+
name: 'identify_knowledge_gaps',
|
|
224
|
+
description: 'Find what is missing or incomplete in the workspace knowledge.',
|
|
225
|
+
version: '1.0.0',
|
|
226
|
+
arguments: [{ name: 'domain', description: 'Domain to check for gaps', required: false }],
|
|
227
|
+
messages: [{
|
|
228
|
+
role: 'user',
|
|
229
|
+
content: `Identify knowledge gaps in: {{domain}}.
|
|
230
|
+
|
|
231
|
+
Stop conditions (check BEFORE each step):
|
|
232
|
+
- If context reveals clear gaps, report them — don't keep searching.
|
|
233
|
+
- This is a diagnostic workflow — identify gaps, don't fix them.
|
|
234
|
+
|
|
235
|
+
Suggested approach (use at most 3 tool calls):
|
|
236
|
+
1. Start with velixar_context for current state of knowledge.
|
|
237
|
+
2. If entity relationships matter, try velixar_graph_traverse on key entities — look for disconnected or sparse nodes.
|
|
238
|
+
3. If conflicts indicate uncertain areas, try velixar_contradictions.
|
|
239
|
+
|
|
240
|
+
Rules:
|
|
241
|
+
- Distinguish "no data" from "low confidence data" from "conflicting data"
|
|
242
|
+
- Prioritize gaps that block current work
|
|
243
|
+
- Suggest specific memories to store to fill critical gaps
|
|
244
|
+
|
|
245
|
+
Output: Gap Report form (knowns, unknowns, blockers, next questions)`,
|
|
246
|
+
}],
|
|
247
|
+
};
|
|
248
|
+
// ── Group 3: Time & Continuity ──
|
|
249
|
+
const trace_belief_evolution = {
|
|
250
|
+
name: 'trace_belief_evolution',
|
|
251
|
+
description: 'Trace how a belief, preference, or understanding changed over time.',
|
|
252
|
+
version: '1.0.0',
|
|
253
|
+
arguments: [{ name: 'belief', description: 'Belief or topic to trace', required: true }],
|
|
254
|
+
messages: [{
|
|
255
|
+
role: 'user',
|
|
256
|
+
content: `Trace the evolution of: {{belief}}
|
|
257
|
+
|
|
258
|
+
Stop conditions (check BEFORE each step):
|
|
259
|
+
- If timeline shows a clear evolution with change points, stop and narrate.
|
|
260
|
+
- If data is sparse, say so — don't over-fetch to fill gaps.
|
|
261
|
+
|
|
262
|
+
Suggested approach (use at most 3 tool calls):
|
|
263
|
+
1. Start with velixar_timeline(topic="{{belief}}") for temporal ordering.
|
|
264
|
+
2. If more memories are needed, try velixar_search for related content.
|
|
265
|
+
3. If conflicts exist at change points, try velixar_contradictions.
|
|
266
|
+
|
|
267
|
+
Rules:
|
|
268
|
+
- Present as a chronological narrative with clear change points
|
|
269
|
+
- Identify what triggered each change (new information, decision, preference shift)
|
|
270
|
+
- Mark the current state clearly
|
|
271
|
+
- Flag uncertainty where timeline is sparse
|
|
272
|
+
|
|
273
|
+
Output: Timeline form (phases, key change points, current state, uncertainty)`,
|
|
274
|
+
}],
|
|
275
|
+
};
|
|
276
|
+
const resume_previous_session = {
|
|
277
|
+
name: 'resume_previous_session',
|
|
278
|
+
description: 'Resume work from a previous session. Use when returning to a project after a break.',
|
|
279
|
+
version: '1.0.0',
|
|
280
|
+
arguments: [
|
|
281
|
+
{ name: 'session_id', description: 'Previous session ID (if known)', required: false },
|
|
282
|
+
{ name: 'topic', description: 'Topic to resume', required: false },
|
|
283
|
+
],
|
|
284
|
+
messages: [{
|
|
285
|
+
role: 'user',
|
|
286
|
+
content: `Resume previous session (session: {{session_id}}) about: {{topic}}.
|
|
287
|
+
|
|
288
|
+
Stop conditions (check BEFORE each step):
|
|
289
|
+
- If session_resume gives a complete picture, stop there — it's designed for this.
|
|
290
|
+
- If the user just needs to know where they left off, one call is enough.
|
|
291
|
+
|
|
292
|
+
Suggested approach (use at most 2 tool calls):
|
|
293
|
+
1. Start with velixar_session_resume — it handles chunking and assembly in one call.
|
|
294
|
+
2. If you need current workspace state beyond the session, try velixar_context.
|
|
295
|
+
|
|
296
|
+
Rules:
|
|
297
|
+
- Summarize where the user left off
|
|
298
|
+
- Highlight what changed since the last session
|
|
299
|
+
- Surface any new contradictions or patterns
|
|
300
|
+
- Keep it concise — the user wants to resume, not review everything
|
|
301
|
+
|
|
302
|
+
Output: Brief form`,
|
|
303
|
+
}],
|
|
304
|
+
};
|
|
305
|
+
const reconstruct_decision_path = {
|
|
306
|
+
name: 'reconstruct_decision_path',
|
|
307
|
+
description: 'Reconstruct the reasoning path that led to a specific decision.',
|
|
308
|
+
version: '1.0.0',
|
|
309
|
+
arguments: [{ name: 'decision', description: 'Decision to reconstruct', required: true }],
|
|
310
|
+
messages: [{
|
|
311
|
+
role: 'user',
|
|
312
|
+
content: `Reconstruct the decision path for: {{decision}}
|
|
313
|
+
|
|
314
|
+
Stop conditions (check BEFORE each step):
|
|
315
|
+
- If timeline shows the decision with clear context, stop and narrate.
|
|
316
|
+
- If the decision memory is self-explanatory, one inspect may suffice.
|
|
317
|
+
|
|
318
|
+
Suggested approach (use at most 3 tool calls):
|
|
319
|
+
1. Start with velixar_timeline(topic="{{decision}}") to find the decision point.
|
|
320
|
+
2. If the decision memory needs detail, try velixar_inspect on it.
|
|
321
|
+
3. If surrounding context is needed, try velixar_search.
|
|
322
|
+
|
|
323
|
+
Rules:
|
|
324
|
+
- Present the reasoning chain: context → options considered → decision → rationale
|
|
325
|
+
- Cite specific memories as evidence
|
|
326
|
+
- Flag if the reasoning chain has gaps
|
|
327
|
+
- Note if circumstances have changed since the decision
|
|
328
|
+
|
|
329
|
+
Output: Timeline form`,
|
|
330
|
+
}],
|
|
331
|
+
};
|
|
332
|
+
// ── Group 4: Memory Lifecycle ──
|
|
333
|
+
const distill_session = {
|
|
334
|
+
name: 'distill_session',
|
|
335
|
+
description: 'Extract and store durable memories from the current session. Use at session end or natural breakpoints.',
|
|
336
|
+
version: '1.1.0',
|
|
337
|
+
arguments: [{ name: 'session_summary', description: 'Summary of what happened this session (optional — if omitted, auto-recalls current session)', required: false }],
|
|
338
|
+
messages: [{
|
|
339
|
+
role: 'user',
|
|
340
|
+
content: `Distill this session: {{session_summary}}
|
|
341
|
+
|
|
342
|
+
Stop conditions (check BEFORE each step):
|
|
343
|
+
- If there's only one memory-worthy takeaway, one velixar_distill call is enough.
|
|
344
|
+
- If content is transient chatter with nothing durable, say so and stop.
|
|
345
|
+
|
|
346
|
+
Suggested approach (use at most 4 tool calls):
|
|
347
|
+
1. If no session summary was provided, call velixar_session_recall to retrieve the current session content first.
|
|
348
|
+
2. Identify memory-worthy content: decisions, preferences, bugs solved, patterns discovered.
|
|
349
|
+
3. Call velixar_distill for each distinct takeaway (it handles duplicate detection). For multiple takeaways, use velixar_batch_store if they are independent facts.
|
|
350
|
+
4. If tags need refinement, try velixar_retag. If memories overlap, try velixar_consolidate.
|
|
351
|
+
|
|
352
|
+
Rules:
|
|
353
|
+
- Only distill content worth remembering long-term — skip transient chatter
|
|
354
|
+
- Each distilled memory should be self-contained and searchable
|
|
355
|
+
- Prefer semantic memories (durable facts) over episodic (event-specific)
|
|
356
|
+
- Report what was stored, skipped (duplicate), and flagged (contradiction)
|
|
357
|
+
|
|
358
|
+
Output: Distillation Set form`,
|
|
359
|
+
}],
|
|
360
|
+
};
|
|
361
|
+
const consolidate_topic_memory = {
|
|
362
|
+
name: 'consolidate_topic_memory',
|
|
363
|
+
description: 'Merge scattered memories about a topic into a unified semantic memory.',
|
|
364
|
+
version: '1.0.0',
|
|
365
|
+
arguments: [{ name: 'topic', description: 'Topic to consolidate', required: true }],
|
|
366
|
+
messages: [{
|
|
367
|
+
role: 'user',
|
|
368
|
+
content: `Consolidate memories about: {{topic}}
|
|
369
|
+
|
|
370
|
+
Stop conditions (check BEFORE each step):
|
|
371
|
+
- If search finds fewer than 2 memories, consolidation isn't needed — say so.
|
|
372
|
+
- If memories don't overlap enough to merge, say so rather than forcing a merge.
|
|
373
|
+
|
|
374
|
+
Suggested approach (use at most 3 tool calls):
|
|
375
|
+
1. Start with velixar_search for all memories about this topic.
|
|
376
|
+
2. If candidates are found, call velixar_consolidate with the memory IDs and a synthesized summary.
|
|
377
|
+
3. If the consolidated memory needs better tags, try velixar_retag.
|
|
378
|
+
|
|
379
|
+
Rules:
|
|
380
|
+
- The consolidated memory should capture the current understanding, not history
|
|
381
|
+
- Preserve original memory IDs as provenance (consolidate does this automatically)
|
|
382
|
+
- If memories contradict, note the conflict in the consolidated summary
|
|
383
|
+
- Show before (scattered) and after (unified) state
|
|
384
|
+
|
|
385
|
+
Output: Distillation Set form`,
|
|
386
|
+
}],
|
|
387
|
+
};
|
|
388
|
+
const retag_recent_memories = {
|
|
389
|
+
name: 'retag_recent_memories',
|
|
390
|
+
description: 'Review and improve tags on recent memories for better organization and retrieval.',
|
|
391
|
+
version: '1.0.0',
|
|
392
|
+
arguments: [{ name: 'count', description: 'Number of recent memories to review (default 10)', required: false }],
|
|
393
|
+
messages: [{
|
|
394
|
+
role: 'user',
|
|
395
|
+
content: `Review and retag recent memories (up to {{count}} or 10).
|
|
396
|
+
|
|
397
|
+
Stop conditions (check BEFORE each step):
|
|
398
|
+
- If all tags look accurate after listing, say so and stop.
|
|
399
|
+
- Only retag memories that actually need it — don't change tags for the sake of it.
|
|
400
|
+
|
|
401
|
+
Suggested approach (use at most 2 tool calls):
|
|
402
|
+
1. Start with velixar_list to get recent memories and review their tags.
|
|
403
|
+
2. For memories with missing, wrong, or overly generic tags, call velixar_retag.
|
|
404
|
+
|
|
405
|
+
Rules:
|
|
406
|
+
- Tags should be specific enough to aid retrieval but not so specific they're unique
|
|
407
|
+
- Add domain tags (e.g., "architecture", "bugfix", "decision") where missing
|
|
408
|
+
- Remove redundant or overly generic tags
|
|
409
|
+
- Report what was changed and why
|
|
410
|
+
|
|
411
|
+
Output: Distillation Set form`,
|
|
412
|
+
}],
|
|
413
|
+
};
|
|
414
|
+
// ── Group 5: Identity & Personalization ──
|
|
415
|
+
const summarize_user_identity = {
|
|
416
|
+
name: 'summarize_user_identity',
|
|
417
|
+
description: 'Build a comprehensive summary of the user identity for this workspace.',
|
|
418
|
+
version: '1.0.0',
|
|
419
|
+
arguments: [],
|
|
420
|
+
messages: [{
|
|
421
|
+
role: 'user',
|
|
422
|
+
content: `Summarize user identity for this workspace.
|
|
423
|
+
|
|
424
|
+
Stop conditions (check BEFORE each step):
|
|
425
|
+
- If velixar_identity returns a complete profile, stop there.
|
|
426
|
+
- If identity is empty, say so and suggest what to store — don't over-fetch.
|
|
427
|
+
|
|
428
|
+
Suggested approach (use at most 3 tool calls):
|
|
429
|
+
1. Start with velixar_identity to get the current profile.
|
|
430
|
+
2. If the profile is sparse, try velixar_search for memories tagged with preferences, expertise, or goals.
|
|
431
|
+
3. If entity relationships would enrich the profile, try velixar_graph_traverse on identity-related entities.
|
|
432
|
+
|
|
433
|
+
Rules:
|
|
434
|
+
- Distinguish stored facts from inferred patterns
|
|
435
|
+
- Flag areas where identity data is sparse or contradictory
|
|
436
|
+
- Present as a structured profile, not a memory dump
|
|
437
|
+
|
|
438
|
+
Output: Brief form`,
|
|
439
|
+
}],
|
|
440
|
+
};
|
|
441
|
+
const detect_preference_shift = {
|
|
442
|
+
name: 'detect_preference_shift',
|
|
443
|
+
description: 'Detect if user preferences or beliefs have shifted over time.',
|
|
444
|
+
version: '1.0.0',
|
|
445
|
+
arguments: [{ name: 'area', description: 'Preference area to check (e.g., "coding style", "tools")', required: false }],
|
|
446
|
+
messages: [{
|
|
447
|
+
role: 'user',
|
|
448
|
+
content: `Detect preference shifts in: {{area}}.
|
|
449
|
+
|
|
450
|
+
Stop conditions (check BEFORE each step):
|
|
451
|
+
- If identity shows clear shifts with timestamps, stop and narrate.
|
|
452
|
+
- If no shifts are detected, say so — don't search for shifts that aren't there.
|
|
453
|
+
|
|
454
|
+
Suggested approach (use at most 3 tool calls):
|
|
455
|
+
1. Start with velixar_identity to get current profile and any recorded shifts.
|
|
456
|
+
2. If temporal context would help, try velixar_timeline with the preference area as topic.
|
|
457
|
+
3. If conflicts exist, try velixar_contradictions to find conflicting preference statements.
|
|
458
|
+
|
|
459
|
+
Rules:
|
|
460
|
+
- A preference shift is valid — don't treat it as an error
|
|
461
|
+
- Present the evolution: old preference → trigger → new preference
|
|
462
|
+
- Suggest updating identity if a shift is confirmed
|
|
463
|
+
- Flag if the shift is ambiguous (might be context-dependent, not a true change)
|
|
464
|
+
|
|
465
|
+
Output: Resolution form`,
|
|
466
|
+
}],
|
|
467
|
+
};
|
|
468
|
+
const align_response_style = {
|
|
469
|
+
name: 'align_response_style',
|
|
470
|
+
description: 'Check user communication preferences and align response style accordingly.',
|
|
471
|
+
version: '1.0.0',
|
|
472
|
+
arguments: [],
|
|
473
|
+
messages: [{
|
|
474
|
+
role: 'user',
|
|
475
|
+
content: `Check and align to user communication preferences.
|
|
476
|
+
|
|
477
|
+
Stop conditions (check BEFORE each step):
|
|
478
|
+
- One tool call is enough. Do not chain further.
|
|
479
|
+
|
|
480
|
+
Suggested approach (1 tool call):
|
|
481
|
+
1. Call velixar_identity to get communication_style and preferences.
|
|
482
|
+
|
|
483
|
+
Rules:
|
|
484
|
+
- Apply the user's stated preferences to your response style
|
|
485
|
+
- If no preferences are stored, use neutral professional style
|
|
486
|
+
- Do not over-personalize — respect stated boundaries
|
|
487
|
+
|
|
488
|
+
Output: Brief form (just the relevant style preferences)`,
|
|
489
|
+
}],
|
|
490
|
+
};
|
|
491
|
+
// ── Group 6: Enterprise ──
|
|
492
|
+
const org_knowledge_review = {
|
|
493
|
+
name: 'org_knowledge_review',
|
|
494
|
+
description: 'Review org-level knowledge: cross-workspace patterns, promotion candidates, isolation checks.',
|
|
495
|
+
version: '1.1.0',
|
|
496
|
+
arguments: [{ name: 'focus', description: 'Specific area to review (optional)', required: false }],
|
|
497
|
+
messages: [{
|
|
498
|
+
role: 'user',
|
|
499
|
+
content: `Review org-level knowledge for: {{focus}}.
|
|
500
|
+
|
|
501
|
+
Stop conditions (check BEFORE each step):
|
|
502
|
+
- If context shows clear org state, stop and summarize.
|
|
503
|
+
- If no org-level memories exist, say so and suggest candidates for promotion.
|
|
504
|
+
|
|
505
|
+
Suggested approach (use at most 3 tool calls):
|
|
506
|
+
1. Start with velixar_context to get workspace overview including org-tier memories.
|
|
507
|
+
2. If cross-workspace patterns matter, try velixar_patterns(topic="org knowledge").
|
|
508
|
+
3. If contradictions exist between workspace and org knowledge, try velixar_contradictions.
|
|
509
|
+
|
|
510
|
+
Rules:
|
|
511
|
+
- Distinguish workspace-local knowledge from org-level knowledge
|
|
512
|
+
- Identify memories that should be promoted from workspace → org (Tier 2 → Tier 3)
|
|
513
|
+
- Flag any workspace isolation violations
|
|
514
|
+
- Suggest consolidation of duplicate knowledge across workspaces
|
|
515
|
+
|
|
516
|
+
Output: Gap Report form (org knowns, workspace-only knowns, promotion candidates, isolation issues)`,
|
|
517
|
+
}],
|
|
518
|
+
};
|
|
519
|
+
const evaluate_product_fit = {
|
|
520
|
+
name: 'evaluate_product_fit',
|
|
521
|
+
description: 'Evaluate whether a domain/company is a good fit for a product or service. Synthesizes knowledge graph data about the domain.',
|
|
522
|
+
version: '1.1.0',
|
|
523
|
+
arguments: [
|
|
524
|
+
{ name: 'domain', description: 'Company domain or name to evaluate', required: true },
|
|
525
|
+
{ name: 'product', description: 'Product or service to evaluate fit for', required: false },
|
|
526
|
+
],
|
|
527
|
+
messages: [{
|
|
528
|
+
role: 'user',
|
|
529
|
+
content: `Evaluate product fit for: {{domain}} (product: {{product}})
|
|
530
|
+
|
|
531
|
+
Stop conditions (check BEFORE each step):
|
|
532
|
+
- If search and graph give enough signal, stop and evaluate — don't exhaust all tools.
|
|
533
|
+
- If no data exists about this domain, say so and suggest what to gather.
|
|
534
|
+
|
|
535
|
+
Suggested approach (use at most 4 tool calls):
|
|
536
|
+
1. Start with velixar_search for any existing memories about {{domain}}.
|
|
537
|
+
2. If entities exist, try velixar_graph_traverse(entity="{{domain}}") for relationships.
|
|
538
|
+
3. If broader context would help, try velixar_context(topic="{{domain}} evaluation").
|
|
539
|
+
4. If adoption patterns are relevant, try velixar_patterns(topic="enterprise adoption").
|
|
540
|
+
|
|
541
|
+
Evaluate:
|
|
542
|
+
- Team size signals (mentions of teams, departments, org structure)
|
|
543
|
+
- Technical maturity (CI/CD, tooling, LLM integration mentions)
|
|
544
|
+
- Pain points the product solves
|
|
545
|
+
- Engagement signals (API usage frequency, memory volume, feature requests)
|
|
546
|
+
|
|
547
|
+
Output form:
|
|
548
|
+
- fit_score: 1-10
|
|
549
|
+
- signals: list of positive/negative indicators
|
|
550
|
+
- recommended_tier: free | pro | teams | enterprise
|
|
551
|
+
- next_action: suggested outreach or nurture step
|
|
552
|
+
- gaps: what information is missing to make a confident assessment`,
|
|
553
|
+
}],
|
|
554
|
+
};
|
|
555
|
+
// ── Group 7: Stewardship ──
|
|
556
|
+
// The "recall first, store after, verify the store" discipline contract.
|
|
557
|
+
// Spec: RECALL-FIRST-MODE-TASKS.md (incl. 7-Whys forward analysis R1-R7).
|
|
558
|
+
const recall_first = {
|
|
559
|
+
name: 'recall_first',
|
|
560
|
+
description: 'Stewardship workflow. Use BEFORE finalizing any non-trivial code change, decision, or design that future sessions will need. Enforces a recall → act → persist → verify loop.',
|
|
561
|
+
version: '1.0.0',
|
|
562
|
+
arguments: [
|
|
563
|
+
{ name: 'intent', description: 'One-line description of what you are about to do.', required: true },
|
|
564
|
+
],
|
|
565
|
+
messages: [{
|
|
566
|
+
role: 'user',
|
|
567
|
+
content: `You are operating in Stewardship mode for this task.
|
|
568
|
+
|
|
569
|
+
Intent: {{intent}}
|
|
570
|
+
|
|
571
|
+
This is the recall_first contract. Honor all four phases in order. None are optional.
|
|
572
|
+
|
|
573
|
+
## Phase 1 — RECALL (before acting)
|
|
574
|
+
|
|
575
|
+
Query velixar memory for any prior decision, hardening row, incident, or constraint that bears on this work.
|
|
576
|
+
|
|
577
|
+
- Use velixar_context for broad orientation, or velixar_search for a specific topic.
|
|
578
|
+
- Run multiple narrow queries SEQUENTIALLY, not in parallel — parallel batched queries can trip auth-failure rate limits and produce silent partial failures.
|
|
579
|
+
- Capture the substance of what you found.
|
|
580
|
+
|
|
581
|
+
## Phase 2 — ACT (perform the change)
|
|
582
|
+
|
|
583
|
+
Do the work: write code, propose the design, update infra. Local-only; nothing committed yet.
|
|
584
|
+
|
|
585
|
+
- Required: explicitly cite at least one recalled fact from Phase 1, OR explicitly state "no prior context found relevant to this change" if your recall returned nothing material.
|
|
586
|
+
- This requirement exists because recall without engagement is theater. The point of recall is to surface conflicts before acting; if the LLM dismisses what it found, the contract failed.
|
|
587
|
+
|
|
588
|
+
## Phase 3 — PERSIST (substantive store)
|
|
589
|
+
|
|
590
|
+
Store a substantive summary of the change to velixar memory.
|
|
591
|
+
|
|
592
|
+
- Use velixar_store SEQUENTIALLY (not parallel). Batched parallel stores have a documented partial-success failure mode where only the first call lands.
|
|
593
|
+
- Tag the memory with the work's domain (e.g. session-YYYY-MM-DD plus topic plus layer-or-component).
|
|
594
|
+
- Reference the recalled context from Phase 1 in the stored summary so future sessions can audit the lineage.
|
|
595
|
+
|
|
596
|
+
## Phase 4 — VERIFY (read back)
|
|
597
|
+
|
|
598
|
+
Confirm the store actually persisted. Do not trust the store-tool's success response alone — past incidents include WAF rejections silently dropping stores while the response said 200.
|
|
599
|
+
|
|
600
|
+
- Verify via velixar_search for a distinctive 3+ word phrase from the stored content (vector-search hot path, synchronous), OR via velixar_inspect by ID (direct lookup, definitely synchronous).
|
|
601
|
+
- Do NOT verify via KG or entity lookups — those are async-indexed and will false-fail at T+0s.
|
|
602
|
+
- If verification returns no hits, retry once with a 2-second backoff. If still empty, treat it as a real persistence failure: re-store, log to local auto-memory, and surface the incident before continuing.
|
|
603
|
+
|
|
604
|
+
## When to use this workflow
|
|
605
|
+
|
|
606
|
+
USE WHEN:
|
|
607
|
+
- Non-trivial code change (multi-file edit, security-touching, infra-touching, deploy-affecting)
|
|
608
|
+
- Architectural decision or design doc
|
|
609
|
+
- Incident response, hardening work, post-migration follow-up
|
|
610
|
+
- Anything the user describes with words like "remember this for next time" or "future sessions"
|
|
611
|
+
|
|
612
|
+
DO NOT USE WHEN:
|
|
613
|
+
- Trivial lookups (grep, ls, single-file reads)
|
|
614
|
+
- Conversational turns without code or design output
|
|
615
|
+
- Pure read-only commands
|
|
616
|
+
- One-shot ad-hoc explanations
|
|
617
|
+
|
|
618
|
+
## Stop conditions
|
|
619
|
+
|
|
620
|
+
- Phase 1 returns nothing relevant → state that explicitly in Phase 2; do not skip the citation step.
|
|
621
|
+
- Phase 4 fails twice → STOP. Surface the persistence failure to the user. Do not silently proceed.
|
|
622
|
+
- The work outgrows a single store (multi-day project) → use recall_first per logical unit of progress; aggregate stores at session-end via distill_session.
|
|
623
|
+
|
|
624
|
+
References:
|
|
625
|
+
- velixar-mcp-server/RECALL-FIRST-MODE-TASKS.md (spec + 7-Whys forward analysis)
|
|
626
|
+
- Cognitive constitution at velixar://constitution`,
|
|
627
|
+
}],
|
|
628
|
+
};
|
|
629
|
+
// ── Export ──
|
|
630
|
+
export const allPrompts = [
|
|
631
|
+
// Group 0: Foundation
|
|
632
|
+
cognitive_constitution,
|
|
633
|
+
// Group 1: Orientation
|
|
634
|
+
recall_prior_reasoning,
|
|
635
|
+
build_project_context,
|
|
636
|
+
profile_entity,
|
|
637
|
+
orient_then_narrow,
|
|
638
|
+
// Group 2: Conflict & Uncertainty
|
|
639
|
+
resolve_contradiction,
|
|
640
|
+
identify_knowledge_gaps,
|
|
641
|
+
// Group 3: Time & Continuity
|
|
642
|
+
trace_belief_evolution,
|
|
643
|
+
resume_previous_session,
|
|
644
|
+
reconstruct_decision_path,
|
|
645
|
+
// Group 4: Memory Lifecycle
|
|
646
|
+
distill_session,
|
|
647
|
+
consolidate_topic_memory,
|
|
648
|
+
retag_recent_memories,
|
|
649
|
+
// Group 5: Identity & Personalization
|
|
650
|
+
summarize_user_identity,
|
|
651
|
+
detect_preference_shift,
|
|
652
|
+
align_response_style,
|
|
653
|
+
// Group 6: Enterprise
|
|
654
|
+
org_knowledge_review,
|
|
655
|
+
evaluate_product_fit,
|
|
656
|
+
// Group 7: Stewardship
|
|
657
|
+
recall_first,
|
|
658
|
+
];
|
|
659
|
+
export function getPromptList() {
|
|
660
|
+
return {
|
|
661
|
+
prompts: allPrompts.map(p => ({
|
|
662
|
+
name: p.name,
|
|
663
|
+
description: p.description,
|
|
664
|
+
version: p.version,
|
|
665
|
+
arguments: p.arguments,
|
|
666
|
+
})),
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
export function getPrompt(name, promptArgs = {}) {
|
|
670
|
+
const prompt = allPrompts.find(p => p.name === name);
|
|
671
|
+
if (!prompt)
|
|
672
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
673
|
+
const messages = prompt.messages.map(m => {
|
|
674
|
+
let content = m.content;
|
|
675
|
+
// Replace provided args
|
|
676
|
+
for (const [key, value] of Object.entries(promptArgs)) {
|
|
677
|
+
content = content.replaceAll(`{{${key}}}`, value);
|
|
678
|
+
}
|
|
679
|
+
// Strip unresolved optional placeholders: "{{key}}" → "" and clean up dangling labels
|
|
680
|
+
const optionalNames = (prompt.arguments || []).filter(a => !a.required).map(a => a.name);
|
|
681
|
+
for (const opt of optionalNames) {
|
|
682
|
+
if (content.includes(`{{${opt}}}`)) {
|
|
683
|
+
// Remove lines that are ONLY the placeholder with a label prefix (e.g., " about: {{topic}}")
|
|
684
|
+
content = content.replace(new RegExp(`\\s*(?:about|for|in|session):\\s*\\{\\{${opt}\\}\\}`, 'g'), '');
|
|
685
|
+
content = content.replace(new RegExp(`\\s*\\(session:\\s*\\{\\{${opt}\\}\\}\\)`, 'g'), '');
|
|
686
|
+
content = content.replaceAll(`{{${opt}}}`, '');
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return { role: m.role, content: { type: 'text', text: content.trim() } };
|
|
690
|
+
});
|
|
691
|
+
return { description: prompt.description, messages };
|
|
692
|
+
}
|
|
693
|
+
//# sourceMappingURL=prompts.js.map
|