feat: Add docsense-agent kit#228
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughChangesDocSense Agent Kit
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 23
🤖 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/docsense-agent/.env.example`:
- Line 1: Remove the leading BOM character from the .env.example file so line 1
begins directly with the DOCSENSE_INTAKE variable declaration, preserving the
existing key and value unchanged.
In `@kits/docsense-agent/apps/.env.example`:
- Line 1: Rewrite the .env.example file so line 1 starts directly with the
DOCSENSE_INTAKE key, removing the leading UTF-8 BOM character while preserving
the existing variable name and value.
In `@kits/docsense-agent/apps/actions/orchestrate.ts`:
- Around line 91-92: Update the docId generation in the ReceivedDoc construction
to use a collision-resistant unique identifier rather than Date.now() alone,
ensuring concurrent submissions receive distinct IDs and their evidence trails
cannot overwrite each other.
- Around line 82-84: Validate the parsed LLM output in the reasoning flow before
assigning `satisfies` and `triggers`. Define and apply a zod schema that
enforces each satisfy entry and `InferredTrigger` field shape, including
required `requirementId`, and use only the validated values when calling
`applyDocument` and `detectAnomalies`; handle invalid output according to the
existing error path.
- Around line 91-96: Update the ReceivedDoc construction in the orchestration
flow to populate docType and extractedFacts from the flow’s actual structured
extraction output instead of the hardcoded "unknown" and empty object. Preserve
the existing docId and receivedAt behavior, and pass the payload fields expected
by requirement-state.ts into each stored receivedDocs entry.
In `@kits/docsense-agent/apps/app/layout.tsx`:
- Around line 10-12: Update the metadata title and description in the layout
configuration to use DocSense branding instead of the leftover “v0 App” and
“Created with v0” scaffold values, while leaving the generator setting
unchanged.
In `@kits/docsense-agent/apps/app/page.tsx`:
- Around line 31-47: Update handleAnalyze to wrap the intakeDocument call and
response handling in try/catch/finally. In the catch block, set an appropriate
error message from the thrown error, and move setLoading(false) into finally so
loading always ends for success, returned failures, and thrown server or network
errors.
In `@kits/docsense-agent/apps/components/header.tsx`:
- Around line 7-42: Update the header component’s hardcoded Tailwind color
classes, including border-slate-200, bg-white, text-slate-800, text-rose-500,
and the Docs/GitHub color classes, to use the app’s theme-aware CSS-variable
utility classes consistent with page.tsx, card.tsx, and drawer.tsx. Preserve the
existing layout, spacing, hover behavior, and link styling while ensuring all
header colors adapt to dark mode and custom themes.
In `@kits/docsense-agent/apps/components/ui/button-group.tsx`:
- Around line 1-5: Add the namespace React import used by the
React.ComponentProps references in the button-group component, matching the
import style of sibling components; leave the existing Slot, cva, cn, and
Separator imports unchanged.
In `@kits/docsense-agent/apps/components/ui/carousel.tsx`:
- Around line 96-105: Update the cleanup function in the React.useEffect
subscription around api, onSelect, and the reInit/select listeners to detach the
reInit listener as well as the select listener. Preserve the existing
subscription behavior and ensure both handlers are removed when the effect
reruns or unmounts.
In `@kits/docsense-agent/apps/components/ui/empty.tsx`:
- Around line 71-82: Update EmptyDescription so its props use the React
component props type for a div, matching the element it renders. Preserve the
existing className handling, data-slot attribute, and rendered styling.
In `@kits/docsense-agent/apps/components/ui/form.tsx`:
- Around line 28-30: Update FormFieldContext to use a null default, then change
useFormField to validate the context before reading fieldContext.name or calling
useFormState/getFieldState. Throw the existing missing-FormField error when no
context is present, while preserving normal field state behavior for valid
FormField usage.
In `@kits/docsense-agent/apps/components/ui/input-group.tsx`:
- Around line 64-79: Remove the role="group" attribute from the InputGroupAddon
component’s returned div, leaving the parent InputGroup as the sole group
landmark while preserving the addon’s other attributes and behavior.
- Around line 70-76: Update InputGroupAddon’s click handling so consumer props
do not overwrite the internal focus behavior: place prop spreading before the
internal onClick or explicitly compose both handlers. Change the queried control
selector to focus either the group’s input or textarea, while preserving the
existing button-click exclusion.
In `@kits/docsense-agent/apps/components/ui/label.tsx`:
- Around line 8-22: No functional change is required: keep the Label component’s
current prop spreading and ref behavior under React 19.2.0. Only convert Label
to React.forwardRef if consistency with other exposed UI primitives is
explicitly desired; otherwise leave the implementation unchanged.
In `@kits/docsense-agent/apps/components/ui/spinner.tsx`:
- Around line 1-5: Add the missing React import required by the
React.ComponentProps type annotation in Spinner, following the explicit import
pattern used by the surrounding UI components. Keep the existing Loader2Icon,
cn, and Spinner implementation unchanged.
In `@kits/docsense-agent/apps/lib/requirement-state.ts`:
- Around line 114-152: Update applyDocument so requirement status changes do not
mutate objects from the input profile: when marking a satisfied requirement as
received, create and store a replacement Requirement object in reqById while
preserving all existing fields. Keep the returned updated profile and
newlySurfaced behavior unchanged, and ensure the original profile.requirements
entries remain untouched.
In `@kits/docsense-agent/apps/next.config.mjs`:
- Around line 6-8: Document the rationale for setting images.unoptimized to true
in the Next.js configuration by adding a brief inline comment explaining why
built-in image optimization is intentionally disabled. Keep the existing
configuration value unchanged.
- Around line 3-5: Remove the ignoreBuildErrors setting from the Next.js
typescript configuration so production builds fail on TypeScript errors. Do not
replace it with a production-wide suppression; if development-only behavior is
required, gate it explicitly to development while keeping production validation
enabled.
In `@kits/docsense-agent/apps/README.md`:
- Around line 1-12: Update the README content for the DocSense Agent rather than
the copied Generation kit: change the title and descriptive references, use the
DocSense Vercel deployment settings with root directory kits/docsense-agent and
DOCSENSE_INTAKE, update setup instructions to reference DocSense, replace
AGENTIC_GENERATE_CONTENT with DOCSENSE_INTAKE, and revise the repository
structure to match the actual DocSense kit layout.
In `@kits/docsense-agent/flows/docsense-intake.ts`:
- Around line 143-154: Update the API Response node configuration identified by
nodeId "graphqlResponseNode" so its outputMapping maps the DocSense reasoning
node's payload into result. Replace the empty mapping while preserving the
existing response settings, ensuring executeFlow returns the reasoning output
for apps/actions/orchestrate.ts to parse.
- Around line 56-71: Update the triggerNode_1 configuration so its values
declaration uses the input name document instead of sampleInput, preserving the
existing string type/schema and trigger metadata to match the payload consumed
by the extraction flow.
In
`@kits/docsense-agent/model-configs/docsense-intake_llmnode-599_generative-model-name.ts`:
- Around line 4-13: The generativeModelName configuration has a
credential/provider mismatch. Update credential_name in the configuration entry
with provider_name "gemini" and model_name "gemini/gemini-2.5-flash" to the
correct Gemini credential name, preserving the existing credentialId mapping.
🪄 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
Run ID: eba7c51f-9690-47c5-9898-da926c389f1d
⛔ Files ignored due to path filters (1)
kits/docsense-agent/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (88)
kits/docsense-agent/.env.examplekits/docsense-agent/.gitignorekits/docsense-agent/README.mdkits/docsense-agent/agent.mdkits/docsense-agent/apps/.env.examplekits/docsense-agent/apps/.gitignorekits/docsense-agent/apps/README.mdkits/docsense-agent/apps/actions/orchestrate.tskits/docsense-agent/apps/app/globals.csskits/docsense-agent/apps/app/layout.tsxkits/docsense-agent/apps/app/page.tsxkits/docsense-agent/apps/components.jsonkits/docsense-agent/apps/components/header.tsxkits/docsense-agent/apps/components/theme-provider.tsxkits/docsense-agent/apps/components/ui/accordion.tsxkits/docsense-agent/apps/components/ui/alert-dialog.tsxkits/docsense-agent/apps/components/ui/alert.tsxkits/docsense-agent/apps/components/ui/aspect-ratio.tsxkits/docsense-agent/apps/components/ui/avatar.tsxkits/docsense-agent/apps/components/ui/badge.tsxkits/docsense-agent/apps/components/ui/breadcrumb.tsxkits/docsense-agent/apps/components/ui/button-group.tsxkits/docsense-agent/apps/components/ui/button.tsxkits/docsense-agent/apps/components/ui/calendar.tsxkits/docsense-agent/apps/components/ui/card.tsxkits/docsense-agent/apps/components/ui/carousel.tsxkits/docsense-agent/apps/components/ui/chart.tsxkits/docsense-agent/apps/components/ui/checkbox.tsxkits/docsense-agent/apps/components/ui/collapsible.tsxkits/docsense-agent/apps/components/ui/command.tsxkits/docsense-agent/apps/components/ui/context-menu.tsxkits/docsense-agent/apps/components/ui/dialog.tsxkits/docsense-agent/apps/components/ui/drawer.tsxkits/docsense-agent/apps/components/ui/dropdown-menu.tsxkits/docsense-agent/apps/components/ui/empty.tsxkits/docsense-agent/apps/components/ui/field.tsxkits/docsense-agent/apps/components/ui/form.tsxkits/docsense-agent/apps/components/ui/hover-card.tsxkits/docsense-agent/apps/components/ui/input-group.tsxkits/docsense-agent/apps/components/ui/input-otp.tsxkits/docsense-agent/apps/components/ui/input.tsxkits/docsense-agent/apps/components/ui/item.tsxkits/docsense-agent/apps/components/ui/kbd.tsxkits/docsense-agent/apps/components/ui/label.tsxkits/docsense-agent/apps/components/ui/menubar.tsxkits/docsense-agent/apps/components/ui/navigation-menu.tsxkits/docsense-agent/apps/components/ui/pagination.tsxkits/docsense-agent/apps/components/ui/popover.tsxkits/docsense-agent/apps/components/ui/progress.tsxkits/docsense-agent/apps/components/ui/radio-group.tsxkits/docsense-agent/apps/components/ui/resizable.tsxkits/docsense-agent/apps/components/ui/scroll-area.tsxkits/docsense-agent/apps/components/ui/select.tsxkits/docsense-agent/apps/components/ui/separator.tsxkits/docsense-agent/apps/components/ui/sheet.tsxkits/docsense-agent/apps/components/ui/sidebar.tsxkits/docsense-agent/apps/components/ui/skeleton.tsxkits/docsense-agent/apps/components/ui/slider.tsxkits/docsense-agent/apps/components/ui/sonner.tsxkits/docsense-agent/apps/components/ui/spinner.tsxkits/docsense-agent/apps/components/ui/switch.tsxkits/docsense-agent/apps/components/ui/table.tsxkits/docsense-agent/apps/components/ui/tabs.tsxkits/docsense-agent/apps/components/ui/textarea.tsxkits/docsense-agent/apps/components/ui/toast.tsxkits/docsense-agent/apps/components/ui/toaster.tsxkits/docsense-agent/apps/components/ui/toggle-group.tsxkits/docsense-agent/apps/components/ui/toggle.tsxkits/docsense-agent/apps/components/ui/tooltip.tsxkits/docsense-agent/apps/components/ui/use-mobile.tsxkits/docsense-agent/apps/components/ui/use-toast.tskits/docsense-agent/apps/hooks/use-mobile.tskits/docsense-agent/apps/hooks/use-toast.tskits/docsense-agent/apps/lib/lamatic-client.tskits/docsense-agent/apps/lib/requirement-state.tskits/docsense-agent/apps/lib/utils.tskits/docsense-agent/apps/next.config.mjskits/docsense-agent/apps/package.jsonkits/docsense-agent/apps/tsconfig.jsonkits/docsense-agent/constitutions/default.mdkits/docsense-agent/flows/docsense-intake.tskits/docsense-agent/lamatic.config.tskits/docsense-agent/model-configs/docsense-intake_llmnode-421_generative-model-name.tskits/docsense-agent/model-configs/docsense-intake_llmnode-599_generative-model-name.tskits/docsense-agent/prompts/docsense-intake_llmnode-421_system_0.mdkits/docsense-agent/prompts/docsense-intake_llmnode-421_user_1.mdkits/docsense-agent/prompts/docsense-intake_llmnode-599_system_0.mdkits/docsense-agent/prompts/docsense-intake_llmnode-599_user_1.md
| @@ -0,0 +1,4 @@ | |||
| DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID" | |||
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Remove the BOM character at the start of line 1.
A byte order mark (U+FEFF) precedes DOCSENSE_INTAKE. Some env parsers fail to handle BOM and will silently miss the first variable, causing DOCSENSE_INTAKE to be undefined at runtime.
🔧 Proposed fix
-DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID"
+DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID"📝 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.
| DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID" | |
| DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID" |
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 1-1: [LeadingCharacter] Invalid leading character detected
(LeadingCharacter)
🤖 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/docsense-agent/.env.example` at line 1, Remove the leading BOM character
from the .env.example file so line 1 begins directly with the DOCSENSE_INTAKE
variable declaration, preserving the existing key and value unchanged.
Source: Linters/SAST tools
| @@ -0,0 +1,4 @@ | |||
| DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID" | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove the BOM character from line 1.
Line 1 begins with a UTF-8 BOM (U+FEFF, rendered as ). Some .env parsers will read the key as \uFEFFDOCSENSE_INTAKE rather than DOCSENSE_INTAKE, silently causing the variable to never load. Rewrite the file without the BOM prefix.
🔧 Proposed fix
-DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID"
+DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID"📝 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.
| DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID" | |
| DOCSENSE_INTAKE="DOCSENSE_INTAKE Flow ID" |
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 1-1: [LeadingCharacter] Invalid leading character detected
(LeadingCharacter)
🤖 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/docsense-agent/apps/.env.example` at line 1, Rewrite the .env.example
file so line 1 starts directly with the DOCSENSE_INTAKE key, removing the
leading UTF-8 BOM character while preserving the existing variable name and
value.
Source: Linters/SAST tools
| const reasoning = parseReasoning(resData?.result); | ||
| const satisfies: string[] = reasoning.satisfies ?? []; | ||
| let triggers: InferredTrigger[] = reasoning.triggers ?? []; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Trust, but verify — the LLM's JSON is consumed unchecked.
reasoning.satisfies/reasoning.triggers are cast straight from parsed LLM output with no shape validation, so a malformed or hallucinated field (e.g. missing requirementId) flows directly into applyDocument/detectAnomalies. zod is already a project dependency — a small schema would catch drift cheaply.
♻️ Proposed validation
+import { z } from "zod";
+
+const ReasoningSchema = z.object({
+ satisfies: z.array(z.string()).optional(),
+ triggers: z
+ .array(
+ z.object({
+ requirementId: z.string(),
+ label: z.string(),
+ reason: z.string(),
+ })
+ )
+ .optional(),
+});
+
function parseReasoning(raw: unknown): ReasoningResult {
if (raw == null) return {};
- if (typeof raw === "object") return raw as ReasoningResult;
+ if (typeof raw === "object") {
+ const parsed = ReasoningSchema.safeParse(raw);
+ return parsed.success ? parsed.data : {};
+ }
if (typeof raw !== "string") return {};📝 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.
| const reasoning = parseReasoning(resData?.result); | |
| const satisfies: string[] = reasoning.satisfies ?? []; | |
| let triggers: InferredTrigger[] = reasoning.triggers ?? []; | |
| import { z } from "zod"; | |
| const ReasoningSchema = z.object({ | |
| satisfies: z.array(z.string()).optional(), | |
| triggers: z | |
| .array( | |
| z.object({ | |
| requirementId: z.string(), | |
| label: z.string(), | |
| reason: z.string(), | |
| }) | |
| ) | |
| .optional(), | |
| }); | |
| function parseReasoning(raw: unknown): ReasoningResult { | |
| if (raw == null) return {}; | |
| if (typeof raw === "object") { | |
| const parsed = ReasoningSchema.safeParse(raw); | |
| return parsed.success ? parsed.data : {}; | |
| } | |
| if (typeof raw !== "string") return {}; |
🤖 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/docsense-agent/apps/actions/orchestrate.ts` around lines 82 - 84,
Validate the parsed LLM output in the reasoning flow before assigning
`satisfies` and `triggers`. Define and apply a zod schema that enforces each
satisfy entry and `InferredTrigger` field shape, including required
`requirementId`, and use only the validated values when calling `applyDocument`
and `detectAnomalies`; handle invalid output according to the existing error
path.
| const doc: ReceivedDoc = { | ||
| docId: `doc-${Date.now()}`, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Date.now() isn't a safe cover identity for concurrent docs.
If two documents are submitted in the same millisecond (e.g. a batch upload via Promise.all), docId collisions overwrite each other's evidence trail.
🪪 Proposed fix
const doc: ReceivedDoc = {
- docId: `doc-${Date.now()}`,
+ docId: `doc-${crypto.randomUUID()}`,
docType: "unknown",📝 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.
| const doc: ReceivedDoc = { | |
| docId: `doc-${Date.now()}`, | |
| const doc: ReceivedDoc = { | |
| docId: `doc-${crypto.randomUUID()}`, | |
| docType: "unknown", |
🤖 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/docsense-agent/apps/actions/orchestrate.ts` around lines 91 - 92, Update
the docId generation in the ReceivedDoc construction to use a
collision-resistant unique identifier rather than Date.now() alone, ensuring
concurrent submissions receive distinct IDs and their evidence trails cannot
overwrite each other.
| const doc: ReceivedDoc = { | ||
| docId: `doc-${Date.now()}`, | ||
| docType: "unknown", | ||
| extractedFacts: {}, | ||
| receivedAt: new Date().toISOString(), | ||
| }; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
set -euo pipefail
printf 'Repo root: '; pwd
# Map relevant files and their sizes first
git ls-files 'kits/docsense-agent/apps/actions/orchestrate.ts' 'kits/docsense-agent/apps/**/requirement-state.ts' 'kits/docsense-agent/apps/**/flow*.ts' 'kits/docsense-agent/apps/**/flow*.tsx' 'kits/docsense-agent/apps/**/workflow*.ts'
echo
echo '--- outline orchestrate.ts ---'
ast-grep outline kits/docsense-agent/apps/actions/orchestrate.ts --view expanded || true
echo
echo '--- outline requirement-state.ts candidates ---'
for f in $(git ls-files 'kits/docsense-agent/apps/**/requirement-state.ts'); do
echo "FILE: $f"
ast-grep outline "$f" --view expanded || true
done
echo
echo '--- search for outputMapping / ReceivedDoc / docType / extractedFacts ---'
rg -n "outputMapping|ReceivedDoc|extractedFacts|docType|reasoning\.satisfies|reasoning\.triggers" kits/docsense-agent/apps -SRepository: Lamatic/AgentKit
Length of output: 3158
🏁 Script executed:
set -euo pipefail
# If the first query didn't find the exact files, discover nearby relevant ones.
echo '--- candidate files under kits/docsense-agent/apps ---'
fd -t f -a 'requirement-state.ts|orchestrate.ts|flow.*\.ts$|workflow.*\.ts$' kits/docsense-agent/apps || trueRepository: Lamatic/AgentKit
Length of output: 345
🏁 Script executed:
set -euo pipefail
# Read the relevant sections once the file locations are known.
# This script is intentionally read-only.
for f in kits/docsense-agent/apps/actions/orchestrate.ts $(git ls-files 'kits/docsense-agent/apps/**/requirement-state.ts' | head -n 5); do
[ -f "$f" ] || continue
echo "===== $f ====="
nl -ba "$f" | sed -n '1,220p'
echo
doneRepository: Lamatic/AgentKit
Length of output: 254
🏁 Script executed:
set -euo pipefail
echo '--- locate relevant files ---'
git ls-files 'kits/docsense-agent/apps/**/orchestrate.ts' 'kits/docsense-agent/apps/**/requirement-state.ts' 'kits/docsense-agent/apps/**/flow*.ts' 'kits/docsense-agent/apps/**/workflow*.ts'
echo
echo '--- search for key symbols ---'
rg -n "outputMapping|ReceivedDoc|extractedFacts|docType|reasoning\.satisfies|reasoning\.triggers|docId" kits/docsense-agent/apps -SRepository: Lamatic/AgentKit
Length of output: 1627
🏁 Script executed:
set -euo pipefail
echo '--- orchestrate.ts relevant slice ---'
sed -n '1,180p' kits/docsense-agent/apps/actions/orchestrate.ts
echo
echo '--- requirement-state.ts relevant slice ---'
sed -n '1,220p' kits/docsense-agent/apps/lib/requirement-state.tsRepository: Lamatic/AgentKit
Length of output: 9549
Wire the real extraction payload into ReceivedDoc kits/docsense-agent/apps/actions/orchestrate.ts: docType and extractedFacts are still hardcoded to "unknown" / {}, so every stored receivedDocs entry drops the evidence trail that requirement-state.ts expects. Pass through the flow’s actual structured output here instead.
🤖 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/docsense-agent/apps/actions/orchestrate.ts` around lines 91 - 96, Update
the ReceivedDoc construction in the orchestration flow to populate docType and
extractedFacts from the flow’s actual structured extraction output instead of
the hardcoded "unknown" and empty object. Preserve the existing docId and
receivedAt behavior, and pass the payload fields expected by
requirement-state.ts into each stored receivedDocs entry.
| images: { | ||
| unoptimized: true, | ||
| }, |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value
Consider documenting why image optimization is disabled.
images.unoptimized: true disables Next.js's built-in image optimization (lazy loading, responsive sizes, format conversion). If this is intentional for the kit (e.g., no image-heavy content), consider adding a brief comment explaining the rationale so future contributors don't remove it without understanding the context.
🤖 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/docsense-agent/apps/next.config.mjs` around lines 6 - 8, Document the
rationale for setting images.unoptimized to true in the Next.js configuration by
adding a brief inline comment explaining why built-in image optimization is
intentionally disabled. Keep the existing configuration value unchanged.
| # Agent Kit Generation by Lamatic.ai | ||
|
|
||
| <p align="center"> | ||
| <a href="https://agent-kit-generation.vercel.app" target="_blank"> | ||
| <img src="https://img.shields.io/badge/Live%20Demo-black?style=for-the-badge" alt="Live Demo" /> | ||
| </a> | ||
| </p> | ||
|
|
||
|
|
||
| **Agent Kit Generation** is an AI-powered content generation system built with [Lamatic.ai](https://lamatic.ai). It uses intelligent workflows to generate text, images, and JSON content through a modern Next.js interface with markdown rendering support. | ||
|
|
||
| [](https://vercel.com/new/clone?repository-url=https://github.com/Lamatic/AgentKit&root-directory=kits/agentic/generation&env=AGENTIC_GENERATE_CONTENT,LAMATIC_API_URL,LAMATIC_PROJECT_ID,LAMATIC_API_KEY&envDescription=Your%20Lamatic%20Generation%20keys%20are%20required.&envLink=https://lamatic.ai/templates/agentkits/agentic/agent-kit-generation) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
This README is copy-pasted from the Generation kit — update it for DocSense.
Every key reference points to the wrong kit. Users following these instructions will be unable to deploy or configure DocSense:
- Line 1: Title says "Agent Kit Generation" — should be "DocSense Agent"
- Line 12: Deploy URL uses
root-directory=kits/agentic/generationandenv=AGENTIC_GENERATE_CONTENT— should bekits/docsense-agentandDOCSENSE_INTAKE - Line 24: Template reference says "Select the 'Generation' agent kit" — should reference DocSense
- Lines 62-65: Env var
AGENTIC_GENERATE_CONTENTshould beDOCSENSE_INTAKE(matcheskits/docsense-agent/.env.example) - Lines 79-94: Repo structure doesn't match the actual kit layout
Would you like me to generate a corrected README tailored to the DocSense kit?
Also applies to: 20-27, 56-66
🤖 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/docsense-agent/apps/README.md` around lines 1 - 12, Update the README
content for the DocSense Agent rather than the copied Generation kit: change the
title and descriptive references, use the DocSense Vercel deployment settings
with root directory kits/docsense-agent and DOCSENSE_INTAKE, update setup
instructions to reference DocSense, replace AGENTIC_GENERATE_CONTENT with
DOCSENSE_INTAKE, and revise the repository structure to match the actual
DocSense kit layout.
| "id": "triggerNode_1", | ||
| "type": "triggerNode", | ||
| "position": { | ||
| "x": 0, | ||
| "y": 0 | ||
| }, | ||
| "data": { | ||
| "nodeId": "graphqlNode", | ||
| "trigger": true, | ||
| "values": { | ||
| "nodeName": "API Request", | ||
| "responeType": "realtime", | ||
| "advance_schema": "{\"sampleInput\":\"string\"}" | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check what variable name the extraction prompts actually interpolate.
rg -n "sampleInput|triggerNode_1.output" kits/docsense-agent/promptsRepository: Lamatic/AgentKit
Length of output: 154
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the relevant files first.
git ls-files 'kits/docsense-agent/flows/docsense-intake.ts' \
'kits/docsense-agent/flows/orchestrate.ts' \
'kits/docsense-agent/prompts/*'
echo '--- outline: docsense-intake.ts ---'
ast-grep outline kits/docsense-agent/flows/docsense-intake.ts --view expanded || true
echo '--- outline: orchestrate.ts ---'
ast-grep outline kits/docsense-agent/flows/orchestrate.ts --view expanded || true
echo '--- rg for triggerNode_1, sampleInput, document ---'
rg -n "triggerNode_1|sampleInput|documentText|resData\\?\\.result|outputMapping|advance_schema|responseNode" kits/docsense-agent/flows kits/docsense-agent/promptsRepository: Lamatic/AgentKit
Length of output: 1932
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the relevant slices with line numbers once the files are identified.
sed -n '1,240p' kits/docsense-agent/flows/docsense-intake.ts | cat -n
echo '---'
sed -n '1,240p' kits/docsense-agent/flows/orchestrate.ts | cat -nRepository: Lamatic/AgentKit
Length of output: 6409
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- files under kits/docsense-agent ---'
git ls-files 'kits/docsense-agent/**'
echo '--- search for documentText / sampleInput / triggerNode_1.output / advance_schema ---'
rg -n "documentText|sampleInput|triggerNode_1\\.output|advance_schema|outputMapping|docsense-intake" kits/docsense-agent .
echo '--- prompt contents (small slices) ---'
for f in kits/docsense-agent/prompts/docsense-intake_llmnode-599_system_0.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-599_user_1.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-421_system_0.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-421_user_1.md; do
echo "### $f"
sed -n '1,220p' "$f" | cat -n
echo
doneRepository: Lamatic/AgentKit
Length of output: 50373
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- docsense-intake prompts ---'
for f in kits/docsense-agent/prompts/docsense-intake_llmnode-599_system_0.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-599_user_1.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-421_system_0.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-421_user_1.md; do
echo "### $f"
nl -ba "$f" | sed -n '1,200p'
echo
done
echo '--- direct pattern search in docsense prompts ---'
rg -n "sampleInput|document|triggerNode_1\\.output" kits/docsense-agent/prompts/docsense-intake_*.mdRepository: Lamatic/AgentKit
Length of output: 299
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- apps/actions/orchestrate.ts ---'
nl -ba kits/docsense-agent/apps/actions/orchestrate.ts | sed -n '1,180p'
echo '--- apps/app/page.tsx ---'
nl -ba kits/docsense-agent/apps/app/page.tsx | sed -n '1,120p'Repository: Lamatic/AgentKit
Length of output: 230
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- prompt files with line numbers via awk ---'
for f in kits/docsense-agent/prompts/docsense-intake_llmnode-599_system_0.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-599_user_1.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-421_system_0.md \
kits/docsense-agent/prompts/docsense-intake_llmnode-421_user_1.md; do
echo "### $f"
awk '{printf "%4d %s\n", NR, $0}' "$f" | sed -n '1,220p'
echo
done
echo '--- quick search for common placeholder syntax ---'
rg -n "\{\{.*\}\}|sampleInput|documentText|triggerNode_1\.output|document" kits/docsense-agent/prompts/docsense-intake_*.mdRepository: Lamatic/AgentKit
Length of output: 5558
Rename the trigger input to document.
apps/actions/orchestrate.ts sends { document: documentText }, and the extraction prompt reads {{trigger.output.document}}, but triggerNode_1 still declares sampleInput. That leaves the document payload outside the flow 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/docsense-agent/flows/docsense-intake.ts` around lines 56 - 71, Update
the triggerNode_1 configuration so its values declaration uses the input name
document instead of sampleInput, preserving the existing string type/schema and
trigger metadata to match the payload consumed by the extraction flow.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
Studio Runtime Validation (Phase 2)✅ Studio validation passed. The kit loaded successfully in Lamatic Studio. This PR is ready for final review and merge. |
|
@mehwishafsa please resolve the comments above |
|
Hi @akshatvirmani, thanks for the review! The CodeRabbit auto-review was
skipped due to the label gate, so I've added the `agentkit-challenge` label
and triggered it manually with ***@***.*** review`. I'll address
anything it flags right away. Studio Runtime Validation (Phase 2) is
already passing. Will follow up once CodeRabbit posts its review.
…On Mon, Jul 13, 2026 at 5:18 PM Akshat Virmani ***@***.***> wrote:
*akshatvirmani* left a comment (Lamatic/AgentKit#228)
<#228 (comment)>
@mehwishafsa <https://github.com/mehwishafsa> please resolve the comments
above
—
Reply to this email directly, view it on GitHub
<#228?email_source=notifications&email_token=BPPEEUYIFNZOLHFU5XWDOND5ETD7VA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJVG43DAMZWG422M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4957603675>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPPEEU5OAWSWXTMUQC6JJGD5ETD7VAVCNFSNUABGKJSXA33TNF2G64TZHMYTANRXGY2TCNJUGE5US43TOVSTWNBYGY3DKNJTG43THILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BPPEEU2D4TDIPEDCQXVG5HT5ETD7VA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJVG43DAMZWG422M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/BPPEEU5E2UGYG54DFP6X5DD5ETD7VA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJVG43DAMZWG422M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
|
Hello @mehwishafsa great! One thing: please resolve the remaining coderabbit comments |
|
@coderabbitai review |
✅ Action performedReview finished.
|
DocSense — Adaptive Document-Intake Agent
An agentic document-intake kit for accountants. It reads each client document as it arrives and infers what's still missing — instead of relying on a static checklist.
The problem: you never know the full list of documents you need until you start reading what the client sends. A foreign payment means an extra tax form; a large cash deposit means a source-of-funds note. Today that depends on one person's memory.
What it does: reads each document, extracts the facts, and proposes new requirements the document triggers — each with cited evidence. For returning clients it stays quiet on routine items and surfaces only what's different this year.
Architecture: the Lamatic flow (
docsense-intake: extraction → reasoning) does the fuzzy LLM work; a deterministic state model (apps/lib/requirement-state.ts) tracks the living requirement list and diffs returning clients against their baseline — so every requirement is explainable, never hallucinated.Built with a two-node Lamatic flow + a Next.js app. Tested end-to-end.
docsense-intakeflow: