mcpField
W
writer-agent

writer-agent

github.com/hoangvantuanCreative & media054 installsUpdated 2w ago
Repository

About writer-agent

Writer Agent is a writing skill that turns documents or URLs into article series for people who need content rewritten with chosen styles and structures. It selects a workflow based on input length and offers configurable writing dimensions.

Key features

  1. 01Convert documents, web pages, and YouTube URLs
  2. 02Choose voice, structure, identity, audience, and emotion
  3. 03Select a workflow tier based on input length
  4. 04Use main-agent or parallel subagent writing paths
  5. 05Synthesize and verify generated articles

Use cases

  1. 01Turn PDF, DOCX, or EPUB files into article series
  2. 02Rewrite web or YouTube content as Vietnamese articles
  3. 03Set article styles with presets or custom dimensions
  4. 04Process long documents with tiered writing workflows

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/hoangvantuan/claude-plugin --skill writer-agent

After installing, type/writer-agentin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

audiences/
busy-professionals.md
curious-beginners.md
deep-seekers.md
emotional_maps/
empower-challenge.md
provoke-transform.md
reflect-discover.md
identities/
contemplative-thinker.md
knowledge-curator.md
tech-builder.md
meta/
performance-benchmarks.md
references/
article-writer-prompt.md
context-extractor-prompt.md
context-optimization.md
decision-trees.md
detail-levels.md
dimension-comparison.md
dimension-selection.md
directory-structure.md
large-doc-processing.md
retry-workflow.md
shared-article-writing.md
steps-5-6-synthesize-verify.md
tier-1-workflow.md
tier-2-workflow.md
tier-3-workflow.md
tier-direct-path.md
scripts/
_wa-common.sh
convert_to_markdown.py
epub_converter.py
extract_structure.py

Details

From the project README

Writer Agent

Transform documents and URLs into styled article series.

Quick Reference

ReferencePurposeLoad at StepDPT1T2T3
directory-structure.mdOutput folder layoutStep 1✓✓✓✓
dimension-selection.mdCustom mode dimension tablesStep 2 (Custom)✓✓✓✓
decision-trees.mdWorkflow decision guidesOn confusion only✓✓✓✓
retry-workflow.mdError recovery proceduresOn error only-✓✓✓
large-doc-processing.mdHandling documents >50K wordsStep 3 (if >20K)--✓✓
article-writer-prompt.mdSubagent prompt templatesStep 4-✓✓✓
context-extractor-prompt.mdContext extraction templateStep 3 (Tier 2)--✓-
context-optimization.mdContext optimization anti-patternsStep 3.1-✓✓✓
detail-levels.mdOutput detail level optionsStep 2.5✓✓✓✓
shared-article-writing.mdShared Steps 4.0-4.6Step 4-✓✓✓

DP = Direct Path | T1-T3 = Tier 1-3 | ✓ = Load | - = Skip

Tier Workflow Files (loaded at Step 2.7 after tier determination):

TierFileWhen
Direct Pathtier-direct-path.md<20K OR (<50K AND ≤3 articles)
Tier 1tier-1-workflow.md20K-50K (fails Direct Path)
Tier 2tier-2-workflow.md50K-100K
Tier 3tier-3-workflow.md>=100K

Dimension files (loaded at Step 2): voices/{voice}.md, structures/{structure}.md, identities/{identity}.md, audiences/{audience}.md, emotional_maps/{emotion}.md

Workflow Overview

Direct Path (<20K words OR <50K words with <=3 articles):

Main agent writes all articles directly without subagents.

Input → Convert → Style/Structure → Plan → Write(main) → Synthesize → Verify
  1        1           2               3        4            5           6

Standard (Tier 1-2, 20K-100K words):

Input → Convert → Style/Structure → Analyze → Extract → Write → Synthesize → Verify
  1        1           2               3         3         4        5           6

Fast Path (Tier 3, >=100K words):

Input → Convert → Style/Structure → Plan → Write(parallel) → Synthesize → Verify
  1        1           2              3          4              5           6

Step 0: Resolve Skill Paths (BẮT BUỘC)

Tìm wa-env → chạy → dùng paths tuyệt đối cho toàn bộ workflow.

# Tìm wa-env (thử Glob trước, fallback find nếu plugin installed vào dotdir)
Glob("**/writer-agent/scripts/wa-env")  # hoặc Glob(".claude/**/wa-env")

# Chạy (dùng bash, không dùng source — để BASH_SOURCE resolve đúng)
bash {path_to_wa-env}
# → SCRIPTS_DIR, SKILL_DIR, VOICES_DIR, STRUCTURES_DIR, IDENTITIES_DIR,
#   AUDIENCES_DIR, EMOTIONS_DIR, TEMPLATES_DIR, REFERENCES_DIR

# Verify
assert Glob(f"{SCRIPTS_DIR}/wa-convert") and Glob(f"{VOICES_DIR}/*.md")

FAIL CONDITION: Không tìm thấy wa-env → STOP. KHÔNG tự suy đoán paths.

Step 1: Input Handling

GUARD: SCRIPTS_DIR đã resolve từ Step 0. Nếu chưa → STOP, quay lại Step 0.

Detect input type and convert to markdown.

Output language: Luôn là tiếng Việt, bất kể source language.

