Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
/**
* The value of the first `--name <value>` or `--name=<value>` in args:
* undefined when the flag is absent, null when it is present without a value
* (last argument, followed by another `--flag`, or an empty value).
*/
export function cliFlagValue(args: readonly string[], name: string): string | null | undefined {
for (let index = 0; index < args.length; index++) {
const arg = args[index];
if (arg === name) {
const next = args[index + 1];
return !next || next.startsWith('--') ? null : next;
}
if (arg.startsWith(`${name}=`)) {
return arg.slice(name.length + 1) || null;
}
}
return undefined;
}