MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _is_auto_memory_write

Function _is_auto_memory_write

src/tool_system/tools/write.py:120–147  ·  view source on GitHub ↗

Whether *file_path* is a write inside the auto-memory directory. Mirrors the TS write-tool carve-out at ``filesystem.ts``: writes to paths matched by ``isAutoMemPath()`` are allowed without further permission gating, *but only when ``hasAutoMemPathOverride()`` is false*. The overrid

(file_path: str)

Source from the content-addressed store, hash-verified

118# ---------------------------------------------------------------------------
119
120def _is_auto_memory_write(file_path: str) -> bool:
121 """Whether *file_path* is a write inside the auto-memory directory.
122
123 Mirrors the TS write-tool carve-out at ``filesystem.ts``: writes to
124 paths matched by ``isAutoMemPath()`` are allowed without further
125 permission gating, *but only when ``hasAutoMemPathOverride()`` is
126 false*. The override case means the SDK caller has wired memory
127 themselves and has its own permission story (TS comment at
128 ``paths.ts:262-272``).
129
130 Note: TS does **not** gate this on ``isAutoMemoryEnabled()`` — the
131 carve-out is purely path-shape, not behavior-flag. We mirror that:
132 if a process has memory writes pending and then auto-memory gets
133 disabled mid-session, the in-flight writes still resolve.
134 """
135 try:
136 from src.memdir import (
137 has_auto_mem_path_override,
138 is_auto_mem_path,
139 )
140 except Exception:
141 return False
142 if has_auto_mem_path_override():
143 return False
144 try:
145 return is_auto_mem_path(_expand_path(file_path))
146 except Exception:
147 return False
148
149
150def _check_permissions(tool_input: dict[str, Any], context: ToolContext) -> PermissionResult:

Callers 4

_validate_inputFunction · 0.85
_check_permissionsFunction · 0.85
_write_callFunction · 0.85

Calls 3

is_auto_mem_pathFunction · 0.90
_expand_pathFunction · 0.70