JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 736
  • Score
    100M100P100Q97212F
  • License MIT

AI context layer for Claude Code and Cursor โ€” scans your codebase once so AI understands your architecture, stack, and patterns without blind file hunting

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promptpilot-ai) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    ๐Ÿง  promptpilot-ai

    The AI context layer for your codebase

    Works with Claude Code ยท Cursor ยท Both

    npm license node

    Scan your project once โ†’ AI understands everything โ†’ no more blind file hunting


    ๐Ÿค” The Problem

    Every time you ask Claude or Cursor to build something, it starts from zero:

    AI: Let me look at your project structure...
    AI: Reading package.json...
    AI: Reading src/app/...
    AI: Reading components/...
    AI: Hmm, where is the auth module?

    That's 8โ€“12 file reads (~25,000 tokens) just to understand context โ€” before writing a single line of code.


    โœ… The Solution

    Run promptpilot-ai init once. It scans your codebase and writes structured context files that AI tools read automatically.

    AI: (reads .claude/context/architecture.md โ†’ knows everything)
    AI: Got it. Here's the implementation plan...

    2โ€“3 reads. ~6,000 tokens. Straight to the code.


    ๐Ÿš€ Quick Start

    # In your project directory
    npx promptpilot-ai@latest init

    You'll be asked which AI tool you're using:

    ? Which AI tool are you using?
      โฏ Claude Code
        Cursor
        Both

    That's it. Open your project in Claude or Cursor โ€” context is loaded automatically.


    ๐Ÿ—‚๏ธ What Gets Generated

    For Claude Code

    your-project/
    โ”œโ”€โ”€ CLAUDE.md                        โ† context index (auto-loaded by Claude)
    โ”œโ”€โ”€ .claude/
    โ”‚   โ”œโ”€โ”€ settings.json                โ† permissions pre-configured
    โ”‚   โ”œโ”€โ”€ commands/
    โ”‚   โ”‚   โ”œโ”€โ”€ ask.md                   โ† /ask slash command
    โ”‚   โ”‚   โ”œโ”€โ”€ plan.md                  โ† /plan slash command
    โ”‚   โ”‚   โ””โ”€โ”€ sync.md                  โ† /sync slash command
    โ”‚   โ””โ”€โ”€ context/
    โ”‚       โ”œโ”€โ”€ architecture.md          โ† project structure
    โ”‚       โ”œโ”€โ”€ stack.md                 โ† tech stack & commands
    โ”‚       โ”œโ”€โ”€ patterns.md              โ† naming & code conventions
    โ”‚       โ””โ”€โ”€ modules/
    โ”‚           โ”œโ”€โ”€ auth.md
    โ”‚           โ”œโ”€โ”€ components.md
    โ”‚           โ””โ”€โ”€ ...
    โ””โ”€โ”€ .git/hooks/post-commit           โ† auto-sync on commit

    For Cursor

    your-project/
    โ””โ”€โ”€ .cursor/
        โ””โ”€โ”€ rules/
            โ”œโ”€โ”€ architecture.mdc         โ† always loaded (alwaysApply: true)
            โ”œโ”€โ”€ stack.mdc                โ† always loaded
            โ”œโ”€โ”€ patterns.mdc             โ† always loaded
            โ””โ”€โ”€ modules/
                โ”œโ”€โ”€ auth.mdc             โ† loaded when you open auth files
                โ”œโ”€โ”€ components.mdc       โ† loaded when you open component files
                โ””โ”€โ”€ ...

    ๐Ÿ’ก Cursor's .mdc rules use alwaysApply: true for global context and file-glob matching for module-level context โ€” so you only pay for what's relevant.


    ๐Ÿ—๏ธ Multi-Repo Workspace (Frontend + Backend)

    your-workspace/        โ† run init here
      backend/             โ† NestJS / Express
      frontend/            โ† Next.js / React
    cd your-workspace
    npx promptpilot-ai@latest init

    promptpilot-ai auto-detects both repos and generates a bridge map:

    ## Endpoint Map
    
    | Method | Path        | Frontend File               | Backend File                    | Handler   |
    |--------|-------------|-----------------------------|---------------------------------|-----------|
    | GET    | /users      | src/app/users/page.tsx      | src/users/users.controller.ts   | findAll() |
    | POST   | /auth/login | src/app/auth/login/page.tsx | src/auth/auth.controller.ts     | login()   |

    Now when you say /ask add a user profile page, AI reads bridge.md, finds the matching endpoint, and implements both frontend and backend in one pass.


    ๐Ÿ“Š Token Savings

    Without promptpilot-ai With promptpilot-ai
    File reads per task 8โ€“12 2โ€“3
    Tokens per task ~25,000 ~6,000
    Savings โ€” ~70% fewer tokens
    Multi-repo cross-lookup Manual, many reads Auto via bridge.md

    โšก Commands

    CLI

    Command Description
    npx promptpilot-ai init First-time setup โ€” scan project and generate context
    npx promptpilot-ai sync Re-scan after major restructuring or new modules
    npx promptpilot-ai sync --templates Also refresh .claude/commands/*.md slash command templates (use after a promptpilot-ai upgrade)

    Claude Code Slash Commands (after init)

    Command Description
    /ask <request> Natural language โ†’ plan โ†’ execute (cross-repo aware)
    /plan <request> Interactive planning โ€” detects UI vs backend, shows 2โ€“3 layout approaches as ASCII mockups for you to pick, then delivers the final plan with reusable-component reuse enforced
    /sync Trigger a context sync from inside Claude Code

    ๐Ÿ› ๏ธ Supported Stacks

    Category Supported
    Frontend Next.js (App + Pages Router), React (Vite), Vue, Svelte, Astro, Remix
    Backend NestJS, Express, Fastify, Hono, Koa
    Languages TypeScript, JavaScript
    Databases PostgreSQL, MySQL, MongoDB, SQLite
    ORMs Prisma, Drizzle, TypeORM
    Package Managers pnpm, npm, yarn
    Testing Vitest, Jest

    ๐Ÿ”„ Keeping Context Fresh

    Trigger What happens
    git commit Post-commit hook auto-updates changed modules
    New module or endpoint Run npx promptpilot-ai sync manually
    Major refactor Run npx promptpilot-ai sync manually

    ๐Ÿ”” Staying Updated

    promptpilot-ai checks npm once a day (throttled, opt-out via NO_UPDATE_NOTIFIER=1 or CI=1) and surfaces new versions in three places:

    Where How you see it
    Terminal Rounded banner on stderr after any promptpilot-ai command (only in interactive terminals, not pipes/CI)
    Claude Code The existing SessionStart hook prints a one-line notice into Claude's context โ€” Claude mentions it at the start of your first response
    Cursor A temporary .cursor/rules/_promptpilot-update.mdc is auto-generated with alwaysApply: true so Cursor surfaces it the next time you chat

    After upgrading the package (npm i -g promptpilot-ai), run:

    npx promptpilot-ai sync --templates

    This refreshes the slash command templates in your project, clears the notice file, and resets the cache. Zero runtime dependencies โ€” version check uses native fetch only.


    โ“ FAQ

    Do I need an API key? No. Uses your existing Claude Code plan or Cursor subscription โ€” no extra API keys.

    Does it work without git? Yes. Without .git, the filesystem is walked directly (skipping node_modules, dist, .next, etc.).

    Can I use it with both Claude and Cursor? Yes โ€” select "Both" during init. It generates .claude/ and .cursor/rules/ simultaneously.

    Is it safe to commit the generated files? Yes, commit them. Teammates get context immediately without running init themselves.


    ๐Ÿ“„ License

    MIT