/init-context
Creates the three context files for a new project.
What It Creates
| File | Location | Purpose |
|---|---|---|
CLAUDE.md | Project root | Entry point (auto-loaded by Claude Code) |
STATUS.md | context/ | Current state, Working Set, next actions |
DECISIONS.md | context/ | Append-only decision log |
When to Use
Use this command:
- For new projects with no context files
- After installing the AI Context System for the first time
Note:
- Never overwrites existing files (reports them as "Already exists")
Usage
bash
/init-contextThe command:
- Detects project information from
package.json,README.md, etc. - Creates
CLAUDE.mdat project root with Session Loop instructions - Creates
context/directory withSTATUS.mdandDECISIONS.md - Reports what was created
What Gets Created
CLAUDE.md (Project Root)
markdown
> **Session Loop**
> 1. Start → Read `context/STATUS.md`
> 2. End → Run `/save`
# [Project Name]
[Auto-detected or prompted description]
## Commands
Run: `[detected command]`
Test: `[detected command]`
Build: `[detected command]`
## Constraints
- Don't refactor unrelated code
- Keep PRs under 300 lines
- If you need to touch files outside Working Set, pause, propose, update Working Set, then proceed
## Context
- Status: `context/STATUS.md`
- Decisions: `context/DECISIONS.md`context/STATUS.md
markdown
# Status
SchemaVersion: 1
LastUpdated: [today]
HeadCommit: [git SHA or N/A]
Objective: TBD
## Working Set
- TBD
## Next Actions
- TBD
## Blocked On
- (None)context/DECISIONS.md
markdown
# Decisions
Append-only log.
---
[Empty - decisions will be added as they're made]Auto-Detection
The command automatically detects:
| Source | Information |
|---|---|
package.json | Project name, description, npm scripts |
Cargo.toml | Rust project info |
pyproject.toml | Python project info |
go.mod | Go project info |
README.md | Project description |
| Git | Repository URL, current HEAD |
Example Output
bash
/init-context
📦 Detected: my-app (Next.js + TypeScript)
✅ Created:
CLAUDE.md (project root)
context/STATUS.md
context/DECISIONS.md
Next steps:
1. Review CLAUDE.md - customize if needed
2. Read context/STATUS.md
3. Start working
4. Run /save at end of sessionIf Context Already Exists
If context files already exist, the command reports them without overwriting:
bash
/init-context
Already exists: CLAUDE.md
Already exists: context/STATUS.md
Already exists: context/DECISIONS.md
No files created (all already exist).To reset: Delete the files manually, then run /init-context again:
bash
rm CLAUDE.md && rm -rf context/
/init-contextAfter Initialization
- Review CLAUDE.md — Customize project description and commands
- Start the Session Loop:
- Read
context/STATUS.mdto see current state - Work on your project
- Run
/savewhen done
- Read
Troubleshooting
Files not created
Check: Are you in the project root?
bash
pwd
# Should be /path/to/your-project (not a subdirectory)Wrong project info detected
Solution: Edit the files manually after creation. The auto-detection is a starting point, not the final word.
Already have CLAUDE.md
Solution: The command won't overwrite it. Add the Session Loop blockquote manually at the top of your existing CLAUDE.md:
markdown
> **Session Loop**
> 1. Start → Read `context/STATUS.md`
> 2. End → Run `/save`See Also
- Getting Started — Full setup guide
- CLAUDE.md Guide — Entry point details
- STATUS.md Guide — Current state format
- DECISIONS.md Guide — Decision log format
- /save — End of session updates