{"record":{"id":"d4379c05d0ba7464","repo":"rohitg00/agentmemory","slug":"config-displayname-hooks-skipped-hookresult","errorCode":null,"errorMessage":"${config.displayName} hooks skipped: ${hookResult.reason}.","messagePattern":"(.+?) hooks skipped: (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/cli/connect/json-mcp-adapter.ts","lineNumber":81,"sourceCode":"\n    detect(): boolean {\n      return existsSync(config.detectDir);\n    },\n\n    async install(opts: ConnectOptions): Promise<ConnectResult> {\n      const existing = readJsonSafe<McpConfig>(config.configPath);\n      const next: McpConfig = existing ? { ...existing } : {};\n      const servers: Record<string, McpEntry> = {\n        ...((next[wrapperKey] as Record<string, McpEntry>) ?? {}),\n      };\n\n      const alreadyHas = entryMatches(servers[\"agentmemory\"]);\n      if (alreadyHas && !opts.force) {\n        logAlreadyWired(config.displayName, config.configPath);\n        if (opts.withHooks && config.installHooks) {\n          const hookResult = config.installHooks(opts);\n          if (hookResult.kind === \"skipped\") {\n            p.log.warn(\n              `${config.displayName} hooks skipped: ${hookResult.reason}.`,\n            );\n          }\n        }\n        return { kind: \"already-wired\", mutatedPath: config.configPath };\n      }\n\n      if (opts.dryRun) {\n        p.log.info(\n          `[dry-run] Would ${alreadyHas ? \"overwrite\" : \"add\"} ${wrapperKey}.agentmemory in ${config.configPath}`,\n        );\n        if (opts.withHooks && config.installHooks) {\n          const hookResult = config.installHooks(opts);\n          if (hookResult.kind === \"skipped\") {\n            p.log.warn(\n              `${config.displayName} hooks skipped: ${hookResult.reason}.`,\n            );\n          }","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/cli/connect/json-mcp-adapter.ts#L63-L99","documentation":"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`.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nagentmemory connect droid --with-hooks\nDroid hooks skipped: hook-manifest-up-to-date.\n\n// after\nagentmemory connect droid --with-hooks --force","handlingStrategy":"validation","validationCode":"// Pre-check hooks before running connect with --with-hooks\nimport { existsSync } from \"node:fs\";\nconst hooksPath = \"~/.factory/hooks.json\"; // host-specific manifest\nconst hooksClean = !existsSync(hooksPath) || JSON.parse(readFileSync(hooksPath, \"utf8\")) !== undefined;\nif (!hooksClean) console.log(\"Resolve existing hook manifest or expect a 'hooks skipped' warning.\");","typeGuard":"function isSkipped(r: ConnectResult): r is { kind: \"skipped\"; reason: string } {\n  return r.kind === \"skipped\" && typeof (r as { reason?: unknown }).reason === \"string\";\n}","tryCatchPattern":"const result = await adapter.install({ ...opts, withHooks: true });\nif (result.kind === \"skipped\") {\n  console.warn(`Hooks not installed: ${result.reason} — MCP wiring unaffected.`);\n}","preventionTips":["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."],"tags":["cli","hooks","skipped","connect"],"backgroundTag":"hooks-install-skipped","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}