Skip to main content
Glama

add_decision

Record architecture choices, trade-offs, and deprecations as markdown files to persist key decisions in the repo's .ai-memory/decisions/ directory.

Instructions

Record a non-trivial decision made while working in this repo (architecture choice, trade-off, deprecation, etc.) as a markdown file under .ai-memory/decisions/.

Args: title: one-line headline of the decision. body: full markdown explanation — context, options considered, reasoning, who/when.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
bodyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core handler function that creates a decision markdown file under `.ai-memory/decisions/`. Takes root path, title, and optional body. Generates a filename from date+slug, avoids clobbering by appending -2/-3 etc., writes the markdown content, and returns the path.
    def add_decision(root: Path, title: str, body: str = "") -> Path:
        init(root)
        date = datetime.now(timezone.utc).strftime("%Y-%m-%d")
        name = f"{date}-{_slug(title)}.md"
        path = _memdir(root) / DECISIONS_DIR / name
        # Avoid clobber on same day, same slug
        n = 1
        while path.exists():
            n += 1
            path = _memdir(root) / DECISIONS_DIR / f"{date}-{_slug(title)}-{n}.md"
        content = f"# {title.strip()}\n\n_Decided: {_now()}_\n\n{body.strip()}\n"
        path.write_text(content, encoding="utf-8")
        return path
  • MCP tool wrapper for add_decision. Defines the tool signature: title (str, required) and body (str, optional). Calls store.add_decision and returns a string confirming the written path. Decorated with @mcp.tool() to register with MCP.
    @mcp.tool()
    def add_decision(title: str, body: str = "") -> str:
        """Record a non-trivial decision made while working in this repo
        (architecture choice, trade-off, deprecation, etc.) as a markdown file
        under `.ai-memory/decisions/`.
    
        Args:
            title: one-line headline of the decision.
            body: full markdown explanation — context, options considered,
                  reasoning, who/when.
        """
        path = store.add_decision(_REPO_ROOT, title, body)
        return f"wrote {path.relative_to(_REPO_ROOT)}"
  • The @mcp.tool() decorator on the add_decision function registers it as an MCP tool named 'add_decision'.
    @mcp.tool()
  • CLI sub-command registration for 'add-decision' using argparse. Defines the title positional argument and optional --body argument.
    p_add_dec = sub.add_parser("add-decision", help="Add a decision document.")
    _add_root_arg(p_add_dec)
    p_add_dec.add_argument("title")
    p_add_dec.add_argument("--body", default="", help="Decision body (Markdown).")
  • Helper function _slug() that converts a title string to a filesystem-safe slug (max 60 chars), used by add_decision to construct the filename.
    def _slug(text: str) -> str:
        s = re.sub(r"[^a-zA-Z0-9]+", "-", text.lower()).strip("-")
        return s[:60] or "decision"
Behavior2/5

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

No annotations are provided, and the description only states the basic action of recording a file. It does not disclose behaviors like overwrite policy, directory creation, permissions, or rate limits.

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

Conciseness4/5

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

The description is concise with a front-loaded main sentence and a separate Args section. It wastes no words, though the Args could be integrated more tightly.

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

Completeness3/5

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

Given no annotations and an output schema, the description provides the core purpose and parameter usage but lacks details on return behavior, file naming, or whether it appends/overwrites. Adequate but with clear gaps.

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?

With 0% schema description coverage, the description compensates by explaining the title as 'one-line headline' and body as 'full markdown explanation' with content guidance. This adds significant meaning beyond the empty schema.

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?

The description clearly states the tool records non-trivial decisions as markdown files in a specific directory, with examples of what qualifies. This distinguishes it from sibling tools like add_fact and add_gotcha.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives like add_fact or add_gotcha. The description implies usage for decisions but lacks when-not-to-use criteria.

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