Skip to content

Local-first 🧠 memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.

TypeScript

fix: keep full MCP status output and normalize codegraph paths (#116)

Khang Nguyenb8d709ee95b9
diff --git a/src/core/partner/codegraph-report.ts b/src/core/partner/codegraph-report.ts
index ec4074e1..695a7a3c 100644
--- a/src/core/partner/codegraph-report.ts
+++ b/src/core/partner/codegraph-report.ts
@@ -14,7 +14,7 @@
* errors and not silent no-ops.
*/
-import { existsSync, readFileSync } from "node:fs";
+import { existsSync, readFileSync, realpathSync } from "node:fs";
import { join } from "node:path";
import {
@@ -238,7 +238,7 @@ export function buildCodegraphReport(
return {
schema_version: 1,
- project,
+ project: displayPath(project),
cli,
index,
cargo_workspace: cargo.workspace,
@@ -246,6 +246,24 @@ export function buildCodegraphReport(
};
}
+/**
+ * Canonicalize the reported project path so it matches the shape callers
+ * already hold. On macOS `/var` is a symlink to `/private/var`, so
+ * `realpathSync` resolves temp roots (Node's `tmpdir()` -> `/var/folders/...`)
+ * to `/private/var/...`; stripping the `/private` prefix restores the
+ * user-facing `/var/...` form. The narrow prefix is deliberate - only the
+ * `/var` firmlink is rewritten this way, never an arbitrary `/private/*` path.
+ * Display-only: index resolution above runs against the raw `project`.
+ */
+function displayPath(path: string): string {
+ try {
+ const real = realpathSync(path);
+ return real.startsWith("/private/var/") ? real.slice("/private".length) : real;
+ } catch {
+ return path.startsWith("/private/var/") ? path.slice("/private".length) : path;
+ }
+}
+
function resolveIndexState(
project: string,
cliPath: string | null,
diff --git a/src/mcp/registry-guard.ts b/src/mcp/registry-guard.ts
index cb9a6ae7..0dcdcd63 100644
--- a/src/mcp/registry-guard.ts
+++ b/src/mcp/registry-guard.ts
@@ -98,6 +98,8 @@ export const PREVIEW_BUDGET_EXEMPT: Readonly<Record<string, string>> = Object.fr
// Bounded-by-construction reads.
second_brain_capabilities: "fixed-size capability report",
+ second_brain_status:
+ "diagnostic contract; callers need full brain/search/config blocks, not a preview envelope",
brain_context:
"session bootstrap; deliberately returns the full preference set - it is the full-view target the budgeted SessionStart injection points at",
brain_pre_compress_pack: "self-budgeting; enforces its own char budget internally",
diff --git a/src/mcp/tools.ts b/src/mcp/tools.ts
index 749abcd4..4b751369 100644
--- a/src/mcp/tools.ts
+++ b/src/mcp/tools.ts
@@ -347,7 +347,13 @@ export function buildToolTable(scope: ToolScope = "full"): ToolDefinition[] {
properties: {},
additionalProperties: false,
},
- previewBudget: MCP_PREVIEW_BUDGET,
+ // No previewBudget: a vault with an indexed search and a populated
+ // Brain layer easily exceeds the default MCP preview cap, and
+ // the `search.*` / `brain.*` blocks are the whole point of the
+ // tool. Without this override, large payloads came back wrapped
+ // in a `{ preview_truncated, artifact_id, bytes_preview }`
+ // envelope — tests parsing `content[0].text` as JSON then lost
+ // every block the operator asked for.
handler: toolStatus,
},
{