Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions roo-skills/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Roo Skills for Kaizen

This directory contains agent-compatible skills and custom modes for the Kaizen learning system.

## Quick Install

To install all skills and modes:

```bash
./roo-skills/install.sh [target_dir]
```

The script can be run from anywhere in the project. If no `target_dir` is provided, it defaults to `.bob`.

## What Gets Installed

### Skills
- **kaizen-learn**: Extract and save learnings from completed tasks
- **kaizen-recall**: Retrieve relevant guidelines before starting tasks

### Custom Modes
- **kaizen-lite**: A learning mode that automatically recalls guidelines at the start and saves learnings at the end of every task

## Installation Details

The `install.sh` script:
1. Copies all skill directories from `roo-skills/` to the `skills/` subdirectory in your target
2. Merges `.roomodes` into `custom_modes.yaml` (preserving your existing custom modes)
3. Creates timestamped backups of existing files in the target directory
4. Verifies the installation

### After Installation

1. **Restart your agent** to load the new skills and modes
2. **Verify** skills appear in the skill menu
3. **Test** the kaizen-lite mode

## Directory Structure

```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to fenced code block.

Per markdownlint MD040, fenced code blocks should have a language specified.

📝 Proposed fix
-```
+```text
 roo-skills/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@roo-skills/README.md` at line 40, The fenced code block in README.md is
missing a language specifier; update the opening fence from ``` to ```text
(i.e., change the triple backticks that wrap the "roo-skills/" snippet to
include the language specifier "text") so the block complies with markdownlint
MD040.

roo-skills/
├── install.sh # Installation script
├── .roomodes # Custom modes configuration
├── kaizen-learn/ # Learning skill
│ ├── SKILL.md
│ └── scripts/
│ └── save.py
└── kaizen-recall/ # Recall skill
├── SKILL.md
└── scripts/
└── get.py
```

## Usage

### Kaizen-Recall Skill

Retrieve guidelines before starting a task:

```bash
python3 .bob/skills/kaizen-recall/scripts/get.py --type guideline --task "your task description"
```

### Kaizen-Learn Skill

Save learnings after completing a task:

```bash
printf '{"entities": [...]}' | python3 .bob/skills/kaizen-learn/scripts/save.py
```

See individual SKILL.md files for detailed usage instructions.

## Kaizen-Lite Mode

The kaizen-lite mode enforces a mandatory workflow:

1. **Recall**: Retrieve guidelines at the start
2. **Work**: Complete the user's request
3. **Learn**: Save learnings before completion

This ensures continuous improvement through every interaction.

## Backup Files

The installation script creates timestamped backups:
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to fenced code block.

Per markdownlint MD040, fenced code blocks should have a language specified.

📝 Proposed fix
-```
+```text
 .bob/custom_modes.yaml.backup.YYYYMMDD_HHMMSS
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 87-87: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@roo-skills/README.md` at line 87, The fenced code block containing the
literal ".bob/custom_modes.yaml.backup.YYYYMMDD_HHMMSS" in README.md is missing
a language specifier; update the opening fence to include a language (e.g., use
```text) so the block becomes a fenced code block with a language specifier to
satisfy markdownlint MD040.

.bob/custom_modes.yaml.backup.YYYYMMDD_HHMMSS
```

To restore from a backup:
```bash
cp .bob/custom_modes.yaml.backup.YYYYMMDD_HHMMSS .bob/custom_modes.yaml
```

## Development

To add new skills:
1. Create a new directory in `roo-skills/`
2. Add a `SKILL.md` file describing the skill
3. Add any scripts in a `scripts/` subdirectory
4. Run `./roo-skills/install.sh` to install

## Related Documentation

- [Kaizen Main README](../README.md)
- [Kaizen CLI Documentation](../CLI.md)
- [Kaizen Configuration](../CONFIGURATION.md)
189 changes: 189 additions & 0 deletions roo-skills/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
#!/usr/bin/env bash
# install.sh
# Automatically install Kaizen skills and modes from roo-skills to Bob
# Usage: Run from anywhere in the project: ./roo-skills/install.sh [target_dir]
# Example: ./roo-skills/install.sh .custom-dir

set -e # Exit on error

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Get script directory (roo-skills) and project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

# Define paths
ROO_SKILLS_DIR="$SCRIPT_DIR"
TARGET_DIR="${1:-$PROJECT_ROOT/.bob}"
TARGET_SKILLS_DIR="$TARGET_DIR/skills"
ROO_MODES_FILE="$ROO_SKILLS_DIR/.roomodes"
TARGET_MODES_FILE="$TARGET_DIR/custom_modes.yaml"

echo -e "${BLUE}=== Kaizen Skills Installer ===${NC}\n"

# Check if roo-skills directory exists
if [ ! -d "$ROO_SKILLS_DIR" ]; then
echo -e "${RED}Error: roo-skills directory not found at $ROO_SKILLS_DIR${NC}"
exit 1
fi

# Create target skills directory if it doesn't exist
if [ ! -d "$TARGET_SKILLS_DIR" ]; then
echo -e "${YELLOW}Creating $TARGET_SKILLS_DIR directory...${NC}"
mkdir -p "$TARGET_SKILLS_DIR"
fi

# Function to copy a skill
copy_skill() {
local skill_name=$1
local source_dir="$ROO_SKILLS_DIR/$skill_name"
local dest_dir="$TARGET_SKILLS_DIR/$skill_name"

if [ ! -d "$source_dir" ]; then
echo -e "${YELLOW}Warning: Skill '$skill_name' not found in roo-skills, skipping...${NC}"
return 1
fi

echo -e "${BLUE}Installing skill: $skill_name${NC}"

# Remove existing skill directory if it exists
if [ -d "$dest_dir" ]; then
echo -e "${YELLOW} Removing existing $skill_name...${NC}"
rm -rf "$dest_dir"
fi

# Copy the skill
cp -r "$source_dir" "$dest_dir"
echo -e "${GREEN} ✓ Installed $skill_name${NC}"

return 0
}

# Install skills
echo -e "\n${BLUE}Step 1: Installing skills...${NC}"
SKILLS_INSTALLED=0
SKILLS_FAILED=0

for skill_dir in "$ROO_SKILLS_DIR"/*; do
if [ -d "$skill_dir" ] && [ "$(basename "$skill_dir")" != ".roomodes" ]; then
skill_name=$(basename "$skill_dir")
if copy_skill "$skill_name"; then
((SKILLS_INSTALLED++))
else
((SKILLS_FAILED++))
fi
fi
done

echo -e "\n${GREEN}Installed $SKILLS_INSTALLED skill(s)${NC}"
if [ $SKILLS_FAILED -gt 0 ]; then
echo -e "${YELLOW}Failed to install $SKILLS_FAILED skill(s)${NC}"
fi
Comment on lines +72 to +86

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Bug: Post-increment with set -e causes premature script exit.

With set -e enabled, ((SKILLS_INSTALLED++)) will terminate the script on the first successful skill installation. The post-increment operator evaluates to the old value (0), causing ((...)) to return exit code 1.

Same issue affects ((SKILLS_FAILED++)) on line 78.

🐛 Proposed fix using || true to suppress exit code
     if copy_skill "$skill_name"; then
-            ((SKILLS_INSTALLED++))
+            ((SKILLS_INSTALLED++)) || true
         else
-            ((SKILLS_FAILED++))
+            ((SKILLS_FAILED++)) || true
         fi

Alternatively, use SKILLS_INSTALLED=$((SKILLS_INSTALLED + 1)) which assigns to a variable and doesn't trigger set -e.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for skill_dir in "$ROO_SKILLS_DIR"/*; do
if [ -d "$skill_dir" ] && [ "$(basename "$skill_dir")" != ".roomodes" ]; then
skill_name=$(basename "$skill_dir")
if copy_skill "$skill_name"; then
((SKILLS_INSTALLED++))
else
((SKILLS_FAILED++))
fi
fi
done
echo -e "\n${GREEN}Installed $SKILLS_INSTALLED skill(s)${NC}"
if [ $SKILLS_FAILED -gt 0 ]; then
echo -e "${YELLOW}Failed to install $SKILLS_FAILED skill(s)${NC}"
fi
for skill_dir in "$ROO_SKILLS_DIR"/*; do
if [ -d "$skill_dir" ] && [ "$(basename "$skill_dir")" != ".roomodes" ]; then
skill_name=$(basename "$skill_dir")
if copy_skill "$skill_name"; then
((SKILLS_INSTALLED++)) || true
else
((SKILLS_FAILED++)) || true
fi
fi
done
echo -e "\n${GREEN}Installed $SKILLS_INSTALLED skill(s)${NC}"
if [ $SKILLS_FAILED -gt 0 ]; then
echo -e "${YELLOW}Failed to install $SKILLS_FAILED skill(s)${NC}"
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@roo-skills/install.sh` around lines 72 - 86, The post-increment arithmetic
((SKILLS_INSTALLED++)) and ((SKILLS_FAILED++)) inside the install loop can
return a non-zero status under set -e and abort the script; replace those
increments with safe arithmetic assignments (e.g.,
SKILLS_INSTALLED=$((SKILLS_INSTALLED + 1)) and SKILLS_FAILED=$((SKILLS_FAILED +
1))) in the block that handles copy_skill results inside the for loop so the
counters increment without producing a failing exit code.


# Install/update custom modes
echo -e "\n${BLUE}Step 2: Installing custom modes...${NC}"

if [ ! -f "$ROO_MODES_FILE" ]; then
echo -e "${YELLOW}Warning: .roomodes file not found at $ROO_MODES_FILE${NC}"
echo -e "${YELLOW}Skipping modes installation...${NC}"
else
echo -e "${BLUE} Merging modes (preserving your existing modes)...${NC}"

# Backup existing file if it exists
if [ -f "$TARGET_MODES_FILE" ]; then
backup_file="$TARGET_MODES_FILE.backup.$(date +%Y%m%d_%H%M%S)"
echo -e "${YELLOW} Backing up existing custom_modes.yaml to $(basename "$backup_file")${NC}"
cp "$TARGET_MODES_FILE" "$backup_file"

# Extract kaizen-lite mode from .roomodes
echo -e "${BLUE} Extracting kaizen-lite mode...${NC}"

# Create temp file with new kaizen-lite mode
temp_new_mode=$(mktemp)
awk '/^ - slug: kaizen-lite/ {f=1} /^ - slug:/ && !/kaizen-lite/ {f=0} f' "$ROO_MODES_FILE" > "$temp_new_mode"

# Check if kaizen-lite already exists in custom_modes.yaml
if grep -q "slug: kaizen-lite" "$TARGET_MODES_FILE"; then
echo -e "${BLUE} Updating existing kaizen-lite mode...${NC}"
# Remove old kaizen-lite mode and add new one
temp_output=$(mktemp)

# Copy everything before kaizen-lite
awk '/^ - slug: kaizen-lite/{exit} {print}' "$TARGET_MODES_FILE" > "$temp_output"

# Add new kaizen-lite mode
cat "$temp_new_mode" >> "$temp_output"

# Add everything after old kaizen-lite (skip to next mode or end)
awk '/^ - slug: kaizen-lite/ {f=1; next} f && /^ - slug:/ {p=1; f=0} p' "$TARGET_MODES_FILE" >> "$temp_output"

mv "$temp_output" "$TARGET_MODES_FILE"
else
echo -e "${BLUE} Adding new kaizen-lite mode...${NC}"
# Just append the new mode
cat "$temp_new_mode" >> "$TARGET_MODES_FILE"
fi

rm "$temp_new_mode"
echo -e "${GREEN} ✓ Successfully merged modes${NC}"
else
# No existing file, just copy
echo -e "${BLUE} Creating new custom_modes.yaml...${NC}"
cp "$ROO_MODES_FILE" "$TARGET_MODES_FILE"
echo -e "${GREEN} ✓ Installed custom_modes.yaml${NC}"
fi
fi

# Verify installation
echo -e "\n${BLUE}Step 3: Verifying installation...${NC}"

# Check skills
echo -e "\n${BLUE}Installed skills in target directory:${NC}"
if [ -d "$TARGET_SKILLS_DIR" ]; then
for skill_dir in "$TARGET_SKILLS_DIR"/*; do
if [ -d "$skill_dir" ]; then
skill_name=$(basename "$skill_dir")
echo -e " ${GREEN}✓${NC} $skill_name"

# Check for SKILL.md
if [ -f "$skill_dir/SKILL.md" ]; then
echo -e " - SKILL.md found"
else
echo -e " ${YELLOW}- Warning: SKILL.md not found${NC}"
fi

# Check for scripts directory
if [ -d "$skill_dir/scripts" ]; then
script_count=$(find "$skill_dir/scripts" -type f -name "*.py" | wc -l)
echo -e " - $script_count Python script(s) found"
fi
fi
done
else
echo -e "${RED}Error: .bob/skills directory not found${NC}"
fi

# Check modes file
echo -e "\n${BLUE}Custom modes file:${NC}"
if [ -f "$TARGET_MODES_FILE" ]; then
echo -e " ${GREEN}✓${NC} custom_modes.yaml exists"
mode_count=$(grep -c "slug:" "$TARGET_MODES_FILE" || echo "0")
echo -e " - $mode_count mode(s) defined"
else
echo -e " ${RED}✗${NC} custom_modes.yaml not found"
fi

# Summary
echo -e "\n${GREEN}=== Installation Complete ===${NC}"
echo -e "${BLUE}Next steps:${NC}"
echo -e " 1. Restart your agent to load the new skills and modes"
echo -e " 2. Verify skills are available in the skill menu"
echo -e " 3. Test the kaizen-lite mode"
echo -e "\n${YELLOW}Note: If you made manual changes to custom_modes.yaml, check the backup file.${NC}"

# Made with Bob
Loading