rohitg00/agentmemory · info
${config.displayName} hooks skipped: ${hookResult.reason}.
Error message
${config.displayName} hooks skipped: ${hookResult.reason}. What it means
During `agentmemory connect` for a JSON-config MCP host, the agentmemory MCP entry was already present in the config file (already-wired path), so the adapter only attempted optional hook installation (because `--with-hooks` was passed). The host's `installHooks` callback returned `{ kind: 'skipped', reason }`, and the CLI logs this warning to say why hooks were not installed. MCP wiring is untouched and the command still returns `already-wired`.
Source
Thrown at src/cli/connect/json-mcp-adapter.ts:81
detect(): boolean {
return existsSync(config.detectDir);
},
async install(opts: ConnectOptions): Promise<ConnectResult> {
const existing = readJsonSafe<McpConfig>(config.configPath);
const next: McpConfig = existing ? { ...existing } : {};
const servers: Record<string, McpEntry> = {
...((next[wrapperKey] as Record<string, McpEntry>) ?? {}),
};
const alreadyHas = entryMatches(servers["agentmemory"]);
if (alreadyHas && !opts.force) {
logAlreadyWired(config.displayName, config.configPath);
if (opts.withHooks && config.installHooks) {
const hookResult = config.installHooks(opts);
if (hookResult.kind === "skipped") {
p.log.warn(
`${config.displayName} hooks skipped: ${hookResult.reason}.`,
);
}
}
return { kind: "already-wired", mutatedPath: config.configPath };
}
if (opts.dryRun) {
p.log.info(
`[dry-run] Would ${alreadyHas ? "overwrite" : "add"} ${wrapperKey}.agentmemory in ${config.configPath}`,
);
if (opts.withHooks && config.installHooks) {
const hookResult = config.installHooks(opts);
if (hookResult.kind === "skipped") {
p.log.warn(
`${config.displayName} hooks skipped: ${hookResult.reason}.`,
);
}View on GitHub (pinned to e04ba88819)
Solutions
- Read the logged `reason` after 'hooks skipped:' and address it specifically (e.g. remove the stale hook config or fix permissions).
- Re-run with `--force` to make the adapter go through the full install path and retry hook installation fresh.
- Install the host's hooks manually per the agentmemory hooks docs if the automated path keeps skipping.
Example fix
// before agentmemory connect droid --with-hooks Droid hooks skipped: hook-manifest-up-to-date. // after agentmemory connect droid --with-hooks --force
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check hooks before running connect with --with-hooks
import { existsSync } from "node:fs";
const hooksPath = "~/.factory/hooks.json"; // host-specific manifest
const hooksClean = !existsSync(hooksPath) || JSON.parse(readFileSync(hooksPath, "utf8")) !== undefined;
if (!hooksClean) console.log("Resolve existing hook manifest or expect a 'hooks skipped' warning."); Type guard
function isSkipped(r: ConnectResult): r is { kind: "skipped"; reason: string } {
return r.kind === "skipped" && typeof (r as { reason?: unknown }).reason === "string";
} Try / catch
const result = await adapter.install({ ...opts, withHooks: true });
if (result.kind === "skipped") {
console.warn(`Hooks not installed: ${result.reason} — MCP wiring unaffected.`);
} Prevention
- Don't pass --with-hooks if you only want MCP wiring.
- Pre-check for an existing hook manifest that the installer would consider current and skip.
- Use --force to ensure the full install path runs instead of the already-wired shortcut.
- Read the reason field in the skipped ConnectResult programmatically rather than scraping CLI output.
When it happens
Trigger: Running `agentmemory connect <json-mcp-host> --with-hooks` when (a) the host config already contains an agentmemory entry matching `npx ... @agentmemory/mcp`, (b) `--force` is not passed, and (c) the host's `installHooks(opts)` returns kind 'skipped' (e.g. hooks manifest already current with different content, or the hook config path is unwritable).
Common situations: Re-running connect after a previous install; user configured hooks manually so the installer declines to overwrite; hook manifest exists but no longer matches what installHooks would write and it skips instead of failing; running in restricted environments where the hooks file cannot be modified.
Related errors
- ${config.displayName} hooks skipped: ${hookResult.reason}. M
- agentmemory: could not locate bundled plugin/ directory (sea
- Claude Code hooks fallback skipped: ${hookResult.reason}. MC
- Codex hooks fallback skipped: ${hookResult.reason}. MCP wiri
- ${adapter.displayName}: not detected on this machine (skippi
AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30).
Data as JSON: /api/errors/d4379c05d0ba7464.
Report an issue: GitHub.