Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions kits/ai-pr-reviewer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AI PR Code Reviewer & Security Auditor

An agentic workflow built on **Lamatic.ai AgentKit** designed to automate Pull Request reviews. This agent acts as a first line of defense in CI/CD pipelines by analyzing code snippets or git diffs for security vulnerabilities and performance improvements.

## The Problem
Manual code reviews are time-consuming, and senior engineers often waste hours pointing out basic linting errors or missing security checks.
Comment on lines +5 to +6

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the Markdown heading spacing.

Insert one blank line after the headings at Line 5, Line 8, Line 11, and Line 16. markdownlint-cli2 reports MD022 for each location, which can fail documentation checks.

Based on the supplied static-analysis report, these four MD022 violations require correction.

Also applies to: 8-9, 11-12, 16-17

🧰 Tools
🪛 markdownlint-cli2 (0.23.1)

[warning] 5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 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/ai-pr-reviewer/README.md` around lines 5 - 6, Update the Markdown
headings in README.md at the affected sections, including “The Problem” and the
headings at the other reported locations, by inserting exactly one blank line
after each heading. Preserve the existing heading text and surrounding content
so all MD022 violations are resolved.

Source: Linters/SAST tools


## The Solution (This Agent)
By integrating this AgentKit flow into a webhook or CI pipeline, development teams get instant, structured feedback on their code before a human ever looks at it.

## Features
- **Security Audit:** Flags OWASP top 10 vulnerabilities (e.g., SQL injection, hardcoded secrets).
- **Code Optimization:** Suggests specific refactors for time/space complexity.
- **Structured JSON Output:** Returns actionable data that can be parsed directly into GitHub PR comments.

## Workflow Structure
1. **Trigger:** Receives raw code or a git diff.
2. **Review Node (LLM):** A highly constrained prompt evaluates the code against strict engineering standards.
3. **Formatting Node:** Outputs a structured JSON payload with `vulnerabilities`, `refactor_suggestions`, and a `pass_fail` boolean.
Comment on lines +3 to +19

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Mission requirement: add a human-readable setup guide.

This README describes the purpose and workflow but does not explain how to install, register, configure, invoke, or consume the kit. Add a Setup section with prerequisites, flow registration, required environment variables or credentials, input format, output schema, and a minimal CI or webhook example.

As per coding guidelines, each kits/*/README.md file must contain a human-readable setup guide.

🧰 Tools
🪛 markdownlint-cli2 (0.23.1)

[warning] 5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 8-8: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 11-11: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 16-16: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 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/ai-pr-reviewer/README.md` around lines 3 - 19, Add a human-readable
Setup section to the README covering prerequisites, AgentKit flow registration,
required environment variables or credentials, accepted code/diff input format,
the structured output schema, and a minimal CI or webhook invocation example.
Keep the existing purpose and workflow sections unchanged and document the
concrete setup and consumption steps using the kit’s established symbols and
configuration names.

Source: Coding guidelines

2 changes: 2 additions & 0 deletions kits/ai-pr-reviewer/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# AI PR Code Reviewer
This agent automatically reviews code for security vulnerabilities and performance bottlenecks, acting as a first line of defense in your CI/CD pipeline.
Comment on lines +1 to +2

@coderabbitai coderabbitai Bot Aug 1, 2026

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Mission requirement: add the missing blank line.

Insert one blank line after the AI PR Code Reviewer heading. This fixes Markdown rule MD022 and preserves the documented agent identity and capabilities.

Proposed fix
 # AI PR Code Reviewer
+
 This agent automatically reviews code for security vulnerabilities and performance bottlenecks, acting as a first line of defense in your CI/CD pipeline.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# AI PR Code Reviewer
This agent automatically reviews code for security vulnerabilities and performance bottlenecks, acting as a first line of defense in your CI/CD pipeline.
# AI PR Code Reviewer
This agent automatically reviews code for security vulnerabilities and performance bottlenecks, acting as a first line of defense in your CI/CD pipeline.
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)

