Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install vivekkarmarkar-claude-code-os-skills-tg-exchange-loop-slice-extractgit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-tg-exchange-loop-slice-extract/SKILL.md---
name: tg-exchange-loop-slice-extract
description: Incrementally extract Telegram exchanges into verbatim + claude files, picking up from where the last extraction ended
---
# tg-exchange-loop-slice-extract — Incremental slice extraction for multi-phase section writing
## Arguments
Same as `tg-exchange-loop-extract`:
- `/tg-exchange-loop-slice-extract introduction` → incremental extraction for the introduction
- `/tg-exchange-loop-slice-extract methods` → incremental extraction for methods
- `/tg-exchange-loop-slice-extract` → no substring provided, ask user
## Behavior
### Step 1 — Determine `filename_substring`
- If the user provides a clear `filename_substring`, use it.
- If not, ask: "What topic or section should I extract? This will be used for the filename (e.g., `introduction`, `methods`, `results`)."
- If the user gives a vague response, choose an appropriate `filename_substring` based on conversation context.
### Step 2 — Check if the two files exist and are populated
Look for `{filename_substring}_verbatim.md` and `{filename_substring}_claude.md` in the project root.
**Case A — Files don't exist or are empty:**
Delegate entirely to `/tg-exchange-loop-extract` with the same `filename_substring`. Stop here — that skill handles the cold start.
**Case B — Files exist and have content:**
Proceed to Step 3.
### Step 3 — Find the last extracted message ID
Parse both `{filename_substring}_verbatim.md` and `{filename_substring}_claude.md` for message IDs:
- In the verbatim file, IDs appear in headers like `## Message {ID} (ts: ...)`
- In the claude file, IDs appear in headers like `## Reply to Message {ID}`
Find the highest message ID across both files. Call this `LAST_EXTRACTED_ID`.
Report: "Last extracted message: {LAST_EXTRACTED_ID}. Looking for new exchanges after this point."
### Step 4 — Identify FIRST and LAST new relevant messages
Read `Telegram_calls.md`. Scan entries whose message ID is strictly greater than `LAST_EXTRACTED_ID`. From those, identify:
- **FIRST_SLICE**: The earliest message (ID > LAST_EXTRACTED_ID) whose content is relevant to the topic/context
- **LAST_SLICE**: The most recent message whose content is relevant to the topic/context
If no relevant messages are found after `LAST_EXTRACTED_ID`, report: "No new exchanges found for '{filename_substring}' after message {LAST_EXTRACTED_ID}." and stop.
Report the identified range: "Found new exchanges from message {FIRST_SLICE} to message {LAST_SLICE} ({N} exchanges). Appending to existing files."
### Step 5 — Loop and append
For each relevant exchange between FIRST_SLICE and LAST_SLICE (inclusive):
**A) Extract verbatim transcribed input:**
- Apply `/verbatim-input-transcribed-from-tg-exchange` logic
- Append to `{filename_substring}_verbatim.md` with header: `## Message {ID} (ts: {timestamp})`
- Followed by the verbatim transcribed text
- Followed by `---` separator
**B) Extract Claude's tool call output:**
- Apply `/claude-tool-output-from-tg-exchange` logic
- Append to `{filename_substring}_claude.md` with header: `## Reply to Message {ID}`
- Followed by the reply text
- Followed by `---` separator
### Step 6 — Report
```
Appended {N} new exchanges for "{filename_substring}":
- {filename_substring}_verbatim.md — {N} new verbatim inputs (total now: {TOTAL})
- {filename_substring}_claude.md — {N} new Claude outputs (total now: {TOTAL})
Slice range: message {FIRST_SLICE} → message {LAST_SLICE}
Previous last: message {LAST_EXTRACTED_ID}
```
## Notes
- This skill is designed for the multi-phase writing workflow. Phase 1 conversations happen across multiple sessions. Each time, invoke this skill to append only the NEW exchanges.
- Only include exchanges relevant to the topic. Skip unrelated exchanges (skill creation, file management, etc.) unless they contain substantive content.
- If transcriptions are not available in the current session context for voice messages, note: `[Transcription not available in current session — re-transcribe from .oga file if needed]`
- For text messages (not voice), the verbatim input is the text content from the channel tag.
- This skill composes: `/tg-exchange-loop-extract` (for cold start), `/verbatim-input-transcribed-from-tg-exchange`, and `/claude-tool-output-from-tg-exchange`.