| name | briefing |
| description | Generate a diplomatic intelligence cable for a country using GDELT CLI data. Produces a professional HTML document in the style of diplomatic daily briefings. |
| disable-model-invocation | true |
| allowed-tools | Bash, Read, Write |
| argument-hint | <country> [capital] |
Diplomatic Intelligence Cable Generator
Generate a professional diplomatic briefing cable for $ARGUMENTS using GDELT CLI.
Instructions
Step 1: Parse Arguments
Extract the country and capital from the arguments:
- First argument: Country name (e.g., "Indonesia")
- Second argument (optional): Capital city (e.g., "Jakarta")
If no capital provided, use common knowledge to determine the capital.
Step 2: Create Output Directory
COUNTRY_LOWER=$(echo "Indonesia" | tr '[:upper:]' '[:lower:]')
mkdir -p briefings/$COUNTRY_LOWER/data
Step 3: Gather GDELT Data
Run the GDELT CLI to fetch news data. Handle rate limiting by waiting between requests.
gdelt doc search "$COUNTRY" --timespan 7d --max-records 75 --json > briefings/$COUNTRY_LOWER/data/articles.json
sleep 6
gdelt doc timeline "$COUNTRY" --mode vol --timespan 7d --json > briefings/$COUNTRY_LOWER/data/volume.json 2>/dev/null || echo '{"error":"timeline unavailable"}' > briefings/$COUNTRY_LOWER/data/volume.json
sleep 6
gdelt doc wordcloud "$COUNTRY" --timespan 7d --json > briefings/$COUNTRY_LOWER/data/wordcloud.json 2>/dev/null || echo '{"error":"wordcloud unavailable"}' > briefings/$COUNTRY_LOWER/data/wordcloud.json
If rate limited (exit code 12), wait 60 seconds and retry. Read the JSON files after fetching.
Step 4: Analyze and Extract
Read the articles JSON and perform deep analysis:
4.1 Extract Key Personalities
Scan all article titles and descriptions for named individuals:
- Government Officials: Presidents, ministers, governors, mayors
- Foreign Leaders: Other heads of state, foreign ministers, ambassadors
- Business Leaders: CEOs, executives, entrepreneurs
- Other Notable Figures: Military leaders, religious figures, celebrities
For each personality, note:
- Name and title/role
- Number of mentions
- Context (what stories they appear in)
4.2 Categorize as DOMESTIC vs EXTERNAL
DOMESTIC Affairs (internal to the country):
- Internal politics, elections, parliament
- Domestic economic policy
- Local crime, disasters, social issues
- National infrastructure, development
- Keywords: domestic, internal, local, national, parliament, election, governor, province
EXTERNAL Affairs (international/foreign relations):
- Bilateral relations with other countries
- International trade negotiations
- Foreign visits and diplomacy
- International organizations (UN, ASEAN, G20)
- Keywords: bilateral, foreign, ambassador, diplomatic, international, treaty, summit, visit
4.3 Thematic Categories (within Domestic/External)
POLITICAL: Government, leadership, elections, policy, parliament, president, minister
ECONOMIC: Trade, investment, GDP, market, business, finance, tariff
SECURITY: Military, defense, terrorism, crime, police, border
SOCIAL: Health, education, religion, culture, disaster, environment
Step 5: Generate HTML Cable
Create briefings/$COUNTRY_LOWER/$CAPITAL_LOWER-daily-YYYY-MM-DD.html with this enhanced structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CAPITAL DAILY - DATE</title>
<style>
:root {
--navy: #1a1a2e;
--navy-light: #16213e;
--gold: #d4af37;
--gold-light: #f4d03f;
--text: #e8e8e8;
--text-muted: #a0a0a0;
--domestic: #4a9eff;
--external: #ff6b6b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: var(--navy);
color: var(--text);
line-height: 1.6;
padding: 2rem;
}
.container { max-width: 900px; margin: 0 auto; }
.cable-header {
border: 3px solid var(--gold);
padding: 1.5rem 2rem;
margin-bottom: 2rem;
background: var(--navy-light);
}
.cable-header h1 {
font-family: Georgia, serif;
font-size: 2rem;
color: var(--gold);
display: flex;
justify-content: space-between;
align-items: baseline;
}
.cable-header .date { font-size: 1rem; color: var(--text-muted); }
.cable-header .subtitle {
font-size: 0.9rem;
color: var(--text-muted);
margin-top: 0.5rem;
text-transform: uppercase;
letter-spacing: 2px;
}
.headline-box {
background: var(--navy-light);
border-left: 4px solid var(--gold);
padding: 1rem 1.5rem;
margin-bottom: 2rem;
}
.headline-box .label {
font-size: 0.8rem;
color: var(--gold);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 0.5rem;
}
.headline-box h2 {
font-family: Georgia, serif;
font-size: 1.3rem;
font-weight: normal;
line-height: 1.4;
}
section { margin-bottom: 2rem; }
section h3 {
font-family: Georgia, serif;
color: var(--gold);
font-size: 1.1rem;
text-transform: uppercase;
letter-spacing: 1px;
border-bottom: 1px solid var(--gold);
padding-bottom: 0.5rem;
margin-bottom: 1rem;
}
section h4 {
color: var(--text-muted);
font-size: 0.95rem;
margin: 1.5rem 0 0.75rem;
text-transform: uppercase;
letter-spacing: 1px;
}
section p { margin-bottom: 1rem; text-align: justify; }
.scope-badge {
display: inline-block;
padding: 0.15rem 0.5rem;
font-size: 0.7rem;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
border-radius: 2px;
margin-right: 0.5rem;
}
.scope-domestic { background: var(--domestic); color: white; }
.scope-external { background: var(--external); color: white; }
.article-item {
padding: 0.75rem 0;
border-bottom: 1px solid #333;
}
.article-item:last-child { border-bottom: none; }
.article-item .title { font-weight: 500; margin-bottom: 0.25rem; }
.article-item .meta { font-size: 0.85rem; color: var(--text-muted); }
.personalities-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
}
.personality-card {
background: var(--navy-light);
border: 1px solid #333;
padding: 1rem;
}
.personality-card .name {
font-weight: 600;
color: var(--gold-light);
margin-bottom: 0.25rem;
}
.personality-card .role {
font-size: 0.85rem;
color: var(--text-muted);
margin-bottom: 0.5rem;
}
.personality-card .context {
font-size: 0.85rem;
line-height: 1.4;
}
.personality-card .mentions {
font-size: 0.75rem;
color: var(--gold);
margin-top: 0.5rem;
}
.metrics {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1rem;
margin-bottom: 1rem;
}
.metric {
background: var(--navy-light);
padding: 1rem;
text-align: center;
border: 1px solid #333;
}
.metric .value {
font-size: 1.5rem;
color: var(--gold);
font-weight: bold;
}
.metric .label {
font-size: 0.75rem;
color: var(--text-muted);
text-transform: uppercase;
}
.topics {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.topic-tag {
background: var(--navy-light);
border: 1px solid var(--gold);
color: var(--gold-light);
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
}
footer {
margin-top: 3rem;
padding-top: 1rem;
border-top: 1px solid #333;
font-size: 0.85rem;
color: var(--text-muted);
text-align: center;
}
footer a { color: var(--gold); text-decoration: none; }
@media print {
body { background: white; color: black; }
.cable-header { border-color: black; }
section h3 { color: black; border-color: black; }
.metric .value { color: black; }
.scope-domestic, .scope-external { color: black; background: #ddd; }
}
@media (max-width: 600px) {
.personalities-grid { grid-template-columns: 1fr; }
.metrics { grid-template-columns: repeat(2, 1fr); }
}
</style>
</head>
<body>
<div class="container">
<header class="cable-header">
<h1>
<span>CAPITAL DAILY</span>
<span class="date">DD MONTH YYYY</span>
</h1>
<div class="subtitle">Automated Intelligence Cable</div>
</header>
<div class="headline-box">
<div class="label">Headline</div>
<h2>Main headline summarizing key developments</h2>
</div>
<section id="summary">
<h3>1. Executive Summary</h3>
<p>2-3 sentence overview of the most significant developments...</p>
</section>
<section id="personalities">
<h3>2. Key Personalities</h3>
<p>Notable figures appearing in this reporting period:</p>
<div class="personalities-grid">
<div class="personality-card">
<div class="name">Name</div>
<div class="role">Title / Position</div>
<div class="context">Brief context of their appearance in the news</div>
<div class="mentions">X mentions</div>
</div>
</div>
</section>
<section id="domestic">
<h3>3. Domestic Affairs</h3>
<h4>Political</h4>
<p>Analysis of domestic political developments...</p>
<div class="article-item">
<span class="scope-badge scope-domestic">Domestic</span>
<span class="title">Article Title</span>
<div class="meta">Source - Date</div>
</div>
<h4>Economic</h4>
<p>Analysis of domestic economic news...</p>
<h4>Social & Security</h4>
<p>Analysis of social issues, crime, disasters...</p>
</section>
<section id="external">
<h3>4. External Affairs</h3>
<h4>Bilateral Relations</h4>
<p>Analysis of bilateral diplomatic activity...</p>
<div class="article-item">
<span class="scope-badge scope-external">External</span>
<span class="title">Article Title</span>
<div class="meta">Source - Date</div>
</div>
<h4>Trade & Investment</h4>
<p>Analysis of international trade and investment...</p>
<h4>Regional & Multilateral</h4>
<p>Analysis of regional organization activity (ASEAN, UN, G20, etc.)...</p>
</section>
<section id="media">
<h3>5. Media Landscape</h3>
<div class="metrics">
<div class="metric">
<div class="value">N</div>
<div class="label">Articles</div>
</div>
<div class="metric">
<div class="value">N</div>
<div class="label">Sources</div>
</div>
<div class="metric">
<div class="value">N</div>
<div class="label">Domestic</div>
</div>
<div class="metric">
<div class="value">N</div>
<div class="label">External</div>
</div>
</div>
<h4>Top Topics</h4>
<div class="topics">
<span class="topic-tag">Topic 1</span>
<span class="topic-tag">Topic 2</span>
</div>
</section>
<footer>
<p>Based on analysis of N articles from N sources</p>
<p>Generated by <a href="https://github.com/neul-labs/gdelt-cli">GDELT CLI</a></p>
</footer>
</div>
</body>
</html>
Step 6: Populate with Real Data
For each section:
-
Executive Summary: Write 2-3 sentences covering the most important story from domestic AND external affairs.
-
Key Personalities:
- Extract 4-6 key figures from the articles
- Include their title/role
- Note the context of their mention
- Count how many articles mention them
-
Domestic Affairs:
- Group articles about internal matters
- Subdivide into Political, Economic, Social/Security
- Each subsection: 1-2 sentence analysis + top 2-3 articles
-
External Affairs:
- Group articles about international matters
- Subdivide into Bilateral, Trade, Regional/Multilateral
- Each subsection: 1-2 sentence analysis + top 2-3 articles
-
Media Landscape:
- Count total articles, unique sources
- Count domestic vs external split
- Extract top topics
Step 7: Write Final Output
Save the HTML file and report:
- File location
- Summary of findings
- Key personalities identified
- Domestic vs External article breakdown
Classification Guidelines
DOMESTIC indicators:
- Article primarily about internal country affairs
- No foreign countries prominently mentioned
- Focus on local government, provinces, domestic companies
- Social issues, local disasters, domestic crime
EXTERNAL indicators:
- Foreign country or leader mentioned prominently
- Bilateral meeting, trade deal, or diplomatic activity
- International organization involvement
- Cross-border issues
When ambiguous: If an article involves both (e.g., trade deal affects domestic industry), classify based on the PRIMARY focus. Trade negotiations with foreign countries = EXTERNAL. Domestic response to foreign policy = DOMESTIC.
Important Notes
- Use formal, analytical tone throughout
- Present facts without speculation
- Key Personalities section should highlight WHO is driving the news
- Domestic/External split helps readers quickly find relevant information
- Always include source attribution
- If a category has no articles, note "No significant developments reported"