[warning] 1-1: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 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/ai-pr-reviewer/agent.md` around lines 1 - 2, Insert a single blank line
immediately after the “AI PR Code Reviewer” heading in the document, before the
descriptive paragraph, while leaving the heading and surrounding content
unchanged.

Source: Linters/SAST tools

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- changed files ---'
git diff --name-status "$(git merge-base HEAD origin/main)" HEAD 2>/dev/null || git diff --name-status HEAD~1 HEAD

printf '%s\n' '--- kit file structure ---'
fd . kits/ai-pr-reviewer --type f 2>/dev/null | sort

printf '%s\n' '--- agent.md with line numbers ---'
nl -ba kits/ai-pr-reviewer/agent.md

printf '%s\n' '--- configuration and flow ---'
for f in kits/ai-pr-reviewer/lamatic.config.ts kits/ai-pr-reviewer/flows/code-review.json kits/ai-pr-reviewer/README.md kits/ai-pr-reviewer/constitutions/default.md; do
  if [ -f "$f" ]; then
    echo "### $f"
    nl -ba "$f"
  fi
done

printf '%s\n' '--- markdownlint configuration ---'
fd -HI 'markdownlint*' . --max-depth 3 --type f -x sh -c 'echo "### $1"; cat "$1"' sh {} \;

Length of output: 1603


🏁 Script executed:

#!/bin/bash
set -euo pipefail

print_file() {
  file="$1"
  if [ -f "$file" ]; then
    printf '\n### %s\n' "$file"
    awk '{ printf "%6d  %s\n", NR, $0 }' "$file"
  fi
}

print_file kits/ai-pr-reviewer/agent.md
print_file kits/ai-pr-reviewer/lamatic.config.ts
print_file kits/ai-pr-reviewer/flows/code-review.ts
print_file kits/ai-pr-reviewer/README.md
print_file kits/ai-pr-reviewer/constitutions/default.md

printf '\n--- relevant repository examples ---\n'
find kits -path '*/flows/*.ts' -type f -print | head -20 | while IFS= read -r file; do
  printf '\n### %s\n' "$file"
  sed -n '1,160p' "$file"
done

printf '\n--- Markdown lint configuration ---\n'
find . -maxdepth 3 -type f \( -iname '*markdownlint*' -o -name '.remarkrc*' \) -print | while IFS= read -r file; do
  printf '\n### %s\n' "$file"
  sed -n '1,200p' "$file"
done

Length of output: 161730


@IamSushii, mission review complete.

Findings

  1. Blocking — Flow module does not use the AgentKit flow format
    kits/ai-pr-reviewer/flows/code-review.ts exports a raw { name, nodes, edges } object. Other kit flows export meta, inputs, references, nodes, and edges, then default-export those values. The current node types ("trigger", "llm", "response") also do not match the Lamatic node definitions used by the repository. The template will not load as an executable AgentKit flow. Convert this file to the established flow module format.

  2. Minor — Markdown heading requires a blank line
    kits/ai-pr-reviewer/agent.md Line 1 must have one blank line before the description on Line 2. This resolves MD022.

You are interacting with an AI system.

4 changes: 4 additions & 0 deletions kits/ai-pr-reviewer/constitutions/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Default Constitution
1. Always prioritize identifying security vulnerabilities.
2. Provide specific, actionable refactoring suggestions.
3. Be polite and concise in GitHub PR comments.
37 changes: 37 additions & 0 deletions kits/ai-pr-reviewer/flows/code-review.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export default {
"name": "Automated Code Review Flow",
"description": "Analyzes input code snippets for security vulnerabilities and optimization opportunities.",
"nodes": [
Comment on lines +1 to +4

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Mission requirement: add the required self-contained flow sections.

The export defines name, description, nodes, and edges, but it does not define meta, inputs, or references. Add the required top-level sections and place the flow metadata, input contract, and node references in them before merge.

As per coding guidelines, each kits/*/flows/*.ts file must contain self-contained meta, inputs, references, nodes, and edges.

🤖 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/ai-pr-reviewer/flows/code-review.ts` around lines 1 - 4, Add the missing
top-level meta, inputs, and references sections to the default exported flow
object in code-review.ts, alongside the existing name, description, nodes, and
edges. Populate them with the flow metadata, input contract, and node references
required for a self-contained kits/*/flows/*.ts definition, while preserving the
existing nodes and edges.

Source: Coding guidelines

{
"id": "input_code",
"type": "trigger",
"label": "Code Snippet Input",
"config": {
"inputType": "text",
"placeholder": "Paste your code snippet or git diff here..."
}
},
{
"id": "llm_auditor",
"type": "llm",
"label": "DevSecOps LLM",
"config": {
"model": "gpt-4o",
"temperature": 0.1,
"systemPrompt": "You are a Principal Security Engineer and strict code reviewer. Analyze the provided code. Output a JSON object containing: 1) 'pass_fail' (boolean), 2) 'vulnerabilities' (array of strings, empty if none), 3) 'optimizations' (array of specific refactoring suggestions), and 4) 'pr_comment' (a polite markdown summary of your review ready for GitHub)."

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Align the flow fields with the documented response contract.

The systemPrompt requires optimizations and pr_comment, but kits/ai-pr-reviewer/README.md documents refactor_suggestions and omits pr_comment. Consumers can parse the wrong key or miss the GitHub-ready comment. Choose one canonical schema and use it in the prompt, output validation, and documentation.

Based on the supplied flow and README, the response field names are inconsistent.

🤖 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/ai-pr-reviewer/flows/code-review.json` at line 21, Align the response
schema across the systemPrompt, output validation, and README documentation:
choose one canonical field set, ensuring the optimization suggestions key and
GitHub-ready review comment key match everywhere. Update the flow’s documented
JSON contract and any validation or consumer references together, using the
existing symbols for the response schema rather than maintaining aliases.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep one response schema across the flow and README.

The flow and README define different JSON keys for the same response contract. The flow requires optimizations and pr_comment, while the README documents refactor_suggestions and omits pr_comment; this can make CI consumers parse the wrong key or miss the GitHub-ready comment.

  • kits/ai-pr-reviewer/flows/code-review.json#L21-L21: use the canonical field names in systemPrompt.
  • kits/ai-pr-reviewer/README.md#L19-L19: document the same keys and types as the flow.

Based on the supplied flow and README, the response contract must be identical at both sites.

📍 Affects 2 files
  • kits/ai-pr-reviewer/flows/code-review.json#L21-L21 (this comment)
  • kits/ai-pr-reviewer/README.md#L19-L19
🤖 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/ai-pr-reviewer/flows/code-review.json` at line 21, The response schema
must match across both documentation and implementation. In
kits/ai-pr-reviewer/flows/code-review.json:21-21, update the systemPrompt to use
the canonical response field names; in kits/ai-pr-reviewer/README.md:19-19,
document those same keys and types, including optimizations and pr_comment and
removing or renaming refactor_suggestions.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate flow file =="
fd -a 'code-review\.json$' . || true

echo "== inspect target file =="
if [ -f kits/ai-pr-reviewer/flows/code-review.json ]; then
  cat -n kits/ai-pr-reviewer/flows/code-review.json
fi

echo "== search for code-review pass_fail usage =="
rg -n "code-review|pass_fail|vulnerabilities|strict code reviewer|systemPrompt" . || true

echo "== inspect kit package metadata =="
fd -a . kits/ai-pr-reviewer | head -50
[ -f kits/ai-pr-reviewer/package.json ] && cat -n kits/ai-pr-reviewer/package.json
[ -f kits/ai-pr-reviewer/README.md ] && cat -n kits/ai-pr-reviewer/README.md

Repository: Lamatic/AgentKit

Length of output: 35442


Define the pass_fail policy before running this flow in CI.

The LLM is asked for a pass_fail boolean, but no threshold makes it false. An LLM response can list critical security issues and still return true. Define severity levels, set explicit fail thresholds, and enforce the CI result from vulnerabilities instead of trusting the free-form boolean.

🤖 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/ai-pr-reviewer/flows/code-review.json` at line 21, Update the
systemPrompt in the code-review flow to define explicit vulnerability severity
levels and the threshold that makes the review fail, then require pass_fail to
reflect those rules. Ensure CI enforcement derives its result from the
classified vulnerabilities and configured fail threshold rather than trusting
the LLM-generated boolean alone.

}
},
{
"id": "output_report",
"type": "response",
"label": "CI/CD JSON Response",
"config": {
"format": "json"
}
Comment on lines +25 to +30

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 10 '"type": "(llm|response)"|format": "json"|schema|response_format|structured' kits --glob '*.json'

Repository: Lamatic/AgentKit

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== target file =="
wc -l kits/ai-pr-reviewer/flows/code-review.json
cat -n kits/ai-pr-reviewer/flows/code-review.json | sed -n '1,80p'

echo
echo "== focused response/json/schema occurrences in kits/ai-pr-reviewer =="
rg -n -C 6 '"id": "output_report"|"type": "response"|"format": "json"|schema|jsonOutput|parse_json|json' kits/ai-pr-reviewer --glob '*.json' --glob '*.ts' --glob '*.js' || true

echo
echo "== candidates for response node implementation =="
rg -n 'registerNode|type.*response|format[": ]+.json|json-format|parse.*json|response_format|structured' kits/ai-pr-reviewer packages core src --glob '*.ts' --glob '*.js' --glob '*.tsx' --glob '*.jsx' || true

Repository: Lamatic/AgentKit

Length of output: 3505


🌐 Web query:

Lamatic AgentKit response node format json schema validation

💡 Result:

In the Lamatic ecosystem, there is no single monolithic "response node schema validation" format. Instead, validation is handled through specific nodes and configuration practices depending on whether you are working with flow-level response definitions or agent-level structured data generation [1][2]. 1. Flow Response Node: The responseNode in a flow configuration does not typically enforce a strict JSON schema validation at the node level itself [1]. Instead, it uses an outputMapping block within the node configuration to aggregate data from previous nodes [1]. This mapping uses a dictionary of key-value pairs where you can structure your final response by referencing outputs from earlier nodes (e.g., "{{LLMNode_187.output.generatedResponse}}") [1]. 2. Structured Data Generation: If you require strict JSON schema validation, you should use the Generate JSON Node [2][3]. This node is specifically designed to enforce a fixed output shape [3]. It allows you to define an Output Schema using Zod JSON, which the AI model then uses to generate structured JSON data that conforms to your specified rules [2]. 3. AgentKit Validation: If you are referring to validating AgentKit contributions or configurations, this is handled by external tools rather than a runtime response node [4]. The @lamatic/mcp tools, specifically kit_validate_structure, are used to perform structural checks on local kit folders to ensure they meet the project requirements before submitting a PR [5][4]. Summary of approaches: - To shape final output: Use outputMapping in the responseNode [1]. - To enforce strict JSON structure: Use the Generate JSON Node with a Zod JSON schema [2]. - To validate AgentKit projects: Use the @lamatic/mcp utility tool kit_validate_structure [5][4].

Citations:


Mission requirement: enforce the CI JSON shape before emitting output.

output_report only declares "format": "json". The LLM prompt requests four typed fields, but the flow has no schema or validation for pass_fail, vulnerabilities, optimizations, and pr_comment. Add a supported strict schema validation before the CI output so markdown fences, extra text, missing keys, and wrong types cannot pass as valid JSON.

🤖 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/ai-pr-reviewer/flows/code-review.json` around lines 25 - 30, Update the
output_report response configuration to enforce a supported strict JSON schema
for pass_fail, vulnerabilities, optimizations, and pr_comment before emitting CI
output. Require all four fields with their expected types, reject markdown
fences, extra text, missing keys, and type mismatches, and preserve the existing
JSON response behavior for valid results.

}
],
"edges": [
{ "source": "input_code", "target": "llm_auditor" },
{ "source": "llm_auditor", "target": "output_report" }
]
};
12 changes: 12 additions & 0 deletions kits/ai-pr-reviewer/lamatic.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
id: "ai-pr-reviewer",
name: "AI PR Code Reviewer & Security Auditor",
description: "An automated agent that analyzes git diffs or code snippets for security vulnerabilities, performance bottlenecks, and clean-code refactoring.",
type: "template",
author: "Sushobhita Majhi",
category: "Developer Tools / CI-CD",
tags: ["LLM", "Code Review", "DevSecOps", "Agentic Workflow"],
links: {
github: "kits/ai-pr-reviewer"
}
};
Comment on lines +1 to +12

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate configs =="
git ls-files 'kits/*/lamatic.config.ts' | sed -n '1,80p'

