Automatic memory / 01

Recall on the question. Write after the answer.

TMCRA cannot know what to recall before a user asks something. An automatic integration first uses the new prompt to recall and inject relevant evidence, lets the Agent answer with that context, and only then records the user message and final assistant response as two separate actors.

02 / TURN LIFECYCLE

The current prompt starts the chain.

Automatic means the host owns the timing. It does not mean TMCRA guesses a query in advance, nor that merely connecting an MCP server can observe every conversation.

  1. 01
    QUESTION

    The user submits the new prompt

    The prompt becomes the recall query. Nothing from the unfinished turn is written yet.

  2. 02
    RECALL + ANSWER

    Evidence is recalled, fenced, and injected

    The host recalls allowed scopes, places bounded evidence in untrusted system context, then calls its existing model or Agent.

  3. 03
    WRITE

    The completed turn is persisted

    The user prompt and final assistant answer are submitted separately to shared project memory, with role, Agent, session, and source provenance preserved.

03 / MULTI-AGENT MEMORY

Share the project. Preserve the speaker.

Specialized Agents should not be split into unrelated project graphs. They share one project boundary, while each conversation keeps its own session and every record keeps its actor attribution.

01RECALL

User global

Stable user facts and preferences that may be useful across projects. Automatic turn writers do not place project chat here.

02RECALL + WRITE

Shared project

The default collaboration boundary. Planner, coder, reviewer, and other Agents use the same project scope so each can recall the others’ progress.

03OPTIONAL RECALL

Current-Agent private

Off by default and recall-only in the current Python and JavaScript/TypeScript lifecycle wrappers. Automatic writes still go to the shared project scope.

SCOPE IS NOT SESSION

One project boundary, distinct Agent sessions.

Use the same stable project key for every collaborating Agent. Keep different session IDs for separate conversations. Agent identity must not be included in the project-scope key, or cross-Agent recall will be broken.

actor.provenance
{
  "role": "user",
  "metadata": { "actor_role": "user", "target_agent_id": "planner" }
}
{
  "role": "assistant",
  "metadata": { "actor_role": "assistant", "agent_id": "planner" }
}

04 / INTEGRATION PATHS

Choose the lifecycle your host can actually expose.

Native adapters attach to host events. SDK wrappers surround your own model call. Generic MCP remains an explicit tool surface unless its host adds lifecycle Hooks.

01

NATIVE HOOKS · PILOT

OpenClaw

Automatic recall and capture through the OpenClaw plugin lifecycle.

before_prompt_build

Uses the current prompt to recall global and shared-project evidence, then returns bounded prependSystemContext before model execution.

agent_end

After a successful, non-aborted turn, queues the user prompt and final assistant answer as separate messages.

gateway_start / gateway_stop

Drains the owner-readable durable queue so a temporary API failure does not discard a completed turn.

openclaw.config
{
  plugins: {
    entries: {
      "tmcra-openclaw": {
        enabled: true,
        hooks: {
          allowConversationAccess: true,
          allowPromptInjection: true
        },
        config: {
          sharedProjectId: "checkout-service",
          includeGlobalScope: true
        }
      }
    }
  }
}

Give every Agent on the same workstream the same sharedProjectId. OpenClaw’s agentId is excluded from the project scope but included in the derived session and message attribution. If sharedProjectId is omitted, the adapter falls back to workspace, then chat identity.

The operator must explicitly allow conversation access and prompt injection. Credentials stay in protected device configuration or Gateway environment, never in the model tool surface.

02

MEMORY PROVIDER · PILOT

Hermes Agent

Automatic memory through the current Hermes MemoryProvider contract.

prefetch / queue_prefetch

Recalls the exact current query. The queued form warms an exact-query cache without changing recall semantics.

sync_turn

Queues the completed primary user/assistant turn. Primary Agents on the same project share a scope but retain distinct sessions.

on_delegation

Records the parent delegation request and delegated result as assistant-side work with distinct parent and child Agent attribution; neither is mislabeled as a user statement.

hermes.setup
python -m pip install https://tmcra.com/downloads/integrations/tmcra_hermes_plugin-0.4.1-py3-none-any.whl
tmcra-hermes install
hermes memory setup
tmcra-hermes status

Set one stable TMCRA_PROJECT_ID, project root, or workspace value across cooperating Agents. Hermes derives one shared project scope while agent_identity participates in each opaque session ID and actor provenance.

The provider is single-select and does not patch Hermes core. Normal device authorization can supply protected credentials; the durable pending queue contains conversation content and must remain owner-readable.

03

OPTIONAL WRAPPER · PREVIEW

Python SDK

Wrap a synchronous or asynchronous model call without replacing your Agent runtime.

The wrapper owns the turn order

SyncMemoryLifecycle and AsyncMemoryLifecycle call prepare_turn first, pass fenced context through PreparedTurn.model_messages(), then call commit_turn only after a non-empty assistant answer exists.

  • Required project_scope is the shared write boundary.
  • global_scope is recalled first when configured, but is never written automatically.
  • agent_private_scope is optional, recall-only, and requires agent_id.
  • The default waits for the ingest Job and verifies success.
python · tmcra-client
from tmcra_client import (
    AutomaticLifecycleConfig,
    SyncClient,
    SyncMemoryLifecycle,
)

with SyncClient(BASE_URL, api_key=access_token) as client:
    memory = SyncMemoryLifecycle(client, AutomaticLifecycleConfig(
        project_scope="project_checkout",
        global_scope="user_global",
        agent_id="planner",
        agent_metadata={"specialty": "planning"},
        # agent_private_scope="agent_planner_private",  # opt in
    ))
    turn = memory.run_turn(
        user_text,
        lambda prepared: call_model(prepared.model_messages()),
        session_id=session_id,
    )

python -m pip install https://tmcra.com/downloads/integrations/tmcra_client-0.5.0-py3-none-any.whl

04

OPTIONAL WRAPPER · PREVIEW

JavaScript / TypeScript SDK

The same compiled package serves JavaScript at runtime and TypeScript with declarations.

TMCRAMemoryLifecycle

prepareTurn recalls the configured scopes in parallel and returns modelMessages(). commitTurn writes both actors to projectScope with read-your-writes consistency; runTurn connects both around your answer callback.

  • Use one projectScope for every Agent on the project.
  • Put agent_id and specialization in agentMetadata; it attributes records without partitioning the project.
  • agentPrivateScope is opt-in recall only; automatic writes remain shared.
javascript / typescript · @tmcra/typescript
import {
  TMCRAClient,
  TMCRAMemoryLifecycle,
} from "@tmcra/typescript";

const client = new TMCRAClient({ baseUrl, apiKey: accessToken });
const memory = new TMCRAMemoryLifecycle(client, {
  projectScope: "project_checkout",
  globalScope: "user_global",
  agentMetadata: { agent_id: "coder", specialty: "implementation" },
  // agentPrivateScope: "agent_coder_private", // opt in
});

const turn = await memory.runTurn(
  userText,
  (prepared) => callModel(prepared.modelMessages()),
  { sessionId },
);

npm install https://tmcra.com/downloads/integrations/tmcra-typescript-0.5.0.tgz

05

EXPLICIT MCP / OPTIONAL CODEX HOOKS · PREVIEW

MCP and Codex Hooks

Choose explicit memory tools or a host lifecycle that can automate them.

DEFAULT

Generic MCP is explicit

The server exposes tmcra_recall, tmcra_ingest, tmcra_get_job, and tmcra_wait_job. The host must deliberately call recall before answering and ingest afterward. Connecting stdio alone cannot observe a host’s turns.

OPTIONAL

Codex Hooks automate the lifecycle

The codex-hooks setup delegates to the existing TMCRA Codex plugin. UserPromptSubmit recalls and injects memory; Stop captures separate user and assistant records. The user must restart Codex, inspect /hooks, and grant trust.

tmcra-mcp-setup
python -m pip install https://tmcra.com/downloads/integrations/tmcra_mcp_server-0.4.0-py3-none-any.whl

# Generic MCP: explicit tools
tmcra-mcp-setup install --mode explicit
tmcra-mcp-setup status --mode explicit

# Codex: optional automatic lifecycle Hooks
tmcra-mcp-setup install --mode codex-hooks
tmcra-mcp-setup status --mode codex-hooks

For a multi-Agent MCP host, pass the same shared scope, distinct session_id values, preserved message roles, and an optional real agent_id. Generic MCP does not invent an Agent identity when the host provides none.

Open the full Codex installation guide
06

VERIFIED ARTIFACTS

Download the tested packages

These files are the same artifacts used for clean-install and package validation. Verify SHA-256 before installation.

Source distributions and the machine-readable manifest remain in the same directory for reproducible deployment.

05 / ACCEPTANCE CHECK

Verify behavior, not just installation.

  1. 01

    Seed a unique fact through Agent A and wait for its write to complete.

  2. 02

    Ask a related new question through Agent B in the same project and verify recall occurs before its model call.

  3. 03

    Inspect evidence: Agent B should see Agent A’s progress, while role, agent_id, session, and source remain distinguishable.

  4. 04

    Verify an Agent-private scope is invisible unless that optional recall scope is explicitly configured.

  5. 05

    Interrupt the API briefly and confirm the adapter’s Job or durable queue recovers without duplicating the turn.

06 / ACCESS

Connect one real workflow end to end.

Tell us the host, number of Agents, project-boundary rule, and expected traffic. We will review the integration path and scoped authorization requirements.

Request integration access