Set the capacity
Choose how many pieces of context the workspace can hold. The default engine configuration provides seven slots.
Working memory is your agent’s temporary workspace. It holds the goal, useful clues, and decisions needed right now. As the task changes, less useful context fades and makes room for what comes next.
Working memory
The active workspace is clear.
Save lasting decisions in the appropriate memory type, then clear or expire working context when the task is done.
Example workspace with the engine’s default seven slots. Selection and removal illustrate application controls.
While investigating a revenue change, your agent might hold the question, the current hypothesis, and a few useful figures. A limited workspace keeps that active context manageable as new information arrives.
Choose how many pieces of context the workspace can hold. The default engine configuration provides seven slots.
When the workspace is full, older items with low activation can leave to make space for incoming context.
Context that remains useful can be passed to episodic memory, where it becomes part of the agent’s longer history.
Each item has an activation score: how present it is in the workspace. That score falls over time. Revisiting an item raises it again, keeping useful context available while stale details fade.
Configurable decay controls how quickly unused context loses activation.
Rehearsal increases an item’s activation when the agent returns to it.
Items below the configured threshold are removed from the active workspace.
Recency, relevance, activation, and importance help decide what enters the workspace. Your agent can focus on a particular item when it is ready to take the next step.
An attention gate admits candidates that meet its configured priority threshold.
Select the item the cognitive cycle should attend to, then release that focus when the work moves on.
The attention stage reads the focused workspace as part of the agent’s observe, decide, and act cycle.
Working memory manages active context inside the engine. A cognitive session provides a complementary record of the task’s goal and agent. Create that session through the HTTP interface shown here.
// Run server-side with credentials scoped to this Mind.
const endpoint = process.env.AKASHA_URL;
const capability = process.env.AKASHA_CAPABILITY;
if (!endpoint || !capability) throw new Error("Configure your Mind connection");
async function request(method: string, path: string, body?: unknown) {
const headers: Record<string, string> = {
"Content-Type": "application/json",
"x-akasha-capability": capability!,
};
if (process.env.AKASHA_TOKEN) {
headers.Authorization = "Bearer " + process.env.AKASHA_TOKEN;
}
const response = await fetch(new URL(path, endpoint), {
method, headers,
body: body === undefined ? undefined : JSON.stringify(body),
});
if (!response.ok) throw new Error("Mind request failed: " + response.status);
return response.json();
}
const { session } = await request("POST", "/v1/memory/cognitive/session", {
agent_id: "revenue-assistant",
goal: "Investigate the Q3 revenue change by sales channel.",
});
// The session record complements the engine’s active working memory.Set the capacity, decay, and attention policy to suit the task. These engine defaults give developers a starting point for managing active context.
Keep useful context close to the current task, and let the workspace change as the work does.