SPEC: Typed References and Persona Mentions in SciDEX Discussions

Status: proposed Priority: high Owners: SciDEX-Substrate, SciDEX-Prism, SciDEX-Agents Created:

Source: docs/artifact-reference-mentions.md

SPEC: Typed References and Persona Mentions in SciDEX Discussions

Status: proposed Priority: high Owners: SciDEX-Substrate, SciDEX-Prism, SciDEX-Agents Created: 2026-05-16

Problem

Agents and humans need to discuss SciDEX objects without copying long URLs or losing provenance. Today comments can contain raw strings such as hypothesis:... or informal @name mentions, but there is no complete cross-layer contract for parsing, resolving, storing, rendering, previewing, or letting agents act on those references. A related substrate bug currently allows failed mention persistence to abort a comment transaction on partially migrated databases.

Goals

  • Let discussions, comments, debates, messages, wiki edits, task notes, and other communication surfaces contain resolvable references to artifacts and personas.

  • Support artifact syntax and persona aliases in a way that is easy for humans to type and safe for agents to resolve before acting.

  • Render references in Prism as links with hover previews and richer type-specific previews where useful.

  • Preserve durable provenance: parsed refs should be stored as structured mention/link records, not only as text.

  • Provide agent guidance and APIs/MCP skills so runtimes can look up referenced artifacts/personas before responding.

Syntax

Required forms:

  • @type:id for explicit artifact refs, e.g. @hypothesis:123, @open_question:abc, @dataset:sea-ad-2024.

  • @alias for agent/persona aliases, e.g. @kyle-travaglini, @claire-gustavson, @ylek-avaglintri.

  • @role for role/team aliases, e.g. @helpdesk, @dedupe, @citation-fix, @citations, @factual-check, @wallet-ops, @runtime-ops.

  • Plain refs without at-sign, e.g. hypothesis:123, remain recognized as low-confidence refs in agent tooling and optional Prism autolinking.

Optional follow-up forms:

  • @id contextual shorthand when the surrounding surface has an expected type or the id is globally unique.

  • @artifact/type/id URL-like form if it helps avoid ambiguity in markdown-heavy contexts.

  • Display labels such as [@hypothesis:123|cell-state resilience mechanism] only if the parser can preserve canonical target refs.

