Skip to content

Cognee memory-provider integration: raise RLIMIT_NOFILE for Lance-backed recall and mirror on_memory_write #14368

@irispillars

Description

@irispillars

Context

This is about a local Cognee memory-provider integration used with Hermes on macOS. The Cognee plugin itself is not currently tracked in upstream NousResearch/hermes-agent, but the behavior gap is specific to the Hermes memory-provider contract / runtime environment and needs a canonical issue reference for the local patch.

Problems

1) Lance-backed recall fails under the default macOS soft maxfiles limit

In a live Hermes gateway process, cognee_recall failed with:

LanceError(IO): Too many open files (os error 24)

Observed runtime state:

  • process soft maxfiles limit: 256
  • live gateway process already had ~219 FDs open before recall
  • Cognee/Lance needed more headroom during recall

For this integration, a local fix raises RLIMIT_NOFILE to 4096 at provider initialization / recall-sensitive paths. A fresh process verified the helper raises 256 -> 4096 successfully when the hard limit allows it.

2) Built-in Hermes memory writes were not mirrored into Cognee

Hermes MemoryProvider exposes on_memory_write(action, target, content) specifically for mirroring built-in memory writes, but the local Cognee provider only handled:

  • prefetch()/queue_prefetch()
  • sync_turn()
  • on_session_end()

Result: memory / user writes made through Hermes did not land in Cognee's durable graph lane.

A local fix adds on_memory_write() support for add / replace and mirrors those writes into Cognee's permanent remember path.

Why this matters

Without these two behaviors:

  • live Cognee recall in gateway sessions can fail under normal macOS limits
  • Hermes built-in durable memories and Cognee drift apart semantically

Local fix shape

  • best-effort RLIMIT_NOFILE raise in the provider before Lance/Kuzu-heavy operations
  • on_memory_write() implementation that mirrors add / replace writes into Cognee permanent memory
  • regression tests for both behaviors

Requested outcome

Even if Cognee is not merged upstream today, keep this issue as the canonical reference for the integration gap so the behavior is not lost:

  • provider integrations backed by Lance/Kuzu need a maxfiles strategy on macOS
  • memory providers intended for durable parity should implement on_memory_write()

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/pluginsPlugin system and bundled pluginstool/memoryMemory tool and memory providerstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions