# auto_writer **Repository Path**: ming616/auto_writer ## Basic Information - **Project Name**: auto_writer - **Description**: agentic paper writer - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-09 - **Last Updated**: 2026-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Auto Writer An AI-powered academic paper writing system based on **Agentic Team** architecture. Multiple specialized AI agents collaborate to plan, research, write, review, and edit academic papers, outputting multi-file LaTeX projects. ## Architecture ``` Topic ──► Planner ──► Outline ──► Researcher ──► References ┌───── Blueprint ─────┐ │ (per-section spec) │ ▼ ▼ SectionWriterAgent × 8 ──► WriterTeam ──► Draft │ ▲ │ Shared Context: │ │ • Previous sections │ │ • References │ │ • Blueprint │ ▼ │ Reviewer ──── feedback ───► Editor ──► .tex files ``` ### Agent Roles | Agent | Responsibility | |-------|---------------| | **Planner** | Creates `PaperBlueprint` (section specs, key points, questions) from topic | | **Researcher** | Gathers references & related literature for each section | | **WriterTeam** | Orchestrates 8 section-level writers with shared context | | ├ `SectionWriterAgent` x8 | Each writes one section using templates + blueprint | | **Reviewer** | Reviews content, runs harness validation, suggests revisions | | **Editor** | Runs harness validation, exports multi-file LaTeX project | ### Section Writers (共享上下文协作) Each section has its own dedicated `SectionWriterAgent`, running sequentially so later sections can reference earlier ones: | Section | Key | File | |---------|-----|------| | Abstract | `abstract` | `0_abstract.tex` | | Introduction | `introduction` | `1_introduction.tex` | | Related Works | `related_works` | `2_related_works.tex` | | Formulations | `formulations` | `3_formulations.tex` | | Proposed Method | `proposed` | `4_proposed.tex` | | Experiments | `experiments` | `5_experiments.tex` | | Discussions | `discussions` | `6_discussions.tex` | | Conclusions | `conclusions` | `7_conclusions.tex` | ## Module Structure ``` src/auto_writer/ ├── core/ # Agent framework │ ├── agent.py # Agent base class + AgentContext (hooks, run) │ ├── message.py # Message, MessageRole │ ├── task.py # Task, TaskStatus │ └── team.py # Team + PaperWritingTeam (workflow, review loop) ├── agents/ # Agent implementations │ ├── planner.py # PlannerAgent → creates PaperBlueprint │ ├── researcher.py # ResearcherAgent → gathers references │ ├── writer.py # SectionWriterAgent × 8 + WriterTeam orchestrator │ ├── reviewer.py # ReviewerAgent → harness validation + feedback │ └── editor.py # EditorAgent → validation + multi-file export ├── models/ │ └── paper.py # Paper, PaperSection, Reference, Author, SECTION_DEFS ├── templates/ # LaTeX skeleton templates │ ├── base.py # Template, SectionTemplate, PaperTemplate │ └── sections.py # Default templates for all 8 sections ├── prompts/ # LLM prompt management │ ├── base.py # Prompt, SystemPrompt, TaskPrompt, PromptManager │ └── agents.py # Default prompts per agent role ├── harness/ # Validation & constraint framework │ ├── base.py # Constraint, Violation, Severity, Harness │ └── rules.py # HasAllSections, SectionContentCheck, etc. ├── blueprint/ # Content plan specification │ ├── base.py # PaperBlueprint, SectionBlueprint, SubsectionBlueprint │ └── defaults.py # Default blueprints for all 8 sections ├── tools/ │ └── formatting.py # LaTeX export (main.tex, section files, .bib) ├── config.py # Project-wide configuration └── __init__.py # Public API exports ``` ## Key Design Decisions - **Blueprint ≠ Template ≠ Prompt ≠ Harness** — Each concern is separated: blueprint defines *what content*, template defines *LaTeX structure*, prompt defines *LLM instructions*, harness defines *validation rules*. - **Per-section `SectionWriterAgent`** — Each section gets its own agent instance with shared context, enabling cross-referencing and collaborative writing. - **`WriterTeam` orchestrator** — Manages 8 section writers sequentially, propagating `shared_state` for context sharing. - **Template system** — Uses `{{placeholder}}` syntax (not Python f-strings) to avoid LaTeX escaping issues. - **Multi-file LaTeX output** — Generates `main.tex`, 8 chapter `.tex` files, and `references.bib`. - **Review loop** — Supports multiple revision cycles with writer → reviewer → editor. - **pydantic v2** — All data models use pydantic v2 for validation. ## Quick Start ```bash pip install -e ".[dev]" ``` ```python import asyncio from auto_writer import PaperWritingTeam async def main(): team = PaperWritingTeam() result = await team.run(topic="Transformer architectures in NLP", max_revisions=1) print(f"Output: {result['output_dir']}") asyncio.run(main()) ``` ## Development ```bash pip install -e ".[dev]" pytest tests/ -v ``` ## License MIT