Skip to content

Traceable, instant, abuse-safe briefs (audit P0s + result-first UI) - #10

Merged
Yasuui merged 7 commits into
mainfrom
claude/friction-mapper-audit-design-a2577a
Oct 30, 2026
Merged

Yasuui merged 7 commits into
mainfrom
claude/friction-mapper-audit-design-a2577a

Conversation

@Yasuui

@Yasuui Yasuui commented Oct 30, 2026

Copy link
Copy Markdown
Owner

What

Implements the P0 items from the 30 Oct audit plus the highest-value UI changes from the "Signal / Evidence" direction.

Trust

  • parseReportJson: a claim is a fact only when explicitly labelled and quoted; invalid/missing kinds and unquoted evidence become inference. Negative, non-finite, string or >52,000 h/yr hour values are dropped.
  • groundReport / quoteAppearsIn: the client checks each fact against what the person typed and downgrades unsourced ones.
  • Rule engine reads only affirmed clauses (affirmedText), so negated or already-automated steps no longer trigger fixes. With no supported signal it abstains ("No supported improvement yet") and asks one question. Evidence now quotes the user's own sentence.

Speed: rule-based replies ship at once (the ~11 s artificial typing delay is gone).

Privacy: removed WorkflowPostHog.tsx (a second tracker with no prod guard that fired "completed" on submit). primary_opportunity is now named | none, and the sanitizer drops any property value outside an allowlisted enum.

Cost (live mode only): lib/live-guard.ts adds 8 req/10 min per client, 4 concurrent, a daily cap (LIVE_DAILY_REQUEST_LIMIT, default 300), a 45 s timeout plus client-disconnect abort, the last 12 messages only, and PDFs parsed once. A tripped limit returns the rule brief with a notice, not an error.

UI: the brief opens on the recommended move, a source quote, a proof strip (workload labelled "not savings", steps, "traceable to your words N of M") and a "How to test it" pilot. The engine badge is always visible. Faint/muted tokens meet AA (calculated). 44 px targets on touch, 16 px composer text, shell min-height 420 px.

Why

The audit showed briefs could look authoritative without support, free results were wrong on negated input, report wording could reach analytics, and the paid endpoint had no spend controls.

Risk

  • Live-guard state is per function instance: best effort, not a global quota.
  • affirmedText drops whole clauses that contain negation words. It errs toward abstaining. Samples and fixtures still produce recommendations.
  • The live-model path was not exercised (no API key locally).

How it was tested

  • npm test: tsc, next build, 61/61 node tests, including the new tests/trust-guards.test.mjs.
  • npm run lint is clean.
  • Local browser: the Data review sample renders immediately ("5 of 6" traceable). The fully automated input returns "No supported improvement yet". At 375 px there's no horizontal scroll, the badge is visible, and the brief opens as a dialog.

Not verified: production deploy, VoiceOver, 200% zoom, the iOS Safari keyboard, live model quality, and n8n export (out of scope).

🤖 Generated with Claude Code

- Parser: invalid/missing evidence kind and unquoted evidence become inference; negative,
  non-finite or absurd hour figures are dropped.
- Client grounds every fact against the user's own words and downgrades unquoted ones.
- Rules ignore negated and already-automated clauses and abstain with a question instead
  of forcing a recommendation; evidence now quotes the user's sentence.
- Rule-based replies ship instantly (removed ~11s artificial typing delay).
- Analytics: removed the duplicate direct-capture tracker; every property value is enum
  or boolean, so report wording can no longer leave the browser.
- Live mode: per-client rate limit, concurrency cap, daily budget, 45s timeout, client
  cancellation, bounded history, PDFs parsed once. Limits fall back to the rule brief.
- Brief leads with the recommended move, a source quote, a traceability count and a pilot
  plan; engine badge always visible; AA text contrast; 44px touch targets; 16px input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
workflow-friction-mapper Ready Ready Preview Oct 30, 2026 6:53pm UTC

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T18:55:36.533103Z 7e89945 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21c71dbcf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/agent-protocol.ts Resolved
Comment thread components/WorkflowChat.tsx Resolved
- quoteAppearsIn now requires each ellipsis-separated segment to appear verbatim, on word
  boundaries and in order; the unordered word-overlap fallback is gone.
- The server returns the attachment text it read (decoded files, extracted PDFs) as a
  data-source part; the client grounds against typed text, decoded text files and that part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da3730a3e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/agent-protocol.ts Resolved
Comment thread lib/demo-agent.ts Resolved
- Quote normalisation keeps Unicode letters and numbers (NFKC, case-folded). Scripts written
  without spaces (Han, Kana, Thai) match on substrings; spaced scripts keep word boundaries.
- The already-automated matcher no longer treats every auto* word (automobile, autograph)
  as automation; it matches automatic/automated and named auto-actions only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ecb55e9350

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/agent-stream.ts Resolved
The transport strips data-* parts before sending, so the attachment text returned for
grounding stays in browser state and is not resent every turn (which could push valid
attachment conversations past the request-size limit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71c1ba873c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/api/optimize/route.ts Resolved
When older turns are dropped, the collected user material (workflow, constraints,
attachment text) is prepended as one bounded user turn, framed as data, so refinements
keep the original evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 089980a322

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/demo-agent.ts Resolved
The already-automated and negation filters describe current state, so they now apply only
when analysing an existing process. Create mode reads the full request again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r-audit-design-a2577a

# Conflicts:
#	app/globals.css
@Yasuui
Yasuui merged commit 3c18126 into main Oct 30, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 7e89945e Deployed Oct 30, 2026 by vercel[bot]
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.

1 participant