Skip to content

feat: Add CollectFlow for AI-powered Accounts Receivable Collections#250

Merged
akshatvirmani merged 11 commits into
Lamatic:mainfrom
Sms1818:feat/collectflow-kit
Jul 20, 2026
Merged

feat: Add CollectFlow for AI-powered Accounts Receivable Collections#250
akshatvirmani merged 11 commits into
Lamatic:mainfrom
Sms1818:feat/collectflow-kit

Conversation

@Sms1818

@Sms1818 Sms1818 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds CollectFlow, an AI-native Accounts Receivable decision-support kit built with Lamatic AgentKit.

CollectFlow helps Accounts Receivable teams prioritize overdue customers, generate explainable collection strategies, introduce human approval for sensitive actions, and track collection outcomes through a guided workflow.


Contribution Type

  • Kit

What is Included

🤖 AI Workflows

  • Portfolio Intelligence

    • Analyze a synchronized AR portfolio
    • Generate a ranked collector queue
    • Explain priority scores
    • Classify customer risk
    • Recommend treatment lanes
  • Customer Strategy

    • Generate customer-specific Next Best Actions
    • Explain AI reasoning
    • Recommend communication channels
    • Generate outreach drafts
    • Recommend follow-up timing
    • Determine whether manager approval is required

💻 Demo Application

A Next.js application demonstrating the complete workflow:

  1. Analyze Portfolio
  2. Review AI-ranked customers
  3. Generate customer strategy
  4. Manager approval (when required)
  5. Record collection outcome
  6. Update collection timeline

Repository Structure

kits/collectflow/
├── apps/
├── assets/
├── flows/
├── prompts/
├── model-configs/
├── constitutions/
├── README.md
├── agent.md
└── lamatic.config.ts

Tech Stack

  • Lamatic AgentKit
  • Next.js
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • Groq
  • Vercel

Live Demo

https://collectflow-nine.vercel.app


Notes

This MVP intentionally focuses on a single end-to-end Accounts Receivable workflow:

Portfolio Analysis
        ↓
Customer Prioritization
        ↓
Customer Strategy
        ↓
Manager Approval
        ↓
Outcome Recording
        ↓
Collection Timeline

To keep the contribution focused, the following are intentionally out of scope:

  • Live ERP integrations (QuickBooks, SAP, NetSuite)
  • Persistent database
  • Email/SMS delivery
  • Authentication
  • Multi-user collaboration
  • Payment processing

Validation

  • Project builds successfully
  • Lamatic workflows exported from Lamatic Studio
  • .env.example included
  • README, agent documentation, and constitution included
  • No secrets or API keys committed
  • Live demo deployed on Vercel
  • Added kits/collectflow/ “CollectFlow” AR decision-support kit:

    • Documentation/specs: kits/collectflow/README.md, kits/collectflow/agent.md, kits/collectflow/constitutions/default.md
    • Env examples: kits/collectflow/.env.example, kits/collectflow/apps/.env.example
    • Kit config: kits/collectflow/lamatic.config.ts
    • Workflows:
      • kits/collectflow/flows/collect-flow-portfolio-intelligence.ts
      • kits/collectflow/flows/collect-flow-customer-strategy.ts
    • Model configs:
      • kits/collectflow/model-configs/collect-flow-portfolio-intelligence_instructor-llmnode-226_generative-model-name.ts
      • kits/collectflow/model-configs/collect-flow-customer-strategy_instructor-llmnode-730_generative-model-name.ts
    • Prompts:
      • kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md
      • kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_user_1.md
      • kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.md
      • kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_user_1.md
  • Updated/re-added node/edge types as defined in the flow graph files (no separate model node in these graphs):

    • Node type values used:
      • triggerNode (API request input)
      • dynamicNode (Instructor LLM step, e.g. InstructorLLMNode_226 / InstructorLLMNode_730)
      • responseNode (API response/output mapping)
    • Edge type values used:
      • defaultEdge (trigger → instructor → response node wiring)
      • responseEdge (trigger → response node wiring)
  • CollectFlow Portfolio Intelligence workflow (collect-flow-portfolio-intelligence.ts) high-level behavior:

    • Trigger (triggerNode_1) accepts portfolio_data as a string (advance_schema)
    • Instructor step (dynamicNode / InstructorLLMNode_226) runs the portfolio intelligence prompts + default constitution and returns structured JSON:
      • portfolio_summary (e.g., customers_analyzed, total_overdue, etc.)
      • ranked_queue (top 5 ranked customers with risk_level, treatment_lane, approval_required, priority_explanation, priority_score, etc.)
    • Response node (responseNode_triggerNode_1) outputs portfolio_summary and ranked_queue as JSON with content-type: application/json
  • CollectFlow Customer Strategy workflow (collect-flow-customer-strategy.ts) high-level behavior:

    • Trigger (triggerNode_1) accepts customer_data as a string (advance_schema)
    • Instructor step (dynamicNode / InstructorLLMNode_730) runs the customer strategy prompts + default constitution and returns structured JSON including:
      • next_best_action, action_summary, reasoning[]
      • recommended_channel, confidence
      • approval_required, approval_reason
      • operational_controls[]
      • draft_subject, draft_message
      • journey_state, next_follow_up_days
    • Response node (responseNode_triggerNode_1) maps Instructor outputs into the API response payload
  • Added a Next.js/TypeScript demo under kits/collectflow/apps/:

    • App scaffolding/config/docs: kits/collectflow/apps/README.md, kits/collectflow/apps/AGENTS.md, kits/collectflow/apps/CLAUDE.md, kits/collectflow/apps/components.json, kits/collectflow/apps/.gitignore, kits/collectflow/apps/eslint.config.mjs, kits/collectflow/apps/next.config.ts, kits/collectflow/apps/postcss.config.mjs, kits/collectflow/apps/tsconfig.json, kits/collectflow/apps/package.json
    • Styling: kits/collectflow/apps/app/globals.css
    • Demo data: kits/collectflow/apps/app/data/demoPortfolio.ts
    • Domain/model helpers:
      • kits/collectflow/apps/app/lib/types.ts
      • kits/collectflow/apps/app/lib/outcomes.ts
      • kits/collectflow/apps/app/lib/lamatic-client.ts
      • kits/collectflow/apps/app/actions/orchestrate.ts (typed analyzePortfolio / generateCustomerStrategy flow execution + structured output validation)
    • Next.js pages/layout:
      • kits/collectflow/apps/app/layout.tsx
      • kits/collectflow/apps/app/page.tsx (end-to-end UI flow: portfolio analysis → per-customer strategy → approval gate → outcome recording → timeline)
      • kits/collectflow/apps/app/components/layout/app-header.tsx
      • kits/collectflow/apps/app/components/portfolio/data-source-card.tsx
      • kits/collectflow/apps/app/components/portfolio/portfolio-view.tsx
      • kits/collectflow/apps/app/components/strategy/approval-card.tsx
      • kits/collectflow/apps/app/components/strategy/outcome-card.tsx
      • kits/collectflow/apps/app/components/strategy/strategy-view.tsx
    • UI component library + utilities under kits/collectflow/apps/components/ui/ and kits/collectflow/apps/lib/:
      • kits/collectflow/apps/components/ui/avatar.tsx
      • kits/collectflow/apps/components/ui/badge.tsx
      • kits/collectflow/apps/components/ui/button.tsx
      • kits/collectflow/apps/components/ui/card.tsx
      • kits/collectflow/apps/components/ui/scroll-area.tsx
      • kits/collectflow/apps/components/ui/select.tsx
      • kits/collectflow/apps/components/ui/separator.tsx
      • kits/collectflow/apps/components/ui/table.tsx
      • kits/collectflow/apps/components/ui/textarea.tsx
      • kits/collectflow/apps/lib/utils.ts (the cn className merge helper)

Copilot AI review requested due to automatic review settings July 15, 2026 13:13
@coderabbitai

coderabbitai Bot commented Jul 15, 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

CollectFlow adds Lamatic portfolio-intelligence and customer-strategy workflows, structured prompts and model configurations, plus a Next.js interface for ranked collections, manager approval, outcome recording, and collection journey tracking.

Changes

CollectFlow application and workflow

Layer / File(s) Summary
Agent contracts and Lamatic workflows
kits/collectflow/agent.md, kits/collectflow/constitutions/default.md, kits/collectflow/flows/*, kits/collectflow/prompts/*, kits/collectflow/model-configs/*, kits/collectflow/lamatic.config.ts
Defines AR decision-support rules, structured outputs, human approval constraints, portfolio and customer strategy flows, prompts, model settings, and kit metadata.
Next.js application foundation and UI primitives
kits/collectflow/apps/package.json, kits/collectflow/apps/app/lib/*, kits/collectflow/apps/app/layout.tsx, kits/collectflow/apps/app/globals.css, kits/collectflow/apps/components/ui/*, kits/collectflow/apps/*config*
Sets up the Next.js application, shared customer and outcome types, Lamatic client configuration, styling tokens, and reusable UI components.
Portfolio analysis and collector queue
kits/collectflow/apps/app/actions/orchestrate.ts, kits/collectflow/apps/app/data/demoPortfolio.ts, kits/collectflow/apps/app/components/portfolio/*, kits/collectflow/apps/app/page.tsx
Executes portfolio analysis, maps ranked results to demo customers, and renders portfolio metrics, customer records, ranked queues, and strategy entry points.
Customer strategy approval and outcome journey
kits/collectflow/apps/app/components/strategy/*, kits/collectflow/apps/app/page.tsx
Generates customer strategies, handles approval and rejection states, records collection outcomes, and renders the outcome-driven journey timeline.
Project documentation and local configuration
kits/collectflow/README.md, kits/collectflow/.env.example, kits/collectflow/apps/.env.example, kits/collectflow/apps/.gitignore, kits/collectflow/apps/README.md, kits/collectflow/apps/AGENTS.md, kits/collectflow/apps/CLAUDE.md
Adds project documentation, Lamatic environment placeholders, local ignore rules, and application guidance.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the PR's main change: adding the CollectFlow AR collections kit.
Description check ✅ Passed The description covers the kit, workflows, structure, tech stack, demo, scope, and validation, with only a few checklist details implied.
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

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/collectflow

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.

Copilot AI 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.

Pull request overview

This PR introduces a new kit, CollectFlow, providing two Lamatic AgentKit workflows (Portfolio Intelligence + Customer Strategy) and a Next.js demo app that walks through prioritization → strategy generation → optional manager approval → outcome recording.

Changes:

  • Added CollectFlow kit documentation, constitution/guardrails, and agent docs.
  • Added Lamatic flow definitions, prompts, and model configs for the two AI workflows.
  • Added a Next.js demo app (UI + server actions) to exercise the end-to-end workflow.

Reviewed changes

Copilot reviewed 48 out of 57 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
kits/collectflow/README.md Kit-level README with walkthrough, setup, and scope.
kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_user_1.md User prompt for portfolio workflow.
kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md System prompt defining portfolio agent behavior and constraints.
kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_user_1.md User prompt for customer strategy workflow.
kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.md System prompt defining customer strategy behavior and constraints.
kits/collectflow/model-configs/collect-flow-portfolio-intelligence_instructor-llmnode-226_generative-model-name.ts Model config for portfolio workflow node.
kits/collectflow/model-configs/collect-flow-customer-strategy_instructor-llmnode-730_generative-model-name.ts Model config for customer strategy workflow node.
kits/collectflow/lamatic.config.ts Kit manifest (metadata, steps, env keys, links).
kits/collectflow/flows/collect-flow-portfolio-intelligence.ts Lamatic flow definition for portfolio ranking.
kits/collectflow/flows/collect-flow-customer-strategy.ts Lamatic flow definition for per-customer strategy generation.
kits/collectflow/constitutions/default.md CollectFlow constitution (guardrails and constraints).
kits/collectflow/apps/tsconfig.json TypeScript config for the demo app.
kits/collectflow/apps/README.md Default Next.js README for the demo app.
kits/collectflow/apps/postcss.config.mjs PostCSS config (Tailwind integration).
kits/collectflow/apps/package.json Demo app dependencies/scripts.
kits/collectflow/apps/next.config.ts Next.js configuration stub.
kits/collectflow/apps/lib/utils.ts UI utility helper (cn).
kits/collectflow/apps/eslint.config.mjs ESLint config for Next.js + TypeScript.
kits/collectflow/apps/components/ui/textarea.tsx Shared UI textarea component.
kits/collectflow/apps/components/ui/table.tsx Shared UI table primitives.
kits/collectflow/apps/components/ui/separator.tsx Shared UI separator component.
kits/collectflow/apps/components/ui/select.tsx Shared UI select component.
kits/collectflow/apps/components/ui/scroll-area.tsx Shared UI scroll area component.
kits/collectflow/apps/components/ui/card.tsx Shared UI card component.
kits/collectflow/apps/components/ui/button.tsx Shared UI button component.
kits/collectflow/apps/components/ui/badge.tsx Shared UI badge component.
kits/collectflow/apps/components/ui/avatar.tsx Shared UI avatar component.
kits/collectflow/apps/components.json shadcn/ui components registry config.
kits/collectflow/apps/CLAUDE.md Points Claude to AGENTS.md.
kits/collectflow/apps/app/page.tsx Main UI flow orchestration (portfolio → strategy → approval → outcome).
kits/collectflow/apps/app/lib/types.ts Domain types for customers, ranking, and enums.
kits/collectflow/apps/app/lib/outcomes.ts Outcome types/options and labeling helpers.
kits/collectflow/apps/app/lib/lamatic-client.ts Server-only Lamatic client + required env validation.
kits/collectflow/apps/app/layout.tsx Root layout, fonts, and metadata.
kits/collectflow/apps/app/globals.css Tailwind/shadcn global styles + theme tokens.
kits/collectflow/apps/app/data/demoPortfolio.ts Synthetic demo portfolio dataset.
kits/collectflow/apps/app/components/strategy/strategy-view.tsx Strategy screen UI (reasoning, controls, approval gate, journey).
kits/collectflow/apps/app/components/strategy/outcome-card.tsx UI for recording outcomes (with optional promise date).
kits/collectflow/apps/app/components/strategy/approval-card.tsx Manager approval UI component (approve/reject with reason).
kits/collectflow/apps/app/components/portfolio/portfolio-view.tsx Portfolio screen UI (pre/post analysis queue).
kits/collectflow/apps/app/components/portfolio/data-source-card.tsx Data source summary card (demo dataset).
kits/collectflow/apps/app/components/portfolio/collector-queue.tsx Preview/static collector queue component.
kits/collectflow/apps/app/components/layout/app-header.tsx Header/navigation for the demo app.
kits/collectflow/apps/app/actions/orchestrate.ts Server actions that call Lamatic flows and validate responses.
kits/collectflow/apps/AGENTS.md Agent rules file for contributors/tools.
kits/collectflow/apps/.gitignore Demo app ignores (Next build, env, etc.).
kits/collectflow/apps/.env.example Example env vars for Lamatic connectivity + flow IDs.
kits/collectflow/agent.md Kit agent documentation (capabilities, principles, state).
kits/collectflow/.gitignore Kit-level ignore file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kits/collectflow/lamatic.config.ts
Comment thread kits/collectflow/lamatic.config.ts
Comment thread kits/collectflow/flows/collect-flow-portfolio-intelligence.ts Outdated
Comment thread kits/collectflow/README.md Outdated
Comment thread kits/collectflow/README.md Outdated

@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: 18

🤖 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/collectflow/apps/.gitignore`:
- Around line 33-35: Update the dotenv ignore patterns in the env-files section
of .gitignore to ignore the base .env file and environment-specific files such
as .env.development and .env.production, while preserving the existing
local-file coverage.

In `@kits/collectflow/apps/app/components/portfolio/collector-queue.tsx`:
- Around line 17-19: Update the CollectorQueue component and its
CollectorQueueProps contract to accept a strategy-entry callback, then wire that
callback to the arrow button for each customer so clicking it opens the
corresponding customer strategy journey. Ensure the callback receives the
selected customer and is invoked from the button’s onClick handler.
- Around line 27-98: Update CollectorQueue and its orchestration to consume
analyzed QueueCustomer[] ranking data instead of merging the five-record
previewRanking map into arbitrary Customer[]; ensure every rendered customer has
ranking fields before calling formatLabel or equivalent display logic. Remove
the fixed “5 accounts” value and derive the badge/count from the actual
rankedCustomers length, while preserving an explicit fallback for customers
without analysis if they can still reach the component.

In `@kits/collectflow/apps/app/components/strategy/outcome-card.tsx`:
- Around line 31-86: Update OutcomeCard’s promiseDate validation and
save-disabled logic to reject dates earlier than today. Add the date input’s
minimum constraint and ensure handleSave does not record an expired
PROMISE_TO_PAY outcome, while preserving valid-date and non-promise behavior.

In `@kits/collectflow/apps/app/components/strategy/strategy-view.tsx`:
- Around line 75-88: Update handleCopy to catch rejected
navigator.clipboard.writeText calls, set the component’s existing error state
with an appropriate message, and avoid marking the copy operation as successful
when writing fails. Preserve the current success behavior, including setCopied
and its timeout, only after the clipboard write completes successfully.
- Around line 380-384: Update the strategy view’s OutcomeCard visibility so it
is not rendered when the latest outcome is PAYMENT_RECEIVED, even if
canExecuteStrategy is true. In the journey timeline rendering around the
terminal-step logic, treat PAYMENT_RECEIVED as completing the terminal
“Collection completed” step rather than leaving it current.
- Around line 339-378: Update the “Copy draft” Button in the strategy view to be
disabled unless canExecuteStrategy is true. Keep the draft subject and message
visible for review, while preserving the existing handleCopy behavior and
copied-state presentation for executable strategies.

In `@kits/collectflow/apps/app/globals.css`:
- Line 10: Update the --font-sans declaration in globals.css to reference
--font-geist-sans, matching the variable defined in app/layout.tsx, instead of
referencing itself.

In `@kits/collectflow/apps/app/layout.tsx`:
- Around line 15-18: Update the metadata export in the layout module by
replacing the default “Create Next App” title and generated-description values
with title and description that accurately represent CollectFlow Accounts
Receivable. Preserve the existing Metadata structure and export.

In `@kits/collectflow/apps/components/ui/card.tsx`:
- Around line 5-93: Wrap the Card component suite—Card, CardHeader, CardTitle,
CardDescription, CardAction, CardContent, and CardFooter—with React.forwardRef
to preserve React 18 compatibility. Type each forwarded ref for the rendered div
and pass it to the corresponding root div while retaining existing props,
styling, and behavior.

In `@kits/collectflow/apps/components/ui/select.tsx`:
- Around line 11-188: Update every exported control in
kits/collectflow/apps/components/ui/select.tsx, including SelectGroup,
SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem,
SelectSeparator, SelectScrollUpButton, and SelectScrollDownButton, to use
React.forwardRef with the appropriate Base UI primitive ref type and attach each
ref to its underlying primitive. In
kits/collectflow/apps/components/ui/textarea.tsx lines 5-16, use
React.forwardRef<HTMLTextAreaElement, ...> and attach the ref to the textarea
element.

In `@kits/collectflow/apps/next.config.ts`:
- Around line 1-7: Rename the Next configuration file from next.config.ts to
next.config.mjs, convert its TypeScript-only type annotation to valid JavaScript
module syntax, and ensure no duplicate Next config file remains.

In `@kits/collectflow/flows/collect-flow-portfolio-intelligence.ts`:
- Line 74: The JSON schema in the portfolio intelligence flow defines the ranked
queue identifier as "customer_id " with a trailing space. Update that property
name to "customer_id" while leaving the surrounding ranked_queue schema
unchanged.

In `@kits/collectflow/lamatic.config.ts`:
- Line 31: Update the prerequisiteSteps entry in the Lamatic configuration to
use the exact declared step ID “collect-flow-portfolio-intelligence,” preserving
the existing dependency configuration otherwise.

In
`@kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.md`:
- Around line 74-81: Insert line breaks before the section headers in both
affected prompt files: in
kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.md
lines 74-81, separate the closing operational_controls content from APPROVAL
CONSISTENCY: and separate the preceding content from FOLLOW-UP TIMING:; in
kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md
lines 45-47, insert a newline before STRICT TYPE REQUIREMENTS:. Preserve all
prompt text and formatting otherwise.

In `@kits/collectflow/README.md`:
- Line 267: Update the contributor description in the README to use the
hyphenated adjective “open-source,” changing “open source maintainers” to
“open-source maintainers.”
- Around line 85-107: Update the three fenced ASCII diagram blocks in README.md,
including the blocks around the “Synchronized AR Portfolio” diagram and the
sections near lines 186 and 217, to use the text language identifier on their
opening fences. Preserve the diagram contents unchanged.
- Around line 39-45: Revise the README’s CollectFlow capability descriptions,
including the “Customer Portfolio” section and the referenced workflow sections,
to present synchronization, persistence, audit/compliance trails, and production
readiness as demo or in-session behavior. Remove or soften claims implying live
ERP integrations, durable storage, audit trails, or a production-ready workflow,
while preserving the intended MVP demonstration flow.
🪄 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: de3cea55-0391-4b8d-9771-445adb2caa59

📥 Commits

Reviewing files that changed from the base of the PR and between 0ada432 and 33f863f.

⛔ Files ignored due to path filters (8)
  • kits/collectflow/apps/package-lock.json is excluded by !**/package-lock.json
  • kits/collectflow/assets/collection-journey.png is excluded by !**/*.png
  • kits/collectflow/assets/customer-portfolio.png is excluded by !**/*.png
  • kits/collectflow/assets/customer-strategy.png is excluded by !**/*.png
  • kits/collectflow/assets/landing.png is excluded by !**/*.png
  • kits/collectflow/assets/manager-approval.png is excluded by !**/*.png
  • kits/collectflow/assets/outcome-recording.png is excluded by !**/*.png
  • kits/collectflow/assets/portfolio-intelligence.png is excluded by !**/*.png
📒 Files selected for processing (49)
  • kits/collectflow/.gitignore
  • kits/collectflow/README.md
  • kits/collectflow/agent.md
  • kits/collectflow/apps/.env.example
  • kits/collectflow/apps/.gitignore
  • kits/collectflow/apps/AGENTS.md
  • kits/collectflow/apps/CLAUDE.md
  • kits/collectflow/apps/README.md
  • kits/collectflow/apps/app/actions/orchestrate.ts
  • kits/collectflow/apps/app/components/layout/app-header.tsx
  • kits/collectflow/apps/app/components/portfolio/collector-queue.tsx
  • kits/collectflow/apps/app/components/portfolio/data-source-card.tsx
  • kits/collectflow/apps/app/components/portfolio/portfolio-view.tsx
  • kits/collectflow/apps/app/components/strategy/approval-card.tsx
  • kits/collectflow/apps/app/components/strategy/outcome-card.tsx
  • kits/collectflow/apps/app/components/strategy/strategy-view.tsx
  • kits/collectflow/apps/app/data/demoPortfolio.ts
  • kits/collectflow/apps/app/globals.css
  • kits/collectflow/apps/app/layout.tsx
  • kits/collectflow/apps/app/lib/lamatic-client.ts
  • kits/collectflow/apps/app/lib/outcomes.ts
  • kits/collectflow/apps/app/lib/types.ts
  • kits/collectflow/apps/app/page.tsx
  • kits/collectflow/apps/components.json
  • kits/collectflow/apps/components/ui/avatar.tsx
  • kits/collectflow/apps/components/ui/badge.tsx
  • kits/collectflow/apps/components/ui/button.tsx
  • kits/collectflow/apps/components/ui/card.tsx
  • kits/collectflow/apps/components/ui/scroll-area.tsx
  • kits/collectflow/apps/components/ui/select.tsx
  • kits/collectflow/apps/components/ui/separator.tsx
  • kits/collectflow/apps/components/ui/table.tsx
  • kits/collectflow/apps/components/ui/textarea.tsx
  • kits/collectflow/apps/eslint.config.mjs
  • kits/collectflow/apps/lib/utils.ts
  • kits/collectflow/apps/next.config.ts
  • kits/collectflow/apps/package.json
  • kits/collectflow/apps/postcss.config.mjs
  • kits/collectflow/apps/tsconfig.json
  • kits/collectflow/constitutions/default.md
  • kits/collectflow/flows/collect-flow-customer-strategy.ts
  • kits/collectflow/flows/collect-flow-portfolio-intelligence.ts
  • kits/collectflow/lamatic.config.ts
  • kits/collectflow/model-configs/collect-flow-customer-strategy_instructor-llmnode-730_generative-model-name.ts
  • kits/collectflow/model-configs/collect-flow-portfolio-intelligence_instructor-llmnode-226_generative-model-name.ts
  • kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.md
  • kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_user_1.md
  • kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md
  • kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_user_1.md

Comment thread kits/collectflow/apps/.gitignore Outdated
Comment thread kits/collectflow/apps/app/components/portfolio/collector-queue.tsx Outdated
Comment thread kits/collectflow/apps/app/components/portfolio/collector-queue.tsx Outdated
Comment thread kits/collectflow/apps/app/components/strategy/outcome-card.tsx Outdated
Comment thread kits/collectflow/apps/app/components/strategy/strategy-view.tsx
Comment thread kits/collectflow/lamatic.config.ts Outdated
Comment thread kits/collectflow/README.md Outdated
Comment thread kits/collectflow/README.md Outdated
Comment thread kits/collectflow/README.md Outdated
@coderabbitai
coderabbitai Bot requested review from amanintech and d-pamneja July 15, 2026 13:25

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/collectflow/apps/app/components/strategy/outcome-card.tsx (1)

31-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Agent, this form is going off-script — no react-hook-form/zod backup.

This outcome-recording form (outcome select, promise date, notes) is built entirely on ad-hoc useState, bypassing the mandated form stack.

As per coding guidelines, kits/*/apps/**/*.{ts,tsx,js,jsx} should "use ... react-hook-form + zod for forms."

Also applies to: 118-181

🤖 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/collectflow/apps/app/components/strategy/outcome-card.tsx` around lines
31 - 44, Refactor OutcomeCard’s outcome, promise-date, and note form to use
react-hook-form with a zod schema instead of the individual useState fields
selectedOutcome, note, promiseDate, and related validation. Connect the form
controls through the hook, validate submissions with the schema, and preserve
the existing saving, saved, and onOutcomeRecorded behavior.

Source: Coding guidelines

🤖 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/collectflow/apps/app/components/portfolio/portfolio-view.tsx`:
- Around line 169-172: Extract the repeated hasAnalyzedPortfolio &&
hasRankingResults expression into a single showRankedResults constant in the
portfolio view component, then replace all four occurrences in the header text,
subtitle, analyzed badge, and ranked-list gate with showRankedResults.

In
`@kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md`:
- Around line 59-68: Update the Correct examples and Incorrect examples sections
in the response-format instructions to wrap each raw JSON fragment in proper
json Markdown code fences, remove the unintended leading spaces, and preserve
the existing validation and structured-output requirements unchanged.

---

Outside diff comments:
In `@kits/collectflow/apps/app/components/strategy/outcome-card.tsx`:
- Around line 31-44: Refactor OutcomeCard’s outcome, promise-date, and note form
to use react-hook-form with a zod schema instead of the individual useState
fields selectedOutcome, note, promiseDate, and related validation. Connect the
form controls through the hook, validate submissions with the schema, and
preserve the existing saving, saved, and onOutcomeRecorded behavior.
🪄 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: ca9e561b-dcdb-4f8d-b247-8666b572a18c

