Spaces:
Sleeping
Sleeping
Commit History
-
fix: hide inert provider toggle on public demo; report real model name in telemetry
On the public Space (PUBLIC_DEMO=1) the provider is forced to Anthropic, so the Anthropic/Ollama toggle was inert — now hidden on the public demo, kept for local dev. Also fixes a telemetry label bug: the run footer always showed the Claude model id even on Ollama runs; triage() now reads the real model's .model_name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>d641c27
-
docs: reflect repo directory rename (youtube-kb → amana)
The local project folder is being renamed to `amana`; update the CLAUDE.md and STATUS.md sentences that asserted the old `youtube-kb` directory name. Code is unaffected (imports are relative, data paths are relative). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>2cd43d3 -
feat(ui): first-run welcome modal + Light/Auto/Dark theme
WelcomeModal: explains the concept, foregrounds the AI-recommends/human-decides boundary, a 3-step how-it-works, and clickable showcase chips (camp-017/005/015) that select the campaign. Shown once (localStorage), reopenable via a "How it works" header button. Esc/backdrop/button close; reduced-motion respected. Dark theme: CSS-variable theming under a `.dark` class (semantic tokens surface/panel/line/heading/body/muted/faint + var-backed accent/gold) so the whole UI flips without dark: sprawl. Warm green-black palette. Light/Auto/Dark segmented toggle in the header (Auto follows the OS live via matchMedia), persisted; inline FOUC script in index.html sets the theme before first paint. Decision colors gain dark variants centrally in lib.ts. Frontend-only; no backend/gate/eval changes. SPA builds clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>61cdd31 -
docs: add REDEPLOY guide for the existing HF Space; fix DEPLOY remote name
The Space already exists (remote `hf` → Misbahuddin/amana). REDEPLOY.md is the short "ship today's commit to the Space you already have" path; DEPLOY.md §6 updated to use the real `hf` remote and the DATABASE_URL secret. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>0ae7bbd -
Deploy-readiness: Neon persistence, moderator identity, run telemetry, warm redesign
Port the key infra gaps from the sibling supportops project so Amana is a durable, accountable, polished live demo (HF Spaces + Neon + keepalive). Backend: - Persistence: new src/db.py writes the moderator audit log to Neon Postgres (JSONB) behind the existing src/audit.py interface; JSONL fallback when DATABASE_URL is unset. api.py untouched. (psycopg added to requirements.) - Moderator identity: /api/decisions now requires a `moderator` name (server-enforced) and records it on every decision. - Run telemetry: agent.triage captures input/output tokens + wall-clock latency and the model name as optional GatedDecision fields. - test_api: force DATABASE_URL off for offline runs; cover the moderator rule. Frontend (warm, mission-branded redesign): - Tailwind tokens: parchment/surface/ink + pine (deep green) + gold (antique), warm stone neutrals; Fraunces/Inter/IBM Plex Mono. - Signature: verdict rendered as a stamped seal; policy-gate intervention shown as a bronze "counters…8e98f03
-
Fix Hugging Face Space metadata
d7bab96 -
Add DEPLOY.md: deploy & submission checklist (user actions)
Step-by-step for billing cap, Docker smoke, HF Space creation, secrets, push, live verification, and video recording. Section 2 updated to reflect that main is already in sync with the work branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>4e54475
-
Phase 5 prep: bound /api/triage spend by construction (PUBLIC_DEMO)
A public Space with a billed /api/triage is a potential spend faucet. Close it structurally rather than with after-the-fact limits. The endpoint already only triages the 18 fixed campaigns (it takes a campaign_id, never free-form text — arbitrary input can't reach the model). The one remaining leak was force=true re-running past the per-campaign cache. - New PUBLIC_DEMO config flag (src/config.py). When on, /api/triage ignores force (no cache bypass) and locks the provider to Anthropic (also neutralizes the Ollama toggle, which can't run on a Space anyway). - ENV PUBLIC_DEMO=1 baked into the Dockerfile, so the deployed image is locked with no extra Space secret. Local dev (no flag) keeps force + provider toggle. - Result: max spend = 18 Haiku triages per container restart, then cache hits. Pairs with the operator-side backstop (a hard monthly cap on a dedicated key in the Anthropic Console) — documented in STATUS as the first deploy step. Tested: scripts.test_api 9/9 (new PUB…09213ce -
Phase 5 prep: harden eval CI against the HF-429 judge flake
Deploy-readiness audit + CI hygiene ahead of the Hugging Face Docker Space. The live LLM-judge step was blocking and twice reddened the workflow on a transient HF-Hub HTTP 429 while pulling the all-MiniLM-L6-v2 embedding model during build_index. The deterministic safety gate (the real blocking gate) always passed; only the advisory judge flaked on an external dependency. - Make the judge step continue-on-error (advisory). Per this repo's own design, only the deterministic gate may fail the build; the nondeterministic live model and its external deps (HF Hub, Anthropic API) must never gate. - Cache ~/.cache/huggingface (actions/cache) so the embedding model isn't re-downloaded every run — removes the 429 root cause on warm caches. Same model download happens in the Space's Docker build (build_index), so a transient 429 there is a one-shot rebuild, not a code bug — documented in STATUS. Build readiness verified: README HF frontmatter (sdk: docker, port 7860), multi-stage Docke…04a389a -
Phase 4.1: gate hardening — corroborate hard citations + enforce ELIG-4
Close the two envelope holes the Phase-4 eval surfaced (confirmed live by an Ollama console run that rejected camp-011 on a fabricated PROH-2/PROH-4 hard citation, and approved >$10k campaigns with no fund-use breakdown). Both fixes stay inside the gate envelope — it still only routes toward the human, never manufactures an APPROVE/REJECT, never re-adjudicates a rule. - ELIG-4 on APPROVE: a >$10k goal carrying the medium-severity large_goal_no_breakdown_check signal now escalates citing ELIG-4 (the gate previously blocked only on high-severity signals, so it slipped through). - Citation corroboration: a hard REJECT is honored only if the cited rule is corroborated by the deterministic scanner (_HARD_RULE_SIGNALS). Genuine rejects (005/006/007/008) all carry their signal and survive; a fabricated hard category on a campaign with no matching content escalates (DEC-2). Detector-less content rules (PROH-1/5/6) are not confirmable -> escalate. Tests: smoke t_policy_gate +2 as…438e8e8
-
Docs: record Phase 4 CI green (live judge) + eval gate-hardening backlog
CI judge step is now active and green (ANTHROPIC_API_KEY secret set). Capture the two envelope holes the Phase 4 eval surfaced as the next actionable work: ELIG-4 not enforced on APPROVE (camp-011/012), and the gate trusting a fabricated hard citation (camp-018 false reject). Update STATUS RESUME-HERE to lead with gate hardening, then Phase 5 deploy. Mark PLAN 5c (CI) as built. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>62acf3d -
Phase 4: eval harness + CI (deterministic safety gate + LLM-judge)
Turn the 18 labelled campaigns into an eval set and make the policy-gate invariants a build gate. - eval/build_testset.py + eval/testset.json: collect each campaign's private _expected into a committed test set; --check fails CI if it drifts. - eval/run_eval.py (full rewrite; the old file was the retired YouTube-RAG eval): * deterministic, model-free layer (no key/index) — privacy boundary, ground- truth citation validity, and the policy-gate envelope probed from both sides (sanctions/injection/low-conf/unfounded-reject escalate; clean approve and founded reject pass through; escalate is terminal). 10 checks, gates CI. * triage scoring (needs key) — recommendation accuracy, escalation recall (overall + safety-critical subset, --strict gates at 100%), reject precision + false-reject ids, citation validity. Per-case error isolation. * LLM-as-judge (--judge) — rationale faithfulness + calibration 1-5 on a subset. - .github/workflows/eval.yml: deterministic gat…9561b34 -
Linkify rule IDs in risk-signal details
The clickable-citations pass wired PolicyText into the rationale, questions, gate-reason, and manipulation note, but skipped the Risk signals section, so a rule ID surfaced by a risk signal (e.g. ELIG-4 in large_goal_no_breakdown_check) rendered as dead text. Run risk-signal detail through PolicyText so those IDs become drawer-linked chips that highlight-track focusRule like everywhere else. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>82482ee
-
Add policy reference drawer + clickable citations; fix check_sanctions retry loop
Two changes that surfaced during the live moderator-console click-through: Policy reference drawer (the acronym glossary moderators asked for): - src/policy.py: SECTION_META (prefix -> plain-English name + blurb) and policy_sections(), grouping parse_policy_rules() by rule-ID prefix. - api.py: new GET /api/policy route. - frontend: new PolicyReference.tsx side drawer (mirrors the audit-history drawer), opened by a Policy button in the header; lists all 26 rules grouped by the 5 sections, each with name + description. Cited rule IDs in the decision card and gate banner are now clickable RuleIdChips that open the drawer scrolled to + highlighting that rule. No AI/triage/gate code touched. check_sanctions retry-loop fix: - src/agent.py: the zero-arg check_sanctions tool now declares optional, ignored names/countries params so Haiku hallucinating those args validates instead of burning retries (was UnexpectedModelBehavior: exceeded max retries). Values still sourced from …063bf3a -
Pivot YouTube RAG scaffold into Amana — T&S triage copilot (Phases 1–3.6)
Repurposes the YouTube-transcript RAG app into a Trust & Safety campaign-review triage copilot: an AI agent screens a fundraising campaign against policy and recommends APPROVE / REJECT / ESCALATE with cited rule IDs; a human moderator decides. The AI never auto-decides. Data layer: - data/policy.md (26 citable rule IDs: ELIG/PROH/COMP/CONT/DEC) - data/campaigns/*.json (18 synthetic cases w/ private _design_note/_expected, stripped before the agent sees them), data/sanctions.json, data/past_cases.json Agent + tools (Pydantic AI, Claude; Ollama toggle for free local dev): - src/schemas.py, src/campaigns.py, src/policy.py, src/tools.py, src/agent.py - four tools: policy_search, similar_cases, check_sanctions (mock), scan_risk_signals - retired src/ingest.py, src/chunk.py, src/rag.py Deterministic policy gate (the "not-a-wrapper" layer): - src/gate.py reconciles the model's decision against policy invariants in code; may only route toward the human (-> ESCALATE), never auto-approve…250666a
-
Scaffold YouTube Channel Knowledge Base (RAG)
developerf4d9ca1