Repository navigation
feat: add shared content projection surface - #391
Conversation
Problem The archive exposed full conversation text, but content-kind filtering still lived in narrow one-off transforms. CLI, facade, MCP, and formatter paths had no shared projection contract for prose-only views or for selectively removing code blocks, tool calls, tool outputs, and file-read payloads. Solution Add a substrate-owned content projection model and wire it through the conversation runtime, archive operations, facade, CLI query output, MCP read/export tools, and shared formatting/payload helpers. This also adds owning tests across core, CLI, facade, and MCP surfaces, including the attachment edge case where prose-only output must drop attachment-only messages. Verification Ref #310 - 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 -q - devtools verify
Problem The new content projection flags change the observable help surface, so the CLI reference, showcase help baseline, and PTY terminal snapshots must move with the implementation. Solution Refresh the generated CLI reference and the committed help/snapshot baselines for the top-level query surface. Verification Ref #310 - pytest -q tests/unit/cli/test_terminal_snapshots.py -q - devtools render-all --check
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (24)
📝 WalkthroughWalkthroughThis change introduces content-kind decomposition to allow filtering conversation output by content category: code blocks, tool calls, tool outputs, and file reads. A new Changes
Sequence DiagramsequenceDiagram
participant CLI as CLI Parser
participant QuerySpec as QueryOutputSpec
participant Archive as ArchiveSearchMixin
participant Conversation as Conversation
participant Projection as ContentProjection
participant Formatter as Formatter
CLI->>QuerySpec: Create with content_projection<br/>flags (no_code_blocks, etc.)
QuerySpec->>Archive: query_conversations(spec,<br/>content_projection=spec)
Archive->>Archive: Fetch conversations<br/>from repository
Archive->>Conversation: with_content_projection(spec)
Conversation->>Projection: project_conversation_content()
Projection->>Projection: Classify & filter<br/>by ContentKind
Projection-->>Conversation: Return filtered<br/>conversation
Conversation-->>Archive: Return projected
Archive-->>QuerySpec: Return list[Conversation]
QuerySpec->>Formatter: format_conversation(conv,<br/>content_projection=spec)
Formatter->>Conversation: with_content_projection(spec)
Conversation->>Projection: Apply filtering
Projection-->>Conversation: Projected content
Formatter->>Formatter: Render to format<br/>(markdown/JSON/etc.)
Formatter-->>CLI: Formatted output
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Suggested labels
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 566c745dd2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
## Summary Add a shared content-kind projection contract for conversation output and wire it through the CLI, facade, MCP, and formatter/payload surfaces. This lands prose-only and selective content suppression without reintroducing one-off string surgery in each consumer. ## Problem `#310` called for content-kind decomposition as a real shared projection contract, not ad hoc trimming. Before this slice, Polylogue only had narrow transforms like `strip-tools` and `strip-thinking`, while full conversation output still flowed through CLI, facade, MCP, and formatter paths without a shared way to remove code blocks, tool calls, tool outputs, or file-read payloads. That made the projection semantics incomplete and surface-specific. ## Solution - add `polylogue.lib.content_projection` with canonical content kinds and a reusable `ContentProjectionSpec` - project structured blocks first, then fall back to text segmentation for fenced code and reasoning tags - preserve file-read vs general tool-output distinctions by pairing tool results with tool-use semantic types - wire projection through conversation runtime helpers, archive operations, facade methods, CLI query output, and MCP read/export tools - add root CLI flags `--no-code-blocks`, `--no-tool-calls`, `--no-tool-outputs`, `--no-file-reads`, and `--prose-only` - refresh the generated CLI reference, showcase help baseline, and PTY help snapshots for the new surface - cover the contract across core, CLI, facade, and MCP tests, including the attachment-only edge case ## Verification - `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 -q` - `devtools verify` Closes #310
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Add a shared content-kind projection contract for conversation output and wire it through the CLI, facade, MCP, and formatter/payload surfaces. This lands prose-only and selective content suppression without reintroducing one-off string surgery in each consumer.
Problem
#310called for content-kind decomposition as a real shared projection contract, not ad hoc trimming. Before this slice, Polylogue only had narrow transforms likestrip-toolsandstrip-thinking, while full conversation output still flowed through CLI, facade, MCP, and formatter paths without a shared way to remove code blocks, tool calls, tool outputs, or file-read payloads. That made the projection semantics incomplete and surface-specific.Solution
polylogue.lib.content_projectionwith canonical content kinds and a reusableContentProjectionSpec--no-code-blocks,--no-tool-calls,--no-tool-outputs,--no-file-reads, and--prose-onlyVerification
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 verifyCloses #310
Summary by CodeRabbit
Release Notes
--no-code-blocks,--no-tool-calls,--no-tool-outputs,--no-file-reads, and--prose-only. Users can exclude specific content types such as code blocks, tool records, tool outputs, or file-read results, or view only authored prose.