# Send Chain of Density to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "chain-of-density",
    "name": "Chain of Density",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/killerapp/chain-of-density",
    "canonicalUrl": "https://clawhub.ai/killerapp/chain-of-density",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/chain-of-density",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=chain-of-density",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "scripts/text_metrics.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/chain-of-density"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/chain-of-density",
    "downloadUrl": "https://openagent3.xyz/downloads/chain-of-density",
    "agentUrl": "https://openagent3.xyz/skills/chain-of-density/agent",
    "manifestUrl": "https://openagent3.xyz/skills/chain-of-density/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/chain-of-density/agent.md"
  }
}
```
## Documentation

### Chain-of-Density Summarization

Compress text through iterative entity injection following the CoD paper methodology. Each pass identifies missing entities from the source and incorporates them while maintaining identical length.

### The Method

Chain-of-Density works through multiple iterations:

Iteration 1: Create sparse, verbose base summary (4-5 sentences at target_words)
Subsequent iterations: Each iteration:

Identify 1-3 missing entities from SOURCE (not summary)
Rewrite summary to include them
Maintain IDENTICAL word count through compression

Key principle: Never drop entities - only add and compress.

### Missing Entity Criteria

Each entity added must meet ALL 5 criteria:

CriterionDescriptionRelevantTo the main story/topicSpecificDescriptive yet concise (≤5 words)NovelNot in the previous summaryFaithfulPresent in the source (no hallucination)AnywhereCan be from anywhere in the source

### Quick Start

User provides text to summarize
Orchestrate 5 iterations via cod-iteration agent
Each iteration reports entities added via Missing_Entities: line
Return final summary + entity accumulation history

### Orchestration Pattern

Iteration 1: Sparse base (target_words, verbose filler)
     ↓ Missing_Entities: (none - establishing base)
Iteration 2: +3 entities, compress filler
     ↓ Missing_Entities: "entity1"; "entity2"; "entity3"
Iteration 3: +3 entities, compress more
     ↓ Missing_Entities: "entity4"; "entity5"; "entity6"
Iteration 4: +2 entities, tighten
     ↓ Missing_Entities: "entity7"; "entity8"
Iteration 5: +1-2 entities, final density
     ↓ Missing_Entities: "entity9"
Final dense summary (same word count, 9+ entities)

### How to Orchestrate

Iteration 1 - Pass source text only:

Task(subagent_type="cod-iteration", prompt="""
iteration: 1
target_words: 80
text: [SOURCE TEXT HERE]
""")

Iterations 2-5 - Pass BOTH previous summary AND source:

Task(subagent_type="cod-iteration", prompt="""
iteration: 2
target_words: 80
text: [PREVIOUS SUMMARY HERE]
source: [ORIGINAL SOURCE TEXT HERE]
""")

Critical:

Invoke serially, not parallel
Pass SOURCE text in every iteration for entity discovery
Parse Missing_Entities: line to track entity accumulation

### Expected Agent Output Format

The cod-iteration agent returns:

Missing_Entities: "entity1"; "entity2"; "entity3"

Denser_Summary:
[The densified summary - identical word count to previous]

Parse both parts - track entities for history, pass summary to next iteration.

### Measuring Density

Use scripts/text_metrics.py for deterministic word counts:

echo "your summary text" | uv run scripts/text_metrics.py words
# Returns: word count

uv run scripts/text_metrics.py metrics "your summary text"
# Returns: {"words": N, "chars": N, "bytes": N}

### Parameters

ParameterDefaultDescriptioniterations5Number of density passes (paper uses 5)target_words80Word count maintained across ALL iterationsreturn_historyfalseInclude intermediate summaries + entities

Note: target_words can be adjusted based on source length and desired output density.

### Minimal (default)

[Final dense summary text]

### With History (return_history=true)

final_summary: |
  [Dense summary at target_words with accumulated entities]
iterations:
  - turn: 1
    missing_entities: "(none - establishing base)"
    words: 80
    summary: |
      [Sparse iteration 1]
  - turn: 2
    missing_entities: "entity1; entity2; entity3"
    words: 80
    summary: |
      [Denser iteration 2]
  # ... etc
total_entities: 9

### When to Use

Verbose documentation exceeding 500 words
Requirements documents needing condensation
Creating executive summaries from detailed reports
Compressing skills that exceed recommended length

### When NOT to Use

Legal/compliance text (precision required)
Tutorial content (beginners need explanation)
Already concise content (<300 words)
Specifications (don't compress specs)

### Example

Source (180 words, verbose skill excerpt):

The name field is a required field that must be present in every skill.
The name field identifies the skill and must follow a specific format.
For the name field, you should use lowercase letters and hyphens only.
The name field can be 1 to 64 characters long. The description field
is also required and tells agents when to use your skill...

Iteration 1 (Sparse, 80 words):

Missing_Entities: (none - establishing base)

Denser_Summary:
This document discusses the requirements for skill configuration fields in agent systems. It covers various aspects of how fields should be formatted and what values they can contain. The document also mentions validation rules that apply to these fields and provides guidance on best practices for developers. Additionally, it includes information about both optional and required elements that need to be considered when creating new skills for the system.

Iteration 3 (After 2 passes, same 80 words):

Missing_Entities: "1-64 characters"; "lowercase alphanumeric-hyphens"; "Use when phrase"

Denser_Summary:
Skills require \`name\` (1-64 chars, lowercase alphanumeric-hyphens) and \`description\` fields with validation rules. The name identifies skills; descriptions tell agents when to invoke using "Use when..." phrases. Both fields have format constraints and best practices. Optional metadata fields provide author, version, and compatibility information for cross-platform agent discovery.

Final Iteration 5 (Same 80 words, maximum density):

Missing_Entities: "Claude Code"; "Cursor"; "GitHub Copilot"

Denser_Summary:
Required: \`name\` (1-64 chars, ^[a-z0-9]+(-[a-z0-9]+)*$) and \`description\` (1-1024 chars) with validation. Description includes "Use when..." + discovery keywords for auto-invocation. Optional: license (SPDX), compatibility, metadata (author, version, tags). Cross-platform: Claude Code, Cursor, GitHub Copilot. Name matches directory. Progressive disclosure via references/, assets/, scripts/ subdirectories.

### Architecture Note

This skill implements the CoD paper methodology:

Skill = orchestrator (this file)
Agent = stateless worker (cod-iteration)
Script = deterministic utility (text_metrics.py)

Sub-agents cannot call other sub-agents. Only skills orchestrate via Task tool.

### References

Paper: From Sparse to Dense: GPT-4 Summarization with Chain of Density Prompting
Dataset: HuggingFace griffin/chain_of_density
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: killerapp
- Version: 1.1.0
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-23T16:43:11.935Z
- Expires at: 2026-04-30T16:43:11.935Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/chain-of-density)
- [Send to Agent page](https://openagent3.xyz/skills/chain-of-density/agent)
- [JSON manifest](https://openagent3.xyz/skills/chain-of-density/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/chain-of-density/agent.md)
- [Download page](https://openagent3.xyz/downloads/chain-of-density)