UNPKG

akm-cli

Version:

akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cur

25 lines (24 loc) • 1.27 kB
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. import { adapterWrites } from "../../core/assets/gate.js"; import { warn } from "../../core/warn.js"; import { resolveWritable, writeTargetAt } from "../../core/write-source.js"; /** Inference only reads and writes the working directory, never a cache or store. */ export function memoryInferenceRoot(sources, config) { const primary = sources.find((source) => source.isDefault === true); if (!primary) { warn("memory inference: skipped — no default bundle among the sources, so there is no write target"); return undefined; } if (primary.path === undefined || !adapterWrites(primary, "memory")) { warn(`memory inference: skipped — the default bundle at ${primary.path ?? primary.bundleId} is not an akm bundle`); return undefined; } const target = writeTargetAt(primary.path, config); if (!resolveWritable(target.config)) { warn(`memory inference: skipped — bundle "${target.source.name}" is not writable, so its pending memories wait`); return undefined; } return primary.path; }