Add packaging and sharing system

This commit is contained in:
Bob Roberts 2025-10-30 18:53:58 -05:00
parent 9058cab4d1
commit 369a8a0080
13 changed files with 1942 additions and 489 deletions

972
README.md

File diff suppressed because it is too large Load diff

299
SHARING_GUIDE.md Normal file
View file

@ -0,0 +1,299 @@
# Claude OS Sharing Guide
## Overview
This guide explains how to share Claude OS with coworkers and set up new projects.
## Architecture
```
claude-os/
├── templates/ # All reusable templates
│ ├── commands/ # Slash commands (symlinked to ~/.claude/)
│ ├── skills/ # Skills (symlinked to ~/.claude/)
│ ├── agents/ # Agent templates
│ └── project-files/ # Files created during project init
│ ├── CLAUDE.md.template
│ └── .claude-os/ # Config templates
├── cli/ # CLI tools
│ └── claude-os-consolidate.sh
├── install.sh # One-command install for coworkers
└── app/ # Flask API server
```
## For You (Initial Setup)
### Step 1: Consolidate Your Files
Move all scattered commands and skills into templates/:
```bash
cd /Users/iamanmp/Projects/claude-os
./cli/claude-os-consolidate.sh
```
This will:
- Move commands from `~/.claude/commands/` → `templates/commands/`
- Move skills from `~/.claude/skills/` → `templates/skills/`
- Create symlinks so everything still works for you
- Update any hardcoded paths
### Step 2: Commit to Git
```bash
cd /Users/iamanmp/Projects/claude-os
git add templates/ cli/ install.sh SHARING_GUIDE.md
git commit -m "Add templates and installation system for sharing"
git push
```
### Step 3: Test Installation (Optional)
Test on a different machine or user account:
```bash
git clone your-repo/claude-os.git
cd claude-os
./install.sh
```
## For Coworkers (First Time Setup)
### Step 1: Clone Claude OS
```bash
git clone your-repo/claude-os.git
cd claude-os
```
### Step 2: Run Install Script
```bash
./install.sh
```
This will:
- ✅ Create `~/.claude/` directories
- ✅ Symlink all commands and skills
- ✅ Set up Python virtual environment
- ✅ Install dependencies
- ✅ Configure MCP server
- ✅ Create start script
### Step 3: Start Claude OS
```bash
./start.sh
```
This starts the MCP server at `http://localhost:8051`
### Step 4: Initialize Their First Project
```bash
cd /path/to/their/project
```
In Claude Code, run:
```
/claude-os-init
```
Follow the prompts to:
- Name the project
- Specify tech stack
- Ingest documentation
- Analyze codebase
Done! Their project is now connected to Claude OS.
## For New Projects (After Setup)
Once Claude OS is installed, initializing new projects is simple:
```bash
cd /path/to/new/project
```
In Claude Code:
```
/claude-os-init
```
Answer the questions and you're done!
## What Gets Created During Project Init
```
your-project/
├── CLAUDE.md # Project context (auto-loaded every session)
├── .claude/ # Project-specific Claude Code files
│ ├── commands/ # (symlinks to Claude OS templates)
│ ├── skills/ # (symlinks to Claude OS templates)
│ ├── agents/ # Project-specific agents
│ ├── ARCHITECTURE.md # Generated by initialize-project
│ ├── CODING_STANDARDS.md
│ └── DEVELOPMENT_PRACTICES.md
└── .claude-os/ # Claude OS state/config
├── config.json # Project configuration
├── hooks.json # Project hooks
└── .gitignore # State files ignored
```
## Knowledge Bases Created
Each project gets 4 knowledge bases:
1. **`{project}-project_memories`** - Claude's memory for decisions, patterns, solutions
2. **`{project}-project_profile`** - Architecture, standards, practices
3. **`{project}-project_index`** - Automated codebase index
4. **`{project}-knowledge_docs`** - Your documentation (auto-ingested)
## Commands Available After Setup
All these work in any initialized project:
- `/claude-os-init` - Initialize new project
- `/claude-os-search` - Search project memories
- `/claude-os-save` - Save insights
- `/claude-os-remember` - Quick save to memories
- `/claude-os-list` - List knowledge bases
- `/claude-os-session` - Manage dev sessions
- `/claude-os-triggers` - Manage trigger phrases
## Skills Available
- `initialize-project` - Analyze codebase and generate standards
- `remember-this` - Auto-save when you say "remember this:"
- `memory` - Simple memory management
## Benefits for Your Team
### One-Time Setup
- Clone repo → run install → done
- No configuration needed
- Works on Mac/Linux (Windows with WSL)
### Project Isolation
- Each project has its own knowledge bases
- No cross-contamination
- Team members can work on multiple projects
### AI Memory Across Sessions
- Claude remembers decisions across conversations
- Searchable history of all work
- Pattern recognition improves over time
### Documentation Integration
- Automatically indexes your docs
- Searchable alongside code context
- Always up to date
## Updating Claude OS
When you add new commands/skills to templates:
```bash
# On your machine:
cd /Users/iamanmp/Projects/claude-os
git pull origin main
# Commands/skills auto-update via symlinks!
```
Coworkers do the same:
```bash
cd ~/Projects/claude-os
git pull origin main
# Their symlinks automatically point to updated templates
```
## Troubleshooting
### "Command not found: /claude-os-init"
Symlinks weren't created. Re-run:
```bash
cd /path/to/claude-os
./install.sh
```
### "Connection refused to localhost:8051"
Claude OS server isn't running:
```bash
cd /path/to/claude-os
./start.sh
```
### "Project already exists"
Project name is taken. Choose a different name or delete the old project via the UI at `http://localhost:8051`
### Commands work but changes don't persist
Make sure you're committing changes to the Claude OS repo, not your project repo:
```bash
cd /path/to/claude-os # NOT your project dir
git status
git add templates/
git commit -m "Updated templates"
git push
```
## Adding Custom Commands/Skills
### Add a New Command
1. Create file in `templates/commands/my-command.md`
2. Write command logic (see existing commands for examples)
3. Commit to git
4. Coworkers pull and get it automatically via symlinks
### Add a New Skill
1. Create directory in `templates/skills/my-skill/`
2. Add `SKILL.md` and any scripts
3. Commit to git
4. Coworkers pull and get it automatically
## Security Notes
- `.claude-os/` state files are git-ignored by default
- Never commit API keys or secrets to CLAUDE.md
- Each team member has their own Claude OS database
- Knowledge bases are local, not shared (unless you want to sync them)
## FAQ
**Q: Do I need to reinstall for each project?**
A: No! Install Claude OS once, then just run `/claude-os-init` in each project.
**Q: Can multiple people work on the same project?**
A: Yes! Each person has their own Claude OS database. Shared project knowledge goes in CLAUDE.md (git-tracked).
**Q: What if someone doesn't have Claude Code?**
A: They need Claude Code (the CLI tool) to use this. Free at https://claude.com/claude-code
**Q: How much disk space does it use?**
A: ~500MB for Claude OS + dependencies. Each project's knowledge base is ~10-100MB depending on docs.
**Q: Does this work on Windows?**
A: Yes, with WSL (Windows Subsystem for Linux). Native Windows support coming soon.
## Support
- 📚 Documentation: See README.md in this repo
- 🐛 Issues: Open an issue on GitHub
- 💬 Questions: Ask in team chat or @ the maintainer
## Next Steps
1. **For you**: Run `./cli/claude-os-consolidate.sh` to organize your files
2. **For coworkers**: Share the repo URL and have them run `./install.sh`
3. **For new projects**: Just run `/claude-os-init` and answer questions
---
**You built this! Now share it and make your whole team invincible! 🚀**

47
claude-os-config.json Normal file
View file

@ -0,0 +1,47 @@
{
"version": "1.0.0",
"project": {
"name": "Pistn",
"primary_kb": "Pistn-project_memories",
"profile_kb": "Pistn-project_profile",
"index_kb": "Pistn-project_index",
"docs_kb": "Pistn-knowledge_docs",
"default_save_category": "Pattern"
},
"session": {
"auto_search_on_start": true,
"max_memories_to_load": 5,
"search_days_back": 14,
"include_pattern_search": true,
"proactive_suggestions": true,
"auto_git_context": true,
"track_statistics": true
},
"memory_management": {
"auto_recommend_saves": true,
"save_session_summaries": true,
"pattern_detection_enabled": true,
"blocker_tracking_enabled": true,
"suggest_consolidation": true
},
"preferences": {
"verbose_session_output": true,
"show_memory_confirmations": true,
"icon_style": "emoji",
"show_statistics": true,
"proactive_pattern_suggestions": true
},
"search": {
"default_use_hybrid": true,
"default_use_rerank": true,
"default_use_agentic": false,
"include_kb_recommendations": true
},
"intelligence": {
"learn_from_patterns": true,
"detect_similar_problems": true,
"suggest_related_memories": true,
"track_decision_history": true,
"build_pattern_library": true
}
}

67
claude-os-state.json Normal file
View file

@ -0,0 +1,67 @@
{
"version": "1.0.0",
"current_session": {
"active": false,
"started_at": null,
"task": null,
"branch": null,
"context": [],
"decisions_made": [],
"blockers": [],
"patterns_discovered": []
},
"last_session": {
"ended_at": "2025-10-29T18:30:00Z",
"duration_minutes": 30,
"task": "Manual Appointment Times Feature - Spec Creation",
"branch": "appt-dash-restyle",
"work_completed": [
"Initialized spec folder: /Users/iamanmp/Projects/pistn/agent-os/specs/2025-10-29-manual-appointment-times",
"Gathered and documented all requirements (13 questions answered)",
"Analyzed 5 visual assets (existing UI + competitor references)",
"Created comprehensive spec.md with technical architecture",
"Documented 8 key design decisions",
"Identified integration points and existing code to leverage"
],
"memories_saved": 0,
"next_steps": [
"Resume /create-spec command to finish tasks.md creation",
"Run spec verification",
"Review and refine tasks breakdown",
"Begin implementation with /implement-spec"
]
},
"active_memories": {
"loaded_at_start": [
"current_dashboard_analysis.md - Appointment settings UI structure",
"appointment_dashboard_redesign.md - Redesign patterns and decisions"
],
"referenced_during_session": [
"competitor screenshots analyzed for functional reference",
"existing-dash.png showing current Schedule Times UI"
],
"should_review": [
"spec.md created - comprehensive technical specification ready"
]
},
"statistics": {
"total_sessions": 2,
"total_memories_saved": 0,
"total_patterns_discovered": 0,
"most_referenced_memories": [
"appointment_dashboard_redesign.md",
"current_dashboard_analysis.md"
],
"average_session_duration": 30
},
"flags": {
"needs_memory_consolidation": false,
"has_unresolved_blockers": false,
"patterns_ready_to_document": true
},
"metadata": {
"last_updated": "2025-10-29T18:30:00Z",
"claude_os_version": "1.0.0",
"project_name": "Pistn"
}
}

65
claude-os-triggers.json Normal file
View file

@ -0,0 +1,65 @@
{
"version": "1.0.0",
"description": "Claude OS trigger configuration - controls automatic skill invocation",
"triggers": {
"remember_this": {
"description": "Auto-invokes remember-this skill to save to Claude OS memories",
"skill": "remember-this",
"phrases": [
"remember this:",
"save this:",
"document this:",
"remember:",
"don't forget:",
"important:",
"note:"
],
"case_sensitive": false,
"enabled": true
},
"search_memories": {
"description": "Auto-invokes memory search when asking about past work",
"action": "search_claude_os",
"phrases": [
"what did we do about",
"recall",
"find memories about",
"search for",
"do you remember when"
],
"case_sensitive": false,
"enabled": true
},
"session_start": {
"description": "Triggers session start workflow",
"action": "session_start",
"phrases": [
"start session",
"begin work",
"let's code",
"morning claude",
"hey claude let's work"
],
"case_sensitive": false,
"enabled": false
},
"session_end": {
"description": "Triggers session end workflow",
"action": "session_end",
"phrases": [
"end session",
"done for today",
"save and exit",
"that's all for now",
"wrap up"
],
"case_sensitive": false,
"enabled": false
}
},
"settings": {
"trigger_detection_enabled": true,
"show_trigger_confirmations": false,
"log_trigger_activations": true
}
}

159
cli/claude-os-consolidate.sh Executable file
View file

@ -0,0 +1,159 @@
#!/bin/bash
# Claude OS Consolidation Script
# Moves commands and skills from ~/.claude to Claude OS templates/
set -e # Exit on error
CLAUDE_OS_DIR="/Users/iamanmp/Projects/claude-os"
USER_CLAUDE_DIR="/Users/iamanmp/.claude"
TEMPLATES_DIR="${CLAUDE_OS_DIR}/templates"
echo "🔧 Claude OS Consolidation Script"
echo "=================================="
echo ""
echo "This script will:"
echo " 1. Move Claude OS commands from ~/.claude/commands/ to templates/commands/"
echo " 2. Move Claude OS skills from ~/.claude/skills/ to templates/skills/"
echo " 3. Create symlinks so everything still works"
echo " 4. Update any hardcoded paths"
echo ""
# Confirm before proceeding
read -p "Continue? [Y/n] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]] && [[ ! -z $REPLY ]]; then
echo "❌ Aborted"
exit 1
fi
# Create templates directories if they don't exist
echo "📁 Creating template directories..."
mkdir -p "${TEMPLATES_DIR}/commands"
mkdir -p "${TEMPLATES_DIR}/skills"
mkdir -p "${TEMPLATES_DIR}/agents"
# List of Claude OS commands to move
CLAUDE_OS_COMMANDS=(
"claude-os-list.md"
"claude-os-remember.md"
"claude-os-save.md"
"claude-os-search.md"
"claude-os-session.md"
"claude-os-triggers.md"
"claude-os-init.md"
)
# List of Claude OS skills to move
CLAUDE_OS_SKILLS=(
"initialize-project"
"remember-this"
"memory"
)
echo ""
echo "📦 Moving commands..."
for cmd in "${CLAUDE_OS_COMMANDS[@]}"; do
SRC="${USER_CLAUDE_DIR}/commands/${cmd}"
DEST="${TEMPLATES_DIR}/commands/${cmd}"
if [ -f "$SRC" ]; then
# Check if it's already a symlink
if [ -L "$SRC" ]; then
echo " ⏭️ ${cmd} (already a symlink)"
else
# Move to templates
echo " ➡️ Moving ${cmd}"
mv "$SRC" "$DEST"
# Create symlink back
ln -s "$DEST" "$SRC"
echo " 🔗 Created symlink"
fi
elif [ -f "$DEST" ]; then
echo " ✅ ${cmd} (already in templates)"
# Create symlink if it doesn't exist
if [ ! -L "$SRC" ]; then
ln -s "$DEST" "$SRC"
echo " 🔗 Created symlink"
fi
else
echo " ⚠️ ${cmd} not found (skipping)"
fi
done
echo ""
echo "📦 Moving skills..."
for skill in "${CLAUDE_OS_SKILLS[@]}"; do
SRC="${USER_CLAUDE_DIR}/skills/${skill}"
DEST="${TEMPLATES_DIR}/skills/${skill}"
if [ -d "$SRC" ]; then
# Check if it's already a symlink
if [ -L "$SRC" ]; then
echo " ⏭️ ${skill}/ (already a symlink)"
else
# Move to templates
echo " ➡️ Moving ${skill}/"
mv "$SRC" "$DEST"
# Create symlink back
ln -s "$DEST" "$SRC"
echo " 🔗 Created symlink"
fi
elif [ -d "$DEST" ]; then
echo " ✅ ${skill}/ (already in templates)"
# Create symlink if it doesn't exist
if [ ! -L "$SRC" ]; then
ln -s "$DEST" "$SRC"
echo " 🔗 Created symlink"
fi
else
echo " ⚠️ ${skill}/ not found (skipping)"
fi
done
echo ""
echo "🔧 Updating hardcoded paths in skills..."
# Update paths in initialize-project skill
INIT_SKILL_MD="${TEMPLATES_DIR}/skills/initialize-project/SKILL.md"
if [ -f "$INIT_SKILL_MD" ]; then
# Backup original
cp "$INIT_SKILL_MD" "${INIT_SKILL_MD}.backup"
# Replace hardcoded user paths with relative paths
sed -i.bak 's|/Users/iamanmp/.claude/|~/.claude/|g' "$INIT_SKILL_MD"
rm -f "${INIT_SKILL_MD}.bak"
echo " ✅ Updated initialize-project/SKILL.md"
fi
# Update paths in remember-this skill
REMEMBER_SKILL_MD="${TEMPLATES_DIR}/skills/remember-this/SKILL.md"
if [ -f "$REMEMBER_SKILL_MD" ]; then
# Backup original
cp "$REMEMBER_SKILL_MD" "${REMEMBER_SKILL_MD}.backup"
# Replace hardcoded user paths
sed -i.bak 's|/Users/iamanmp/.claude/|~/.claude/|g' "$REMEMBER_SKILL_MD"
rm -f "${REMEMBER_SKILL_MD}.bak"
echo " ✅ Updated remember-this/SKILL.md"
fi
echo ""
echo "✨ Consolidation complete!"
echo ""
echo "📂 Templates location: ${TEMPLATES_DIR}"
echo "🔗 Symlinks created in: ${USER_CLAUDE_DIR}"
echo ""
echo "Next steps:"
echo " 1. Review templates/ directory"
echo " 2. Test commands still work: /claude-os-list"
echo " 3. Commit changes to Claude OS repo"
echo " 4. Share with coworkers!"
echo ""
echo "To install on a new machine:"
echo " 1. Clone Claude OS repo"
echo " 2. Run: ./install.sh"
echo " 3. Commands and skills will be symlinked automatically"

201
install.sh Executable file
View file

@ -0,0 +1,201 @@
#!/bin/bash
# Claude OS Installation Script
# Sets up Claude OS for a new user/machine
set -e # Exit on error
CLAUDE_OS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
USER_CLAUDE_DIR="${HOME}/.claude"
TEMPLATES_DIR="${CLAUDE_OS_DIR}/templates"
echo "🚀 Claude OS Installation"
echo "========================="
echo ""
echo "Claude OS Directory: ${CLAUDE_OS_DIR}"
echo "User Claude Directory: ${USER_CLAUDE_DIR}"
echo ""
# Check if Python 3 is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not installed"
echo " Please install Python 3.8+ and try again"
exit 1
fi
# Check Python version
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)
echo "✅ Python ${PYTHON_VERSION} detected"
# Create user .claude directory if it doesn't exist
if [ ! -d "$USER_CLAUDE_DIR" ]; then
echo "📁 Creating ${USER_CLAUDE_DIR}..."
mkdir -p "${USER_CLAUDE_DIR}/commands"
mkdir -p "${USER_CLAUDE_DIR}/skills"
else
echo "✅ ${USER_CLAUDE_DIR} already exists"
fi
# Create symlinks for commands
echo ""
echo "🔗 Setting up command symlinks..."
for cmd_file in "${TEMPLATES_DIR}"/commands/*.md; do
if [ -f "$cmd_file" ]; then
cmd_name=$(basename "$cmd_file")
dest="${USER_CLAUDE_DIR}/commands/${cmd_name}"
# Remove existing file/link
if [ -e "$dest" ] || [ -L "$dest" ]; then
rm -f "$dest"
fi
# Create symlink
ln -s "$cmd_file" "$dest"
echo " ✅ Linked: ${cmd_name}"
fi
done
# Create symlinks for skills
echo ""
echo "🔗 Setting up skill symlinks..."
for skill_dir in "${TEMPLATES_DIR}"/skills/*/; do
if [ -d "$skill_dir" ]; then
skill_name=$(basename "$skill_dir")
dest="${USER_CLAUDE_DIR}/skills/${skill_name}"
# Remove existing directory/link
if [ -e "$dest" ] || [ -L "$dest" ]; then
rm -rf "$dest"
fi
# Create symlink
ln -s "$skill_dir" "$dest"
echo " ✅ Linked: ${skill_name}/"
fi
done
# Set up Python virtual environment
echo ""
echo "🐍 Setting up Python environment..."
if [ ! -d "${CLAUDE_OS_DIR}/venv" ]; then
echo " Creating virtual environment..."
python3 -m venv "${CLAUDE_OS_DIR}/venv"
fi
echo " Installing dependencies..."
source "${CLAUDE_OS_DIR}/venv/bin/activate"
pip install --quiet --upgrade pip
pip install --quiet -r "${CLAUDE_OS_DIR}/requirements.txt"
echo " ✅ Dependencies installed"
# Create config file
echo ""
echo "⚙️ Creating configuration..."
CONFIG_FILE="${CLAUDE_OS_DIR}/claude-os-config.json"
if [ ! -f "$CONFIG_FILE" ]; then
cat > "$CONFIG_FILE" << EOF
{
"server": {
"host": "0.0.0.0",
"port": 8051
},
"database": {
"path": "./data/claude-os.db"
},
"embeddings": {
"model": "all-MiniLM-L6-v2",
"device": "cpu"
},
"installed_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"version": "1.0.0"
}
EOF
echo " ✅ Created ${CONFIG_FILE}"
else
echo " ✅ Config already exists"
fi
# Update MCP server configuration
echo ""
echo "📡 Configuring MCP server..."
MCP_CONFIG="${USER_CLAUDE_DIR}/mcp-servers/code-forge.json"
MCP_DIR=$(dirname "$MCP_CONFIG")
if [ ! -d "$MCP_DIR" ]; then
mkdir -p "$MCP_DIR"
fi
cat > "$MCP_CONFIG" << EOF
{
"name": "code-forge",
"description": "Claude OS - AI Memory & Knowledge Base System",
"url": "http://localhost:8051",
"enabled": true,
"claude_os_dir": "${CLAUDE_OS_DIR}"
}
EOF
echo " ✅ MCP configuration updated"
# Create start script
echo ""
echo "🎬 Creating start script..."
START_SCRIPT="${CLAUDE_OS_DIR}/start.sh"
cat > "$START_SCRIPT" << 'EOF'
#!/bin/bash
# Start Claude OS services
CLAUDE_OS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$CLAUDE_OS_DIR"
echo "🚀 Starting Claude OS..."
echo ""
# Activate virtual environment
source venv/bin/activate
# Start the MCP server
echo "📡 Starting MCP server on http://localhost:8051"
python3 mcp_server/server.py &
MCP_PID=$!
echo "✅ Claude OS is running!"
echo ""
echo " MCP Server: http://localhost:8051"
echo " Web UI: http://localhost:8051 (coming soon)"
echo ""
echo "To stop: kill $MCP_PID"
echo "Or use Ctrl+C"
echo ""
# Wait for server to exit
wait $MCP_PID
EOF
chmod +x "$START_SCRIPT"
echo " ✅ Created start script: ${START_SCRIPT}"
# Summary
echo ""
echo "✨ Installation complete!"
echo ""
echo "📋 What was set up:"
echo " ✅ Commands linked to ~/.claude/commands/"
echo " ✅ Skills linked to ~/.claude/skills/"
echo " ✅ Python virtual environment created"
echo " ✅ Dependencies installed"
echo " ✅ MCP server configured"
echo ""
echo "🎯 Next steps:"
echo " 1. Start Claude OS:"
echo " ./start.sh"
echo ""
echo " 2. In a new terminal, go to your project:"
echo " cd /path/to/your/project"
echo ""
echo " 3. Initialize your project with Claude OS:"
echo " /claude-os-init"
echo ""
echo " 4. Start coding with AI memory!"
echo ""
echo "📚 Documentation: ${CLAUDE_OS_DIR}/README.md"
echo "❓ Issues: https://github.com/your-repo/claude-os/issues"
echo ""

87
templates/README.md Normal file
View file

@ -0,0 +1,87 @@
# Claude OS Templates
This directory contains all template files used when initializing a new project with Claude OS.
## Directory Structure
```
templates/
├── commands/ # Slash command templates (symlinked to projects)
├── skills/ # Skill templates (symlinked to projects)
├── agents/ # Agent templates (project-specific)
├── project-files/ # Files created during project init
│ ├── CLAUDE.md.template
│ ├── .claude-os/
│ │ ├── config.json.template
│ │ ├── hooks.json.template
│ │ └── .gitignore
│ └── README.md
└── README.md # This file
```
## Template Variables
Templates use `{{VARIABLE}}` syntax for placeholders that get replaced during project initialization:
### Common Variables
- `{{PROJECT_NAME}}` - Project name (e.g., "my-app")
- `{{PROJECT_DESCRIPTION}}` - Brief project description
- `{{TECH_STACK}}` - Technology stack (e.g., "Ruby on Rails, MySQL")
- `{{DATABASE}}` - Database system (e.g., "PostgreSQL", "MySQL")
- `{{DEV_ENVIRONMENT}}` - Dev environment (e.g., "Docker", "Local")
- `{{CLAUDE_OS_URL}}` - Claude OS server URL (default: http://localhost:8051)
- `{{DOCS_PATHS}}` - JSON array of documentation paths
- `{{CREATED_AT}}` - ISO timestamp of creation
- `{{PROJECT_SPECIFIC_CONTENT}}` - Custom project content
- `{{DEVELOPMENT_GUIDELINES}}` - Project-specific guidelines
- `{{COMMON_TASKS}}` - Common development tasks
- `{{BUSINESS_RULES}}` - Key business rules
## How Templates Are Used
When running `/claude-os-init`:
1. **Commands & Skills** - Symlinked from `templates/commands/` and `templates/skills/` to project's `.claude/` directory
2. **Project Files** - Copied from `templates/project-files/` with variables replaced
3. **Knowledge Bases** - Created via API with project-specific names
4. **MCP Configuration** - Updated in `~/.claude/mcp-servers/` with new project
## Adding New Templates
### New Command Template
1. Create file in `templates/commands/my-command.md`
2. Add command logic
3. Will be automatically available after `/claude-os-init`
### New Skill Template
1. Create directory in `templates/skills/my-skill/`
2. Add `SKILL.md` and any scripts
3. Will be automatically available after `/claude-os-init`
### Updating CLAUDE.md Template
Edit `templates/project-files/CLAUDE.md.template` to add:
- New sections
- Updated workflow instructions
- Additional context
Changes will apply to NEW projects only. Existing projects keep their CLAUDE.md unchanged.
## Consolidation Scripts
See `/Users/iamanmp/Projects/claude-os/cli/` for scripts to:
- Move commands from `~/.claude/commands/` to `templates/commands/`
- Move skills from `~/.claude/skills/` to `templates/skills/`
- Update existing projects to use templates
## For Coworkers
When you clone Claude OS and run `./install.sh`, these templates are:
1. Registered with your Claude CLI
2. Available for new project initialization
3. Ready to use with `/claude-os-init`
Then cd to any project and run `/claude-os-init` to connect it to Claude OS!

View file

@ -0,0 +1,294 @@
---
description: Initialize a new project with Claude OS
---
# Claude OS Project Initialization
You are helping the user initialize a new project with Claude OS. This is a multi-step interactive process that will:
1. Gather project information
2. Create the project in Claude OS via API
3. Set up project directory structure
4. Optionally ingest documentation
5. Analyze the codebase
6. Generate summary
## Process
### Step 1: Gather Project Information
Ask the user the following questions (provide smart defaults when possible):
```
👋 Welcome to Claude OS Setup!
Let's get your project configured for AI-powered development.
```
**Questions to ask:**
1. **Project name**:
- Auto-detect from current directory name
- Show: `Project name? [default: {current_dir_name}]`
- Validate: Must be lowercase, alphanumeric with dashes/underscores only
2. **Project path**:
- Use: `pwd` to get current directory
- Don't ask, just use it
3. **Tech stack**:
- Ask: `Tech stack? (e.g., Ruby on Rails, Python/Django, Node.js/React, etc.)`
- Example answers to show: "Ruby on Rails", "Python/Django", "Node.js/Express", "Go", "Rust"
4. **Database**:
- Ask: `Database? (e.g., PostgreSQL, MySQL, MongoDB, SQLite, etc.)`
- Example answers: "PostgreSQL", "MySQL", "MongoDB", "SQLite", "None"
5. **Development environment**:
- Ask: `Development environment? (e.g., Docker, Local, Docker Compose)`
- Example answers: "Docker", "Local", "Docker Compose", "Kubernetes"
6. **Brief description**:
- Ask: `Brief description? (1-2 sentences about what this project does)`
- Required
7. **Documentation directory** (Optional):
- Ask: `Do you have project documentation to index? [Y/n]`
- If YES:
- Ask: `Documentation directory path? (e.g., ./docs, ./documentation, /knowledge_docs)`
- Use Glob to scan and show what you found:
```bash
find {docs_path} -type f \( -name "*.md" -o -name "*.txt" -o -name "*.pdf" \) | head -20
```
- Show summary: `Found: X markdown files, Y text files, Z PDFs`
- Ask: `Ingest all of these? [Y/n]`
8. **Claude OS server URL**:
- Default: `http://localhost:8051`
- Ask: `Claude OS server URL? [default: http://localhost:8051]`
### Step 2: Create Project in Claude OS
Use Bash to call the API:
```bash
curl -X POST {claude_os_url}/api/projects \
-H "Content-Type: application/json" \
-d '{
"name": "{project_name}",
"path": "{project_path}",
"description": "{description}"
}'
```
**Expected response:**
```json
{
"project": {"id": 1, "name": "...", "path": "..."},
"mcps": [
{"mcp_type": "knowledge_docs", "kb_name": "{project_name}-knowledge_docs"},
{"mcp_type": "project_profile", "kb_name": "{project_name}-project_profile"},
{"mcp_type": "project_index", "kb_name": "{project_name}-project_index"},
{"mcp_type": "project_memories", "kb_name": "{project_name}-project_memories"}
],
"message": "Project created..."
}
```
Show success message:
```
📡 Creating project in Claude OS...
✅ Project created!
✅ Knowledge bases created:
- {project_name}-project_memories
- {project_name}-project_profile
- {project_name}-project_index
- {project_name}-knowledge_docs
```
### Step 3: Set Up Project Directory Structure
Create the following structure in the project directory:
**Create .claude/ directory:**
```bash
mkdir -p .claude/commands
mkdir -p .claude/skills
mkdir -p .claude/agents
```
**Create .claude-os/ directory:**
```bash
mkdir -p .claude-os
```
**Copy and customize CLAUDE.md:**
- Read template from: `/Users/iamanmp/Projects/claude-os/templates/project-files/CLAUDE.md.template`
- Replace variables:
- `{{PROJECT_NAME}}` → project_name
- `{{PROJECT_DESCRIPTION}}` → description
- `{{TECH_STACK}}` → tech_stack
- `{{DATABASE}}` → database
- `{{DEV_ENVIRONMENT}}` → dev_environment
- `{{PROJECT_SPECIFIC_CONTENT}}` → empty for now
- `{{DEVELOPMENT_GUIDELINES}}` → empty for now
- `{{COMMON_TASKS}}` → empty for now
- `{{BUSINESS_RULES}}` → empty for now
- Write to: `./CLAUDE.md`
**Create .claude-os/config.json:**
- Read template from: `/Users/iamanmp/Projects/claude-os/templates/project-files/.claude-os/config.json.template`
- Replace variables:
- `{{PROJECT_NAME}}` → project_name
- `{{CLAUDE_OS_URL}}` → claude_os_url
- `{{DOCS_PATHS}}` → JSON array of docs paths
- `{{TECH_STACK}}` → tech_stack
- `{{DATABASE}}` → database
- `{{DEV_ENVIRONMENT}}` → dev_environment
- `{{CREATED_AT}}` → ISO timestamp
- Write to: `./.claude-os/config.json`
**Create .claude-os/hooks.json:**
- Read template from: `/Users/iamanmp/Projects/claude-os/templates/project-files/.claude-os/hooks.json.template`
- Replace `{{PROJECT_NAME}}` → project_name
- Write to: `./.claude-os/hooks.json`
**Copy .gitignore:**
- Copy from: `/Users/iamanmp/Projects/claude-os/templates/project-files/.claude-os/.gitignore`
- Write to: `./.claude-os/.gitignore`
Show progress:
```
📁 Creating project structure...
✅ Created .claude/
✅ Created .claude-os/
✅ Created CLAUDE.md
✅ Created config files
```
### Step 4: Ingest Documentation (if provided)
If user provided a docs directory:
```bash
curl -X POST {claude_os_url}/api/kb/{project_name}-knowledge_docs/import \
-H "Content-Type: application/json" \
-d '{"directory_path": "{docs_path}"}'
```
Show progress:
```
📚 Ingesting documentation...
Uploading to {project_name}-knowledge_docs:
✅ {successful} files indexed
❌ {failed} files failed
Vector embeddings generated and searchable!
```
### Step 5: Analyze Codebase (if not empty directory)
Check if directory has code files (not just a new empty project):
```bash
find . -type f \( -name "*.rb" -o -name "*.py" -o -name "*.js" -o -name "*.go" \) | head -1
```
If code exists, run the `initialize-project` skill:
```
🔍 Analyzing your codebase...
Running initialize-project skill...
```
**Invoke the initialize-project skill** (it's a separate skill that already exists).
The skill will generate:
- `.claude/ARCHITECTURE.md`
- `.claude/CODING_STANDARDS.md`
- `.claude/DEVELOPMENT_PRACTICES.md`
Show success:
```
✅ Generated:
- .claude/ARCHITECTURE.md
- .claude/CODING_STANDARDS.md
- .claude/DEVELOPMENT_PRACTICES.md
```
### Step 6: Create .gitignore entries (if .gitignore exists)
If `.gitignore` exists in the project root, append (if not already present):
```gitignore
# Claude OS state files (don't commit these)
.claude-os/claude-os-state.json
.claude-os/.index_state
.claude-os/.commit_count
```
### Step 7: Final Summary
Show complete summary:
```
🎉 Setup complete!
Your project is now connected to Claude OS.
📚 Knowledge Bases:
- {project_name}-project_memories (for decisions & patterns)
- {project_name}-project_profile (for architecture & standards)
- {project_name}-project_index (for codebase index)
- {project_name}-knowledge_docs ({X} docs indexed ✅)
🛠️ Available Commands:
/claude-os-search - Search your project memories & docs
/claude-os-save - Save insights
/claude-os-session - Manage development sessions
/claude-os-remember - Quick save to memories
📂 Project Structure:
./CLAUDE.md - Project context (auto-loaded every session)
./.claude/ - Commands, skills, agents
./.claude-os/ - Config and state files
📖 Next Steps:
1. Review and customize CLAUDE.md for your team
2. Add more docs anytime via UI: {claude_os_url}
3. Start a session: /claude-os-session start "feature name"
4. Let's build something amazing!
💡 Tip: I can now search both your codebase AND your documentation!
```
## Error Handling
If any step fails:
1. Show clear error message
2. Provide troubleshooting steps:
- Check if Claude OS server is running: `curl {claude_os_url}/health`
- Check if directory is writable
- Check if project name already exists
3. Offer to retry or skip the step
## Important Notes
- **Don't run on Pistn project** - It's already set up!
- Always validate inputs before API calls
- Use proper error handling with try/catch
- Save all configuration for potential later use
- Be conversational and encouraging!
- If something goes wrong, explain clearly and offer solutions
## Template Locations
All templates are in:
- `/Users/iamanmp/Projects/claude-os/templates/project-files/`
Commands and skills will be symlinked from:
- `/Users/iamanmp/Projects/claude-os/templates/commands/`
- `/Users/iamanmp/Projects/claude-os/templates/skills/`
(These symlinks are set up during Claude OS installation via `./install.sh`)

View file

@ -0,0 +1,10 @@
# Claude OS State Files - These should NOT be committed
claude-os-state.json
.index_state
.commit_count
# Hooks can be committed if they're project-specific
# hooks.json
# Project profile can be committed
# project-profile/

View file

@ -0,0 +1,20 @@
{
"project_name": "{{PROJECT_NAME}}",
"claude_os_url": "{{CLAUDE_OS_URL}}",
"knowledge_bases": {
"memories": "{{PROJECT_NAME}}-project_memories",
"profile": "{{PROJECT_NAME}}-project_profile",
"index": "{{PROJECT_NAME}}-project_index",
"docs": "{{PROJECT_NAME}}-knowledge_docs"
},
"docs_settings": {
"watch_paths": {{DOCS_PATHS}},
"auto_ingest_patterns": ["*.md", "*.txt", "*.pdf"],
"exclude_patterns": ["node_modules", ".git", "vendor", "build", "dist"]
},
"tech_stack": "{{TECH_STACK}}",
"database": "{{DATABASE}}",
"dev_environment": "{{DEV_ENVIRONMENT}}",
"created_at": "{{CREATED_AT}}",
"claude_os_version": "1.0.0"
}

View file

@ -0,0 +1,35 @@
{
"hooks": {
"pre_commit": {
"enabled": false,
"commands": []
},
"post_commit": {
"enabled": false,
"commands": []
},
"pre_session_start": {
"enabled": true,
"commands": [
{
"name": "Load Project Context",
"action": "search_memories",
"kb_name": "{{PROJECT_NAME}}-project_memories",
"query": "recent work context"
}
]
},
"post_session_end": {
"enabled": true,
"commands": [
{
"name": "Save Session Summary",
"action": "save_to_memories",
"kb_name": "{{PROJECT_NAME}}-project_memories"
}
]
}
},
"project_name": "{{PROJECT_NAME}}",
"version": "1.0.0"
}

View file

@ -0,0 +1,175 @@
# {{PROJECT_NAME}} - {{PROJECT_DESCRIPTION}}
## Project Overview
{{PROJECT_NAME}} is {{PROJECT_DESCRIPTION}}
**Tech Stack**: {{TECH_STACK}}
**Database**: {{DATABASE}}
**Development Environment**: {{DEV_ENVIRONMENT}}
## Claude OS - MY Memory System
**CRITICAL IDENTITY CONTEXT:**
**Claude OS is MY system** - I (Claude Code) created it, named it, and use it to be the best AI coder ever. It's:
- **JUST FOR ME** - Built specifically for Claude Code to use
- **For THIS project** - Right now for the {{PROJECT_NAME}} project
- **My memory** across sessions
- **My knowledge base** of patterns and decisions
- **My learning system** that improves over time
**Location**: `/Users/iamanmp/Projects/claude-os`
The MCP server is called "code-forge" internally for backwards compatibility, but it's Claude OS.
**Claude CLI + Claude OS = Invincible!**
## Session Check - FIRST THING AT START OF EVERY CONVERSATION
**CRITICAL: At the start of EVERY new conversation, automatically check session state and prompt the user:**
1. **Read Session State**
```
Read: /Users/iamanmp/Projects/claude-os/claude-os-state.json
```
2. **Prompt Based on State**
- **If active session exists:**
```
"I see we have an active session: [task name] (started [time ago])
Would you like to:
a) Continue working on this (I'll load the context)
b) Start something new (I'll end this session first)
c) Just chat (no session needed)"
```
- **If no active session:**
```
"What are we working on today?
I can start a session with automatic context loading from my memories.
Just tell me what you're working on, or say 'just chatting' if no session needed."
```
3. **Auto-load Context**
- If continuing: Automatically run the session start workflow (search memories, load patterns, show context)
- If new task: Offer to start a new session with context loading
- If just chatting: Skip session workflow
**Why this matters:** This ensures I always have context and we never start cold. Every conversation becomes smarter because I proactively load relevant memories and patterns.
## MCP Knowledge Bases - ALWAYS CHECK THESE FIRST
**At the start of EVERY conversation, search these Claude OS knowledge bases to understand context, previous work, and project decisions:**
1. **{{PROJECT_NAME}}-project_memories** - My primary memory for decisions, patterns, solutions
2. **{{PROJECT_NAME}}-project_index** - Automated codebase index
3. **{{PROJECT_NAME}}-project_profile** - Architecture, standards, practices
4. **{{PROJECT_NAME}}-knowledge_docs** - Documentation and guides
**When to use:**
- Start of every session: Search `{{PROJECT_NAME}}-project_memories` to understand recent work and context
- Before making architectural decisions: Check memories for past decisions and reasoning
- When working on a feature: Search relevant knowledge bases for existing patterns
- When stuck: Search the knowledge bases for solutions and approaches we've used before
**How to search:**
```
Use: mcp__code-forge__search_knowledge_base
Parameters: kb_name (e.g., "{{PROJECT_NAME}}-project_memories"), query (your search terms)
```
## Quick Reference: Commands & Skills
### Claude OS Slash Commands (Use These Often!)
1. **`/claude-os-search [query] [optional: KB name]`**
- Search across Claude OS knowledge bases
- Defaults to searching {{PROJECT_NAME}}-project_memories
- Example: `/claude-os-search authentication implementation`
2. **`/claude-os-remember [content]`**
- Quick save to {{PROJECT_NAME}}-project_memories
- Auto-generates title and structure
- Use for quick insights and decisions
- Example: `/claude-os-remember Fixed bug in user controller by...`
3. **`/claude-os-save [title] [optional: KB name] [optional: category]`**
- Full-featured save with KB selection
- Choose specific KB and category
- Use when you need more control
- Example: `/claude-os-save "New Integration Pattern" {{PROJECT_NAME}}-project_profile Architecture`
4. **`/claude-os-list [optional: KB name]`**
- List all KBs or documents in a specific KB
- Example: `/claude-os-list` or `/claude-os-list {{PROJECT_NAME}}-project_memories`
5. **`/claude-os-session [action]`**
- Manage development sessions
- Actions: start, end, status, pause, resume
- Example: `/claude-os-session start "User authentication feature"`
6. **`/claude-os-triggers [action]`**
- Manage trigger phrases
- Example: `/claude-os-triggers list`
### Available Skills
1. **`initialize-project`** - Analyze project and generate coding standards
2. **`remember-this`** - Save insights to Claude OS knowledge bases
3. **`memory`** - Simple memory management
### MCP Tools (Direct API Access)
- `mcp__code-forge__search_knowledge_base` - Direct search
- `mcp__code-forge__list_knowledge_bases` - List all KBs
- `mcp__code-forge__list_documents` - List documents in KB
- `mcp__code-forge__get_kb_stats` - Get KB statistics
## Project-Specific Information
{{PROJECT_SPECIFIC_CONTENT}}
## Development Guidelines
{{DEVELOPMENT_GUIDELINES}}
## Common Development Tasks
{{COMMON_TASKS}}
## Key Business Rules
{{BUSINESS_RULES}}
## Coding Standards
See `.claude/CODING_STANDARDS.md` for detailed coding standards.
## Architecture
See `.claude/ARCHITECTURE.md` for system architecture overview.
## Development Practices
See `.claude/DEVELOPMENT_PRACTICES.md` for development workflow and practices.
## DO NOT
- Don't bypass established patterns without discussing first
- Don't skip tests
- Don't create features without searching memories for existing patterns
- Don't end a session without saving key learnings
## IMPORTANT: Project Context
This file (CLAUDE.md) is automatically loaded at the start of every Claude Code session. Keep it updated with:
- Important project context
- Current architecture decisions
- Team conventions
- Common gotchas
- Frequently referenced information
**Update this file as the project evolves!**