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