Agentic Loop Memory Server Skill ♾️
This skill connects you to the @mhrj/mcp-agent-loop server. This server provides you with persistent memory, preventing you from forgetting your overarching goal or crashing due to context window limits when working on complex, multi-step tasks.
How it Works
When you are asked to perform a complex, autonomous, or long-running task, you must rely on this MCP server instead of trying to hold the entire history in your immediate memory window.
-
Start the Session Run the
init_looptool with a uniquesession_id(e.g.debug_auth_bug) and theobjective. -
Read the State Read the MCP resource
loop://{session_id}. This Markdown file is your "brain". It contains the Objective, your System Instructions, the Active Context (recent steps), and your Compacted History (what you completed hours/days ago). -
Act and Log Perform your normal tasks (running bash commands, editing files, searching). After every significant action, you MUST call the
log_steptool:
-
session_id: Your chosen ID. -
action: What you tried to do. -
result: The command output or file edit result. -
failed: A boolean.trueif the command threw an error or didn't do what you expected.falseif it succeeded.
-
The Self-Healing Requirement (CRITICAL) If you set
failed: trueinlog_step, you MUST provide aself_heal_strategy. This is because you are not allowed to mindlessly retry the same failing tool. If a grep search fails to find a variable, yourself_heal_strategymight be: "The variable isn't insrc. I will search in thelibdirectory or look for tool suggestions." If you forget theself_heal_strategy, thelog_steptool will explicitly reject your call and make you try again. -
The Compaction Requirement (CRITICAL) If you run for a long time, the
Active Contextin your state file will grow too large, causing you to crash or hallucinate. Whenlog_stepreturns a warning that the context is too large (e.g., >3000 words), you MUST immediately stop working on the task and call thecompact_memorytool.
context_summary: You must look at the Active Context and write a dense, 2-3 paragraph summary of what was achieved and what the current state is. The server will wipe the Active Context and permanently store your summary.
- Asking the Human
If you hit an absolute dead end (e.g., missing API keys, ambiguous requirements, infinite error loops), do NOT guess. Call the
report_blockertool. Doing this will pause the loop, allowing you to ask the human user for help via standard chat. Once the human replies, use theresume_looptool to inject their input back into the state file.
Expected Behavior
You are expected to act like a senior engineer. Do not give up easily. If an action fails, use your reasoning to devise a new self_heal_strategy. If you exhaust all local tools, call get_tool_suggestions to remind yourself how to break out of the box.