📥 Commits

Reviewing files that changed from the base of the PR and between 311d429 and e16599b.

📒 Files selected for processing (11)
  • kits/collectflow/README.md
  • kits/collectflow/apps/.gitignore
  • kits/collectflow/apps/app/components/portfolio/portfolio-view.tsx
  • kits/collectflow/apps/app/components/strategy/outcome-card.tsx
  • kits/collectflow/apps/app/components/strategy/strategy-view.tsx
  • kits/collectflow/apps/app/globals.css
  • kits/collectflow/apps/app/layout.tsx
  • kits/collectflow/flows/collect-flow-portfolio-intelligence.ts
  • kits/collectflow/lamatic.config.ts
  • kits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.md
  • kits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md

Comment thread kits/collectflow/apps/app/components/portfolio/portfolio-view.tsx Outdated

@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/collectflow/flows/collect-flow-portfolio-intelligence.ts`:
- Line 74: Replace the inline schema in the flow’s schema payload so each
object’s required fields are listed in an object-level required array, removing
the invalid required: true entries from individual properties. Add
additionalProperties: false to the root object, portfolio_summary, and
ranked_queue item objects, while preserving the existing field names and types.
🪄 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: e03dfcb7-2019-4af0-ac33-cdf6531109a7

📥 Commits

Reviewing files that changed from the base of the PR and between e16599b and e1d146d.

📒 Files selected for processing (4)
  • kits/collectflow/apps/app/actions/orchestrate.ts
  • kits/collectflow/apps/app/components/portfolio/portfolio-view.tsx
  • kits/collectflow/apps/app/components/strategy/strategy-view.tsx
  • kits/collectflow/flows/collect-flow-portfolio-intelligence.ts

Comment thread kits/collectflow/flows/collect-flow-portfolio-intelligence.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/collectflow/flows/collect-flow-portfolio-intelligence.ts`:
- Line 74: Update the schema in the portfolio intelligence flow’s output
definition: add required arrays for the root object, portfolio_summary, and each
ranked_queue item covering their expected fields, and set additionalProperties
to false on all three object levels. Keep the existing property types and array
structure unchanged.
🪄 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: 4fea46d8-3343-495d-9dbd-130d1c6123cd

