SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.21867 · 2026

MemGuard: Persisting Verifier Signals for LLM-Agent Memory Governance

Hao Tang, Haoyu Wang, Chuang Liu, Zijing Zhang, Chao Xue, Jiachen Luo, Guangyuan Dong, He Liang

arXiv · PDF · Open in the Atlas

Code that ran

14 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 8 failures of our instrument; 8 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2608.21867.json · badge: /api/ran/2608.21867.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
whyyyyy123/MemGuard community
Papers with Code archive
14 ran · 8 no recorded run
FunctionStatusWhere it lives
_age_days Ran
ran, honoured the contract we drafted
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("1ed3295c923663a0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datetime import datetime, timezone

# Construct arguments for _age_days function
value = "2024-01-15T10:30:00+00:00"
now = datetime(2024, 1, 20, 15, 45, 30, tzinfo=timezone.utc)

ARGS = {
    "value": value,
    "now": now,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_is_verified_success Ran
ran, violated the contract we drafted
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("46190085512be5a1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field

class MemoryState(str, Enum):
    PROVISIONAL = 'provisional'
    ACTIVE = 'active'
    SUMMARY = 'summary'
    ARCHIVED = 'archived'

class MemoryType(str, Enum):
    PROCEDURAL_HINT = 'procedural_hint'
    FAILURE_AVOIDANCE = 'failure_avoidance'
    TOOL_USAGE = 'tool_usage'

class MemoryRecord(BaseModel):
    memory_id: str
    task_id: str
    query: str
    title: str = ''
    description: str = ''
    content: str
    applicability: str = ''
    risk: str = 'none'
    evidence_span: str = ''
    failure_guard: bool = False
    memory_type: MemoryType
    source_status: str
    state: MemoryState
    confidence: float
    quality_score: float
    created_at: str
    last_used_at: Optional[str] = None
    use_count: int = 0
    dedup_key: str
    supersedes: list[str] = Field(default_factory=list)
    conflicts_with: list[str] = Field(default_factory=list)
    embedding: Optional[list[float]] = None
    verifier_score: Optional[float] = None
    verifier_confidence: Optional[float] = None
    verifier_label: Optional[str] = None
    verifier_criteria: dict[str, float] = Field(default_factory=dict)
    verifier_model: Optional[str] = None
    verification_time: Optional[str] = None
    verifier_uncertainty: Optional[float] = None
    verifier_views: list[str] = Field(default_factory=list)

def _is_verified_success(record: MemoryRecord) -> bool:
    return (record.verifier_label or record.source_status) in {'success', 'verified_success'}

# Create a valid MemoryRecord instance
record = MemoryRecord(
    memory_id='mem_001',
    task_id='task_001',
    query='How do I use this tool?',
    title='Tool Usage Guide',
    description='A guide for using the tool',
    content='Step 1: Open the tool. Step 2: Configure settings.',
    applicability='general',
    risk='low',
    evidence_span='Step 1-2',
    failure_guard=False,
    memory_type=MemoryType.TOOL_USAGE,
    source_status='verified_success',
    state=MemoryState.ACTIVE,
    confidence=0.95,
    quality_score=0.88,
    created_at='2024-01-01T00:00:00Z',
    last_used_at='2024-01-02T00:00:00Z',
    use_count=5,
    dedup_key='dedup_key_001',
    supersedes=[],
    conflicts_with=[],
    embedding=[0.1, 0.2, 0.3, 0.4],
    verifier_score=0.92,
    verifier_confidence=0.87,
    verifier_label='success',
    verifier_criteria={'accuracy': 0.9, 'relevance': 0.85},
    verifier_model='model_v1',
    verification_time='2024-01-02T01:00:00Z',
    verifier_uncertainty=0.05,
    verifier_views=['view1', 'view2']
)

ARGS = {
    'record': record
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
pydantic, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_make_summary_record Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("54460377e09f4f92")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned MemoryRecord. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from datetime import datetime
from typing import Callable
from enum import Enum

class MemoryState(str, Enum):
    PROVISIONAL = 'provisional'
    ACTIVE = 'active'
    SUMMARY = 'summary'
    ARCHIVED = 'archived'

class MemoryType(str, Enum):
    PROCEDURAL_HINT = 'procedural_hint'
    FAILURE_AVOIDANCE = 'failure_avoidance'
    TOOL_USAGE = 'tool_usage'

from pydantic import BaseModel, Field
from typing import Optional

class MemoryRecord(BaseModel):
    memory_id: str
    task_id: str
    query: str
    title: str = ''
    description: str = ''
    content: str
    applicability: str = ''
    risk: str = 'none'
    evidence_span: str = ''
    failure_guard: bool = False
    memory_type: MemoryType
    source_status: str
    state: MemoryState
    confidence: float
    quality_score: float
    created_at: str
    last_used_at: Optional[str] = None
    use_count: int = 0
    dedup_key: str
    supersedes: list[str] = Field(default_factory=list)
    conflicts_with: list[str] = Field(default_factory=list)
    embedding: Optional[list[float]] = None
    verifier_score: Optional[float] = None
    verifier_confidence: Optional[float] = None
    verifier_label: Optional[str] = None
    verifier_criteria: dict[str, float] = Field(default_factory=dict)
    verifier_model: Optional[str] = None
    verification_time: Optional[str] = None
    verifier_uncertainty: Optional[float] = None
    verifier_views: list[str] = Field(default_factory=list)

def create_memory_record(
    memory_id: str,
    task_id: str,
    query: str,
    content: str,
    memory_type: MemoryType,
    source_status: str,
    state: MemoryState,
    confidence: float,
    quality_score: float,
    created_at: str,
    dedup_key: str,
) -> MemoryRecord:
    return MemoryRecord(
        memory_id=memory_id,
        task_id=task_id,
        query=query,
        content=content,
        memory_type=memory_type,
        source_status=source_status,
        state=state,
        confidence=confidence,
        quality_score=quality_score,
        created_at=created_at,
        dedup_key=dedup_key,
    )

now_str = "2024-01-15T10:30:00Z"

records = [
    create_memory_record(
        memory_id="mem_001",
        task_id="task_001",
        query="How to use tool X?",
        content="Tool X is used by calling function Y with parameter Z",
        memory_type=MemoryType.TOOL_USAGE,
        source_status="verified",
        state=MemoryState.ACTIVE,
        confidence=0.95,
        quality_score=0.92,
        created_at="2024-01-14T10:00:00Z",
        dedup_key="tool_x_usage",
    ),
    create_memory_record(
        memory_id="mem_002",
        task_id="task_001",
        query="How to use tool X?",
        content="Tool X requires initialization before use",
        memory_type=MemoryType.PROCEDURAL_HINT,
        source_status="verified",
        state=MemoryState.ACTIVE,
        confidence=0.88,
        quality_score=0.85,
        created_at="2024-01-14T11:00:00Z",
        dedup_key="tool_x_usage",
    ),
    create_memory_record(
        memory_id="mem_003",
        task_id="task_001",
        query="How to use tool X?",
        content="Avoid passing None to tool X parameter",
        memory_type=MemoryType.FAILURE_AVOIDANCE,
        source_status="verified",
        state=MemoryState.ACTIVE,
        confidence=0.91,
        quality_score=0.89,
        created_at="2024-01-14T12:00:00Z",
        dedup_key="tool_x_usage",
    ),
]

def summarize_fn(records: list[MemoryRecord]) -> str:
    summaries = [f"- {record.content}" for record in records]
    return "Summary of tool usage:\n" + "\n".join(summaries)

ARGS = {
    "records": records,
    "now": now_str,
    "summarize_fn": summarize_fn,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, pydantic, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MemoryRecord — a MemoryRecord output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MemoryRecord output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_normalize_text Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("2d262cf10a58fb63")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

PHRASE_MAP = {'dimensionless inputs': 'dimensionless', 'failing regression test': 'failure test', 'failing test': 'failure test', 'multi line': 'multiline', 'multi-line': 'multiline', 'programmatic solution': 'script', 'programmatic tools': 'script', 'provided examples': 'reproduce', 'python script': 'script', 'reproduction script': 'reproduce script', 'shell commands': 'shell', 'shell utilities': 'shell', 'text manipulation tools': 'shell'}

def _normalize_text(text: str) -> str:
    normalized = text.lower().replace('`', ' ')
    for source, target in PHRASE_MAP.items():
        normalized = normalized.replace(source, target)
    normalized = normalized.replace('do not', 'dont')
    normalized = normalized.replace("don't", 'dont')
    normalized = re.sub('[^a-z0-9_+\\-\\s]', ' ', normalized)
    normalized = normalized.replace('-', ' ')
    return re.sub('\\s+', ' ', normalized).strip()

ARGS = {
    'text': 'Hello World! This is a Python script with multi-line code and shell commands. Do not forget dimensionless inputs!'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_normalize_token Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("9a4ad480d7420674")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Analyze the function signature and body
# The function _normalize_token takes a single parameter: token (str)
# It performs string operations on the token and returns str | None

# Setup
ARGS = {
    'token': 'debugging'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_parse_timestamp Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("f8163f6324dd61be")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned datetime. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datetime import datetime, timezone

ARGS = {
    "value": "2024-01-15T10:30:45+00:00"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type datetime — a datetime output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a datetime output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_retention_score Ran
ran, honoured the contract we drafted
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("55370582150beff6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datetime import datetime, timezone
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field

class MemoryState(str, Enum):
    PROVISIONAL = 'provisional'
    ACTIVE = 'active'
    SUMMARY = 'summary'
    ARCHIVED = 'archived'

class MemoryType(str, Enum):
    PROCEDURAL_HINT = 'procedural_hint'
    FAILURE_AVOIDANCE = 'failure_avoidance'
    TOOL_USAGE = 'tool_usage'

def _parse_timestamp(value: str | None) -> datetime | None:
    if not value:
        return None
    normalized = value.replace('Z', '+00:00')
    return datetime.fromisoformat(normalized)

def _age_days(value: str | None, *, now: datetime) -> float:
    dt = _parse_timestamp(value)
    if dt is None:
        return 0.0
    return max((now - dt).total_seconds() / 86400.0, 0.0)

class MemoryRecord(BaseModel):
    memory_id: str
    task_id: str
    query: str
    title: str = ''
    description: str = ''
    content: str
    applicability: str = ''
    risk: str = 'none'
    evidence_span: str = ''
    failure_guard: bool = False
    memory_type: MemoryType
    source_status: str
    state: MemoryState
    confidence: float
    quality_score: float
    created_at: str
    last_used_at: Optional[str] = None
    use_count: int = 0
    dedup_key: str
    supersedes: list[str] = Field(default_factory=list)
    conflicts_with: list[str] = Field(default_factory=list)
    embedding: Optional[list[float]] = None
    verifier_score: Optional[float] = None
    verifier_confidence: Optional[float] = None
    verifier_label: Optional[str] = None
    verifier_criteria: dict[str, float] = Field(default_factory=dict)
    verifier_model: Optional[str] = None
    verification_time: Optional[str] = None
    verifier_uncertainty: Optional[float] = None
    verifier_views: list[str] = Field(default_factory=list)

def _retention_score(record: MemoryRecord, *, now: datetime) -> float:
    age = _age_days(record.last_used_at or record.created_at, now=now)
    label = record.verifier_label or record.source_status
    if label in {'verified_success', 'success'}:
        success_bonus = 0.5
    elif label == 'uncertain':
        success_bonus = -0.2
    elif record.failure_guard or record.memory_type.value == 'failure_avoidance':
        success_bonus = 0.1
    else:
        success_bonus = -0.3
    usage_bonus = min(record.use_count * 0.1, 0.5)
    recency_bonus = max(0.0, 0.25 - min(age / 90.0, 0.25))
    verifier_reward = record.verifier_score if record.verifier_score is not None else record.quality_score
    verifier_confidence = record.verifier_confidence if record.verifier_confidence is not None else record.confidence
    conflict_penalty = min(len(record.conflicts_with) * 0.1, 0.3)
    return verifier_reward + verifier_confidence + success_bonus + usage_bonus + recency_bonus - conflict_penalty

now = datetime(2024, 1, 15, 12, 0, 0, tzinfo=timezone.utc)

record = MemoryRecord(
    memory_id='mem_001',
    task_id='task_001',
    query='How to debug memory issues?',
    title='Memory Debugging Guide',
    description='A guide for debugging memory-related issues',
    content='When debugging memory issues, check allocation patterns and use profilers.',
    applicability='debugging',
    risk='low',
    evidence_span='lines 42-58',
    failure_guard=False,
    memory_type=MemoryType.PROCEDURAL_HINT,
    source_status='success',
    state=MemoryState.ACTIVE,
    confidence=0.85,
    quality_score=0.9,
    created_at='2024-01-10T10:00:00+00:00',
    last_used_at='2024-01-14T15:30:00+00:00',
    use_count=5,
    dedup_key='dedup_001',
    supersedes=[],
    conflicts_with=['mem_002'],
    embedding=[0.1, 0.2, 0.3, 0.4],
    verifier_score=0.88,
    verifier_confidence=0.92,
    verifier_label='verified_success',
    verifier_criteria={'accuracy': 0.95, 'relevance': 0.88},
    verifier_model='gpt-4',
    verification_time='2024-01-14T16:00:00+00:00',
    verifier_uncertainty=0.05,
    verifier_views=['view_1', 'view_2']
)

ARGS = {
    'record': record,
    'now': now
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_stronger_record Ran
ran, honoured the contract we drafted
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("f4ae4281d4257d39")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datetime import datetime, timezone
from enum import Enum

class MemoryState(str, Enum):
    PROVISIONAL = 'provisional'
    ACTIVE = 'active'
    SUMMARY = 'summary'
    ARCHIVED = 'archived'

class MemoryType(str, Enum):
    PROCEDURAL_HINT = 'procedural_hint'
    FAILURE_AVOIDANCE = 'failure_avoidance'
    TOOL_USAGE = 'tool_usage'

class MemoryRecord:
    def __init__(self):
        self.memory_id = "mem_001"
        self.task_id = "task_001"
        self.query = "test query"
        self.title = "Test Title"
        self.description = "Test Description"
        self.content = "Test Content"
        self.applicability = "high"
        self.risk = "none"
        self.evidence_span = "span_001"
        self.failure_guard = False
        self.memory_type = MemoryType.PROCEDURAL_HINT
        self.source_status = "success"
        self.state = MemoryState.ACTIVE
        self.confidence = 0.85
        self.quality_score = 0.90
        self.created_at = "2024-01-15T10:30:00+00:00"
        self.last_used_at = "2024-01-20T14:45:00+00:00"
        self.use_count = 5
        self.dedup_key = "dedup_key_001"
        self.supersedes = []
        self.conflicts_with = []
        self.embedding = [0.1, 0.2, 0.3, 0.4]
        self.verifier_score = 0.88
        self.verifier_confidence = 0.92
        self.verifier_label = "verified_success"
        self.verifier_criteria = {"accuracy": 0.95, "relevance": 0.88}
        self.verifier_model = "verifier_v1"
        self.verification_time = "2024-01-20T15:00:00+00:00"
        self.verifier_uncertainty = 0.05
        self.verifier_views = ["view_1", "view_2"]

def _parse_timestamp(value: str | None) -> datetime | None:
    if not value:
        return None
    normalized = value.replace('Z', '+00:00')
    return datetime.fromisoformat(normalized)

def _age_days(value: str | None, *, now: datetime) -> float:
    dt = _parse_timestamp(value)
    if dt is None:
        return 0.0
    return max((now - dt).total_seconds() / 86400.0, 0.0)

def _retention_score(record: MemoryRecord, *, now: datetime) -> float:
    age = _age_days(record.last_used_at or record.created_at, now=now)
    label = record.verifier_label or record.source_status
    if label in {'verified_success', 'success'}:
        success_bonus = 0.5
    elif label == 'uncertain':
        success_bonus = -0.2
    elif record.failure_guard or record.memory_type.value == 'failure_avoidance':
        success_bonus = 0.1
    else:
        success_bonus = -0.3
    usage_bonus = min(record.use_count * 0.1, 0.5)
    recency_bonus = max(0.0, 0.25 - min(age / 90.0, 0.25))
    verifier_reward = record.verifier_score if record.verifier_score is not None else record.quality_score
    verifier_confidence = record.verifier_confidence if record.verifier_confidence is not None else record.confidence
    conflict_penalty = min(len(record.conflicts_with) * 0.1, 0.3)
    return verifier_reward + verifier_confidence + success_bonus + usage_bonus + recency_bonus - conflict_penalty

def _stronger_record(record: MemoryRecord, *, now: datetime) -> tuple[float, float, float, int]:
    label = record.verifier_label or record.source_status
    label_priority = {'verified_success': 3.0, 'success': 2.5, 'verified_fail': 2.8 if record.failure_guard or record.memory_type.value == 'failure_avoidance' else 0.5, 'fail': 1.0 if record.failure_guard or record.memory_type.value == 'failure_avoidance' else 0.0, 'uncertain': 0.8}.get(label, 0.5)
    verifier_reward = record.verifier_score if record.verifier_score is not None else record.quality_score
    verifier_confidence = record.verifier_confidence if record.verifier_confidence is not None else record.confidence
    return (label_priority, verifier_reward, verifier_confidence, _retention_score(record, now=now), record.use_count)

record = MemoryRecord()
now = datetime(2024, 1, 25, 12, 0, 0, tzinfo=timezone.utc)

ARGS = {
    'record': record,
    'now': now
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_signature Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("fcfff9d162975a44")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

ARGS = {
    'text': 'This is a failing regression test with a reproduction script that uses shell commands to debug the error and inspect the multiline code for syntax errors',
    'max_tokens': 6
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_token_set Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("3bc79e46d07c6eb3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned set. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

ARGS = {
    "text": "This is a test with failing regression tests and shell commands for debugging. Don't modify the code, just reproduce the issue with a python script."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
canonical_tokens Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("09e53c079cc48f93")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

ARGS = {
    "text": "This is a failing regression test with multi-line shell commands for debugging. We need to reproduce the bug and verify the fix using a python script."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_text_relevance Ran
ran, honoured the contract we drafted
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("0a7496e54bac1ee4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from difflib import SequenceMatcher
import re

torch.manual_seed(0)

def tokenize(text: str) -> set[str]:
    return {token for token in re.findall('[a-z0-9_]{3,}', text.lower())}

def compute_text_relevance(query: str, text: str) -> float:
    query_tokens = tokenize(query)
    text_tokens = tokenize(text)
    if not query_tokens or not text_tokens:
        return 0.0
    overlap = len(query_tokens & text_tokens) / len(query_tokens | text_tokens)
    surface = SequenceMatcher(None, query.lower(), text.lower()).ratio()
    return overlap * 0.7 + surface * 0.3

ARGS = {
    "query": "machine learning algorithms",
    "text": "machine learning is a subset of artificial intelligence that focuses on algorithms"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
has_negation Ran
ran, violated the contract we drafted
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("0c8761b47d687424")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

NEGATION_TOKENS = {'avoid', 'cannot', 'never', 'no', 'not', 'without'}

PHRASE_MAP = {'dimensionless inputs': 'dimensionless', 'failing regression test': 'failure test', 'failing test': 'failure test', 'multi line': 'multiline', 'multi-line': 'multiline', 'programmatic solution': 'script', 'programmatic tools': 'script', 'provided examples': 'reproduce', 'python script': 'script', 'reproduction script': 'reproduce script', 'shell commands': 'shell', 'shell utilities': 'shell', 'text manipulation tools': 'shell'}

def _normalize_text(text: str) -> str:
    normalized = text.lower().replace('`', ' ')
    for source, target in PHRASE_MAP.items():
        normalized = normalized.replace(source, target)
    normalized = normalized.replace('do not', 'dont')
    normalized = normalized.replace("don't", 'dont')
    normalized = re.sub('[^a-z0-9_+\\-\\s]', ' ', normalized)
    normalized = normalized.replace('-', ' ')
    return re.sub('\\s+', ' ', normalized).strip()

def has_negation(text: str) -> bool:
    normalized = _normalize_text(text)
    words = set(re.findall('[a-z0-9_]{2,}', normalized))
    return 'dont' in words or bool(words & NEGATION_TOKENS)

ARGS = {
    'text': "Please avoid using this approach without proper testing"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tokenize Ran
ran; our contract draft was wrong, not the code
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("5f9acd760a957490")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned set. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def tokenize(text: str) -> set[str]:
    return {token for token in re.findall('[a-z0-9_]{3,}', text.lower())}

# Setup code
text_input = "Hello World! This is a test_123 with some numbers 456 and symbols @#$."

ARGS = {
    "text": text_input
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MemoryRecord Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("084726e6df28f3cf")
How it ran

no invocation recorded.

MemoryState Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("e4583c10b7a84975")
How it ran

no invocation recorded.

MemoryType Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("e7f0ac915b745d4f")
How it ran

no invocation recorded.

_resolve_conflicts Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("fe4477a4110d856d")
How it ran

no invocation recorded.

_similarity Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("d78eac1bb02c4e9b")
How it ran

no invocation recorded.

may_conflict Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("4cc9b56ca604d3d9")
How it ran

no invocation recorded.

run_budgeted_governance Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("477b35bb458ab53b")
How it ran

no invocation recorded.

signature_similarity Not yet run
unverified (harvested, no recorded run)
whyyyyy123/MemGuard/src/memguard/memory/governance.py
code served (permissive licence) · get_code("24882a9c1b05b99b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 22 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

LLM agents are moving from single-prompt use to long task streams in which reusable memory becomes a core capability for terminal, software-engineering, and web tasks. Such memory is useful only when stored experience remains reliable across hundreds of interactions, but two failure modes break that assumption in practice. The first is unreliable admission: failed trajectories, accidental successes, and misleading observations enter memory because they appear relevant, then mislead later decisions. The second is memory drift: long-running banks accumulate duplicate, stale, and conflicting records that retrieval alone cannot repair. MemGuard's key distinction is to treat verifier output not as a one-shot filter, but as persistent lifecycle metadata. It converts multi-criteria score-token verification into reward, confidence, label, and uncertainty descriptors that are attached to every candidate before activation and reused during retrieval, conflict resolution, summarization, and archival. We evaluate MemGuard on Terminal-Bench 2.0, SWE-Bench Verified, WebArena, and Mind2Web across four backbones, comparing against four memory baselines plus a verifier-only control under matched runtime budgets. Averaged over five seeds, MemGuard achieves the best success metric and lowest average steps in all 16 backbone-benchmark settings, improving over ReasoningBank, the strongest prior baseline among the memory methods we evaluate, with a largest gain of 7.9 success-rate points on WebArena, 5.6 stepsuccess-rate points on Mind2Web, and 2.4-3.5 points on terminal and software-engineering benchmarks. Code is available at https:// github.com/whyyyyy123/MemGuard.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2608.21867")
get_code_for_paper("2608.21867")
have("2608.21867")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2608.21867.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2608.21867.svg)](https://syntology.ai/paper/2608.21867)

Connect an agent — have() is free.