Skip to main content

Characters and recaps (sidecars.generate)

sidecars.generate makes a book's characters and recaps. An admin presses Generate characters and recaps on a book, and the Bridge:

  1. transcribes the book, or reads its ebook;
  2. runs the sidecars engine's agent passes and validates the result;
  3. writes it into the book's .audiosilo/ folder;
  4. asks the server to read it. /meta then serves it to the players.

The same run also writes an own-words, spoiler-free description of the book (the description step). sidecars.describe writes one alone for a book generated earlier (A description on its own). A book with no chapter markers runs too. The engine finds its chapters in the narration first, and the job writes them as chapters.json straight away (Chapterless books).

The job model it rides on (states, leases, attempts, cancel) is in Pairing and jobs. The server's code is internal/bridge (jobs.go, estimate.go, status.go), api/handlers_bridge.go and handlers_bridge_estimate.go. The Bridge's is internal/generate, wired in internal/app/engine.go.

Who sees the action​

The kind's family is sidecars, so a Bridge advertising sidecars.generate puts sidecars in GET /server's bridge.features. Both UIs gate the action on the same four things:

  • the user is an admin (the player also refuses a demo account, a household member and a kid's account, whatever their role says: mayGenerate in src/components/bridge/bridge-model.ts);
  • capabilities.bridge (a Bridge paired and online);
  • bridge.features includes sidecars;
  • capabilities.metadata: generated content reaches the players through /meta, which is 404 while metadata is off.

The console (admin-ui/src/features/bridge/, generateAvailable) offers it in the book page's Community card (GenerateSection), on each series card (SeriesGenerateDialog) and links each generate job in Settings > Bridge to its book. The player offers it on the book page's action row and in the companion's empty Who's who and Story so far; see the book page. For a single book both UIs follow one offer rule, because generated content only ever fills a dimension the community lacks (/meta's per-dimension merge). A series batch has its own rule (Queueing it).

The community hasGenerated hereOffered
both characters and a recap listeither or noneno action: "The community already has characters and recaps for this book", with a link to them (covered)
one of them, or neithercharacters or a recap list the community lacks, so they showRegenerate
one of them, or neithernone that showsGenerate

Generated and shown is the one rule both UIs read: a part counts for Regenerate when the book has the generated file and the community lacks that part, so /meta lays it in. A file the community's own part masks shows nowhere, so it counts for neither Regenerate nor sharing: a book whose only generated file is masked offers Generate, unless the community has both parts (covered).

A whole-book summary alone isn't recaps, on either side. A community work with only a recap_summary keeps it, and generated recaps fill the list beside it (see generated content for how work.generated.recap_summary keeps the summary's credit). A generated recaps.json with only a summary counts as no recaps, so on its own it leaves the book on Generate.

The console decides from the estimate's has: generateAction calls generatedShown, which is has.local[d] && !has.community[d]. The player decides from the book's /meta work: generateOffer reads work.generated.characters with a non-empty characters list, or work.generated.recaps with a non-empty recaps list (a masked file never reaches /meta). The server pins the two readings together (TestGeneratedShownAgrees).

has.local keeps the masked files because other checks need them. The dialog's "This replaces the characters and recaps generated before" shows whenever has.local has characters or recaps, a masked file included, since a job rewrites that too (a recaps.json with only a summary shows no line), and Write a description reads them.

The console's covered line links to the book page's Characters and recaps card; the player's, shown only to an admin mayGenerate allows, opens the book page's Characters tab. The companion's empty Who's who and Story so far never show the line: an empty panel means the community lacks that half. In the player, a failed job also gives way to the covered line once the community has both (see Status and refresh).

The other guards (a job open, the Bridge offline, the four gates above) are unchanged. A chapters.detect or sidecars.contribute job queued or working still hides the console's action (not a share held while the contributions module is off, which a generate job cancels), while the player keeps its button and the confirmation holds back (see the book page).

Queueing it​

POST /admin/bridge/jobs with kind: "sidecars.generate", a library_id and a required book path (an indexed book; the job is about its own path). params, checked strictly (an unknown field is 400) and stored with the defaults filled in, so the Bridge reads one complete object:

FieldValuesDefaultMeaning
sourceauto, audio, ebookautowhat the run reads: auto takes the book's ebook when it has a readable one, else the audio
contributelocal, issuelocallocal keeps the results on this server; issue also offers them to the community as an intake issue
work_idtext, at most 200 bytes, no control charactersnonethe community work the results are for, when the caller knows it

The kind writes. So on top of the job model's checks, the server refuses:

  • any generate job with 409 library_not_writable, unless the last heartbeat reports the library mapped and writable;
  • a contribute: "issue" job with 409 cannot_contribute, unless the Bridge can contribute (Status.CanContribute(): the heartbeat's setup block, else estimates.sidecars.can_contribute; none counts as false).

Both checks come after the dedupe, so an open job of the book is returned (200) whatever they would say. A contribute: "issue" job also needs the contributions module. New requests get 404 module_off while the module is off. A Bridge claiming with share_off=1 can finish an existing job locally. See Jobs of a managed module.

A generate job is refused 409 contribute_open while a sidecars.contribute job is queued or working for the book. It cancels a parked one, or a queued one held while the module is off.

The player always sends {source: "auto", contribute: "local"}. Only the console offers contributing. Its dialog's switch shows while the module's flag is on and the estimate's can_contribute is true, and starts on issue.

A series batch is the client queueing each book on its own, in reading order, earliest first. Job ids ascend and the claim takes the oldest queued job, so the Bridge picks them up in that order. The console's series dialog asks each book's brief estimate first (four at a time) and leaves out the books that already have recaps (community, or a generated recap list: a summary-only recaps.json is none), those with an open job, and those it couldn't check; the book dialogs' Also generate for N earlier books first queues the estimate's earlier before the book itself.

The estimate​

The confirmation dialogs read GET /admin/bridge/estimate. The server costs the run from the figures in the Bridge's last heartbeat (bridge.EstimateSidecars):

  • source is ebook when the book has an ebook by the Bridge's own rule (library.BookEbook, mirroring the Bridge's epubBeside: exactly one regular, non-hidden .epub directly in a folder book's folder, or <stem>.epub beside a single-file book; the same rule names the book's ebook, the file the player's reader opens: A book's ebook). The server only finds the file; the Bridge also checks it can read it, and falls back to the audio when it can't.
  • asr_hours is the book's duration times asr_seconds_per_audio_hour, 0 for an ebook, without figures, or for audio of unknown length.
  • agent_cost_usd is the duration times agent_usd_per_audio_hour (audio) or agent_usd_per_ebook (ebook); null while the Bridge has no history for that source, which the dialogs show as "No estimate yet", never as free.
  • figures says whether the heartbeat carried estimates at all: without them agent_ready and subscription are defaults, so a false agent_ready means "not known yet".
  • has.community is what the book's community work carries (meta.Service.Coverages: the cached enrichment, else the console's bounded lookup), with has.community_unknown set when that couldn't be had right now; has.local is what its indexed attachments carry, a file the community masks included, and recaps only with a recap list (catalog.BookAttachmentParts).
  • earlier is the books of the same library before this one in its first numbered series (any spelling of it, catalog.EarlierInSeries), with no generated recap list (a summary-only recaps.json doesn't count) and, metadata on, no community recaps either (a book the community couldn't be asked about is left out, never offered on a guess): the nearest 10, among at most the nearest 30 checked, in reading order, each with its own asr_hours and agent_cost_usd from its audio.
  • open_job is the book's open sidecars.generate job, else the open job of another kind that refuses one now (Service.Blocker): a queued or working chapters.detect job or sidecars.contribute job (not a queued one held while the contributions module is off); omitted for neither.

