PlotDirector/Docs/Investigations/Writer2Audit/03-Activity-Capture-Assessment.md

15 KiB
Raw Blame History

Activity Capture Assessment

Conclusion

The application can establish what accepted manuscript state it holds now, how paragraph/scene/chapter identities were reconciled at the latest transition, and when particular captures, validations or selected application operations were recorded. It cannot establish a complete past sequence of writing, continuous focus time, every added/deleted word, or the human origin of the prose. Authentication attributes an operation to an account/installation; it does not prove who physically typed it.

These limits must be visible in dashboards and reports. An import baseline is pre-existing manuscript content, not newly written output. “Last synchronised” and “last changed” are different claims.

Four evidence categories

Recorded means retained by the inspected current system, subject to overwrite/deletion below. Transient means available during operation but not retained as a historical activity record. Inferred means a limited conclusion derivable from evidence with a stated interval/scope. Unavailable means the current records cannot substantiate the claim.

Question Recorded and retained Transient operational evidence Reasonable inference Cannot currently establish
Current manuscript and timing BookParagraphManuscripts.Payload, revision, last request, snapshot hash, payload UpdatedUtc; current SceneManuscriptSources text/counts and row dates Incoming snapshot/chapter payload before overwrite Accepted state existed by server acceptance/capture time Actual sentence creation time; all intervening manuscript states
Paragraph changes and identity Current ParagraphOccurrence GUID, NativeId, Text, PreviousText, Change, WasMoved, Resolution, neighbours/ordinal/positions; latest evidence anchor states ParagraphComparison.Removed and old state in reconciliation A matched paragraph differs between the two compared observations; movement is a reconciliation result Durable timestamped per-paragraph edit history; previous states of deleted paragraphs after overwrite
Words added/removed/net Current word statistics and some previous paragraph text; no retained gross-count ledger Before/after accepted text available in full/chapter reconciliation Net difference between two known, comparable retained snapshots; snapshot-diff additions/deletions if both full states and a stated algorithm exist Total typing/deletion activity, edits undone before sync, all historic gross additions/deletions
Chapter/scene activity Latest paragraph assignment, chapter headings/checkpoints; scene latest source, workflow actual words/LastWorkedOn Live cursor and current validated chapter/scene, old/new mapping during reconciliation Change interval can be associated with a chapter/scene if mappings are valid; current cursor means location, not editing Time spent editing every chapter; current mappings as proof of historical ownership
Writing session boundaries/time Schedule items store planned date/estimated minutes and declaration of Done/CompletedDateUtc Word open/close, activation, heartbeat, native session/revision, browser window connection times; agent diagnostic stopwatches At most a connected/observed interval while telemetry exists Retained actual session duration; continuous concentration; precise pauses, interruptions or offline work time
Drafting versus revision Current revision status; author-entered plan task type Nature of a compared content change A replacement/deletion-heavy change pattern can be labelled inferred revision-like activity with caveats Intent, definitive drafting/revision classification or automatic phase completion
Offline changes Latest Word file may later supply an accepted state In-memory capture/retry/cache while processes survive; Word's own saved file Changes occurred between last accepted state and later observation; exact event time may be unknown Every offline action, offline sessions, guaranteed restart-safe delivery of all observations
Duplicate events Latest request identity / revision checks; onboarding capture identity+payload hash; current chapter validations Pipe sequence rejection, pending request acknowledgements and retry state Current paths guard many repeated/stale submissions A permanent globally deduplicated writing-event history, particularly old-key replay after later changes/restarts
Prior manuscript versions Original retained import capture, discrete backup/restore-point payloads, latest accepted state; latest previous-text fields Full prior state loaded for save; comparison removed rows Some discrete earlier accepted/import states may be recoverable where complete snapshots exist Arbitrary historical date reconstruction or continuous provenance from sparse backups
Author/editor/system attribution ProjectActivity user on selected app actions; capture user; native grant/installation/account context Authenticated request user and source, active session Account submitted/accepted a particular operation Sole physical authorship, AI-free text, external editor identity from an unlabelled imported file

What the implementation actually observes

