A full-stack AI writing agent for style extraction, rewriting, review, cover generation, and publishing-ready WeChat layout (FastAPI + React/Vite).
- Productize fragmented writing actions into one standardized loop: material retrieval, style-constrained rewriting, quality review, human refinement, cover generation, and layout publishing.
- In our practical usage, value shows up in two dimensions: productivity (long-form output can move from hour-level effort to roughly tens-of-minutes), and quality (more stable style, reviewable outputs, and replayable process instead of one-shot prompt luck).
- During writing, the app can run RAG retrieval against your materials library and show cited materials in the output context for traceability.
- Rewrite now supports a controlled editor-review loop:
draft(1) -> review(1) -> (if failed) draft(2) -> review(2), with backend-capped retries (max_retries=1) to avoid infinite loops. - WeChat layout capability: format content in multiple styles based on official account publishing conventions, then export to WeChat with one click.
- Rewrite: input source text, pick style, set target length (
100-8000preset options, default500), stream output. Home also shows real-time loop stage hints (first draft, first review, second draft, second review, final state). The top nav supports site-wideCN / ENswitching (saved inlocalStorageaswrite_agent_lang).
- Style Management: create and reuse writing style DNA.
- Materials (RAG): collect materials, test retrieval, and reuse in writing.
- Review: inspect rewrite results and do manual edits when needed.
- Cover Generation: generate covers from rewrite results with multiple modes and ratios.
- Layout: jump from Rewrite/Review/Covers to
/layoutwithrewrite_id, auto-import content and cover (if available), then apply theme, preview in real time, and copy to WeChat.
- GitHub Trends: captures weekly Top10 repositories by star growth over the last 7 days, with week selection and manual refresh. Each repo can be sent to Materials or Rewrite in one click, connecting topic discovery to the writing workflow.
- Linux.do Trends: aggregates public Linux.do hot topics by
7 days / 30 days, supports period history switch (recent 12 periods), single-tag server-side filtering, and manual refresh with cooldown / rate-limit backoff protection. Each item can be sent to Materials or Rewrite in one click.
git clone https://github.com/guoguo-tju/write_agent.git
cd write_agent
uv sync
cd frontend && npm install && cd ..cp .env.example .envEdit .env with:
- Required:
OPENAI_API_KEY,VOLCENGINE_API_KEY - Optional:
SILICONFLOW_API_KEY(for writing-time RAG embedding/retrieval and citation display) - Optional:
GITHUB_TOKEN(orGITHUB_PERSONAL_ACCESS_TOKEN) for richer GitHub trends enrichment context.
PYTHONPATH=src DATABASE_URL=sqlite:///./data/acceptance_write_agent.db .venv/bin/uvicorn write_agent.main:app --host 127.0.0.1 --port 8000cd frontend
npm run dev- Frontend:
http://127.0.0.1:5173 - Backend docs:
http://127.0.0.1:8000/docs - Suggested first run path:
Rewrite -> Review -> Covers -> Layout (/layout).
Note: without SILICONFLOW_API_KEY, the main flow still runs, but writing-time RAG retrieval/citation is limited.
.
├── src/write_agent/ # backend (api, models, services)
├── frontend/ # React + Vite frontend
├── scripts/ # db/init/smoke scripts
├── tests/ # backend tests
├── data/ # sqlite + chroma data
└── docs/screenshots/ # README screenshots
- Entry for AI contributors:
AGENTS.md - Full engineering spec:
docs/specs/development-spec-v1.md - Verification checklist:
docs/specs/verification-checklist.md
Check OPENAI_API_KEY and related OpenAI-compatible config in .env.
Check VOLCENGINE_API_KEY, VOLCENGINE_BASE_URL, and model config.
Check SILICONFLOW_API_KEY and network access to embedding service.
Use http://127.0.0.1:5173 for frontend and http://127.0.0.1:8000 for backend, and keep VITE_API_URL aligned.
Cover images are runtime assets stored locally under ./data/covers, and this directory is intentionally ignored by Git.
It means the system automatically fell back to the baseline fetch flow and did not block core actions. Configure GITHUB_TOKEN (or GITHUB_PERSONAL_ACCESS_TOKEN) to get richer enrichment context.







