Organisations are living ecosystems. Over time, they form shared memory through decisions, interactions, experiments, mistakes, and the casual conversations of everyday work. It's the collective action of their members that cultivates the context.

Modern agent harnesses manage execution loops, tools, context, and persistent memory. They can complete long-running complex tasks, recover from failures, and adapt their approach during execution, but their context belongs to one session and ends with it. In contrast, an organisation operates across many people, agents, and sessions, and its knowledge evolves through shared work, changing decisions, and outcomes that no single agent has seen end to end.

Persistent memory alone doesn't establish shared organisational state. That state needs to preserve what changed, where it came from, who can access it, and how independent executions can build upon it. What substrate needs to be in place to hold that state, so that people and agents can operate as part of a shared, evolving system?

01Initial architecture

Egregore's initial architecture, built in January 2026, kept organisational knowledge independent of individual agent sessions. It had three parts: structured, shared Markdown files as the canonical state, hosted on Git for provenance and lineage; a graph derived from those files; and a relational database for accounts.

By January 2026, coding agents had already shown that a model can find what it needs by navigating files and searching them with tools such as grep and jq, without a vector store. We applied this approach to organisational knowledge, and at our scale, a few thousand Markdown documents, the model found the relevant files and context efficiently.

The graph was a derived projection of organisational memory, representing relationships, provenance, and lifecycle states across sessions, quests, handoffs, and artifacts. It supported activity tracking and relationship-based retrieval, which became increasingly useful as models improved at navigating the graph. Since the canonical knowledge and relationship metadata lived in files, the graph could be rebuilt as the ontology changed, without losing organisational memory.

Independent agent sessions sit above Egregore v1, which has three parts: shared Markdown files hosted on Git as the canonical state, a graph derived from those files, and a relational database for accounts. The animation shows a session writing a file, the graph being derived from it, another session reading through file search and through the graph, and the graph being rebuilt from the files.
fig.01 Egregore v1

One application of this architecture was handoffs between people and their agents. In an independent Claude Code session, a member would run /handoff, which created a Markdown file bundling the work, decisions, open threads, and intended recipient, with structured frontmatter. Once the file was created, a hook would fire, sync it via Git, send the recipient a Telegram message with a summary, and index the relationship in the graph.

When the recipient started their own session, a startup hook would inject the latest context and relevant handoffs to the user in an activity dashboard. All the recipient had to do was point their agent to the handoff. The agent would create a worktree and start on the work handed over, after clarification if needed. Continuity came from durable artifacts and shared conventions for interpreting them, since the receiving agent never saw the first agent's conversation.

Handoffs helped immensely in reducing the cold start problem. They also took the place of rigid task boards in the new, non-deterministic way of working with agents, which is why continuity across sessions mattered. After a while, handoffs generated human-readable Egregore links, and the Telegram notifications sent those instead.

Organisational state was already independent of Claude Code. As new harnesses were released, the next step was to move that state above the harnesses with an interface, so that users could swap between them as they saw fit. We released the Egregore CLI with multiple harness options.

The Egregore CLI instance screen: connection status, available skills, and the installed harnesses Claude Code, Codex, Pi and Prime
fig.02 the Egregore CLI, with multiple harness options

This architecture worked for teams operating within a common trust boundary, and for knowledge that Egregore had largely created itself. As we moved towards enterprise adoption, Egregore had to handle new requirements.

The first was a generic ingest pipeline, for knowledge held in systems Egregore did not own. The second was access: organisational memory needed to remain shared without being accessible to everyone in the organisation. Repository membership alone could no longer govern access to organisational context, so the runtime needed to enforce which knowledge each participant and agent was authorised to access, under what conditions, before that knowledge entered the agent's context.

02From shared memory to a canonical evidence layer

In Egregore's initial architecture, the versioned filesystem was the authoritative source for organisational knowledge, since Egregore largely created and managed the artifacts stored within it. The ingest pipeline changed the semantics, because Google Docs, repositories, message threads, research databases, and enterprise systems may remain authoritative outside Egregore. These sources have their own lifecycles: documents change, permissions are revoked, messages are deleted, and repositories evolve.

The graph had an authority problem of its own. It was meant to be a derived projection, and it had become a second source of truth: handoff lifecycle states existed only there. Its hosted deployment also conflicted with the local-first approach customers and the community expected. We had kept the graph for a while regardless, as the model got very capable at writing Cypher queries and could find the relevant files in a few turns.

To distinguish source authority from Egregore's representation of that source, we designed a canonical evidence layer: normalised, versioned content that preserves source identity, structural boundaries, provenance, permission lineage, and synchronisation state. External records would remain traceable to their original systems, while Egregore remained authoritative for native decisions, handoffs, skills, and traces. Retrieval indexes and the graph would become replaceable projections over this evidence, so we moved the handoff lifecycle states into versioned records and made the graph optional.

For retrieval, we evaluated QMD as a locally rebuildable index over organisational evidence. It combines keyword and semantic search with optional query expansion and LLM reranking. I was curious how QMD would perform within a harness, since a harness has its own tools and QMD is mostly used without one, with a small model. We tested five configurations against 42 questions on a frozen copy of our own organisational memory, 2,649 Markdown documents, comparing retrieval quality against latency and model overhead.

We chose challenging questions about our own real work, with the help of agents. For each question, we noted in advance which file and passage hold the answer, then checked whether each configuration returned them. File Hit@5 counts the questions where a correct file is in the top five results, while Passage@5 is stricter and requires a returned passage to contain the answer. The benchmark scores retrieval only, and does not judge the agent's final answer.

