Standalone CLI + MCP server for capturing root-cause analyses, sanitizing evidence, and publishing safe, idempotent "why cases" to aihangout.ai.
- Default mode (recommended):
--target outboxwrites to.why-engine/outbox/<idempotencyKey>.jsonwith dedupe via ledger. - Secrets present: outbox always writes a stub-only record (hashes + metadata only) and blocks API publish.
- Sensitive prose present: content classification can block API publish even when no literal token/key is present.
- API publish: use
--target apior--target bothwith--dry-run truefirst; require--problem-idinitially to avoid creating new problems by accident. - History: optional
--keep-historywrites.why-engine/outbox/history/<idempotencyKey>-<timestamp>.json.
The store is no longer write-only. Before attempting a fix, ask whether this failure has happened before:
why-engine search --repo-path . --query "ECONNRESET during retry storm in api client"
why-engine search --repo-path . --query "torn audit line after crash" --tags durability --jsonAgents get the same capability via the MCP tool why.recall — call it with the raw error message or stack trace before writing a fix. Matching is field-weighted TF-IDF (titles, root causes, tags, error snippets weighted highest), fully offline and deterministic.
why-engine doctor --repo-path . # 8-point health check, exit 1 on failure
why-engine doctor --repo-path . --fix # quarantine a torn audit tail (auditable repair)
why-engine stats --repo-path . # totals, tags, recurring root-cause clusters
why-engine audit-repair --repo-path . # repair-only entrypointDurability guarantees in v0.2.0: audit appends are fsync'd and lock-serialized across processes; case, outbox, and ledger writes are atomic (readers never see partial files); a crash mid-append leaves a classified, repairable torn tail rather than an unreadable log; mid-log corruption remains non-repairable tamper evidence. Recurring clusters in stats flag the same root cause happening twice — a prevention that did not hold.
WHY.md is the reviewed, human/agent-readable surface for project rationale.
Architectural decisions are written proactively. Fix Intelligence is promoted from
public WhyCases with a meaningful generalizablePattern.
why-engine promote-why --repo-path . # dry-run by default
why-engine promote-why --repo-path . --dry-run false # write qualifying casesPromotion requires the quality gate to pass, the score to meet --min-score
(default 70), sensitivity === "public", and content classification to allow
publication.
- Recall engine (
search/why.recall),statswith recurring-cluster detection,doctor --fix,audit-repair. - Crash-safe audit chain: fsync + cross-process locking + O(1) appends + torn-tail repair with quarantine.
- Atomic writes everywhere (cases, outbox, ledger). 83-test suite. Fully backwards compatible with v0.1.x stores.
- Full Command Parity: Added
verify-auditcommand alias to resolve web-to-CLI invocation mismatches. - Outbox Detail Retrieval: Fixed the critical outbox page 404 by adding fallback routing lookup on
idempotencyKey. - Advanced Secret Redaction: Recursive deep object and array traversal scanner to detect and redact Stripe keys, JWT tokens, GitHub tokens, and DB connection strings.
- Testing Coverage: Expanded the test suite from 11 tests to 50 tests covering all CLI endpoints, tamper detection, and security constraints.