Skip to content

feat(demo): Security Theater + unified shell + a11y/motion polish - #9

Merged
wesleyscholl merged 1 commit into
mainfrom
claude/focused-faraday-lykfyz
Jun 11, 2026
Merged

wesleyscholl merged 1 commit into
mainfrom
claude/focused-faraday-lykfyz

Conversation

@konjoinfinity

Copy link
Copy Markdown
Contributor

Delivers all three remaining next-steps in one pass, on top of the Pipeline (#7) and Agent (#8) theaters.

1. Security & cache-write theater β€” new surface /security

Visualizes kyro's real konjoai.cache.poisoning.PoisoningGuard as a live "write firewall".

  • demo/security.py β€” SecurityEngine runs the guard unmodified: per-tenant WriteRateLimiter, cosine Q-A coherence (the identical _cosine_similarity), and the Welford AnomalyDetector. The authoritative accept/reject is guard.validate(); the per-layer diagnostics the UI shows are read from the guard's own components, so the explanation always matches the decision. The only substitution is the demo encoder β€” exactly the embed_fn seam the guard already exposes. A curated, fully deterministic scenario (FNV-hash encoder, not Python's salted hash()) exercises every layer: coherent baselines β†’ poisoned/off-topic (blocked at coherence) β†’ padded answer (flagged for length anomaly) β†’ bot flood (trips the rate limiter).
  • demo/security.html β€” cinematic firewall: three gate counters (pass/block/flag), an animated verdict timeline with per-layer signal bars, an OWASP-safe threat ledger (SHA-256 hashes only), and an interactive "test your own write" panel.
  • demo/server.py β€” GET /security, GET /api/security/{scenario,stats}, POST /api/security/{check,reset} (bounded inputs).
  • tests/unit/test_demo_security.py β€” 11 contract tests: each layer fires, OWASP no-raw-text (only 16-hex hashes), interactive check/reset.

2. Unified shell

Cross-document View Transitions (@view-transition { navigation: auto }) on all five surfaces for smooth page-to-page morphs, and a consistent nav with Security linked everywhere: Playground Β· Observatory Β· Pipeline Β· Agent Β· Security.

3. Polish across pages

  • prefers-reduced-motion honoured (animations + view-transitions disabled) on every surface.
  • :focus-visible rings for keyboard navigation.
  • aria-current / aria-live on the new surfaces; responsive grids that stack on narrow viewports.

Honesty notes

  • Demo thresholds are tuned tighter than production defaults (coherence 0.12, 6 writes/min, 2.5Οƒ) purely so every layer is observable in a short scenario β€” labelled in the payload's config.
  • The embedder is the demo's deterministic char-trigram encoder (same float32/L2-unit contract), wired through the guard's real embed_fn.

Verification

  • 36 demo tests pass, stable across multiple PYTHONHASHSEED values; ruff check . clean repo-wide.
  • All five surfaces serve 200; the security scenario returns its 14-row timeline; the off-topic interactive check returns blocked / coherence.
  • Rendered & screenshotted headless against the live server.
  • Only demo/* and a new test changed β€” no production konjoai/ code touched.

Run it:

python3 demo/server.py        # http://localhost:8766/security

https://claude.ai/code/session_01WWWgV1NwxaaNdPfy4PHN1K


Generated by Claude Code

Three "next steps" in one pass.

1) Security & cache-write theater (new surface /security)
   - demo/security.py β€” SecurityEngine drives the real
     konjoai.cache.poisoning.PoisoningGuard unmodified: per-tenant
     WriteRateLimiter, cosine Q-A coherence (identical _cosine_similarity),
     and the Welford AnomalyDetector. Authoritative accept/reject comes from
     guard.validate(); per-layer diagnostics are read from the guard's own
     components so the explanation always matches the verdict. Only the demo
     encoder is substituted (the guard's embed_fn seam). A curated, fully
     deterministic scenario exercises every layer (coherent baselines β†’
     poisoned/off-topic β†’ length anomaly β†’ rate-limit flood).
   - demo/security.html β€” cinematic "write firewall": three gate counters,
     an animated verdict timeline with per-layer signal bars, an OWASP-safe
     threat ledger (SHA-256 hashes only), and an interactive "test your own
     write" panel.
   - demo/server.py β€” GET /security, GET /api/security/{scenario,stats},
     POST /api/security/{check,reset} (bounded inputs).
   - tests/unit/test_demo_security.py β€” 11 contract tests (each layer fires,
     OWASP no-raw-text, interactive check/reset).

2) Unified shell β€” cross-document View Transitions (@view-transition:
   navigation auto) on all five surfaces for smooth page-to-page morphs, and
   a consistent nav with Security linked everywhere (Playground Β· Observatory
   Β· Pipeline Β· Agent Β· Security).

3) Polish across pages β€” prefers-reduced-motion honoured (animations +
   view-transitions disabled), :focus-visible rings for keyboard nav,
   aria-current / aria-live on the new surfaces, and responsive grids that
   stack on narrow viewports.

36 demo tests pass (stable across PYTHONHASHSEED); ruff clean repo-wide.

https://claude.ai/code/session_01WWWgV1NwxaaNdPfy4PHN1K
@wesleyscholl
wesleyscholl marked this pull request as ready for review June 11, 2026 18:03
@wesleyscholl
wesleyscholl merged commit 6208192 into main Jun 11, 2026
7 checks passed
@wesleyscholl
wesleyscholl deleted the claude/focused-faraday-lykfyz branch June 11, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants