# Circe PR 9 review

Eight implementation gaps addressed in a separate corrective PR. Product completeness is not established; live validation is blocked and application language workflows remain.

Corrective PR: https://github.com/Absterrg0/circe/pull/10

Baseline: 5dc176f80246d2ee672a166e9a8f5026c9aece5e
Corrective head: 927c9ea409b3c6c6133ca5e3dc00af2b64d5c97f

PR #9 addresses the previous audit’s largest structural gap: semantic context now survives restart alongside kernel state, and a continuing host rebuilds discourse instead of starting every call empty. PR #8 is already in its base, and all 147 earlier independent review checks still pass. This review did not duplicate those earlier fixes.

The remaining defects are integration ownership problems. The host must own observation identity, the decision evidence preceding execution, and serialization of calls that share a clock and discourse. Leaving these responsibilities to individual callers would recreate the same alternate-entry-point drift seen in the earlier PR stack.

The third accepted-turn log is justified because a semantic abstention creates no kernel command to deduplicate. It records the first interpretation before consequences. The kernel still owns authorization, effects and reconciliation; the context store still owns evidence. The files are ordered append boundaries, not an atomic multi-file transaction. This distinction is documented and the pre-dispatch cut is tested.

The corrective change adds no external runtime dependency and does not rewrite the kernel. Most additions are regression tests, the live HTTP mapping, and a small turn snapshot codec. That is proportionate to the failures found. I would keep these boundaries and resist adding a general orchestration framework. The append-only JSONL adapters still read whole logs and lack compaction, so long-lived scale remains unproven.

## F77 Persist the decisions that justified commands

PR #9 records frames and observations, but runTurn never writes run.traces to its semantic store. The durable context adapter can store decisions, yet the real host omits them. A successful operation therefore survives restart without its original decision evidence in the context store.

The corrected host persists the actual decision traces before entering the command loop and permits only identical provenance on a retry. Two existing host tests gained assertions that fail on the original PR. Restart and first-turn execution retain the same trace identities.

Verification: host.test.ts checks decision persistence on initial execution and after reopening.

## F78 Reuse the first interpretation when an observation is retried

PR #9 invokes perception again on every runTurn delivery. Stable kernel command IDs cannot protect an observation that originally abstained, and they do not pin the number or meaning of a later interpretation. Retrying after a restart can ask a nondeterministic model to turn an earlier abstention into new work.

The host now appends the first interpreted turn before trace writes or dispatch. Reopening uses that snapshot, checks the input fingerprint, and redelivers exactly its compiled commands. This also covers a failure immediately before dispatch. The log preserves workflow Maps explicitly; recovery checks provenance and recompiles the saved semantic turn before accepting its commands.

Verification: host.test.ts covers completed replay, abstention, conflicting input and the pre-dispatch cut; turn-store.test.ts covers Maps, detached reads, conflicts and corrupt records.

## F79 Serialize calls that share the interaction clock and discourse

The original host lets simultaneous runTurn and ingest calls operate on one runtime and mutable clock. A later call can change the time while an earlier perception call is suspended. Both turns can assemble against discourse that has not incorporated the other operation.

A single per-host promise queue now orders turns, observations, commands and reconciliation. Inputs are cloned before joining the queue, so caller mutation during the wait cannot change the operation. A concurrency regression observes overlapping backend work on PR #9 and a maximum of one active turn after the fix.

Verification: host.test.ts checks simultaneous calls, pre-enqueue snapshots and persisted provenance.

## F80 Expose recovery and confirmation through the continuing host

The file host can reconstruct a confirmation gate or UNKNOWN effect, but its public API only offers ingestion and request-oriented semantic turns. The underlying runtime is private. Application callers cannot use the kernel’s typed confirm or reconcile methods through this host.

The host now exposes command and reconcile, using the same queue and clock as other operations. Retained tests restart before confirmation and after a lost invocation response; confirmation executes once and reconciliation resolves the recorded application without invoking again. This supplies typed controls. It does not implement an English confirmation/correction workflow.

Verification: host.test.ts exercises both missing APIs through real file-backed restart; both fail as absent methods on the original PR.

## F81 Apply the same canonical context values before and after restart

