Skip to content

Story-so-far setup, reviews with triage and rulings, and the studio - #10

Merged
MrPickering merged 3 commits into
mainfrom
agent/weaver-s7-studio
Sep 28, 2026
Merged

MrPickering merged 3 commits into
mainfrom
agent/weaver-s7-studio

Conversation

@MrPickering

Copy link
Copy Markdown
Contributor

Three slices, as three commits. Draft until two remaining checks are done: a real-Claude review run through the findings queue, and a studio polish pass.

S5a: story-so-far setup (host adapter, work packets, facts ledger)

  • Weaver builds work packets; a host (Claude Code, or the claude CLI in batch) answers them; Weaver validates and records the answers with their input hashes.
  • The API key never reaches the host. The child environment drops ANTHROPIC_API_KEY. The host also survives early exits, times out, and retries once.
  • weaver state bootstrap [--run]: narrative-state records and facts files for imported books. Every fact must quote the scene verbatim or it is rejected. Nothing is auto-accepted. After acceptance, imported books can release.
  • continuity/facts.json: a deterministic facts ledger.

S5b: reviews, triage, findings queue, rulings

  • weaver review --chapter N [--run]: continuity, style and critic packets. Continuity gets compact context, and every finding must quote its paragraph verbatim.
  • weaver findings: one triaged queue across style rules, voice and judgment. Definite findings plus at most 2 critic items are queued, capped at 6 per chapter; everything else becomes notes.
  • weaver rule <id> --decision fix|allow|intended: decide once. A ruling lapses when the passage changes, allowing a blocking finding is audited, and each ruling is its own commit.

S7: studio (weaver studio, 127.0.0.1:4187)

  • The author's page: progress, book browser with wiki links, characters, places, threads, the findings queue with decisions, changes with approve/reject, history with undo, and jobs.
  • Bound to 127.0.0.1 only. POSTs need the X-Weaver-Studio header and a local Host; routes are allow-listed; restrictive CSP. Port 4187 is allocated in the ops port registry.

Verification so far

  • npm run preflight: 63/63 with a fake host.
  • Real Claude, simulated 12-chapter book: bootstrap recorded 9/12 scenes with about 30 facts each, every quote verified verbatim. The run used a deliberately fake ANTHROPIC_API_KEY, so it succeeding proves the key is stripped. It stopped on system memory pressure and is resumable.
  • Studio driven in real Chrome: the "It's intended" click produced one commit touching only continuity/rulings.json, and the count updated. POST without the header returns 403, a forged Host 403, and path traversal 404.

Still to do before this leaves draft

  • Real-Claude review --run on a chapter through findings and rule.
  • Studio polish: cache doctor and findings (pages take 1.3 s, findings 5 s); hide empty chapters on /findings; a normalized place name on location facts; render or strip Markdown in threads; add an Origin check.

🤖 Generated with Claude Code

https://claude.ai/code/session_011T6ux9Zwjx6YYPyHmFa375

MrPickering and others added 3 commits September 26, 2026 06:23
…s ledger

Weaver's core stays deterministic: it builds work packets, a host (Claude
Code interactively, or the `claude` CLI in batch) answers them, and
Weaver validates and records the answers with the hashes of their inputs.

- engine/host.mjs: runs the configured host with the prompt on stdin,
  WITHOUT ANTHROPIC_API_KEY in the child environment (so runs stay on
  the user's Claude subscription). Survives a host that exits early,
  times out a hung host, and retries once on a transient failure.
  Batch runs are concurrency-limited. Doctor warns when no host is
  available.
- engine/packets.mjs: deterministic packet ids, JSON extraction, and one
  repair round for answers that fail validation; interactive
  `weaver packet` / `weaver submit`.
- `weaver state bootstrap [--run]`: per-scene narrative-state records
  plus facts files for imported books, in reading order, resumable, and
  never auto-accepted (the author runs state:accept). Anti-invention
  rule: every fact must quote the scene verbatim, or the answer is
  repaired or skipped. After acceptance, imported books can release.
- continuity/facts.json: a deterministic facts ledger (per character, in
  reading order, plus where each fact was first established), with a
  compact summary as packet context.

Verified: npm run preflight (55/55) with a fake host covering the happy
path through release, invented quotes, repair, retry, early exit, the
API key never reaching the host, resume, and the interactive round trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Session-Id: 04db4d93-9884-44ee-b28f-627e92b33731
Agent: claude-code
…ledger

On a simulated 12-chapter book the three reviewer lenses caught what no
script can (a character placed where canon says he never goes), but at
about 10 findings per lens per chapter. The product is triage and memory.

- `weaver review --chapter N [--run]`: continuity/style/critic packets.
  Continuity gets compact context (facts ledger plus the previous
  chapter's state records), not every earlier chapter. Paragraph-numbered
  text; each finding must quote its paragraph verbatim or it is dropped
  (and counted). Records carry prose and facts hashes and go stale when
  either changes.
- `weaver findings`: one queue across style rules, voice and judgment,
  with stable ids. Judgment is triaged: definite findings, plus at most 2
  items from a failing critic, capped at 6 per chapter; everything else
  becomes counted notes (--all).
- `weaver rule <id> --decision fix|allow|intended`: decide once. An
  allow/intended ruling suppresses the finding while the passage is
  unchanged and lapses (with a note) when it changes. Allowing a blocking
  style finding is audited in check/approve output. `--to-fix` lists what
  the author wants repaired. Each ruling is its own commit touching only
  continuity/rulings.json.

Verified: npm run preflight (60/60) with the fake host: review records,
dropped invented quotes, repair, staleness, triage caps, stable ids,
ruling suppression, lapse, audited blocking exceptions, fix resolution,
per-ruling commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Session-Id: 04db4d93-9884-44ee-b28f-627e92b33731
Agent: claude-code
The author never uses a terminal or handles files, codes or Git. The
studio is a thin UI over the existing engine: every button calls the same
function as the matching command, through the same doctor refusal.

- `weaver studio [--port]`: node:http bound to 127.0.0.1 only, default
  port 4187 (project.json "studio.port" optional). /api/health carries a
  body signature. POSTs require X-Weaver-Studio: 1 plus a local Host.
  Routes are allow-listed, there is no path traversal, and a restrictive
  CSP; only packaged assets are served. Offline, no dependencies.
- Pages: progress ("N of M chapters approved since import"), a book
  browser with paragraph numbers and finding markers, character pages
  (voice evidence, facts timeline), places and threads derived from the
  facts ledger and state records (wiki links and stable slugs), a triaged
  findings queue with Fix / Intended / Allow, pending changes side by
  side with Approve / Reject, history with Undo, and a doctor footer on
  every page.
- Jobs: run a chapter review or the story-so-far setup from the page, one
  at a time, with a live log tail.

Verified: npm run preflight (63/63): health signature, all pages, 404s,
POST protection, approve/reject/undo and rulings via the API asserted
against Git, wiki links, progress count, jobs with the fake host, a
127.0.0.1 bind, and the studio starting from the packed tarball.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Session-Id: 04db4d93-9884-44ee-b28f-627e92b33731
Agent: claude-code
@MrPickering
MrPickering marked this pull request as ready for review September 28, 2026 22:39
@MrPickering
MrPickering merged commit 81ee875 into main Sep 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant