Book writing agents
A single-file Streamlit tool that rewrites long-form text into a target style and length, one section at a time, until an automated checker and a deterministic policy gate both agree it is done.
The problem
One rewrite pass is never enough, and nobody wants to babysit it
Rewriting a manuscript into a consistent voice at a specific length is not a single generation call. Long input has to be split into sections that each fit a generation budget, each section needs to stay stylistically continuous with the one before it, and "good enough" is a judgment call that a single pass rarely gets right on the first try.
The tool automates the part that benefits from automation, the drafting and re-drafting loop, while keeping a hard, non-negotiable line in front of it: a small set of mechanical tells (a banned em-dash, a banned sentence pattern) get blocked before the section is even scored, rather than left to an LLM checker that misses them some of the time.
Architecture
Rewrite, gate, score, loop
The Noesis integration was evaluated honestly rather than assumed worth keeping: for this single tool, a few lines of local regex would deliver most of the same value with no network call and no manuscript text leaving the machine. Noesis earns its place if this becomes one of several agents governed centrally over time; for a single local tool the case is closer.
Detail
At a glance
| Interface | Single-file Streamlit app (streamlit run rewriter_loop.py). |
|---|---|
| Input | Uploaded or pasted .txt / .pdf, split into sections for long inputs or large expansion targets. |
| Rewrite step | RewriteAgent (Tinker) drafts each section from the target style, the previous iteration's feedback, and a continuity snippet carried from the prior section. |
| Policy gate | A Noesis ingest() check runs as a hard backstop before the checker, blocking mechanical violations deterministically and logging the event. |
| Check step | CheckerAgent scores human-likeness (1-10), rule adherence including length, and AI risk; loops per section until the score clears the threshold or the iteration cap is hit. |
| Output | All sections stitched into the final text, downloadable from the app. |
| Stage | Building. Runs locally; not deployed publicly. |