Raw: https://promptreports.ai/docs/agent-memory.md

# Memory for agents

An agent proposes what it learned. A person decides whether it becomes memory. The next session or workflow run loads what was promoted and records what it read, so a wrong entry can be traced to every run that read it.

Not live yet. ContextFile and the PromptReports runner hold the code, and each part stays off until it is switched on for an org. RepoOps filing proposals from sessions, and loading memory when a session starts, is in review. The house org goes first.

| Step | What happens | State |
|---|---|---|
| Propose | An agent files a lesson, an error and its fix, or a decision, with its sources. It waits for review. | Built |
| Propose from RepoOps | RepoOps files proposals from captured sessions, run diagnoses and propose_brain_entry. | Planned |
| Review | A person promotes a proposal under a PromptCompute approval, or declines it. | Built |
| Load in a workflow run | Every run loads the org's packet before its first action and records each entry's digest. | Built |
| Load in a coding session | The session-start hook loads the packet for the repo and the branch's task. | Planned |
| Trace back | Read an entry with every run and session that loaded it, or mark it wrong to keep it out of later packets. | Built |

## 1. Propose

When a session or a run teaches something the next agent should know, the agent calls propose_memory on ContextFile's MCP server, https://mcp.contextfile.ai/mcp. It sends the kind (lesson, error_fix or decision), a title, a body and one to ten sources. A source is a session, a run diagnosis, a pull request, a commit, a brain file or a URL. An error fix may name the check that proves it, with its CI status and the GitHub Actions run. The same proposal sent twice answers replayed.

ContextFile redacts secrets and personal data from every text field before it stores a proposal. A proposal that held either, or that fails the injection scan, is kept as quarantined and is never promoted. No packet holds a proposal until it is promoted.

RepoOps will file proposals for you: the error and fix from a run diagnosis, a captured session, and anything sent through the brain MCP's propose_brain_entry when the org has memory on. It will run its own redaction rules before anything leaves the machine, and it will never promote.

## 2. Review

A person reads the queue on ContextFile's Org memory page, /memory. An agent reads it with list_memory_proposals: pending by default, or promoted, declined, quarantined or all, newest first, each with its sources and digest.

To promote, call decide_memory_proposal with decision promote and no approval_id. That files a PromptCompute approval request, contextfile.memory.promote, with the proposal id, its digest, the org and your account, and changes nothing. Once a person approves it, call again with the approval_id. ContextFile then makes the entry, once, versioned by its title, with its source and the person who promoted it. Only an owner or admin of the org, or an agent acting for one, applies a promotion, and the approval must come from the memory's own PromptCompute org. The action is marked never_auto, so an approval a PromptCompute rule decided is refused. Decline takes no approval; an agent may decline only its own proposals.

One rule can promote without a person: error_fix_check_passed. It promotes an error fix only for a repo the operator lists as the org's, and only when ContextFile reads from GitHub that the pull request merged into the default branch in the last 7 days and that the named check passed on a push to the default branch at that commit. The entry holds the merge commit's message, not the proposal's text, and the rule never makes a new version of an entry a person reviewed. An owner or admin turns it on with set_memory_rule, which asks a person in PromptCompute (contextfile.memory_rule.approve) and is refused until 30 days after the org's first entry a person promoted. Turning it off takes effect at once.

## 3. Load

At the start of a session or a run, the agent calls context_packet with task, repo, branch and, for a session, session_id. On the family endpoint, contextfile_context_packet makes the same call as your agent with a one-minute token for ContextFile. The packet holds the org's promoted entries that are not marked wrong, the newest version of each, and an entry tied to a repo only for that repo. They are ranked by fit to the task and cut to the org's budget, 4,000 tokens unless the operator sets another. Each entry carries its digest, the answer carries packet_digest, and ContextFile records the read against the run, the session or the agent.

A workflow run loads its own packet. For an org with memory on, every run except a dry run or a part run calls context_packet once, before its first action, with the workflow's title and description as the task and the run's own PromptReports ID agent token. The run record gets a memory field with the packet digest and each entry's entry_id, name, version and digest, never the text. The run trace lists each entry as a memory entry link. A load that fails is recorded with its reason (no_agent_token, bad_answer or unavailable), and the run goes on.

What ContextFile answers is data, not instructions. The runner never puts an entry's text into a template, an argument or an approval card. Only a step that starts an agent session, such as repoops.build_fix, gets the entries, in its call's _meta under promptreports/memory.

RepoOps will load a packet when a coding session starts. The hook that repoops adopt installs will ask for the packet for the repo and the branch's task, and record the packet and entry digests on the session.

## 4. Trace back

get_memory_entry returns one entry with its source, who promoted it, any wrong mark, and every run, session or agent that read it, by digest. When an entry turns out wrong, call mark_memory_entry_wrong with a reason. No later packet holds that version or any older version of the same name, and the answer lists every run and session that read it so you can check them. A version promoted after the mark loads again.

Every proposal, promotion, decline, wrong mark and rule change is written to the org's memory ledger.

## Memory stays in its org

A packet holds only entries of the org the run or session belongs to. Every memory tool acts in the org of the caller's PromptReports ID agent token, or in an org named in the call that the caller belongs to. An entry one org promotes never reaches a run in another.

## The tools

```
MCP tools on mcp.contextfile.ai:
  propose_memory (kind, title, body, repo, branch, sources, check)
  list_memory_proposals (state, limit)
  decide_memory_proposal (proposal_id, decision, approval_id, reason)
  get_memory_entry (entry_id)
  mark_memory_entry_wrong (entry_id, reason)
  set_memory_rule (rule, on, approval_id)
  context_packet (task, repo, branch, session_id)
On mcp.promptreports.ai: contextfile_context_packet
REST on ContextFile: POST and GET /v1/memory/proposals, POST /v1/memory/proposals/{proposal_id}/decision,
  GET /v1/memory/entries/{entry_id}, POST /v1/memory/entries/{entry_id}/wrong, POST /v1/memory/rules
```

## Switching it on

Each part has its own switch, and each lists org ids: FAMILY_MEMORY_ORGS in ContextFile, RUNNER_FAMILY_MEMORY_ORGS in the PromptReports runner, and FAMILY_MEMORY_PROPOSALS in RepoOps. All three are off. With ContextFile's switch off, the memory tools, and context_packet with task, answer unavailable.
