6.5 KiB
Writer 2.0 implementation sprint
Authorisation: attached overnight implementation instructions, following the approved Writer2_Spec.md and complete Writer2Audit. Work remains on codex/word-companion-native-phase1-20261104; fetch at start found no divergence. Existing untracked CanonicalManuscriptArchitectureAssessment.md is not part of this sprint.
Capture decisions
The first increment retains counts and identifiers, not a second manuscript or historical prose archive. The existing paragraph manuscript and chapter acceptance engine remain authoritative. ParagraphManuscriptRepository holds the canonical row lock and commits the established stored-procedure save and activity append together. A failed append rolls back that acceptance; Word's document is unchanged and the caller may retry. No unchanged chapter validation is counted as writing output.
Events have server receipt UTC, optional native observation UTC, source/provenance, request/event identity, schema/metric version, manuscript/book/project, optional transport session/chapter and old/new paragraph/scene associations. Snapshot references are hashes/revisions; old prose cannot be reconstructed from this ledger. Initial or explicit current baseline contributes no new writing output. Existing manuscripts receive a metadata-only current baseline at startup/daily discovery under source System, respecting per-book pause settings. A concurrent first change is also protected by transactional baseline insertion, and owners can explicitly record a baseline. Discovery pages 100 books at a time without changing canonical prose/revisions. No historical backfill is fabricated.
Word changes use whitespace-v1 tokens and paragraph-local LCS; recognised moved paragraphs retain identity without new words, unmatched splits/merges are compared together. Very large replacement comparisons use an explicitly labelled partial minimum token-balance estimate to bound processing. Additions minus removals always equals the comparable word-count difference; these are sampled accepted differences, not keystrokes. Formatting not present in capture cannot be measured. No sessions or continuous focus duration are inferred.
Retention/privacy defaults for Development
- Capture metadata is enabled by default; author can pause per book without stopping manuscript synchronisation.
- Events default to 365 days, configurable from 30 to 3650 days. A daily worker expires events; shortening retention applies immediately.
- Activity is owner-private in this increment. Existing broad project collaborators are not granted the new activity views/export/controls.
- Explicit confirmed erase removes retained events and pauses capture; manuscript data remains intact.
- Compact request/hash receipts survive event expiry/erasure until permanent book deletion to prevent replay inflation. They retain no prose. Book hard deletion cascades both metadata tables/settings. Normal APIs never update activity events; retention/erasure are deliberate exceptions to append-only storage.
- JSON evidence export is bounded and cursor-paged. Activity is operational history, not part of the current manuscript/project portable recovery format. Existing database backups may contain separate copies; erasing live history does not erase prior backups or downloaded exports. Restore/copy is not certified as a continuous provenance chain. Production retention/backup policy remains a separate deployment decision.
Native delivery
The agent's existing DPAPI-protected installation state now holds up to 128 source observations with immutable event identities, server/account scope and original UTC. No prose is queued. Known unsaved chapter-change signals use this queue; delivery waits for normal authenticated connection recovery, runs independently of manuscript synchronisation and acknowledges exact request identity. Entries survive a restart, transient failures and sign-out/account switching without being reassigned to another account. Failed deliveries back off and remain pending; queue/storage failures expose incomplete observation coverage rather than changing sync behaviour.
Pending outbox entries use protected state schema 2, which older agents refuse rather than silently dropping unknown fields. After the queue drains, settings return to compatible schema 1. Do not force re-pair or replace protected settings to work around an older-agent downgrade while observations remain pending.
The old coalescing DeferredWorkQueue is deliberately not connected as a prose sender: it cannot preserve exact activity observations and contains no text. Final saved offline changes still reconcile via the established synchronisation path; the new queue does not claim to capture edits that were never observed, survive every Word crash, or reconstruct offline sessions. Observations outside the server's 30-day/five-minute-future window are retained locally pending resolution, not falsely timestamped at receipt. A blocked or full queue needs attention; it does not stop normal manuscript synchronisation.
Native source/portable qualification is distinct from Windows installer/COM acceptance. No Windows execution, real monitor placement or signed installer is claimed by this sprint.
Migration compatibility review
259 is additive: new metadata/settings/receipt tables and stored procedures; no existing canonical procedure or numbered migration is edited. It contains no manuscript backfill or existing text update. New tables cascade only on intentional book deletion; no new chapter/scene foreign key prevents existing reorganisation. Existing binaries can run with this added schema. Rolling back to an old binary stops new activity capture and therefore creates a coverage gap; it does not remove manuscript data. Application rollback is not SQL rollback.
Before any Development application deployment, apply and verify the qualified additive migration against the verified effective Development database after backup. The disposable clone is PlotDirector_Writer2_Synthetic_20261114; it was restored to new files from the copy-only/checksum-verified backup writer2-before-259-20261114.bak. Existing Development was not restored/reset.
Qualification and delivery
Actual final results, commits and deployment evidence are recorded in SprintResults.md when complete. The implementation preserves old endpoints and full/selective chapter reconciliation. The complete six-destination Writer product, flexible planning wizard, measured sessions, parallel passes, insights/collaboration and signed reports remain separate gates unless explicitly listed as delivered.