oxidizer: AIValidateResponseServerCommand → cognition/validate-response-decision (one PR)#1426
Merged
Merged
Conversation
…se-decision (one PR per zero-users directive)
Single-PR oxidizer per Joel 2026-05-18 19:44Z directive (zero users,
full-blown Rust-driven dev, no migration ceremony). Adds the Rust
cognition path AND replaces the TS parallel reimplementation in the
same commit — no 4-PR cadence.
Renamed command + binding from `cognition/validate-response` to
`cognition/validate-response-decision` to avoid collision with the
existing persona-validator surface (which already owns
`cognition/validate-response` in modules/cognition.rs:814).
## What this ships
Rust:
- `cognition/validate_response.rs` (~380 LOC + 14 tests):
- `ValidateResponseRequest` / `ValidateResponseDecision` /
`ResponseDecision` (ts-rs exported)
- `ValidateResponseError` typed enum (NoAdapter / Generation)
- `build_validate_prompt` — pure prompt builder (mirrors TS template
byte-for-byte modulo substitutions)
- `parse_decision` — pure one-word parser (SUBMIT/CLARIFY/SILENT)
with TS-parity precedence: CLARIFY > SILENT > Submit (fail-open
default)
- `reason_for` — canonical reason strings
- `evaluate_validate_response` — async orchestrator (Groq via
existing registry, llama-3.1-8b-instant default, temp 0.1,
max 10 tokens)
- `modules/cognition.rs`: `cognition/validate-response-decision` IPC arm
- ts-rs barrel adds 3 new types (cognition/{ResponseDecision,
ValidateResponseDecision, ValidateResponseRequest}.ts)
TS:
- `bindings/modules/cognition.ts`: new
`cognitionValidateResponseDecision` binding method.
- `commands/ai/validate-response/server/AIValidateResponseServerCommand.ts`:
thin shim. Deletes inline prompt template, parseDecision,
getReasonForDecision, AIProviderDaemon/TextGenerationRequest/
LOCAL_MODELS imports.
## Discipline
- One PR carries Rust + TS shim + dead-TS delete (zero-users mode).
- All errors typed (NoAdapter, Generation). No silent default-on-error.
- Fail-open SUBMIT default in parser matches TS behavior (silence
more user-hostile than off-topic).
- Clippy held at 157 baseline (resolved 1 new unreachable-pattern
warning by renaming colliding match arm).
## Tests
- 14 logic + ts-rs tests pass (`cognition::validate_response::*`)
- npm run build:ts clean
- Clippy at baseline
## Refs
- Joel 2026-05-18 19:44Z: zero-users full-blown-Rust-dev mode →
one PR per oxidizer
- Sibling: codex's #1383 + my #1402/#1421 pattern (one-PR delegation)
- #1248 umbrella
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joelteply
added a commit
that referenced
this pull request
May 25, 2026
…1438) RAG-mode generation now delegates to Rust via AIDecisionService — the same IPC seam PersonaUser's response path already uses. Rust owns prompt assembly (system prompt + history + time prefixes + hour-gap markers + identity reminder), provider routing, admission gating, timeout, and token-usage stamping (build_response_messages + build_response_generation_request in cognition/generate_response.rs). Direct-message + preview modes stay TS-side: - Direct mode is an introspection/test path that bypasses admission; Rust intentionally does not expose a "skip the gate" code path. - Preview mode reconstructs the request Rust would build as a local mirror. Source of truth is the Rust path; if assembly drifts a `cognition/preview-request` IPC is the fix. Mirrors the pattern from #1421 (should-respond) and #1426 (validate-response-decision). The 100-line of TS message-building that duplicated build_response_messages now lives only in Rust. Co-authored-by: Test <test@test.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Single-PR oxidizer per Joel directive 2026-05-18 19:44Z (zero users, full-blown Rust-driven dev, no migration ceremony). Adds Rust path + replaces TS parallel reimpl + deletes dead TS in one PR — no 4-PR cadence.
Renamed command + binding to
cognition/validate-response-decisionto avoid collision with the existing persona-validator surface (which already ownscognition/validate-response).What this ships
Rust (
cognition/validate_response.rs, ~380 LOC + 14 tests):ValidateResponseRequest/ValidateResponseDecision/ResponseDecision(ts-rs)ValidateResponseErrortyped enum (NoAdapter / Generation)build_validate_prompt— pure, mirrors TS template byte-for-byteparse_decision— pure one-word parser (SUBMIT/CLARIFY/SILENT), TS-parity precedence: CLARIFY > SILENT > Submit (fail-open default)reason_for— canonical reason stringsevaluate_validate_response— async (Groq via existing registry; llama-3.1-8b-instant default; temp 0.1; max 10 tokens)IPC:
cognition/validate-response-decisioncommand arm in CognitionModule.TS mixin: new
cognitionValidateResponseDecision(params)binding method.TS command shim:
AIValidateResponseServerCommand.tsnow delegates. Deletes inline prompt template,parseDecision,getReasonForDecision, 3 unused imports.Ratchet: ESLint baseline locked 5433 → 5432.
Discipline
Verification
cargo test cognition::validate_response::— 14/14 passnpm run build:ts— cleanRefs
🤖 Generated with Claude Code