Repository navigation
Description
Metadata
Parent: #1807
Related cleanup umbrella: #2177
Related substrate: polylogue/core/refs.py, recovery/context compiler, work-packet evidence refs, assertion evidence refs.
Cross-pollination source: /tmp/ideas.md ref-resolution UX section and Sinex ObjectRef cross-pollination notes.
Status: proposed feature; parse/normalize exists, resolution does not.
Purpose
Make public refs actionable.
Polylogue can now parse and normalize ObjectRef / EvidenceRef strings for sessions, messages, blocks, runs, context snapshots, observed events, assertions, commits, GitHub refs, tool calls, subagent reports, and more. Many payloads carry those refs. But users and agents cannot consistently say “show me this ref” through CLI/API/MCP/daemon and get the appropriate payload/view.
This issue adds a resolver service and surfaces so refs become a real navigation substrate rather than just typed strings embedded in payloads.
Current code reality
Current ref substrate:
polylogue/core/refs.py
ObjectRefKind includes session, message, block, attachment, paste_span, work_event, phase, thread, file, branch, commit, check-run, workspace, agent, user, repo, insight, run, context-snapshot, observed-event, assertion, saved_view, recall_pack, transform, tool-call, subagent-report, github-issue, github-pr, github-review
EvidenceRefKind includes session/message/block
parse_public_ref(), normalize_object_ref_text(), normalize_public_ref_text()
polylogue/context/compiler.py
RecoveryContextCompilation carries evidence_refs and object_refs
polylogue/surfaces/payloads.py
assertions, runs, observed events, context snapshots, recovery/work-packet payloads carry refs
Missing owner:
resolve_public_ref(ref) -> finite payload/view or typed unsupported error
Proposed resolver
Add a service such as:
class PublicRefResolutionPayload(SurfacePayloadModel):
mode: Literal["ref-resolution"]
ref: str
kind: str
resolved: bool
payload_kind: str | None
payload: object | None
title: str | None
summary: str | None
evidence_refs: tuple[str, ...]
object_refs: tuple[str, ...]
caveats: tuple[str, ...]
actions: tuple[RefResolutionActionPayload, ...]
resolve_public_ref(archive, ref: str, *, view: str | None = None) -> PublicRefResolutionPayloadResolution should prefer existing read/query/recovery/assertion APIs rather than direct SQL everywhere.
Initial resolvable kinds should include:
session:<id> -> session summary/read profile payload
message:<id> -> message terminal-query row or session/message snippet
block:<id>[:idx] -> block terminal-query row or block snippet
assertion:<id> -> assertion row/claim payload
run:<id> -> run query-unit row / recovery projection row when available
context-snapshot:<id> -> context snapshot query-unit row when available
observed-event:<id> -> observed event query-unit row when available
EvidenceRef session_id[::message_id[::block_index]] -> nearest session/message/block payload
External refs such as github-pr, github-review, commit, and file may resolve to structured local metadata/caveat rows first; they do not need network lookup in v0.
Surfaces
CLI:
polylogue read REF --format json
polylogue read REF --view transcript
polylogue find ref:REF then readPython API:
await archive.resolve_ref("session:codex-session:abc")MCP:
resolve_ref(ref, view?)
Daemon/web API:
GET /api/refs/resolve?ref=...
The web workbench should use the daemon route to make evidence refs clickable in recovery/work-packet/assertion views.
Design constraints
- Do not create a database registry just to resolve refs. Use existing storage/query/read-model owners first.
- Do not churn the colon ref format until resolution works.
- Unsupported kinds must return typed unsupported errors/caveats, not silently perform broad search.
- Ref resolution must preserve privacy boundaries: raw bytes and absolute local paths are not exposed by default.
- The resolver should be finite and bounded; no “resolve every related thing recursively” by default.
Acceptance criteria
- Shared resolver service exists and is consumed by at least CLI and one machine surface (MCP, Python API, or daemon).
- Session, message, block, assertion, and at least one runtime-transform ref kind (
run,observed-event, orcontext-snapshot) resolve against fixture archives. - EvidenceRef forms resolve to the nearest object payload and preserve the original evidence ref in the response.
- Web/workbench evidence refs can link to the resolver route or payload without inventing a separate resolver.
- Unsupported ref kinds fail typed with the parsed kind and a clear caveat/action.
- Docs list supported ref forms, unsupported forms, and examples.
Tests
- Core parse/resolve tests for session/message/block/assertion refs.
- Runtime-transform resolve test for one projected run/event/snapshot row.
- CLI JSON smoke for
polylogue read REF --format jsonor equivalent final syntax. - MCP/API/daemon route test for the shared payload if implemented.
- Privacy test for file/path refs or raw evidence refs.
Non-goals
- Do not add live GitHub/network lookup in v0.
- Do not create a separate task/project model around refs.
- Do not implement unbounded graph expansion.
- Do not add tests that merely assert old ref spellings are absent.
Identity-map dependency
Ref resolution must distinguish archive refs, provider-native provenance, logical session refs, run/context/event refs, and material-source refs. Do not make provider-native ids a substitute for archive object identity. See #2184 for the coordinate map.
Forensic audit reinforcement
The 2026-06-19 static audit reached the same conclusion as this issue: #1845 made refs useful as payload strings, but the missing product capability is resolution. Future ref work should prioritize resolve_public_ref(...) and user-visible navigation over adding more ref kinds.
Do not build a global ref database first. Resolve through existing owners where possible: session/message/block repositories, assertion reads, terminal query-unit rows, recovery/work-packet projections, and daemon/API/MCP wrappers. Unsupported external refs should return typed caveats/actions, not broad search.
Activity
Sinity commentedon Jun 19, 2026
Closing as implemented on current master.
Acceptance matrix:
Polylogue.resolve_ref(...)inpolylogue/api/archive.py, returningPublicRefResolutionPayloadfrompolylogue/surfaces/payloads.py.polylogue read REF --format jsonhandling inpolylogue/cli/query_verbs.py.resolve_refinpolylogue/mcp/server_tools.pyand daemonGET /api/refs/resolve?ref=...inpolylogue/daemon/http.py; route contract is recorded inpolylogue/daemon/route_contracts.py.context-snapshot:<id>:session_start.session_id::message_idandsession_id::message_id::0, preserving the original evidence ref in the response.commit:abc123returns a bounded unresolved payload with kind/caveat rather than broad search.docs/search.mddocumentsPublicRefResolutionPayload,Polylogue.resolve_ref(), MCPresolve_ref, and/api/refs/resolve.Verification run from a fresh worktree on current master:
Residuals such as richer external GitHub/file/commit lookup or recursive graph expansion remain explicit non-goals for this issue and should be opened separately only if product pressure appears.