On this page
1. Purpose2. <pf:asset> Element3. <pf:area> Element (Optional Child of <pf:asset>)4. Validation & Security Rules5. PFDOM Node Model & Deterministic Serialization6. Renderer & Client Projections7. Backward CompatibilityPersonafile Media Assets and Semantic Areas Specification
- Version: Draft 0.1
- Status: Working Draft
- Applies to:
PERSONAFILE/1.0document body (<pf:asset>,<pf:area>)
1. Purpose
Real-world personas (restaurants, shops, museums, venues, products,
manuals) rely on visual media — menus, floorplans,
product photos, brochures, and short videos. Standard Markdown
() cannot represent video, MIME types, placement
roles, or structured knowledge anchored to parts of a graphic.
This specification defines two composable, HTML-inspired body elements:
<pf:asset>— declares an image, video, audio, or document asset attached to the persona.<pf:area>— optional semantic child of<pf:asset>anchoring pre-extracted grounded text and/or navigable Personafile links (pref) to normalized coordinates (boxes or points), pixel-accurate semantic masks (mask="#RRGGBB"), and optional video timestamps.
Visual-First, Zero-RAG Knowledge
By storing pre-extracted text inside <pf:area> at
authoring time (e.g., when a business uploads a menu graphic and marks
regions), any client can simultaneously:
- Display the publisher's original graphic with interactive overlays to humans, and
- Feed the exact extracted region text straight into the
LLM via
PFRendererin realtime — with zero RAG pipeline, zero vector database, and zero per-query vision-model inference cost.
Separation of concerns:
<pf:area>carries purely semantic data (coordinates, label, link, extracted text). Visual presentation behaviors such as focus, zoom, background blur, or bottom-sheet inspection are client UX choices, not spec attributes.
2. <pf:asset> Element
<pf:asset id="menu-main" type="image/jpeg" src="assets/menu.jpg" role="welcome" alt="Bistro Lumière Menu">
Daily printed menu photographed each morning.
</pf:asset>
<pf:asset id="kitchen-tour" type="video/mp4" src="assets/tour.mp4" poster="assets/tour-thumb.jpg" role="gallery" alt="Kitchen tour" />2.1 Attributes
| Attribute | Required | Description |
|---|---|---|
src |
MUST | URI reference to the media resource (resolved against canonical base URI per RFC 3986). |
type |
SHOULD | IANA MIME type (e.g., image/jpeg,
image/png, image/webp, video/mp4,
audio/mpeg, application/pdf). |
alt |
SHOULD | Short accessible description and fallback label for text-only clients/LLMs. |
id |
Optional | Stable identifier within the document for caching, deep linking, or tool references. |
role |
Optional | Semantic placement hint: welcome (featured in
empty-chat/landing welcome media), gallery (default; shown
in persona details/media viewer), or reference (background
knowledge asset). |
poster |
Optional | Preview thumbnail URI reference for video or document assets (resolved per RFC 3986). |
mask |
Optional | URI reference (or lossless raster base64 data URI) to a
lossless color-ID segmentation mask image (e.g., PNG
generated by Segment Anything / SAM) sharing the aspect ratio of
src. #000000 or transparent
(alpha = 0) pixels represent unmapped background. |
| Inner text | Optional | Human- and LLM-readable caption or summary (text outside
<pf:area> children). |
3.
<pf:area> Element (Optional Child of
<pf:asset>)
Echoing HTML <area> without legacy
<map>/usemap indirection or brittle
pixel coordinates, <pf:area> nests directly inside
<pf:asset> using resolution-independent
normalized coordinates in [0.0, 1.0].
<pf:asset id="menu-main" type="image/jpeg" src="assets/menu.jpg" role="welcome" alt="Bistro Lumière Menu">
<pf:area id="starters" x="0.05" y="0.10" w="0.42" h="0.40" label="Starters">
French Onion Soup — €9. Roasted Beet Salad (V) — €11.
</pf:area>
<pf:area id="mains" x="0.52" y="0.10" w="0.43" h="0.55" label="Mains">
Duck Confit — €22. Mushroom Risotto (V, GF) — €18.
</pf:area>
<pf:area id="wine" x="0.05" y="0.55" label="Wine List" pref="/wine-sommelier/" />
</pf:asset>Video example with temporal range:
<pf:asset id="tour" type="video/mp4" src="assets/tour.mp4" poster="assets/tour.jpg" alt="Bakery tour">
<pf:area id="oven" x="0.30" y="0.40" w="0.25" h="0.30" t="12.5" t_end="18.0" label="Wood-fired oven">
Sourdough baked at 260°C every morning at 5am.
</pf:area>
</pf:asset>Real-world photo example with a pixel-accurate segmentation mask
(e.g., generated by SAM — no
x/y/w/h
required):
<pf:asset id="living-room" type="image/jpeg" src="assets/room.jpg" mask="assets/room-mask.png" alt="Living Room">
<pf:area id="lamp" mask="#E6194B" label="Arc Lamp" pref="/products/arc-lamp.pf">
Brushed brass floor lamp — €290.
</pf:area>
<pf:area id="sofa" mask="#3CB44B" label="Linen Sofa" pref="/products/linen-sofa.pf">
3-seat oatmeal linen sofa — €1,450.
</pf:area>
</pf:asset>3.1 Attributes
| Attribute | Required | Description |
|---|---|---|
mask |
Optional | 6-digit hex color key (#RRGGBB, case-insensitive,
normalized to uppercase #RRGGBB) identifying the entity's
exact pixels inside the parent <pf:asset mask="...">
image. When mask is present, the area's shape is
"mask" and x, y, w,
h are not required. |
x, y |
MUST (unless mask is
set) |
Normalized origin coordinates in [0.0, 1.0] (top-left
(0, 0) to bottom-right (1, 1)). |
w, h |
Optional | Normalized width and height in (0.0, 1.0]. When
both w and h are present (and
mask is absent), the area is a rectangular
region. When both are omitted (and
mask is absent), the area is a point / pin
marker. Specifying only one of w or h
is invalid and emits a diagnostic. |
label |
SHOULD | Short title for the region, mask entity, or pin. |
id |
Optional | Stable semantic identifier within the parent
<pf:asset> (used for PFDOM queries and LLM focus
references). |
t, t_end |
Optional | Video/audio timestamp and optional end time in seconds
(t >= 0, t_end >= t). |
pref |
Optional | Navigable link to another Personafile (resolved per RFC 3986 using
the exact same rules as <pf:a pref="...">). |
| Inner text | Optional | Pre-extracted grounded text describing the region's content for realtime LLM context and user inspection. |
4. Validation & Security Rules
- URL sanitization:
src,poster,mask(on<pf:asset>), andprefMUST be resolved against the document's canonical base URI per RFC 3986 and restricted to safe schemes (https://and relative references;http://only whenallowInsecureHttpis enabled). For self-contained single-file Personafiles,src,poster, and<pf:asset mask>MAY also use raster-only base64 data URIs (data:image/(png|jpeg|jpg|webp|gif);base64,<payload>; losslessimage/pngorimage/webpSHOULD be used for masks). Unsafe schemes (javascript:,file:,vbscript:,data:image/svg+xml,data:text/html) MUST be rejected with a diagnostic (UNSAFE_ASSET_SRC,UNSAFE_ASSET_MASK), anddata:URIs MUST NOT be permitted on<pf:area pref>. - Coordinate & mask bounds:
- When
maskis absent on<pf:area>:xandyMUST be finite numbers in[0.0, 1.0]. When present,wandhMUST be finite numbers in(0.0, 1.0]. Ifx + w > 1.0ory + h > 1.0, parsers MUST emit a diagnostic warning and clamp the effective bounds to1.0. - When
maskis present on<pf:area>: its value MUST match#RRGGBB(6 hexadecimal digits; invalid values emitINVALID_AREA_MASK_COLOR). If the parent<pf:asset>has no validmaskURI, parsers SHOULD emitMISSING_ASSET_MASK. - Lossless & nearest-neighbor requirement: Mask
images MUST be encoded without lossy compression (use
PNG or lossless WebP; avoid JPEG). Clients sampling or rendering masks
MUST use nearest-neighbor sampling (no
bilinear interpolation or anti-aliasing) to preserve exact color-ID
boundaries, and SHOULD cap decoded mask resolution
(e.g.,
<= 640pxmax side) for low memory and fastO(1)pixel hit-testing. - When present,
tMUST be>= 0.0, andt_end(if present) MUST be>= t.
- When
- Untrusted provenance: All captions,
alttext,labelvalues, and<pf:area>inner text inherit the document'suntrustedprovenance and MUST be treated as untrusted data (never privileged system instructions). - Embedded assets:
<pf:asset>elements inside<pf:embed>MUST resolvesrc,poster,mask, andprefagainst the embedded document's canonical base URI, not the parent document's URI.
5. PFDOM Node Model & Deterministic Serialization
Conformant PFDOM libraries (pfdom-js,
pfdom-kt) implementing this extension MUST
expose:
AssetNode(kind: "asset"):id: nullable stringresolvedSrc: stringmimeType: nullable string (type)alt: nullable stringrole:"welcome" | "gallery" | "reference"(defaults to"gallery")resolvedPoster: nullable stringresolvedMask: nullable string (resolved_maskin JS /resolvedMaskin Kt)caption: string (trimmed non-area inner text)areas: ordered list ofAreaNode
AreaNode(kind: "area"):id: nullable stringshape:"rect" | "point" | "mask"("mask"whenmaskcolor key is present; otherwise"rect"if bothw&hare present, else"point")x,y: double (0.0..1.0; optional /0.0whenshape == "mask")w,h: nullable double (0.0..1.0)maskColor: nullable string (mask_colorin JS /maskColorin Kt; normalized uppercase#RRGGBB)t,tEnd: nullable double (seconds)label: nullable stringresolvedPref: nullable stringtext: string (trimmed extracted inner text)
- Document convenience API:
doc.getAssets(role: String? = null): List<AssetNode>doc.getLinks()SHOULD also include navigable<pf:area pref="...">links alongside<pf:a>links.
6. Renderer & Client Projections
| Consumer | Recommended Projection |
|---|---|
PFRenderer (LLM) |
Projects each asset's alt/caption and its
<pf:area> labels + extracted text into structured
prompt context (e.g., [Asset: Menu (image/jpeg)] followed
by - Starters: French Onion Soup — €9...), and surfaces
<pf:area pref="..."> as
[Personafile: Label](url) links. Inline data:
base64 payloads and mask URIs/hex colors MUST NOT be
dumped into LLM prompts (emit inline for data:
sources). Enables realtime grounded answers with zero RAG. |
MarkdownRenderer |
Renders image assets as Markdown images (),
video/file assets as descriptive links, and <pf:area>
items as a structured bullet list beneath the asset. |
HTMLRenderer / Web Client |
Renders <img> /
<video poster="..."> wrapped in a responsive
container with percentage-positioned interactive overlays for
rect/point areas, and optional canvas
pixel-mask hit-testing / silhouette highlight for mask
areas (data-pf-mask +
data-pf-mask-color). |
| Mobile Client | Maps <pf:asset role="welcome"> into empty-chat
welcome media, all assets into PersonaDetailsActivity, and
<pf:area> into native focus-region / point-marker /
pixel-mask silhouette spotlight views (e.g.,
FocusedImagePreviewView). |
7. Backward Compatibility
Minimal PERSONAFILE/1.0 parsers that do not implement
this extension MUST continue to parse the document
without fatal errors, ignoring unknown <pf:asset> and
<pf:area> tags or degrading gracefully to their inner
text.