brief=1 is the cheap answer for a label or a batch: the same shape without the look into the book's folder (source audio, no ebook) and without the series scan (earlier: []).

The Bridge's figures​

Once the engine starts, the heartbeat can include estimates.sidecars (PUT /bridge/status). The Bridge reads the transcription rate on every heartbeat. It refreshes the cached spend figures every 5 minutes or when a job finishes.

FieldWhere it comes from
asr_seconds_per_audio_hourthe decode seconds per hour of audio on the route the next segment would use (below), the same rate the job and queue ETAs use
agent_usd_per_audio_hourthe finished audio books' agent spend over their hours (a long book weighs more); null before the first
agent_usd_per_ebookthe finished ebook books' average spend; null before the first
samplesthe finished books the two spend figures come from
agent_backend, agent_ready, subscriptionthe agent container's state (runner.json): the CLI the Bridge runs, whether it is available (a fresh heartbeat, the CLI present with a credential the provider hasn't refused) and whether that credential is a subscription login
can_contributea GitHub token resolves and isn't refused (below); the setup block carries the same answer, which the server prefers
monthly_budget_usd, month_spent_usdagent.monthly_budget_usd, and this calendar month's (UTC) agent spend across every book

The scheduler keeps separate rates for local and worker decodes. Each starts at 900 seconds per audio hour. On the first transcription pass, a completed segment qualifies if it contains at least 60 seconds of audio and has a positive decode time. The first qualifying segment sets its route's rate. Each later sample updates the stored moving average as soon as the segment finishes.

