Skip to content

feat: Add scam-shield bundle#289

Open
GitRzh wants to merge 7 commits into
Lamatic:mainfrom
GitRzh:feat/scam-shield
Open

feat: Add scam-shield bundle#289
GitRzh wants to merge 7 commits into
Lamatic:mainfrom
GitRzh:feat/scam-shield

Conversation

@GitRzh

@GitRzh GitRzh commented Jul 23, 2026

Copy link
Copy Markdown

PR Checklist

  • Folder is at kits/scam-shield/ (kebab-case, unique)
  • lamatic.config.ts present with valid type (bundle), name, author, tags, steps, links
  • agent.md present
  • README.md present, describes what the contribution does and how to use it
  • flows/<n>.ts exists for every step in lamatic.config.ts (index-scam-patterns.ts, scam-message-triage.ts)
  • constitutions/default.md present
  • .env.example present
  • apps/package.json works with npm install && npm run dev — N/A, bundle has no apps/
  • links.github in lamatic.config.ts points to kits/scam-shield
  • links.deploy has root-directory=kits/<n>/apps — N/A, bundle-only, no deploy link
  • No .env or .env.local committed — only .env.example with placeholders
  • All @reference paths resolve to files that actually exist in this kit
  • PR touches only files inside kits/scam-shield/
  • Added kits/scam-shield/ bundle for India-focused UPI/banking fraud triage using RAG (bundle-only; no apps/ directory or deployment link).
  • Bundle config & hygiene:
    • kits/scam-shield/.env.example (placeholders: LAMATIC_API_URL, LAMATIC_PROJECT_ID, LAMATIC_API_KEY)
    • kits/scam-shield/.gitignore (ignores .lamatic/, node_modules/, and .env* except !.env.example; excludes local-only index.html)
    • kits/scam-shield/lamatic.config.ts (bundle metadata; steps: index-scam-patternsscam-message-triage, plus GitHub link)
  • Documentation:
    • kits/scam-shield/README.md (end-to-end workflow, safety behavior, quickstart for indexing + deploying + GraphQL triage trigger + sample response)
    • kits/scam-shield/agent.md (agent purpose, interaction flows, scam-message-triage JSON contract, guardrails)
  • Safety / constitution & prompts:
    • kits/scam-shield/constitutions/default.md (hard rules: no OTP/PIN/CVV/full numbers; no exploit/bypass details; route to official reporting/verification channels)
    • kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md (system prompt: JSON-only risk assessment schema; low-risk fallback when no match)
    • kits/scam-shield/prompts/scam-message-triage_ragnode-573_user_1.md (injects {{triggerNode_1.output.message}})
  • Model configs:
    • kits/scam-shield/model-configs/index-scam-patterns_vectorize-node-808_embedding-model-name.ts (Gemini embedding model for vectorization)
    • kits/scam-shield/model-configs/scam-message-triage_ragnode-573_embedding-model-name.ts (Gemini embedding model for retrieval)
    • kits/scam-shield/model-configs/scam-message-triage_ragnode-573_generative-model-name.ts (Gemini generative model for triage)
  • Workflows:
    • kits/scam-shield/flows/index-scam-patterns.ts (index-scam-patterns)
      • Node types used/introduced: triggerNode, dynamicNode, responseNode
      • Dynamic node chain: triggerNode_1codeNode_948 (prepares vectorData/metaData) → vectorizeNode_808vectorNode_954 (indexes to scampatterns)
      • How it works: accepts either batch patterns[] or single pattern_name+content, computes deterministic stable IDs via SHA-256 of name|content, vectorizes/indexes with overwrite semantics, and returns { message, recordsIndexed }.
    • kits/scam-shield/flows/scam-message-triage.ts (scam-message-triage)
      • Node types used/introduced: triggerNode, dynamicNode, responseNode
      • Dynamic node chain: triggerNode_1RAGNode_573 (retrieval + generative triage) → responseNode_triggerNode_1
      • How it works: takes an input message, retrieves relevant scam patterns from scampatterns (configured retrieval params), runs the configured system/user prompts with the generative model, and returns structured JSON (risk_score, red_flags, explanation, recommended_action, report_channel) plus references.
  • Ingestion helper:
    • kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts (builds { vectorData, metaData } from trigger inputs; supports batch or single record shapes; generates collision-resistant, deterministic id values).

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Changes

The 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

Layer / File(s) Summary
Bundle metadata and runtime configuration
kits/scam-shield/lamatic.config.ts, kits/scam-shield/.env.example, kits/scam-shield/.gitignore
Defines kit metadata, workflow steps, environment placeholders, and ignored local files.
Scam pattern indexing pipeline
kits/scam-shield/flows/index-scam-patterns.ts, kits/scam-shield/scripts/*, kits/scam-shield/model-configs/index-scam-patterns_*
Accepts single or batch scam patterns, creates stable records, vectorizes and indexes them, and maps indexing results to the response.
Message triage pipeline
kits/scam-shield/flows/scam-message-triage.ts, kits/scam-shield/model-configs/scam-message-triage_*, kits/scam-shield/prompts/*, kits/scam-shield/constitutions/default.md, kits/scam-shield/agent.md
Connects the message trigger to RAG retrieval and generation, maps response fields, and defines JSON output and safety constraints.
Kit setup and usage documentation
kits/scam-shield/README.md
Documents setup, indexing, deployment, API testing, response structure, folder layout, and authorship.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the Scam Shield bundle.
Description check ✅ Passed The description closely follows the checklist and covers the bundle, files, validation notes, and N/A items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Bundle: kits/scam-shield

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 912e7ad and 884feb4.

📒 Files selected for processing (14)
  • kits/scam-shield/.env.example
  • kits/scam-shield/.gitignore
  • kits/scam-shield/README.md
  • kits/scam-shield/agent.md
  • kits/scam-shield/constitutions/default.md
  • kits/scam-shield/flows/index-scam-patterns.ts
  • kits/scam-shield/flows/scam-message-triage.ts
  • kits/scam-shield/lamatic.config.ts
  • kits/scam-shield/model-configs/index-scam-patterns_vectorize-node-808_embedding-model-name.ts
  • kits/scam-shield/model-configs/scam-message-triage_ragnode-573_embedding-model-name.ts
  • kits/scam-shield/model-configs/scam-message-triage_ragnode-573_generative-model-name.ts
  • kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md
  • kits/scam-shield/prompts/scam-message-triage_ragnode-573_user_1.md
  • kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts

Comment thread kits/scam-shield/.gitignore Outdated
Comment thread kits/scam-shield/flows/index-scam-patterns.ts
Comment thread kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md Outdated
Comment thread kits/scam-shield/README.md
Comment thread kits/scam-shield/README.md
Comment thread kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts Outdated
… quarantine untrusted prompt content, clean up README
@coderabbitai
coderabbitai Bot requested review from amanintech and d-pamneja July 23, 2026 11:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Document the runtime shape or align the flow mapping.

kit/scam-shield/flows/scam-message-triage.ts maps modelResponse and references from RAGNode_573.output at 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

📥 Commits

Reviewing files that changed from the base of the PR and between 884feb4 and 2104fa0.

📒 Files selected for processing (5)
  • kits/scam-shield/.gitignore
  • kits/scam-shield/README.md
  • kits/scam-shield/flows/index-scam-patterns.ts
  • kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md
  • kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts

Comment thread kits/scam-shield/prompts/scam-message-triage_ragnode-573_system_0.md Outdated
Comment thread kits/scam-shield/README.md
Comment thread kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts Outdated
…tor keys, quarantine untrusted prompt content, fix README examples
@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/scripts/index-scam-patterns_code-node-948_code.ts (1)

14-23: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Mission alert: use a collision-resistant primary-key digest.

stableId produces only a 32-bit non-cryptographic hash, but kits/scam-shield/flows/index-scam-patterns.ts uses id as the VectorDB primary key with overwrite semantics. A collision can therefore silently replace an unrelated scam pattern. Use a cryptographic digest of the canonical name/content pair, or another collision-safe deterministic identifier.

🤖 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/scripts/index-scam-patterns_code-node-948_code.ts` around
lines 14 - 23, The stableId function currently uses a 32-bit non-cryptographic
hash that can collide and overwrite unrelated VectorDB records. Replace its hash
component with a collision-resistant cryptographic digest of the canonical
name/content pair, while preserving deterministic output and the existing
name-based prefix format.
🤖 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.

Outside diff comments:
In `@kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts`:
- Around line 14-23: The stableId function currently uses a 32-bit
non-cryptographic hash that can collide and overwrite unrelated VectorDB
records. Replace its hash component with a collision-resistant cryptographic
digest of the canonical name/content pair, while preserving deterministic output
and the existing name-based prefix format.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4c6bcb99-2c03-4800-b11a-6b26abeae886

📥 Commits

Reviewing files that changed from the base of the PR and between 2104fa0 and 146835c.

📒 Files selected for processing (2)
  • kits/scam-shield/README.md
  • kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/scripts/index-scam-patterns_code-node-948_code.ts`:
- Around line 23-26: Update stableId to build an unambiguous canonical
representation of name and content before hashing, using length or structured
encoding rather than a delimiter-only concatenation. Preserve the existing
normalized name prefix and SHA-256 digest generation, ensuring distinct field
pairs such as values containing "|" produce distinct IDs.
🪄 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: c741d71c-ba3c-4a33-a71b-6eccaba979c6

📥 Commits

Reviewing files that changed from the base of the PR and between 146835c and 1c0c365.

📒 Files selected for processing (1)
  • kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts

Comment thread kits/scam-shield/scripts/index-scam-patterns_code-node-948_code.ts
@GitRzh

GitRzh commented Jul 26, 2026

Copy link
Copy Markdown
Author

Hi @akshatvirmani — just checking in on this PR. All checks are passing and there are no conflicts with main, so it should be ready for review whenever you get a chance. Let me know if anything needs changes. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant