Skip to main content
Glama

get_repo_memory

Retrieve the repository's .ai-memory/ as Markdown to load prior work into the LLM context, avoiding redundant tasks. Call this before starting any task.

Instructions

Return the entire .ai-memory/ of the current repo as a Markdown document ready to drop into your LLM context. Call this before starting any task in this repo so you don't redo work other agents already verified.

Args: fact_limit: cap on number of facts (default 50, most recent first).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fact_limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool handler function for 'get_repo_memory'. It is decorated with @mcp.tool() (registration) and calls store.render() to produce a Markdown document of the repo's .ai-memory/ contents.
    @mcp.tool()
    def get_repo_memory(fact_limit: int = 50) -> str:
        """Return the entire `.ai-memory/` of the current repo as a Markdown document
        ready to drop into your LLM context. Call this **before** starting any task
        in this repo so you don't redo work other agents already verified.
    
        Args:
            fact_limit: cap on number of facts (default 50, most recent first).
        """
        return store.render(_REPO_ROOT, fact_limit=fact_limit)
  • The store.render() function called by the handler. It gathers facts, decisions, and gotchas from .ai-memory/ and assembles them into a single Markdown string.
    def render(root: Path, *, fact_limit: int | None = 50) -> str:
        """Render the whole .ai-memory/ as one markdown document for an LLM prompt."""
        if not is_initialized(root):
            return "_(no .ai-memory yet — run `repo-memory init`)_"
    
        parts: list[str] = []
        parts.append(f"# Memory snapshot for `{root.name}`\n")
        parts.append(f"_Rendered at {_now()}._\n")
    
        facts = list_facts(root, limit=fact_limit)
        parts.append(f"## Facts ({len(facts)})\n")
        if facts:
            for f in facts:
                ev = f.evidence or {}
                ev_str = ""
                if ev.get("file"):
                    lines = ev.get("lines")
                    ev_str = f" — `{ev['file']}`{':' + str(lines) if lines else ''}"
                    if ev.get("verified_at"):
                        ev_str += f" (verified {ev['verified_at']})"
                tags = " ".join(f"#{t}" for t in f.tags)
                parts.append(f"- **{f.claim}**{ev_str}  {tags}".rstrip() + "  _\\<{}>_".format(f.id))
        else:
            parts.append("_(empty)_")
    
        parts.append("\n## Decisions\n")
        decs = list_decisions(root)
        if decs:
            for p in decs:
                parts.append(f"### {p.stem}\n")
                parts.append(p.read_text(encoding="utf-8").strip() + "\n")
        else:
            parts.append("_(none yet)_")
    
        parts.append("\n## Gotchas\n")
        gotchas_path = _memdir(root) / GOTCHAS_FILE
        if gotchas_path.exists():
            parts.append(gotchas_path.read_text(encoding="utf-8").strip())
        else:
            parts.append("_(none yet)_")
    
        return "\n".join(parts) + "\n"
  • The @mcp.tool() decorator registers 'get_repo_memory' as an MCP tool with the FastMCP server.
    @mcp.tool()
  • The function signature and docstring define the schema: accepts an optional 'fact_limit' (int, default 50) and returns a string.
    def get_repo_memory(fact_limit: int = 50) -> str:
        """Return the entire `.ai-memory/` of the current repo as a Markdown document
        ready to drop into your LLM context. Call this **before** starting any task
        in this repo so you don't redo work other agents already verified.
    
        Args:
            fact_limit: cap on number of facts (default 50, most recent first).
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description explains it returns a Markdown document, the effect of fact_limit (cap, most recent first), and implies read-only. Could mention prerequisite or error cases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short paragraphs: first front-loads purpose and usage, second explains parameter. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple read tool with one optional param and output schema. Could mention error handling or if memory missing, but not critical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage, but description adds 'most recent first' ordering and explains cap, which goes beyond schema properties.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it returns the entire .ai-memory/ as Markdown, and distinguishes from sibling add_*/list_facts tools by specifying it should be called before tasks to avoid rework.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Call this **before** starting any task' and explains why. While it doesn't list alternatives, the context of sibling tools makes the usage context clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yubinkim444/repo-memory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server