Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
examples/x-to-book-system/README.md
1# Example: X-to-Book Multi-Agent System23This example demonstrates how the Agent Skills for Context Engineering can be applied to design a production multi-agent system. The system monitors X (Twitter) accounts and generates daily synthesized books from their content.45## The Problem67A user requested a multi-agent system that:8- Monitors target X accounts daily9- Extracts insights and patterns from tweets10- Produces structured book output1112This is a non-trivial agent system because:13- High-volume data (hundreds of tweets per day)14- Long-form output requiring coherence15- Temporal awareness (tracking how narratives evolve)16- Quality requirements (accurate attribution, no hallucination)1718## Skills Applied1920### 1. multi-agent-patterns2122**Decision**: Selected Supervisor/Orchestrator pattern over peer-to-peer swarm.2324**Reasoning from skill**:25> "The supervisor pattern places a central agent in control, delegating to specialists and synthesizing results. The supervisor maintains global state and trajectory, decomposes user objectives into subtasks, and routes to appropriate workers."2627**Application**: Book production has clear sequential phases (scrape → analyze → synthesize → write → edit) that benefit from central coordination. Quality gates between phases require explicit checkpoints.2829**Failure mode addressed**:30> "Supervisor Bottleneck: The supervisor accumulates context from all workers, becoming susceptible to saturation and degradation."3132**Mitigation applied**: Raw tweet data never passes through Orchestrator context. Scraper writes to file system, other agents read from file system. Orchestrator receives only phase summaries.3334### 2. context-fundamentals3536**Decision**: Strict context budgets per agent with progressive disclosure.3738**Reasoning from skill**:39> "Context must be treated as a finite resource with diminishing marginal returns. Like humans with limited working memory, language models have an attention budget drawn on when parsing large volumes of context."4041**Application**: Each agent has an explicit token budget:42- Orchestrator: 50k (routing only)43- Scraper: 20k (one account at a time)44- Writer: 80k (one chapter at a time)4546**Principle applied**:47> "Progressive disclosure manages context efficiently by loading information only as needed."4849**Application**: Book outline loads first (lightweight). Full chapter content loads only when Writer is working on that specific chapter.5051### 3. memory-systems5253**Decision**: Temporal Knowledge Graph over simple vector store.5455**Reasoning from skill**:56> "Vector stores lose relationship information... Vector stores also struggle with temporal validity. Facts change over time, but vector stores provide no mechanism to distinguish 'current fact' from 'outdated fact'."5758**Application**: The system needs to answer queries like:59- "What was @account's position on AI regulation in January?"60- "Which accounts agree/disagree on crypto?"6162These require relationship traversal and temporal validity that vector stores cannot provide.6364**Architecture from skill**:65> "Temporal knowledge graphs add validity periods to facts. Each fact has a 'valid from' and optionally 'valid until' timestamp."6667**Application**: All relationships (DISCUSSES, AGREES_WITH, DISAGREES_WITH) have temporal validity periods.6869### 4. context-optimization7071**Decision**: Observation masking for tweet data.7273**Reasoning from skill**:74> "Tool outputs can comprise 80%+ of token usage in agent trajectories. Much of this is verbose output that has already served its purpose."7576**Application**: Daily tweet volume could reach 100k+ tokens. This data is:771. Processed by Scraper782. Written to file system (not passed through context)793. Read by Analyzer in chunks804. Summarized before reaching Synthesizer8182**Compaction trigger from skill**:83> "Compaction is the practice of summarizing context contents when approaching limits."8485**Application**: Phase outputs are compacted at 70% context utilization before passing to next phase.8687### 5. tool-design8889**Decision**: Three consolidated tools instead of 15+ narrow tools.9091**Reasoning from skill**:92> "The consolidation principle states that if a human engineer cannot definitively say which tool should be used in a given situation, an agent cannot be expected to do better."9394**Application**: Instead of separate tools for `fetch_timeline`, `fetch_thread`, `fetch_engagement`, `search_tweets`, we implement one `x_data_tool` with an action parameter.9596**Tool description pattern from skill**:97> "Effective tool descriptions answer four questions: What does the tool do? When should it be used? What inputs does it accept? What does it return?"9899**Application**: Each tool has explicit usage triggers, parameter documentation, and error recovery guidance.100101### 6. evaluation102103**Decision**: Multi-dimensional rubric with automated pipeline.104105**Reasoning from skill**:106> "Agent quality is not a single dimension. It includes factual accuracy, completeness, coherence, tool efficiency, and process quality."107108**Application**: Five evaluation dimensions weighted by importance:109- Source Accuracy (30%) - quotes verified against original tweets110- Thematic Coherence (25%) - narrative flow111- Completeness (20%) - theme coverage112- Insight Quality (15%) - synthesis beyond restating113- Readability (10%) - prose quality114115**Human review trigger from skill**:116> "Human evaluation catches what automation misses."117118**Application**: Books scoring below 0.7 or with source accuracy below 0.8 are flagged for human review.119120## Architecture Diagram121122```123┌─────────────────────────────────────────────────────────────────┐124│ ORCHESTRATOR AGENT │125│ Context: 50k tokens (routing, checkpoints, no raw data) │126│ Pattern: Supervisor with file-system coordination │127└─────────────────────────────────────────────────────────────────┘128│ │ │ │129▼ ▼ ▼ ▼130┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐131│ SCRAPER │ │ ANALYZER │ │ WRITER │ │ EDITOR │132│ 20k ctx │ │ 80k ctx │ │ 80k ctx │ │ 60k ctx │133│ Per-account │ │ Per-account │ │ Per-chapter │ │ Per-chapter │134└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘135│ │ │ │136▼ ▼ ▼ ▼137┌─────────────────────────────────────────────────────────────────┐138│ FILE SYSTEM STORAGE │139│ raw_data/{account}/{date}.json │140│ analysis/{account}/{date}.json │141│ drafts/{book_id}/chapter_{n}.md │142└─────────────────────────────────────────────────────────────────┘143│144▼145┌─────────────────────────────────────────────────────────────────┐146│ TEMPORAL KNOWLEDGE GRAPH │147│ Entities: Account, Tweet, Theme, Book, Chapter │148│ Relationships: POSTED, DISCUSSES, AGREES_WITH, SOURCES │149│ All relationships have temporal validity periods │150└─────────────────────────────────────────────────────────────────┘151```152153## Key Patterns Demonstrated154155| Pattern | Skill Source | Application |156|---------|--------------|-------------|157| Context isolation via sub-agents | multi-agent-patterns | Each agent has clean context for its phase |158| File system as coordination mechanism | multi-agent-patterns | Avoids context bloat from shared state passing |159| Progressive disclosure | context-fundamentals | Chapter content loads only when needed |160| Temporal knowledge graph | memory-systems | Tracks evolving positions over time |161| Observation masking | context-optimization | Raw tweets never enter orchestrator context |162| Tool consolidation | tool-design | 3 tools instead of 15+ |163| Multi-dimensional evaluation | evaluation | 5 weighted quality dimensions |164165## Files166167- [PRD.md](./PRD.md) - Complete Product Requirements Document168- [SKILLS-MAPPING.md](./SKILLS-MAPPING.md) - Detailed mapping of skills to design decisions169170## Using This Example171172This example serves as a template for applying context engineering skills to new projects:1731741. **Identify context challenges**: What are the volume constraints? What causes context saturation?1752. **Select architecture pattern**: Based on coordination needs, choose supervisor, swarm, or hierarchical1763. **Design memory system**: Based on query patterns, choose vector store, knowledge graph, or temporal graph1774. **Apply optimization techniques**: Observation masking, compaction, progressive disclosure as needed1785. **Build evaluation framework**: Define dimensions relevant to your use case179180The skills provide the vocabulary and patterns; the application requires understanding your specific constraints.181182