@hiveai/mcp 0.9.7 → 0.9.9
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/dist/index.js +133 -71
- package/dist/index.js.map +1 -1
- package/dist/server.js +133 -71
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/dist/server.js
CHANGED
|
@@ -3449,8 +3449,9 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
3449
3449
|
}
|
|
3450
3450
|
|
|
3451
3451
|
// src/server.ts
|
|
3452
|
+
import { loadConfigSync } from "@hiveai/core";
|
|
3452
3453
|
var SERVER_NAME = "haive";
|
|
3453
|
-
var SERVER_VERSION = "0.9.
|
|
3454
|
+
var SERVER_VERSION = "0.9.9";
|
|
3454
3455
|
function jsonResult(data) {
|
|
3455
3456
|
return {
|
|
3456
3457
|
content: [
|
|
@@ -3461,15 +3462,70 @@ function jsonResult(data) {
|
|
|
3461
3462
|
]
|
|
3462
3463
|
};
|
|
3463
3464
|
}
|
|
3465
|
+
var ENFORCEMENT_PROFILE_TOOLS = /* @__PURE__ */ new Set([
|
|
3466
|
+
"get_briefing",
|
|
3467
|
+
"mem_save",
|
|
3468
|
+
"mem_tried",
|
|
3469
|
+
"mem_search",
|
|
3470
|
+
"mem_get",
|
|
3471
|
+
"mem_update",
|
|
3472
|
+
"mem_verify",
|
|
3473
|
+
"mem_relevant_to",
|
|
3474
|
+
"code_map",
|
|
3475
|
+
"pre_commit_check"
|
|
3476
|
+
]);
|
|
3477
|
+
var BRIEFING_TOOLS = /* @__PURE__ */ new Set(["get_briefing", "mem_relevant_to"]);
|
|
3478
|
+
var MUTATING_TOOLS = /* @__PURE__ */ new Set([
|
|
3479
|
+
"mem_save",
|
|
3480
|
+
"mem_tried",
|
|
3481
|
+
"mem_observe",
|
|
3482
|
+
"mem_session_end",
|
|
3483
|
+
"bootstrap_project_save",
|
|
3484
|
+
"mem_update",
|
|
3485
|
+
"mem_approve",
|
|
3486
|
+
"mem_reject",
|
|
3487
|
+
"mem_delete",
|
|
3488
|
+
"runtime_journal_append",
|
|
3489
|
+
"pattern_detect"
|
|
3490
|
+
]);
|
|
3464
3491
|
function createHaiveServer(options = {}) {
|
|
3465
3492
|
const context = createContext(options);
|
|
3493
|
+
const config = loadConfigSync(context.paths);
|
|
3494
|
+
const toolProfile = options.env?.HAIVE_TOOL_PROFILE ?? config.enforcement?.toolProfile ?? "enforcement";
|
|
3495
|
+
const requireBriefingFirst = options.env?.HAIVE_REQUIRE_BRIEFING_FIRST === "0" ? false : config.enforcement?.requireBriefingFirst ?? true;
|
|
3496
|
+
let briefingLoaded = false;
|
|
3466
3497
|
const tracker = new SessionTracker(context);
|
|
3467
3498
|
void tracker.init();
|
|
3468
3499
|
const server = new McpServer(
|
|
3469
3500
|
{ name: SERVER_NAME, version: SERVER_VERSION },
|
|
3470
3501
|
{ capabilities: { tools: {}, prompts: {} } }
|
|
3471
3502
|
);
|
|
3472
|
-
|
|
3503
|
+
const shouldRegisterTool = (name) => toolProfile === "full" || ENFORCEMENT_PROFILE_TOOLS.has(name);
|
|
3504
|
+
const registerTool = (name, description, schema, handler) => {
|
|
3505
|
+
if (!shouldRegisterTool(name)) return;
|
|
3506
|
+
const tool = server.tool.bind(server);
|
|
3507
|
+
tool(
|
|
3508
|
+
name,
|
|
3509
|
+
description,
|
|
3510
|
+
schema,
|
|
3511
|
+
async (input) => {
|
|
3512
|
+
if (BRIEFING_TOOLS.has(name)) {
|
|
3513
|
+
briefingLoaded = true;
|
|
3514
|
+
return await handler(input);
|
|
3515
|
+
}
|
|
3516
|
+
if (requireBriefingFirst && MUTATING_TOOLS.has(name) && !briefingLoaded) {
|
|
3517
|
+
return jsonResult({
|
|
3518
|
+
error: "haive_briefing_required",
|
|
3519
|
+
message: "This hAIve project requires get_briefing or mem_relevant_to before state-changing hAIve tools. Call get_briefing({ task: '...' }) first.",
|
|
3520
|
+
tool: name
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
return await handler(input);
|
|
3524
|
+
}
|
|
3525
|
+
);
|
|
3526
|
+
};
|
|
3527
|
+
const shouldRegisterPrompt = (name) => toolProfile === "full" || name === "bootstrap_project" || name === "post_task";
|
|
3528
|
+
registerTool(
|
|
3473
3529
|
"mem_save",
|
|
3474
3530
|
[
|
|
3475
3531
|
"Save a piece of knowledge as a persistent memory that survives across AI sessions.",
|
|
@@ -3501,7 +3557,7 @@ function createHaiveServer(options = {}) {
|
|
|
3501
3557
|
return jsonResult(await memSave(input, context));
|
|
3502
3558
|
}
|
|
3503
3559
|
);
|
|
3504
|
-
|
|
3560
|
+
registerTool(
|
|
3505
3561
|
"mem_suggest_topic",
|
|
3506
3562
|
[
|
|
3507
3563
|
"Propose a stable `topic` key (topic-upsert) from type + short title.",
|
|
@@ -3518,7 +3574,7 @@ function createHaiveServer(options = {}) {
|
|
|
3518
3574
|
MemSuggestTopicInputSchema,
|
|
3519
3575
|
async (input) => jsonResult(await memSuggestTopic(input, context))
|
|
3520
3576
|
);
|
|
3521
|
-
|
|
3577
|
+
registerTool(
|
|
3522
3578
|
"mem_tried",
|
|
3523
3579
|
[
|
|
3524
3580
|
"Record a FAILED approach so future agents don't repeat the same mistake.",
|
|
@@ -3545,7 +3601,7 @@ function createHaiveServer(options = {}) {
|
|
|
3545
3601
|
return jsonResult(await memTried(input, context));
|
|
3546
3602
|
}
|
|
3547
3603
|
);
|
|
3548
|
-
|
|
3604
|
+
registerTool(
|
|
3549
3605
|
"mem_observe",
|
|
3550
3606
|
[
|
|
3551
3607
|
"Capture a code-level discovery made WHILE READING existing code.",
|
|
@@ -3577,7 +3633,7 @@ function createHaiveServer(options = {}) {
|
|
|
3577
3633
|
return jsonResult(await memObserve(input, context));
|
|
3578
3634
|
}
|
|
3579
3635
|
);
|
|
3580
|
-
|
|
3636
|
+
registerTool(
|
|
3581
3637
|
"mem_session_end",
|
|
3582
3638
|
[
|
|
3583
3639
|
"Save an end-of-session recap so the NEXT session starts with fresh context.",
|
|
@@ -3606,7 +3662,7 @@ function createHaiveServer(options = {}) {
|
|
|
3606
3662
|
return jsonResult(await memSessionEnd(input, context));
|
|
3607
3663
|
}
|
|
3608
3664
|
);
|
|
3609
|
-
|
|
3665
|
+
registerTool(
|
|
3610
3666
|
"get_briefing",
|
|
3611
3667
|
[
|
|
3612
3668
|
"\u2B50 DEFAULT-FIRST for coding agents on any repo where `haive init` ran: call this BEFORE",
|
|
@@ -3657,7 +3713,7 @@ function createHaiveServer(options = {}) {
|
|
|
3657
3713
|
return jsonResult(await getBriefing(input, context));
|
|
3658
3714
|
}
|
|
3659
3715
|
);
|
|
3660
|
-
|
|
3716
|
+
registerTool(
|
|
3661
3717
|
"mem_search",
|
|
3662
3718
|
[
|
|
3663
3719
|
"Search memories by keyword or semantic similarity.",
|
|
@@ -3689,7 +3745,7 @@ function createHaiveServer(options = {}) {
|
|
|
3689
3745
|
return jsonResult(await memSearch(input, context));
|
|
3690
3746
|
}
|
|
3691
3747
|
);
|
|
3692
|
-
|
|
3748
|
+
registerTool(
|
|
3693
3749
|
"mem_timeline",
|
|
3694
3750
|
[
|
|
3695
3751
|
"Chronological view of related memories: by shared frontmatter.topic OR expanded from a seed id",
|
|
@@ -3705,7 +3761,7 @@ function createHaiveServer(options = {}) {
|
|
|
3705
3761
|
MemTimelineInputSchema,
|
|
3706
3762
|
async (input) => jsonResult(await memTimeline(input, context))
|
|
3707
3763
|
);
|
|
3708
|
-
|
|
3764
|
+
registerTool(
|
|
3709
3765
|
"mem_for_files",
|
|
3710
3766
|
[
|
|
3711
3767
|
"Surface memories relevant to the files you are currently editing.",
|
|
@@ -3729,7 +3785,7 @@ function createHaiveServer(options = {}) {
|
|
|
3729
3785
|
MemForFilesInputSchema,
|
|
3730
3786
|
async (input) => jsonResult(await memForFiles(input, context))
|
|
3731
3787
|
);
|
|
3732
|
-
|
|
3788
|
+
registerTool(
|
|
3733
3789
|
"mem_get",
|
|
3734
3790
|
[
|
|
3735
3791
|
"Fetch a single memory by its full id with all details.",
|
|
@@ -3745,7 +3801,7 @@ function createHaiveServer(options = {}) {
|
|
|
3745
3801
|
MemGetInputSchema,
|
|
3746
3802
|
async (input) => jsonResult(await memGet(input, context))
|
|
3747
3803
|
);
|
|
3748
|
-
|
|
3804
|
+
registerTool(
|
|
3749
3805
|
"mem_list",
|
|
3750
3806
|
[
|
|
3751
3807
|
"List memories with optional filters. Use for browsing, not for task onboarding.",
|
|
@@ -3765,7 +3821,7 @@ function createHaiveServer(options = {}) {
|
|
|
3765
3821
|
MemListInputSchema,
|
|
3766
3822
|
async (input) => jsonResult(await memList(input, context))
|
|
3767
3823
|
);
|
|
3768
|
-
|
|
3824
|
+
registerTool(
|
|
3769
3825
|
"get_project_context",
|
|
3770
3826
|
[
|
|
3771
3827
|
"Read .ai/project-context.md (and optionally a module context) directly.",
|
|
@@ -3783,7 +3839,7 @@ function createHaiveServer(options = {}) {
|
|
|
3783
3839
|
GetProjectContextInputSchema,
|
|
3784
3840
|
async (input) => jsonResult(await getProjectContext(input, context))
|
|
3785
3841
|
);
|
|
3786
|
-
|
|
3842
|
+
registerTool(
|
|
3787
3843
|
"bootstrap_project_save",
|
|
3788
3844
|
[
|
|
3789
3845
|
"Persist the project context document (.ai/project-context.md) or a module",
|
|
@@ -3801,7 +3857,7 @@ function createHaiveServer(options = {}) {
|
|
|
3801
3857
|
BootstrapProjectSaveInputSchema,
|
|
3802
3858
|
async (input) => jsonResult(await bootstrapProjectSave(input, context))
|
|
3803
3859
|
);
|
|
3804
|
-
|
|
3860
|
+
registerTool(
|
|
3805
3861
|
"code_map",
|
|
3806
3862
|
[
|
|
3807
3863
|
"Look up where symbols (classes, functions, interfaces) are defined in the codebase.",
|
|
@@ -3822,7 +3878,7 @@ function createHaiveServer(options = {}) {
|
|
|
3822
3878
|
CodeMapInputSchema,
|
|
3823
3879
|
async (input) => jsonResult(await codeMapTool(input, context))
|
|
3824
3880
|
);
|
|
3825
|
-
|
|
3881
|
+
registerTool(
|
|
3826
3882
|
"mem_resolve_project",
|
|
3827
3883
|
[
|
|
3828
3884
|
"Diagnostics: resolve which project root hAIve is using (never throws).",
|
|
@@ -3838,7 +3894,7 @@ function createHaiveServer(options = {}) {
|
|
|
3838
3894
|
MemResolveProjectInputSchema,
|
|
3839
3895
|
async (input) => jsonResult(await memResolveProject(input, context))
|
|
3840
3896
|
);
|
|
3841
|
-
|
|
3897
|
+
registerTool(
|
|
3842
3898
|
"mem_update",
|
|
3843
3899
|
[
|
|
3844
3900
|
"Update the body, tags, or anchor of an existing memory in-place.",
|
|
@@ -3861,7 +3917,7 @@ function createHaiveServer(options = {}) {
|
|
|
3861
3917
|
MemUpdateInputSchema,
|
|
3862
3918
|
async (input) => jsonResult(await memUpdate(input, context))
|
|
3863
3919
|
);
|
|
3864
|
-
|
|
3920
|
+
registerTool(
|
|
3865
3921
|
"mem_verify",
|
|
3866
3922
|
[
|
|
3867
3923
|
"Check whether memory anchor paths and symbols still exist in the current code.",
|
|
@@ -3880,7 +3936,7 @@ function createHaiveServer(options = {}) {
|
|
|
3880
3936
|
MemVerifyInputSchema,
|
|
3881
3937
|
async (input) => jsonResult(await memVerify(input, context))
|
|
3882
3938
|
);
|
|
3883
|
-
|
|
3939
|
+
registerTool(
|
|
3884
3940
|
"mem_approve",
|
|
3885
3941
|
[
|
|
3886
3942
|
"Mark a memory as validated (trusted, approved by a human or the team).",
|
|
@@ -3896,7 +3952,7 @@ function createHaiveServer(options = {}) {
|
|
|
3896
3952
|
MemApproveInputSchema,
|
|
3897
3953
|
async (input) => jsonResult(await memApprove(input, context))
|
|
3898
3954
|
);
|
|
3899
|
-
|
|
3955
|
+
registerTool(
|
|
3900
3956
|
"mem_reject",
|
|
3901
3957
|
[
|
|
3902
3958
|
"Mark a memory as rejected and record a reason.",
|
|
@@ -3914,7 +3970,7 @@ function createHaiveServer(options = {}) {
|
|
|
3914
3970
|
MemRejectInputSchema,
|
|
3915
3971
|
async (input) => jsonResult(await memReject(input, context))
|
|
3916
3972
|
);
|
|
3917
|
-
|
|
3973
|
+
registerTool(
|
|
3918
3974
|
"mem_pending",
|
|
3919
3975
|
[
|
|
3920
3976
|
"List memories in 'proposed' status awaiting review, sorted by read count.",
|
|
@@ -3930,7 +3986,7 @@ function createHaiveServer(options = {}) {
|
|
|
3930
3986
|
MemPendingInputSchema,
|
|
3931
3987
|
async (input) => jsonResult(await memPending(input, context))
|
|
3932
3988
|
);
|
|
3933
|
-
|
|
3989
|
+
registerTool(
|
|
3934
3990
|
"mem_delete",
|
|
3935
3991
|
[
|
|
3936
3992
|
"Permanently delete a memory by id.",
|
|
@@ -3947,7 +4003,7 @@ function createHaiveServer(options = {}) {
|
|
|
3947
4003
|
MemDeleteInputSchema,
|
|
3948
4004
|
async (input) => jsonResult(await memDelete(input, context))
|
|
3949
4005
|
);
|
|
3950
|
-
|
|
4006
|
+
registerTool(
|
|
3951
4007
|
"get_recap",
|
|
3952
4008
|
[
|
|
3953
4009
|
"Return ONLY the most recent session_recap. Cheaper than get_briefing when",
|
|
@@ -3965,7 +4021,7 @@ function createHaiveServer(options = {}) {
|
|
|
3965
4021
|
return jsonResult(await getRecap(input, context));
|
|
3966
4022
|
}
|
|
3967
4023
|
);
|
|
3968
|
-
|
|
4024
|
+
registerTool(
|
|
3969
4025
|
"mem_relevant_to",
|
|
3970
4026
|
[
|
|
3971
4027
|
"One-shot ranked memories for a task \u2014 use instead of get_briefing when",
|
|
@@ -3991,7 +4047,7 @@ function createHaiveServer(options = {}) {
|
|
|
3991
4047
|
return jsonResult(await memRelevantTo(input, context));
|
|
3992
4048
|
}
|
|
3993
4049
|
);
|
|
3994
|
-
|
|
4050
|
+
registerTool(
|
|
3995
4051
|
"code_search",
|
|
3996
4052
|
[
|
|
3997
4053
|
"Semantic search over the codebase \u2014 finds exported symbols (functions, classes,",
|
|
@@ -4014,7 +4070,7 @@ function createHaiveServer(options = {}) {
|
|
|
4014
4070
|
return jsonResult(await codeSearch(input, context));
|
|
4015
4071
|
}
|
|
4016
4072
|
);
|
|
4017
|
-
|
|
4073
|
+
registerTool(
|
|
4018
4074
|
"why_this_file",
|
|
4019
4075
|
[
|
|
4020
4076
|
"One-shot file-context lookup: combines recent git history, memories anchored",
|
|
@@ -4034,7 +4090,7 @@ function createHaiveServer(options = {}) {
|
|
|
4034
4090
|
return jsonResult(await whyThisFile(input, context));
|
|
4035
4091
|
}
|
|
4036
4092
|
);
|
|
4037
|
-
|
|
4093
|
+
registerTool(
|
|
4038
4094
|
"anti_patterns_check",
|
|
4039
4095
|
[
|
|
4040
4096
|
"Scan a diff (or set of paths) against documented attempt/gotcha memories.",
|
|
@@ -4057,7 +4113,7 @@ function createHaiveServer(options = {}) {
|
|
|
4057
4113
|
return jsonResult(await antiPatternsCheck(input, context));
|
|
4058
4114
|
}
|
|
4059
4115
|
);
|
|
4060
|
-
|
|
4116
|
+
registerTool(
|
|
4061
4117
|
"mem_distill",
|
|
4062
4118
|
[
|
|
4063
4119
|
"Cluster recurring observations / failed attempts so a human can collapse",
|
|
@@ -4082,7 +4138,7 @@ function createHaiveServer(options = {}) {
|
|
|
4082
4138
|
return jsonResult(await memDistill(input, context));
|
|
4083
4139
|
}
|
|
4084
4140
|
);
|
|
4085
|
-
|
|
4141
|
+
registerTool(
|
|
4086
4142
|
"why_this_decision",
|
|
4087
4143
|
[
|
|
4088
4144
|
"Trace the genealogy of a memory (especially decision/architecture):",
|
|
@@ -4104,7 +4160,7 @@ function createHaiveServer(options = {}) {
|
|
|
4104
4160
|
return jsonResult(await whyThisDecision(input, context));
|
|
4105
4161
|
}
|
|
4106
4162
|
);
|
|
4107
|
-
|
|
4163
|
+
registerTool(
|
|
4108
4164
|
"mem_conflicts_with",
|
|
4109
4165
|
[
|
|
4110
4166
|
"Detect memories that potentially CONTRADICT a given memory.",
|
|
@@ -4130,7 +4186,7 @@ function createHaiveServer(options = {}) {
|
|
|
4130
4186
|
return jsonResult(await memConflicts(input, context));
|
|
4131
4187
|
}
|
|
4132
4188
|
);
|
|
4133
|
-
|
|
4189
|
+
registerTool(
|
|
4134
4190
|
"mem_conflict_candidates",
|
|
4135
4191
|
[
|
|
4136
4192
|
"Bulk scan for conflict CANDIDATES (not proof):",
|
|
@@ -4151,7 +4207,7 @@ function createHaiveServer(options = {}) {
|
|
|
4151
4207
|
return jsonResult(await memConflictCandidates(input, context));
|
|
4152
4208
|
}
|
|
4153
4209
|
);
|
|
4154
|
-
|
|
4210
|
+
registerTool(
|
|
4155
4211
|
"runtime_journal_append",
|
|
4156
4212
|
[
|
|
4157
4213
|
"Append one line to `.ai/.runtime/session-journal.ndjson` \u2014 machine-local session continuity.",
|
|
@@ -4165,7 +4221,7 @@ function createHaiveServer(options = {}) {
|
|
|
4165
4221
|
RuntimeJournalAppendInputSchema,
|
|
4166
4222
|
async (input) => jsonResult(await runtimeJournalAppend(input, context))
|
|
4167
4223
|
);
|
|
4168
|
-
|
|
4224
|
+
registerTool(
|
|
4169
4225
|
"runtime_journal_tail",
|
|
4170
4226
|
[
|
|
4171
4227
|
"Read the last N entries from the runtime session journal (parsed JSON lines).",
|
|
@@ -4177,7 +4233,7 @@ function createHaiveServer(options = {}) {
|
|
|
4177
4233
|
RuntimeJournalTailInputSchema,
|
|
4178
4234
|
async (input) => jsonResult(await runtimeJournalTail(input, context))
|
|
4179
4235
|
);
|
|
4180
|
-
|
|
4236
|
+
registerTool(
|
|
4181
4237
|
"pre_commit_check",
|
|
4182
4238
|
[
|
|
4183
4239
|
"One-shot 'should I block this commit?' check. Combines three signals:",
|
|
@@ -4202,7 +4258,7 @@ function createHaiveServer(options = {}) {
|
|
|
4202
4258
|
return jsonResult(await preCommitCheck(input, context));
|
|
4203
4259
|
}
|
|
4204
4260
|
);
|
|
4205
|
-
|
|
4261
|
+
registerTool(
|
|
4206
4262
|
"pattern_detect",
|
|
4207
4263
|
[
|
|
4208
4264
|
"Heuristic memory detector \u2014 finds knowledge worth saving WITHOUT calling an LLM.",
|
|
@@ -4233,7 +4289,7 @@ function createHaiveServer(options = {}) {
|
|
|
4233
4289
|
return jsonResult(await patternDetect(input, context));
|
|
4234
4290
|
}
|
|
4235
4291
|
);
|
|
4236
|
-
|
|
4292
|
+
registerTool(
|
|
4237
4293
|
"mem_diff",
|
|
4238
4294
|
[
|
|
4239
4295
|
"Compare two memories side-by-side to decide if they should be merged.",
|
|
@@ -4250,40 +4306,46 @@ function createHaiveServer(options = {}) {
|
|
|
4250
4306
|
MemDiffInputSchema,
|
|
4251
4307
|
async (input) => jsonResult(await memDiff(input, context))
|
|
4252
4308
|
);
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
"
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
"
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4309
|
+
if (shouldRegisterPrompt("bootstrap_project")) {
|
|
4310
|
+
server.prompt(
|
|
4311
|
+
"bootstrap_project",
|
|
4312
|
+
[
|
|
4313
|
+
"Analyze the project codebase and write .ai/project-context.md \u2014 run once after haive init.",
|
|
4314
|
+
"The AI explores the directory structure, reads key files (package.json, README, config),",
|
|
4315
|
+
"identifies the tech stack, architectural patterns, key modules, and conventions,",
|
|
4316
|
+
"then persists everything via bootstrap_project_save.",
|
|
4317
|
+
"For multi-component projects, run with module param to create .ai/modules/<name>/context.md."
|
|
4318
|
+
].join(" "),
|
|
4319
|
+
BootstrapProjectArgsSchema,
|
|
4320
|
+
(args) => bootstrapProjectPrompt(args, context)
|
|
4321
|
+
);
|
|
4322
|
+
}
|
|
4323
|
+
if (shouldRegisterPrompt("post_task")) {
|
|
4324
|
+
server.prompt(
|
|
4325
|
+
"post_task",
|
|
4326
|
+
[
|
|
4327
|
+
"\u2B50 Post-task reflection \u2014 run at the end of every session to capture what you learned:",
|
|
4328
|
+
"failed approaches (mem_tried), new conventions/decisions/gotchas (mem_save),",
|
|
4329
|
+
"code discoveries (mem_observe), and an end-of-session recap (mem_session_end).",
|
|
4330
|
+
"In autopilot mode a minimal recap saves automatically; calling this produces a richer one."
|
|
4331
|
+
].join(" "),
|
|
4332
|
+
PostTaskArgsSchema,
|
|
4333
|
+
(args) => postTaskPrompt(args, context)
|
|
4334
|
+
);
|
|
4335
|
+
}
|
|
4336
|
+
if (shouldRegisterPrompt("import_docs")) {
|
|
4337
|
+
server.prompt(
|
|
4338
|
+
"import_docs",
|
|
4339
|
+
[
|
|
4340
|
+
"Import knowledge from a document (README, ADR, wiki, API spec) as hAIve memories.",
|
|
4341
|
+
"Pass the full document content; the AI extracts up to 10 actionable memories",
|
|
4342
|
+
"(conventions, decisions, gotchas, architecture) and saves them via mem_save.",
|
|
4343
|
+
"Good candidates: ADRs, onboarding docs, runbooks, team wikis."
|
|
4344
|
+
].join(" "),
|
|
4345
|
+
ImportDocsArgsSchema,
|
|
4346
|
+
(args) => importDocsPrompt(args, context)
|
|
4347
|
+
);
|
|
4348
|
+
}
|
|
4287
4349
|
return { server, context, tracker };
|
|
4288
4350
|
}
|
|
4289
4351
|
function parseMcpCliArgs(argv) {
|
|
@@ -4308,7 +4370,7 @@ function printHaiveMcpVersion() {
|
|
|
4308
4370
|
console.log(SERVER_VERSION);
|
|
4309
4371
|
}
|
|
4310
4372
|
async function runHaiveMcpStdio(options) {
|
|
4311
|
-
const { server, context } = createHaiveServer({ root: options.root });
|
|
4373
|
+
const { server, context } = createHaiveServer({ root: options.root, env: process.env });
|
|
4312
4374
|
console.error(
|
|
4313
4375
|
`[haive-mcp] starting server v${SERVER_VERSION} (project root: ${context.paths.root})`
|
|
4314
4376
|
);
|