What an agent has learned about the person it works for, exposed to scripts as services.agentMemoryManager. <p> The scope is always an {@link Agent}, never a profile id a caller supplies: an agent row already carries its tenant, its owner and its definition name, so remembering and recalling are bounded by the same object that decides whose agent this is. There is no way through this API to write a fact about somebody else, which matters because the caller on the other side of it is a language model acting on a user's words. <p> <b>Recording is an upsert on the key.</b> An agent that learns a correction should record it under the key it first used, and end up with one fact rather than two that disagree. Nothing here works out which existing memory a new fact contradicts - that is the agent's judgement, made with the memories already in front of it, and the key is how it expresses that judgement. <p> <b>Bounded, and refused rather than trimmed.</b> Memories are read into every later conversation, so they are a standing per-turn cost. Past the ceiling a write is refused with a message saying so, instead of silently dropping the oldest: an agent told it is full can choose what to forget, whereas an agent whose writes quietly vanish believes it remembered something it did not. <p> Values cross to script as JSON strings rather than as maps, since Nashorn renders a Java map as {@code {}} when it is stringified - the same reason {@code ResultSetManager} does it.

Group: Managers


Methods

remember(Agent agent, String memoryKey, String content) · proposeAccountFact(Agent agent, String memoryKey, String content) · forget(Agent agent, String memoryKey) · list(Agent agent) · findProposedAccountFacts(Organisation adminOrg, String agentDefName) · findConfirmedAccountFacts(Organisation adminOrg, String agentDefName) · findRejectedAccountFacts(Organisation adminOrg, String agentDefName) · findOwnMemories(Organisation adminOrg, Profile owner, String agentDefName) · decideAccountFact(Long memoryId, Organisation adminOrg, Profile decidedBy, String action) · deleteMemory(Long memoryId, Organisation adminOrg)

remember(Agent agent, String memoryKey, String content)

Returns: String

Records a fact about an agent's owner, replacing whatever that agent already held under the same key.

ParameterDescription
agentthe agent doing the remembering, which supplies the tenant, the owner and the definition name; must not be null
memoryKeya short identifier for what the fact is about, in the form reporting-region. Lower case letters, digits and hyphens
contentthe fact, written so it still makes sense read on its own months later

proposeAccountFact(Agent agent, String memoryKey, String content)

Returns: String

Proposes a fact about the <b>account</b> rather than about the person, for an administrator to confirm. <p> Written immediately, so nothing is lost in the moment the user explains it, but with no reach until somebody confirms it: until then it behaves exactly like an ordinary memory belonging to whoever stated it. That split is the whole point. A wrong fact about one person misleads that person, who is in a position to notice; a wrong fact about the account silently shapes every administrator's answers, and none of them knows it is there or who said it. Confirmation, not writing, is what gives a fact reach. <p> <b>A proposal cannot overwrite a confirmed fact.</b> If the key is already taken by one, the call is refused and the existing content returned, so the agent can put the difference to the user rather than quietly replacing something an administrator reviewed.

ParameterDescription
agentthe agent proposing, which supplies the tenant, the stating owner and the definition name; must not be null
memoryKeya short identifier for what the fact is about
contentthe fact, stated as something true of the account

forget(Agent agent, String memoryKey)

Returns: String

Removes one recorded fact.

ParameterDescription
agentthe agent that recorded it; must not be null
memoryKeythe key it was recorded under

list(Agent agent)

Returns: String

Every fact this agent holds about its owner.

ParameterDescription
agentthe agent; must not be null

findProposedAccountFacts(Organisation adminOrg, String agentDefName)

Returns: List<AgentMemory>

The account facts awaiting a decision, for the review queue on the agent definition page.

ParameterDescription
adminOrgthe tenant
agentDefNamethe agent definition the facts belong to

findConfirmedAccountFacts(Organisation adminOrg, String agentDefName)

Returns: List<AgentMemory>

The confirmed account facts, for review and removal on the agent definition page.

ParameterDescription
adminOrgthe tenant
agentDefNamethe agent definition the facts belong to

findRejectedAccountFacts(Organisation adminOrg, String agentDefName)

Returns: List<AgentMemory>

The account facts an administrator has turned down, so they can be seen and, if that was a mistake or the world has changed, deleted - which frees the key for proposing again.

ParameterDescription
adminOrgthe tenant
agentDefNamethe agent definition the facts belong to

findOwnMemories(Organisation adminOrg, Profile owner, String agentDefName)

Returns: List<AgentMemory>

One person's own memories and proposals, so they can see and remove what an agent has recorded about them.

ParameterDescription
adminOrgthe tenant
ownerwhose memories to read
agentDefNamethe agent definition

decideAccountFact(Long memoryId, Organisation adminOrg, Profile decidedBy, String action)

Returns: AgentMemory

Acts on a proposed account fact, on behalf of an administrator. One method rather than three because the caller is a controller dispatching a form action, and the three transitions share every precondition - the row must exist, be in this tenant, and still be a proposal.

ParameterDescription
memoryIdthe proposal's row id
adminOrgthe tenant it must belong to, so an id from another account cannot be acted on
decidedBythe administrator deciding; required for a confirmation, since an account fact with no accountable confirmer is what the review step exists to prevent
action{@code confirm}, {@code reject} or {@code personal}

deleteMemory(Long memoryId, Organisation adminOrg)

Returns: void

Deletes a memory outright, on behalf of an administrator. The only way a confirmed account fact can be removed - deliberately not reachable from a tool, since a fact that every administrator relies on should not be removable by one person's conversation.

ParameterDescription
memoryIdthe row id
adminOrgthe tenant it must belong to
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.