# picc-init

[![npm downloads](https://img.shields.io/npm/dt/@ladbabynpm/picc-init.svg)](https://www.npmjs.com/package/@ladbabynpm/picc-init)

`/init` command for pi.
Part of [picc](https://github.com/Ladbaby/picc), a pi agent setup mirroring Claude Code's harness.
Adds a Claude-Code-style codebase-initialization command to pi that analyzes the repo and writes a concise `CLAUDE.md` at the project root.

The prompt is a **verbatim port of Claude Code's default `/init`** — the `OLD_INIT_PROMPT` in `commands/init.ts`, which is what regular users get. The 8-phase `NEW_INIT_PROMPT` (skills, hooks, `CLAUDE.local.md`, plugin suggestions) is gated behind the `NEW_INIT` feature flag and is *not* the default, so it is intentionally not ported.

## What it does

Registers a single pi command, `/init`. Its handler notifies `Analyzing your codebase...`, waits for the agent to be idle (`ctx.waitForIdle()`), and injects the prompt via `pi.sendUserMessage(...)`. The agent then:

- Analyzes the codebase and writes a `CLAUDE.md` at the project root covering:
  1. **Commands** — build, lint, and test commands, including how to run a single test.
  2. **Architecture** — the "big picture" structure that only makes sense after reading multiple files.

The prompt carries the same usage notes as Claude Code: don't repeat yourself, skip obvious/generic instructions, avoid listing easily-discoverable file structure, fold in important parts of existing Cursor rules (`.cursor/rules/`, `.cursorrules`), Copilot rules (`.github/copilot-instructions.md`), and the README, and don't invent sections like "Common Development Tasks" or "Tips for Development". If a `CLAUDE.md` already exists, it proposes improvements rather than silently overwriting.

The generated file is prefixed with:

```
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
```

## Usage

Install via `pi install npm:@ladbabynpm/picc-init`, then run:

```
/init
```

## Differences from Claude Code

- **Default prompt only.** Only `OLD_INIT_PROMPT` is ported. The feature-flagged `NEW_INIT_PROMPT` (interactive setup choice, `CLAUDE.local.md`, skills, hooks, plugin/gh-CLI optimization suggestions) is not included.
- **No subagent / interview steps.** The default Claude Code `/init` is a single self-contained prompt — it does not launch a scout or ask the user questions. The earlier draft's `scout` subagent and `ask_user_question` interview were artifacts of the (non-default) NEW prompt and have been removed.
- **No Claude Code product features.** Nothing here depends on official plugins, `.claude/settings.json` hooks, or the `gh` CLI.
