Skip to main content

Module attribution

Module attribution 

Source
Expand description

Drawer creator-attribution tag helpers.

Why: prior to this module, drawers carried content, room, importance, and free-form tags but no first-class metadata describing the writer. Operators who saw noise drawers in a palace had no way to trace which client wrote them — was it the trusty-memory MCP, a curl from a shell script, claude-mpm’s Python hook, the dashboard form? This module defines a reserved creator:* tag namespace that every write path (HTTP, MCP, CLI, hook) attaches automatically. With creator:client=… present on every drawer, “where did this come from?” becomes grep-able. The namespace approach (vs. a Drawer schema change) piggy-backs on the existing msg: tag pattern from #99 so no migration is required.

What:

  • CREATOR_*_PREFIX constants — the four reserved tag prefixes.
  • CreatorInfo — small value type carrying client name, version, source, and optional cwd. into_tags() renders the four tag strings (or three, when cwd is absent) in a stable order.
  • is_creator_tag — predicate used by UI render code that wants to hide the namespace from the main tag chips (mirroring how msg:* is filtered today).

Test: see the tests module at the bottom — covers tag composition, prefix detection, and round-trip via is_creator_tag.

Structs§

CreatorInfo
Value type describing the writer of a drawer.

Enums§

CreatorSource
Originating-subsystem labels emitted into creator:source=.

Constants§

CLI_CLIENT_NAME
Client name attached to drawers written by the trusty-memory CLI.
CREATOR_CLIENT_PREFIX
Tag prefix carrying the writing client’s short name (e.g. creator:client=trusty-memory-mcp).
CREATOR_CWD_PREFIX
Tag prefix carrying the writing process’ cwd at write time (e.g. creator:cwd=/Users/alice/projects/foo).
CREATOR_SESSION_PREFIX
Tag prefix carrying the short session id of the writer (issue #202).
CREATOR_SOURCE_PREFIX
Tag prefix carrying the originating subsystem (http/mcp/hook/cli).
CREATOR_VERSION_PREFIX
Tag prefix carrying the writing client’s version string (e.g. creator:version=0.5.1).
HOOK_CLIENT_NAME
Client name attached to drawers written by hook-driven code paths.
HTTP_DEFAULT_CLIENT
Default client name used when an HTTP caller omits the X-Trusty-Client-Name header.
MCP_CLIENT_NAME
Client name attached to drawers written by the MCP tool surface.
X_TRUSTY_CLIENT_CWD
HTTP request header carrying the writing client’s cwd.
X_TRUSTY_CLIENT_NAME
HTTP request header carrying the writing client’s short name.

Functions§

is_creator_tag
Return true when a tag belongs to the creator:* reserved namespace.
session_tag_from_tags
Build a creator:session=<first-8-chars> tag from the first bare UUID found in tags, if any (issue #202).