Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: remove limit from git-base memory frontmatter and increase default to 100k (#9537)
github-actions[bot]94fc05b6e530
diff --git a/letta/constants.py b/letta/constants.pyindex e36b0b324..0abe94a8f 100644--- a/letta/constants.py+++ b/letta/constants.py@@ -419,7 +419,7 @@ MAX_ERROR_MESSAGE_CHAR_LIMIT = 1000# Default memory limitsCORE_MEMORY_PERSONA_CHAR_LIMIT: int = 20000CORE_MEMORY_HUMAN_CHAR_LIMIT: int = 20000-CORE_MEMORY_BLOCK_CHAR_LIMIT: int = 20000+CORE_MEMORY_BLOCK_CHAR_LIMIT: int = 100000# Function return limitsFUNCTION_RETURN_CHAR_LIMIT = 50000 # ~300 wordsdiff --git a/letta/schemas/memory.py b/letta/schemas/memory.pyindex 3c17f557e..ce80fb33c 100644--- a/letta/schemas/memory.py+++ b/letta/schemas/memory.py@@ -226,8 +226,6 @@ class Memory(BaseModel, validate_assignment=True):front_lines = []if block.description:front_lines.append(f"description: {block.description}")- if block.limit is not None:- front_lines.append(f"limit: {block.limit}")if getattr(block, "read_only", False):front_lines.append("read_only: true")diff --git a/letta/services/memory_repo/block_markdown.py b/letta/services/memory_repo/block_markdown.pyindex 3c9d3e3a5..dfb70afef 100644--- a/letta/services/memory_repo/block_markdown.py+++ b/letta/services/memory_repo/block_markdown.py@@ -3,11 +3,11 @@File format:---description: "Who I am and how I approach work"- limit: 20000---My name is Memo. I'm a stateful coding assistant...- Frontmatter fields are only rendered when they differ from defaults.+- ``limit`` is intentionally excluded from frontmatter (deprecated for git-base memory).- Files without frontmatter are treated as value-only (backward compat)."""@@ -37,12 +37,12 @@ def serialize_block(This is used for initial file creation. For updates to existing files,prefer `merge_frontmatter_with_body` to preserve user formatting."""- # description and limit are always included in frontmatter.+ # description is always included in frontmatter.# read_only and metadata are only included when non-default.+ # limit is intentionally excluded (deprecated for git-base memory).front: Dict[str, Any] = {}front["description"] = description- front["limit"] = limit if limit is not None else _get_field_default("limit")if read_only != _get_field_default("read_only"):front["read_only"] = read_only@@ -111,7 +111,6 @@ def merge_frontmatter_with_body(# Desired valuesdesired_description = description- desired_limit = limit if limit is not None else _get_field_default("limit")desired_read_only = read_onlydesired_metadata = metadata if metadata is not None else _get_field_default("metadata")@@ -122,8 +121,9 @@ def merge_frontmatter_with_body(parsed["description"] = desired_descriptionchanged = True- if "limit" not in parsed or parsed.get("limit") != desired_limit:- parsed["limit"] = desired_limit+ # Remove limit from frontmatter if it exists (deprecated for git-base memory)+ if "limit" in parsed:+ del parsed["limit"]changed = Trueif desired_read_only != _get_field_default("read_only"):