agentleFS
agentset-aiagentset-ai/agentset/.cursor/rules/project-structure.mdc

agentset / rules

Cursor rule2.1k starsChanged 10 months agoMITView on GitHub

Project structure, monorepo management, and architectural patterns for the Agentset platform

  • Reads credentials

Trending

Quiet since September.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 2 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 2 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the agentset-ai/agentset repository that our weekly crawl found: only 8 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about agentset-ai/agentset

The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 8

Talked about on GitHub and Hacker News (8 times).

On GitHub · 6

1 more on GitHub

The file

Show its rules and text

We split this project-structure.mdc into the rules it gives an agent

14 rules. About 0 are common, 10 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use bun as the package manager (required by packageManager field)

    line 39
  2. Distinctive:

    Use catalog: references for shared external dependencies

    line 41
  3. Distinctive:

    Avoid camelCase or PascalCase for directories

    line 67
  4. Distinctive:

    Import from packages using their configured aliases:

    line 84
  5. Very specific:

    Use dotenv -e ../../.env in package scripts to access root env

    line 126
  6. Very specific:

    Use tsc for building TypeScript packages

    line 139
  7. Distinctive:

    Keep component files, styles, and tests together

    line 158
  8. Distinctive:

    Place utility functions near their usage

    line 159
  9. Very specific:

    Use catalog: for shared dependencies across packages

    line 166
  10. Distinctive:

    Avoid duplicate dependencies across packages

    line 167
  11. Distinctive:

    Keep related packages in sync (e.g., React ecosystem)

    line 172
  12. Distinctive:

    Use exact versions for critical dependencies

    line 173
  13. Distinctive:

    Document breaking changes in package versions

    line 174
  14. Distinctive:

    Use dependency injection for complex relationships

    line 189

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
project-structure.mdc
---
description: Project structure, monorepo management, and architectural patterns for the Agentset platform
globs:
alwaysApply: true
---

# Project Structure & Monorepo Guidelines

## Overview

Agentset is a **Turborepo monorepo** containing a Next.js web app and supporting packages. This is an **open-source RAG (Retrieval-Augmented Generation) platform** built with modern web technologies.

## Monorepo Structure

### Core Applications

- `apps/web/` - Main Next.js application with App Router

### Internal Packages (Workspace Dependencies)

- `packages/db/` - Database schema, Prisma client, and types
- `packages/demo/` - Demo data and templates
- `packages/emails/` - Email templates and components (using react-email and resend)
- `packages/engine/` - RAG engine with vector stores and embeddings
- `packages/jobs/` - Background job definitions (Trigger.dev)
- `packages/storage/` - File storage utilities (S3)
- `packages/stripe/` - Payment processing utilities
- `packages/tinybird/` - Data warehousing and analytics (Tinybird)
- `packages/ui/` - Shared UI components (Shadcn-based)
- `packages/utils/` - Shared utility functions
- `packages/validation/` - Shared Zod schemas
- `packages/webhooks/` - Webhook definitions and handlers
- `tooling/` - Development and build tooling

## Package Management

### Use Bun with Workspace Protocol

- Use `bun` as the package manager (required by packageManager field)
- Reference internal packages with `workspace:*` in package.json
- Use catalog: references for shared external dependencies

```json
{
  "dependencies": {
    "@agentset/db": "workspace:*",
    "@agentset/ui": "workspace:*",
    "typescript": "catalog:"
  }
}
```

### Workspace Scripts

- `bun dev` - Start all services in watch mode
- `bun dev:web` - Start web app with dependencies
- `bun build` - Build all packages
- `bun lint` - Run linting across workspace
- `bun typecheck` - Type check all packages

## Directory Naming Conventions

### Use Kebab-Case for Directories

- Directory names should use lowercase with dashes: `auth-wizard/`, `api-client/`
- File names should use kebab-case: `auth-provider.tsx`, `user-settings.ts`
- Avoid camelCase or PascalCase for directories

### Package Organization

```
packages/
├── db/           # Database-related code
├── ui/           # UI components
├── engine/       # Core RAG functionality
├── validation/   # Shared schemas
└── utils/        # Utility functions
```

## Import Patterns

### Use Package Aliases

Import from packages using their configured aliases:

```typescript
// ✅ Correct - use package aliases
import { Button } from "@agentset/ui"
import { db } from "@agentset/db/client"
import { env } from "@agentset/engine/env"

// ❌ Avoid relative paths to packages
import { Button } from "../../packages/ui/src/components/button"
```

### Barrel Exports

Each package should export through `src/index.ts`:

```typescript
// packages/utils/src/index.ts
export * from "./functions"
export * from "./error"
export * from "./fetch"
```

## Environment Management

### Environment Configuration

- Environment variables are validated using `@t3-oss/env-nextjs`
- Each package can extend the environment schema
- Main environment is defined in [apps/web/src/env.ts](mdc:apps/web/src/env.ts)

```typescript
// Extending environment in packages
export const env = createEnv({
  extends: [engineEnv, storageEnv, stripeEnv],
  // ... configuration
});
```

### Environment Files

- `.env` - Main environment file at root
- Use `dotenv -e ../../.env` in package scripts to access root env

## Build and Development

### Turborepo Configuration

- Configured in [turbo.json](mdc:turbo.json) at root
- Uses build cache and parallel execution
- Each package defines its own build pipeline

### Package Development

- Each package should be independently buildable
- Use `tsc` for building TypeScript packages
- Web app uses Next.js build system

## File Organization Principles

### Group by Feature, Then by Type

```
src/
├── app/                    # Next.js App Router pages
├── components/            # Shared UI components
├── lib/                   # Utilities and configurations
├── hooks/                 # Custom React hooks
├── types/                 # TypeScript type definitions
└── services/              # External service integrations
```

### Co-locate Related Files

- Keep component files, styles, and tests together
- Place utility functions near their usage
- Group related API routes in the same directory

## Dependency Management

### External Dependencies

- Use `catalog:` for shared dependencies across packages
- Avoid duplicate dependencies across packages
- Pin AI SDK versions for consistency

### Version Management

- Keep related packages in sync (e.g., React ecosystem)
- Use exact versions for critical dependencies
- Document breaking changes in package versions

## Package Boundaries

### Clear Responsibilities

- `@agentset/db` - All database operations and schemas
- `@agentset/ui` - Reusable UI components only
- `@agentset/engine` - RAG functionality, no UI code
- `@agentset/validation` - Shared schemas, no business logic

### Avoid Circular Dependencies

- Packages should not depend on apps
- Higher-level packages can depend on lower-level ones
- Use dependency injection for complex relationships

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.