Skip to content

feat(daemon): replace run ingest with observable convergence (#845) - #847

Merged
Sinity merged 58 commits into
masterfrom
feature/refactor/daemon-convergence-replaces-run
May 6, 2026
Merged

Sinity merged 58 commits into
masterfrom
feature/refactor/daemon-convergence-replaces-run

Conversation

@Sinity

@Sinity Sinity commented May 6, 2026

Copy link
Copy Markdown
Owner

Summary

Ref #845. This is a large daemon-first convergence slice: live ingestion now runs through observable daemon convergence batches, durable live cursor state records failures and interrupted work, append-only JSONL changes read tails instead of whole files, the old polylogue run batch pipeline is removed, static archive publication/site generation is removed, and the archive write gateway is wired into the real ingest commit boundary.

Problem

The previous public batch model hid daemon convergence behavior behind duplicate pipeline paths. It also made performance and restart behavior hard to verify: a daemon kill during a large import could leave the operator unable to tell which source group had converged, whether work was safe to resume, or whether a workload was doing whole-file / whole-archive work. Issue #845 asks for a daemon-owned ingest architecture with concrete observability and performance evidence, not another provider-event or storage-schema detour.

Solution

  • Replace the old public polylogue run handling with daemon-owned ingest paths. The run command, run helpers, observer scaffolding, run-state storage queries, run-specific tests, mutation entries, and user-facing docs are deleted rather than deprecated.
  • Remove static archive publication/site generation from the runtime surface. The remaining pages tooling is devtools-only documentation rendering; archive reading belongs to daemon/web surfaces.
  • Add LiveBatchProcessor as the in-process daemon live batch executor used by the watcher and benchmark harness. It records queue/backlog, payload read bytes, append/full-file counts, failing files, stage timings, RSS/current file heartbeat state, and cursor retry state.
  • Make live cursor failures durable and status-visible, including first-time failures, excluded files, failure backoff, and daemon-abandoned running attempts on restart.
  • Make convergence resumable at group boundaries: append and full-file groups run convergence and advance cursors only after that group converges, so a killed daemon retries uncommitted groups instead of skipping them.
  • Add daemon-live synthetic benchmark coverage using the proper synthetic corpus generator. The campaign performs initial ingest plus append workloads and reports semantic axes for files, source bytes, append bytes, payload reads, archive writes, row counts, and stage timings.
  • Add append/tail JSONL ingestion for live sources. Grown Claude Code / Codex-style JSONL files read completed tails from the cursor offset and write appended records without replacing prior conversation rows.
  • Reconcile ArchiveWriteGateway as the real local ingest commit/effects authority instead of a dead daemon-RPC-shaped wrapper.
  • Tighten hot paths found during bounded profiling: sample JSONL before raw storage, avoid duplicate live work, parallelize many-file batches, suppress duplicate skip logs, trim duplicate Codex ingest tuples, and avoid repeated timestamp parsing in Codex materialization.

Acceptance Matrix

Satisfied in this PR:

  • Durable live cursor ownership/failure visibility uses the archive DB path and is surfaced through daemon status.
  • Daemon convergence exposes backlog, retry/failure state, read/write byte shape, row counts, stage timings, heartbeat state, and live file progress.
  • polylogue run and its batch-handling surface are removed outright; ingestion is daemon-owned.
  • Static archive publication/site generation is removed from the archive runtime surface.
  • Append-only live JSONL convergence reads tails rather than unchanged prefixes and preserves prior archived messages.
  • Daemon convergence is resumable across kills at group boundaries; prior running attempts become durable interrupted cursor rows on restart.
  • Archive writes go through the real gateway boundary used by sync ingest commits.
  • Synthetic benchmark evidence can exercise daemon convergence without running the daemon process.

Still open / intentionally not claimed:

  • The largest single-session files still need deeper streaming materialization/write work to reduce high RSS and minute-scale per-file stalls.
  • Provider-event volume is measured but not redesigned here; refactor(daemon): replace polylogue run with performant convergence #845 explicitly should not collapse into unrelated provider-events schema work.
  • A final real production-corpus convergence run was not restarted after the interrupted run, per operator guidance to avoid another full run before further optimization.
  • Broader provider-specific append guarantees should be expanded beyond the Claude Code / Codex-shaped JSONL paths covered here.

Verification

  • devtools verify
    • Result: verify: all checks passed
  • devtools run-benchmark-campaigns --campaign daemon-live-convergence --scale small --output .local/benchmarks/daemon-live-small-after-optimizations.json
    • Result: report written at .local/benchmarks/daemon-live-small-after-optimizations.json/2026-05-06-small.json
    • Key shape: failed_files=0, succeeded_files=20, total_wall_s=0.484541, append_payload_read_bytes=6586, append_input_bytes=89778
  • Bounded Codex ingest profile on a 313 MB JSONL sample after tuple/timestamp optimization:
    • Before tuple dedupe: elapsed_s=34.962
    • After tuple dedupe + timestamp fast path: elapsed_s=25.672
    • Stored row counts stayed stable: messages=34725, content_blocks=34742, action_events=28049

Production Run Evidence

A real-data daemon convergence attempt reached 91.05% of observed source bytes in 100.69 minutes before termination. At interruption the DB contained raw_conversations=10165, conversations=7326, messages=3462031, content_blocks=2440067, and action_events=1435397. That interruption exposed the resumability/observability gap fixed here: cursor progress is now advanced only after converged groups and interrupted running cursor rows are made durable on daemon restart.

Sinity added 30 commits May 6, 2026 05:07
Problem: #845 needs daemon-first convergence to be observable enough to spot batch regressions, retry backlog, and expensive read/write behavior instead of relying on opaque watcher logs.

What changed: live watcher batches now emit ingestion_batch telemetry with queue counts, byte deltas, parse/convergence timings, and stage timings. Daemon status now exposes typed live cursor retry/backoff/exclusion state in JSON and plain output.

Verification: ruff check polylogue/sources/live/watcher.py polylogue/daemon/status.py tests/unit/sources/test_live_watcher.py tests/unit/daemon/test_daemon_status.py; nix develop -c mypy polylogue/sources/live/watcher.py polylogue/daemon/status.py tests/unit/sources/test_live_watcher.py tests/unit/daemon/test_daemon_status.py; nix develop -c pytest tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_cursor_adversary.py tests/benchmarks/test_daemon_convergence.py -q
Problem: #845 calls for one honest daemon convergence model, but polylogued still wired an ingest convergence stage that could call parse_file() per source after the live watcher had already used the batched parse_sources() path.

What changed: daemon runtime convergence now contains only post-ingest repair/freshness stages. The obsolete acquire and ingest stage factories were removed, and the convergence benchmark now drives LiveWatcher._ingest_files() and asserts the synthetic corpus is submitted as one batched parse_sources() call.

Verification: ruff check polylogue/daemon/cli.py polylogue/daemon/convergence_stages.py tests/benchmarks/test_daemon_convergence.py; nix develop -c mypy polylogue/daemon/cli.py polylogue/daemon/convergence_stages.py tests/benchmarks/test_daemon_convergence.py; nix develop -c pytest tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_cursor_adversary.py tests/benchmarks/test_daemon_convergence.py -q
Problem: #845 needs daemon-first ingestion to be observable and performance-verifiable without starting the long-running daemon. The live watcher still owned useful batch metrics internally, and benchmark campaigns could not exercise the daemon convergence path over generated live source workloads.

What changed: extract reusable live batch processing from the watcher, return structured read/write/timing metrics, run daemon convergence stages against the configured archive DB, and add a synthetic daemon-live-convergence benchmark campaign with file/source-byte/archive-row shape stats. The campaign is registered in the quality catalog and semantic-axis evidence can now compare file and byte axes.

Verification: ruff check on touched daemon/live/devtools/test files; mypy on touched daemon/live/devtools/test files; pytest -q tests/unit/daemon/test_convergence_stages.py tests/unit/devtools/test_benchmark_campaigns.py tests/unit/devtools/test_quality_registry.py tests/unit/sources/test_live_watcher.py tests/benchmarks/test_daemon_convergence.py (52 passed); devtools run-benchmark-campaigns --scale small --campaign daemon-live-convergence --output .local/benchmark-campaigns/daemon-live-check-fixed2; devtools render-all --check.

Ref #845
Problem: #845 makes ingestion daemon-owned. Keeping the old root polylogue run command, run-only helper stack, showcase baselines, mutation campaign, and docs around preserved the public batch model even after the command had stopped being part of the root command list.

What changed: delete the root run command implementation and run-specific helper modules, remove direct run command tests and baselines, update CLI/query/docs/help hints to point at polylogued run or polylogue ingest, and refresh quality/topology/proof generated surfaces. The artifact graph now reports render-conversations as uncovered instead of pretending the deleted run-stage exercises still cover it.

Verification: rg found no stale polylogue run/run-stage references outside unrelated words; ruff check on touched Python files; mypy on touched Python/test files; pytest -q tests/unit/cli/test_click_app.py tests/unit/cli/test_cli_error_boundaries.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_embed.py tests/unit/cli/test_query_exec.py tests/unit/cli/test_terminal_snapshots.py tests/unit/core/test_maintenance_targets.py tests/unit/devtools/test_artifact_graph.py tests/unit/devtools/test_mutation_catalog.py tests/unit/devtools/test_render_cli_reference.py tests/unit/proof/test_diffing_runtime.py tests/unit/showcase/test_exercise_catalog.py tests/unit/showcase/test_vhs_generation.py tests/unit/storage/test_fts5.py (370 passed); devtools render-all --check.

Ref #845
Problem: removing the public run surface intentionally leaves the conversation-render runtime path uncovered until a daemon-owned rendering path is wired, and the topology projection still treated blob_gc.py as an unresolved storage cell.

What changed: the scenario coverage witness now records the explicit render-conversations gap, and the topology generator keeps blob_gc.py as a storage-root helper so generated topology artifacts have no TBD cells.

Verification: ruff format --check and ruff check on the edited Python files passed; pytest -q tests/unit/devtools/test_scenario_coverage.py tests/unit/devtools/test_topology_projection_witness.py reported 6 passed; devtools render-all --check passed.
Problem: daemon live convergence could observe that a JSONL file grew, but the ingest path still treated growth as a whole-file parse/write. That made append-sized changes indistinguishable from full-source work in both runtime behavior and benchmark evidence.

What changed: live batches now use cursor offsets to plan completed JSONL tails, persist append raw records, and write parsed tail records with append semantics that preserve existing messages. Batch metrics and the synthetic daemon-live benchmark now separate full source bytes from appended payload bytes.

Verification: ruff check and mypy passed for the touched daemon/live/ingest files and tests. Pytest reported 52 passed for live watcher, daemon convergence benchmark, the append write test, and benchmark campaign tests. devtools run-benchmark-campaigns --scale small --campaign daemon-live-convergence --output .local/benchmark-campaigns/daemon-live-append-check-2 completed and reported append_payload_read_bytes=2250 vs append_input_bytes=24805.
Problem: ArchiveWriteGateway claimed to be the canonical write path but was not exercised by the production ingest writer, and it still carried an unimplemented daemon RPC fallback that made the contract look broader than the code.

What changed: the gateway is now scoped to the real commit/effects boundary and exposes sync/async commit methods. Sync ingest commits route through it, while package-level ingest worker/process-pool exports remain monkeypatchable for existing focused tests.

Verification: ruff check and mypy passed for write gateway and ingest-batch files. Pytest reported 4 passed for the write-gateway tests and the ingest-batch monkeypatch/side-effect tests; the combined append/gateway focused suite reported 56 passed. devtools render-all --check passed.
Delete the old static archive site and publication pipeline so daemon web remains the only web UI surface. The run pipeline no longer plans or executes render/site stages, publication records are removed from the SQLite/runtime contracts, and search/open results now point at daemon web URLs.

Move GitHub Pages documentation generation into devtools so documentation publishing is not modeled as product archive publication. Refresh generated docs, proof catalogs, topology, showcase baselines, and snapshots for the deleted surface.

Ref #845
Keep ingest_record and process_pool_executor as module-level dependencies in the sync ingest-batch core. Existing focused tests and monkeypatch-based fault probes depend on patching that module directly, and the rebase temporarily routed through the package export instead.

Ref #845
Direct append ingestion now proves the existing archive identity before parsing tails. Claude Code tails must match the stored session identity, while Codex tails that omit session_meta are parsed with a synthetic session_meta for the archived provider conversation id.

Add public archive read tests that ingest an initial JSONL session, append one record, and assert the stored conversation contains N+M messages without creating fallback-session conversations.

Ref #845
Append-mode ingest writes now expose the provider-event count keys expected by the batch summary recorder and insert appended provider events with insert-or-ignore semantics. The medium daemon-live benchmark exposed this as append write failures after the provider-events schema merged into master.

Verification: pytest -q tests/unit/sources/test_live_watcher.py tests/unit/pipeline/test_ingest_batch.py tests/benchmarks/test_daemon_convergence.py tests/unit/devtools/test_benchmark_campaigns.py

Synthetic benchmark: devtools run-benchmark-campaigns --scale medium --campaign daemon-live-convergence --output .local/benchmark-campaigns/daemon-live-medium-845-fixed reported failed_files=0 and append_payload_read_bytes=9280 vs append_input_bytes=237880.

Ref #845
Route live batch metric emission through a daemon-supplied callback instead of importing daemon event code from the live source layer. This keeps daemon observability wired while satisfying the package layering contract after the rebase.

Refresh mutation campaign coverage references after the public run/static publication removal so manifest verification no longer names deleted render-service tests.
Let non-machine Click exceptions keep Click's normal failure path instead of wrapping them as unexpected runtime errors.

Refresh CLI and MCP unit expectations against the current command and FastMCP error contracts so the broad suite no longer fails on stale mocks.
Problem: root polylogue run was removed for #845, but the old batch-run substrate still existed behind tests, devtools probes, run JSON artifacts, observer hooks, and the runs table.

What changed: delete the runner/execution/finalization/planning/observer modules and their tests, move reusable source/stage selection helpers to ingest_support, route showcase and pipeline probes through Polylogue.parse_sources or direct ingest services, and remove durable run ledger storage. Schema v8 drops the runs table.

Verification: ruff check on touched files passed; mypy --strict on touched files passed; pytest focused slice passed with 166 passed; devtools render-all --check passed; devtools verify-topology, verify-test-ownership, and verify-migrations passed.
Problem: the append-tail path had focused byte-shape and single-record coverage, but the public archive read proof did not make the N+M merge contract explicit.

What changed: extend the live append integration test to ingest three Claude Code messages, append two completed tail records, and assert the public archive read returns all five messages in order while tail metrics stay append-only.

Verification: ruff check tests/unit/sources/test_live_watcher.py passed; mypy --strict tests/unit/sources/test_live_watcher.py passed; pytest -q tests/unit/sources/test_live_watcher.py::test_live_append_merges_tail_visible_through_public_archive_read tests/unit/sources/test_live_watcher.py::test_codex_append_uses_existing_session_identity_when_tail_lacks_session_meta passed with 2 passed.
Ref #845

Replace the daemon-live benchmark's hand-written Claude Code JSONL with the shared synthetic corpus generator, make the campaign runnable without generating an unrelated seed archive, and keep reruns deterministic by clearing stale generated JSONL.

Use acquired raw blob hashes plus tail-only newline scans for full-ingest cursor state, so large files do not get read a second time just to update live cursors. Live catch-up now recursively mirrors live watch discovery, and scoped source names such as codex:24 canonicalize back to provider truth for raw acquisition rows.

Provider detection now cheaply rejects non-Codex shapes before Pydantic validation and trims intentionally truncated JSONL detection prefixes, removing noisy false parser logs from benchmark prefix probes.

Verification: ruff check and mypy --strict on touched files passed; pytest focused behavior suite passed with 21 tests; pytest tests/unit/sources/test_live_watcher.py tests/unit/devtools/test_benchmark_campaigns.py passed with 52 tests; devtools render-all --check passed. Synthetic daemon-live medium/large/stretch campaigns completed; stretch reported append_payload_read_bytes=110531 vs append_input_bytes=10573408. Real side-DB smoke over 10 largest local Claude/Codex JSONL files ingested 4.74 GB and 291429 messages in 519.378s, with cursor_fingerprint_read_bytes capped at 65536 bytes per large file; follow-up Codex-only smoke verified raw and conversation provider rows store as codex.
Daemon convergence now accepts a changed source batch so global stages can collapse repeated per-file checks into one transaction. The insights stage resolves affected source paths to conversation ids and refreshes only those profiles, thread roots, and provider-day aggregates instead of rebuilding archive-wide read models on every live batch.

Small live JSONL batches also avoid process-pool startup overhead, and the Claude Code parser reads record dictionaries directly in its hot loop while preserving the parsed conversation boundary.

Ref #845
The batch insights check runs against the lightweight SQLite connection profile, which returns tuple rows rather than sqlite3.Row mappings. Resolve source-path and missing-profile rows positionally so the daemon does not silently skip targeted insight refresh during live convergence.

Ref #845
Codex live-ingest hot paths process large JSONL streams record by record. The previous parser allocated a Pydantic CodexRecord for every record, including tens of thousands of message and provider-event rows in large sessions.

Parse the hot stream directly from raw JSON dictionaries while keeping the typed ParsedConversation boundary and preserving CodexRecord for model contracts and detection. This removes per-record model validation from daemon ingestion without changing parser output semantics.

Focused verification:
- ruff check polylogue/sources/parsers/codex.py
- mypy --strict polylogue/sources/parsers/codex.py
- pytest -q tests/unit/sources/test_parsers_codex.py tests/unit/sources/test_parsers_base.py tests/unit/sources/test_source_laws.py -k 'codex or Codex'

Real parser-only timing on a 313,852,416 byte Codex JSONL session: 62,749 messages and 84,262 provider events parsed in 4.972s.
Large live-ingest streams usually produce parsed messages with canonical text and content blocks but no provider_meta. The materializer still called the unified provider harmonizer for every such message, which adds avoidable per-message overhead on large Codex sessions.

Return the message directly when provider_meta is absent. The harmonizer only enriches from provider metadata, so this preserves output semantics while avoiding tens of thousands of no-op calls per session.

Focused verification:
- ruff check polylogue/pipeline/prepare_transform_content.py tests/unit/pipeline/test_materialization_runtime.py
- mypy --strict polylogue/pipeline/prepare_transform_content.py tests/unit/pipeline/test_materialization_runtime.py
- pytest -q tests/unit/pipeline/test_materialization_runtime.py
Targeted session insight rebuilds hydrate full conversations, but plain text content blocks duplicate text already stored on the messages table. Large Codex sessions are text-heavy, so loading every text block adds substantial DB read and hydration cost without changing work-event or phase inference.

Load content blocks for insight refresh only when the message row indicates tool or thinking semantics. Text-only messages still contribute role, text, timestamp, and word counts from the message row, while tool/thinking messages retain their blocks for action-event and reasoning inference.

Focused verification:
- ruff check polylogue/storage/insights/session/rebuild.py tests/unit/storage/test_session_insight_refresh.py
- mypy --strict polylogue/storage/insights/session/rebuild.py tests/unit/storage/test_session_insight_refresh.py
- pytest -q tests/unit/storage/test_session_insight_refresh.py tests/unit/daemon/test_convergence_stages.py tests/unit/daemon/test_daemon_convergence.py
Known JSONL stream providers already enter the streaming ingest path with provider identity from acquisition. Avoid re-sniffing those samples through the broad detector so provider-specific synthetic streams do not emit misleading parser rejection noise before the intended provider handles them.

Ref #845
Validation-off JSONL stream ingest already has authoritative provider identity from acquisition and does not need a schema sample. Build a direct stream parse plan for known stream providers so large files are not read once for sampling and again for parsing.

Measured during #845 profiling, the removed pre-sample cost was about 4.4s on a 313 MB Codex JSONL before parsing began.

Ref #845
Materialization previously built normalized message payloads once for the conversation content hash and again for per-message content hashes. Compute both from the same pass so hash outputs remain unchanged while large streams avoid repeated payload construction and JSON serialization.

A representative 313 MB Codex JSONL ingest_record probe improved from 33.8s profiled before the stream/hash changes to 16.5s wall time after them under concurrent load.

Ref #845
Keep the daemon's default post-ingest stage set in one factory and reuse it from polylogued, daemon-live benchmarks, and convergence benchmark probes. This makes the daemon convergence boundary explicit and avoids scattered FTS/embed/insights wiring.

Ref #845
Record each live-ingest batch as a durable attempt row in the archive DB, with phase, file counts, byte-read counters, stage timings, current source/path, and RSS snapshots. polylogued status now surfaces recent attempts so a killed or interrupted convergence run leaves actionable state instead of only an incomplete terminal log.

Ref #845
Extend the daemon-live synthetic benchmark to generate both Claude Code and Codex JSONL through the shared synthetic corpus generator. The campaign now appends generated provider-shaped tail records for both providers and reports per-provider file counts, so append-read regressions are visible for the two largest live chatlog sources.

Measured small campaign: append_payload_read_bytes=6586 while append_input_bytes=70256, with 20 succeeded files and 0 failures.

Ref #845
Track Claude Code conversation created_at and updated_at incrementally while parsing instead of retaining every normalized timestamp and computing min/max afterward. This keeps the parser result identical while trimming per-record memory in large JSONL streams.

Ref #845
Sinity added a commit that referenced this pull request May 6, 2026
## Summary

Keeps `polylogued status` responsive while the daemon is converging a large archive.

## Problem

During the Sinnix deployment of #847/#850, the daemon was healthy and had live attempt state in SQLite, but `polylogued status --format json` exceeded a 30s timeout while convergence was starting. The status path was doing work that scales with archive size or takes deep archive locks: recursive blob-size walking, deep readiness imports, async insight status, and duplicate status probes.

## Solution

Make the local daemon status path bounded: blob size is reported as unmeasured `0`, FTS readiness and insight freshness use small read-only SQLite probes, and JSON rendering reuses the typed `DaemonStatus` probe results instead of recomputing them. The live busy-daemon probe that timed out before returned in 1.7s with this branch.

Ref #845

## Verification

- `ruff format --check polylogue/daemon/status.py tests/unit/daemon/test_daemon_status.py`
- `ruff check polylogue/daemon/status.py tests/unit/daemon/test_daemon_status.py`
- `mypy --strict polylogue/daemon/status.py tests/unit/daemon/test_daemon_status.py`
- `pytest tests/unit/daemon/test_daemon_status.py -q` → `8 passed in 10.84s`
- `.venv/bin/polylogued status --format json` against the live busy daemon → returned in `1.731s`
- `devtools verify` → `verify: all checks passed`
- pre-push `devtools verify --quick` → `verify: all checks passed`
Sinity added a commit that referenced this pull request May 6, 2026
## Summary

Follow-up to the daemon-first #845 work after deploying #847/#850/#851
on the workstation. The live daemon exposed two deployment-scale
problems: status payloads became huge with thousands of retryable live
cursor failures, and full-ingest attempts could look stale while the
worker was actually busy inside storage replacement. The same live run
also exposed an unindexed SQLite foreign-key path that made conversation
replacement scan millions of provider events.

## Problem

During the Sinnix switch, `polylogued status --format json` returned
quickly after #851 but emitted thousands of file paths. The active
attempt was marked stale in `full_blob_copy`, while `py-spy` showed the
daemon was actually in `_process_ingest_batch_sync ->
replace_conversation_runtime_state_sync`. The live archive has ~4.0M
`provider_events` rows, and `provider_events.source_message_id`
referenced `messages(message_id)` without an index, so deleting messages
during replacement caused repeated child-table scans and ~91GB of read
I/O before I stopped the old service.

## Solution

- Bound live cursor file samples in daemon status while preserving exact
failed/excluded/retry counts.
- Heartbeat full-ingest file scanning, blob materialization, and
worker-write handoff with current path and payload-read counters.
- Add schema v9 with indexes on `provider_events(source_message_id)` and
`attachment_refs(message_id)` so message deletion during replacement has
supporting FK indexes; v8 archives upgrade in place.
- Split live-batch helper code and the new focused tests out of
oversized modules, then refresh topology projections.

## Verification

- `ruff check polylogue/sources/live/batch.py
polylogue/sources/live/batch_support.py
polylogue/storage/sqlite/schema_bootstrap.py
tests/unit/sources/test_live_batch_support.py
tests/unit/storage/test_schema_upgrades.py
tests/unit/sources/test_live_watcher.py
tests/unit/storage/test_backend.py` -> all checks passed.
- `mypy polylogue/sources/live/batch.py
polylogue/sources/live/batch_support.py
polylogue/storage/sqlite/schema_bootstrap.py
tests/unit/sources/test_live_watcher.py
tests/unit/sources/test_live_batch_support.py
tests/unit/storage/test_backend.py
tests/unit/storage/test_schema_upgrades.py` -> success, no issues.
- `pytest tests/unit/sources/test_live_watcher.py
tests/unit/sources/test_live_batch_support.py
tests/unit/daemon/test_daemon_status.py
tests/unit/storage/test_backend.py
tests/unit/storage/test_schema_upgrades.py
tests/unit/devtools/test_verify_file_budgets.py -q` -> 110 passed.
- `devtools verify-file-budgets` -> clean.
- `devtools render-all --check` -> OK.
- `devtools verify` -> all checks passed.
- pre-push quick verification -> all checks passed.

Ref #845
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Ref #845. This is a large daemon-first convergence slice: live ingestion now runs through observable daemon convergence batches, durable live cursor state records failures and interrupted work, append-only JSONL changes read tails instead of whole files, the old `polylogue run` batch pipeline is removed, static archive publication/site generation is removed, and the archive write gateway is wired into the real ingest commit boundary.

## Problem

The previous public batch model hid daemon convergence behavior behind duplicate pipeline paths. It also made performance and restart behavior hard to verify: a daemon kill during a large import could leave the operator unable to tell which source group had converged, whether work was safe to resume, or whether a workload was doing whole-file / whole-archive work. Issue #845 asks for a daemon-owned ingest architecture with concrete observability and performance evidence, not another provider-event or storage-schema detour.

## Solution

- Replace the old public `polylogue run` handling with daemon-owned ingest paths. The run command, run helpers, observer scaffolding, run-state storage queries, run-specific tests, mutation entries, and user-facing docs are deleted rather than deprecated.
- Remove static archive publication/site generation from the runtime surface. The remaining pages tooling is devtools-only documentation rendering; archive reading belongs to daemon/web surfaces.
- Add `LiveBatchProcessor` as the in-process daemon live batch executor used by the watcher and benchmark harness. It records queue/backlog, payload read bytes, append/full-file counts, failing files, stage timings, RSS/current file heartbeat state, and cursor retry state.
- Make live cursor failures durable and status-visible, including first-time failures, excluded files, failure backoff, and daemon-abandoned `running` attempts on restart.
- Make convergence resumable at group boundaries: append and full-file groups run convergence and advance cursors only after that group converges, so a killed daemon retries uncommitted groups instead of skipping them.
- Add daemon-live synthetic benchmark coverage using the proper synthetic corpus generator. The campaign performs initial ingest plus append workloads and reports semantic axes for files, source bytes, append bytes, payload reads, archive writes, row counts, and stage timings.
- Add append/tail JSONL ingestion for live sources. Grown Claude Code / Codex-style JSONL files read completed tails from the cursor offset and write appended records without replacing prior conversation rows.
- Reconcile `ArchiveWriteGateway` as the real local ingest commit/effects authority instead of a dead daemon-RPC-shaped wrapper.
- Tighten hot paths found during bounded profiling: sample JSONL before raw storage, avoid duplicate live work, parallelize many-file batches, suppress duplicate skip logs, trim duplicate Codex ingest tuples, and avoid repeated timestamp parsing in Codex materialization.

## Acceptance Matrix

Satisfied in this PR:

- Durable live cursor ownership/failure visibility uses the archive DB path and is surfaced through daemon status.
- Daemon convergence exposes backlog, retry/failure state, read/write byte shape, row counts, stage timings, heartbeat state, and live file progress.
- `polylogue run` and its batch-handling surface are removed outright; ingestion is daemon-owned.
- Static archive publication/site generation is removed from the archive runtime surface.
- Append-only live JSONL convergence reads tails rather than unchanged prefixes and preserves prior archived messages.
- Daemon convergence is resumable across kills at group boundaries; prior `running` attempts become durable interrupted cursor rows on restart.
- Archive writes go through the real gateway boundary used by sync ingest commits.
- Synthetic benchmark evidence can exercise daemon convergence without running the daemon process.

Still open / intentionally not claimed:

- The largest single-session files still need deeper streaming materialization/write work to reduce high RSS and minute-scale per-file stalls.
- Provider-event volume is measured but not redesigned here; #845 explicitly should not collapse into unrelated provider-events schema work.
- A final real production-corpus convergence run was not restarted after the interrupted run, per operator guidance to avoid another full run before further optimization.
- Broader provider-specific append guarantees should be expanded beyond the Claude Code / Codex-shaped JSONL paths covered here.

## Verification

- `devtools verify`
  - Result: `verify: all checks passed`
- `devtools run-benchmark-campaigns --campaign daemon-live-convergence --scale small --output .local/benchmarks/daemon-live-small-after-optimizations.json`
  - Result: report written at `.local/benchmarks/daemon-live-small-after-optimizations.json/2026-05-06-small.json`
  - Key shape: `failed_files=0`, `succeeded_files=20`, `total_wall_s=0.484541`, `append_payload_read_bytes=6586`, `append_input_bytes=89778`
- Bounded Codex ingest profile on a 313 MB JSONL sample after tuple/timestamp optimization:
  - Before tuple dedupe: `elapsed_s=34.962`
  - After tuple dedupe + timestamp fast path: `elapsed_s=25.672`
  - Stored row counts stayed stable: `messages=34725`, `content_blocks=34742`, `action_events=28049`

## Production Run Evidence

A real-data daemon convergence attempt reached 91.05% of observed source bytes in 100.69 minutes before termination. At interruption the DB contained `raw_conversations=10165`, `conversations=7326`, `messages=3462031`, `content_blocks=2440067`, and `action_events=1435397`. That interruption exposed the resumability/observability gap fixed here: cursor progress is now advanced only after converged groups and interrupted `running` cursor rows are made durable on daemon restart.
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Adds the missing in-place archive upgrade from schema v7 to schema v8 so existing archives can run the daemon build merged in #847.

## Problem

#847 removed the legacy batch-run ledger and bumped `SCHEMA_VERSION` to 8, but the declared upgrade dispatcher still stopped at v6→v7. On the production archive, `polylogued` started successfully but every live convergence batch failed with `Database schema version 7 is incompatible with expected version 8`.

## Solution

Add a narrow `build_v7_to_v8_upgrade_plan()` that drops only the retired `idx_runs_timestamp` index and `runs` table, include that final step in older upgrade chains, and allow the sync/async schema bootstrap paths to execute the new action. Tests pin both the actual `_ensure_schema()` upgrade and the fact that the v8 migration carries no unrelated archive-wide work.

Ref #845

## Verification

- `ruff format --check polylogue/storage/sqlite/schema.py polylogue/storage/sqlite/schema_bootstrap.py tests/unit/storage/test_backend.py`
- `ruff check polylogue/storage/sqlite/schema.py polylogue/storage/sqlite/schema_bootstrap.py tests/unit/storage/test_backend.py`
- `mypy --strict polylogue/storage/sqlite/schema.py polylogue/storage/sqlite/schema_bootstrap.py tests/unit/storage/test_backend.py`
- `pytest tests/unit/storage/test_backend.py tests/unit/storage/test_provider_events_schema.py -q` → `38 passed in 11.54s`
- `devtools verify` → `verify: all checks passed`
- pre-push `devtools verify --quick` → `verify: all checks passed`

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Chores**
  * Added support for database schema version 8 upgrade, which removes the legacy batch-run ledger during the migration process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Keeps `polylogued status` responsive while the daemon is converging a large archive.

## Problem

During the Sinnix deployment of #847/#850, the daemon was healthy and had live attempt state in SQLite, but `polylogued status --format json` exceeded a 30s timeout while convergence was starting. The status path was doing work that scales with archive size or takes deep archive locks: recursive blob-size walking, deep readiness imports, async insight status, and duplicate status probes.

## Solution

Make the local daemon status path bounded: blob size is reported as unmeasured `0`, FTS readiness and insight freshness use small read-only SQLite probes, and JSON rendering reuses the typed `DaemonStatus` probe results instead of recomputing them. The live busy-daemon probe that timed out before returned in 1.7s with this branch.

Ref #845

## Verification

- `ruff format --check polylogue/daemon/status.py tests/unit/daemon/test_daemon_status.py`
- `ruff check polylogue/daemon/status.py tests/unit/daemon/test_daemon_status.py`
- `mypy --strict polylogue/daemon/status.py tests/unit/daemon/test_daemon_status.py`
- `pytest tests/unit/daemon/test_daemon_status.py -q` → `8 passed in 10.84s`
- `.venv/bin/polylogued status --format json` against the live busy daemon → returned in `1.731s`
- `devtools verify` → `verify: all checks passed`
- pre-push `devtools verify --quick` → `verify: all checks passed`
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Follow-up to the daemon-first #845 work after deploying #847/#850/#851
on the workstation. The live daemon exposed two deployment-scale
problems: status payloads became huge with thousands of retryable live
cursor failures, and full-ingest attempts could look stale while the
worker was actually busy inside storage replacement. The same live run
also exposed an unindexed SQLite foreign-key path that made conversation
replacement scan millions of provider events.

## Problem

During the Sinnix switch, `polylogued status --format json` returned
quickly after #851 but emitted thousands of file paths. The active
attempt was marked stale in `full_blob_copy`, while `py-spy` showed the
daemon was actually in `_process_ingest_batch_sync ->
replace_conversation_runtime_state_sync`. The live archive has ~4.0M
`provider_events` rows, and `provider_events.source_message_id`
referenced `messages(message_id)` without an index, so deleting messages
during replacement caused repeated child-table scans and ~91GB of read
I/O before I stopped the old service.

## Solution

- Bound live cursor file samples in daemon status while preserving exact
failed/excluded/retry counts.
- Heartbeat full-ingest file scanning, blob materialization, and
worker-write handoff with current path and payload-read counters.
- Add schema v9 with indexes on `provider_events(source_message_id)` and
`attachment_refs(message_id)` so message deletion during replacement has
supporting FK indexes; v8 archives upgrade in place.
- Split live-batch helper code and the new focused tests out of
oversized modules, then refresh topology projections.

## Verification

- `ruff check polylogue/sources/live/batch.py
polylogue/sources/live/batch_support.py
polylogue/storage/sqlite/schema_bootstrap.py
tests/unit/sources/test_live_batch_support.py
tests/unit/storage/test_schema_upgrades.py
tests/unit/sources/test_live_watcher.py
tests/unit/storage/test_backend.py` -> all checks passed.
- `mypy polylogue/sources/live/batch.py
polylogue/sources/live/batch_support.py
polylogue/storage/sqlite/schema_bootstrap.py
tests/unit/sources/test_live_watcher.py
tests/unit/sources/test_live_batch_support.py
tests/unit/storage/test_backend.py
tests/unit/storage/test_schema_upgrades.py` -> success, no issues.
- `pytest tests/unit/sources/test_live_watcher.py
tests/unit/sources/test_live_batch_support.py
tests/unit/daemon/test_daemon_status.py
tests/unit/storage/test_backend.py
tests/unit/storage/test_schema_upgrades.py
tests/unit/devtools/test_verify_file_budgets.py -q` -> 110 passed.
- `devtools verify-file-budgets` -> clean.
- `devtools render-all --check` -> OK.
- `devtools verify` -> all checks passed.
- pre-push quick verification -> all checks passed.

Ref #845
Sinity added a commit that referenced this pull request May 7, 2026
Foundation slice for #829. Polylogue mixed hardcoded defaults,
scattered env reads, CLI flags, and partial dataclasses;
after #847 daemon convergence, embeddings, hook install,
auth, and health policies all needed one config contract.

- `polylogue/config.py`: introduces `polylogue.toml` loading
  with the four-layer precedence (defaults → user TOML at
  `$XDG_CONFIG_HOME/polylogue/polylogue.toml` → environment
  variables → CLI flags / programmatic overrides). Defines
  the schema sections `[archive]`, `[daemon]`, `[daemon.api]`,
  `[notifications]`, `[health]`.
- `polylogue/cli/commands/config.py` and registration:
  `polylogue config show` lets operators see the resolved
  config and the layer that supplied each value.
- `docs/cli-reference.md`, `docs/topology-status.md`, etc.:
  generated surfaces refreshed.

Refs #829
Sinity added a commit that referenced this pull request May 7, 2026
Foundation slice for #829. Polylogue mixed hardcoded defaults,
scattered `os.environ.get()` calls, CLI flags, and partial
dataclasses; after #847 daemon convergence, embeddings, hook
install, auth, and health all need one config contract.

- `polylogue/config.py`: introduces `PolylogueConfig` dataclass
  with typed fields covering archive root, daemon settings,
  watch sources, embedding settings, and notification backend.
  `load_polylogue_config()` returns the typed instance and
  applies the four-layer precedence (defaults → TOML → env →
  flags) introduced in PR #889.
- Six previously direct `os.environ.get()` reads under
  `cli/query_progress.py`, `cli/shared/formatting.py`,
  `daemon/status.py`, `logging.py`, `paths/_roots.py`,
  `pipeline/services/{ingest_worker,validation_flow}.py` now go
  through the config object so future env additions land in one
  place.

Refs #829
Sinity added a commit that referenced this pull request May 7, 2026
Foundation slice for #829. Polylogue mixed hardcoded defaults,
scattered env reads, CLI flags, and partial dataclasses;
after #847 daemon convergence, embeddings, hook install,
auth, and health policies all needed one config contract.

- `polylogue/config.py`: introduces `polylogue.toml` loading
  with the four-layer precedence (defaults → user TOML at
  `$XDG_CONFIG_HOME/polylogue/polylogue.toml` → environment
  variables → CLI flags / programmatic overrides). Defines
  the schema sections `[archive]`, `[daemon]`, `[daemon.api]`,
  `[notifications]`, `[health]`.
- `polylogue/cli/commands/config.py` and registration:
  `polylogue config show` lets operators see the resolved
  config and the layer that supplied each value.
- `docs/cli-reference.md`, `docs/topology-status.md`, etc.:
  generated surfaces refreshed.

Refs #829
Sinity added a commit that referenced this pull request May 7, 2026
Foundation slice for #829. Polylogue mixed hardcoded defaults,
scattered `os.environ.get()` calls, CLI flags, and partial
dataclasses; after #847 daemon convergence, embeddings, hook
install, auth, and health all need one config contract.

- `polylogue/config.py`: introduces `PolylogueConfig` dataclass
  with typed fields covering archive root, daemon settings,
  watch sources, embedding settings, and notification backend.
  `load_polylogue_config()` returns the typed instance and
  applies the four-layer precedence (defaults → TOML → env →
  flags) introduced in PR #889.
- Six previously direct `os.environ.get()` reads under
  `cli/query_progress.py`, `cli/shared/formatting.py`,
  `daemon/status.py`, `logging.py`, `paths/_roots.py`,
  `pipeline/services/{ingest_worker,validation_flow}.py` now go
  through the config object so future env additions land in one
  place.

Refs #829
Sinity added a commit that referenced this pull request Jun 13, 2026
Problem: #1813 folded `open --print-url` into `read --to browser`, but the
new browser route emitted human text ("✗ No sessions matched.") and exit 0
even for machine consumers. The integration test pinning the old contract
(JSON no-results envelope + exit 2) failed, and the regression was real: a
`--format json` request that matched nothing no longer returned a structured
error.

What changed:
- `_run_read_browser` now emits the canonical `no_results` error envelope and
  exits 2 when JSON output is requested (on the verb via `read -f json` or on
  the root via `--format json … read`), mirroring the removed
  `_emit_open_no_results` json branch.
- Migrated the integration test to the `read --to browser` grammar and renamed
  it accordingly.
- Flagged the remaining pre-#1813 verb grammar in the #847-skipped tests so the
  daemon-fixture rewrite migrates rather than resurrects the removed verbs.

Ref #1813
Sinity added a commit that referenced this pull request Jun 13, 2026
Problem: #1813 folded `open --print-url` into `read --to browser`, but the
new browser route emitted human text ("✗ No sessions matched.") and exit 0
even for machine consumers. The integration test pinning the old contract
(JSON no-results envelope + exit 2) failed, and the regression was real: a
`--format json` request that matched nothing no longer returned a structured
error.

What changed:
- `_run_read_browser` now emits the canonical `no_results` error envelope and
  exits 2 when JSON output is requested (on the verb via `read -f json` or on
  the root via `--format json … read`), mirroring the removed
  `_emit_open_no_results` json branch.
- Migrated the integration test to the `read --to browser` grammar and renamed
  it accordingly.
- Flagged the remaining pre-#1813 verb grammar in the #847-skipped tests so the
  daemon-fixture rewrite migrates rather than resurrects the removed verbs.

Ref #1813
Sinity added a commit to Sinity/sinnix that referenced this pull request Jul 16, 2026
* fix(polylogue): retire batch run service

Problem: Polylogue daemon convergence now owns ingestion, but Sinnix still installed polylogue-run.service/timer and observed the removed runs ledger.

What changed: pin Polylogue to the #847 merge, remove the batch writer service/timer, point health at polylogued.service, raise daemon catch-up memory guardrails, and move sinnix-observe/runtime fixtures to live_ingest_attempt evidence.

Verification: python3 -m py_compile scripts/sinnix-observe; nix build .#checks.x86_64-linux.nixos-services-polylogue .#checks.x86_64-linux.nixos-core-performance-policy .#heavyChecks.x86_64-linux.sinnix-observe-runtime; nix build .#heavyChecks.x86_64-linux.polylogue-vm; nix build .#checks.x86_64-linux.treefmt.

Refs #57, Sinity/polylogue#845, Sinity/polylogue#847

* feat(hermes): configure approval mode

Problem: Hermes approval behavior was not represented in generated config, so host policy had to live outside the module contract.

What changed: add an approvals.mode option, render it into Hermes config, cover the default in the service assertion, and set sinnix-prime to off mode.

Verification: nix build .#checks.x86_64-linux.nixos-services-hermes; nix build .#checks.x86_64-linux.treefmt.

* chore(codex): raise default reasoning effort

Problem: the local Codex default was still configured for medium reasoning despite the current workstation agent workload favoring deeper analysis.

What changed: set the default Codex reasoning effort to xhigh in the Home Manager-managed config.

Verification: nix build .#checks.x86_64-linux.treefmt.

* chore(agents): remove deepseek shim

Problem: the top-level ds launcher pinned a store path and duplicated agent model configuration outside the managed dotfile/module surfaces.

What changed: remove the stale ad-hoc DeepSeek Claude shim from the repo root.

Verification: nix build .#checks.x86_64-linux.treefmt.

* fix(polylogue): drop stale run unit helpers

Problem: after retiring polylogue-run.service, load-shedding and maintenance-overlap helpers still referenced the removed unit.

What changed: remove polylogue-run.service from the maintenance gate default unit set and the emergency nuke-builds user unit list.

Verification: rg -n 'polylogue-run|polylogue\.run|SINNIX_OBSERVE_POLYLOGUE_RUNS|polylogue-runs' modules flake scripts hosts CLAUDE.md README.md; nix build .#checks.x86_64-linux.treefmt.

Refs #57

* fix(cli): prevent scope wrapper recursion

Problem: sudo nixos-rebuild switch can inherit the project devshell scope wrapper environment. The active-wrapper path trusted SINNIX_SCOPE_ORIGINAL_PATH blindly, so a stale or reintroduced wrapper dir made nixos-rebuild exec the wrapper again in a tight loop after activation.\n\nWhat changed: carry the wrapper dir explicitly, strip it before both scoped dispatch and active re-entry, and resolve the unwrapped command path before exec. The performance policy witness now checks that the generated wrapper includes this recursion guard.\n\nVerification: nix build .#checks.x86_64-linux.nixos-core-performance-policy .#checks.x86_64-linux.treefmt

* fix(polylogue): consume schema v8 upgrade

Problem: the first daemon-convergence deploy consumed Polylogue #847, but production archives at schema v7 needed the follow-up #850 upgrade before polylogued could resume ingestion.\n\nWhat changed: update the Polylogue flake input from #847 to #850 so the deployed package includes the declared v7->v8 archive upgrade.\n\nVerification: nix build .#checks.x86_64-linux.nixos-services-polylogue .#checks.x86_64-linux.nixos-core-performance-policy .#checks.x86_64-linux.treefmt .#heavyChecks.x86_64-linux.sinnix-observe-runtime .#heavyChecks.x86_64-linux.polylogue-vm .#nixosConfigurations.sinnix-prime.config.system.build.toplevel

* fix(polylogue): consume bounded daemon status

Problem: after daemon convergence deployment, polylogued status could time out during a live catch-up even though durable live attempt state was readable. Polylogue #851 bounds the status probes.\n\nWhat changed: update the Polylogue flake input from #850 to #851 so the active daemon package includes responsive status probes during convergence.\n\nVerification: nix build .#checks.x86_64-linux.nixos-services-polylogue .#checks.x86_64-linux.nixos-core-performance-policy .#checks.x86_64-linux.treefmt .#heavyChecks.x86_64-linux.polylogue-vm .#nixosConfigurations.sinnix-prime.config.system.build.toplevel

* fix(polylogue): consume status heartbeat schema

Problem: the deployed daemon status path was bounded, but production catch-up exposed an unindexed provider-events foreign-key delete path that could stall live convergence during full ingest.

What changed: advance the Polylogue input to the merged #854 commit, which adds bounded live cursor status samples, live batch heartbeat updates, and schema v9 foreign-key indexes for provider-event and attachment replacement paths.

Ref #57

* fix(polylogue): consume bounded FTS startup

Problem: the daemon-only Polylogue deployment still hit an O(index) FTS5 startup count before liveness, so the previously pinned package could block catch-up on large archives.

What changed: advance the Polylogue input to the merged #858 fix, which replaces daemon startup COUNT(*) on messages_fts with the docsize-backed FTS status helper.

Ref #57

* feat(perf): protect agent sessions from pressure kills

Problem: coding-agent frontends were placed with background work and systemd-oomd/earlyoom kills were hard to diagnose after the fact.

What changed: add an agent.slice with interactive-style memory protection, route agent wrappers through that slice, keep agent frontends out of earlyoom preferred victims, expose the slice in sinnix-observe, and add a systemd-oomd watcher that records/notifications memory-pressure kill events.

Verification: included in the latest Nix build of checks.x86_64-linux.nixos-core-performance-policy, checks.x86_64-linux.treefmt, heavyChecks.x86_64-linux.sinnix-observe-runtime, and the sinnix-prime toplevel before the host switch.

* docs(agents): record pressure kill safeguards

Document the new protected agent slice and oomd kill event watcher in the agent maintenance reference so future sessions know why agent frontends are kept out of background pressure shedding.

* fix(perf): tail oomd watcher journal

Problem: the oomd event watcher used --since=now, which still made journalctl scan enough history on service start to read hundreds of megabytes before settling into follow mode.

What changed: start the watcher at the journal tail with --lines=0 and pin that behavior in the performance policy test.

Verification: bash -n scripts/sinnix-oomd-watch; nix build .#checks.x86_64-linux.nixos-core-performance-policy

* fix(perf): disable PSI oomd kills for dev work

Problem: systemd-oomd was killing developer scopes based on short PSI pressure windows even when the machine still had roughly 24G MemAvailable, including one build-slice victim with only 4M current memory. That made agent and workload deaths look arbitrary under low actual RAM usage.

What changed: disable systemd-oomd, remove ManagedOOMMemoryPressure kill policy from build/background/nix-build/maintenance paths, and leave low-memory intervention to earlyoom. Keep the disposable slices weighted and latency-sheddable, while the prior agent/app/session protections keep terminals and agent frontends in avoid/preferred recovery slices.

The oomd recorder is now a cursor-based oneshot timer instead of a resident journal follower, with persistent state under /var/lib/sinnix-oomd-watch and events under /realm/data/captures/syslog/oomd-events.

Verification: nix fmt; bash -n scripts/sinnix-oomd-watch scripts/sinnix-scope; git diff --check; nix build .#checks.x86_64-linux.nixos-core-performance-policy; nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel; sudo nix run .#switch; systemctl/systemctl --user show confirmed systemd-oomd inactive, timer active, and protected/runtime slice properties applied.

* feat(services): add ChatGPT MCP bridge

Problem: ChatGPT Connector developer mode needs a local HTTP MCP endpoint while the actual MCP transport runs over SSH.

What changed: add a chatgpt-mcp user service that wraps ssh-mcp through mcpo, exposes configurable port/SSH options, persists package caches in the service state directory, and enables it on sinnix-prime.

Verification: nix build .#checks.x86_64-linux.treefmt .#nixosConfigurations.sinnix-prime.config.system.build.toplevel

* chore(dots): re-render codex AGENTS.md after polylogued daemon rename

CLAUDE.md and world-model/projects.md were updated in a recent session to
replace `polylogue watch` / `polylogue-watch.service` references with the
current `polylogued` / `polylogued.service` shape (configured by
`sinnix.services.polylogue`). The codex-side AGENTS.md is auto-generated
from those sources via scripts/render-agents and was stale until now.

Re-rendered. No content changes beyond what already landed in CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(performance): make resource isolation actually enforced (Fix A2/B/D)

Diagnostic that prompted this set lives in

Short version: PSI io full=37% over 5min, 23 GB swap used (18 GB in
user-1000.slice alone), load avg 22 — system unusable. None of the
declared `IOWeight` / `IOSchedulingClass` / `Nice` annotations were doing
anything because the data NVMes use mq-deadline, which honors neither.
And `MemorySwapMax=infinity` everywhere meant a single greedy slice
could drown the swap subsystem and starve everyone else's pageouts.

Fix B — per-slice MemorySwapMax (generous, tiered):

  - user.slice           = 24 G   (chrome + agents pinned 18 G during incident)
  - nix-build.slice      = 20 G   (linker / codegen needs real swap)
  - background.slice     =  8 G   (sinnix daemons; small with headroom)
  - sinnix-maintenance   =  6 G   (borg observed at 1.5 G + 5.7 G RSS)
  - system.slice         = (left infinity — PID 1 / login plumbing)

`MemorySwapMax` is a fairness invariant, not an idle-wasting cap. Removed
it from the `hasHardResourceCeiling` predicate in performance.test.nix
with a comment explaining the structural distinction; added positive
assertions on each per-slice cap.

Fix D — `system-critical.slice` for observability daemons:

  CPUWeight=10000, IOWeight=10000, MemoryMin=256M,
  ManagedOOMPreference=avoid, IODeviceLatencyTargetSec=interactive.

below.service moved into it with Nice=-5, IOSchedulingClass=best-effort,
IOSchedulingPriority=0. Below was previously sitting in system.slice at
default Nice=0 producing "data collection took 938 ms (>= 500 ms)"
warnings during exactly the contention it exists to capture — the new
slice ensures sub-second sampling holds under load.

Slice is documented for likely future tenants: sentinel,
sinnix-pressure-watchdog, network-monitor, power-watchdog, future sinex
collector daemons. Inclusion rule: the daemon's value depends on
consistent sub-second sampling under load.

Fix A2 — `io.cost.qos` initialization:

New `sinnix-iocost-init.service` writes `ctrl=auto` to
`/sys/fs/cgroup/io.cost.{model,qos}` for the data NVMes (and SATA root)
at boot. Without this, `IOWeight=` declarations across the slice
hierarchy are silently discarded on mq-deadline. With this, the kernel
cost-models each device and throttles cgroups whose share would push
past the QoS target — making `IOWeight=1` on `sinnix-maintenance.slice`
actually mean something relative to `IOWeight=1000` on `user.slice`.

Service ordered `before = [ below.service sinnix-pressure-watchdog.service
sysinit.target ]` so io.cost is enabled before any IOWeight-honoring
service starts. `SuccessExitStatus = "0 1"` keeps boot non-fatal if a
device UUID is absent.

Devices configured (resolved through stable UUIDs so NVMe enumeration
order doesn't surprise the script):
  - data NVMe (CT4000P3, /realm)
  - system NVMe (Samsung 960 EVO, Nix store + swap)
  - root SSD (SATA)

Skip A1 (BFQ) — throughput regression on fast NVMes isn't worth it for
mixed/interactive workloads. Skip A3 (absolute IOBandwidthMax caps) — too
blunt for a system-config gap.

Fix E1 — sentinel watchdog feedback:

New section 15 in `scripts/sinnix-sentinel` reads journal entries from
`sinnix-pressure-watchdog` (5-min default window), counts events of
`sinex.invocation.lacks_*` and `systemd.unit.lacks_control_group`, and
emits a sentinel warning + desktop notification when any kind exceeds
threshold N=5. Surfaces actionable metadata that already existed in the
journal — converts "data the watchdog logged but no one read" into "data
the operator sees on their notification surface."

E3 (sinex pipeline ingest) deferred until sinex collector daemons land.
E2 (auto-corrective actions) deferred until E1 has produced enough
operational data to know which patterns are safe to auto-act on.

Tests:
  - nixos-core-performance-policy:    PASS  (slice budgets + iocost-init)
  - nixos-services-below:             PASS  (system-critical slice + Nice/IO knobs)
  - nixos-services-sentinel:          PASS  (script builds clean)
  - sinnix-sentinel package build:    PASS

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(browser): disable Chrome Vulkan on Wayland

Problem: a live desktop incident produced NVIDIA Xid 31 MMU faults against Chrome and kitty. Chrome logged a Wayland+Vulkan incompatibility, lost its GPU context, and restarted its GPU process; shortly afterward a kitty process aborted and Hyprland unmapped the window.

What changed: extend the existing Chrome Wayland color-management workaround to also disable Vulkan and DefaultANGLEVulkan, matching the editor wrapper policy while leaving video acceleration defaults alone.

Verification: nix fmt; git diff --check -- modules/features/desktop/browser.nix modules/features/desktop/browser.test.nix; nix build .#checks.x86_64-linux.nixos-bundle-desktop. Full host build is currently blocked by unrelated dirty airvpn-seed config not included in this commit.

* feat(services): add AirVPN seeding tunnel module

Problem: the host config enables sinnix.services.airvpn-seed, but the module file was still untracked, so Nix could not evaluate that service option from the repository source.

What changed: track the AirVPN WireGuard/Transmission service module. The encrypted agenix secret files and other unrelated worktree changes remain unstaged.

Verification: git diff --staged --check -- modules/services/airvpn-seed.nix. Full host build is currently blocked by unrelated untracked flake/npm/chrome-devtools-mcp content.

* feat(dev): add Chrome DevTools MCP tooling

Problem: browser and agent debugging need a tracked, reproducible Chrome DevTools MCP package and registry-managed client wiring instead of relying on ad hoc runtime installs.

What changed: package chrome-devtools-mcp 0.25.0 from a vendored npm lock, expose mcp-chrome-devtools and headed Playwright wrappers, render registry entries for Claude/Codex/Gemini, and move Claude MCP servers into the wrapper's --mcp-config path.

Verification: nix fmt; git diff --check.

* feat(services): enable AirVPN seeding on prime

Problem: the AirVPN seeding service module existed, but sinnix-prime still needed the host enablement and agenix secret declarations/files to evaluate and activate the tunnel.

What changed: enable sinnix.services.airvpn-seed on sinnix-prime with forwarded port 20241, register the two agenix secret files, and track the encrypted AirVPN WireGuard key and PSK payloads.

Verification: nix fmt; git diff --check.

* feat(git): clean merged PR branches safely

Problem: the old git cleanup alias deleted any branch merged into the current local graph and could not distinguish squash-merged PR branches from branches whose upstream disappeared for another reason.

What changed: route git cleanup through a helper that protects current/default branches, prunes remotes, deletes branches merged into the default branch, and only force-deletes gone-upstream branches when GitHub reports a merged PR for that head.

Verification: nix fmt; git diff --check.

* fix(boot): keep generation cleanup bounded

Problem: stale UKI/BLS entries and age-based profile cleanup left the boot menu noisy and made rollback retention depend on wall-clock churn rather than a clear generation count.

What changed: keep ten boot entries, normalize BLS entry titles, delete stale hash-suffixed UKIs from EFI/Linux, and align Nix GC/clean commands around keeping the last ten system generations.

Verification: nix fmt; git diff --check.

* feat(desktop): retarget agent scratchpad to Hermes 2

Problem: the existing agent scratchpad binding still targeted the first agent scratchpad command/title while the active desktop workflow uses the Hermes-2 scratchpad.

What changed: move the scratchpad binding to F5 and retarget the scratchpad definition to scratchpad-agent2 / scratch_agent2 with the Hermes-2 title.

Verification: nix fmt; git diff --check.

* chore(services): budget polylogued background work

Problem: polylogued and sentinel health checks need clearer runtime attribution and resource behavior, and the agent memory docs still described the older polylogue-watch path.

What changed: run polylogued in background.slice with explicit CPU/IO weights and IO read throttling, include Nix profiles in sentinel health coverage, add nix to sentinel runtime inputs, and update the persistent agent docs to name polylogued and its materialized products.

Verification: nix fmt; git diff --check.

* docs(agents): record worktree orchestration rules

Problem: multi-agent worktree sessions can silently lose work or commit into the wrong checkout unless the operational memory states the branch, commit, and cleanup rules explicitly.

What changed: add the agent orchestration workflow section covering worktree isolation, write-scope separation, commit cadence, pre-flight prompts, and post-agent merge checks.

Verification: nix fmt; git diff --check.

* test: register service eval coverage

Problem: newly enabled service surfaces were not represented in the test coverage ledger, so eval-only coverage expectations lagged the configuration.

What changed: add airvpn-seed and chatgpt-mcp entries to the service coverage map.

Verification: nix fmt; git diff --check.

* test: align resource assertion formatting

Problem: the checked Nix sources had a few assertion/merge blocks and Hermes expectations out of sync with the current formatted/evaluated output.

What changed: apply nixfmt-style let/block layout in resource tests and drop the stale Hermes manual-approval expectation.

Verification: nix fmt; git diff --check.

* build: update flake inputs

Problem: the local flake lock had pending input updates that should be captured with the rest of the system configuration state.

What changed: update devshell, intercept-bounce, llm-agents.nix, lynchpin, nix-vscode-extensions, polylogue, rust-overlay, sinex, stylix, and the related pinned nixpkgs input revisions.

Verification: nix fmt; git diff --check.

* feat(lynchpin): wire MCP server, skill, and service module

Four sinnix-side pieces connecting the lynchpin MCP server (7648cbb0 +
6d49b448 in the lynchpin repo):

1. flake/scripts.nix + flake/packages.nix — lynchpin-cli script package:
   sanitized Python wrapper exposing lynchpin-mcp binary from the lynchpin
   flake input; added to publicPackageNames so nix flake check validates it.

2. modules/lib/mcp-registry.nix + modules/features/dev/mcp-servers.nix —
   MCP registry entry for lynchpin (stdio, all clients) + mcpLynchpinBin
   wrapper + ~/.local/bin/mcp-lynchpin symlink, mirroring the polylogue
   pattern exactly.

3. dots/_ai/skills/lynchpin/SKILL.md — substantive skill content covering
   all available MCP tools, query patterns, freshness model, and when to
   prefer polylogue or the CLI instead.

4. modules/services/lynchpin.nix — minimal service module adding lynchpin-cli
   to systemPackages and LYNCHPIN_MCP_PROVIDED=1 env var when enabled.
   No timer or daemon yet (MCP is on-demand stdio). Not enabled by default
   in any host config.

Co-Authored-By: Claude <[email protected]>

* feat(arc-e.2): weekly lynchpin refresh systemd timer

Optional refreshTimer in sinnix.services.lynchpin: a oneshot service
that runs the full analysis DAG weekly (default Sun 03:00, randomized
within 1h window), promoting results to the DuckDB substrate. Persistent
true so missed runs execute on next boot. 4-hour timeout.

Nice=19 / IOSchedulingClass=idle so the DAG never competes with
interactive work.

* skill(lynchpin): substrate-first principle, quick orientation for 28+ tools

Adds mandatory substrate query before any project claim. Quick-reference
table mapping questions to tools. Updated tool count and description.

* feat(performance): periodic swap drain on pressure-safe conditions

Linux never proactively rehydrates cold swap pages. A single transient
peak (large build, chrome burst, scrub) leaves GB of working set
cold-on-disk for days; every later access then costs a 4K random read
on the swap NVMe, which surfaces as sustained io PSI even while
MemAvailable is plentiful and the working set fits in RAM.

Observed today: 14.3 GiB swapped, rust-analyzer holding 7 GiB of it,
io PSI some avg300=25% with no active heavy I/O. swapoff/swapon cleared
it and PSI source went to zero.

Add sinnix-swap-drain.{service,timer} that runs swapoff -a && swapon -a
every 20 min, gated on:
  1. swap_used >= 2 GiB
  2. MemAvailable >= swap_used + 4 GiB headroom
  3. io PSI some avg10 < 10%

Persistent=false so resume from suspend doesn't catch up. The drain is
self-throttling: gates skip cleanly with informative log lines when
conditions aren't met. Matches the file's existing pressure-based
shedding idiom (slices, earlyoom, io.cost) one level up at the
swap-state-correction layer.

Considered and rejected: lowering swappiness further (kernel still
swaps under hard pressure; doesn't fix stickiness), re-enabling zram
(file already documents CPU-burn rationale, doesn't help disk-swap
stickiness anyway), disabling swap entirely (loses backstop for
genuine peaks).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(cli): integrate yt-polisher as flake input + feature module

Adds yt-polisher (English YT video → Polish karaoke subs → unlisted upload)
as a sinnix CLI feature, sourced from github:Sinity/yt-polisher via SSH so
the private repo stays private without per-host credential ceremony.

- Flake input: git+ssh://[email protected]/Sinity/yt-polisher.git
- Overlay re-export: flake/overlay/package/yt-polisher.nix (auto-discovered)
- Feature module: modules/features/cli/yt-polisher.nix (mkFeatureModule)
- Enabled on sinnix-prime

* fix(polylogue): broaden I/O caps to sda + nvme1n1; raise MemoryHigh

The polylogued service had IOReadBandwidthMax targeting only nvme0n1.
Active Claude Code session JSONLs live on sda2 (~/.claude/projects/ via
/persist/home), and swap-in traffic hits nvme1n1 — neither was capped.

Observed under sustained ingest activity: sda hit 114 MB/s reads /
12k IOPS / 77% util and io PSI avg10 climbed to 73%, while nvme0n1
stayed under its 50M cap. Adding per-device bandwidth caps plus IOPS
caps closes the gap; the IOPS limit catches metadata storms that
bandwidth caps miss.

Also: MemoryHigh=8G was peaking against the wall, triggering reclaim
that paged the daemon's working set out and amplified the read storm
when it had to re-page in. Raise to 12G (MemoryMax unchanged at 16G).

Discovery context: PR/issue describing the upstream daemon-side
amplification opportunities (raw_fingerprint cursor caching, etc.)
to follow.

* feat(skills): assured-close, adversarial-loop, evidence-harness

Captures the AC-matrix + adversarial-loop closure pattern field-tested
on polylogue PRs #1002 (#818), #1004 (#868), #1006 (#819), #1010
(#1003 follow-on) on 2026-05-10. Three composable skills:

- assured-close: full issue-closure runbook. Internalize ACs verbatim,
  plan deltas, implement, run the adversarial loop, write the AC matrix
  into the PR body, close-discipline gate before merge (no "future
  work" without #NNN). References the close-discipline and
  coherence-gap memories that govern the pattern.

- adversarial-loop: independent subagent review iteration until
  convergence, capped at 5. Independence rule: each iteration runs
  cold without prior findings, to avoid shared blind spots. The four
  coherence gaps caught during the field test (catalog routing, IPv6
  origin, session-tree envelope drift, mtime-drift fingerprint loop)
  are the productive yield this skill targets.

- evidence-harness: reproduction-first investigation for bug cases
  where multiple suspects fit the symptom. Build a counter-based
  harness, measure what each suspect does, fix only what data
  implicates. Template references tests/infra/io_counter.py and
  tests/integration/test_live_read_amplification.py in polylogue.

Skills compose: assured-close invokes adversarial-loop (always) and
evidence-harness (for bug-investigation issues). Each is independently
useful — adversarial-loop applies to any closure with an AC list,
evidence-harness to any reproducible-but-non-deterministic bug.

There is some overlap with the `superpowers:*` plugin
(verification-before-completion, systematic-debugging,
requesting-code-review). The new skills are positioned as the
project-specific operationalization of these patterns that integrates
with sinity's close-discipline and coherence-gap feedback memories
saved in /home/sinity/.claude/projects/-realm-project-polylogue/memory/.

* fix: repair boot services and bound Sinex cache

Problem: the iocost init unit was ordered before sysinit while still carrying default dependencies, which produced boot ordering cycles and could disrupt early services. Sinex also generated an empty blob init unit when legacy annex initialization was disabled, and NATS JetStream reserved more storage than the server cap allowed. The Sinex Cargo target cache had no active-checkout size control and filled /cache.\n\nWhat changed: make iocost a real early-boot unit, only include sinex-blob-init when its upstream conditions are true, set the NATS JetStream file store cap to 32G, and make daily Sinex cache pruning remove stale checkout roots plus Cargo incremental directories above an 80GiB soft cap while skipping active Rust builds.\n\nVerification: nix build .#checks.x86_64-linux.nixos-core-performance-policy --no-link; nix build .#checks.x86_64-linux.nixos-services-sinex-delayed-runtime --no-link; nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link; sudo nix run .#switch; systemctl --failed --no-pager

* fix: stabilize desktop pressure priority

Remove cgroup io.latency targets after blkcg_iolatency WARNs under build pressure on the current kernel, keeping resource control work-conserving through IOWeight and io.cost instead of hard bandwidth ceilings.

Keep developer/build/background pressure backoff at the normal 20/50 weights and split true maintenance work to 10/1, so builds soak idle resources without preempting the desktop.

Switch sinnix-prime from the NVIDIA open kernel module to the proprietary module with GSP firmware disabled after the previous boot showed GSP heartbeat/Xid 119 lockups while memory was healthy.

Verification: nix build .#checks.x86_64-linux.nixos-core-performance-policy .#checks.x86_64-linux.nixos-host-sinnix-prime-observability-policy .#heavyChecks.x86_64-linux.nixos-services-below; git diff --check -- touched files

* fix: give desktop cgroups maximum priority

Make interactive user, session, app, and agent slices use maximum CPUWeight/IOWeight with larger MemoryMin/MemoryLow floors. Build, background, Nix, and maintenance work drop to CPUWeight=1 and IOWeight=1, which keeps them work-conserving when the machine is idle but makes them lose contested resource decisions to Hyprland, terminals, browser UI, and agent frontends.

Keep the policy free of hard CPU and I/O bandwidth ceilings; this is prioritization through cgroup weights and memory protection.

Verification: nix build .#checks.x86_64-linux.nixos-core-performance-policy .#heavyChecks.x86_64-linux.nixos-services-below; git diff --check -- touched files

* fix(polylogue): keep package source binding in scope

Problem: the Sinnix checks could not evaluate after the polylogue wrapper split because polylogueSrc was declared as a sibling in a plain attrset and then referenced by other sibling derivations.

What changed: hoist polylogueSrc into the surrounding let binding so polylogue-cli and polylogued can share the same package reference, and clarify why the Sinex bridge still drops pinned-upstream hard caps until the flake input advances.

Verification: nix build .#checks.x86_64-linux.nixos-services-sinex-delayed-runtime --no-link.

Co-Authored-By: Codex <[email protected]>

* refactor(sinex): defer runtime caps to upstream defaults

Problem: the Sinnix bridge still duplicated Sinex runtime hard-cap suppression even after the Sinex module learned null MemoryMax/CPUQuota defaults and low-priority scheduling policy. That made local verification with the updated Sinex input conflict with maintenance units and kept host policy more arcane than necessary.

What changed: make the bridge hard-cap override conditional on older pinned Sinex inputs that still expose concrete caps, force only the bridge-owned maintenance class back to weight 1, and update the focused service test to accept profile-specific upstream MemoryHigh values while still proving no hard caps and low-priority runtime scheduling.

Verification: nix build .#checks.x86_64-linux.nixos-services-sinex-delayed-runtime --no-link; nix build .#checks.x86_64-linux.nixos-services-sinex-delayed-runtime --no-link --override-input sinex git+file:///realm/project/sinex --no-write-lock-file

* refactor: use polylogue's sanitized api-python instead of local wrapper

polylogue now provides a sanitized api-python package (python binary
wrapped with PYTHONPATH/PYTHONHOME unset), matching the CLI binaries.
Replace mkSanitizedPythonWrapper with a simple symlink tree.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

* feat: unify machine telemetry capture

Problem: machine, network, and ad hoc performance capture were split across separate services and scripts, which made workstation performance analysis hard to join and easy to double-count.\n\nWhat changed: replace the network monitor and perf-scan surfaces with canonical machine telemetry SQLite capture plus immutable experiment-run manifests. Wire the host, diagnostics, coverage, and smoke command surfaces to the unified capture path.\n\nVerification: nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link; nix build .#checks.x86_64-linux.nixos-services-machine-telemetry .#checks.x86_64-linux.coverage-manifest --no-link; python3 scripts/sinnix-observe --offline --format json | jq -e '.schema == "sinnix-observe-v1"'.

* feat: add no-loss syslog index

Problem: raw journald captures are high-entropy evidence and must not be replaced by narrow summaries, but they still need a compact navigation layer for analysis.\n\nWhat changed: add a packaged syslog-index command and an hourly diagnostics timer that writes derived JSONL indexes for journal files, boot-metric directories, and OOMD event files while leaving raw logs canonical and untouched.\n\nVerification: python3 scripts/syslog-index --no-edge-inspect; nix build .#checks.x86_64-linux.nixos-host-sinnix-prime-observability-policy .#checks.x86_64-linux.coverage-manifest --no-link; nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link.

* fix: remove stale disabled audio capture option

Problem: the committed host config set audioCapture.asrProvider even though the committed audio-capture module does not define that option, so rebuilding from a clean Git revision failed.\n\nWhat changed: remove the stale provider assignment from the disabled host feature block. The feature remains disabled on sinnix-prime.\n\nVerification: nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link.

* fix: support manual AirVPN seed startup

Problem: the host configuration intentionally disables AirVPN seed boot autostart, but the committed service module did not expose that option. Clean flake switches therefore failed before activation.

What changed: add an autoStart option that controls the generated WireGuard target, bind Transmission to the target instead of a single service, and keep WireGuard allowed IPs complete while suppressing main-table routes. Retire the superseded power-watchdog service module now that machine-telemetry owns host power and pressure capture.

Verification: nix build .#heavyChecks.x86_64-linux.nixos-services-airvpn-seed .#heavyChecks.x86_64-linux.nixos-services-airvpn-seed-manual-start --no-link; nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link

* fix: support manual Polylogue daemon startup

Problem: the host disables the Polylogue daemon's user-session autostart, but the committed service module did not expose that option, so clean-revision switches failed during evaluation.

What changed: add the daemon autoStart option, wire it to the user service Install target, and remove local Polylogue cgroup caps so workload policy is centralized instead of spread across service modules. Add default and manual-start service checks.

Verification: nix build .#checks.x86_64-linux.nixos-services-polylogue .#heavyChecks.x86_64-linux.nixos-services-polylogue-manual-start --no-link; nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link

* fix: support manual Transmission startup

Problem: the host disables Transmission autostart during the current performance investigation, but the committed service module did not expose that option, causing clean-revision switches to fail.

What changed: add the Transmission autoStart option, gate the deferred boot timer behind it, create torrent directories at service start instead of boot-time tmpfiles, and remove local cgroup caps from the sparsify helper. Add checks for default and manual-start modes.

Verification: nix build .#heavyChecks.x86_64-linux.nixos-services-transmission .#heavyChecks.x86_64-linux.nixos-services-transmission-manual-start --no-link; nix build .#nixosConfigurations.sinnix-prime.config.system.build.toplevel --no-link

* fix: retire failed cache resource policy

Problem: the old /cache NVMe policy linked ~/.cache/nix into /cache while the host now persistently bind-mounts ~/.cache, making Home Manager activation fail during switch and preserving stale cgroup/io.cost complexity from the degraded hardware period.

What changed: route Nix build scratch to /var/cache/nix-build, keep eval/fetcher cache under the normal persistent XDG cache, remove the /cache-specific sccache/cargo/pip/nix-direnv wiring, and collapse sinnix-scope into a compatibility wrapper while the workstation returns to a simplified measured baseline.

Verification: nix build .#checks.x86_64-linux.nixos-core-performance-policy --no-link

* fix: remove failed cache drive storage units

Problem: the workstation no longer has a reliable /cache NVMe, but the host configuration still declared /cache and a swap partition on that device. Activation waited on missing device jobs and could not reach a clean switch.

What changed: remove the /cache filesystem declaration and swap partition from sinnix-prime, keep the failure evidence in comments, and adjust the storage policy test to stop expecting /cache.

Verification: nix build .#checks.x86_64-linux.nixos-host-sinnix-prime-storage-discard-policy --no-link; nix eval .#nixosConfigurations.sinnix-prime.config.swapDevices returns [].

* fix: keep syslog indexes user-readable

Problem: syslog-index runs as root so its derived manifest and JSONL outputs were replaced as root:root 0600, making the no-loss navigation layer unreadable to normal Lynchpin/user analysis even though the raw journal remains canonical.

What changed: after each atomic replace, inherit ownership from the index directory and chmod outputs to 0640. Raw syslog/journal files are not modified.

Verification: python3 -m py_compile scripts/syslog-index; tmp fixture run produced 0640 index files and correct manifest counts.

* chore: deploy polylogue catch-up fixes

Problem: polylogued catch-up was still able to dominate workstation I/O after prior daemon fixes. The live archive showed a full-corpus rehash caused by inode/device churn, followed by an action FTS convergence probe that scanned the FTS table.

What changed: deploy Polylogue through 62193c7, including the durable catch-up observability, inode-churn fast skip, and indexed action-event FTS probe fixes. Point Lynchpin at the same top-level Polylogue input, keep Sinex at the zbus lockfile fix, and run the Polylogue user service as a systemd-managed background I/O workload with Nice=10, IOSchedulingClass=idle, and IOWeight=10.

Verification:
- nix build .#checks.x86_64-linux.nixos-services-polylogue --no-link
- sudo nix run --accept-flake-config .#switch
- deployed polylogue binary reports 0.1.0+62193c7
- polylogued.service shows Nice=10, IOSchedulingClass=idle, IOWeight=10

* chore: deploy bounded polylogue daemon startup

Problem: the live Polylogue daemon had already hit an OOM-prone workload and restart could repeat the failure if the packaged service kept running without a memory envelope or without the merged bounded-startup daemon fixes.\n\nWhat changed: advance the Polylogue flake input to 566001f5, which includes the residual-workload and bounded FTS startup PRs, and expose MemoryHigh/MemoryMax on the user service with defaults of 8G/12G.\n\nVerification: nix eval confirmed the rendered user service MemoryHigh=8G and MemoryMax=12G, sudo nix run .#switch completed successfully, the active unit runs polylogue 0.1.0+566001f, and live daemon-workload-probe reports failed=0, running=0, convergence_debt.failed_count=0 with indexed source/FTS query plans.\n\nResidual evidence: the daemon now starts and reaches convergence quickly, but active large session files still produce per-update replacement/FTS/insight work; that is live churn, not catch-up debt.

* chore: ignore .cache/ for verify-hook output

A local verify hook writes /realm/project/sinnix/.cache/{last-verify-result.json,verify-history.jsonl}. These are derived per-machine state, not project source.

* fix(observability): restore indefinite below, NVML 1 Hz GPU, daily lynchpin

Problem: a wave of "contain workstation pressure" changes (commit 1972154 on 2026-05-02 and follow-ups) and an in-flight below.nix refactor reduced the answer surface for "what happened during pressure" exactly when it matters.

What changed:

- below.nix: delete retentionDays option, below-prune service, and below-prune timer. Storage is indefinite (~720 MB/day at 1 s with dict-compress chunk-32 = ~260 GB/year, well within budget on root SSD).
- lynchpin.nix: daily substrate refresh instead of weekly (Sun 03:00 -> *-*-* 03:00:00) so the analysis surface does not lag the week.
- machine-telemetry.nix: replace nvidia-smi subprocess in gpu_metrics() with a pynvml-backed implementation (direct libnvidia-ml.so calls, sub-ms per sample); add a dedicated 1 Hz sampler thread that writes a new gpu_sample table; add gpuIntervalSec option (default 1.0) and --gpu-interval CLI flag; expose LD_LIBRARY_PATH=/run/opengl-driver/lib when sinnix.gpu.mode != "igpu". Also lower serviceIntervalSec 60 -> 10 so per-unit IO bytes are attributable at below-comparable resolution.
- introspection.nix: switch the captureMonitoring entry from power-watchdog to machine-telemetry (already retired) and rename the captures path accordingly.

Verification:
- nix-instantiate --parse on each edited file.
- below.service restarted; 68 indefinite-coverage data shards now present (2026-03-09 -> 2026-05-15).
- Borg exclude follows in a separate commit so the change to /var/log/below capture survives backup growth.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(backup): fix borg appendFailedSuffix, denser btrbk, broaden excludes

Problem: borgWrapper's never-true -z check meant any borg create exiting with code 1 left every archive permanently renamed .failed. btrbk retention used a sparse legacy schema. Realm + persist Borg jobs scanned and chunked ~440 GB of regenerable/runtime state on every archive: sinex's misplaced NATS JetStream + PostgreSQL data dir (~295 GB under /realm/data/captures/sinex/), polylogue archive (~123 GB regenerable from upstream), syslog exports (~21 GB derived from journald), the just-uncapped below store (~52 GB and growing), and the user cache directory.

What changed:

- borg: set appendFailedSuffix=false; add --lock-wait 7200 so HDD spin-up or a stale lock from a crashed prior job doesn't fail the next one.
- borg: drop borgMemoryHigh/Max + maintenanceSlice/maintenanceServiceConfig/maintenanceGate infrastructure (the maintenance slice gate was redundant with the explicit timer windows and added friction).
- btrbk: replace the "30-min then hourly then drop" schema with the simpler "snapshot_preserve_min latest, snapshot_preserve 6h" pattern aligned with the 4h Borg cadence.
- persist exclude list: add var/log/below (indefinite-retention post-mortem store; recover from live host, not backup) and home/sinity/.cache (catch-all replacing per-cache lines for sccache 11G, sinex client cache 6G, media-preview-cache 5G, uv 2.5G, chrome 1.6G, ms-playwright 635M — all regenerable).
- realm exclude list: add **/data/captures/sinex/state and /postgresql (~295 GB sinex runtime; TODO relocate to /var/lib/sinex via SINEX_STATE_DIR), **/data/captures/polylogue (regenerable via `polylogue run acquire parse materialize`), **/data/captures/syslog (re-exportable from journald).

Verification:
- nix-instantiate --parse on both files.
- borg info /outer-realm/backup/borg-persist-v1 confirmed dedup is doing the work (11.56 TB original -> 494 GB dedup); excludes cut per-archive working set, not total dedup'd footprint.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* refactor(sinex/bridge): drop maintenance slice + gate, relocate NATS state

What changed:

- Drop helpers + sinnix-maintenance-gate plumbing from the sinex bridge. The maintenanceGate / maintenanceServiceConfig wrappers added a slice + gate layer on top of the upstream sinex resource policy. Workstation containment is now expressed through upstream services.sinex.runtime.* / .bootstrap.* / .nats.killPolicy instead of a sinnix-side gate.
- Relocate NATS state from /cache/nats/jetstream to /var/lib/nats (the /cache mountpoint was decommissioned with the failed NVMe; /var/lib is the canonical persistent state path).
- Drop per-node MemoryMax/CPUQuota hard cap suppression that targeted older pinned sinex inputs; current sinex no longer emits those.
- Update bridge.test.nix to assert the new shape (no maintenance slice, NATS state under /var/lib/nats).

Verification:
- nix-instantiate --parse passes on both files.
- Test assertions align with the new structure (verified by inspection; full check pending sinnix-rebuild switch).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(audio): standalone ASR + audio daemon with local + Cohere backends

What changed:

- audio-capture.nix: add asrProvider option (local | cohere | cohere-api) with sensible defaults — local faster-whisper "small" by default, with Cohere Transcribe (open weights or API) as opt-in alternatives. Threading through cohereModel/Revision/ApiModel/Language/ApiKeyFile/MaxNewTokens options.
- audio-capture.nix: add preferredSourcePattern regex (defaults to Blue Yeti) so the daemon transcribes only the intended physical mic, with a separate transcriptDir for JSONL output alongside the opus archive.
- New scripts/sinnix-asr-server: ASR HTTP service on port 7778 routing to the configured backend.
- New scripts/sinnix-audio-daemon: continuous PipeWire capture with VAD, preferred-source filtering, opus archival, and live transcription.
- secrets.nix: add cohere-api-key for the cohere-api backend.

Verification:
- nix-instantiate --parse on all edited Nix files.
- Scripts pass `@sinnix-package: skip` marker — installed by audio-capture module, not auto-packaged.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(chatgpt-mcp): support CHATGPT_MCP_HOST override and API-key strict-auth

What changed:

- Add cfg.host with CHATGPT_MCP_HOST env override and pass --host explicitly to mcpo.
- Load CHATGPT_MCP_API_KEY from systemd CREDENTIALS_DIRECTORY/api-key when not already set in env; when an API key is present pass it to mcpo as --api-key X --strict-auth.

Verification: nix-instantiate --parse.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore: drop modules/panic-log-capture.sh (inlined into modules/performance.nix)

The script body now lives inside performance.nix as a writeShellScriptBin
call, with performance.test.nix asserting the ExecStart uses the packaged
binary rather than the sibling .sh file (which is non-executable in the
nix store and would fail at activation). The file became dead the moment
that test passed; this commit removes it.

* chore(cli/core): drop /cache-era helpers; add fio; fix knowledgebase path

What changed:

- Drop [email protected] MemoryHigh/Max/SwapMax overrides (the /cache failure investigation deprioritized the per-instance coredump cap; coredumps storage is already set to "none").
- Drop _sinnix_project_cache_setup helper and its call site. It exported SINEX_DEV_CACHE_ROOT under /cache/sinex; /cache was the failed NVMe and was decommissioned.
- Fix project-root match: /realm/project/knowledgebase -> /realm/data/knowledgebase (canonical knowledgebase lives in /realm/data).
- Add fio to home.packages so block-device benchmarking is declaratively available without ad-hoc nix-shell.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(host): re-enable Transmission autoStart on sinnix-prime

Was disabled in commit 9588b0a as a temporary measure during the workstation performance investigation. With turbo enabled, PCIe at native generation, and observability restored, the investigation reasons no longer apply. Re-enabling so transmission-autostart.timer installs and Transmission seeds again after boot. sentinel still honors restartable=false (manual stops not fought).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(hyprland): keep debug logs disabled by default

Hyprland's `debug.disable_logs` + `enable_stdout_logs` were turned back
on for "post-mortem crash analysis", but the practical cost is constant
journal noise from a healthy compositor. Reset to the upstream-quiet
defaults and lock the choice with a feature test so a future drift back
to verbose logs needs explicit policy.

Targeted forensics still works: flip `disable_logs = false;
enable_stdout_logs = true;` for one rebuild when actively bisecting a
crash.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(boot): enable memtest86 + Intel microcode updates

Two low-cost reliability upgrades for sinnix-prime:

- systemd-boot memtest86 entry exposes a known-good memtest from the
  loader menu — no USB stick needed when investigating suspected ECC
  events or DIMM-related stalls.
- hardware.cpu.intel.updateMicrocode applies redistributable microcode
  at every boot, picking up Intel's mitigations for i7-13700K errata
  without a BIOS update.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(foundation): pin knowledgebase under /realm/data; bigger early console

Two unrelated locale/path fixes coalesced into one commit since both
touch foundation:

- foundation.realm.knowledgebase: pin to /realm/data/knowledgebase
  instead of deriving from realm.root (=/realm/project). The
  knowledgebase is data, not project source — the previous default
  silently put it under /realm/project/knowledgebase which is wrong on
  every host. Aligns with KNOWLEDGEBASE_ROOT exported elsewhere.
- console.earlySetup + ter-220n: HiDPI-friendly initrd console so boot
  messages stay legible on the 4K monitor; matches the larger TTY font
  already used post-init.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(sinnix-gw): enable + restart https-dns-proxy after uci commit

The DoH provisioning block configured Cloudflare/Quad9 endpoints but
relied on the operator to enable + start the service manually. Add an
idempotent enable+restart (with start fallback) at the end of the
provisioning script so a freshly-applied router config actually serves
DoH without a second login.

`|| true` keeps the script resilient if the service is unavailable on a
stripped OpenWrt build.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* refactor(flake): drop developerWork resource budget from rebuild slice

Removes the lib/resource-budgets.nix module and its only use site in
the dev-shell rebuild wrapper. The "developer work" budget set
CPUWeight=1 / IOWeight=1, starving nixos-rebuild relative to every
other slice — including the desktop graphical slice at weight 10000.

In practice rebuilds are bursty, not adversarial, and the 1:10000 ratio
was making routine `sw-rebuild`/`safe-rebuild` runs take materially
longer when the desktop was idle anyway. Drop the artificial cap and
let CPUWeight/IOWeight default (=100) compete fairly.

This is part of the same pressure-containment retreat as the recent
below-retention + pressureWatch restorations — over-aggressive
throttling that didn't pay for its complexity.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(flake/router): pin SSH key + bypass agent for OpenWrt access

Router SSH access was sensitive to whatever the agent was holding —
several keys + extra prompts caused silent BatchMode failures when the
correct key wasn't first in the list. Add explicit `-i ~/.ssh/id_ed25519`
plus `IdentitiesOnly=yes -o IdentityAgent=none` to both the
provisioning and the health-check paths so router operations are
deterministic regardless of agent state.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(flake): rename power-watchdog→machine-telemetry in test registry

Reflects the long-completed migration from `power-watchdog.nix` (high-
frequency power/thermal logging) to the unified `machine-telemetry.nix`
service. The test registry still pointed at the dead service name.

Also picks up a nixfmt-driven reflow in flake/scripts.nix (polylogue-python
package symlink) — purely cosmetic.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* refactor(services): stop idle-scheduling sentinel + weechat-log-sealer

Both timer-driven services were marked Nice=19 + IOSchedulingClass=idle
(plus a MemoryHigh=256M/MemoryMax=512M cap on weechat-log-sealer) under
the broader pressure-containment campaign. The cost was real failure
modes:

- sentinel is the health-monitor itself; if it can't get scheduled, the
  one signal that tells us the box is under pressure is exactly the
  signal we lose. The point of sentinel is to run promptly and report.
- weechat-log-sealer runs blake2b over IRC log files; the 256M soft cap
  was below the working-set of large archives, triggering throttling on
  every run for no useful reason.

Both jobs are bursty and complete in seconds at normal priority. Cap
removal lets them finish cleanly without the host noticing.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(hermes): raise checkpoint + turn ceilings to effectively unbounded

Default max_snapshots=50 and max_turns=90 were noticeably truncating
real Hermes sessions — long-running coding loops hit the cap mid-task,
which then cost more in re-driving the agent from scratch than the
checkpoints would have cost to keep.

Bump both to 1_000_000 (i.e. "no practical limit") and assert the new
values in the service test so they don't silently drift back. Disk
cost of checkpoints is tiny relative to chat history kept alongside.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(rawlog): default knowledgebase to /realm/data, not /realm/project

The two rawlog scripts derived their knowledgebase path from
REALM_ROOT=/realm/project, producing /realm/project/knowledgebase —
which does not exist. The real knowledgebase lives under
/realm/data/knowledgebase. Switch the env contract to REALM_DATA_ROOT
with the correct default. Matches the foundation.realm.knowledgebase
fix in the same series.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(scripts): add vr-contact-sheet for flat reprojection sheets

@sinnix-package script that generates contact sheets for VR (180/360)
videos by reprojecting equirectangular/half-sphere frames into a flat
preview grid. Inputs live under /neo-outer-realm/inbox/tdown; outputs
to a sibling tdown_contact_sheets directory.

Useful for triaging inbound VR captures before deciding what to keep —
the raw equirectangular thumbnails are unusable for content evaluation.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(dots): refresh agent docs + skills; add archive helper scripts

Bundled documentation/policy refresh for the AI-agent dotfile tree:

- .agent/includes/modules/services.md: replace power-watchdog row with
  machine-telemetry to match flake/tests.nix.
- dots/claude/{CLAUDE.md, world-model/{filesystem,projects}.md}:
  small clarifications, no behavioral change.
- dots/codex/{AGENTS.md, config.toml, skills/...}: substantial AGENTS
  trim + config.toml tweaks; refreshed system skills marker.
- dots/_ai/skills/{assured-close,evidence-harness}/SKILL.md: tightened
  guidance text.
- dots/_ai/scripts/archive-{prep,upload}.sh: new helpers used by the
  archive workflow.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* feat(sinex): relocate runtime state from /realm/data/captures/sinex to /var/lib/sinex

The old layout misused the captures namespace. /realm/data/captures/ is for
INPUT data that sinex ingests (ActivityWatch SQLite, Atuin DB exports,
GDPR exports, etc.). Sinex's own operational substrate — Postgres data
directory, NATS jetstream, CAS blob-repository, per-source-worker state —
isn't captured data; it's service runtime state and belongs at the NixOS
convention path /var/lib/sinex.

This is the 2026-05-15 wipe transition. Old state at
/realm/data/captures/sinex/ is preserved as a pg_dump snapshot at
/realm/inbox/sinex-snapshots/sinex-prod-2026-05-15.dump (~50 GB live DB
→ ~10 GB compressed) and then orphaned. New state grows fresh at
/var/lib/sinex/ under the corrected source-material lane design from
sinex PR #1289 (long-lived materials with size/time rotation).

## Why /var/lib/sinex rather than another /realm/ subdirectory

- NixOS convention. The sinex NixOS module already defaults
  stateRoot = "/var/lib/sinex"; this commit removes sinnix's override.
- Post-#1289 state size will be much smaller than the prior 292 GB
  on /realm — the bulk was per-event materials from the pre-fold
  desktop ingestor and per-poll SqliteRowAdapter materials. Both fixed.
- Root filesystem (sda2) has 452 GB free, enough headroom for the
  reduced steady-state footprint.
- If /var pressure becomes real later, bind-mount /realm/sinex into
  /var/lib/sinex as a minimal-disruption follow-up.

## Persistence

/var lives on the root subvolume which BTRFS-rollback impermanence wipes
every boot. Added `sinnix.persistence.system.directories = [ sinexRuntimeRoot ]`
so Postgres data, NATS jetstream, CAS blob-repository, and per-source-
worker state survive reboots. Without this, the next reboot silently
re-initializes the database — exactly the class of failure the
impermanence module is meant to surface, not hide.

## Variable rename

`sinexCaptureRoot` → `sinexRuntimeRoot`. The old name was wrong even
when the path lived under captures/: it's runtime state, not captures.

## Out of scope

- /var/lib/nats (system NATS) keeps its existing path; sinex's
  JetStream data lives at ${sinexRuntimeRoot}/state/nats/jetstream.
- Migrating already-running deployments is operator work (see the
  pre-wipe snapshot path above). This commit only changes config.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(machine-telemetry): correct NIC name; drop stale host overrides

Problem: machine-telemetry has been writing 9098 network_sample rows
since 2026-04-11 against a non-existent interface. The actual primary
NIC on sinnix-prime is enp4s0 — at some point the kernel naming
shifted (or the BIOS slot reassigned) and the hardcoded "enp6s0"
became dead. Effect: every row records iface_json={rx_bytes:0,
tx_bytes:0,...}, nic_json={speed_mbps:0,link:"unknown"}, and the
service self-reports "network.interface_missing" in gap_codes_json.
~34 days of bandwidth + link + NIC-error counters lost.

Ping/DNS data was unaffected (routing-resolved, not iface-bound), so
the gap survived undetected.

What changed:
- Module default "enp6s0" -> "enp4s0" in both the Nix mkOption default
  and the Python argparse default, so a stock machine-telemetry import
  picks the live NIC on this generation of the host.
- Drop the entire sinnix-prime host override block for machine-
  telemetry. Five of its six fields restated module defaults verbatim;
  the sixth (serviceIntervalSec = 60) silently reverted commit 7b3f87c
  which lowered the module default to 10 so per-unit IO bytes stay
  attributable at below-comparable resolution. Host config now carries
  only `enable = true;` — deviation, not duplication.

Verification:
- nix-instantiate --parse on both files.
- Post-rebuild: confirm `interface=enp4s0` in newest network_sample row
  and that iface_json has non-zero rx_bytes/tx_bytes within one cycle.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(backup): exclude /var/lib/sinex from borg persist job

Sinex service runtime state (Postgres data ~50G, NATS JetStream ~40G,
CAS blob-repository ~200G, per-source-worker state) does not belong in
the persist borg backup. Including it would multiply repo size by
~150 GB per backup snapshot for data that's already either:

- content-addressed via BLAKE3 — CAS blobs only recoverable via
  re-ingestion from their source materials, not from a tarball copy
- transient — NATS event queue + KV state, restoring stale state
  would conflict with current ingestd cursors
- pg-managed — the right backup tool is pg_basebackup / pg_dump,
  which already exists at docs/operations/backup.md and a one-shot
  `sinexctl admin snapshot` (sinex PR #1287)

The exclusion pairs with the runtime-state relocation
(/realm/data/captures/sinex → /var/lib/sinex) in the parent sinex
bridge commit. Persistence declaration ensures /var/lib/sinex
survives BTRFS-rollback impermanence; backup exclusion ensures
this 290+ GB of state doesn't get archived as part of the persist
job.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(flake): bump sinex input to master 5239fd3d (post-redesign)

Deploys all the sinex-side fixes landed during the 2026-05-15 horizon-3
session:

- #1284 heartbeat-status collision fix (root operational fire — 5
  automatons silently stuck in consume-without-emit since boot)
- #1288 MemoryMax hard caps on automata profiles (defensive against
  future leaks)
- #1289 long-lived source materials with size/time rotation (#1285
  Slice A — the load-bearing fix for registry growth bounded by
  rotation count, not poll count)
- #1291 sinexctl admin snapshot MVP (#1287 — runtime state backup)
- #1292 access-setup units now requiredBy beforeUnits (#1290 — fixes
  the silent ACL bridge failure that was the actual cause of
  ActivityWatch DLQ spam)

Combined with the local sinnix changes:
- /var/lib/sinex relocation (out of the captures/ namespace)
- impermanence persistence declaration
- borg backup exclusion

This is the input bump that activates all of it on the live host.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(flake): re-bump sinex to pull #1293 (Cargo.toml duplicate csv fix)

* chore(flake): bump sinex to pull #1294 Cargo.lock refresh

* chore(flake): bump sinex to pull #1295 (conflict-marker leftover fix)

* chore(flake): bump sinex to pull #1296 borrow-checker fix

* chore(flake): bump sinex to pull #1297

* chore(flake): bump sinex to pull #1298 + #1299

* feat(observability): capture full PSI windows

Problem: machine-telemetry only stored PSI avg10 values, which loses the avg60/avg300 windows and monotonic total counters needed to separate short spikes from sustained pressure.

What changed: bump the machine-telemetry schema version, add avg60/avg300/total fields for CPU, IO, and memory PSI, write the new fields on every metric sample, and add an in-place SQLite column migration so the existing telemetry database upgrades on the next service start.

Verification: nix-instantiate --parse modules/services/machine-telemetry.nix.

* chore: bump sinex to 2925ba956 (#1303 jetstream retention + db pool shrink)

* feat(sinex/bridge): use upstream runtime-target gating

Sinex#1306 lets the upstream module own auxiliary unit gating: the
wantedBy stripping for bootstrap one-shots, the sinex-runtime.target
wants graph, the deferred-start timer, and the document-scan timer
PartOf wiring. This bridge no longer needs to recompute any of that.

Bridge shrinks from 543 lines to 441 lines. Removed:

- the delayedRuntimeServices / delayedRuntimeTargets / delayedRuntimeUnits
  enumeration and per-unit lib.genAttrs overrides
- the bridgeRuntimePolicy / maintenanceServicePolicy attribute sets
- the legacyCaptureRuntimeServicePolicy mkIf compatibility shim
- the manual sinex-runtime.target wants graph assembly
- the bridge-side sinex-runtime.timer definition
- the per-host postgresql-setup ConditionPathIsReadable wiring
- the manual sinex-runtime auto-start timer with timer-target gating

Replaced by upstream options:

- services.sinex.runtime.target.{includeDatabase,extraAfter}
- services.sinex.runtime.deferredStart.{enable,autoStart,delay,accuracy}
- services.sinex.database.setupWaitForPaths

What stays in the bridge (genuinely host-specific):

- sinex runtime package selection from the flake input
- secrets path mapping into services.sinex.secrets.paths
- /var/lib/sinex storage layout (postgres dir, NATS dir, sinex user home)
- workstation resource policy: clear the heavy-automaton kill-fences
  the upstream module sets as MemoryMax/CPUQuota caps
- RequiresMountsFor on postgresql for the /var/lib/sinex mount
- maintenance-timer plain-policy override (Persistent=false, scheduler
  bias stripped) for sinex-document-scan
- activation-profile mapping from cfg.activationProfile to per-node
  enable flags
- the !runtimeEnabled disable-everything block (prepareHost without
  enable should not light up nodes/observability/lifecycle)
- the sinex-runtime.target wants += network-online.target so the
  module's extraAfter ordering has a corresponding dependency edge

bridge.test.nix updated to filter out invoked_on_demand monitor units
from restartableRuntimeServices; those carry Restart=no by design and
must not be subject to the long-running-service restart-policy
assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* chore(flake): bump sinex to #1305 (nixos runtime-target ownership)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: Codex <[email protected]>
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.

2 participants