ccpe-system/skills/workflow/conversation-segmentation.s...

349 lines
9.4 KiB
Markdown

---
artifact_type: ccpe-skill
name: conversation-segmentation
skill_id: conversation-segmentation
author: CCPE System
version: 0.2
created: 2026-06-06
updated: 2026-06-07
status: draft
skill_type: transformation-skill / knowledge-management-skill
target_platform: Codex / Claude Code / OpenClaw / platform-neutral Markdown
based_on: CCPE System
related_models:
- candidate: lossless-viewpoint-distillation
related_agents:
- whole-source-gestalt-reviewer
- topic-discovery-router
- topic-graph-synthesizer
- lossless-coverage-auditor
related_runtimes:
- viewpoint-discussion-distillation
related_protocols:
- agent-invocation-packet
---
# Conversation Segmentation Skill
## 1. Skill Overview
### 1.1 Purpose
Split a long discussion source into stable, traceable source blocks that downstream topic discovery, topic graph synthesis, routing, document building, and coverage audit can reference.
This Skill is non-interpretive. It may carry accepted Step 0 lens metadata forward for downstream worker packets, but it must not classify topics, assign hierarchy, or decide routing.
### 1.2 Skill Type
```text
transformation-skill
knowledge-management-skill
```
### 1.3 Intended Users
Viewpoint Discussion Distillation Runtime, Topic Discovery Router, Topic Graph Synthesizer, Lossless Coverage Auditor, and human operators.
When executed by a Runtime operator as a formal Skill execution, this Skill requires a Skill execution record under the Agent Invocation Packet Protocol.
### 1.4 Success Criteria
```text
- Source blocks have stable IDs.
- Round boundaries are preserved.
- Source locations are traceable.
- Blocks are small enough to route but large enough to preserve meaning.
- Segmentation does not rewrite source content.
- Segmentation records whether it happened before or after Step 0.
- Accepted gestalt lens id/path is recorded when present, without topic interpretation.
```
## 2. Trigger Conditions
Use this Skill when:
```text
- A long diary, discussion, transcript, or research conversation must be processed.
- Topic routing needs stable source IDs.
- Coverage audit needs a source block inventory.
- A confirmed Step 0 lens needs to be referenced in downstream worker packets.
```
Do not use this Skill when:
```text
- The source is already segmented with stable IDs.
- The user only wants casual reading.
- The source cannot be read or referenced.
- The task asks for topic interpretation rather than source block construction.
```
## 3. Input Contract
### 3.1 Required Inputs
```text
- source_document_path
- boundary_rule
- output_workspace_path
- source_type
- segmentation_timing: before_step_0 | after_gate_0 | source_mode_exception
```
### 3.2 Optional Inputs
```text
- accepted_gestalt_lens_path
- accepted_gestalt_lens_id
- gate_0_decision_record_path
- source_primary_language
- output_language_policy: mirror_source_primary_language
- expected_round_count
- max_block_size_guidance
- speaker markers
- sections to exclude from processing
```
### 3.3 Input Quality Requirements
The source must be readable. If Chinese Markdown is read through PowerShell, use explicit UTF-8 handling. If `accepted_gestalt_lens_path` is supplied, record it as metadata only.
## 4. Output Contract
### 4.1 Output Types
```text
- source block inventory
- source-map update
- segmentation warnings
- lens metadata for downstream worker packets
```
### 4.2 Default Output Format
```md
# Source Map
## 1. Source Document
## 2. Boundary Rule
## 3. Segmentation Timing
## 4. Accepted Gestalt Lens Metadata
## 5. Source Block ID Convention
## 6. Round Inventory
## 7. Source Blocks
| block_id | round_id | heading | locator | block_type | summary_locator | status |
## 8. Segmentation Warnings
```
### 4.3 Output Quality Requirements
Each source block must include block ID, round ID, heading or locator, block type, and enough locator text for recovery. Lens metadata must not include topic classifications introduced by the segmentation step. If segmentation warnings or boundary questions require human confirmation, those human-review sections must use the source material's primary language as the dominant language.
## 5. Model Context
### 5.1 Related Model Cards
```text
- model_id: none
model_card_path: none
```
### 5.2 Model Fidelity Rules
Segmentation is not interpretation. Do not classify, summarize, polish, route, or assign topic graph structure beyond short locator notes.
## 6. Procedure
### 6.1 Main Procedure
```text
1. Verify source path, boundary rule, output workspace, segmentation timing, and Skill execution record requirement.
2. Record accepted gestalt lens metadata if provided.
3. Read source metadata and boundary rule.
4. Identify top-level rounds or sections.
5. Split each round into coherent source blocks.
6. Assign stable IDs using R{round}-B{block}.
7. Record locator text and source position.
8. Mark ambiguous boundaries.
9. Write or update source-map.
10. Write Skill execution record when executed locally as formal Runtime work.
```
### 6.2 Branch Logic
```text
- If H1 headings exist, use them as primary round boundaries.
- If no clear headings exist, infer sections conservatively and mark warnings.
- If a block is too long, split at natural paragraph or speaker boundaries.
- If a block is too short to preserve meaning, merge with adjacent related text.
- If Step 0 exists, include lens id/path in source-map and downstream packet metadata.
- If Step 0 does not exist because the Runtime chose fragmented flat-discovery mode, record the source-mode exception.
```
### 6.3 Stop Conditions
Complete when all readable source content has a source block ID or explicit exclusion status.
### 6.4 Fallback Procedure
If segmentation is ambiguous, produce a partial source map and ask for boundary confirmation. Do not solve ambiguity by topic interpretation.
## 7. Tool Layer
### 7.1 Tools Used
```text
- tool_name: filesystem
purpose: read source and write source-map
trigger: runtime Step 1
input: source path, output workspace, segmentation timing, optional lens metadata
output: source-map and skill-execution-record when formal local execution
```
### 7.2 Tool Permission
Read the source. Write only to confirmed output workspace. Do not modify source.
### 7.3 Tool Failure Handling
Stop with missing file, encoding, permission, or unreadable lens metadata diagnostics.
## 8. Authority Layer
### 8.1 Autonomous Actions
Create source block IDs, source-map drafts, segmentation warnings, and non-interpretive lens metadata references.
### 8.2 Actions Requiring Confirmation
Excluding source sections from processing, changing boundary rule after initial segmentation, or proceeding when boundary ambiguity would affect source block identity.
### 8.3 Forbidden Actions
```text
- Rewrite, summarize away, delete, or move source content.
- Classify topics.
- Assign topic hierarchy.
- Route source blocks.
- Generate material-unit records.
- Generate topic documents.
- Treat lens metadata as a segmentation decision.
```
## 9. Constraints
### 9.1 Hard Constraints
```text
- Source IDs must be stable within a run.
- Original source remains unchanged.
- Ambiguous boundaries must be marked.
- Segmentation remains non-interpretive.
- Accepted lens metadata may be carried forward but not interpreted.
- Formal local execution requires skill-execution-record.md.
```
### 9.2 Soft Constraints
Prefer semantic coherence over equal block length.
### 9.3 Refusal / Abort Conditions
Abort if the source cannot be read. Block if asked to produce topic judgments as part of segmentation.
## 10. Evaluation
### 10.1 Validation Checklist
```text
Inputs satisfied?
Segmentation timing recorded?
Accepted lens metadata recorded if present?
Procedure followed?
Source preserved?
No topic classification introduced?
Human-review boundary warnings mirror source primary language when present?
Output meets contract?
Skill execution record present when required?
Failure modes handled?
Human confirmation respected?
```
### 10.2 Failure Modes
Unstable IDs, over-large blocks, over-small fragments, missing rounds, encoding corruption, hidden topic interpretation, missing Step 0 lens metadata.
### 10.3 Test Cases
```text
Test Case 1:
Input: Markdown discussion with seven H1 headings and accepted_gestalt_lens_path.
Expected Output: seven round groups with R01-B001 style IDs and lens path recorded in metadata only.
Test Case 2:
Input: Markdown discussion without clear headings.
Expected Output: inferred sections plus segmentation warnings, no topic classification.
```
## 11. Runtime Integration
### 11.1 Used By Agents
```text
- topic-discovery-router
- topic-graph-synthesizer
- lossless-coverage-auditor
```
### 11.2 Used By Runtimes
```text
- viewpoint-discussion-distillation
```
### 11.3 Handoff Output
Hand off `00-source-map.md`, source block inventory, segmentation timing, and accepted lens metadata.
Required execution record when executed locally:
```text
invocations/conversation-segmentation/skill-execution-record.md
```
## 12. Platform Implementation Notes
### 12.1 Codex
Use PowerShell UTF-8 reads for Chinese Markdown in Knowledge Vault.
### 12.2 Claude Code
Use equivalent UTF-8-safe file reads.
### 12.3 OpenClaw
Preserve same Markdown output contract.
### 12.4 Platform-Neutral
Any platform may implement this as long as source block IDs remain stable and segmentation stays non-interpretive.
## 13. Version Notes
```text
v0.2:
- Added Step 0 lens metadata handling while preserving non-interpretive segmentation boundary.
v0.1:
- Initial draft.
```