PR #9 validates and appends context operations, then applies their original input objects in memory. Replay applies the decoder’s normalized shape instead. An entity with an extra runtime property therefore has different content before and after reopening. Probability decoding also drops an own __proto__ key, and the writer accepts sparse or symbol-keyed input that JSON cannot faithfully preserve.

The writer now decodes the encoded operation before appending and applies that canonical value immediately. Numeric records preserve own keys; unrepresentable values and a second format header are rejected. These changes reuse the existing codec rather than introduce a second persistence model.

Verification: context-file/index.test.ts has four failing comparisons on PR #9, covering canonical parity, probability ownership, invalid input and repeated headers.

## F82 Reject invalid UTF-8 in completed log records

The original file reader decodes bytes with replacement semantics. Invalid UTF-8 inside a completed JSON string can become the replacement character while the record remains syntactically valid. Evidence has then changed without a corruption error.

The reader now uses fatal UTF-8 decoding and physical byte offsets. Completed corrupt records fail; an unterminated torn fragment is repaired at the last valid append boundary. The completed-record test fails on PR #9. The torn-fragment regression also passes on the original code and is a preservation control, not evidence of a second defect.

Verification: file-log/index.test.ts tests completed UTF-8 corruption and torn-tail repair; all 41 journal regressions remain green.

## F83 Evaluate applied outcomes rather than effect IDs

The original evaluation can pass after an executor returns EXECUTION_ERROR because its command and effect-count checks still match. Its fixture client also searches ahead for a convenient matching question set, masking a wrong call sequence. It has no active injected-client option for running the same cases against a real provider.

The corrected evaluation requires successful effects and actual expected target invocation, checks no mutation on abstention, consumes the next fixture strictly, accepts an injected client, and counts actual calls instead of cached run metadata. Each evaluation gets fresh files. Failures remain visible as case checks. The unchanged fixture suite remains a pipeline test rather than semantic accuracy evidence.

Verification: heldout-review.test.ts covers a failed executor, transcript skipping, injection, redelivery call counts and independent evaluation directories.

## F84 Provide a runnable live bounded-decision transport

PR #9 explicitly leaves the live transport to a future host. The injected interface and hand-written answers therefore do not demonstrate the original product requirement of language passing through real semantic decisions into safe execution.

The corrective branch adds a native-fetch TypeSafe System One client and eval:live entry point. It maps bounded questions, validates answer keys and distributions, handles HTTP errors and timeouts, and preserves returned model metadata. Its live corpus includes a request/query decision so a query cannot become a mutation through referent selection alone.

This closes the missing code path only. Mock HTTP tests and mocked live-workflow controls pass, but no API key or account-supported model is configured. No real-model call or accuracy result exists. That remains an external validation blocker and is not represented as completed product behavior.

Verification: Seven additional Jev transport tests, two mocked live-workflow controls, and an explicit no-credentials exit check. Official contract: https://api.typesafe.ai/openapi.json.

## Remaining product work

Live semantic evidence is blocked: No TYPESAFE_API_KEY or TYPESAFE_MODEL is configured. The live command exits before making a call. Configure them in /home/abstergo/.config/circe/typesafe.env outside Git to enable the next verification. Do not paste the secret into the task. The HTTP mapping was checked against TypeSafe’s official OpenAPI document, but credentials and a real response are still needed.

The language product is not finished: Typed confirmation, revision, cancellation, resumption and reconciliation are available. The current request-oriented demo does not supply a general natural-language control or query-response workflow. The five synthetic live cases exercise a narrow slice. They are not a representative interpretation benchmark, and thresholds are not calibrated against observed outcomes.

Durable storage is not automatic semantic learning: The context adapter can persist annotations, assertions and phrase bindings; the host persists authority observations, frames, traces and interpreted turns. Applications still need to decide which accepted semantic results become durable beliefs or bindings. Persisted decision traces alone do not establish that the system learns reusable semantic knowledge.

Storage operating contract remains limited: One process owns each store path. Multi-process locking, migrations beyond current format checks, retention and compaction are not implemented. No performance claim for unbounded histories is supported by this review.

{
  "baselineTests": 438,
  "finalTests": 466,
  "externalChecks": 147,
  "baselineComparison": {
    "failed": 17,
    "passed": 23
  },
  "typecheck": "pass",
  "boundaries": "pass",
  "fixtureCases": 5,
  "live": "not run: missing API credentials/model"
}
