3.7 KiB
Architecture
Purpose
whetstone_RSA should be a callable library for bounded fuzzy decisions, not a
general chat model.
The reusable unit is not "a small transformer." The reusable unit is:
- a finite decision space
- a compact policy over that space
- a deterministic executor behind it
Core Runtime
The library should expose one high-level operation:
decide(input, schema, context) -> decision_result
Where:
inputis natural language or a compact structured descriptionschemadefines the legal decision spacecontextcarries app-specific state
The runtime returns:
decision_idslotsconfidenceabstainescalation_targettrace
Main Components
1. Decision Schema
Defines the bounded output surface:
- enum labels
- slot definitions
- required vs optional fields
- validity constraints
- allowed escalation targets
This is the contract that keeps the model narrow.
2. Input Encoder
Normalizes app inputs into a stable inference shape.
Examples:
- plain user text
- AST node metadata
- taskitem summaries
- form descriptions
- UI state plus text
3. Policy Layer
A tiny learned model that scores legal outcomes.
This may start as a transformer specialist, but the interface should not hard-code one model family. The policy layer should be swappable.
4. Constraint Layer
Deterministic checks that reject illegal or inconsistent outputs.
Examples:
- invalid enum value
- missing required slot
- impossible field combination
- out-of-policy tool choice
5. Executor
Takes a valid decision and calls the deterministic downstream system:
- tool invocation
- template expansion
- AST mutation selection
- workflow dispatch
- form submission preparation
6. Confidence and Escalation
Every decision gate needs a native abstain path.
Outputs should support:
proceedretry_with_contextescalate_to_larger_modelescalate_to_human
7. Gate Diagnosis
The runtime should eventually support gate diagnosis as a first-class library capability.
This means the library should not only run gates, but also help determine why a gate is underperforming and what restructuring options are plausible.
See docs/gate_failure_taxonomy.md.
Library Boundaries
The core library should stay domain-agnostic.
Recommended split:
rsa-core: schemas, inference interface, scoring, confidence, tracingrsa-runtime: model loading, quantization support, inference backendsrsa-eval: benchmarks, calibration, error analysisrsa-domains-whetstone: WhetstoneDSL gate schemas and adapters
Data Model
Each gate should be described by metadata that is independent of any one model:
gate_idtask_familyoutput_cardinalityslot_schemainput_modalitiesrequires_world_knowledgerequires_stateful_contextdeterministic_fallback_availablelabel_stabilitycandidate_factorizationsquality_targetlatency_budget_ms
This metadata matters because model size should be chosen from gate properties, not from intuition alone.
Initial API Sketch
GateDefinition
id
labels
slots
constraints
escalation_policy
DecisionRequest
gate_id
input_text
context
DecisionResult
decision_id
slots
confidence
abstain
escalation_target
trace
GateDiagnosis
primary_failure_class
secondary_failure_classes
recommended_probes
recommended_interventions
confidence
Non-Goals
- open-ended answer generation
- internet-grounded knowledge retrieval
- replacing deterministic business logic
- hiding uncertainty instead of exposing it
Guiding Principle
Intelligence should be concentrated at the routing boundary.
Once the route is chosen and validated, the rest of the system should become ordinary software.