All notable changes to SIW Intent Brain will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- IntentBrain - Main scoring API with fail-closed behavior
- LeadCard Contract - Structured JSON output with
lead_card.v1schema - Score Dimensions - Urgency, pain point intensity, commercial relevance, solution seeking
- Lead Tiering - S/A/B/C/D tiers based on composite score
- Next Step Recommendations - offer_resource, ask_question, draft_reply, monitor, ignore
- JSON Extractor - Tolerant JSON parsing with strict/extracted modes
- Normalizer - Score clamping, list cleanup, string truncation
- Heuristics Fallback - Rule-based tiering and next_step when LLM output is invalid
- OpenRouter Client - HTTP client with retry, backoff, timeout handling
- Prompt Builder - Stable, deterministic prompt construction
- Response Parsing - Robust extraction from potentially malformed LLM output
siw-brain score- Score text and output LeadCard JSONsiw-brain validate- Validate LeadCard JSON against schemasiw-brain doctor- Check environment and dependenciessiw-brain demo- Run offline demo with sample texts
- Environment variable support (
OPENROUTER_API_KEY,SIW_MODEL, etc.) - YAML config file support
.envfile support via python-dotenv- Priority: env > yaml > defaults
- Fail-closed design - always returns valid LeadCard
- Structured error codes (
E_UPSTREAM_HTTP,E_PARSE_JSON, etc.) - Soft fail-closed for low confidence scores
- Structured JSON logging (disabled by default,
--verboseto enable) - In-memory metrics (request counts, latency tracking)
- Logs output to stderr, keeping stdout clean
- Multi-encoding file reading (UTF-8, UTF-8-sig, UTF-16)
- Handles PowerShell ">" redirect encoding automatically
- Tested on Windows PowerShell
- 390+ unit tests (all offline, no network required)
- FakeClient injection for isolated testing
- Contract validation tests
- Heuristics boundary tests
- Comprehensive README with quickstart guide
- CLI reference with examples
- Configuration guide
- Troubleshooting section
- API key never logged or printed
- Input text truncated in logs
- No sensitive data in error messages
- Verbose logs only to stderr
- PyPI package publishing
- Additional model support
- Batch scoring API
- Custom prompt templates