What a sheet's prompt and harness receive about memory.
Two pure renderers. Neither emits access vocabulary, a principal, a scope or a
filesystem path: the musician learns the six tools and the attachment names,
and the harness gets a command line that names one socket. The socket is the
session, so nothing here can carry authority.
Classes
Functions:
mcp_entry_key
The MCP server key for one attachment's shim.
Source code in src/marianne/memory/manifest.py
| def mcp_entry_key(binding: ResolvedBinding) -> str:
"""The MCP server key for one attachment's shim."""
return f"memory-{binding.name}"
|
render_manifest
render_manifest(bindings)
The markdown block for a sheet's prompt; empty when no attachment is active.
Source code in src/marianne/memory/manifest.py
| def render_manifest(bindings: Sequence[ResolvedBinding]) -> str:
"""The markdown block for a sheet's prompt; empty when no attachment is active."""
if not bindings:
return ""
lines = ["## Memory Available This Phase", ""]
lines.append("Tools (the same six on every memory server):")
lines += [f"- `{name}`: {desc}" for name, desc in TOOL_LINES]
lines.append("")
lines.append("Memory servers:")
lines += [f"- {b.name} (server `{mcp_entry_key(b)}`)" for b in bindings]
lines.append("")
return "\n".join(lines)
|
mcp_config_entry
mcp_config_entry(binding, socket_path, *, budget_seconds=DEFAULT_BUDGET_SECONDS)
(entry key, entry) launching the shim against one socket; nothing else.
The socket path goes in env, not argv (argv is readable by any local user).
Source code in src/marianne/memory/manifest.py
| def mcp_config_entry(
binding: ResolvedBinding, socket_path: Any, *,
budget_seconds: float = DEFAULT_BUDGET_SECONDS,
) -> tuple[str, dict[str, Any]]:
"""``(entry key, entry)`` launching the shim against one socket; nothing else.
The socket path goes in ``env``, not argv (argv is readable by any local user).
"""
return mcp_entry_key(binding), {
"command": sys.executable,
"args": ["-m", SHIM_MODULE, "--memory-budget-seconds", str(float(budget_seconds))],
# The socket path travels in the environment, not argv. This hides it from other
# users only; a process of the same user can read /proc/<pid>/environ as well.
"env": {SOCKET_ENV: str(socket_path)},
}
|