Analyze plain text documents to understand their semantic structure and token distribution. Use when asked to analyze context, visualize token usage, segment text, identify components, create waffle charts, or compare multiple documents.
Analyze plain text documents to understand their semantic structure and token distribution. This skill helps visualize how tokens are distributed across different semantic components of a document.
When analyzing a document, follow these steps:
Convert the input text file to JSON format:
./scripts/parse.sh input.txt > parsed.json
Add token counts using tiktoken (GPT-4o encoding):
./scripts/count-tokens.sh parsed.json > counted.json
For parts with more than 500 tokens, identify semantic breakpoints and split them.
You (Claude) should do this directly:
part-1.1, part-1.2, etc.)After segmenting, recount tokens:
./scripts/count-tokens.sh segmented.json > recounted.json
Analyze the document and identify the distinct semantic components it contains.
You (Claude) should do this directly:
components array and component field on each partcomponent_tokens totalsRun the colorization script to assign consistent colors:
./scripts/colorise.sh componentised.json > colored.json
./scripts/waffle-chart.sh colored.json > waffle.html
./scripts/bar-chart.sh colored.json > bar-chart.html
./scripts/text-view.sh colored.json > text-view.html
For a complete analysis pipeline:
# Parse and count
./scripts/parse.sh input.txt > /tmp/1-parsed.json
./scripts/count-tokens.sh /tmp/1-parsed.json > /tmp/2-counted.json
# You segment and componentise the JSON directly, then:
./scripts/colorise.sh /tmp/3-componentised.json > /tmp/4-colored.json
./scripts/waffle-chart.sh /tmp/4-colored.json > waffle.html
For multiple files:
./scripts/group.sh input_folder/ output_dir/
The JSON format used throughout:
{
"source": "filename.txt",
"parts": [
{
"id": "part-1",
"text": "The actual text content...",
"token_count": 150,
"component": "introduction"
}
],
"components": ["introduction", "methodology", "results"],
"component_tokens": {
"introduction": 500,
"methodology": 1200,
"results": 800
},
"total_tokens": 2500
}
When segmenting large parts (>500 tokens):
Look for natural breakpoints:
#, ##, etc.)Create semantically coherent chunks:
Update IDs hierarchically:
part-1 splits into part-1.1, part-1.2, etc.When identifying components:
Read all parts to understand the document structure
Identify 3-10 distinct semantic categories
Use descriptive, lowercase names with underscores
Common patterns:
introduction, methodology, results, conclusionconfiguration, implementation, examples, api_referenceoverview, prerequisites, steps, troubleshootingAssign each part to exactly one component
Use other for parts that don't fit elsewhere
Components are assigned these colors:
blue - Primary content, introductionsemerald - Workflows, processes, methodologypurple - Style, personality, guidelinesorange - Context, examples, highlightsindigo - Code, technical contentslate - Environment, configurationgray - Tools, utilities, otherSee the references/ folder for detailed documentation on each step.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer