project-init ยท diff

git:20260706.14c5553 to git:20260726.87fe1ac

47 added, 132 removed. Audit A to A.

---
name: project-init
- description: "Set up Director Mode in a project: detect language/framework, generate CLAUDE.md, configure agents/skills/hooks and MCP, and verify the install. Use on first setup of a project, after cloning, or when the user runs /project-init."
+ description: "Set up concise, guidance-first Claude/Codex/Grok project context after inspecting the repository. Use on first setup, after cloning, or when the user runs /project-init."
user-invocable: true
---
- # Project Initialization
-
- Execute a comprehensive project setup using Expert Agents.
-
- ---
-
- ## Phases
-
- ### Phase 1: Project Analysis
-
- 1. Check existing setup: `ls -la .claude/ CLAUDE.md`
- 2. Detect language and project type:
+ # Project initialization
- | File Found | Language | Framework Detection |
- |---|---|---|
- | `package.json` | Node.js/TypeScript | Check `dependencies` for react, express, next, etc. |
- | `requirements.txt` / `pyproject.toml` / `setup.py` | Python | Check for django, flask, fastapi, etc. |
- | `Cargo.toml` | Rust | Check `[dependencies]` section |
- | `go.mod` | Go | Check module imports |
- | `pom.xml` / `build.gradle` | Java/Kotlin | Check for spring, android, etc. |
- | None of the above | Unknown | Ask user for tech stack |
+ Create the smallest useful project context without adding permission gates,
+ blocking hooks, or mandatory process rules.
- 3. Detect test framework: jest, pytest, cargo test, go test, etc.
- 4. Map project structure: `find . -type f \( -name "*.ts" -o -name "*.py" -o -name "*.rs" -o -name "*.go" \) | head -20`
+ ## 1. Inspect before writing
- **If no project files detected:**
- ```
- This appears to be an empty or new project.
- What tech stack would you like to use?
- 1. Node.js + TypeScript
- 2. Python
- 3. Go
- 4. Rust
- 5. Other (specify)
- ```
+ - Read existing `CLAUDE.md`, `AGENTS.md`, README, manifests, scripts, and CI.
+ - Detect the language, framework, build, test, lint, and development commands
+ from repository evidence.
+ - Preserve existing user guidance and unrelated configuration.
+ - If the stack or desired workflow cannot be inferred safely, ask one focused
+ question instead of inventing it.
- ### Phase 2: CLAUDE.md Setup
+ ## 2. Add concise shared context
- Use the claude-md-expert agent to create project-specific CLAUDE.md:
+ Keep permanent guidance focused on facts useful in most sessions:
```markdown
- # [Project Name] - Project Instructions
+ # Project name
- ## Overview
- [Auto-detected from package.json description, README.md, or pyproject.toml]
+ ## Purpose
+ [What this repository delivers]
- ## Tech Stack
- - Language: [detected]
- - Framework: [detected]
- - Testing: [detected]
+ ## Stack and structure
+ - [Language/framework]
+ - [Important entry points]
## Commands
- - dev: [detected from scripts or Makefile]
- - test: [detected test command]
- - build: [detected build command]
- - lint: [detected lint command]
-
- ## Development Policies
- - Always write tests before implementation (TDD)
- - Use conventional commits
- - Document public APIs
-
- ## Available Commands
- /workflow # Full 5-step development
- /auto-loop # Autonomous TDD loop
- /focus-problem # Analyze problem
- /test-first # TDD cycle
- /smart-commit # Create commit
- ```
-
- ### Phase 3: MCP Configuration (Optional)
-
- Check if MCP is useful for this project:
-
- ```bash
- # Memory MCP (recommended for larger projects)
- claude mcp add --scope project memory \
- -e MEMORY_FILE_PATH=./.claude/memory.json \
- -- npx -y @modelcontextprotocol/server-memory
- ```
-
- **Skip if:** Small project, prototype, or user declines.
-
- ### Phase 4: Hooks Setup
-
- Install the Auto-Loop stop hook for autonomous development:
-
- ```bash
- # Verify hooks were installed
- ls -la .claude/hooks/auto-loop-stop.sh
-
- # If missing, copy from Director Mode Lite source:
- # cp /path/to/director-mode-lite/hooks/auto-loop-stop.sh .claude/hooks/
- # chmod +x .claude/hooks/auto-loop-stop.sh
- ```
-
- Hooks belong in `.claude/settings.local.json` for per-user installs (the Director Mode default); use `.claude/settings.json` instead when the team shares hooks in version control.
+ - dev: [verified command]
+ - test: [verified command]
+ - build: [verified command]
+ - lint: [verified command]
- Verify settings.local.json has the Stop hook configured:
- ```bash
- jq '.hooks.Stop' .claude/settings.local.json
+ ## Local conventions
+ - [Only repository-specific conventions supported by evidence]
```
- **If hooks are not configured:** Run the install script again or manually add the Stop hook entry to `.claude/settings.local.json`.
-
- ### Phase 5: Review Expert Agents
-
- List available experts for reference:
- - `claude-md-expert` - CLAUDE.md design patterns
- - `mcp-expert` - MCP server configuration
- - `agents-expert` - Custom agent creation
- - `skills-expert` - Custom skill/command creation
- - `hooks-expert` - Hook automation patterns
-
- ### Phase 6: Summary
-
- Output completed setup:
-
- ```markdown
- ## Project Setup Complete
+ Use the Director managed block in both `CLAUDE.md` and `AGENTS.md` so all three
+ CLIs can find `.director-mode/GUIDANCE.md`. Put detailed, conditional procedures
+ in skills rather than expanding the permanent files.
- ### Detected
- - Language: TypeScript
- - Framework: Express.js
- - Testing: Jest
+ ## 3. Verify native assets
- ### Installed
- - [x] CLAUDE.md created with project-specific config
- - [x] Auto-Loop hooks configured
- - [ ] MCP: skipped (optional)
+ Check the selected CLI surfaces:
- ### Next Steps
- 1. Review and customize `CLAUDE.md`
- 2. Run `/workflow` to start your first feature
- 3. Try `/auto-loop "your task"` for autonomous TDD
+ ```text
+ Claude: .claude/skills/ and .claude/agents/
+ Codex: .agents/skills/ and .codex/agents/
+ Grok: shared Claude-compatible skills and .grok/agents/
+ Relay: .director-mode/bin/director-relay
```
- ---
+ Run `scripts/verify-install.sh` when available. Do not require every optional
+ tool merely to declare setup complete.
- ## Quick Mode
+ ## 4. Optional integrations
- Minimal setup (skip MCP and expert review):
- 1. Phase 1: Analysis (detect language + framework)
- 2. Phase 2: Generate CLAUDE.md
- 3. Phase 4: Verify hooks
- 4. Phase 6: Summary with next steps
+ MCP servers, hooks, TDD, autonomous loops, and extra agents are choices, not
+ defaults. Suggest one only when it materially helps the current repository and
+ explain its effect. Install or register it only after the user requests it.
- ---
+ In particular, never register a Stop hook, deny rule, validator, security
+ guard, or background tracker as part of ordinary project initialization.
- ## Next Steps After Init
+ ## 5. Report the result
- 1. Review and customize `CLAUDE.md`
- 2. Run `/workflow` to start developing
- 3. Use `/auto-loop` for autonomous TDD
- 4. Run `/check-environment` if anything seems wrong
+ Summarize detected facts, files created or updated, validation actually run,
+ and optional next steps. A useful default next step is `director-mode` or
+ `workflow`; use `session-relay` when another CLI should take over.