Inspiration
Assistants are starting to act on our behalf: reordering groceries, changing routines, booking services. A week later, nobody remembers why any of it happened, and the assistant can't tell you either. We wanted Alexa+ to be able to answer the simplest question a household can ask: "Alexa, why?"
What it does
Alexa, why? is a self-hosted MCP server for Alexa+. Every time Alexa+ acts, it records the decision: what it did, the reason, the inputs, and who approved it. Later you can ask:
- "Why did you reorder coffee?" Alexa quotes the stored reason and the approver, plus a short trace id.
- "What changed this week?" Alexa lists every decision since a point in time, each with its own trace.
- Verify the trail. Each record is SHA-256 hashed and chained to the one before it, so changing a single byte of history makes verification fail. Restoring the byte makes it pass again.
Four decision tools: record_decision, explain_why, whats_changed and get_trace.
How we built it
- A Cloudflare Worker in TypeScript speaking MCP (spec 2025-11-25, stateless Streamable HTTP), with D1 for durable storage.
- Records are canonical JSON hashed with SHA-256 and chained, built on Scholialang reasoning traces (Action and Finding atoms).
- An OAuth client-credentials token endpoint issues short-lived, audience-bound tokens for Alexa+, alongside per-judge tokens, origin checks and rate limits.
- A Python reference implementation and shared fixtures keep the TypeScript port byte-compatible.
- A local demo page simulates the Alexa+ conversation so the full flow can be shown end to end.
Challenges we ran into
- Concurrent writes could overwrite another decision, so we moved to D1 conditional writes with bounded retries.
- Retention: deleting individual records breaks verification, so whole household windows expire together and the chain keeps an anchor hash.
- Stored reasons are treated as untrusted data, so a recorded "reason" can never inject instructions into Alexa's spoken answer.
Accomplishments that we're proud of
- A tamper test you can watch: change one byte in the database and verification fails, restore it and it passes.
- Spoken answers short enough for voice, with a full machine-verifiable trail behind them.
What we learned
Explanations only build trust if they can be checked. "Here's why" is much stronger when it comes with "and here's how you can verify it."
What's next for Alexa, why?
- Live validation with an Alexa+ client.
- Household controls to review, export and expire decision history.
- Shared verification so other agents and apps can read the same trail.
Built With
- cloudflare-d1
- cloudflare-workers
- mcp
- oauth
- python
- scholialang
- sha-256
- typescript