PlotDirector.NativeCompanion/Vsto/WordAdapter.cs subscribes to document open/change/activation, selection, before-save and before-close. CaptureSelection samples cursor range, document length and Saved state. It increments a local revision on length changes or saved→dirty transitions; BeforeSave also invalidates affected work. A periodic probe covers some edits that do not raise selection changes. Later bounded chapter reads/fingerprints detect content differences, including same-length edits.

These are deliberately coalesced lifecycle observations. They are not per-keystroke notifications or a durable Word Track Changes stream. A revision increment can reflect a save/lifecycle event and cannot be counted as one prose edit. The timer in the add-in schedules responsive COM work; it is not a writing-focus timer. Chapter timing metrics measure synchronisation performance, not time spent writing.

Agent/SessionManager.cs keeps instances/documents in memory, rejects stale sequence/revision, and clears document work on detach/change. ParagraphSnapshotCache is in memory, bounded to eight entries / approximately 32 MiB of text and scoped to authentication/manuscript. It optimises deltas; it is not a local snapshot archive. CompanionStateStore persists DPAPI-protected account credentials/preferences/bindings; it does not persist a writing-event journal.

DeferredWorkQueue is a durable metadata foundation with capacity 128. It coalesces newer work for a manuscript/scene and stores no prose. The source explicitly says it is not attached to a sender; production code has no construction/use reference. Its portable queue tests do not establish end-to-end offline activity capture. A later sync can reconcile final offline edits, but cannot recover deleted/undone intermediate work or session timing that was never observed and saved.

Identity and reconciliation limits

Protocol/Manuscript/ParagraphIdentity.cs explicitly treats Word w14:paraId as a document-part hint. PlotDirector occurrence GUIDs are the canonical identity. Matching uses native IDs, unchanged sequence, unique text/context and neighbour checks; copy/paste duplicates, splits/merges and uncertain rewrites can remain ambiguous. WasMoved uses order analysis to distinguish moves from simple insertion-induced index shifts.

ParagraphManuscriptEngine.Reconcile applies current rows, retains/reviews evidence and assignments conservatively, and updates snapshot capture time. PreviousText belongs to the latest comparison and may equal current text for unchanged matched rows. A high count of PreviousText fields does not imply that many edits. Removed rows returned by comparison are not an append-only tombstone list in ParagraphManuscript.

The Undo collection is bounded layout history (roughly 1–12 layouts depending on manuscript size). It stores assignments, scene/chapter layout and event positions under a matching snapshot hash, not all old paragraph prose. It is cleared when content hash changes and for certain evidence actions. It cannot reconstruct old manuscript text.

Chapter assignments use canonical IDs plus heading occurrence GUIDs and accepted heading windows, including excluded/canonical-zero sections. Changed-chapter merging requires a recognised heading, complete evidence, correct base revision and coherent adjacent boundaries. Cross-chapter moves, new/deleted headings and ambiguous identity require structural review. Store old and new associations in future activity; joining old events solely to today's chapter/scene layout would rewrite their meaning.

Timestamp and retention semantics

Field/store Meaning Retention/claim limit
ParagraphManuscript.UpdatedUtc inside Payload Engine bootstrap/reconciliation snapshot capture time Book-level accepted capture, not per-paragraph creation. Structure-only saves can advance revision without a new prose change.
BookParagraphManuscripts.UpdatedUtc column Latest database row save, including mode preferences Not a reliable prose change time. Metadata checkpoint updates can change Payload without advancing the content revision.
ChapterCheckpoint.LastSuccessfulSyncUtc Successful acceptance/validation, including unchanged text One latest durable checkpoint, not the date the author wrote that chapter.
BookChapterValidations.ValidatedUtc/ExpiresUtc Server acceptance and current-session physical position lease Updated per book/chapter/user/session; expiry is 12 hours, expired rows pruned on relevant acceptance/reuse. A retained expired row is not valid live evidence.
OnboardingManuscriptCaptures.CreatedUtc + PayloadHash Server receipt/retention of a preview capture IsCurrent changes; older captures can remain. Not a version at each subsequent sync. PayloadHash is an integrity digest, not an external signature.
ManuscriptDocuments.LastOpenedUtc/LastSyncUtc Latest binding operation times Latest values only, not a session/open history.
SceneWorkflow.LastWorkedOn, DraftedDate Editable workflow dates; legacy companion word-count procedures can write date values Date precision; can be author-entered or set on sync. Cannot treat as measured activity days or duration.
WritingScheduleItems.CompletedDateUtc Server time an authorised user marks planned task Done Declared task completion, no measured session duration. Regeneration/deletion can remove it.
ProjectActivity.CreatedDateUTC Time selected app action was recorded, with optional user/entity No before/after prose, coverage contract or writing idempotency key. Not every database path calls it.
ProjectRestorePoints.CreatedDateUtc/JsonData A discrete recovery export and its creation time Manually/safety-created, deletable, limited manual capacity; no guaranteed cadence or continuous chain.
App/native diagnostic logs Operational troubleshooting, correlation and timings No audited long-term retention or complete event contract. Do not use as provenance of all work.

