feat: Add scam-shield bundle#289
Conversation
|
Warning Review limit reached
Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughChangesThe Scam Shield kit adds bundle metadata, scam-pattern indexing and message-triage flows, Gemini model configurations, safety rules, environment templates, and setup documentation. Scam Shield
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
🎉 All checks passed! This contribution follows the AgentKit structure. |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/scam-shield/.gitignore`:
- Around line 3-4: Update the environment ignore rules in the project’s
.gitignore to match all .env variants, including production and staging files,
while explicitly keeping .env.example trackable.
In `@kits/scam-shield/flows/index-scam-patterns.ts`:
- Around line 117-122: Update the indexing configuration around primaryKeys,
vectorsField, and metadataField so records use a stable unique record ID or
content hash as the sole primary key instead of pattern_name. Preserve
pattern_name in the metadata payload, ensuring distinct patterns with the same
name are retained rather than overwritten.
In `@kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md`:
- Around line 1-10: Harden the system prompt by explicitly treating both the
user message and retrieved scam patterns as untrusted data rather than
instructions, preventing prompt injection from changing the assessment. Update
the red_flags requirement to use redacted descriptions instead of reproducing
sensitive OTPs, PINs, CVVs, account numbers, or similar secrets, while
preserving the existing JSON-only response schema and scam-triage behavior.
In `@kits/scam-shield/README.md`:
- Around line 21-38: Update the README around the Step headings and fenced code
blocks to satisfy markdownlint-cli2: add blank lines where required, including
the referenced sections, mark the folder-tree code fence as text, and ensure the
file ends with exactly one newline.
- Around line 43-47: Update the setup instructions in the README before the test
curl command to explicitly load the `.env` values into the shell, using a
source/export step after copying and populating `.env`. Ensure LAMATIC_API_URL
and LAMATIC_API_KEY are available when the example request runs.
In `@kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts`:
- Around line 1-3: Update the initialization of single_name, single_content, and
batch to read values from the runtime workflow object rather than mustache
expressions. Ensure batch resolves to the actual patterns array, including when
the upstream output uses an array-like key, so the existing loop can create
vectors and metadata without throwing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a9d7edf7-f8be-413b-88de-07c43c74091d
📒 Files selected for processing (14)
kits/scam-shield/.env.examplekits/scam-shield/.gitignorekits/scam-shield/README.mdkits/scam-shield/agent.mdkits/scam-shield/constitutions/default.mdkits/scam-shield/flows/index-scam-patterns.tskits/scam-shield/flows/scam-message-triage.tskits/scam-shield/lamatic.config.tskits/scam-shield/model-configs/index-scam-patterns_vectorize-node-808_embedding-model-name.tskits/scam-shield/model-configs/scam-message-triage_ragnode-573_embedding-model-name.tskits/scam-shield/model-configs/scam-message-triage_ragnode-573_generative-model-name.tskits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.mdkits/scam-shield/prompts/scam-message-triage_ragnode-573_user_1.mdkits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts
| "primaryKeys": [ | ||
| "pattern_name" | ||
| ], | ||
| "vectorsField": "{{vectorizeNode_808.output.vectors}}", | ||
| "metadataField": "{{codeNode_948.output.metaData}}", | ||
| "duplicateOperation": "overwrite" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Mission directive: make every indexed pattern uniquely addressable.
The request schema permits repeated pattern_name values, but Lines 117–122 use it as the only key and overwrite collisions. Different pattern content sharing a name is silently lost. Use a stable record ID or content hash as the primary key; retain pattern_name as metadata.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/scam-shield/flows/index-scam-patterns.ts` around lines 117 - 122, Update
the indexing configuration around primaryKeys, vectorsField, and metadataField
so records use a stable unique record ID or content hash as the sole primary key
instead of pattern_name. Preserve pattern_name in the metadata payload, ensuring
distinct patterns with the same name are retained rather than overwritten.
… quarantine untrusted prompt content, clean up README
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/scam-shield/README.md (1)
76-85: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDocument the runtime shape or align the flow mapping.
kit/scam-shield/flows/scam-message-triage.tsmapsmodelResponseandreferencesfromRAGNode_573.outputat lines 126 and 118–126, while this README example shows them parsed as object/array fields. Either show users the exact runtime output shape or confirm/update the flow so clients receive the documented JSON type.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/scam-shield/README.md` around lines 76 - 85, Align the Scam Shield README example with the actual output shape produced by the scam-message-triage flow, especially the modelResponse and references fields mapped from RAGNode_573.output. Either document the runtime wrapper/type returned by the flow or update the flow mapping so clients receive the object and array JSON types shown in the example.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md`:
- Line 14: Add a single trailing newline at the end of the prompt file to
satisfy markdownlint MD047, without changing any existing prompt text or adding
headings.
In `@kits/scam-shield/README.md`:
- Around line 39-41: Update the batch request example in the README so it is
valid JSON: replace the unquoted ellipsis with a second concrete pattern object,
preserving the existing schema and example intent.
In `@kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts`:
- Around line 1-18: Update the input initialization in the scam-pattern indexing
script to read pattern data from the workflow object using the trigger node’s
output fields, rather than quoted Mustache placeholders. Ensure the batch value
is obtained as the actual array and single_name/single_content contain the
submitted values before the processing logic and record indexing execute.
---
Outside diff comments:
In `@kits/scam-shield/README.md`:
- Around line 76-85: Align the Scam Shield README example with the actual output
shape produced by the scam-message-triage flow, especially the modelResponse and
references fields mapped from RAGNode_573.output. Either document the runtime
wrapper/type returned by the flow or update the flow mapping so clients receive
the object and array JSON types shown in the example.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 927a7c41-2ec3-4710-a27a-8a5b1b772174
📒 Files selected for processing (5)
kits/scam-shield/.gitignorekits/scam-shield/README.mdkits/scam-shield/flows/index-scam-patterns.tskits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.mdkits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts
| "report_channel": "<cybercrime.gov.in or helpline 1930 or bank's official number, as appropriate>" | ||
| } | ||
|
|
||
| Never ask the user for OTP, PIN, CVV, or account numbers. Never provide exploit detail on named banks. Never repeat back any sensitive value (OTP, PIN, CVV, account/card number) the user included in their message, even partially. If the message doesn't match any known scam pattern and seems benign, return a low risk_score and say so plainly in the explanation. No newline at end of file |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Mission cleanup: add the missing final newline.
markdownlint reports MD047 for this file. Add one trailing newline without adding a heading or other prompt text.
🧰 Tools
🪛 LanguageTool
[style] ~14-~14: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... provide exploit detail on named banks. Never repeat back any sensitive value (OTP, P...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🪛 markdownlint-cli2 (0.23.0)
[warning] 14-14: Files should end with a single newline character
(MD047, single-trailing-newline)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md` at line
14, Add a single trailing newline at the end of the prompt file to satisfy
markdownlint MD047, without changing any existing prompt text or adding
headings.
Source: Linters/SAST tools
…tor keys, quarantine untrusted prompt content, fix README examples
PR Checklist
kits/scam-shield/(kebab-case, unique)lamatic.config.tspresent with validtype(bundle),name,author,tags,steps,linksagent.mdpresentREADME.mdpresent, describes what the contribution does and how to use itflows/<n>.tsexists for every step inlamatic.config.ts(index-scam-patterns.ts,scam-message-triage.ts)constitutions/default.mdpresent.env.examplepresentapps/package.jsonworks withnpm install && npm run dev— N/A, bundle has noapps/links.githubinlamatic.config.tspoints tokits/scam-shieldlinks.deployhasroot-directory=kits/<n>/apps— N/A, bundle-only, no deploy link.envor.env.localcommitted — only.env.examplewith placeholders@referencepaths resolve to files that actually exist in this kitkits/scam-shield/kits/scam-shield/bundle for India-focused UPI/banking scam fraud triage (bundle-only; no apps directory/deployment link).kits/scam-shield/.env.example(LAMATIC API URL/project/key placeholders)kits/scam-shield/.gitignore(ignores.lamatic/,node_modules/, and.env*except.env.example; excludes a local demoindex.html)kits/scam-shield/lamatic.config.ts(bundle metadata; defines the two mandatory steps:index-scam-patternsthenscam-message-triage)kits/scam-shield/README.md(RAG workflow, safety/guardrails behavior, quickstart for ingest + deploy + GraphQL trigger usage, expected kit structure)kits/scam-shield/agent.md(agent purpose, interaction flows, and thescam-message-triageI/O contract)kits/scam-shield/constitutions/default.md(constitution: blocks requesting/disclosing OTP/PIN/CVV/account/card numbers, exploit bypass details, and mandates official reporting channels)kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md(system prompt with strict JSON output schema and behavioral constraints)kits/scam-shield/prompts/scam-message-triage_ragnode-573_user_1.md(user prompt template wiringmessagefrom the trigger)kits/scam-shield/model-configs/index-scam-patterns_vectorize-node-808_embedding-model-name.tskits/scam-shield/model-configs/scam-message-triage_ragnode-573_embedding-model-name.tskits/scam-shield/model-configs/scam-message-triage_ragnode-573_generative-model-name.tskits/scam-shield/flows/index-scam-patterns.tstriggerNode(GraphQL API request) →dynamicNode(dynamiccodeNode) →dynamicNode(dynamicvectorizeNode) →dynamicNode(dynamicvectorNodeindexing intoscampatterns) →responseNode(GraphQL realtime response)id,pattern_name,content), vectorizes them using the configured embedding model, indexes/overwrites into thescampatternsvector DB, and returnsmessage+recordsIndexed.kits/scam-shield/flows/scam-message-triage.tstriggerNode→dynamicNode(dynamicRAGNode) →responseNodescampatternsfor the triggeredmessage(limit=3), runs the configured system/user prompt set with the configured generative model to produce a structured JSON risk assessment (risk_score,red_flags,explanation,recommended_action,report_channel), and returnsmodelResponseplusreferences.kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts(Mustache-driven extraction for single vs batch inputs, stable per-record IDs via hashing, and output formatting as{ vectorData, metaData }with validation/erroring on invalid inputs)