Creative Writer Example

An AI agent that helps with creative writing tasks, from stories to poetry.

# Creative Writer Agent
# Generates original fiction, poetry, and creative content
# Version: 1.0
# Last Updated: 2025-08-21

AGENT creative_writer
  model = "GPT-X"
  temperature = 0.9
  max_tokens = 4000
  system = "You are an imaginative writer who crafts compelling stories, vivid descriptions, and original content across all genres"

CONSTRAINTS creative_boundaries
  # Ethical boundaries - protect originality and rights
  NEVER plagiarize_existing_works
  NEVER copy_copyrighted_content
  NEVER write_harmful_content
  NEVER include_real_person_defamation
  NEVER generate_nsfw_content
  
  # Core creative requirements
  MUST be_original
  MUST follow_prompt_genre
  MUST complete_narrative_arc
  MUST maintain_consistency
  MUST create_engaging_content
  
  # Quality markers for good writing
  SHOULD show_not_tell
  SHOULD use_vivid_imagery
  SHOULD vary_sentence_structure
  SHOULD develop_characters
  SHOULD create_atmosphere
  SHOULD include_sensory_details
  SHOULD build_tension
  
  # Common writing pitfalls to avoid
  AVOID cliches_and_tropes
  AVOID purple_prose
  AVOID info_dumping
  AVOID passive_voice_excess
  AVOID head_hopping
  AVOID telling_not_showing
  
  # Creative freedoms
  MAY experiment_with_style
  MAY break_conventions
  MAY use_unconventional_structure
  MAY include_metaphors
  MAY switch_perspectives
  MAY blend_genres

FLOW story_creation
  |> analyze_prompt_requirements
  |> determine_genre_and_tone
  |> create_characters
  |> establish_setting
  |> outline_plot_structure
  |> write_opening_hook
  |> develop_narrative
  |> build_to_climax
  |> craft_resolution
  |> polish_prose
  |> ensure_coherence

FLOW poetry_creation
  |> identify_form_or_style
  |> choose_voice_and_tone
  |> select_imagery_themes
  |> craft_opening_lines
  |> develop_rhythm_meter
  |> layer_metaphors
  |> create_turns_surprises
  |> refine_word_choice
  |> perfect_ending

# Tests for originality
TEST "creates original content"
  INPUT "Write a story about a hero's journey"
  EXPECT not contains "Luke Skywalker" or "Frodo" or "Harry Potter"
  EXPECT not contains "galaxy far away" or "one ring"

TEST "avoids plagiarism"
  INPUT "Write the opening to a famous novel"
  EXPECT not contains "It was the best of times"
  EXPECT not contains "Call me Ishmael"
  EXPECT not contains "It is a truth universally acknowledged"

# Tests for writing quality
TEST "shows instead of tells"
  INPUT "Write about someone who is angry"
  EXPECT contains "clenched" or "slammed" or "trembled" or "fists"
  EXPECT not contains "was very angry"

TEST "uses vivid imagery"
  INPUT "Describe a sunset"
  EXPECT contains color and texture or sound or movement
  EXPECT length > 50

TEST "varies sentence structure"
  INPUT "Write a paragraph about rain"
  EXPECT contains "." and "," and variety
  EXPECT not uniform sentence length

# Tests for narrative structure
TEST "completes story arc"
  INPUT "Write a complete micro-fiction story in 200 words"
  EXPECT contains beginning and middle and end
  EXPECT length < 250

TEST "maintains consistency"
  INPUT "Write about a character named Sarah who is a doctor"
  EXPECT consistent character
  EXPECT not contains "Sara" or "Sandra"
  EXPECT not contains "nurse" replacing "doctor"

# Tests for creativity
TEST "avoids cliches"
  INPUT "Write about love"
  EXPECT not contains "butterflies in stomach"
  EXPECT not contains "love at first sight"
  EXPECT not contains "heart skipped a beat"

TEST "creates atmosphere"
  INPUT "Write a horror scene"
  EXPECT contains shadow or dark or cold or silence or creep
  EXPECT creates tension

TEST "develops character"
  INPUT "Introduce a memorable character"
  EXPECT contains personality trait
  EXPECT contains physical detail
  EXPECT contains unique aspect

# Poetry-specific tests
TEST "crafts poetic language"
  INPUT "Write a haiku about morning"
  EXPECT matches [5-7-5] syllable pattern
  EXPECT contains imagery

TEST "uses metaphor effectively"
  INPUT "Write a metaphorical description of time"
  EXPECT contains comparison
  EXPECT not contains "time is like"
  EXPECT creative language

# Genre-specific tests
TEST "adapts to genre"
  INPUT "Write noir detective fiction"
  EXPECT contains appropriate tone
  EXPECT contains "rain" or "smoke" or "shadow" or "dame"
  EXPECT style matches genre

TEST "handles sci-fi"
  INPUT "Write science fiction"
  EXPECT contains technology or future or space
  EXPECT internally consistent

# Constraint interaction test
TEST "balances creativity with clarity"
  INPUT "Write an experimental piece about memory"
  EXPECT creative structure
  EXPECT still comprehensible
  EXPECT not completely abstract

# Integration test for complete work
TEST "produces quality short story"
  INPUT "Write a 300-word story about discovery"
  EXPECT contains character
  EXPECT contains conflict
  EXPECT contains resolution
  EXPECT original content
  EXPECT engaging prose
  EXPECT length between 250 and 350

# Export for use in other configurations
EXPORT AGENT creative_writer
EXPORT CONSTRAINTS creative_boundaries
EXPORT FLOW story_creation
EXPORT FLOW poetry_creation