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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kits/fablens/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.lamatic/
node_modules/
.env
.env.local
74 changes: 74 additions & 0 deletions kits/fablens/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# FabLens — Fabric Impact Analyzer

FabLens lets you paste a clothing product URL and instantly understand what it's made of—and how those materials impact your skin and the environment.

It combines a structured material database with AI analysis to give clear, explainable insights.

---

## What It Does

- Extracts materials from product pages using Lamatic workflows
- Normalizes and deduplicates material data
- Scores materials across:
- 🌱 Environmental impact (biodegradability, water usage, chemical processing)
- 🧴 Skin safety (breathability, irritation risk)
- Uses a **hybrid scoring system**:
- Known materials → local database
- Unknown materials → AI analysis fallback
- Displays transparent positives and negatives

---

## Tech Stack

- **Lamatic** — workflow orchestration + LLM execution (GraphQL API)
- **Firecrawl** — webpage content extraction
- **Next.js (App Router)** — frontend + API routes
- **Tailwind CSS** — styling
- **Groq (llama-4-scout)** — AI inference

---

## Setup

```bash
cd kits/fablens/apps
cp .env.example .env.local
npm install
npm run dev
```

---

## Environment Variables

| Variable | Description |
|----------|-------------|
| `LAMATIC_API_KEY` | Your Lamatic API key from studio.lamatic.ai |
| `LAMATIC_PROJECT_ID` | Your Lamatic project ID |
| `LAMATIC_WORKFLOW_ID` | Workflow ID used for material extraction |
| `LAMATIC_HOST` | Your Lamatic GraphQL endpoint (e.g. https://<org>.lamatic.dev/graphql) |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Comment on lines +44 to +52
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Mission-critical docs gap: add FABLENS_WORKFLOW_ID to environment variables.

The setup table is incomplete; users can miss a required config and fail runtime setup.

Proposed patch
 | Variable | Description |
 |----------|-------------|
 | `LAMATIC_API_KEY` | Your Lamatic API key from studio.lamatic.ai |
+| `FABLENS_WORKFLOW_ID` | Workflow ID used by the FabLens Lamatic step |
As per coding guidelines, "Every kit must have a `README.md` that documents setup, environment variables, and usage".
📝 Committable suggestion

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

Suggested change
## Environment Variables
| Variable | Description |
|----------|-------------|
| `LAMATIC_API_KEY` | Your Lamatic API key from studio.lamatic.ai |
## Environment Variables
| Variable | Description |
|----------|-------------|
| `LAMATIC_API_KEY` | Your Lamatic API key from studio.lamatic.ai |
| `FABLENS_WORKFLOW_ID` | Workflow ID used by the FabLens Lamatic step |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@kits/fablens/README.md` around lines 33 - 38, Update the Environment
Variables table in kits/fablens/README.md to include the missing
FABLENS_WORKFLOW_ID entry: add a new row with `FABLENS_WORKFLOW_ID` as the
Variable and a brief Description (e.g., "Workflow ID used by FabLens to select
the processing workflow") so the README documents all required runtime
configuration alongside `LAMATIC_API_KEY`; ensure formatting matches the
existing Markdown table style.

Comment on lines +46 to +52
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Mission docs sync: add the scoring workflow env var to setup table.

LAMATIC_SCORING_WORKFLOW_ID exists in .env.example but is missing here, so operators can under-configure deployments.

📝 Proposed patch
 | `LAMATIC_API_KEY` | Your Lamatic API key from studio.lamatic.ai |
 | `LAMATIC_PROJECT_ID` | Your Lamatic project ID |
 | `LAMATIC_WORKFLOW_ID` | Workflow ID used for material extraction |
+| `LAMATIC_SCORING_WORKFLOW_ID` | Workflow ID used for unknown-material scoring fallback |
 | `LAMATIC_HOST` | Your Lamatic GraphQL endpoint (e.g. https://<org>.lamatic.dev/graphql) |

As per coding guidelines, "Every kit must have a README.md that documents setup, environment variables, and usage".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@kits/fablens/README.md` around lines 46 - 52, Add the missing environment
variable LAMATIC_SCORING_WORKFLOW_ID to the README's environment variables table
so operators see it alongside LAMATIC_API_KEY, LAMATIC_PROJECT_ID,
LAMATIC_WORKFLOW_ID, and LAMATIC_HOST; update the table row for
`LAMATIC_SCORING_WORKFLOW_ID` with a short description like "Scoring workflow ID
used for model scoring/validation" to match `.env.example` and ensure README
setup docs list all vars referenced by the kit.

## Supported Sites

Works best with product pages that clearly list materials:

- BIBA
- Patagonia
- Independent/D2C brands

## Future Plans

- Percentage-weighted scoring
- Improved compound material handling
- Expanded material database
- Support for furniture & cosmetics
- Image-based material detection

## Limitations

- Sites with bot protection (e.g. H&M, Amazon) may fail
- Missing material data → no analysis
- Compound materials (e.g. polycotton) may not always resolve accurately
- No percentage-weighted scoring
60 changes: 60 additions & 0 deletions kits/fablens/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# FabLens

## Overview

FabLens is an intelligent consumer tool that helps users make informed clothing purchases by analyzing textile materials from product URLs. It provides a factual, transparent breakdown of environmental impact and skin safety so users can better understand what a garment is made of and what that means in practical terms. [file:2][file:4]

## Purpose

FabLens exists to make fabric information easier to understand. Many fashion product pages mention materials without explaining their real-world implications, so FabLens translates those materials into clear insights about biodegradability, chemical processing, breathability, and irritation risk. [file:2][file:4]

## Flows

### Material Analysis Flow

- **Trigger:** The user pastes a clothing product URL into the FabLens interface. [file:2]
- **Process:** FabLens scrapes the product page, extracts listed material information, checks known fabrics against a local material database, and uses AI fallback analysis for unknown materials. [file:2]
- **Response:** The system returns a structured explanation of each material’s environmental characteristics and skin-safety considerations, including both positives and negatives. [file:2]
- **Dependencies:** This flow depends on Lamatic orchestration, Firecrawl scraping, and the configured AI model. [file:2]

## Guardrails

- FabLens should present factual information, not moral judgments or guilt-based messaging. [file:2]
- FabLens should not assign simplistic scores when the product goal is transparent explanation. [file:2]
- FabLens should clearly distinguish between known material database results and AI fallback analysis. [file:2]
- FabLens should avoid making unsupported claims when the source page does not provide enough material detail. [file:2]

## Integration Reference

FabLens uses Lamatic AI for flow orchestration and analysis, Firecrawl for webpage scraping, Next.js for the frontend application, Tailwind CSS for styling, and Groq with `llama-4-scout` as the language model layer. [file:2]

## Environment Setup

The application requires a Lamatic API key for operation, and the kit configuration also defines a workflow environment key named `FABLENS_WORKFLOW_ID`. [file:2][file:4]

### Required Environment Variables

| Variable | Description |
|---|---|
| `LAMATIC_API_KEY` | Your Lamatic API key from Lamatic Studio. [file:2] |
| `FABLENS_WORKFLOW_ID` | The workflow ID used by the configured Lamatic kit step. [file:4] |

## Quickstart

1. Navigate to `kits/fablens/apps`. [file:2]
2. Copy `.env.example` to `.env.local`. [file:2]
3. Add your `LAMATIC_API_KEY`. [file:2]
4. Install dependencies with `npm install`. [file:2]
5. Start the development server with `npm run dev`. [file:2]

## Common Failure Modes

| Symptom | Likely Cause | Fix |
|---|---|---|
| No material analysis returned | The target site does not list material information clearly. [file:2] | Try a product page that includes fabric details in plain text. [file:2] |
| No scrape results | The target site has scraper protection. [file:2] | Test with supported or simpler sites such as independent brands. [file:2] |
| Flow does not run correctly | Missing API key or workflow configuration. [file:2][file:4] | Verify `LAMATIC_API_KEY` and `FABLENS_WORKFLOW_ID` are set correctly. [file:2][file:4] |

## Scope

FabLens is currently designed for clothing product pages and works best on sites that expose material details in readable text. Support for furniture, cosmetics, image-based material detection, percentage-weighted scoring, and a larger material database are planned for future versions. [file:2]
Comment on lines +5 to +60
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Mission cleanup: remove unresolved [file:*] reference artifacts.

These labels are undefined (MD052) and render as broken references; also add a single trailing newline at EOF (MD047).

Proposed direction
-FabLens is an intelligent consumer tool ... practical terms. [file:2][file:4]
+FabLens is an intelligent consumer tool ... practical terms.

Apply the same cleanup for all [file:2] / [file:4] occurrences across this document.

📝 Committable suggestion

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

Suggested change
FabLens is an intelligent consumer tool that helps users make informed clothing purchases by analyzing textile materials from product URLs. It provides a factual, transparent breakdown of environmental impact and skin safety so users can better understand what a garment is made of and what that means in practical terms. [file:2][file:4]
## Purpose
FabLens exists to make fabric information easier to understand. Many fashion product pages mention materials without explaining their real-world implications, so FabLens translates those materials into clear insights about biodegradability, chemical processing, breathability, and irritation risk. [file:2][file:4]
## Flows
### Material Analysis Flow
- **Trigger:** The user pastes a clothing product URL into the FabLens interface. [file:2]
- **Process:** FabLens scrapes the product page, extracts listed material information, checks known fabrics against a local material database, and uses AI fallback analysis for unknown materials. [file:2]
- **Response:** The system returns a structured explanation of each materials environmental characteristics and skin-safety considerations, including both positives and negatives. [file:2]
- **Dependencies:** This flow depends on Lamatic orchestration, Firecrawl scraping, and the configured AI model. [file:2]
## Guardrails
- FabLens should present factual information, not moral judgments or guilt-based messaging. [file:2]
- FabLens should not assign simplistic scores when the product goal is transparent explanation. [file:2]
- FabLens should clearly distinguish between known material database results and AI fallback analysis. [file:2]
- FabLens should avoid making unsupported claims when the source page does not provide enough material detail. [file:2]
## Integration Reference
FabLens uses Lamatic AI for flow orchestration and analysis, Firecrawl for webpage scraping, Next.js for the frontend application, Tailwind CSS for styling, and Groq with `llama-4-scout` as the language model layer. [file:2]
## Environment Setup
The application requires a Lamatic API key for operation, and the kit configuration also defines a workflow environment key named `FABLENS_WORKFLOW_ID`. [file:2][file:4]
### Required Environment Variables
| Variable | Description |
|---|---|
| `LAMATIC_API_KEY` | Your Lamatic API key from Lamatic Studio. [file:2] |
| `FABLENS_WORKFLOW_ID` | The workflow ID used by the configured Lamatic kit step. [file:4] |
## Quickstart
1. Navigate to `kits/fablens/apps`. [file:2]
2. Copy `.env.example` to `.env.local`. [file:2]
3. Add your `LAMATIC_API_KEY`. [file:2]
4. Install dependencies with `npm install`. [file:2]
5. Start the development server with `npm run dev`. [file:2]
## Common Failure Modes
| Symptom | Likely Cause | Fix |
|---|---|---|
| No material analysis returned | The target site does not list material information clearly. [file:2] | Try a product page that includes fabric details in plain text. [file:2] |
| No scrape results | The target site has scraper protection. [file:2] | Test with supported or simpler sites such as independent brands. [file:2] |
| Flow does not run correctly | Missing API key or workflow configuration. [file:2][file:4] | Verify `LAMATIC_API_KEY` and `FABLENS_WORKFLOW_ID` are set correctly. [file:2][file:4] |
## Scope
FabLens is currently designed for clothing product pages and works best on sites that expose material details in readable text. Support for furniture, cosmetics, image-based material detection, percentage-weighted scoring, and a larger material database are planned for future versions. [file:2]
FabLens is an intelligent consumer tool that helps users make informed clothing purchases by analyzing textile materials from product URLs. It provides a factual, transparent breakdown of environmental impact and skin safety so users can better understand what a garment is made of and what that means in practical terms.
## Purpose
FabLens exists to make fabric information easier to understand. Many fashion product pages mention materials without explaining their real-world implications, so FabLens translates those materials into clear insights about biodegradability, chemical processing, breathability, and irritation risk.
## Flows
### Material Analysis Flow
- **Trigger:** The user pastes a clothing product URL into the FabLens interface.
- **Process:** FabLens scrapes the product page, extracts listed material information, checks known fabrics against a local material database, and uses AI fallback analysis for unknown materials.
- **Response:** The system returns a structured explanation of each material's environmental characteristics and skin-safety considerations, including both positives and negatives.
- **Dependencies:** This flow depends on Lamatic orchestration, Firecrawl scraping, and the configured AI model.
## Guardrails
- FabLens should present factual information, not moral judgments or guilt-based messaging.
- FabLens should not assign simplistic scores when the product goal is transparent explanation.
- FabLens should clearly distinguish between known material database results and AI fallback analysis.
- FabLens should avoid making unsupported claims when the source page does not provide enough material detail.
## Integration Reference
FabLens uses Lamatic AI for flow orchestration and analysis, Firecrawl for webpage scraping, Next.js for the frontend application, Tailwind CSS for styling, and Groq with `llama-4-scout` as the language model layer.
## Environment Setup
The application requires a Lamatic API key for operation, and the kit configuration also defines a workflow environment key named `FABLENS_WORKFLOW_ID`.
### Required Environment Variables
| Variable | Description |
|---|---|
| `LAMATIC_API_KEY` | Your Lamatic API key from Lamatic Studio. |
| `FABLENS_WORKFLOW_ID` | The workflow ID used by the configured Lamatic kit step. |
## Quickstart
1. Navigate to `kits/fablens/apps`.
2. Copy `.env.example` to `.env.local`.
3. Add your `LAMATIC_API_KEY`.
4. Install dependencies with `npm install`.
5. Start the development server with `npm run dev`.
## Common Failure Modes
| Symptom | Likely Cause | Fix |
|---|---|---|
| No material analysis returned | The target site does not list material information clearly. | Try a product page that includes fabric details in plain text. |
| No scrape results | The target site has scraper protection. | Test with supported or simpler sites such as independent brands. |
| Flow does not run correctly | Missing API key or workflow configuration. | Verify `LAMATIC_API_KEY` and `FABLENS_WORKFLOW_ID` are set correctly. |
## Scope
FabLens is currently designed for clothing product pages and works best on sites that expose material details in readable text. Support for furniture, cosmetics, image-based material detection, percentage-weighted scoring, and a larger material database are planned for future versions.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 5-5: Reference links and images should use a label that is defined
Missing link or image reference definition: "file"

(MD052, reference-links-images)


[warning] 9-9: Reference links and images should use a label that is defined
Missing link or image reference definition: "file"

(MD052, reference-links-images)


[warning] 33-33: Reference links and images should use a label that is defined
Missing link or image reference definition: "file"

(MD052, reference-links-images)


[warning] 56-56: Reference links and images should use a label that is defined
Missing link or image reference definition: "file"

(MD052, reference-links-images)


[warning] 56-56: Reference links and images should use a label that is defined
Missing link or image reference definition: "file"

(MD052, reference-links-images)


[warning] 60-60: Files should end with a single newline character

(MD047, single-trailing-newline)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@kits/fablens/agent.md` around lines 5 - 60, Remove all unresolved artifact
references like "[file:2]" and "[file:4]" throughout the FabLens README (e.g.,
within the "FabLens" intro, "Purpose", "Material Analysis Flow", "Environment
Setup", "Required Environment Variables", "Quickstart", "Common Failure Modes",
and "Scope" sections) and ensure the file ends with a single trailing newline;
keep the surrounding text intact and preserve variable names such as
LAMATIC_API_KEY and FABLENS_WORKFLOW_ID and section headings while deleting only
the bracketed file tokens.

5 changes: 5 additions & 0 deletions kits/fablens/apps/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LAMATIC_API_KEY=your_lamatic_api_key_here
LAMATIC_HOST=https://your-org.lamatic.dev/graphql
LAMATIC_PROJECT_ID=your_project_id
LAMATIC_WORKFLOW_ID=your_extraction_workflow_id
LAMATIC_SCORING_WORKFLOW_ID=your_scoring_workflow_id
1 change: 1 addition & 0 deletions kits/fablens/apps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vercel
Loading
Loading