WordCompanion_Scene_UpdateWordCount (SQL 059) overwrites current actual word count and a date-valued LastWorkedOn; runtime word-count update (097) uses the server UTC date. Neither preserves deltas. ManuscriptTextStatisticsService computes current deterministic counts; no additions/deletions are retained by that calculation. Word and server token counts must not be assumed identical.

Development evidence, without historical overclaim

SELECT-only results are preserved alongside this assessment. The relevant stores are non-temporal; canonical paragraph state, scene sources, schedule items and project activity are not tracked by CDC. At inspection:

  • 14 current manuscript rows; 118,399 current paragraphs; 50,743 PreviousText fields and three latest Modified annotations. These are aggregate current annotations, not a count of past edits or distinct real books. Development fixture origin was not inferred.
  • 467 retained chapter-validation rows, all expired. Retention here demonstrates rows remain until pruning, not a historical activity archive. Last retained validation was 13 November 2026, 22:09:15 UTC.
  • One onboarding capture dated 8 November 2026, 21:05:14 UTC; one restore point dated 9 November 2026, 14:57:07 UTC, containing one paragraph manuscript snapshot. These establish discrete source states only. No full reconstruction of author prose was attempted or exported.
  • 54 project activity rows, dominated by location create/update actions, plus project/book/export/merge records. No evidence in those aggregates establishes a complete sequence of native writing edits.
  • One active writing plan, no schedule items, Owner-only current access rows. The absence of schedule items is not proof schedule generation is unimplemented; it exists in code/procedures.

No arbitrary-date manuscript reconstruction is warranted. With author approval in a future feature, a specific retained import or restore point could be offered as a labelled historical source. Comparing two such states establishes a difference over their observation interval; it does not establish when or by whom each intermediate change occurred. Database backups outside the app were not restored/inspected and are not assumed available to authors.

Capture accepted manuscript transitions on the server once, for Word and the future Editor. Native telemetry supplies optional observation/session information; server acceptance supplies authoritative receipt, actor context and accepted revision. Legacy clients can benefit from server acceptance events without a forced upgrade; they simply have lower temporal coverage.

Each event must identify provenance class, source, authenticated submitter and claimed contributor separately, document/manuscript/book, old/new revision and snapshot hashes, affected paragraph GUIDs and historical chapter/scene links, observed time and precision/clock quality, received UTC, schema/metric version, optional focus session, immutable idempotency key and correlation/causation IDs. Baseline, content transition, mapping change, validation, import/declaration and session transition are different event types.

Gross counts should mean token insertions/deletions between accepted observed states under algorithm X, not keystrokes. Define tokenisation once and version it. For comparable scope, added - deleted = after words - before words. Replacements count both sides; stable paragraph moves do not become drafting; split/merge and punctuation/whitespace cases need explicit fixtures. Formatting-only changes do not count as growth. Ambiguous identity or missing baseline produces partial/unknown coverage, never invented zeros. Imported baseline content is excluded from “words written this period”.

Keep observed text change, timer elapsed, declared objective and inferred workflow pattern separate. A document can be edited while several passes exist; do not allocate all output to every pass or simultaneous session. If linkage is uncertain, leave it unassigned and offer declaration rather than silently doubling totals. Rebuild statistics from retained raw events; snapshot/diff text retention determines whether those counts remain independently recomputable. Full history/reconstruction is an optional policy-governed capability, not a consequence of append-only counts alone.