How to Give Your Code Agents a Memory You Control

How to Give Your Code Agents a Memory You Control
4 min read

funes, an open-source tool presented on the Hugging Face blog, creates a durable memory for programming agents from sessions already recorded on the user’s machine. Compatible with Claude Code, Codex, pi and Hermes, it runs locally and installs with a single command.

Programming agents approach each project as an unknown. The reasoning followed ‘last Tuesday’ disappears at the end of the session, and each new agent, on each new machine, starts from scratch. Yet these agents already produce a detailed trace of their work: code searches, attempted approaches, encountered errors, and changes of direction. But these raw logs remain archives. It is impossible to find with a simple text search the answer to the question ‘why did we abandon the streaming parser?’ among ten thousand conversation turns. To be useful during work, this material must be indexed, searchable, categorized, and linked to its exact source.

A local memory, integrated into the workflow

funes fits into a single binary. Its default inference engine does not depend on any machine learning library, and representation (embedding) and re-ranking computations are performed on the user’s machine. The command funes add claude builds the first index, gives the agent the recall and get tools, and installs the automation that indexes each completed conversation turn. Indexing is incremental: new sessions do not re-index the entire history, and older content can be added in stages.

When a task touches a past decision or a result already obtained, the agent can itself launch a search in its memory. The user no longer has to find the old session or copy its context into the new one. The results return the original text, not a summary, with the agent, timestamp, session, and original turn.

Technically, a single pipeline transforms each supported trace into a common structure of turns and blocks, splits it into fragments, represents it numerically with a fixed local model, then writes it to a Lance-format dataset. A query combines a vector search, which relies on meaning, and a BM25 search, which relies on keywords. The results are merged, re-ranked by a so-called cross-encoder model, weighted according to their recency, then supplemented with neighboring fragments.

A shared memory, treated as a dataset

For a memory to follow a user’s work from one machine to another, it can be linked to a Hugging Face repository when adding funes, with a command like funes add codex acme/funes-memory. According to the article, this repository is private by default and belongs to its owner. Credentials are masked during indexing, then each fragment is checked again before publication, and any element that still resembles a secret is withheld. The operation of this check is detailed in the repository’s SECURITY.md file, which also specifies its limits.

When an agent reads a remote memory, funes caches the dataset files on the local machine. The command funes ask allows asking a question directly to a memory, local or shared, as with –memory huggingface/funes-memory, which designates a public memory on funes development. If the retrieved passages do not allow for an answer, the agent signals it.

In teams, according to the article, a new member can query the history of decisions upon arrival, including dead ends and reasons that were never recorded in a merge request. For an open-source project, a maintainer can publish the sessions related to a version, which everyone can consult with the –memory option.

A cost compared to compaction and handoff

A long investigation weighs down a session, to the point where each turn costs more to carry the context than to accomplish the work. Three responses are possible: let the agent compact its context, write a handoff before starting from scratch, or use memory. On two tasks whose answer cannot be reconstructed without the original session, the team compared these three approaches. According to its measurements, compaction worked on one task and never on the other, its summary having flattened important results. Searching memory proved to be the least costly of the three on both tasks, 8 times cheaper than a written handoff on one, and 4 times on the other.

The blog also cites Jorge Luis Borges, in Funes the Memorious: ‘To think is to forget differences, to generalize, to make abstractions.’ For the authors, agents have already produced the trace of their work. Sessions can now be queried by the next agent, on the machine the user is using at that time. Questions, bugs, and requests for support of a new agent can be submitted via the issues on the funes GitHub repository.

S’abonner
Notification pour
guest

0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
0
Nous aimerions avoir votre avis, veuillez laisser un commentaire.x