echo
echo "== targeted configs =="
for f in kits/ai-pr-reviewer/lamatic.config.ts kits/sentinel-iq/lamatic.config.ts; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    cat -n "$f"
  fi
done

echo
echo "== files in ai-pr-reviewer =="
git ls-files kits/ai-pr-reviewer | sed -n '1,120p'

echo
echo "== schema/metadata references for kit config fields =="
rg -n "lamatic\.config|type: \"template\"|type: \"kit\"|author|steps|links" -S --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' . | sed -n '1,220p'

Repository: Lamatic/AgentKit

Length of output: 15738


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== flow id =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path('kits/ai-pr-reviewer/flows/code-review.json')
if p.exists():
    data = json.loads(p.read_text())
    print("file:", p)
    for key in ["name", "id", "type", "title", "steps"]:
        print(f"{key}:", repr(data.get(key)))
PY

echo
echo "== lamatic.config metadata docs =="
sed -n '85,125p' CLAUDE.md

echo
echo "== registry entries for ai-pr-reviewer =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path('registry.json')
if p.exists():
    data = json.loads(p.read_text())
    if isinstance(data, list):
        entries = [e for e in data if e.get('id') == 'ai-pr-reviewer' or e.get('name') == 'AI PR Code Reviewer & Security Auditor']
    else:
        entries = []
    print("match_count:", len(entries))
    for e in entries[:5]:
        print(json.dumps({k:e.get(k) for k in sorted(e.keys()) if k in {'id','name','type','author','steps','links'}}, indent=2))
PY

echo
echo "== occurrences of ai-pr-reviewer =="
rg -n "ai-pr-reviewer|AI PR Code Reviewer" -S --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' . | sed -n '1,120p'

Repository: Lamatic/AgentKit

Length of output: 1880


Mission: register the code-review flow in kit metadata.

kits/ai-pr-reviewer/lamatic.config.ts is missing required steps and links. Add a steps entry for the code-review flow and populate the kit metadata links for GitHub/deploy/docs. Use the documented type/author metadata shape so this kit passes the metadata contract.

🤖 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/ai-pr-reviewer/lamatic.config.ts` around lines 1 - 9, Update the default
kit metadata object in lamatic.config.ts to include the required steps entry for
the AI PR code-review flow and links for GitHub, deployment, and documentation.
Align the type and author fields with the documented metadata contract while
preserving the existing identity, description, category, and tags.

Source: Coding guidelines

Loading