原始内容
LeCoder PAI
Personal AI Infrastructure - A customizable Claude Code enhancement system.
Quick Start
# Clone the repository
git clone https://github.com/YOUR_USERNAME/lecoder-pai.git
cd lecoder-pai
# Run setup
./setup.sh
What is LeCoder PAI?
LeCoder PAI enhances Claude Code with:
- Custom Hooks - Lifecycle hooks for session management, security, and logging
- Skills System - Modular skills that extend Claude's capabilities
- Agent Definitions - Pre-configured agent types for specialized tasks
- Statusline - Rich status display showing session info, system stats, and more
- Security Validator - Pre-execution validation for bash commands
Directory Structure
.claude/
├── Hooks/ # Session lifecycle hooks
│ ├── lib/ # Shared hook utilities
│ ├── security-validator.ts
│ ├── capture-all-events.ts
│ └── ...
├── Skills/ # Skill definitions
│ └── CORE/ # Core skill (auto-loaded)
├── Agents/ # Agent type definitions
├── Commands/ # Custom commands
├── Tools/ # Setup and utility tools
├── settings.json # Main configuration
└── statusline-command.sh # Status display script
Configuration
LeCoder PAI is designed to be portable and robust.
Dynamic Paths
The configuration uses ${HOME} to dynamically resolve your home directory. This ensures the setup works seamlessly across macOS, Linux (including Raspberry Pi), and other Unix-like systems without hardcoding absolute paths.
- Config Location:
~/.claude - Settings:
~/.claude/settings.json
Automatic Log Cleanup
To keep your system clean and storage usage low, LeCoder PAI includes an automatic log cleanup hook.
- What it does: Automatically deletes log files older than 7 days.
- When it runs: At the start of every session (
SessionStart). - Location:
.claude/Hooks/cleanup-logs.ts
Installation
Run the setup script to install PAI to your home directory:
./setup.sh
Setup
After installation, your settings are in ~/.claude/settings.json:
{
"env": {
"PAI_DIR": "/path/to/your/.claude",
"DA": "LeCoder" // Your assistant's name
}
}
Hooks
LeCoder PAI uses Claude Code's hook system:
| Hook | Purpose |
|---|---|
| SessionStart | Initialize session, load CORE context |
| PreToolUse | Security validation for Bash commands |
| PostToolUse | Event logging, tab title updates |
| Stop | Cleanup and session summary |
Customization
Change Assistant Name
Edit ~/.claude/settings.json:
"DA": "YourAssistantName"
Add Custom Skills
Create a new directory in ~/.claude/Skills/YourSkill/ with a SKILL.md file.
Requirements
- Claude Code 2.0+
- Bun (for TypeScript hooks)
- macOS or Linux
License
MIT