The server validates the block on its own: a number below 0 or past its (far) bound, or a block that doesn't decode, drops the block, never the heartbeat (a refused heartbeat would take the Bridge offline). A key it doesn't know is ignored, so a newer Bridge can send more. Settings > Bridge shows the agent, Paid by, This month and Estimates from rows from the same block (GET /admin/bridge's estimates).

How the Bridge runs it​

The handler (generate.Handler) runs in the pipeline lane (25 jobs at once): the job only follows an engine book, and the engine's scheduler decides what actually runs, so a job sits in the lane as long as its book is queued, running or parked. One run:

  1. Waits for the engine (its first start may download ffmpeg), reporting waiting.
  2. Finds its engine book again, when the job is resumed: generate_books maps the server job id to the engine book, and is trusted only for the same library and book (another server, or a reinstalled one, hands out ids an older mapping still holds; that run is stopped and this job starts its own).
  3. Refuses an impossible contribution before any spend. contribute: issue on a Bridge with no GitHub token fails at once (Options.ContribCredential), worded for why. The cause is either not signed in ("...but the Bridge isn't signed in to GitHub: sign in on the Bridge's Accounts tab, or generate the book with contribute set to local"), or signed in but the sign-in couldn't be refreshed (contrib.ErrSignInUnrefreshed: "...but the Bridge's GitHub sign-in couldn't be refreshed (GitHub couldn't be reached, or didn't answer with a new token): generate the book again once GitHub answers, or with contribute set to local"). A resumed job is checked only when it has to start a new engine book after all, because that is a new spend. That happens when its id maps to another book's run, as in step 2, or its engine book is gone (deleted, or swept since it was cancelled).
  4. Prepares (prepare). It checks, in order:
    • the library is one the server listed, with a mapping check that found it mapped and writable at the mount the Bridge uses now. A new job fails otherwise; a resumed one parks library_not_writable and waits;
    • the book, read from GET /bridge/libraries/{id}/book?path= with its book facts. An unreachable server or a 5xx is waited out, backing off to a minute; a 4xx fails the job;
    • the book's files match the server's sizes through the mount;
    • the book's own folder takes a write probe. Otherwise the job parks book_not_writable and looks again every minute, or at once on Retry.
  5. Creates the engine book (create).
    • The source (chooseSource). audio is taken as asked. ebook needs a readable .epub, else the job fails. auto takes a readable one and falls back to the audio, logging why: several .epub files, or one whose OPF doesn't parse, as a DRM-wrapped one doesn't.
    • Regenerating from audio (fromKeptTranscript). A done whole run of the audio at this path, split by markers or files, with reusable transcripts gives a new engine book that starts at sanitizing, with its own agent passes, costs and contribution history. The earlier run goes in the same write.
    • Another earlier run. A chapters run (done, or cancelled at its transcription or detection) or a done read-along run not transcribed in windows, its transcripts kept and its audio unchanged (Other jobs, after the table) is continued, keeping its transcription. Any other engine book at the same source path is deleted first (deleteEarlier). The job fails instead if another open job follows that book (cancel that one first), or if a stage of it stays busy through up to 40 polls, about two minutes (giveWayTries, the same bound as the give-way wait; try again in a minute).
    • The new book takes its identity from the server's facts (title, authors, narrators, series and position, ASIN, ISBN), its work_id from the params or else the server's metadata cache, its kind (audio or ebook), and the job's contribute as its contrib_mode.
  6. Follows it (follow): every 3 seconds while a stage works, every 30 while it is queued, paused or parked (a Retry looks at once), turning the book into the job's progress and parks (below).
  7. Finishes: on done it writes the attachments (write rules), asks the server to read them (POST /bridge/rescan {mode: "attachments"}, up to three tries; the server's next scan reads them anyway), then runs the description step and, when that gave one, saves description.json beside them and asks again, and reports the result. An engine book that fails fails the job with the engine's error.

A book's later volume waits for the earlier one: the engine holds a series lock until a book reaches ready, so a sequel's agent stages run after its predecessor has been written and can carry its knowledge forward. A failed or cancelled book releases the lock.

When the book moves​

The server carries an open job with its book when a scan sees the book move, and its answers to the job's reports carry the new path. At its next look the Bridge follows it (adoptMove): it asks the server for the book there and checks its files through the mapped library, then records the move (recordMove, store.MoveGenerateBook), the job's rel_path and the engine book's source and ebook paths in one write. The results are saved at the new place. A lookup that may answer later (the server restarting) leaves the move pending; a move out of the library's folder parks book_not_writable.

When another engine book already holds the new path:

  • one whose run ended (done, failed or cancelled) that no other open job follows is cleared, as create clears an earlier run, and the move goes on;
  • a live one parks the job book_not_writable ("another of the Bridge's runs is at the new path") until that run ends or goes.

Progress​

Each look at the engine book becomes a PATCH with this progress object (the server stores it opaquely; at most 16 KiB):

FieldMeaning
stepalways set: the engine state (inspecting, asr, chapter_detecting, fact_pass, synthesizing, auditing, contributing...), or the job's own waiting (the engine book is queued, or the job waits on the engine, the server or the mapping), writing (writing into .audiosilo/), rescanning (asking the server to read them) and describing (the description step)
messagethe step in words ("Transcribing (12 of 40)"; "Needs attention: ..." while parked, "Paused: ..." while paused)
message_code, message_paramsthe code of a fixed sentence (starting, book_lookup, saving_sidecars, rescan_them, finished...) and its values; absent for an engine stage's label and the job's own park reasons (the library's name or an error in a sentence) (Job progress)
done, totalthe current stage's counts, when it has some
stagethe engine state
eta_secondsthe engine's whole-book estimate of the time left, when it has one (never while parked, paused or waiting for its ASR turn)
cost_usdthe agent spend so far: the budgets' basis (each run's provider-reported cost, else its complete API-price estimate), rounded to cents
sourceaudio or ebook
parkwhile parked only: code, hint (the Bridge's English advice), retry_at (RFC 3339) when the park resumes by itself, and message, the park's sentence for people: the job's error without the <code>: it may lead with, absent when only the code is left (jobs.withParkMessage). The Bridge's own page shows message, or the job's error without its code for a job parked by an older Bridge. That page never shows the code

The console and the player word the stages themselves (bridge.stage.* in both UIs; describing is "Writing the description", chapter_detecting "Finding the chapters in the narration") and show done/total, the time left and the cost. For a step without a stage label, the console's generate card shows the message as the job list words it (progressText).

States​

The job reports running while the engine works, needs_attention while the engine book is parked (progress.park set, error the park's message) and running again when it resumes (the server allows needs_attention -> running for the same claim; a park changing its code in place is reported as is). It ends done with the result, failed with the error text, or cancelled.

Cancelling (cancel_requested) cancels the job's context; a job that ends any way short of done stops its engine book (the scheduler's cancel), since nothing would follow it any more.

Parks​

A generate job retries a temporary book lookup with backoff. A successful HTTP answer it cannot use, such as a proxy HTML sign-in page, fails the job after two minutes of unusable responses and identifies the address to check.

The result’s share_skipped distinguishes contributions_off from no_share_job (no authorized job was following the book). Local files remain available.

The engine's own park codes (its state.ParkCode) plus two of the Bridge's (book_not_writable, library_not_writable). Each has a hint in the progress; "Retry" there is the Retry on the job on the Bridge's own page (POST /api/jobs/{id}/retry), which re-admits the engine book, or makes a job waiting on its own park look again now. A Retry that meets the book parked again or cancelled between its read and its write does nothing and answers 409 "the book changed meanwhile; try again" (ErrBookChanged).

A change on the page that answers a park resumes everything parked on it, engine books and description jobs alike. For the agent's parks:

  • a monthly budget saved on the Settings tab answers budget_exceeded;
  • an agent credential changed on the Accounts tab answers agent_credential_refused and agent_unavailable.

After a restart. A cap set in config.yaml or the environment is read at the next start. That start re-admits the budget_exceeded parks once: engine books through the scheduler's restartReadmitCodes, and a description job because the restart resumes it and it checks the caps before spending. The exception is an engine book's park that the caps would make again with the same reason, figures included (budgetParkHolds compares the text). That one stays paused.

So a changed cap, raised or lowered, re-admits the job even while it is still short of the spend. An unchanged cap re-admits a monthly park whose month's spend grew after it (a run already under way finished). A book still over a cap parks again before it spends anything. A raised cap needs no Retry.

The same start gives one more try each to the availability parks (agent_unavailable, agent_rate_limited, asr_unavailable, media_tools_unavailable), and to a supervisor_escalated park whose message names an authentication, rate or usage limit, credits or backend failure (restartRecoverablePark).

CodeMeansResumes by itself
agent_unavailablethe agent container isn't answering, has no CLI or no credential, or didn't claim the job within agent.claim_timeout_secondsyes, 10 minutes later when the container said why (retry_at), or at once when the agent's credential changes on the Accounts tab
agent_rate_limitedthe agent account hit its usage limityes, when it resets
agent_credential_refusedthe provider refused the CLI's credentialit looks again every 30 minutes, or at once when the agent's credential changes on the Accounts tab
budget_exceededthe monthly cap (retry_at the 1st of next month, UTC) or the per-book cap was reachedthe monthly one on the 1st, or at once on a Settings save that changes it; the per-book one, or a cap the environment sets, once it is changed and the Bridge restarted, with no Retry (with an unchanged cap it stays paused, or parks again before it spends anything; see above and The budgets)
agent_validation_exhausted, qa_no_converge, spelling_gate_failure, fix_loop_exhausted, asr_decode_timeout, markers_not_confident, ebook_chapters_not_confident, supervisor_escalated, supervisor_budgetan engine stage gave up after its bounded retriesthe supervisor's automatic actions (on by default, The engine wiring) retry them by themselves, except asr_decode_timeout, markers_not_confident and ebook_chapters_not_confident, while a job follows the book: at most 3 times for the same problem (supervisor.max_attempts) and 3 automatic recoveries a day per book. After that, or for those three: Retry
chapters_not_detecteda book with no chapter markers whose chapters couldn't be found in the narration with confidence (the message says why: no headings heard, a chapter too long, numbers missing). See Chapterless booksno: add chapter markers to the file, cancel and generate again
media_tools_unavailable, asr_unavailableffmpeg/ffprobe is missing, or the Bridge's own speech recognition failed to set upno: fix it, then Retry (the stage looks for ffmpeg/ffprobe again and sets the speech recognition up again); a fix in config.yaml or the environment, or the tools' download, needs a restart, and the Bridge's next start tries once more by itself
asr_worker_waitingno ASR worker is connected and the fallback is wait (or the Bridge has no speech recognition of its own)yes, as soon as a worker connects (or the fallback is local with a usable backend)
manifest_changedthe book's audio changed since it was transcribedno: cancel and generate again
ebook_unreadable, ebook_no_chaptersthe ebook can't be usedno: cancel and generate from the audio
contrib_unavailablecontributing has no GitHub token it can use: none resolves, GitHub refused it, or a signed-in token needed a refresh and GitHub couldn't be reached or didn't answer with a new token (same code, its own reason: pipeline.ContribUnrefreshedMsg)yes, on a sign-in on the Accounts tab (every book with this code, whatever its reason). The unrefreshed one also resumes by itself once a refresh works (see Parks)
share_unconfirmedThe Bridge cannot confirm permission to share with the server. It waits before community lookups or filing.It checks again in one minute.
core_neededcontributing needs a community core record the book doesn't haveno (the local files are already written)
core_pendingthe book's core record waits for the next data releaseyes
book_not_writablethe Bridge can't write in the book's folder or its .audiosilo/ (before the run, or when writing the results; the results wait in the engine's work folder), or can't follow the book to a new pathit checks again on its own (every minute for a write), or at once on Retry
library_not_writablea resumed job's library isn't mapped and writable any morewhen the next mapping check passes

The result​

On done (at most 64 KiB):

{
"library_id": 1,
"path": "Author/Book",
"source": "audio",
"files": ["characters.json", "recaps.json", "description.json", "bridge.json"],
"characters": 41,
"recaps": 38,
"cost_usd": 12.5,
"work_id": "the-way-of-kings",
"contributed": { "characters": "https://github.com/...", "recaps": "https://github.com/..." },
"intake_notes": { "characters": "This issue was filed outside the AudioSilo GitHub App. A maintainer needs to route it to intake manually." },
"description": true
}

files are the names written into .audiosilo/ (with the <stem>. prefix for a single-file book; chapters.json too for a book whose chapters were found in the narration), work_id the resolved community work (or the pipeline's placeholder slug), contributed only with contribute: issue, naming each dimension's intake issue, intake_notes (optional) the routing note of each issue a maintainer must send to intake. description says whether description.json was written; when it is false, description_error says why in a few plain words ("the agent account hit its usage limit", "the book has a single chapter, so no description leaves out its ending"...), which the console shows as "No description this time: ...". cost_usd includes the description step's spend, a try that failed its checks included. An older Bridge sends neither field.

Notifications​

The server announces the jobs (not a Bridge route): bridge.Service's OnTransition hook fires once a move into a state an admin hears about has committed, whatever made it (the Bridge's PATCH, or a lease that ran out on the last attempt, which fails the job), and notify.BridgeJobEnded records it:

  • into done: bridge_job_finished (Characters and recaps ready: <title>; for a sidecars.describe job Description ready: <title>, "Listeners see it in the player's About when the book has no other description."; for a chapters.detect job Chapters found: <title>, "Listeners see them in the player now." only when the book's chapters_source is generated once the attachments rescan has run, else that they were saved but the book uses other chapters);
  • into failed, or into needs_attention with a park that isn't transient: bridge_job_failed, with the park code. agent_rate_limited, agent_unavailable and asr_worker_waiting are never announced, whatever their retry_at; a park that changes its code in place is announced when the new code isn't transient. A failed job's title names its kind (Characters and recaps failed: <title>, Description failed: <title>, Chapters failed: <title>).

A repeated park on the same claim is announced again only after six hours, a changed park code, or a change between a timed wait and a wait for a person. A new claim can announce the park again. The server never announces share_unconfirmed. See Notifications.

The description step​

The description step writes a book's own-words, spoiler-free description: the paragraph a stranger reads before deciding to listen. The agent writes it, and the Bridge saves it as description.json. It is local only. meta-community takes descriptions by pull request, so a contribute: issue run never files one. The Bridge's code is pipeline.Executor.Describe (internal/pipeline/describe_stage.go, its prompt internal/agent/prompts/description.md) and describeOnce (internal/generate/describejob.go).

What the agent sees: the spoiler bound​

The bound is the staging, by construction: the agent's folder holds opening.md and an empty out/, nothing else. No transcript, no ebook text, no knowledge-final.md (the whole-book knowledge sheet carries the ending), no later chapter's notes, no publisher copy; the prompt also forbids the web and the agent's own memory of the book. opening.md is copied mechanically from the fact pass's own chunks (chunk_plan.json): the ## Chapter N sections of the chosen files, their file numbering kept.

The chosen files are the book's opening: those whose logical position is 0 (front matter) or among its first K story positions, where

  • n is the number of distinct story positions the files hold (capped at the classifier's chapter count, so one misheard late announcement can't widen the window, and a sequel numbered on from 45 still has an opening);
  • K = max(2, ceil(n / 4)), capped at n - 1: a quarter of the book, two chapters at least, and never the last chapter (its ending). A book of two chapters gets its first only; a book of one gets no description (the step answers "the book has a single chapter").

Excluded edge files (an Audible intro, the closing credits) and end matter never count. The positions are classified the way the sidecar stages did, so K counts the same logical chapters the recaps use. That classification reads the transcripts, which the retention deletes, so each one is kept beside the notes as chapter_positions.json (keyed by the manifest it was made from); a book whose transcripts are gone uses it, else its file numbers (a file's number is never below its story chapter, so that bound is only less generous, never unsafe).

The checks​

The answer is out/description.json, exactly {"text": "..."}. Before it is kept, every one of these must pass; a failure goes back to the agent as feedback for another try:

  • the text, trimmed, is 200 to 1500 code points, at most two paragraphs, with no control character (nor U+2028/U+2029) but a newline, and no em dash;
  • a neutral reference-guide voice: no second person, no sentence ending in a question mark, no sales words ("gripping", "must-read", "unforgettable"...), the book's own title and series exempt (a book may be called Me Before You);
  • the composed model.Description (the run's work and sources from its characters.json, licence CC-BY-SA-4.0) passes meta's description.schema.json;
  • the no-verbatim check: an 8-word run shared with the book's source text (audiosilo-meta's extract.NGram, the shingle the sidecars use) fails. It measures against whatever text is still there: the transcripts (their text and corrected layers) for an audio book, the ebook's chapter text for an ebook. With none left it is skipped and recorded as such; a local fault of the check itself (the disk, an unreadable transcript) fails the step rather than paying for an agent retry.

What it measured is recorded as checked_against (transcripts, book text or none) in bridge.json's description object. A run whose own work and sources can't make a valid description fails before any spend; validation exhausted means no description.

When it runs in a generate job​

An ebook's text is deleted as its book reaches done (a licensing rule), so the step runs where the text is still there:

  1. At the start of the engine's contributing stage (which every book passes through to resolve its community work, contributing or not): best effort and once per book (a book with any description run, passed or failed, is never paid for again, since a contributing park runs the stage again), only for a book an open sidecars.generate job follows, without waiting out a rate limit, any error only logged.
  2. At the job's finish (the engine book done, or parked at contributing), after the characters and recaps are saved: the job's pass reuses the description already in the engine's work folder, re-composed with the work and sources the contributing stage resolved, nothing spent, its checked_against kept. With none, it tries once itself (and once more at done when it first asked at a contributing park, so the description never ships naming another work than the characters do), unless the book's latest description run failed after spending: a run never pays twice.

The step never fails, parks or holds the job: no rate-limit wait, an engine that keeps the book for more than a few polls is given up on, and any error leaves the job to finish with its characters and recaps, its result saying description: false and why. A description it got follows in a second save.

The step is not an engine stage. It records its own describing stage run on the engine book (so its spend counts in the per-book and monthly budgets, the monthly sum and the estimates, and both budgets are checked before any spend), runs under the scheduler's hold on the book (no stage, delete, purge or sweep acts on it meanwhile), and uses the agent model agent.claude routes as describing (sonnet by default). The kept file is the engine's sidecars/description.json, which the transcript purge keeps.

A description on its own: sidecars.describe​

sidecars.describe writes a description for a book the Bridge generated earlier, from the notes it kept, with no new speech recognition. Its family is sidecars, so it shares the same bridge.features entry. The notes outlive the transcripts: the retention deletes the transcript text but keeps the fact notes, the chapter positions and the sidecars. The player has no such action; the console offers it.

Queueing: POST /admin/bridge/jobs with kind: "sidecars.describe", a library_id, a required book path and params {} or none (any field is 400; stored as {}). It writes, so 409 library_not_writable as for a generate job, and a Bridge that doesn't advertise it (an older Bridge) is 409 kind_unavailable. It is refused with 409 generate_open while a sidecars.generate job is open for the book (that run writes the description itself); a second press returns the open describe job (its own dedupe key). The other way round, a generate job queued while a describe job is open cancels that job in the same transaction (at once when it is queued or parked, else by cancel_requested, its error "a generate job for the book replaced it"), since the generate run writes the description from fresher notes. See Kinds are allow-listed twice.

The console (admin-ui/src/features/bridge/describe-section.tsx). The book page's Community card has a Description part. It shows a generated description (from the admin book detail's generated_description) with the "Generated on this server" mark and its time, clamped behind Show more. It says when listeners see another description in the player instead (the book's own, or the community's).

Write a description confirms, then queues the job (describeOffered). It is offered only when all of these hold:

  • the estimate says can_describe and writable;
  • the book has generated characters or recaps, whose notes are the source;
  • there is no description from either side (has.local.description, has.community.description, with community_unknown unset), and the book has no description of its own;
  • no generate or describe job is open (the estimate's open_job included).

The describe job's status shows in the same part.

The Bridge (DescribeJob, the pipeline lane) prepares as a generate job does (strict when new; a resumed job parks library_not_writable). Then it finds the engine book whose notes describe the book, the first of:

  • the latest engine book at its source path;
  • the latest generate job's book at its library path (a book that moved while that job ran);
  • the run the book's own bridge.json names (a book that moved after).

A run found through bridge.json (namedRun) moves to the book's place: its source path and the job's mapping, so a later regenerate finds its kept transcript there. One an open job still follows is left to that job's own move.

It runs the description step until it writes one. The agent's parks (rate limit, budget, credential, unavailable) are the job's park (needs_attention, with code, hint and retry_at). A rate limit parks at once, never waited out while the job holds the book, so the book is free for other jobs while it waits. After a park, each try first checks again what the start checked (recheckNotes): the library mapping, a move, the book's folder writable, and its notes still there with no other job making them again. The job tries again at retry_at, on Retry, or at once when a change on the page answers it (Parks). Handler.WakeParked does this, because these jobs wait in their own loop, not as engine books, so the engine's re-admit doesn't reach them. Each wake is numbered, so a try that parks on a code woken while it ran tries again at once instead of losing the wake.

A parked job is still running on the Bridge, so a restart resumes it and it tries again at once. A cap raised in config.yaml or the environment needs only the restart. Then the job saves description.json and bridge.json (how) and asks for the attachments rescan. It fails, with a sentence the console shows as it is, when:

FailureMessage
no engine book (never generated here, or removed)The Bridge has no notes for this book (it was not generated here, or they were removed). Generate characters and recaps again to get a description.
a generate run still works on itA generate job is still running for this book; it writes the description when it finishes.
a single-chapter bookThis book has a single chapter, so no description could leave out its ending.
validation exhaustedCouldn't write a description that passed the checks.
the engine keeps the bookThe engine is busy with this book; try again in a minute.

Its progress is {step: describing | writing | rescanning | done, message, message_code, done, total, stage: "describing", source, cost_usd, park?}, and its result:

{
"library_id": 1,
"path": "Author/Book",
"description": true,
"files": ["description.json", "bridge.json"],
"cost_usd": 0.18,
"checked_against": "none"
}

description is always true (the console's shared result parser reads it). An audio book past its transcript retention, or an ebook (its text went at done), is checked against nothing: checked_against: "none".

Resuming after a restart​

The job model's rules hold: a running job is resumed under its claim, and a lapsed claim is taken again as the next attempt (see Resuming after a restart). On top of those:

  • The engine book survives: generate_books (store migration 0003) maps the job to it, so a resumed job follows the same book rather than starting over. A book this job's own cancel had stopped (the server took the job back, then handed it out again) is re-admitted, unless its transcripts were swept meanwhile, in which case it starts over.
  • Round limits survive a crash. On startup, Scheduler.Reconcile checks each open stage run. If the book is still at that stage and the stage wrote its completion sentinel before the crash, the scheduler records the run as successful. A completed paid round counts toward its cap, and the book can resume from the sentinel. Otherwise the scheduler closes the open run as interrupted.
  • The server's identity: server_jobs.server_id records which server handed each job out (the pairing's server_id); an open row of another server is treated as lost, never reported to the wrong one.
  • A job ended without running (its first report after a restart answered with a cancel or a lost claim) releases its engine book (Abandon), as the end of a run would.
  • Moves: a resumed job finding its engine book again (attach) records a move it missed (the book's path in the claim against the mapping and the engine book's source) as a running job does (When the book moves), parking until it can.

Contributing​

With contribute: local, the job's own write into the book's .audiosilo/ is the only copy: the pipeline's export folder (Config.ExportRoot) is unset on the Bridge.

With contribute: issue, the engine's contributing stage files the community intake issues, as audiosilo-sidecars did. It uses the token contrib.TokenSource resolves: AUDIOSILO_BRIDGE_GITHUB_TOKEN, else the Accounts tab's GitHub sign-in, else gh (see Configuration).

The local files are written before that stage can park. A book parked at contributing (core_needed, contrib_unavailable, say) already has its .audiosilo/ files, and the job writes them again only when the engine's sidecars change.

A sign-in on the Accounts tab re-admits every book parked contrib_unavailable, whatever its reason. A book parked because a signed-in token couldn't be refreshed needs no sign-in, because the Bridge is still signed in. The Bridge tries the refresh again at most once a minute (accounts.refreshRetry; the heartbeat and the page ask for the token), and the first refresh that works re-admits the books parked on it at once. The park also carries a retry_at 10 minutes out (contrib.UnrefreshedRetry), so a token that resolves another way meanwhile (the environment's, gh's) is picked up too (Parks).

accounts.ErrUnrefreshed covers GitHub not being reached (ghauth.Unreachable: no answer, or one cut short) and GitHub answering with something other than a token (a server error, a rate limit, a page that isn't JSON); its reason, and the checklist's github detail, say which. GitHub answering that the refresh token is spent or revoked (ghauth.ErrBadRefresh) refuses the sign-in instead (accounts.ErrRefused), which only a new sign-in ends.

can_contribute in the heartbeat means "a token resolves and isn't refused". With the Contributions module on, that is all the server checks of the Bridge's GitHub access before it queues such a job. An issue filed with the App's user token skips the labels check (AppFiled). GitHub drops the labels a non-collaborator sets, and the community repository's route.yml (audiosilo-meta-community) labels it.

Contributing later, after a run kept local, is its own kind, sidecars.contribute: see Contributions.

The budgets​

Every agent run is preflighted against two caps (pipeline.Executor):

  • agent.book_budget_usd (default 75): one book's spend; past it the book parks budget_exceeded until the cap is raised (in config.yaml or the environment) and the Bridge restarted, with no Retry (Parks says what that start re-admits).
  • agent.monthly_budget_usd (default 100, 0 = none): this calendar month's (UTC) spend across every book, superseded runs included, and the spend of engine books a regenerate deleted (kept in deleted_stage_spend), so regenerating doesn't reset the month. Past it the book parks budget_exceeded with retry_at the first of the next month. The page's Settings tab edits it (locked when AUDIOSILO_BRIDGE_AGENT_MONTHLY_BUDGET_USD sets it) and it applies at once: a save that changes it resumes what is parked budget_exceeded, one still over it parking again (Parks), so nothing needs Retry. A cap the environment sets is read at the next start, as the per-book one is.

With a subscription credential the costs are notional (what the same tokens would cost on an API key), so the caps still bound the usage.

Transcript retention​

Decision 5: a book's transcripts are kept privately in the Bridge's data folder (the engine's work folder, <data>/work) for transcripts.retention_days (default 30) after its job ends, never in the library and never contributed. generate_books.ended_at records the end; a daily sweep (Handler.SweepTranscripts) purges every finished engine book whose job ended at least that long ago and records swept_at, so it never looks at it again. With 0 a book's transcripts go as its job ends.

Reuse within retention (fromKeptTranscript, pipeline.KeptTranscription). A generate job reading the audio starts a new engine book at sanitizing from a done whole run's chapter transcripts, and a chapters job starts one at chapter_detecting from a done read-along's window transcripts. The new run is reused only when all of these hold, else the earlier run is cleared and the job starts from scratch (audio the Bridge can't look at right now, or an earlier run that stays busy, fails the job instead, to be tried again):

  • retention is on and the earlier job ended within it, checked at the job's start, not only by the sweep;
  • the audio is unchanged (pipeline.AudioCurrent) and the manifest matches the fingerprint asr.json recorded, when it recorded one;
  • the ASR record is eligible for reuse, and its configured model and language match the current settings wherever both values are known;
  • every chapter's or window's raw transcript is there and complete.

The other shortcuts (a read-along going on from an earlier run, a generate job continuing a chapters or read-along run, a chapters job writing an earlier run's detected chapters) don't compare the ASR settings.

The purge (scratch.PurgeTranscripts) deletes the reclaimable scratch (the split chapter audio, the agents' staged inputs, the re-transcription clips, an ebook's extracted text), every transcripts-* layer, the corrected transcript copies a sequel carried from its predecessor, and the root files that quote the transcript (the spelling candidates and reference matches, the QA reports, plan and accepted ledger, the tail verdicts, the correction and repair logs). It keeps what a sequel builds on (the facts in knowledge-final.md, the spelling ledger and rules, the series glossary), the fact notes a sidecars.describe reads, the description step's chapter_positions.json, the manifest and the sidecars (description.json included). It also removes windows/ (a chapterless book's window transcripts and detection) and keeps chapters_detected.json (titles only, which chapters.detect reuses). For alignment files, see read-along scratch and transcript retention.

Each purge takes the engine's hold on the book. The daily sweep leaves a held book (a description being written) for its next run.

The engine wiring​

internal/app/engine.go builds the engine the way the archived audiosilo-sidecars daemon did, minus its folder scan, and starts it in the background once the Bridge runs:

  • the event hub with its durable persister (events kept 30 days);
  • the media tools (toolfetch) and the ASR backend (asr.Select; a backend that can't be used leaves the engine running, and an asr stage parks asr_unavailable);
  • only the agent container's runner (agentbox): the Bridge never runs an agent CLI itself, and the engine's local claude/codex runners stay as code for their output parsers and tests. The engine's agent concurrency follows the container's slots from runner.json;
  • the pipeline executor (with both budgets), the scheduler and the supervisor's deterministic lane only: config normalization forces supervisor.model_assisted, supervisor.model_automatic_actions and the backend failover off, whatever the file says, and supervisor.automatic_actions defaults on (its bounded recoveries, each capped per book per day, are the point when nobody watches the engine), acting only on a book a job still follows;
  • the contribution poller, and the two daily sweeps (events, transcripts).

The sidecars.generate handler waits for it, so jobs claimed during the first start just report waiting.