Repository navigation
Description
Problem
Conversation output currently mixes authored prose, fenced code, tool
calls, tool-result payloads, file reads, thinking traces, and other
mechanically emitted material into one undifferentiated text stream.
Existing role filters reduce speaker noise, but they do not let users
ask for prose-only context or suppress mechanical artifacts in a
principled way.
That makes corpus mining, resume-style summaries, handoff briefs, and
human review needlessly noisy. Content-kind projection should be a real
archive/query contract, not a late-stage string-trimming trick.
Strengthened scope
Introduce a canonical content-kind projection contract for rendered and
query-returned conversation content, then expose it consistently across
CLI, MCP, and facade surfaces.
The first shipped taxonomy should be richer than the issue title alone.
Minimum first-class kinds:
- prose/authored text
- fenced code blocks
- tool invocation records
- tool-result payloads
- file-read payloads (distinct from generic tool results)
- reasoning / thinking traces
- system / protocol noise when the source format exposes it distinctly
The implementation should:
- classify content kinds in shared substrate/runtime logic once, not by
fragile final-string surgery in each command - prefer structured
content_blocksand semantic block metadata when
available, with a shared text-fallback decomposition for legacy/plain
messages that still detects fenced code and preserves prose order - pair tool-result payloads to their originating tool calls when enough
metadata exists so file-read outputs can be filtered without bluntly
deleting all tool traffic - make role projection and content-kind projection composable and order
stable - preserve the raw archive unchanged; this is a projection contract, not
ingestion mutation - expose the same projection model through CLI, facade, and MCP where
conversation/query text is returned
User-facing contract
At minimum, support these controls on the CLI root query surface and the
corresponding MCP/facade contract:
--no-code-blocks--no-tool-calls--no-tool-outputs--no-file-reads--prose-only
--prose-only should be a real preset over the shared projection model,
not a separate bespoke path.
Design requirements
- Provider-specific quirks must normalize into the shared taxonomy
rather than leaking different flag behavior per provider. - The default output must remain backward-compatible unless a caller
opts into projection. - Projection must compose cleanly with truncation, role filters,
transforms, stream output, plain/markdown/JSON rendering, and detail
payload serialization. - Empty messages produced by projection should not survive into rendered
output as blank shells. - The public contract should be typed, reusable, and testable without
invoking CLI glue.
Surface requirements
Land the shared contract in all three surface families:
- CLI query/detail/stream output
- MCP
get_conversationand list/query surfaces that return conversation
content or payloads - facade/archive methods that return conversation objects intended for
downstream rendering or analysis
This should not create three separate flag-parsing or projection
implementations.
Acceptance criteria
- CLI output can exclude code blocks, tool calls, tool outputs, and
file-read payloads independently, plus a prose-only mode. - MCP and facade surfaces expose the same projection contract where they
return conversation/query text or serialized message payloads. - Mixed-content tests cover structured blocks and text-fallback messages
containing prose, fenced code, tool calls, tool results, file reads,
and thinking traces in the same transcript. - File-read suppression is narrower than generic tool-output suppression
when the underlying metadata is sufficient to distinguish them. - The decomposition/projection logic is implemented once in shared logic
rather than by repeated output-string patching.
Strategic value
This is not just output cleanup. It creates a cleaner semantic substrate
for later mining, summaries, live-session inspection, and downstream
products, while preventing future surfaces from reintroducing bespoke
text-mangling logic.
Activity
Sinity commentedon Apr 23, 2026
Starting implementation. I tightened the issue contract first so this lands as one shared projection model rather than another CLI-only string filter. Tactics for this slice: (1) shared structured-first content-kind classifier with text fallback, (2) conversation-level projection so tool-result/file-read pairing can work across message boundaries, (3) surface parity across CLI query/stream, MCP detail/export surfaces, and facade conversation reads, (4) mixed-content tests covering prose, fenced code, tool calls, tool outputs, file reads, and thinking traces in one transcript.
Sinity commentedon Apr 23, 2026
Implemented the strengthened
#310plan onfeature/feat/content-kind-projectionand opened PR #391.What landed on the branch:
polylogue.lib.content_projectionwith canonical content kinds and reusableContentProjectionSpec--no-code-blocks,--no-tool-calls,--no-tool-outputs,--no-file-reads,--prose-onlyVerification run locally:
pytest -q tests/unit/core/test_content_projection.py tests/unit/cli/test_query_fmt.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_query_exec.py tests/unit/cli/test_click_app.py tests/unit/cli/test_terminal_snapshots.py tests/unit/core/test_facade_api.py tests/unit/mcp/test_server_surfaces.py -qdevtools verifyPR: #391
feat: add shared content projection surface (#391)
Sinity commentedon Apr 23, 2026
Merged via PR #391: #391
Merge commit:
811c94826ffd4690be002fd7c3ef987bf65d4c74#310is now closed.masteris clean.feat: add shared content projection surface (#391)
chore(deps): bump pytest-benchmark from 5.2.3 to 5.3.0 (#4492)