📥 Commits

Reviewing files that changed from the base of the PR and between e1d146d and 6dc31a6.

📒 Files selected for processing (1)
  • kits/collectflow/flows/collect-flow-portfolio-intelligence.ts

Comment thread kits/collectflow/flows/collect-flow-portfolio-intelligence.ts Outdated
@Sms1818

Sms1818 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 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.

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation passed. The kit loaded successfully in Lamatic Studio.

This PR is ready for final review and merge.

@akshatvirmani

Copy link
Copy Markdown
Contributor

@Sms1818 there are some comments left please resolve them

@Sms1818

Sms1818 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@akshatvirmani All review comments have been addressed and resolved. The requested changes have been incorporated, and the PR is ready for final review. Thank you!

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Sms1818! 👋

Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review.

Steps to follow:

  1. Read through all CodeRabbit comments carefully
  2. Address each issue raised (or reply explaining why you disagree)
  3. Push your fixes as new commits
  4. Once all issues are resolved, comment here so we can re-review

This helps keep the review process efficient for everyone. Thank you! 🙏

@Sms1818

Sms1818 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

All CodeRabbit review comments have now been addressed. The PR is ready for re-review. Thank you!

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@akshatvirmani akshatvirmani added the tier-3 Pass label Jul 20, 2026
@akshatvirmani
akshatvirmani merged commit 499e998 into Lamatic:main Jul 20, 2026
1 of 2 checks passed
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.

3 participants