Skip to content
Open
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
115 changes: 102 additions & 13 deletions plugin/commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,130 @@ allowed-tools: ["Read", "Glob", "Grep", "Bash", "Task"]

Explore this codebase deeply and compile findings into Supermemory.

## Phase 0: Detect Ecosystem

Before anything else, determine the primary tech stack by checking which manifest files exist:

```
Glob for these patterns at the repo root (and one level deep):
*.sln, *.csproj, Directory.Build.props, global.json → .NET/C#
package.json → JS/TS
Cargo.toml → Rust
pyproject.toml, setup.py, requirements.txt → Python
go.mod → Go
pom.xml, build.gradle, build.gradle.kts → Java/Kotlin
Gemfile → Ruby
composer.json → PHP
Package.swift → Swift
mix.exs → Elixir
```

Note the detected ecosystem(s). A repo may use multiple (e.g., a JS frontend + Go backend). Use the **Ecosystem Reference** below to guide all subsequent phases.

---

## Ecosystem Reference

Use this table based on the ecosystem(s) detected in Phase 0. For each phase, look up what to search for.

### Manifest & Config Files (Phase 1)

| Ecosystem | Manifests | Config Files |
|-----------|-----------|-------------|
| **.NET/C#** | `*.sln`, `*.csproj`, `Directory.Build.props`, `Directory.Packages.props`, `global.json`, `nuget.config` | `appsettings.json`, `appsettings.*.json`, `launchSettings.json`, `.editorconfig` |
| **JS/TS** | `package.json`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` | `tsconfig.json`, `.eslintrc*`, `vite.config.*`, `next.config.*`, `webpack.config.*` |
| **Rust** | `Cargo.toml`, `Cargo.lock` | `rust-toolchain.toml`, `.cargo/config.toml` |
| **Python** | `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements*.txt`, `Pipfile` | `tox.ini`, `pytest.ini`, `.flake8`, `mypy.ini` |
| **Go** | `go.mod`, `go.sum` | `.golangci.yml` |
| **Java/Kotlin** | `pom.xml`, `build.gradle`, `build.gradle.kts`, `settings.gradle*` | `application.properties`, `application.yml`, `logback.xml` |
| **Ruby** | `Gemfile`, `Gemfile.lock`, `*.gemspec` | `config/database.yml`, `config/routes.rb`, `.rubocop.yml` |
| **PHP** | `composer.json`, `composer.lock` | `.env`, `config/*.php`, `phpunit.xml` |
| **Swift** | `Package.swift`, `*.xcodeproj`, `*.xcworkspace` | `Info.plist`, `.swiftlint.yml`, `*.xcconfig` |
| **Elixir** | `mix.exs`, `mix.lock` | `config/config.exs`, `config/runtime.exs`, `.formatter.exs`, `.credo.exs` |

### Entry Points & Architecture (Phase 2)

| Ecosystem | Entry Points | Architectural Patterns to Find |
|-----------|-------------|-------------------------------|
| **.NET/C#** | `Program.cs`, `Startup.cs` | DI registrations (`IServiceCollection`), middleware pipeline (`app.Use*`), Controllers or Minimal API endpoints, `DbContext` subclasses, project references in `*.csproj` |
| **JS/TS** | `index.ts`, `main.ts`, `App.tsx`, `server.ts` | Route definitions, React/Vue/Svelte components, API handlers, module exports |
| **Rust** | `main.rs`, `lib.rs` | `mod.rs` modules, trait definitions, `impl` blocks, feature flags in `Cargo.toml` |
| **Python** | `main.py`, `app.py`, `__main__.py`, `wsgi.py`, `asgi.py` | Decorators (`@app.route`, `@router`), `__init__.py` structure, ORM models, management commands |
| **Go** | `main.go`, `cmd/*/main.go` | Interface definitions, package structure, handler functions, middleware chains |
| **Java/Kotlin** | `*Application.java`, `Main.java`, `App.kt` | `@SpringBootApplication`, `@RestController`, `@Service`, `@Repository` annotations, dependency injection |
| **Ruby** | `config.ru`, `app/controllers/application_controller.rb` | Rails MVC structure (`app/models`, `app/controllers`, `app/views`), routes, migrations, gems |
| **PHP** | `public/index.php`, `artisan` | Laravel service providers, routes (`routes/web.php`, `routes/api.php`), Eloquent models, middleware |
| **Swift** | `Sources/*/main.swift`, `App.swift`, `*App.swift` | SwiftUI `@main` app struct, UIKit `AppDelegate`/`SceneDelegate`, SPM targets in `Package.swift`, module structure under `Sources/` |
| **Elixir** | `lib/*/application.ex`, `lib/*_web/endpoint.ex` | OTP supervision trees, Phoenix endpoint/router/controllers, Ecto schemas and repos, GenServer modules, context modules |

### Conventions & Patterns (Phase 3)

| Ecosystem | What to Look For |
|-----------|-----------------|
| **.NET/C#** | Namespace-per-folder structure, `src/`/`tests/` split, `IOptions<T>` configuration pattern, attribute-based routing, extension method conventions (`*Extensions.cs`) |
| **JS/TS** | Import style (ESM vs CJS), component file naming, barrel exports (`index.ts`), path aliases, monorepo structure |
| **Rust** | Module hierarchy, error handling patterns (`Result`, `?`), derive macro usage, visibility modifiers |
| **Python** | Package structure, type hint usage, decorator patterns, test organization (`tests/`), linter/formatter choice |
| **Go** | Package naming, error return patterns, interface placement, table-driven tests |
| **Java/Kotlin** | Package hierarchy, annotation usage, builder patterns, DTO/entity separation |
| **Ruby** | Rails conventions (CoC), concern modules, service objects, RSpec vs Minitest |
| **PHP** | PSR standards, namespace structure, facade usage, artisan commands |
| **Swift** | Protocol-oriented design, `@Observable`/`@State`/`@Binding` patterns, access control (`public`/`internal`/`private`), Swift concurrency (`async`/`await`/`actor`) |
| **Elixir** | `use`/`import`/`alias` conventions, pipe operator chains, pattern matching in function heads, context-based module organization (Phoenix contexts), test structure (`test/`) |

### Key Files to Read (Phase 4)

| Ecosystem | Important Files & Patterns |
|-----------|--------------------------|
| **.NET/C#** | `ServiceCollectionExtensions` or DI setup, middleware classes, `DbContext` + migrations, `AutoMapper`/`Mapster` profiles, `MediatR` handlers, `appsettings.json` structure |
| **JS/TS** | Auth middleware, database client setup, API client wrappers, shared utilities, state management (Redux store, Context providers) |
| **Rust** | Error types, trait implementations, build scripts (`build.rs`), integration test structure |
| **Python** | Settings/config module, ORM models, serializers, middleware, celery tasks, management commands |
| **Go** | HTTP handlers, database layer, middleware, config loading, wire/dependency injection |
| **Java/Kotlin** | Security config, JPA entities, repository interfaces, service layer, exception handlers |
| **Ruby** | ApplicationController, model validations/callbacks, initializers, service objects, background jobs |
| **PHP** | Service providers, form requests, policies, event/listener pairs, scheduled tasks |
| **Swift** | Protocol definitions, view models, network/API layer, Core Data / SwiftData models, dependency injection setup, `Package.swift` target dependencies |
| **Elixir** | `Application` module (supervision tree), `Repo` module (Ecto), router and pipeline definitions, context modules with public API functions, migration files, LiveView modules |

---

## Phase 1: Project Overview

Read and note:
- `package.json` / `Cargo.toml` / `pyproject.toml` / `go.mod`
Read and note the manifest and config files identified by the Ecosystem Reference above, plus:
- `README.md`
- Config files (tsconfig, eslint, etc.)
- CI/CD config (`.github/workflows/`, `Jenkinsfile`, `.gitlab-ci.yml`, etc.)
- Docker files (`Dockerfile`, `docker-compose.yml`)

Gather: project name, purpose, tech stack, how to run/build/test

## Phase 2: Architecture

Explore and note:
- Use Glob to understand folder structure
- Find entry points (index.ts, main.py, App.tsx)
- Identify API routes, database models
- Find entry points per the Ecosystem Reference
- Identify the architectural patterns listed for the detected ecosystem
- Look for API routes/endpoints, database models/entities, and data flow

Comment on lines -24 to 25

This comment was marked as outdated.

Gather: architecture, key modules, data flow

## Phase 3: Conventions

Analyze and note:
- Naming conventions
- File organization
- Import patterns
- Ecosystem-specific conventions from the reference table
- Naming conventions (files, classes, functions, variables)
- File organization and project structure patterns
- Git history: `git log --oneline -20`

Gather: coding conventions, patterns to follow

## Phase 4: Key Files

Read and note:
Read and note the ecosystem-specific key files from the reference table, plus:
- Auth logic
- Database connections
- Database connections / ORM setup
- API clients
- Shared utilities
- Shared utilities and helpers

Gather: where important logic lives

Expand All @@ -53,12 +142,12 @@ After exploring all phases, compile everything into one comprehensive summary an
node "${CLAUDE_PLUGIN_ROOT}/scripts/add-memory.cjs" "YOUR COMPILED FINDINGS HERE"
```

Include: tech stack, architecture, conventions, key files, important patterns.
Include: detected ecosystem, tech stack, architecture, conventions, key files, important patterns.

## Instructions

- Make ~20-50 tool calls to explore thoroughly
- Skip node_modules, build outputs, generated files
- Skip dependency/package folders (`node_modules`, `bin`, `obj`, `target`, `vendor`, `__pycache__`, `.gradle`, `build`, `.build`, `_build`, `deps`), generated files, and lock files
- Compile all findings at the end into one save

Start now.