@hiveai/mcp 0.3.2 → 0.4.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/dist/server.js CHANGED
@@ -1914,7 +1914,7 @@ function summarizeTools(events) {
1914
1914
 
1915
1915
  // src/server.ts
1916
1916
  var SERVER_NAME = "haive";
1917
- var SERVER_VERSION = "0.3.2";
1917
+ var SERVER_VERSION = "0.3.3";
1918
1918
  function jsonResult(data) {
1919
1919
  return {
1920
1920
  content: [
@@ -1935,7 +1935,30 @@ function createHaiveServer(options = {}) {
1935
1935
  );
1936
1936
  server.tool(
1937
1937
  "mem_save",
1938
- "Save a new memory (convention, decision, gotcha, architecture, glossary). For failed approaches use mem_tried instead \u2014 it enforces a structured format that is more useful to future agents. Use scope=team to share with the whole team.",
1938
+ [
1939
+ "Save a piece of knowledge as a persistent memory that survives across AI sessions.",
1940
+ "",
1941
+ "USE THIS WHEN you discover something worth remembering for future sessions:",
1942
+ " - A project convention (how things are done here)",
1943
+ " - An architectural decision and its rationale",
1944
+ " - A gotcha or non-obvious behavior that surprised you",
1945
+ " - A domain term and what it means in this codebase",
1946
+ "",
1947
+ "DO NOT USE for failed approaches \u2192 use mem_tried instead (better structure).",
1948
+ "DO NOT USE for code discoveries during exploration \u2192 use mem_observe instead.",
1949
+ "",
1950
+ "PARAMETERS:",
1951
+ " type \u2014 convention | decision | gotcha | architecture | glossary | attempt",
1952
+ " slug \u2014 short kebab-case id (e.g. 'flyway-no-modify-existing')",
1953
+ " body \u2014 Markdown content with the full knowledge",
1954
+ " scope \u2014 team (shared with all devs) | personal (private) | module (component-scoped)",
1955
+ " paths \u2014 anchor to source files for staleness detection (STRONGLY recommended)",
1956
+ " topic \u2014 stable key for upsert: if a memory with same topic+scope exists, update it in-place",
1957
+ "",
1958
+ "RETURNS: { id, scope, file_path, action: 'created'|'updated', warning?, invalid_paths? }",
1959
+ "WARNING: if paths point to non-existent files, they will be immediately stale after haive sync.",
1960
+ "DEDUP: identical body content within the same scope is rejected \u2014 use mem_update to modify."
1961
+ ].join("\n"),
1939
1962
  MemSaveInputSchema,
1940
1963
  async (input) => {
1941
1964
  tracker.record("mem_save", input.slug);
@@ -1943,26 +1966,125 @@ function createHaiveServer(options = {}) {
1943
1966
  }
1944
1967
  );
1945
1968
  server.tool(
1946
- "mem_search",
1947
- "Search memories by substring across id, tags, and body. Optional filters by scope/type/module.",
1948
- MemSearchInputSchema,
1949
- async (input) => jsonResult(await memSearch(input, context))
1969
+ "mem_tried",
1970
+ [
1971
+ "Record a FAILED approach so future agents don't repeat the same mistake.",
1972
+ "",
1973
+ "USE THIS IMMEDIATELY when you try something and it doesn't work. This is the",
1974
+ "most valuable type of negative knowledge \u2014 it saves hours of debugging for",
1975
+ "future agents working on the same codebase.",
1976
+ "",
1977
+ "Auto-validated (no approval cycle). Surfaced FIRST in future get_briefing calls",
1978
+ "so it's impossible to miss.",
1979
+ "",
1980
+ "PARAMETERS:",
1981
+ " what \u2014 short title of what you tried (e.g. 'importing X with ESM dynamic import')",
1982
+ " why_failed \u2014 the exact error or reason it failed",
1983
+ " instead \u2014 what to do instead (the correct approach)",
1984
+ " scope \u2014 team (default) | personal",
1985
+ " paths \u2014 source files where the issue lives",
1986
+ "",
1987
+ "RETURNS: { id, file_path, action: 'created' }"
1988
+ ].join("\n"),
1989
+ MemTriedInputSchema,
1990
+ async (input) => {
1991
+ tracker.record("mem_tried", input.what.slice(0, 80));
1992
+ return jsonResult(await memTried(input, context));
1993
+ }
1950
1994
  );
1951
1995
  server.tool(
1952
- "mem_list",
1953
- "List memories with optional filters by scope/type/module/tag.",
1954
- MemListInputSchema,
1955
- async (input) => jsonResult(await memList(input, context))
1996
+ "mem_observe",
1997
+ [
1998
+ "Capture a code-level discovery made WHILE READING existing code.",
1999
+ "",
2000
+ "USE THIS when you read a file and spot something the team may not know about:",
2001
+ " - A bug or race condition hiding in the code",
2002
+ " - A security gap or missing validation",
2003
+ " - An inconsistency between two files",
2004
+ " - A missing configuration or environment variable",
2005
+ " - Anything that could silently break in production",
2006
+ "",
2007
+ "DIFFERENCE from mem_save: mem_observe is for REACTIVE discoveries during code",
2008
+ "reading. mem_save is for deliberate knowledge capture (conventions, decisions).",
2009
+ "",
2010
+ "Auto-validated, anchored to file paths for staleness detection.",
2011
+ "",
2012
+ "PARAMETERS:",
2013
+ " what \u2014 one-line title (e.g. 'MobilePaymentController: duplicate @RequestBody')",
2014
+ " where \u2014 file path(s) where the issue lives",
2015
+ " impact \u2014 what breaks or could break because of this",
2016
+ " fix \u2014 suggested fix (optional)",
2017
+ " scope \u2014 team (default, since discoveries benefit everyone)",
2018
+ "",
2019
+ "RETURNS: { id, file_path }"
2020
+ ].join("\n"),
2021
+ MemObserveInputSchema,
2022
+ async (input) => {
2023
+ tracker.record("mem_observe", input.where);
2024
+ return jsonResult(await memObserve(input, context));
2025
+ }
1956
2026
  );
1957
2027
  server.tool(
1958
- "get_project_context",
1959
- "Read the shared .ai/project-context.md (and optionally a module context).",
1960
- GetProjectContextInputSchema,
1961
- async (input) => jsonResult(await getProjectContext(input, context))
2028
+ "mem_session_end",
2029
+ [
2030
+ "Save an end-of-session recap so the NEXT session starts with fresh context.",
2031
+ "",
2032
+ "CALL THIS before closing any significant working session. In autopilot mode,",
2033
+ "the MCP server saves a minimal recap automatically on exit \u2014 but calling this",
2034
+ "manually produces a richer, more useful recap.",
2035
+ "",
2036
+ "HOW IT WORKS: uses topic-upsert \u2014 one recap per scope is kept and updated",
2037
+ "in-place (revision_count increments). get_briefing surfaces the latest recap",
2038
+ "at the very top of the next session's briefing, before project context.",
2039
+ "",
2040
+ "PARAMETERS:",
2041
+ " goal \u2014 what you were trying to accomplish (1\u20132 sentences)",
2042
+ " accomplished \u2014 what was actually done (bullet list recommended)",
2043
+ " discoveries \u2014 bugs, surprises, missing knowledge found during this session",
2044
+ " files_touched \u2014 key files read or modified (used as anchor for staleness)",
2045
+ " next_steps \u2014 what should happen in the next session or for a teammate",
2046
+ " scope \u2014 personal (default) | team",
2047
+ "",
2048
+ "RETURNS: { id, scope, action: 'created'|'updated', revision_count }"
2049
+ ].join("\n"),
2050
+ MemSessionEndInputSchema,
2051
+ async (input) => {
2052
+ tracker.record("mem_session_end", input.goal.slice(0, 80));
2053
+ return jsonResult(await memSessionEnd(input, context));
2054
+ }
1962
2055
  );
1963
2056
  server.tool(
1964
2057
  "get_briefing",
1965
- "One-shot onboarding: returns project context + module contexts + ranked relevant memories under a token budget. Replaces 4\u20135 separate calls when an agent starts a task.",
2058
+ [
2059
+ "\u2B50 CALL THIS FIRST at the start of every task. One-shot onboarding that returns",
2060
+ "everything relevant in a single call under a token budget.",
2061
+ "",
2062
+ "RETURNS (in order of priority):",
2063
+ " 1. last_session \u2014 recap of the previous session (goal, what was done, next steps)",
2064
+ " 2. project_context \u2014 .ai/project-context.md (auto-generated from code-map if template)",
2065
+ " 3. module_contexts \u2014 relevant .ai/modules/<name>/context.md based on files being edited",
2066
+ " 4. memories \u2014 ranked team memories relevant to your task",
2067
+ " 5. symbol_locations \u2014 file:line:kind for any requested symbols (no grep needed)",
2068
+ " 6. setup_warnings \u2014 actionable warnings if setup is incomplete",
2069
+ " 7. decay_warnings \u2014 memories not read in >90 days (consider reviewing)",
2070
+ "",
2071
+ "KEY PARAMETERS:",
2072
+ " task \u2014 what you are about to do (1\u20132 sentences) \u2014 ALWAYS provide this",
2073
+ " files \u2014 files you are about to edit \u2014 surfaces anchored memories",
2074
+ " symbols \u2014 symbol names to look up in the code-map (e.g. ['PaymentService'])",
2075
+ " format \u2014 'full' (default) | 'compact' (1-line summaries, use when token budget is tight)",
2076
+ "",
2077
+ "EXAMPLE USAGE:",
2078
+ " get_briefing({ task: 'add a Stripe payment integration', files: ['src/payments/'], symbols: ['PaymentService'] })",
2079
+ "",
2080
+ "CONFIDENCE LEVELS in memories:",
2081
+ " authoritative \u2014 validated + read 10+ times (highest trust)",
2082
+ " trusted \u2014 validated or proposed + read 3+ times",
2083
+ " low \u2014 proposed, few reads (take with caution)",
2084
+ " unverified \u2014 draft (unverified: true flag set)",
2085
+ "",
2086
+ "Replaces 4\u20135 separate tool calls. Always call this before any other tool."
2087
+ ].join("\n"),
1966
2088
  GetBriefingInputSchema,
1967
2089
  async (input) => {
1968
2090
  tracker.record("get_briefing", input.task ?? "");
@@ -1970,113 +2092,305 @@ function createHaiveServer(options = {}) {
1970
2092
  }
1971
2093
  );
1972
2094
  server.tool(
1973
- "code_map",
1974
- "Browse the project's pre-computed code map (file \u2192 exports + 1-line description) instead of grepping. Requires `haive index code`.",
1975
- CodeMapInputSchema,
1976
- async (input) => jsonResult(await codeMapTool(input, context))
1977
- );
1978
- server.tool(
1979
- "bootstrap_project_save",
1980
- "Persist a project (or module) context document analyzed by the AI client.",
1981
- BootstrapProjectSaveInputSchema,
1982
- async (input) => jsonResult(await bootstrapProjectSave(input, context))
1983
- );
1984
- server.tool(
1985
- "mem_verify",
1986
- "Check anchor freshness for one or every memory; optionally write status updates back to disk.",
1987
- MemVerifyInputSchema,
1988
- async (input) => jsonResult(await memVerify(input, context))
1989
- );
1990
- server.tool(
1991
- "mem_reject",
1992
- "Record a rejection for a memory (blocks auto-promotion and lowers its trust signal).",
1993
- MemRejectInputSchema,
1994
- async (input) => jsonResult(await memReject(input, context))
2095
+ "mem_search",
2096
+ [
2097
+ "Search memories by keyword or semantic similarity.",
2098
+ "",
2099
+ "USE WHEN you need to find a specific memory and don't know its id.",
2100
+ "For session onboarding, use get_briefing instead (richer, ranked, budgeted).",
2101
+ "",
2102
+ "SEARCH MODES:",
2103
+ " Literal (default): AND search across id, tags, and body \u2014 all tokens must match.",
2104
+ " Falls back to OR automatically if no AND results (partial match).",
2105
+ " Semantic (semantic: true): embedding-based similarity \u2014 finds related memories",
2106
+ " even with different wording. Requires haive embeddings index to be built.",
2107
+ "",
2108
+ "PARAMETERS:",
2109
+ " query \u2014 search terms or natural language question",
2110
+ " scope \u2014 filter by personal | team | module",
2111
+ " type \u2014 filter by convention | decision | gotcha | architecture | glossary",
2112
+ " semantic \u2014 true for embedding-based search (requires @hiveai/embeddings)",
2113
+ " limit \u2014 max results (default 10)",
2114
+ "",
2115
+ "RETURNS: array of { id, type, scope, status, confidence, body, match_quality }"
2116
+ ].join("\n"),
2117
+ MemSearchInputSchema,
2118
+ async (input) => jsonResult(await memSearch(input, context))
1995
2119
  );
1996
2120
  server.tool(
1997
2121
  "mem_for_files",
1998
- "Given the file paths the agent is currently working on, return relevant memories grouped by reason (anchor overlap, module, domain) plus any matching .ai/modules/<name>/context.md contents.",
2122
+ [
2123
+ "Surface memories relevant to the files you are currently editing.",
2124
+ "",
2125
+ "USE WHEN starting work on specific files and you want to know:",
2126
+ " - What conventions apply to these files",
2127
+ " - What gotchas are anchored to these paths",
2128
+ " - What decisions were made about this module",
2129
+ "",
2130
+ "Matching strategy (in priority order):",
2131
+ " 1. Anchor overlap \u2014 memories whose paths overlap with your files",
2132
+ " 2. Module context \u2014 .ai/modules/<name>/context.md if module is inferred",
2133
+ " 3. Domain/tag match \u2014 memories whose tags include path segments",
2134
+ "",
2135
+ "PARAMETERS:",
2136
+ " files \u2014 list of project-relative file paths you are editing",
2137
+ " scope \u2014 filter by scope (default: all)",
2138
+ "",
2139
+ "RETURNS: { memories: [...], module_contexts: [...] }"
2140
+ ].join("\n"),
1999
2141
  MemForFilesInputSchema,
2000
2142
  async (input) => jsonResult(await memForFiles(input, context))
2001
2143
  );
2002
2144
  server.tool(
2003
2145
  "mem_get",
2004
- "Fetch a single memory by id, including its body, anchor, usage, and confidence.",
2146
+ [
2147
+ "Fetch a single memory by its full id with all details.",
2148
+ "",
2149
+ "USE WHEN get_briefing returned a memory in 'compact' format and you need",
2150
+ "the full body, or when you know the exact id of a memory.",
2151
+ "",
2152
+ "PARAMETERS:",
2153
+ " id \u2014 full memory id (e.g. '2026-04-28-gotcha-flyway-strict-no-ddl')",
2154
+ "",
2155
+ "RETURNS: { id, type, scope, status, confidence, body, anchor, tags, usage }"
2156
+ ].join("\n"),
2005
2157
  MemGetInputSchema,
2006
2158
  async (input) => jsonResult(await memGet(input, context))
2007
2159
  );
2008
2160
  server.tool(
2009
- "mem_delete",
2010
- "Delete a memory by id (and its usage entry by default).",
2011
- MemDeleteInputSchema,
2012
- async (input) => jsonResult(await memDelete(input, context))
2161
+ "mem_list",
2162
+ [
2163
+ "List memories with optional filters. Use for browsing, not for task onboarding.",
2164
+ "",
2165
+ "For task onboarding use get_briefing (ranked + budgeted).",
2166
+ "For keyword search use mem_search.",
2167
+ "",
2168
+ "PARAMETERS:",
2169
+ " scope \u2014 personal | team | module",
2170
+ " type \u2014 convention | decision | gotcha | architecture | glossary",
2171
+ " status \u2014 draft | proposed | validated | stale | rejected",
2172
+ " tags \u2014 filter by tags (AND match)",
2173
+ " module \u2014 filter by module name",
2174
+ "",
2175
+ "RETURNS: array of { id, type, scope, status, confidence, tags, created_at }"
2176
+ ].join("\n"),
2177
+ MemListInputSchema,
2178
+ async (input) => jsonResult(await memList(input, context))
2179
+ );
2180
+ server.tool(
2181
+ "get_project_context",
2182
+ [
2183
+ "Read .ai/project-context.md (and optionally a module context) directly.",
2184
+ "",
2185
+ "USE WHEN you need the full project context without the memory ranking and",
2186
+ "token budgeting of get_briefing \u2014 e.g. for a reference architecture review.",
2187
+ "",
2188
+ "For normal task onboarding, use get_briefing instead (more efficient).",
2189
+ "",
2190
+ "PARAMETERS:",
2191
+ " module \u2014 also load .ai/modules/<module>/context.md if provided",
2192
+ "",
2193
+ "RETURNS: { content: string, module_context?: string }"
2194
+ ].join("\n"),
2195
+ GetProjectContextInputSchema,
2196
+ async (input) => jsonResult(await getProjectContext(input, context))
2197
+ );
2198
+ server.tool(
2199
+ "bootstrap_project_save",
2200
+ [
2201
+ "Persist the project context document (.ai/project-context.md) or a module",
2202
+ "context (.ai/modules/<name>/context.md) analyzed by the AI.",
2203
+ "",
2204
+ "USE AFTER the bootstrap_project MCP prompt: the prompt tells you how to",
2205
+ "analyze the codebase; this tool saves the result.",
2206
+ "",
2207
+ "PARAMETERS:",
2208
+ " content \u2014 full Markdown content of the context document",
2209
+ " module \u2014 if provided, saves as a module context (not root project context)",
2210
+ "",
2211
+ "RETURNS: { file_path, module? }"
2212
+ ].join("\n"),
2213
+ BootstrapProjectSaveInputSchema,
2214
+ async (input) => jsonResult(await bootstrapProjectSave(input, context))
2215
+ );
2216
+ server.tool(
2217
+ "code_map",
2218
+ [
2219
+ "Look up where symbols (classes, functions, interfaces) are defined in the codebase.",
2220
+ "",
2221
+ "USE INSTEAD OF grepping when you need to find where something lives.",
2222
+ "Requires haive index code to have been run (done automatically in autopilot mode).",
2223
+ "",
2224
+ "TIP: include symbols in get_briefing directly for auto-lookup at session start.",
2225
+ "",
2226
+ "PARAMETERS:",
2227
+ " symbol \u2014 name or partial name to search (e.g. 'PaymentService')",
2228
+ " file \u2014 filter by file path substring",
2229
+ " max_files \u2014 cap on results (default 40)",
2230
+ "",
2231
+ "RETURNS: { available: bool, files: [{ path, exports: [{ name, kind, line, description }] }] }",
2232
+ "If available: false \u2192 run haive index code first."
2233
+ ].join("\n"),
2234
+ CodeMapInputSchema,
2235
+ async (input) => jsonResult(await codeMapTool(input, context))
2013
2236
  );
2014
2237
  server.tool(
2015
2238
  "mem_update",
2016
- "Update the body, tags, or anchor of an existing memory without changing its id or losing usage history.",
2239
+ [
2240
+ "Update the body, tags, or anchor of an existing memory in-place.",
2241
+ "",
2242
+ "USE WHEN a memory exists but its content has become outdated or incomplete.",
2243
+ "This preserves the memory's id, usage history, and read_count.",
2244
+ "",
2245
+ "For evolving memories that you will update repeatedly, use mem_save with a",
2246
+ "topic key instead (topic-upsert pattern).",
2247
+ "",
2248
+ "PARAMETERS:",
2249
+ " id \u2014 full memory id to update",
2250
+ " body \u2014 new Markdown content (replaces existing body)",
2251
+ " tags \u2014 new tag list (replaces existing tags)",
2252
+ " paths \u2014 new anchor paths (replaces existing paths)",
2253
+ " symbols \u2014 new anchor symbols (replaces existing symbols)",
2254
+ "",
2255
+ "RETURNS: { id, file_path, updated_fields: string[] }"
2256
+ ].join("\n"),
2017
2257
  MemUpdateInputSchema,
2018
2258
  async (input) => jsonResult(await memUpdate(input, context))
2019
2259
  );
2020
2260
  server.tool(
2021
- "mem_pending",
2022
- "List 'proposed' memories awaiting review, sorted by reads (most-read first).",
2023
- MemPendingInputSchema,
2024
- async (input) => jsonResult(await memPending(input, context))
2261
+ "mem_verify",
2262
+ [
2263
+ "Check whether memory anchor paths and symbols still exist in the current code.",
2264
+ "",
2265
+ "USE WHEN you want to know if a specific memory is still valid after a refactor,",
2266
+ "or to check all memories for staleness (haive sync does this automatically).",
2267
+ "",
2268
+ "PARAMETERS:",
2269
+ " id \u2014 check a single memory (omit to check all)",
2270
+ " update \u2014 write 'stale' or 'validated' status back to disk",
2271
+ "",
2272
+ "RETURNS: { results: [{ id, status: 'fresh'|'stale'|'anchorless', reason? }] }",
2273
+ "Stale means the anchored file/symbol no longer exists at that path.",
2274
+ "Anchorless means the memory has no paths/symbols \u2014 staleness is undetectable."
2275
+ ].join("\n"),
2276
+ MemVerifyInputSchema,
2277
+ async (input) => jsonResult(await memVerify(input, context))
2025
2278
  );
2026
2279
  server.tool(
2027
2280
  "mem_approve",
2028
- "Mark a memory as validated immediately (explicit team review).",
2281
+ [
2282
+ "Mark a memory as validated (trusted, approved by a human or the team).",
2283
+ "",
2284
+ "In autopilot mode, memories are validated automatically \u2014 you rarely need this.",
2285
+ "In manual mode, call this after reviewing a proposed memory to activate it.",
2286
+ "",
2287
+ "PARAMETERS:",
2288
+ " id \u2014 full memory id to approve",
2289
+ "",
2290
+ "RETURNS: { id, previous_status, new_status: 'validated' }"
2291
+ ].join("\n"),
2029
2292
  MemApproveInputSchema,
2030
2293
  async (input) => jsonResult(await memApprove(input, context))
2031
2294
  );
2032
2295
  server.tool(
2033
- "mem_tried",
2034
- "Preferred way to record a failed approach. Enforces a structured what/why_failed/instead format that is immediately actionable for future agents. Auto-validated (no approval cycle). Use whenever you tried an approach and it failed \u2014 prevents the same mistake from happening in the next session.",
2035
- MemTriedInputSchema,
2036
- async (input) => {
2037
- tracker.record("mem_tried", input.what.slice(0, 80));
2038
- return jsonResult(await memTried(input, context));
2039
- }
2296
+ "mem_reject",
2297
+ [
2298
+ "Mark a memory as rejected and record a reason.",
2299
+ "",
2300
+ "USE WHEN a memory is factually wrong, outdated, or not useful.",
2301
+ "Rejection blocks auto-promotion and lowers the memory's trust signal.",
2302
+ "Rejected memories are excluded from get_briefing by default.",
2303
+ "",
2304
+ "PARAMETERS:",
2305
+ " id \u2014 full memory id to reject",
2306
+ " reason \u2014 why this memory is being rejected (stored in frontmatter)",
2307
+ "",
2308
+ "RETURNS: { id, previous_status, new_status: 'rejected' }"
2309
+ ].join("\n"),
2310
+ MemRejectInputSchema,
2311
+ async (input) => jsonResult(await memReject(input, context))
2040
2312
  );
2041
2313
  server.tool(
2042
- "mem_diff",
2043
- "Compare two memories side-by-side: shows frontmatter fields that differ and lines unique to each body. Useful before merging or deduplicating memories.",
2044
- MemDiffInputSchema,
2045
- async (input) => jsonResult(await memDiff(input, context))
2314
+ "mem_pending",
2315
+ [
2316
+ "List memories in 'proposed' status awaiting review, sorted by read count.",
2317
+ "",
2318
+ "USE IN MANUAL MODE to see what memories are waiting for human review.",
2319
+ "In autopilot mode, proposed memories auto-approve after 72h.",
2320
+ "",
2321
+ "High read_count on a proposed memory = many agents found it useful without",
2322
+ "rejecting it = strong signal to approve.",
2323
+ "",
2324
+ "RETURNS: array of { id, type, scope, read_count, created_at, body_preview }"
2325
+ ].join("\n"),
2326
+ MemPendingInputSchema,
2327
+ async (input) => jsonResult(await memPending(input, context))
2046
2328
  );
2047
2329
  server.tool(
2048
- "mem_observe",
2049
- "Capture a code-level discovery made during exploration: a bug, inconsistency, missing config, or security gap found by reading existing code that was NOT in the briefing. Use this whenever you read code and spot something that could silently break in production. Auto-validated, anchored to file paths for staleness detection. Prefer this over mem_save for reactive discoveries during code reading.",
2050
- MemObserveInputSchema,
2051
- async (input) => {
2052
- tracker.record("mem_observe", input.where);
2053
- return jsonResult(await memObserve(input, context));
2054
- }
2330
+ "mem_delete",
2331
+ [
2332
+ "Permanently delete a memory by id.",
2333
+ "",
2334
+ "USE WITH CAUTION \u2014 prefer mem_reject for outdated memories (preserves history).",
2335
+ "Use delete only for accidentally created memories or duplicates.",
2336
+ "",
2337
+ "PARAMETERS:",
2338
+ " id \u2014 full memory id to delete",
2339
+ " delete_usage \u2014 also delete usage stats (default: true)",
2340
+ "",
2341
+ "RETURNS: { deleted: true, id }"
2342
+ ].join("\n"),
2343
+ MemDeleteInputSchema,
2344
+ async (input) => jsonResult(await memDelete(input, context))
2055
2345
  );
2056
2346
  server.tool(
2057
- "mem_session_end",
2058
- "Save a structured end-of-session recap (goal / accomplished / discoveries / next steps). Uses topic-upsert: one recap per scope is kept and updated in-place so the next session always has fresh context. Call this before closing every significant session. get_briefing automatically surfaces the latest recap at the top of the next session's briefing.",
2059
- MemSessionEndInputSchema,
2060
- async (input) => {
2061
- tracker.record("mem_session_end", input.goal.slice(0, 80));
2062
- return jsonResult(await memSessionEnd(input, context));
2063
- }
2347
+ "mem_diff",
2348
+ [
2349
+ "Compare two memories side-by-side to decide if they should be merged.",
2350
+ "",
2351
+ "USE BEFORE merging or deduplicating similar memories.",
2352
+ "Shows: frontmatter fields that differ + lines unique to each body.",
2353
+ "",
2354
+ "PARAMETERS:",
2355
+ " id_a \u2014 first memory id",
2356
+ " id_b \u2014 second memory id",
2357
+ "",
2358
+ "RETURNS: { frontmatter_diff: {...}, body_only_in_a: [...], body_only_in_b: [...] }"
2359
+ ].join("\n"),
2360
+ MemDiffInputSchema,
2361
+ async (input) => jsonResult(await memDiff(input, context))
2064
2362
  );
2065
2363
  server.prompt(
2066
2364
  "bootstrap_project",
2067
- "Instructions for the AI client to analyze the project and save the context.",
2365
+ [
2366
+ "Analyze the project codebase and write .ai/project-context.md \u2014 run once after haive init.",
2367
+ "The AI explores the directory structure, reads key files (package.json, README, config),",
2368
+ "identifies the tech stack, architectural patterns, key modules, and conventions,",
2369
+ "then persists everything via bootstrap_project_save.",
2370
+ "For multi-component projects, run with module param to create .ai/modules/<name>/context.md."
2371
+ ].join(" "),
2068
2372
  BootstrapProjectArgsSchema,
2069
2373
  (args) => bootstrapProjectPrompt(args, context)
2070
2374
  );
2071
2375
  server.prompt(
2072
2376
  "post_task",
2073
- "Post-task checklist: run this after completing a task to capture failed approaches, new conventions, decisions, and gotchas before closing the session.",
2377
+ [
2378
+ "\u2B50 Post-task reflection \u2014 run at the end of every session to capture what you learned:",
2379
+ "failed approaches (mem_tried), new conventions/decisions/gotchas (mem_save),",
2380
+ "code discoveries (mem_observe), and an end-of-session recap (mem_session_end).",
2381
+ "In autopilot mode a minimal recap saves automatically; calling this produces a richer one."
2382
+ ].join(" "),
2074
2383
  PostTaskArgsSchema,
2075
2384
  (args) => postTaskPrompt(args, context)
2076
2385
  );
2077
2386
  server.prompt(
2078
2387
  "import_docs",
2079
- "Analyze documentation (README, ADR, wiki page, etc.) and save the actionable knowledge as hAIve memories. Pass the content and an optional source/scope.",
2388
+ [
2389
+ "Import knowledge from a document (README, ADR, wiki, API spec) as hAIve memories.",
2390
+ "Pass the full document content; the AI extracts up to 10 actionable memories",
2391
+ "(conventions, decisions, gotchas, architecture) and saves them via mem_save.",
2392
+ "Good candidates: ADRs, onboarding docs, runbooks, team wikis."
2393
+ ].join(" "),
2080
2394
  ImportDocsArgsSchema,
2081
2395
  (args) => importDocsPrompt(args, context)
2082
2396
  );