···199199| Config (`config/journal.json`) | `solstone/think/journal_config.py` |
200200| Schedules (`config/schedules.json`) | `solstone/think/schedule_config.py` |
201201| Push devices (`config/push_devices.json`) | `solstone/think/push/devices.py` |
202202+| Local inference operational telemetry (`health/local-inference/YYYYMMDD.jsonl`) | `solstone/think/providers/local_admission.py` |
202203| Hosted backup binding (`backup/hosted/binding.json`) | `solstone/think/backup/hosted.py` |
203204| Convey config (`config/convey.json`) | `solstone/convey/config.py` + `solstone/think/facets.py` |
204205| Chat config (`config/chat.json`) | `solstone/apps/chat/config.py` |
···211212| Index (SQLite, `indexer/*`) | `solstone/think/indexer/*` |
212213| Observer registry and sync history (`apps/observer/observers/*.json`, `apps/observer/observers/*/hist/*.jsonl`) | `solstone/apps/observer/utils.py` |
213214| Import ingest/resolve staging (`imports/**`) | `solstone/apps/import/ingest.py` + `solstone/apps/import/resolve.py` + `solstone/apps/import/facet_ingest.py` + `solstone/apps/import/journal_sources.py` — HTTP-ingest + resolve staging state, plus the remote-ingest bundle under `imports/<id>/`. `journal_sources.py` owns only its `create_state_directory` `imports/` initializers; its source registry is app-storage. Import-bundle and sync-cursor content under `imports/<id>/` and `imports/<backend>.json` is written by `solstone/think/importers/{utils,cli,shared,sync}.py` (local/CLI import flows + sync cursor), and `solstone/think/importers/plaud.py` installs streamed imported audio onto `imports/<id>/<name>` via journal_io's `install_file` primitive, as importer declared outputs (L7). |
214214-| Operational-log/cache pruning and root task-log compaction — deletion/compaction only, across the dated allowlist (`chronicle/<day>/health/*.{log,jsonl}`, top-level `talents/<talent>/<epoch_ms>.jsonl` run logs + `talents/<YYYYMMDD>.jsonl` day indexes, `tokens/`, `awareness/`, `config/actions/`, `facets/*/logs/`, `apps/observer/observers/*/hist/`, `.cache/cogitate-history/`) plus root `task_log.txt` epoch lines older than the same retention window | `solstone/think/log_retention.py` — prunes derived/operational artifacts by retention age and rewrites only root `task_log.txt` during compaction, preserving recent and unparseable lines. Routes its own deletes/compaction; does not write through each domain's owner. |
215215+| Operational-log/cache pruning and root task-log compaction — deletion/compaction only, across the dated allowlist (`chronicle/<day>/health/*.{log,jsonl}`, top-level `talents/<talent>/<epoch_ms>.jsonl` run logs + `talents/<YYYYMMDD>.jsonl` day indexes, `tokens/`, `health/local-inference/`, `awareness/`, `config/actions/`, `facets/*/logs/`, `apps/observer/observers/*/hist/`, `.cache/cogitate-history/`) plus root `task_log.txt` epoch lines older than the same retention window | `solstone/think/log_retention.py` — prunes derived/operational artifacts by retention age and rewrites only root `task_log.txt` during compaction, preserving recent and unparseable lines. Routes its own deletes/compaction; does not write through each domain's owner. |
215216216217If you're about to write to a domain from a module not in this table, stop and route through the owner.
217218
···224224- Return usage in `GenerateResult["usage"]` - wrapper handles logging
225225- For `run_cogitate()`, include usage in the `finish` event
226226227227+## Bundled-local admission and inference telemetry
228228+229229+The `local` provider has one shared admission boundary for the supervisor-owned
230230+Qwen server. It applies only when `providers.local` resolves to the bundled
231231+loopback runtime. A configured OpenAI-compatible endpoint and every cloud
232232+provider bypass this boundary.
233233+234234+Capacity remains explicit and intentionally small:
235235+236236+| Runtime profile | Serving capacity | Evidence |
237237+|---|---:|---|
238238+| Linux floor | 1 | supervisor `ServerTier`; live `/props.total_slots` wins |
239239+| Linux capable (at least 16 GiB tiering VRAM) | 2 | supervisor `ServerTier`; live `/props.total_slots` wins |
240240+| Apple MLX | 1 | conservative explicit fallback because mlx-vlm 0.6.2 does not advertise a slot limit |
241241+242242+The provider memoizes the capacity once per process. It first reads live
243243+`/props.total_slots`, then the persisted `health/local.ctx` launch tier, then
244244+falls back to one. The supervisor remains the configuration owner: changing a
245245+Linux tier's `parallel_slots` changes both `llama-server --parallel` and provider
246246+admission after the journal processes restart. Apple stays at one until that
247247+runtime exposes a stable capacity contract and a separate measurement justifies
248248+raising it.
249249+250250+Admission uses one `flock` file per slot under
251251+`health/local-inference-admission/`. This coordinates independent journal
252252+processes without a scheduler service or in-memory queue. Waiting async calls
253253+are cancellation-safe; exceptions and cancellation release acquired locks;
254254+process exit releases kernel locks. Queue time consumes the caller's existing
255255+provider deadline, so waiting cannot silently extend a request beyond its
256256+configured timeout. Cogitate holds one permit for its run because the OpenHands
257257+SDK owns its internal multi-turn HTTP calls; this is conservative and avoids an
258258+uncontrolled second path to the same server.
259259+260260+Every bundled-local attempt appends a content-free JSON record to
261261+`health/local-inference/YYYYMMDD.jsonl`. These files follow the configured
262262+`retention.journal_logs.days` policy. Records contain:
263263+264264+- request id, timestamp, generate/cogitate kind, provider, logical model, and
265265+ runtime profile;
266266+- serving capacity, evidence source, admission slot, and client queue wait;
267267+- client wall time plus server prompt-evaluation, generation, and total timing
268268+ when the response exposes them;
269269+- prompt/generated token counts, reused prompt tokens, prompt-cache cold/warm
270270+ state, and selected server slot when exposed;
271271+- retry index, finish reason, outcome, timeout/cancellation flags, and a safe
272272+ reason code on failure.
273273+274274+Records never contain prompt text, generated text, messages, schemas, images,
275275+endpoint URLs, or credentials. A successful `GenerateResult` also carries the
276276+same record as `inference`; callers that already retain the full result can use
277277+it without rereading the log. Fields unavailable from a runtime remain null or
278278+`unknown` rather than being inferred.
279279+280280+Run the synthetic journal-shaped benchmark against an isolated server:
281281+282282+```bash
283283+python scripts/benchmark_local_inference_admission.py \
284284+ --endpoint http://127.0.0.1:8080 --slots 2 --concurrency 10 \
285285+ --requests 30 --mode baseline
286286+python scripts/benchmark_local_inference_admission.py \
287287+ --endpoint http://127.0.0.1:8080 --slots 2 --concurrency 10 \
288288+ --requests 30 --mode admitted
289289+```
290290+291291+It reports throughput, latency P50/P95/P99, explicit queue wait, residual opaque
292292+wait, failures, and NVIDIA peak memory/utilization when `nvidia-smi` is present.
293293+The payloads are fixed synthetic text/JSON requests and never read a journal.
294294+295295+The implementation gate on `fedora.local` used a fresh b9957 server with two
296296+slots, ten producers, and twelve mixed requests for each side. Baseline versus
297297+admitted results were 0.1291 versus 0.1296 requests/s, P95 latency 78.71 versus
298298+77.22 seconds, P99 80.28 versus 77.30 seconds, and identical 4,652 MiB peak GPU
299299+memory. Most importantly, P95 wait hidden inside the server fell from 65.56
300300+seconds to 1.22 seconds; the admitted run reported 62.38 seconds as explicit
301301+client queue wait. The boundary preserved throughput, slightly improved the
302302+tail, and made the backlog observable without changing model work.
303303+304304+Rollback is one code revert plus a journal-process restart. The lock files hold
305305+no state and may remain on disk; removing the provider calls to
306306+`acquire_local_slot*()` immediately restores server-side queueing. Telemetry
307307+JSONL files are ordinary operational logs and can remain until retention prunes
308308+them.
309309+227310## Context & Routing
228311229312Context strings determine provider and model selection. Providers receive already-resolved models, but understanding the system helps: