A comprehensive framework for context engineering to help AI incrementally create high-quality, concise essays with the depth and clarity.
# 1. Clone or copy this framework
cd context-engineering-for-writers
# 2. Set up your writing rules (optional - template provided)
# Edit CLAUDE.md to add your writing-specific guidelines
# 3. Add writing examples (highly recommended)
# Place exemplary essays and writing samples in the examples/ folder
# 4. Create your initial essay request
# Edit INITIAL.md with your essay topic and requirements
# 5. Generate a comprehensive WRP (Writing Requirements Prompt)
# In Claude Code, run:
/generate-wrp INITIAL.md
# 6. Execute the WRP to write your essay
# In Claude Code, run:
/execute-wrp WRPs/your-essay-name.md
- What is Context Engineering for Writers?
- Framework Structure
- Step-by-Step Guide
- Writing Effective INITIAL.md Files
- The WRP Workflow
- Using Examples Effectively
- Best Practices for Essay Writing
Context Engineering for Writers represents a paradigm shift from traditional writing prompts to comprehensive writing context systems:
Traditional Writing Prompts:
- Focuses on topic suggestions and basic instructions
- Limited to surface-level guidance
- Like giving someone a writing topic on a sticky note
Context Engineering for Writers:
- A complete system for providing comprehensive writing context
- Includes style guides, examples, research patterns, and validation criteria
- Like providing a master class with exemplars, techniques, and feedback loops
- Reduces Writing Failures: Most AI writing failures aren't model failures - they're context failures
- Ensures Consistency: AI follows your writing style, voice, and structural patterns
- Enables Complex Essays: AI can handle multi-layered arguments with proper context
- Self-Improving: Validation loops allow AI to refine and improve its writing
context-engineering-for-writers/
├── .claude/
│ ├── commands/
│ │ ├── generate-wrp.md # Generates comprehensive WRPs
│ │ └── execute-wrp.md # Executes WRPs to write essays
│ └── settings.local.json # Claude Code permissions
├── WRPs/
│ ├── templates/
│ │ └── wrp_base.md # Base template for WRPs
│ └── EXAMPLE_essay_wrp.md # Example of a complete WRP
├── examples/ # Your writing examples (critical!)
│ ├── paul_graham_style/ # Paul Graham essay examples
│ ├── argument_structures/ # Different argument patterns
│ └── transitions/ # Effective transition examples
├── CLAUDE.md # Global writing rules for AI assistant
├── INITIAL.md # Template for essay requests
├── INITIAL_EXAMPLE.md # Example essay request
└── README.md # This file
The CLAUDE.md
file contains writing-wide rules that the AI assistant will follow in every conversation. The template includes:
- Writing philosophy: Clarity, conciseness, and depth principles
- Essay structure: Introduction patterns, argument flow, conclusion techniques
- Style conventions: Voice, tone, sentence structure preferences
- Research standards: Source integration, fact-checking, citation practices
- Revision process: Self-editing criteria, feedback incorporation
You can use the provided template as-is or customize it for your writing style.
Edit INITIAL.md
to describe what you want to write:
## ESSAY TOPIC:
[Describe your essay topic - be specific about the angle, argument, or exploration you want to pursue]
## EXAMPLES:
[List any example files in the examples/ folder and explain what aspects should be emulated]
## RESEARCH:
[Include links to relevant sources, studies, or background reading]
## STYLE & TONE:
[Specify the desired voice, audience, and stylistic approach]
## OTHER CONSIDERATIONS:
[Mention any specific requirements, constraints, or elements to include/avoid]
See INITIAL_EXAMPLE.md
for a complete example.
WRPs (Writing Requirements Prompts) are comprehensive writing blueprints that include:
- Complete context and research
- Structural framework with validation
- Style and voice guidelines
- Revision and refinement criteria
They are similar to PRDs but crafted specifically to instruct an AI writing assistant.
Run in Claude Code:
/generate-wrp INITIAL.md
This command will:
- Read your essay request
- Research the topic and gather context
- Analyze writing patterns from examples
- Create a comprehensive WRP in
WRPs/your-essay-name.md
Once generated, execute the WRP to write your essay:
/execute-wrp WRPs/your-essay-name.md
The AI writing assistant will:
- Read all context from the WRP
- Create a detailed writing plan
- Draft each section with validation
- Revise and refine based on criteria
- Ensure all quality standards are met
ESSAY TOPIC: Be specific and focused
- ❌ "Write about technology"
- ✅ "Explore how the maker mindset in programming parallels the creative process in painting, using personal anecdotes and concrete examples to argue that both are fundamentally about iterative creation rather than predetermined execution"
EXAMPLES: Leverage the examples/ folder
- Place exemplary essays and writing samples in
examples/
- Reference specific techniques, structures, or styles to emulate
- Explain what aspects should be incorporated
RESEARCH: Include all relevant context
- Primary source URLs
- Background reading
- Statistical data or studies
- Expert opinions or quotes
STYLE & TONE: Define your voice
- Target audience (general public, experts, peers)
- Tone (conversational, academic, persuasive)
- Voice characteristics (personal, authoritative, exploratory)
- Structural preferences (narrative, analytical, argumentative)
The command follows this process:
-
Research Phase
- Analyzes your writing samples for patterns
- Searches for similar essay structures
- Identifies stylistic conventions to follow
-
Context Gathering
- Fetches relevant research and sources
- Includes background information
- Adds domain-specific knowledge
-
Blueprint Creation
- Creates step-by-step writing plan
- Includes validation checkpoints
- Adds revision criteria
-
Quality Check
- Scores confidence level (1-10)
- Ensures all context is included
- Load Context: Reads the entire WRP
- Plan: Creates detailed writing outline
- Draft: Writes each section iteratively
- Validate: Checks against quality criteria
- Revise: Refines based on feedback
- Finalize: Ensures all requirements met
The examples/
folder is critical for success. AI writing assistants perform much better when they can see patterns to follow.
-
Structural Patterns
- How you organize arguments
- Introduction and conclusion styles
- Paragraph flow and transitions
-
Voice and Style
- Sentence structure preferences
- Vocabulary choices
- Tone consistency
-
Research Integration
- How you incorporate sources
- Citation and reference styles
- Fact-to-opinion ratios
-
Narrative Techniques
- Personal anecdote usage
- Metaphor and analogy patterns
- Storytelling approaches
paul_graham_style/
: Essays demonstrating clear, conversational yet profound writingargument_structures/
: Different ways to build and present argumentstransitions/
: Effective ways to connect ideas and sectionsopenings_closings/
: Compelling introduction and conclusion examples
- Include 3-5 exemplary essays in your examples folder
- Choose pieces that represent your target quality and style
- Annotate what makes each example effective
- Specify your preferred tone and style in CLAUDE.md
- Include examples of voice consistency
- Note what to avoid (overly academic, too casual, etc.)
- Use clear argument progression
- Include smooth transitions between ideas
- End sections with forward momentum
- Include primary sources in your WRP
- Verify facts and statistics
- Balance research with original insight
- Use the validation criteria in your WRP
- Don't settle for first drafts
- Apply consistent revision standards
Your essays should demonstrate:
- Clarity: Ideas are immediately understandable
- Depth: Insights go beyond surface observations
- Flow: Smooth progression from idea to idea
- Voice: Consistent, engaging personality
- Precision: Every word serves a purpose
- Impact: Memorable conclusions and takeaways
- Ruby 3.2.0 or higher
- Claude CLI installed and configured
- Bundler gem installed
-
Navigate to this project directory:
cd context-engineering-for-writers
-
Install dependencies:
bundle install
This will install the Claude Swarm gem and all dependencies needed for the enhanced writing workflow.
-
Setup the framework:
- Copy this framework to your writing workspace
- Add 2-3 exemplary essays to the examples folder
- Customize CLAUDE.md with your writing preferences
- Create your initial essay request in INITIAL.md
-
Launch the Writing Research & Essay Generation Swarm:
bin/launch
This will start the Writing Orchestrator with connections to all specialist agents:
- Research Specialist
- Context Engineer
- Style Analyst
- Essay Writer
- Quality Reviewer
-
Resume a previous writing session:
bin/launch --session-id [SESSION_ID]
-
Launch with enhanced permissions:
bin/launch --vibe
-
View active writing sessions:
bin/launch ps
You can still use the traditional approach with individual Claude Code commands:
-
Generate a comprehensive WRP:
/generate-wrp INITIAL.md
-
Execute the WRP to write your essay:
/execute-wrp WRPs/your-essay-name.md
The enhanced swarm workflow provides specialized agents for each phase:
- Research Phase: Research Specialist gathers comprehensive sources and context
- Planning Phase: Context Engineer creates detailed Writing Requirements Prompts
- Style Analysis: Style Analyst ensures voice consistency with examples
- Writing Phase: Essay Writer executes WRPs systematically
- Quality Review: Quality Reviewer validates against all criteria
- All session data is stored in
~/.claude-swarm/sessions/
- Sessions can be resumed using the session ID
- View active sessions to monitor writing progress
- Each writing project maintains its own session context
The framework is designed to improve with use. Each essay you write adds to your context, making future essays even better.
If you encounter "Circular dependency detected" errors:
- Check
claude-swarm.yml
for bidirectional connections between agents - Ensure the writing_orchestrator coordinates between agents rather than agents connecting directly to each other
- The current configuration uses a hierarchical structure: orchestrator → specialists → no circular references
- Command not found: Ensure Claude CLI is installed and configured
- Permission errors: Check
.claude/settings.local.json
for proper command permissions - Missing dependencies: Run
bundle install
to install required gems
"The way to create something beautiful is often to make subtle tweaks to something that already exists, or to combine existing ideas in a slightly new way." - Paul Graham
This framework helps you engineer the context needed for AI to make those subtle tweaks and combinations that result in truly excellent writing.
The inspiration for this project came from https://github.com/coleam00/context-engineering-intro