Input TypeDetectionAction
File (PDF/DOCX/EPUB/etc)Path + extensionwa-convert {path}
URL (web page)http:// or https://wa-convert {url}
YouTube URLyoutube.com or youtu.bewa-convert {url}
Plain text / .txt / .mdNo complex extensionRewrite → wa-paste-text
File/URL Conversion
{SCRIPTS_DIR}/wa-convert [/path/to/file.pdf or url]

Output: writer-agent/{slug}-{timestamp}/input-handling/content.md

Plain Text Processing
  1. Read content (if file)
  2. Rewrite to structured markdown (add headings, preserve content)
  3. Propose title
  4. Execute:
echo "{rewritten_content}" | {SCRIPTS_DIR}/wa-paste-text - --title "{title}"
Error Handling
ErrorAction
File not foundAsk for correct path
Unsupported formatTry Docling, confirm with user
URL fetch failedReport and stop
Empty contentWarn, confirm before continue
Encrypted PDFAsk for decrypted version

Step 2: Select Writing Dimensions

Hệ thống 5 chiều độc lập. User chọn preset combo hoặc Custom để mix-match tự do.

Preset Combos (Recommended)

Show bảng sau cho user, hỏi chọn preset hoặc "Custom":

PresetVoiceStructureIdentityAudienceEmotion
EducatorTeacherBuilding BlocksTech BuilderCurious BeginnersEmpower & Challenge
StorytellerStorytellerStory ArcContemplative ThinkerDeep SeekersReflect & Discover
AnalystObjectiveBLUF-EvidenceKnowledge CuratorBusy ProfessionalsEmpower & Challenge
ExplorerInvestigatorFive LayersKnowledge CuratorDeep SeekersProvoke & Transform
MentorGuideDepth-PracticeContemplative ThinkerCurious BeginnersReflect & Discover
ReflectorPersonalSpiral ReturnContemplative ThinkerDeep SeekersReflect & Discover
Zen MasterDialogueMaster-StudentContemplative ThinkerDeep SeekersReflect & Discover

Cách dùng: Hiển thị bảng trên → Hỏi user gõ tên preset (e.g. "Educator") hoặc "Custom".

  • Nếu chọn preset: Tất cả 5 dimensions đã set, skip đến Step 2.5
  • Nếu chọn Custom: Chuyển sang Step 2a-2f bên dưới (chọn từng chiều)
  • Adaptive structure: Dùng khi content mixed/không fit structures cố định. Chỉ available qua Custom mode hoặc user yêu cầu trực tiếp.
Custom Mode

Khi user chọn "Custom" → đọc dimension-selection.md để chọn từng chiều (Voice → Structure → Identity → Audience → Emotion) kèm compatibility check.

Step 2.5: Select Detail Level

Hỏi user để confirm output detail level.

LevelRatioDescription
Concise15-25%Tóm lược, giữ ý chính
Standard30-40%Cân bằng (Recommended)
Comprehensive50-65%Chi tiết, giữ nhiều ví dụ
Faithful75-90%Gần như đầy đủ, viết lại theo style

Default: Standard (if user skips or unclear). PASS/FAIL dựa trên section coverage, không phải word count.

Chi tiết calculation (target_ratio, example_percentage) và worked examples → detail-levels.md.

Step 2.6: Tier Reference Table

Canonical tier definitions (referenced throughout documentation):

TierWord CountStrategyContext ApproachGlossarymax_concurrent
Direct Path<20K OR (<50K AND ≤3 articles)Main agent writes allN/A (no subagents)Inline (~200 words)N/A
Tier 120K-50K (fails Direct Path)Subagents read source directlyNo context filesInline (~200 words)3
Tier 250K-100KSmart compressionContext extractorsSeparate file (~600 words)3
Tier 3>=100KFast Path, minimal overheadNo context filesInline (~300 words)2

Priority rules:

  • Direct Path conditions are checked FIRST and override tier boundaries
  • Documents 20K-50K with ≤3 articles use Direct Path (not Tier 1)
  • Only documents failing Direct Path conditions fall through to tier selection

Note: Direct Path <50K condition is further limited by language: EN ~44K, VI ~32K, mixed ~38K words. These limits are pre-computed in structure.json → direct_path.capacity_ok. If capacity exceeded, fallback to Tier 1.

Key differences:

  • Direct Path: Main agent handles everything (no subagents)
  • Tier 1: Lightweight subagents, read source via line ranges
  • Tier 2: Context extraction for compression (only tier with separate glossary file)
  • Tier 3: Like Tier 1 but larger chunks, more selective glossary, lower concurrency

Step 2.7: Load Tier Workflow (BẮT BUỘC)

Sau khi xác định tier từ Step 2.6, đọc file workflow tương ứng:

tier = determine_tier(structure_json)  # Từ structure.json

if tier == "direct_path":
    Read(f"{SKILL_DIR}/references/tier-direct-path.md")
elif tier == 1:
    Read(f"{SKILL_DIR}/references/tier-1-workflow.md")
elif tier == 2:
    Read(f"{SKILL_DIR}/references/tier-2-workflow.md")
elif tier == 3:
    Read(f"{SKILL_DIR}/references/tier-3-workflow.md")

Tier workflow file chứa Steps 3-4. Sau khi hoàn thành Step 4, load references/steps-5-6-synthesize-verify.md cho Steps 5-6.

FAIL CONDITION: Nếu không load tier workflow file → KHÔNG biết cách xử lý Steps 3-4 cho tier đó. STOP và load file đúng.

Comments

Markdown supported