Three configurations illustrate the trade-off:

ConfigurationFile Hit@5Passage@5Median latency
Keyword + semantic88.1%64.3%304 ms
+ Reranker90.5%66.7%8.67 s
QMD default pipeline73.8%42.9%20.30 s
NoteQMD’s default pipeline generated its own search queries, while the keyword + semantic configuration used queries prepared in advance by an agent.

Keyword and semantic search with rank fusion offered the best practical trade-off, although its 304 ms covers the search alone and excludes the time spent writing the queries. Adding the reranker gained one question out of 42 on each metric, at 28 times the latency. QMD performed well inside the harness, but I was surprised that the full stock pipeline didn't: it scored lowest and took 20 seconds. Because the query source differs between rows, the table does not isolate query expansion or reranking as components. It does suggest the index can stay simple when an agent writes the query, which is how the runtime uses it.

This didn't establish that graph retrieval was inferior, but showed that effective retrieval was possible through a locally rebuildable index, without depending on a managed graph service.

Harnesses are adaptive, and this evaluation scored retrieval on its own, outside an agent's session. As a next step, it will be useful to evaluate across consecutive agent sessions, and with BEAM for long-running agents as well.

With the search index now running locally and rebuildable from the files, the access problem was still open. It was about governing how that knowledge enters an agent's context, independently of the harness executing the work.

03Independent loops, shared state

Claude Code, Codex, and Pi each run an execution loop. The harness assembles context, calls the model, runs the tools the model asks for, and feeds the results back.

aₜ = Model(Cₜ)
oₜ = Tools(aₜ)
Cₜ₊₁ = Harness.update(Cₜ, aₜ, oₜ)

Cₜ is the context at step t, aₜ is the action the model proposes, and oₜ is what the tools return. Everything in this loop belongs to one session, so when the session ends, C ends with it.

Egregore leaves this loop as it is and adds one step.

aₜ = Model(Cₜ)
oₜ = Tools(aₜ)
Eₜ = Egregore.observe(Sₜ, qₜ, actor, organisation, policy)
Cₜ₊₁ = Harness.update(Cₜ, aₜ, oₜ, Eₜ)

Sₜ is organisational state. When the model asks for organisational evidence, its query qₜ goes to the runtime, and nothing else in that call comes from the model. The runtime resolves the actor from the configured identity, binds the request to the active session and prompt, and evaluates policy before the search starts. QMD then searches only the records that policy allows, and the runtime checks each result against its canonical file before delivery.

Eₜ is a context packet: the authorised passages, each with a reference to its source. Each harness receives it in its own way. In Claude Code, a post-tool hook delivers the packet and confirms that it belongs to the current prompt. In Codex, hooks were not as native at the time and gave us problems, so the packet arrives as ordinary tool output.

Three harnesses, Claude Code, Codex and Pi, each run their own execution loop. When a model asks for organisational evidence, its query goes to the Egregore runtime, which resolves the actor, binds the request to the session and prompt, and evaluates policy. QMD then searches only the records policy allows, each result is checked against its canonical file, and a context packet returns to the harness.
fig.03 the observe step, from query to context packet

Imagine two members of an organisation working on the same project. Both can read its technical decisions, but only one can also read the commercial agreement. Their agents send the same query and receive different evidence: same q, different E. For the member without access, the agreement is absent from the set that QMD searches. No instruction tells the model to ignore the agreement, because the model never sees it.

The boundary exists so that the model decides what it needs, while Egregore decides what it is entitled to know. Egregore makes that decision in deterministic code, with typed Python contracts for identity, membership, permission, and scope. The decision covers what the runtime delivers, and is not filesystem confidentiality yet.

The runtime also handles writes.

Sₜ₊₁ = Egregore.write(Sₜ, wₜ, actor, organisation, policy)

wₜ is the record the agent wants to add to S. When a member runs /handoff, the runtime gives the write an identity, provenance and a receipt, and a record without provenance stays out of search. Reading, writing, and sharing outside the organisation are separate permissions, so an actor who can read a decision cannot change it or send it out on that basis alone.

The recipient's next session finds the handoff through observe, in whichever harness they use. C ended with the session that wrote the handoff, while S belongs to the organisation and stays.

04An evolving organisational state

Beyond handoffs, rituals such as /wrap and /reflect turn completed work, decisions, and observations into organisational records. When enabled, session records also capture commits, PRs, friction encountered, and execution costs. They are durable accounts of what the work produced, and leave out the agent's reasoning and conversation. As explicit rituals, /wrap and /reflect were often missed despite the reminder hooks. In designing the new mechanism, we considered ambient systems enabled via OpenTelemetry, which would capture session activity without anyone running a command.

Records link to one another, and each link has a type. When a decision replaces an earlier one, the new record points to the old one as superseded, the way architecture decision records do. Completing a handoff creates an event linked to the handoff and its supporting evidence. Earlier records are not changed. They are simply no longer current, while these relationships allow the runtime to distinguish current knowledge from its history.

Coordination can now happen across independent executions, without any agent needing the full history of the work. Different members and agents can advance the same effort, while later executions recover its current state, outstanding commitments, and supporting evidence. Continuity now sits with the organisation, and no longer depends on any individual session or harness.

This continuity is what organisational continual learning needs first. With decisions linked to evidence, outcomes, and execution traces, the next step is to evaluate patterns in how the organisation operates, and use those evaluations to improve its skills, workflows, and retrieval mechanisms. The longer-term goal is a model-agnostic, adaptive substrate for organisations of people and agents, capable of learning from their collective experience and changing how they operate.