feat: Add CollectFlow for AI-powered Accounts Receivable Collections#250
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughCollectFlow 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. ChangesCollectFlow application and workflow
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
🎉 All checks passed! This contribution follows the AgentKit structure. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (8)
kits/collectflow/apps/package-lock.jsonis excluded by!**/package-lock.jsonkits/collectflow/assets/collection-journey.pngis excluded by!**/*.pngkits/collectflow/assets/customer-portfolio.pngis excluded by!**/*.pngkits/collectflow/assets/customer-strategy.pngis excluded by!**/*.pngkits/collectflow/assets/landing.pngis excluded by!**/*.pngkits/collectflow/assets/manager-approval.pngis excluded by!**/*.pngkits/collectflow/assets/outcome-recording.pngis excluded by!**/*.pngkits/collectflow/assets/portfolio-intelligence.pngis excluded by!**/*.png
📒 Files selected for processing (49)
kits/collectflow/.gitignorekits/collectflow/README.mdkits/collectflow/agent.mdkits/collectflow/apps/.env.examplekits/collectflow/apps/.gitignorekits/collectflow/apps/AGENTS.mdkits/collectflow/apps/CLAUDE.mdkits/collectflow/apps/README.mdkits/collectflow/apps/app/actions/orchestrate.tskits/collectflow/apps/app/components/layout/app-header.tsxkits/collectflow/apps/app/components/portfolio/collector-queue.tsxkits/collectflow/apps/app/components/portfolio/data-source-card.tsxkits/collectflow/apps/app/components/portfolio/portfolio-view.tsxkits/collectflow/apps/app/components/strategy/approval-card.tsxkits/collectflow/apps/app/components/strategy/outcome-card.tsxkits/collectflow/apps/app/components/strategy/strategy-view.tsxkits/collectflow/apps/app/data/demoPortfolio.tskits/collectflow/apps/app/globals.csskits/collectflow/apps/app/layout.tsxkits/collectflow/apps/app/lib/lamatic-client.tskits/collectflow/apps/app/lib/outcomes.tskits/collectflow/apps/app/lib/types.tskits/collectflow/apps/app/page.tsxkits/collectflow/apps/components.jsonkits/collectflow/apps/components/ui/avatar.tsxkits/collectflow/apps/components/ui/badge.tsxkits/collectflow/apps/components/ui/button.tsxkits/collectflow/apps/components/ui/card.tsxkits/collectflow/apps/components/ui/scroll-area.tsxkits/collectflow/apps/components/ui/select.tsxkits/collectflow/apps/components/ui/separator.tsxkits/collectflow/apps/components/ui/table.tsxkits/collectflow/apps/components/ui/textarea.tsxkits/collectflow/apps/eslint.config.mjskits/collectflow/apps/lib/utils.tskits/collectflow/apps/next.config.tskits/collectflow/apps/package.jsonkits/collectflow/apps/postcss.config.mjskits/collectflow/apps/tsconfig.jsonkits/collectflow/constitutions/default.mdkits/collectflow/flows/collect-flow-customer-strategy.tskits/collectflow/flows/collect-flow-portfolio-intelligence.tskits/collectflow/lamatic.config.tskits/collectflow/model-configs/collect-flow-customer-strategy_instructor-llmnode-730_generative-model-name.tskits/collectflow/model-configs/collect-flow-portfolio-intelligence_instructor-llmnode-226_generative-model-name.tskits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.mdkits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_user_1.mdkits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.mdkits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_user_1.md
There was a problem hiding this comment.
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 tradeoffAgent, this form is going off-script — no
react-hook-form/zodbackup.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
📒 Files selected for processing (11)
kits/collectflow/README.mdkits/collectflow/apps/.gitignorekits/collectflow/apps/app/components/portfolio/portfolio-view.tsxkits/collectflow/apps/app/components/strategy/outcome-card.tsxkits/collectflow/apps/app/components/strategy/strategy-view.tsxkits/collectflow/apps/app/globals.csskits/collectflow/apps/app/layout.tsxkits/collectflow/flows/collect-flow-portfolio-intelligence.tskits/collectflow/lamatic.config.tskits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.mdkits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.md
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
kits/collectflow/apps/app/actions/orchestrate.tskits/collectflow/apps/app/components/portfolio/portfolio-view.tsxkits/collectflow/apps/app/components/strategy/strategy-view.tsxkits/collectflow/flows/collect-flow-portfolio-intelligence.ts
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
kits/collectflow/flows/collect-flow-portfolio-intelligence.ts
|
@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. |
|
@Sms1818 there are some comments left please resolve them |
|
@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! |
|
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:
This helps keep the review process efficient for everyone. Thank you! 🙏 |
|
All CodeRabbit review comments have now been addressed. The PR is ready for re-review. Thank you! |
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
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
What is Included
🤖 AI Workflows
Portfolio Intelligence
Customer Strategy
💻 Demo Application
A Next.js application demonstrating the complete workflow:
Repository Structure
Tech Stack
Live Demo
https://collectflow-nine.vercel.app
Notes
This MVP intentionally focuses on a single end-to-end Accounts Receivable workflow:
To keep the contribution focused, the following are intentionally out of scope:
Validation
.env.exampleincludedAdded
kits/collectflow/“CollectFlow” AR decision-support kit:kits/collectflow/README.md,kits/collectflow/agent.md,kits/collectflow/constitutions/default.mdkits/collectflow/.env.example,kits/collectflow/apps/.env.examplekits/collectflow/lamatic.config.tskits/collectflow/flows/collect-flow-portfolio-intelligence.tskits/collectflow/flows/collect-flow-customer-strategy.tskits/collectflow/model-configs/collect-flow-portfolio-intelligence_instructor-llmnode-226_generative-model-name.tskits/collectflow/model-configs/collect-flow-customer-strategy_instructor-llmnode-730_generative-model-name.tskits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_system_0.mdkits/collectflow/prompts/collect-flow-portfolio-intelligence_instructor-llmnode-226_user_1.mdkits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_system_0.mdkits/collectflow/prompts/collect-flow-customer-strategy_instructor-llmnode-730_user_1.mdUpdated/re-added node/edge types as defined in the flow graph files (no separate
modelnode in these graphs):typevalues used:triggerNode(API request input)dynamicNode(Instructor LLM step, e.g.InstructorLLMNode_226/InstructorLLMNode_730)responseNode(API response/output mapping)typevalues used:defaultEdge(trigger → instructor → response node wiring)responseEdge(trigger → response node wiring)CollectFlow Portfolio Intelligence workflow (
collect-flow-portfolio-intelligence.ts) high-level behavior:triggerNode_1) acceptsportfolio_dataas a string (advance_schema)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 withrisk_level,treatment_lane,approval_required,priority_explanation,priority_score, etc.)responseNode_triggerNode_1) outputsportfolio_summaryandranked_queueas JSON withcontent-type: application/jsonCollectFlow Customer Strategy workflow (
collect-flow-customer-strategy.ts) high-level behavior:triggerNode_1) acceptscustomer_dataas a string (advance_schema)dynamicNode/InstructorLLMNode_730) runs the customer strategy prompts + default constitution and returns structured JSON including:next_best_action,action_summary,reasoning[]recommended_channel,confidenceapproval_required,approval_reasonoperational_controls[]draft_subject,draft_messagejourney_state,next_follow_up_daysresponseNode_triggerNode_1) maps Instructor outputs into the API response payloadAdded a Next.js/TypeScript demo under
kits/collectflow/apps/: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.jsonkits/collectflow/apps/app/globals.csskits/collectflow/apps/app/data/demoPortfolio.tskits/collectflow/apps/app/lib/types.tskits/collectflow/apps/app/lib/outcomes.tskits/collectflow/apps/app/lib/lamatic-client.tskits/collectflow/apps/app/actions/orchestrate.ts(typedanalyzePortfolio/generateCustomerStrategyflow execution + structured output validation)kits/collectflow/apps/app/layout.tsxkits/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.tsxkits/collectflow/apps/app/components/portfolio/data-source-card.tsxkits/collectflow/apps/app/components/portfolio/portfolio-view.tsxkits/collectflow/apps/app/components/strategy/approval-card.tsxkits/collectflow/apps/app/components/strategy/outcome-card.tsxkits/collectflow/apps/app/components/strategy/strategy-view.tsxkits/collectflow/apps/components/ui/andkits/collectflow/apps/lib/:kits/collectflow/apps/components/ui/avatar.tsxkits/collectflow/apps/components/ui/badge.tsxkits/collectflow/apps/components/ui/button.tsxkits/collectflow/apps/components/ui/card.tsxkits/collectflow/apps/components/ui/scroll-area.tsxkits/collectflow/apps/components/ui/select.tsxkits/collectflow/apps/components/ui/separator.tsxkits/collectflow/apps/components/ui/table.tsxkits/collectflow/apps/components/ui/textarea.tsxkits/collectflow/apps/lib/utils.ts(thecnclassName merge helper)