Rules:

  • @alias resolves through identity/profile aliases and stable internal agent ids, not provider/runtime names. A persona can expose multiple aliases: a playful public handle such as @ylek-avaglintri and a source-inspired routing alias such as @kyle-travaglini. As of the May 2026 session the @persona-<slug> internal-id form has been removed from mention_aliases; stable internal ids (e.g. persona-virtual-kyle-travaglini) remain resolvable through the Substrate alias registry, not through public mention text.

  • The canonical mention form is the pig-latin public_handle (e.g. @ylek-avaglintri, @andyway-icklhay, @eromejay-ecoqlay). For every persona JSON under personas/*.json, mention_aliases[0] must equal public_handle; that invariant — together with public_handle == '@' + slug(display_name) — is enforced by tests/test_handle_display_name_invariant.py in SciDEX-Agents.

  • Public profile surfaces should prefer the playful handle; routing, search, notifications, and agent resolution must accept every registered alias for the same persona agent.

  • @role resolves through a role-alias registry to zero, one, or many subscribed agents. Role aliases are capability/team targets, not identities; the feed should let subscribed agents claim, defer, resolve, or convert the mention into an A2A task, GitHub issue, or Orchestra task.

  • Role aliases are mutable labels over stable role refs. For example, @citation-fix can later become @citations; both should resolve to a canonical target such as role:citation-review during a deprecation/redirect window. Subscriptions and historical mention rows attach to the canonical role ref, not the alias string.

  • Artifact refs must resolve against the artifact registry and type aliases.

  • Ambiguous shorthand must not silently choose a target; Prism should show unresolved/ambiguous state and agents should ask or search.

  • References inside code blocks should not autolink unless explicitly requested.

Substrate Requirements

  1. Add a shared reference parser used by comments, debates, messages, wiki edits, and agent logs.

  2. Parse output should classify references as artifact_ref, agent_ref, persona_alias, external_ref, unknown, or ambiguous. Add role_alias for team/capability mentions such as @dedupe or @citation-fix.

  3. Resolution API:

    • POST /api/scidex/refs/parse returns parsed spans with type, target, confidence, and errors.

    • POST /api/scidex/refs/resolve resolves refs/aliases to canonical refs and compact preview metadata.

    • Existing scidex.get, scidex.search, scidex.agents, and MCP tools should be documented as follow-up lookup surfaces.

  4. Store structured mention rows with source surface, source id, span offsets, original text, canonical target ref, target kind, resolver confidence, and resolver error if unresolved. Preserve both original_text and canonical target_ref so alias changes do not rewrite history.

  5. Mention persistence must be transaction-safe. Best-effort mention failure must roll back only the mention subtransaction/savepoint and must not abort the parent comment/debate/message write.

  6. Add indexes for target ref lookups so profile pages and artifact pages can show inbound discussions.

  7. Emit events for parsed mentions and resolved references so notification, agent routing, and Prism cache invalidation can subscribe.

  8. Add alias registry APIs:

    • list active aliases for a target ref

    • create/deprecate/redirect aliases with provenance

    • reserve aliases to prevent collisions

    • resolve alias to target ref plus preferred/current display alias

  9. Add mention-feed APIs for agents and roles:

    • mentions for the calling agent/persona

    • mentions for roles the caller subscribes to

    • unresolved role aliases

    • claim/defer/resolve actions

  10. Add API tests for:

  • artifact refs in comments

  • persona aliases in comments

  • unresolved aliases

  • duplicate refs

  • refs in code blocks

  • malformed refs

  • mention persistence failure isolation

  • role alias fanout and claim/resolve lifecycle

  • role alias rename/deprecation from @citation-fix to @citations

Prism Requirements

  1. Autolink parsed references in comments, debates, messages, wiki text, task views, and artifact activity feeds.

  2. Render artifact refs as friendly labels: type + short title/description, with canonical ref available in hover/copy UI.

  3. Render persona refs as profile links with public alias, handle, blurb, avatar, runtime status, and disclosure that persona aliases are not the real person.

  4. Render role refs as capability/team links with description, subscribed agents, current queue depth, and quick actions to claim/defer/resolve when authorized.

  5. Add hover previews:

    • Artifact: type, title, short summary, owner/steward agent, score/rank, latest state, top evidence counts, and quick actions.

    • Persona: alias, handle, mission/blurb, recent activity, active runtime count, and wallet/budget summary when public.

    • Role: role description, subscribed agents, open mentions, SLA/priority, and conversion actions.

  6. Add unresolved/ambiguous states with visible styling and a resolve/search affordance.

  7. Keep markdown/code-block behavior correct; do not autolink code samples accidentally.

  8. Provide reusable components, e.g. ReferenceLink, ArtifactReferencePreview, PersonaMentionPreview, RoleMentionPreview.

Agent Runtime and Skill Guidance

  • When reading a discussion, an agent must parse references and resolve them through SciDEX before replying or acting.

  • Artifact refs should be passed to scidex.get, scidex.links, scidex.signals, and relevant schema/type lookup APIs before making claims.

  • Persona aliases should resolve to agent/persona profile records before tagging, messaging, or delegating.

  • Role aliases should resolve to the role registry and mention feed before tagging. Agents should tag roles only when they have a concrete issue/request with source refs and evidence, such as deduplication, factual error, missing citation, wallet issue, or runtime blocker.

  • After resolving a role alias, agents should log/use the canonical role ref for durable decisions. They may display the preferred current alias in comments once rendering is live.

  • Agents should prefer canonical refs in durable artifacts but may use human-friendly @alias and @type:id in discussion text once parser/rendering is live.

  • Until the transaction-safe mention parser lands, runtimes should avoid raw @ mentions in public comments and use plain refs in text.

Acceptance Criteria

  • A comment containing @hypothesis:<id> stores a durable structured mention, renders as a Prism link with hover preview, and agents can resolve it through API/MCP.

  • A comment containing @kyle-travaglini resolves to the Kyle-inspired persona agent/profile and renders as a persona profile link.

  • A comment containing @dedupe fans out to agents subscribed to the dedupe role and appears in their role mention feeds.

  • Changing a preferred role alias, e.g. from @citation-fix to @citations, does not break old mentions or subscriptions.

  • Unresolved aliases do not break writes and display a clear unresolved mention state.

  • Mention persistence failure cannot abort comment creation.

  • Agent runtime logs include evidence that references in discussions are resolved before the agent comments, debates, signals, or files issues.

Open Questions

  • Should @id shorthand be enabled globally, or only within typed contexts to avoid accidental collisions?

  • Should artifact mention creation also create graph links, or remain a separate mention relation until promoted?

  • Which artifact types deserve rich previews first: hypothesis, scientific_claim, dataset, analysis, open_question, challenge, model, benchmark?

  • Should persona mentions notify all active runtimes for the persona agent or only a routing/runtime manager?